-
Notifications
You must be signed in to change notification settings - Fork 8
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
Deserialize function in a Serde trait #264
Conversation
|
||
fn deserialize(data: [Field; ACCOUNT_WITHIN_BLOCK_SERIALIZED_LEN]) -> Self { | ||
let mut fragment = Fragment::new_focused(data); | ||
let account: Account = Account::deserialize(fragment.pop_front_array()); |
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.
It's worth explaining somewhere in the file why we need to call deserialise with type here (as opposite to case with BYTES32) and probably make an issue to noir out of it.
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.
noir-lang/noir#5005
Preparing repro for another one now
|
||
impl Serde<ACCOUNT_WITHIN_BLOCK_SERIALIZED_LEN> for AccountWithinBlock { | ||
fn serialize(self) -> [Field; ACCOUNT_WITHIN_BLOCK_SERIALIZED_LEN] { | ||
let mut data: Fragment<ACCOUNT_WITHIN_BLOCK_SERIALIZED_LEN, Field> = Fragment::empty(); |
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.
I think for serialization you can use BoundedVec
, no need for Fragment
. #BoundedVec
This PR is on top of #263
This PR adds a deserialize function in a Serde trait alongsize the serialize counterparty.
This allows us to pass complex values through oracle without hitting: noir-lang/noir#4561
Without it - I wasn't able to return our StorageWithinBlock struct from an Oracle