Skip to content
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

Merged

Conversation

zajko
Copy link
Contributor

@zajko zajko commented May 8, 2024

…d more unit tests for the 2.x to 1.x translation process

}

pub fn block_v1_no_deploys_no_era() -> BlockV1 {
let mut val = serde_json::from_str::<Value>(BLOCK_BODY_V1_ALL_DATA).unwrap();
Copy link
Contributor Author

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

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

Copy link
Contributor Author

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
Copy link
Contributor Author

@zajko zajko May 8, 2024

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.

@zajko zajko force-pushed the legacy_filters_codefixes_and_testfixes branch from da421e8 to 16aeb1e Compare May 8, 2024 14:11
…d more unit tests for the 2.x to 1.x translation process
@zajko zajko force-pushed the legacy_filters_codefixes_and_testfixes branch from 16aeb1e to 6c76135 Compare May 8, 2024 14:57
Comment on lines 51 to 52
let escaped = format!("\"{}\"", arg);
serde_json::from_str(&escaped).unwrap()
Copy link

@jacek-casper jacek-casper May 9, 2024

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

Suggested change
let escaped = format!("\"{}\"", arg);
serde_json::from_str(&escaped).unwrap()
serde_json::from_value(serde_json::Value::String(arg)).unwrap()

@jacek-casper
Copy link

left some minor comments... other than that lgtm

Copy link

@rafal-ch rafal-ch left a 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.

event_sidecar/src/event_stream_server/tests.rs Outdated Show resolved Hide resolved
LEGACY_SSE_EMULATION.md Outdated Show resolved Hide resolved
LEGACY_SSE_EMULATION.md Outdated Show resolved Hide resolved
LEGACY_SSE_EMULATION.md Outdated Show resolved Hide resolved
LEGACY_SSE_EMULATION.md Outdated Show resolved Hide resolved
LEGACY_SSE_EMULATION.md Outdated Show resolved Hide resolved
LEGACY_SSE_EMULATION.md Outdated Show resolved Hide resolved
LEGACY_SSE_EMULATION.md Outdated Show resolved Hide resolved
@zajko zajko merged commit 0cba5c9 into casper-network:feat-2.0 May 14, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants