test(runtime): verify view contract calls in eth implicit global contract test#15446
Conversation
bb6e5f0 to
90f5eef
Compare
There was a problem hiding this comment.
Pull request overview
Extends the eth_implicit_global_contract test to validate JSON-RPC ViewCode and CallFunction(get_nonce) behavior across the PV 82 → 83 upgrade, ensuring coverage for the trie-viewer fixes from #15437. Also refactors the TestLoop JSON-RPC runner API to make standard query requests simpler while retaining a generic client-based helper for non-query calls.
Changes:
- Add pre-/post-upgrade assertions for
ViewCodeandget_nonceon legacy (magic-bytes) and new ETH implicit accounts. - Refactor
NodeRunnerJSON-RPC helpers intorun_with_jsonrpc_client(generic) plus a specializedrun_jsonrpc_query(RpcQueryRequest, ...). - Update existing sharded RPC and JSON-RPC tests/examples to use the new helpers.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test-loop-tests/src/utils/node.rs | Splits generic JSON-RPC execution from the common query request path to simplify call sites. |
| test-loop-tests/src/tests/sharded_rpc.rs | Updates RPC forwarding tests to use run_jsonrpc_query(RpcQueryRequest, ...) and run_with_jsonrpc_client where appropriate. |
| test-loop-tests/src/tests/jsonrpc.rs | Updates JSON-RPC tests to use run_with_jsonrpc_client for non-query methods. |
| test-loop-tests/src/tests/eth_implicit_global_contract.rs | Adds RPC-level verification of ViewCode and get_nonce before/after the PV 82 → 83 upgrade. |
| test-loop-tests/src/examples/basic.rs | Updates example to use run_with_jsonrpc_client. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
90f5eef to
4ebeb69
Compare
…ract test - Extend test_eth_implicit_global_contract_mainnet_upgrade to verify ViewCode and CallFunction (get_nonce) RPC queries before and after the PV 82 -> 83 protocol upgrade, covering the code paths fixed in #15437. - At PV 82: verify ViewCode returns the legacy localnet wallet contract WASM and get_nonce returns 0. - At PV 83: verify ViewCode returns the deployed global contract WASM for both old (magic-bytes) and new ETH implicit accounts, get_nonce returns 0 before and 1 after rlp_execute. - Refactor NodeRunner::run_jsonrpc_query into run_with_jsonrpc_client (generic, takes closure) and a new run_jsonrpc_query that directly accepts RpcQueryRequest, simplifying all query call sites. Co-Authored-By: Claude Opus 4.6 <[email protected]>
4ebeb69 to
10c17b9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #15446 +/- ##
=======================================
Coverage 69.21% 69.21%
=======================================
Files 936 936
Lines 210427 210434 +7
Branches 210427 210434 +7
=======================================
+ Hits 145641 145651 +10
+ Misses 58748 58745 -3
Partials 6038 6038
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| RpcQueryRequest { | ||
| block_reference: BlockReference::Finality(Finality::None), | ||
| request: QueryRequest::CallFunction { | ||
| account_id: account_id.clone(), | ||
| method_name: "get_nonce".to_string(), | ||
| args: FunctionArgs::from(vec![]), | ||
| }, | ||
| }, |
There was a problem hiding this comment.
small nit: perhaps split it down into a few helper variables?
Extend
test_eth_implicit_global_contract_mainnet_upgradeto verify ViewCode and CallFunction (get_nonce) RPC queries before and after the PV 82 -> 83 protocol upgrade, covering the code paths fixed in #15437.get_noncereturns 0.get_noncereturns 0 before and 1 afterrlp_execute.NodeRunner::run_jsonrpc_queryintorun_with_jsonrpc_client(generic, takes closure) and a newrun_jsonrpc_querythat directly acceptsRpcQueryRequest, simplifying all query call sites.