Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): apply numerated to pages #3861

Merged
merged 27 commits into from
Apr 16, 2024
Merged

refactor(core): apply numerated to pages #3861

merged 27 commits into from
Apr 16, 2024

Conversation

grishasobol
Copy link
Member

Fixes #3830
Related PR: #3791

Make pages refactoring:

  1. Split pages implementation for gear-core and gear-lazy-pages to increase safety.
  2. Append Numerated implementation for gear and wasm pages in gear-code and gear-lazy-pages.
  3. Now WasmPage and GearPage are just type names over Page<SIZE>.
  4. Append new struct PagesAmount<SIZE>, which should be considered as possible wasm or gear pages amount. In comparison PagesAmount<SIZE> max value is bigger than Page<SIZE> max value, because indexes amount is always bigger than max possible index, if indexes start from 0.
  5. Alloc algorithm is slightly changed in order to suit for new pages implementation.
  6. Append lots of tests for pages.

Apply IntervalsTree for gear-lazy-pages in order to simplify work with sets of pages and show how to work with tree.
NOTE: IntervalsTree is NOT applied to gear-core in order to split big changes in code in one PR: migration, benchmarks changes and changes in runtime code.

@grishasobol grishasobol self-assigned this Apr 3, 2024
@grishasobol grishasobol changed the title apply numerated to pages refactor(core): apply numerated to pages Apr 3, 2024
@grishasobol grishasobol added the A0-pleasereview PR is ready to be reviewed by the team label Apr 3, 2024
@grishasobol grishasobol added E2-forcemacos Force CI to run macOS build in PR E1-forcenatwin Force CI to run native Windows build in PR labels Apr 4, 2024
@grishasobol grishasobol removed the E1-forcenatwin Force CI to run native Windows build in PR label Apr 4, 2024
Copy link
Member

@breathx breathx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So huge refactoring
But in the end most parts of the code looks much better. GJ!

common/numerated/src/numerated.rs Outdated Show resolved Hide resolved
common/src/benchmarking.rs Show resolved Hide resolved
core/src/code/errors.rs Show resolved Hide resolved
core/src/memory.rs Show resolved Hide resolved
core/src/memory.rs Outdated Show resolved Hide resolved
core/src/pages.rs Outdated Show resolved Hide resolved
common/src/paused_program_storage.rs Show resolved Hide resolved
lazy-pages/src/common.rs Show resolved Hide resolved
lazy-pages/src/common.rs Show resolved Hide resolved
@breathx
Copy link
Member

breathx commented Apr 9, 2024

I guess it won't be excess to check this PR on validators so we're 100% sure that no compatibility broken and nothing is differ from current impl

@breathx
Copy link
Member

breathx commented Apr 12, 2024

@ark0f please review

pallets/gear/src/lib.rs Outdated Show resolved Hide resolved
core-backend/src/mock.rs Outdated Show resolved Hide resolved
core/src/pages.rs Outdated Show resolved Hide resolved
gclient/src/api/calls.rs Show resolved Hide resolved
core/src/pages.rs Show resolved Hide resolved
core/src/memory.rs Outdated Show resolved Hide resolved
pallets/gear/src/benchmarking/mod.rs Show resolved Hide resolved
@grishasobol
Copy link
Member Author

I guess it won't be excess to check this PR on validators so we're 100% sure that no compatibility broken and nothing is differ from current impl

Testnet and Mainnet was successfully full synced

@grishasobol grishasobol merged commit b5375f2 into master Apr 16, 2024
11 checks passed
@grishasobol grishasobol deleted the gsobol-pages branch April 16, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-pleasereview PR is ready to be reviewed by the team E2-forcemacos Force CI to run macOS build in PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use Interval instead of Range in free_range
3 participants