-
Notifications
You must be signed in to change notification settings - Fork 37
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
fix(wasm-dpp): serialization bugs and failing tests #1030
Conversation
...ges/wasm-dpp/src/state_transition/validation/validate_state_transition_identity_signature.rs
Show resolved
Hide resolved
...test/unit/stateTransition/validation/validateStateTransitionIdentitySignatureFactory.spec.js
Show resolved
Hide resolved
@@ -68,6 +74,47 @@ pub struct ExtendedDocument { | |||
pub entropy: Bytes32, | |||
} | |||
|
|||
impl Encode for ExtendedDocument { | |||
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError> { |
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'm not sure how it works - is the data being written to the encoder directly and then something like encoder.finalize()
is called?
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.
Well yes, when you derive Encode it takes every attribute and encodes them and puts them back to back, but you don't need to derive, you can do things manually.
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'm more interested in how the API works. For example, if you want to serialize something to a vec, you write something like let encoded: Vec<u8> = bincode::serialize(&doc).unwrap();
, and then bincode figures out the encoder internally? I'm not really familiar with the barcode just yet, so I was wondering if my assumption is right
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.
This is not exactly a comment to this specific code, just figured that this is the place I can ask about it as well :)
Issue being fixed or feature implemented
Fixed wasm logic and tests to reflect latest rs-dpp updates
What was done?
toBuffer
methods to usePlatformSerializable
fromBuffer
methods of factories to usePlatformSerializable
decodeProtocolEntity
tests and commented codeHow Has This Been Tested?
Breaking Changes
toBuffer now returns bincode instead of cbor
Checklist:
For repository code-owners and collaborators only