feat(gas-keys): rosetta, mirror, prefetch support for DelegateV2 (3/3)#15885
feat(gas-keys): rosetta, mirror, prefetch support for DelegateV2 (3/3)#15885darioush wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR completes non-consensus subsystem support for DelegateV2 across Rosetta, mirror, and runtime prefetching, aiming to preserve DelegateV2 fidelity (including extensions like gas-key nonce index) through conversions and to avoid missing trie reads during validation.
Changes:
- Rosetta: round-trip
DelegateV2extensions by addingOperationMetadata::delegate_action_extension, refactoring delegate op emission, and adding a bijection test forDelegateV2. - Mirror: remap and re-sign
DelegateV2actions during genesis mapping instead of cloning them through unchanged. - Runtime prefetch: prefetch the per-index gas-key nonce row required by
DelegateV2validation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/mirror/src/genesis.rs | Adds DelegateV2 handling by remapping inner delegate action and re-signing with the mapped key. |
| runtime/runtime/src/prefetch.rs | Prefetches access key + gas-key nonce row for DelegateV2 (gas key extension). |
| chain/rosetta-rpc/src/models.rs | Extends OperationMetadata to carry DelegateV2 extension for round-tripping. |
| chain/rosetta-rpc/src/adapters/validated_operations/delegate_action.rs | Plumbs the optional delegate extension through validated delegate-action operations. |
| chain/rosetta-rpc/src/adapters/mod.rs | Refactors delegate op generation and reconstructs Delegate vs DelegateV2 based on presence of extension; adds bijection test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## darioush/gas-keys/delegate-v2-core-exec #15885 +/- ##
===========================================================================
- Coverage 69.95% 69.95% -0.01%
===========================================================================
Files 945 945
Lines 202736 202827 +91
Branches 202736 202827 +91
===========================================================================
+ Hits 141820 141881 +61
- Misses 56149 56182 +33
+ Partials 4767 4764 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3531361 to
5c94756
Compare
6494ae5 to
cee91a1
Compare
93d9a32 to
b3b6201
Compare
cee91a1 to
85c4f84
Compare
b3b6201 to
9c68ba6
Compare
85c4f84 to
6c5c0ac
Compare
9c68ba6 to
9305229
Compare
5435ac4 to
815e070
Compare
815e070 to
ac99e5e
Compare
ac99e5e to
1da4185
Compare
…ions (1/3) (near#15904) First of a 3-PR stack adding gas-key support to meta transactions via a new `Action::DelegateV2`. Replaces the extension-based stack (near#15883, near#15884, near#15885) with the versioned design suggested in review there. Adds the wire types and the nesting guard, but no execution yet: validation rejects `DelegateV2` (`UnsupportedProtocolFeature`) and the apply path fails it gracefully. Execution lands in the next PR in the stack. Design: - `DelegateActionV2` mirrors `TransactionV1`: its `nonce: TransactionNonce` selects either the access key nonce or one of a gas key's parallel nonces by index. - `VersionedDelegateActionPayload` (wire enum, currently just `V2`) is the signed payload of `VersionedSignedDelegateAction`. Future versions add a variant here instead of a new `Action` variant, so the delegate nesting guard stays frozen, and the variant byte is covered by the signature so versions cannot be confused. - `DelegateV2` signs under its own NEP-461 discriminant (NEP-611, gas keys), making V1 and V2 signing domains disjoint by construction. - `VersionedDelegateActionRef`/`VersionedSignedDelegateActionRef` are borrowing wrappers for code handling V1 and V2 uniformly (the `VersionedActionReceipt` pattern). - A dedicated `ProtocolFeature::DelegateV2` (protocol version 85) gates the action independently of `ProtocolFeature::GasKeys`, so it can be pulled from the release on its own if needed. Includes `ActionView::DelegateV2`, cost/fee handling, and trivial match arms across the workspace. Protocol schema and openapi specs (1.2.11) are regenerated.
Last of the 3-PR stack (builds on #15884, original non-splitted: #15877). Non-consensus subsystem support for
DelegateV2.DelegateActionExtensionthrough a newOperationMetadata::delegate_action_extensionfield, soAction -> Operations -> Actionstays a bijection forDelegateV2. Addstest_delegate_v2_actions_bijection.DelegateV2ingenesis.rsinstead of cloning it through.DelegateV2validation reads.