-
Notifications
You must be signed in to change notification settings - Fork 55
Fix/storage sol #179
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
Merged
Merged
Fix/storage sol #179
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add PrimitiveCodec implementations for Uint, Signed, and FixedBytes types from alloy_primitives. Also add support for Rust primitive signed integers (i8-i128) and u128/usize. Remove redundant MapKey implementations for signed integers as they're now covered by the generic PrimitiveCodec impl. - Implement PrimitiveCodec for Uint<BITS, LIMBS> (8-256 bits) - Implement PrimitiveCodec for Signed<BITS, LIMBS> (8-256 bits) - Implement PrimitiveCodec for FixedBytes<N> (1-32 bytes) - Add support for Rust primitive types: i8-i128, u128, usize, isize - Add comprehensive test coverage for all new types
Refactor storage module to simplify the API and remove unnecessary type bounds. Major breaking changes to constants, traits, and vector operations to provide a cleaner and more ergonomic interface for storage operations. - Rename StorageLayout constants: REQUIRED_SLOTS to SLOTS, ENCODED_SIZE to BYTES - Rename PrimitiveCodec trait to PackableCodec for clarity - Remove composite module and integrate functionality directly - Add manual Copy/Clone implementations to avoid unnecessary T: Copy bounds - Change vector API: push/pop to grow/shrink for complex types - Add specialized push/pop methods for vectors of primitive types
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactor Storage System to Solidity-Compatible Layout
Summary
This PR completely refactors the storage system to provide a more ergonomic, type-safe API while maintaining full Solidity storage layout compatibility.
Key Changes
API Improvements
solidity_storage!macro with#[derive(Storage)]for better IDE support and Rust idiomsStorageU256,StorageAddress,StorageMap, etc.)Technical Enhancements
Migration Impact
Breaking Changes
solidity_storage!macro is deprecatedself.balance_accessor())Storage*wrappersExample