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): Implement LimitedIntervalsTree and MaxEncodedLen for JournalNote #4466

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

playX18
Copy link
Member

@playX18 playX18 commented Jan 24, 2025

Changes

  • Added new type to core: LimitedIntervalsTree which is based on IntervalsTree but checks limits before inserting intervals. It implements MaxEncodedLen
  • Added type-alias WasmPagesIntervalsTree which is LimitedIntervalsTree<WasmPage, PayloadSizeError, u16::MAX/2+1>.
  • Changed most of the code to use WasmPagesIntervalsTree instead of unlimited IntervalsTree
  • Implemented MaxEncodedLen for JournalNote
  • Test that JournalNote, when encoded is less than 32MiB in size
  • Changed LimitedVec formatting implementation to include two new traits for limited formatting instead of requiring T to be where [T]: AsRef<[u8]>: this allows us to debug/display LimitedVec with any T that implements corresponding trait.

Notes

  • Program storage was not updated, migration to migrate from IntervalsTree can be a separate PR. Only public APIs were updated to convert IntervalsTree to LimitedIntervalTree.

@breathx

…JournalNote

- Added new type to core: `LimitedIntervalsTree` which is based on `IntervalsTree` but checks limits before inserting intervals. It implements `MaxEncodedLen`
- Added type-alias `WasmPagesIntervalsTree` which is `LimitedIntervalsTree<WasmPage, PayloadSizeError, u16::MAX/2+1>`.
- Changed most of the code to use `WasmPagesIntervalsTree` instead of unlimited `IntervalsTree`
- Implemented MaxEncodedLen for `JournalNote`
- Test that `JournalNote`, when encoded is less than 32MiB in size
@playX18 playX18 added the A0-pleasereview PR is ready to be reviewed by the team label Jan 24, 2025
@playX18 playX18 self-assigned this Jan 24, 2025
@playX18 playX18 changed the title refactor(core): Implement LimitedIntervalsTree and MaxEncodedLen for … refactor(core): Implement LimitedIntervalsTree and MaxEncodedLen for JournalNote Jan 24, 2025
@playX18 playX18 added A1-inprogress Issue is in progress or PR draft is not ready to be reviewed and removed A0-pleasereview PR is ready to be reviewed by the team labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A1-inprogress Issue is in progress or PR draft is not ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant