-
Notifications
You must be signed in to change notification settings - Fork 324
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: using #[derive(Serialize)]
more
#11541
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ use dep::aztec::protocol_types::{ | |
MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS, REGISTERER_CONTRACT_CLASS_REGISTERED_MAGIC_VALUE, | ||
}, | ||
contract_class_id::ContractClassId, | ||
traits::Serialize, | ||
}; | ||
|
||
pub struct ContractClassRegistered { | ||
|
@@ -14,9 +13,12 @@ pub struct ContractClassRegistered { | |
packed_public_bytecode: [Field; MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS], | ||
} | ||
|
||
impl Serialize<MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS + 5> for ContractClassRegistered { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer using the Serialize trait here as it did not use intrinsic Noir serialization. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea this seems to be some event serialization given how they are adding the magic value at the beginning. We'll likely eventually replace this with |
||
fn serialize(self: Self) -> [Field; MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS + 5] { | ||
impl ContractClassRegistered { | ||
fn serialize_non_standard( | ||
self: Self, | ||
) -> [Field; MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS + 5] { | ||
let mut packed = [0; MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS + 5]; | ||
// Since we are not yet emitting selectors we'll use this magic value to identify events emitted by the ClassRegisterer. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copied this comment from constants.nr since I had no idea WTF is this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fine, it likely alludes to 'event emission' not really being a thing yet, and event selectors not being a formal concept. |
||
packed[0] = REGISTERER_CONTRACT_CLASS_REGISTERED_MAGIC_VALUE; | ||
packed[1] = self.contract_class_id.to_field(); | ||
packed[2] = self.version; | ||
|
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.
Do we want to spend time on tackling this or too low of a priority?
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.
No, it's good to tackle this. Very annoying that
derive
causes errors due to missing imports for things that are invisibly used.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.
Agree, will try to tackle it today