-
Notifications
You must be signed in to change notification settings - Fork 159
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
UnsignedMessage cbor encoding #174
Conversation
vm/message/src/unsigned_message.rs
Outdated
impl UnsignedMessage { | ||
pub fn builder() -> MessageBuilder { | ||
MessageBuilder::default() | ||
} | ||
} | ||
|
||
/// Structure defines how the fields are cbor encoded as an unsigned message | ||
#[derive(Serialize, Deserialize)] | ||
struct CborUnsignedMessage( |
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.
Should be public, ya?
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.
that was refactored 4 hours ago lol how did you even review that? And no, didn't need to be since it was just used in that file for consistent ser/de
@@ -7,20 +7,20 @@ use std::ops::Deref; | |||
|
|||
/// Method number indicator for calling actor methods | |||
#[derive(Default, Clone, Copy, PartialEq, Debug, Serialize, Deserialize)] | |||
pub struct MethodNum(i32); // TODO: add constraints to this | |||
pub struct MethodNum(u64); // TODO: add constraints to this |
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.
Should this not be an enum? Then you can impl the From traits to convert from a number type
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.
nah, needs to be an integer because methods vary based on actor and needs to be future proofed for when you can initialize own actor with custom code
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.
pls address comments
assert_eq!(enc_bz.as_slice(), expected); | ||
// Assert decoding from those bytes goes back to unsigned message | ||
assert_eq!( | ||
&from_slice::<UnsignedMessage>(expected).expect("Should be able to deserialize cbor bytes"), |
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.
Nit: all .expect
other than this one begins with a lowercase.
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 ya, is just used for easier test debugging instead of unwrapping. I made all consistent.
Match format with one defined in Lotus.
Once these are done I will open PR