-
Notifications
You must be signed in to change notification settings - Fork 355
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
Use protobuf de helpers #515
Conversation
Add serialiation / deserialization traits to them
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.
Looks like nice cleanup
@@ -7,13 +9,13 @@ const WIRE_TYPE_LENGTH_DELIMITED: u8 = 2; | |||
// Up to 9 bytes of varints as a practical limit (https://github.com/multiformats/unsigned-varint#practical-maximum-of-9-bytes-for-security) | |||
const VARINT_MAX_BYTES: usize = 9; | |||
|
|||
#[derive(Clone, Debug, PartialEq)] | |||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] |
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.
Why do we serialize? (As JSON)
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 thought it would be useful.
We need to "binarize" these messages, not serialise them.
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. I prefer no json methods.
We can add method to protobuf serialise in the future. (which could be used in multitest for example).
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.
merging now, so I can start linking. feel free to clean up later.
@@ -856,11 +857,11 @@ pub fn parse_contract_addr(data: &Option<Binary>) -> AnyResult<Addr> { | |||
.ok_or_else(|| anyhow!("No data response"))? | |||
.to_vec(); | |||
// parse the protobuf struct | |||
let init_data = InstantiateData::decode(bin.as_slice())?; |
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.
Ah, this is the example I can link to. I guess it works.
Use protobuf helpers to deserialize response in wasm executor
instantiate_contract
.Also, add a couple extra useful methods, and publish structs so that they can be used directly.
Also, add deserialization / serialization traits to them.