-
Notifications
You must be signed in to change notification settings - Fork 71
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
feat: struct packing #503
feat: struct packing #503
Conversation
timestamps_and_finalization_status: u128, // In order: start, min, max, finalization_status | ||
execution_payload_hash: felt252, | ||
execution_strategy: ContractAddress, | ||
author: UserAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annoying that the UserAddress
adds storage overhead. one solution could be to store a felt252
hash of it that we then compute when neeeded. probably unnecessary complexity though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, most of the time the UserAddress
will be ethereum / starknet and will felt in a single felt so the storage will not move (will stay 0) so i don't think it will cost that much?
active_voting_strategies: u256, | ||
} | ||
|
||
impl ProposalStorePacking of StorePacking<Proposal, PackedProposal> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really like cairo's approach to packing. super clean and efficient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah! agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one thing is make sure you #[derive(starknet::Store)]
and not #[derive(Store)]
. Found out the hard way...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uTACK
…eat_struct_packing
Implement struct packing (for Proposal, as the Storage struct will not be modified as much) using the
StorePacking
traitCloses #483