Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Improve SierraContractClass ABI handling. #816

Open
SantiagoPittella opened this issue Jul 13, 2023 · 2 comments
Open

Improve SierraContractClass ABI handling. #816

SantiagoPittella opened this issue Jul 13, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@SantiagoPittella
Copy link
Member

I'm forwarding a message from @kkovaacs :
"starknet_in_rust uses the ContractClass type from cairo-lang-starknet when creating a Declare v2 transaction. Unfortunately the JSON representation for that type isn’t quite the same as the one used on Starknet.
The ABI is defined as a string on Starknet to avoid the issue of the class hash depending on the exact method of JSON-serializing the ABI data structure. However, the ContractClass type contains a parsed representation of the ABI which is then transformed back to string when starknet_in_rust is doing class hash calculation."
This leads to potencial hash mismatches.

Thanks @kkovaacs for the report.

@kkovaacs
Copy link
Contributor

FYI: it seems there are Sierra classes out there where ABI cannot even be parsed:

https://testnet-2.starkscan.co/class/0x04db025178e9b74b9eb51178860acd478362bc9b5a8f3fd63252b1d70b0dc0ad

I get a "missing field kind" error when trying to parse the JSON using serde into ContractClass.

@kkovaacs
Copy link
Contributor

Very easy to reproduce using the class in this comment: eqlabs/pathfinder#1208 (comment)

The starknet_estimateFee call fails with starknet_in_rust because the class hash miscalculation leads to an invalid transaction hash, which then fails signature check...

@juanbono juanbono added this to the 0.3.1 milestone Jul 18, 2023
@juanbono juanbono added the enhancement New feature or request label Jul 18, 2023
@juanbono juanbono moved this to Todo in Starknet Jul 18, 2023
@juanbono juanbono removed this from the 0.3.1 milestone Nov 13, 2023
@igaray igaray moved this from Todo to Backlog in Starknet Jan 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

3 participants