Skip to content

feat: preserve class abi#356

Merged
kariy merged 3 commits intomainfrom
feat/preserve-abi-str
Nov 13, 2025
Merged

feat: preserve class abi#356
kariy merged 3 commits intomainfrom
feat/preserve-abi-str

Conversation

@kariy
Copy link
Member

@kariy kariy commented Nov 13, 2025

the abi field in rpc format for the contract class can be an arbitrary string. this is what the jsonrps spec says:

   "abi": {
            "title": "ABI",
            "type": "string",
            "description": "The class ABI, as supplied by the user declaring the class"
          }

currently, if the rpc abi string can't be converted into the ContractAbi type, it will fail during the deserialization phase. the abi string must be preserved as well because it's part of the class hash computation. so we need to preserve the raw string even if it's just some random string.

Starknet class with arbitrary abi string: 0x22b7d06d355ddb1c485ec9cc09b488e77e63318db8833104aed56d598416417 where the abi string returned by the RPC is literally this "Declared from starknet-rs test case. Timestamp (ms): 1709974545243".

superseded #353 .

this change also include a database version bump ( 7 -> 8 ) because of the change made to the value type of the Classes table i.e., the katana_primitives::class::ContractClass enum.

@kariy kariy marked this pull request as ready for review November 13, 2025 01:17
@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 78.43137% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.96%. Comparing base (9bde0ae) to head (5a0549d).
⚠️ Report is 183 commits behind head on main.

Files with missing lines Patch % Lines
crates/primitives/src/class.rs 70.00% 15 Missing ⚠️
...rates/storage/db/src/models/versioned/class/mod.rs 50.00% 15 Missing ⚠️
crates/rpc/rpc-types/src/class.rs 94.00% 6 Missing ⚠️
crates/storage/db/src/models/versioned/class/v7.rs 0.00% 6 Missing ⚠️
...rage/provider/provider/src/providers/fork/state.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #356      +/-   ##
==========================================
+ Coverage   73.32%   74.96%   +1.64%     
==========================================
  Files         209      250      +41     
  Lines       23132    30234    +7102     
==========================================
+ Hits        16961    22666    +5705     
- Misses       6171     7568    +1397     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kariy kariy merged commit 92196ed into main Nov 13, 2025
11 checks passed
@kariy kariy deleted the feat/preserve-abi-str branch November 13, 2025 03:40
chudkowsky pushed a commit that referenced this pull request Nov 18, 2025
the `abi` field in rpc format for the contract class can be an arbitrary string. this is what the jsonrps [spec] says:

```json
   "abi": {
            "title": "ABI",
            "type": "string",
            "description": "The class ABI, as supplied by the user declaring the class"
          }
```

currently, if the rpc abi string can't be converted into the `ContractAbi` type, it will fail during the deserialization phase. the abi string must be preserved as well because it's part of the class hash computation. so we need to preserve the raw string even if it's just some random string.

Starknet class with arbitrary abi string: `0x22b7d06d355ddb1c485ec9cc09b488e77e63318db8833104aed56d598416417` where the abi string returned by the RPC is literally this `"Declared from starknet-rs test case. Timestamp (ms): 1709974545243"`.

superseded #353 .

this change also include a database version bump ( 7 -> 8 ) because of the change made to the value type of the `Classes` table i.e., the `katana_primitives::class::ContractClass` enum.

[spec]:
https://github.com/starkware-libs/starknet-specs/blob/c2e93098b9c2ca0423b7f4d15b201f52f22d8c36/api/starknet_api_openrpc.json#L3215C8-L3219C12
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.

1 participant