Skip to content

test: validate JSON-RPC schema against execution-api fixtures - #1010

Merged
XinyuCRO merged 41 commits into
developfrom
feat/rpc
Jul 2, 2026
Merged

test: validate JSON-RPC schema against execution-api fixtures#1010
XinyuCRO merged 41 commits into
developfrom
feat/rpc

Conversation

@XinyuCRO

@XinyuCRO XinyuCRO commented Jun 22, 2026

Copy link
Copy Markdown

@github-actions github-actions Bot added the evm label Jun 22, 2026
Comment thread tests/integration_tests/spec/test_rpc_spec_schema.py Fixed
Comment thread tests/integration_tests/spec/test_rpc_spec_schema.py Fixed
Comment thread tests/integration_tests/spec/test_rpc_spec_schema.py Fixed
Comment thread tests/integration_tests/spec/test_rpc_spec.py Fixed
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.51515% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.21%. Comparing base (099ce78) to head (6d1d30c).

Files with missing lines Patch % Lines
rpc/namespaces/ethereum/eth/api.go 0.00% 8 Missing ⚠️
x/evm/keeper/grpc_query.go 12.50% 6 Missing and 1 partial ⚠️
rpc/types/block.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1010      +/-   ##
===========================================
+ Coverage    46.18%   46.21%   +0.02%     
===========================================
  Files          197      197              
  Lines        17214    17237      +23     
===========================================
+ Hits          7951     7966      +15     
- Misses        8433     8443      +10     
+ Partials       830      828       -2     
Files with missing lines Coverage Δ
rpc/backend/account_info.go 83.72% <100.00%> (+2.14%) ⬆️
x/evm/types/tracer.go 35.08% <ø> (ø)
rpc/types/block.go 53.93% <0.00%> (+1.18%) ⬆️
x/evm/keeper/grpc_query.go 71.66% <12.50%> (-0.24%) ⬇️
rpc/namespaces/ethereum/eth/api.go 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread tests/integration_tests/spec/test_rpc_spec_schema.py Fixed
@XinyuCRO XinyuCRO changed the title tests: validate JSON-RPC schema against execution-api fixtures test: validate JSON-RPC schema against execution-api fixtures Jun 24, 2026
@JayT106

JayT106 commented Jun 25, 2026

Copy link
Copy Markdown

@claude

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Claude finished @JayT106's task in 3m 26s —— View job


PR Review — test: validate JSON-RPC schema against execution-api fixtures

  • Gather context and understand the PR
  • Read CLAUDE.md (not present)
  • Review changed Go files (rpc/, x/evm/)
  • Review new Python test files
  • Check for state-breaking changes
  • Post inline comments on issues found
  • Write final review summary

Summary

This PR adds:

  1. A new eth_baseFee RPC method
  2. A fix for eth_getStorageAt key parsing
  3. Stricter block number parsing (hex-only)
  4. txHash in debug_traceBlock results
  5. A fix to getAccessListExcludes guard condition
  6. A comprehensive JSON-RPC schema test suite against upstream execution-apis fixtures

Overall the code quality is good and the test infrastructure is well-designed. See findings below.


Findings

🔴 Breaking Change — Stricter Block Number Parsing (rpc/types/block.go)

The removal of the decimal fallback is a client-facing breaking change. Before, BlockNumber.UnmarshalJSON accepted decimal strings like "12345" by falling back to cast.ToUint64. Now any non-hex input (missing 0x prefix) returns an error.

Any client relying on decimal block number inputs will break silently. The PR description calls it "stricter" but doesn't highlight this as a compatibility concern. This is acceptable if there are no known users of that path, but should be explicitly acknowledged.

🟡 Unused Return Value in decodeStorageKey (rpc/backend/account_info.go:140)

storageKey, _, err := decodeStorageKey(key)

The inputLength int return value is discarded everywhere it's called. If it was intended for future use (e.g., detecting right-vs-left padding for legacy compat), it should be documented; otherwise simplify the signature.

🟡 No Unit Test for eth_baseFee (rpc/namespaces/ethereum/eth/api.go)

The BaseFee() method has 0% coverage per Codecov. This method has two code paths (head.BaseFee == nil and non-nil) — a unit test would be straightforward given the existing backend.go interface.

🟡 getAccessListExcludes logic change (x/evm/keeper/grpc_query.go:1052)

The original code checked args.Gas == nil unconditionally when AuthorizationList was set. The new code wraps it in if len(args.AuthorizationList) > 0, which is correct — but note this means that if a caller passes authorizationList: [] (empty slice), gas is no longer checked. This is intentional per the fix, but worth confirming the behavior is consistent with go-ethereum.

