fix: serialize accessList storageKeys in camelCase per Ethereum JSON-RPC spec#51
Open
ionodeionode wants to merge 1 commit intoopentensor:masterfrom
Open
Conversation
…RPC spec The ethereum crate's AccessListItem serializes storage_keys in snake_case, but the Ethereum JSON-RPC specification requires camelCase (storageKeys). This breaks indexers and tooling that validate against the spec (e.g., subsquid). Add a custom serializer wrapper (AccessListItemCamelCase) for the Transaction struct's access_list field to ensure storageKeys is serialized in the correct camelCase format. The rpc-v2 types already have their own AccessListItem with the correct rename_all = camelCase attribute, so only rpc-core is affected. Fixes opentensor/subtensor#2143
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes opentensor/subtensor#2143
Problem
The
ethereumcrate'sAccessListItemstruct serializes thestorage_keysfield in snake_case:{ "address": "0x9dc08c6e2bf0f1eed1e00670f80df39145529f81", "storage_keys": [] }However, the Ethereum JSON-RPC specification requires camelCase (
storageKeys):{ "address": "0x9dc08c6e2bf0f1eed1e00670f80df39145529f81", "storageKeys": [] }This breaks indexers and tooling that validate against the spec. The issue was reported by the Subsquid team who encountered problems while indexing the Bittensor mainnet.
Solution
Added a custom serialization wrapper (
AccessListItemCamelCase) and aserialize_withmodule (access_list_camelcase) for theTransactionstruct'saccess_listfield. This ensuresstorageKeysis serialized in the correct camelCase format without modifying the underlyingethereumcrate type.Note: The
rpc-v2types already define their ownAccessListItemwith#[serde(rename_all = "camelCase")], so onlyrpc-coreis affected by this bug.Before
After