starknet-rs icon indicating copy to clipboard operation
starknet-rs copied to clipboard

Legacy contract class corrupted when deserialized through `ContractArtifact`

Open xJonathanLEI opened this issue 2 years ago • 2 comments

Due to a scientific notation issue, certain legacy (Cairo 0) contract artifacts can be different when deserializing directly and through the ConrtractArtifact enum. This leads to class hash errors, and hence failures on contract declaration.

Details to be updated later. Creating this issue first so that it can be referenced from starkli.

xJonathanLEI avatar Jun 01 '23 06:06 xJonathanLEI

Looks like the switch to raw_value in https://github.com/xJonathanLEI/starknet-rs/commit/c5cf1967d44dd61fb68b36cefed710cc8518b1ab has made this worse. Previously only artifacts with values that can be converted to the scientific notation without precision loss are affected; now it looks like most artifacts are affected.

xJonathanLEI avatar Jul 03 '23 16:07 xJonathanLEI

Added a test case (that's disabled by default to avoid breaking CI) in #644, test_legacy_artifact_deser_from_contract_artifact, specifically to test this issue. A patch to this issue should be able to also remove the ignore attribute on that test case.

xJonathanLEI avatar Jul 29 '24 15:07 xJonathanLEI