-
Notifications
You must be signed in to change notification settings - Fork 11
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
Added documentation for legacy translation. Fixed removed tests. Adde… #301
Added documentation for legacy translation. Fixed removed tests. Adde… #301
Conversation
} | ||
|
||
pub fn block_v1_no_deploys_no_era() -> BlockV1 { | ||
let mut val = serde_json::from_str::<Value>(BLOCK_BODY_V1_ALL_DATA).unwrap(); |
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 done through json deserialization because BlockBody* structures from casper-types don't offer new
functions and/or setters of their fields
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.
have you tried using TestBlockV1Builder
? I think it might simplify 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.
👍
@@ -201,7 +209,88 @@ mod tests { | |||
Some(TransformKindV1::WriteContractPackage), | |||
maybe_tanslate_stored_value(&stored_value) | |||
); | |||
//TODO wrtite tests for rest of cases |
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.
The structures behind new variants in StoredValue don't have random
implementations, and it's not clear how to construct some of these structs. So I gave up having 100% coverage here.
da421e8
to
16aeb1e
Compare
…d more unit tests for the 2.x to 1.x translation process
16aeb1e
to
6c76135
Compare
types/src/testing.rs
Outdated
let escaped = format!("\"{}\"", arg); | ||
serde_json::from_str(&escaped).unwrap() |
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 it'd probably be cleaner to use Value
here
let escaped = format!("\"{}\"", arg); | |
serde_json::from_str(&escaped).unwrap() | |
serde_json::from_value(serde_json::Value::String(arg)).unwrap() |
left some minor comments... other than that lgtm |
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.
LGTM 👍 with just a few nits.
…d more unit tests for the 2.x to 1.x translation process