🟡 CodeQL: Implicit string concatenation (_schema_constants.py:162-165 and :166-168)

LEGACY_CREATE_BYTECODE = (
    "0x600d380380600d6000396000f360004381526020014681526020014181526020014"
    "881526020014481526020013281526020013481526020016000f3"
)

Python implicitly concatenates adjacent string literals. These aren't inside a list so there's no actual bug, but using an explicit + or a single long string removes the CodeQL noise and makes intent clearer.

🟡 CodeQL: Bare except Exception: pass without comment (conftest.py:117)

The _w3_wait_for_block function silently swallows all exceptions in the polling loop. Line 207 has a good comment explaining why ("The RPC endpoint can reject early requests..."); the identical pattern at line 117 does not. A brief comment here would satisfy CodeQL and aid future readers.

🟢 TraceBlock txHash addition (x/evm/keeper/grpc_query.go:626)

This is a clean, minimal fix. TxTraceResult.TxHash was already defined in types/tracer.go but never populated. The addition is correct and non-breaking.

🟢 decodeStorageKey implementation

Leniently accepts keys with or without 0x prefix and handles odd-length hex. common.BytesToHash right-aligns the bytes as expected for storage slot addressing. The error paths return a structured InvalidParamsError with the offending key in the message. Well done.

🟢 eth_baseFee implementation

Returns new(big.Int) (zero) when head.BaseFee == nil (pre-EIP-1559 contexts) rather than nil, which avoids a null pointer in the JSON response. Correct behavior.

🟢 Python Test Infrastructure

The fixture sync architecture (_execution_apis_sync.py, genesis overlay injection, conftest.py setup) is well-structured. The separate normalizers, rewriters, constants, and report files follow good separation of concerns. The SCHEMA_MISMATCH_WHITELIST and EXCLUDED_SCHEMA_SPEC_CASES allow-lists are explicitly documented with reasons.

One note: _execution_apis_sync.py fetches from main branch of ethereum/execution-apis at runtime — consider pinning to a specific commit/tag for reproducibility (or exposing a EXECUTION_APIS_REF env var alongside the existing EXECUTION_APIS_ARCHIVE_URL).


State-Breaking Changes

None detected. All changes are either:

  • Read-only RPC handlers (no state mutations)
  • Trace/debug query improvements (no consensus impact)
  • Defensive guard clauses in getAccessListExcludes (no state change)

The stricter block number parsing is API-breaking for RPC clients, not a consensus/state-breaking change. It is safe to merge to non-release branches.


| Branch: feat/rpc

Comment thread tests/integration_tests/execution-api/_schema_constants.py
Comment thread rpc/types/block.go Outdated
Comment thread rpc/backend/account_info.go
@JayT106

JayT106 commented Jun 25, 2026

Copy link
Copy Markdown

in https://github.com/crypto-org-chain/cronos-docs/pull/338/changes#diff-70121135e802c99e062c63c7323c1e41506bb2741106a23b08a05af4a91ad73eR125 mentioned the eth_simulateV1 but this PR seems remove a lot of files, could you give context of it?

@XinyuCRO

Copy link
Copy Markdown
Author

in https://github.com/crypto-org-chain/cronos-docs/pull/338/changes#diff-70121135e802c99e062c63c7323c1e41506bb2741106a23b08a05af4a91ad73eR125 mentioned the eth_simulateV1 but this PR seems remove a lot of files, could you give context of it?

@JayT106 the deleted simulateV1 specs files are copied from execution specs, this pr introduce a way to sync all specs fixtures including simulateV1 ones into the test context without needing to track them in git, should have no behavior changes

Comment thread x/evm/types/tracer.go
Comment thread rpc/backend/account_info.go
@thomas-nguy

Copy link
Copy Markdown
  • We probably could split this PR into 2 or 3 differents PRs which clear intent
  • Missing changelog

Comment thread tests/integration_tests/execution-api/README.md Outdated
Comment thread tests/integration_tests/execution-api/README.md Outdated
Comment thread tests/integration_tests/spec/test_simulate.py Outdated
Comment thread tests/integration_tests/execution-api/README.md
Comment thread tests/integration_tests/execution-api/conftest.py Fixed

@thomas-nguy thomas-nguy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@XinyuCRO
XinyuCRO merged commit e30f83e into develop Jul 2, 2026
32 checks passed
@XinyuCRO
XinyuCRO deleted the feat/rpc branch July 2, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants