Skip to content

feat(gas-keys): rosetta, prefetcher, mirror support for DelegateV2 (3/3)#15906

Merged
darioush merged 1 commit into
masterfrom
darioush/gas-keys/delegate-v2-versioned-others
Jun 13, 2026
Merged

feat(gas-keys): rosetta, prefetcher, mirror support for DelegateV2 (3/3)#15906
darioush merged 1 commit into
masterfrom
darioush/gas-keys/delegate-v2-versioned-others

Conversation

@darioush

@darioush darioush commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Last PR of the stack (on top of #15905).

  • Rosetta: delegate operations carry a gas-key DelegateV2's nonce index in OperationMetadata::nonce_index, so it round-trips through operations and the NEAR Actions -> Operations -> NEAR Actions bijection holds (test included). A DelegateV2 with a plain nonce reconstructs as the semantically equivalent plain Delegate. The shared operation-building logic is extracted into push_delegate_action_operations.
  • Prefetcher: a gas-key delegate action also reads the per-index gas key nonce row during validation, so prefetch it alongside the access key.
  • Mirror: maps and re-signs DelegateV2 actions like plain Delegate ones, preserving the versioned nonce; the shared remapping moves into map_delegate_action over VersionedDelegateActionRef with a per-version resign closure.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.92793% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.80%. Comparing base (3de604d) to head (1fe0ece).

Files with missing lines Patch % Lines
tools/mirror/src/genesis.rs 38.77% 30 Missing ⚠️
runtime/runtime/src/prefetch.rs 0.00% 15 Missing ⚠️
chain/rosetta-rpc/src/adapters/mod.rs 97.29% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15906      +/-   ##
==========================================
+ Coverage   69.78%   69.80%   +0.02%     
==========================================
  Files         946      946              
  Lines      203610   203752     +142     
  Branches   203610   203752     +142     
==========================================
+ Hits       142095   142238     +143     
+ Misses      56741    56740       -1     
  Partials     4774     4774              
Flag Coverage Δ
pytests-nightly 1.10% <0.00%> (-0.01%) ⬇️
unittests 69.53% <77.92%> (+0.01%) ⬆️
unittests-nightly 69.51% <77.92%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-others branch from c0cbec3 to 0f1bac4 Compare June 11, 2026 23:15
@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-wiring branch from 0b2c394 to f3581f1 Compare June 12, 2026 02:39
@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-others branch 2 times, most recently from 49ab67e to aa2633c Compare June 12, 2026 02:50
@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-wiring branch from f3581f1 to 620ffac Compare June 12, 2026 02:50
@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-others branch from aa2633c to c617409 Compare June 12, 2026 03:02
@darioush darioush requested a review from Copilot June 12, 2026 03:17

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

This PR completes the “gas-keys / DelegateV2” integration across Rosetta, the runtime trie prefetcher, and the mirror tool, ensuring DelegateV2 actions (including gas-key nonce indexing) round-trip correctly and are handled consistently across these subsystems.

Changes:

  • Rosetta: carries DelegateV2 gas-key nonce_index through operation metadata and reconstructs DelegateV2 when present (with a bijection test).
  • Runtime prefetcher: adds deterministic prefetching for the gas-key per-index nonce row for DelegateV2 during receipt processing.
  • Mirror: maps and re-signs DelegateV2 actions while preserving the versioned nonce semantics via shared delegate mapping logic.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/mirror/src/genesis.rs Adds DelegateV2 mapping/re-signing support and factors remapping into a shared map_delegate_action helper.
runtime/runtime/src/prefetch.rs Prefetches DelegateV2 access keys and gas-key nonce rows when applicable.
chain/rosetta-rpc/src/models.rs Extends operation metadata with nonce_index for gas-key DelegateV2 round-tripping.
chain/rosetta-rpc/src/adapters/validated_operations/delegate_action.rs Threads nonce_index through delegate action operation encoding/decoding.
chain/rosetta-rpc/src/adapters/mod.rs Extracts shared delegate operation building and adds DelegateV2 conversion + bijection test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread chain/rosetta-rpc/src/adapters/mod.rs
@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-others branch from c617409 to a25dca6 Compare June 12, 2026 03:36
@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-wiring branch from 620ffac to 372c515 Compare June 12, 2026 03:36
@darioush darioush requested a review from pugachAG June 12, 2026 03:44
@darioush darioush marked this pull request as ready for review June 12, 2026 03:44
@darioush darioush requested a review from a team as a code owner June 12, 2026 03:44
@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-others branch from a25dca6 to 09958f9 Compare June 12, 2026 12:55
@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-wiring branch 2 times, most recently from 48ae1c3 to ab5ebcf Compare June 12, 2026 13:01
@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-others branch from 09958f9 to adba604 Compare June 12, 2026 13:01
@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-wiring branch from ab5ebcf to ad2e760 Compare June 12, 2026 22:47
@darioush darioush requested a review from frol as a code owner June 12, 2026 22:47
Base automatically changed from darioush/gas-keys/delegate-v2-versioned-wiring to master June 12, 2026 23:18
@darioush darioush force-pushed the darioush/gas-keys/delegate-v2-versioned-others branch from adba604 to 1fe0ece Compare June 12, 2026 23:23
@darioush darioush enabled auto-merge June 12, 2026 23:24
@darioush darioush added this pull request to the merge queue Jun 12, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 13, 2026
@darioush darioush added this pull request to the merge queue Jun 13, 2026
Merged via the queue into master with commit 7eadd26 Jun 13, 2026
32 checks passed
@darioush darioush deleted the darioush/gas-keys/delegate-v2-versioned-others branch June 13, 2026 00:53
darioush added a commit that referenced this pull request Jun 22, 2026
Adds a 2.13.0 changelog entry for the new `DelegateV2` meta-transaction
action (`ProtocolFeature::DelegateV2`, protocol version 85), which lets
gas keys ([NEP-611](near/NEPs#611)) sign relayed
meta transactions.
([#15904](#15904),
[#15905](#15905),
[#15906](#15906))

Sorry I forgot this as part of the feature.
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