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

feat: use raw_value instead of arbitrary_precision #418

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

xJonathanLEI
Copy link
Owner

The arbitrary_precision feature from serde_json is used mostly because of how the Cairo 0 artifact represents big numbers in raw number format instead of string. Without this feature enabled the correct class hash could not be obtained.

However, the implementation of this feature is problematic and has been causing issues. Switching to raw_value wouldn't resolve those as raw_value suffers from the very same issues as arbitrary_precision. What's less bad about raw_value is that using it is opt-in - it doesn't pollute number decoding like arbitrary_precision does. This is important due to how Cargo resolves dependencies - dependants of this library might be forced to enable the serde_json feature.

Resolves #394.

The `arbitrary_precision` feature from `serde_json` is used mostly
because of how the Cairo 0 artifact represents big numbers in raw number
format instead of string. Without this feature enabled the correct class
hash could not be obtained.

However, the implementation of this feature is problematic and has
been causing issues. Switching to `raw_value` wouldn't resolve those as
`raw_value` suffers from the very same issues as `arbitrary_precision`.
What's less bad about `raw_value` is that using it is opt-in - it
doesn't pollute number decoding like `arbitrary_precision` does. This
is important due to how Cargo resolves dependencies - dependants of this
library might be forced to enable the `serde_json` feature.
@xJonathanLEI xJonathanLEI merged commit c5cf196 into master Jun 30, 2023
23 checks passed
@xJonathanLEI xJonathanLEI deleted the dev/no_arbitrary_precision branch June 30, 2023 06:00
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.

starknet-core dependency serde_json arbitrary precision feature flag
1 participant