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

fix: avoid rounding in serializations #415

Merged
merged 1 commit into from
Jul 14, 2024
Merged

Conversation

yair-starkware
Copy link
Contributor

@yair-starkware yair-starkware commented Jul 9, 2024

This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.89%. Comparing base (7c08d83) to head (97f51d1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #415   +/-   ##
=======================================
  Coverage   82.89%   82.89%           
=======================================
  Files          37       37           
  Lines        1719     1719           
  Branches     1719     1719           
=======================================
  Hits         1425     1425           
  Misses        217      217           
  Partials       77       77           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yair-starkware yair-starkware force-pushed the yair/arbitrary_precision branch 2 times, most recently from 0ad54d5 to 8b2b64f Compare July 9, 2024 13:20
Copy link
Contributor

@Yael-Starkware Yael-Starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 12 of 12 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dafnamatsry and @yair-starkware)


crates/tests-integration/tests/end_to_end_test.rs line 35 at r1 (raw file):

    let deserialized = serde_json::to_string(&serialized).unwrap();
    assert_eq!(input, deserialized);
}

why duplicate the test?
consider adding a function to test utils with this logic.

Code quote:

fn serialization_precision() {
    let input =
        "{\"value\":244116128358498188146337218061232635775543270890529169229936851982759783745}";
    let serialized = serde_json::from_str::<serde_json::Value>(input).unwrap();
    let deserialized = serde_json::to_string(&serialized).unwrap();
    assert_eq!(input, deserialized);
}

Copy link
Contributor

@Yael-Starkware Yael-Starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)

Copy link
Collaborator

@dafnamatsry dafnamatsry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 12 of 12 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @yair-starkware)


crates/gateway/Cargo.toml line 26 at r1 (raw file):

reqwest.workspace = true
serde.workspace = true
serde_json = { workspace = true, features = ["arbitrary_precision"] }

Can it added in the workspace level?

Code quote:

features = ["arbitrary_precision"] }

Copy link
Contributor Author

@yair-starkware yair-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dafnamatsry)


crates/gateway/Cargo.toml line 26 at r1 (raw file):

Previously, dafnamatsry wrote…

Can it added in the workspace level?

Unfortunately no, it is an open issue: rust-lang/cargo#4463


crates/tests-integration/tests/end_to_end_test.rs line 35 at r1 (raw file):

Previously, Yael-Starkware (YaelD) wrote…

why duplicate the test?
consider adding a function to test utils with this logic.

We need this test in each crate that uses serde_json

Copy link
Collaborator

@dafnamatsry dafnamatsry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @yair-starkware)


crates/gateway/Cargo.toml line 26 at r1 (raw file):

Previously, yair-starkware (Yair) wrote…

Unfortunately no, it is an open issue: rust-lang/cargo#4463

Not sure I totally understand the issue.
According to the documentation (https://doc.rust-lang.org/cargo/reference/features.html#feature-unification and https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table) feature selection is additive.

Copy link
Contributor

@Yael-Starkware Yael-Starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @yair-starkware)


crates/tests-integration/tests/end_to_end_test.rs line 35 at r1 (raw file):

Previously, yair-starkware (Yair) wrote…

We need this test in each crate that uses serde_json

yes I undestood that eventually by myself, thought I retracted this comment

@yair-starkware yair-starkware force-pushed the yair/arbitrary_precision branch from 8b2b64f to 7299be1 Compare July 11, 2024 11:53
Copy link
Contributor Author

@yair-starkware yair-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 13 files reviewed, 1 unresolved discussion (waiting on @dafnamatsry and @Yael-Starkware)


crates/gateway/Cargo.toml line 26 at r1 (raw file):

Previously, dafnamatsry wrote…

Not sure I totally understand the issue.
According to the documentation (https://doc.rust-lang.org/cargo/reference/features.html#feature-unification and https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table) feature selection is additive.

Oh I think it's new.
We had a problem with this in Papyrus.

Copy link
Collaborator

@dafnamatsry dafnamatsry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 13 of 13 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)

@yair-starkware yair-starkware merged commit a5f6540 into main Jul 14, 2024
8 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.

4 participants