Skip to content

test(runtime): verify view contract calls in eth implicit global contract test#15446

Merged
pugachAG merged 1 commit into
masterfrom
test-eth-implicit-view-calls
Mar 25, 2026
Merged

test(runtime): verify view contract calls in eth implicit global contract test#15446
pugachAG merged 1 commit into
masterfrom
test-eth-implicit-view-calls

Conversation

@pugachAG

@pugachAG pugachAG commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

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.

@pugachAG pugachAG requested review from darioush and wacban March 24, 2026 14:51
@pugachAG pugachAG marked this pull request as ready for review March 24, 2026 14:51
@pugachAG pugachAG requested a review from a team as a code owner March 24, 2026 14:51
Copilot AI review requested due to automatic review settings March 24, 2026 14:51
@pugachAG pugachAG force-pushed the test-eth-implicit-view-calls branch from bb6e5f0 to 90f5eef Compare March 24, 2026 14:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 ViewCode and get_nonce on legacy (magic-bytes) and new ETH implicit accounts.
  • Refactor NodeRunner JSON-RPC helpers into run_with_jsonrpc_client (generic) plus a specialized run_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.

@pugachAG pugachAG force-pushed the test-eth-implicit-view-calls branch from 90f5eef to 4ebeb69 Compare March 24, 2026 15:43
…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]>
@pugachAG pugachAG force-pushed the test-eth-implicit-view-calls branch from 4ebeb69 to 10c17b9 Compare March 24, 2026 16:09
@codecov

codecov Bot commented Mar 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.21%. Comparing base (c3abcf9) to head (10c17b9).
⚠️ Report is 5 commits behind head on master.

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           
Flag Coverage Δ
pytests-nightly 1.16% <ø> (ø)
unittests 68.49% <100.00%> (-0.01%) ⬇️
unittests-nightly 68.70% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wacban wacban left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Comment on lines +306 to +313
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![]),
},
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

small nit: perhaps split it down into a few helper variables?

@pugachAG pugachAG added this pull request to the merge queue Mar 25, 2026
Merged via the queue into master with commit 663a039 Mar 25, 2026
32 checks passed
@pugachAG pugachAG deleted the test-eth-implicit-view-calls branch March 25, 2026 11:45
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.

3 participants