You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Background. NEP-611 (gas keys) adds a second meta-transaction variant, Action::DelegateV2, so that a gas key can relay a delegate action. It mirrors the NEP-366 DelegateAction the app already signs, but the delegated payload is versioned and its nonce is a TransactionNonce — the same versioned nonce as TransactionV1 — so the signer can point at either an access key's nonce or one of a gas key's parallel nonce slots. Signatures use the NEP-461 domain-separated hashing scheme, and V2 gets a different prefix (NEP-611) from V1 (NEP-366), so the two payloads can't be confused.
VersionedDelegateActionPayload::V2(DelegateActionV2) = 0 — versioned wrapper; unknown version tags must be rejected.
DelegateActionV2 { sender_id, receiver_id, actions: Vec<NonDelegateAction>, nonce: TransactionNonce, max_block_height, public_key } — identical to the V1 DelegateAction except nonce is a TransactionNonce instead of a plain u64.
Current behavior. The app signs NEP-366 delegate actions through a dedicated flow (SignMode::NEP366DelegateAction, INS_SIGN_NEP366_DELEGATE_ACTION, parsing/types/nep366_delegate_action/). There is no V2 path: the versioned payload, the TransactionNonce, and the NEP-611 signing prefix are all unhandled, and action tag 14 is unknown to the action parser.
Work.
Add a DelegateV2 signing flow mirroring the NEP-366 one, hashing the payload under the NEP-611 domain prefix (not NEP-366).
Parse VersionedDelegateActionPayload: accept V2 (tag 0), reject unknown version tags.
Parse the versioned TransactionNonce: a plain access-key nonce, or a gas-key { nonce, nonce_index } selecting a parallel nonce slot. Shares the versioned-nonce parsing with the gas-keys / TransactionV1 work.
Reuse the existing delegate field parsing (sender, receiver, actions, max block height, public key) and the nested-delegate rejection.
Display: label it a meta-transaction (delegate), show receiver + action list, and — when a gas-key nonce is used — the nonce index.
(if the app parses relayer-side txs) accept Action::DelegateV2 (tag 14) in the transaction action parser.
Acceptance. A DelegateActionV2 payload parses and signs with the correct NEP-611 prefix; the versioned nonce (both plain and gas-key forms) is handled; unknown payload versions are rejected; tests cover a V2 delegate with both nonce forms.
Reference.near-cli-rs already carries a SignedDelegateActionV2 variant on the client side (src/transaction_signature_options/display/mod.rs) — useful prior art for the wire format.
Status note: gated behind the nightly gas-keys protocol feature (protocol v85), not yet on mainnet — P1, batched with gas keys for the consolidated audit.
Background. NEP-611 (gas keys) adds a second meta-transaction variant,
Action::DelegateV2, so that a gas key can relay a delegate action. It mirrors the NEP-366DelegateActionthe app already signs, but the delegated payload is versioned and its nonce is aTransactionNonce— the same versioned nonce asTransactionV1— so the signer can point at either an access key's nonce or one of a gas key's parallel nonce slots. Signatures use the NEP-461 domain-separated hashing scheme, and V2 gets a different prefix (NEP-611) from V1 (NEP-366), so the two payloads can't be confused.Wire shape (nearcore
core/primitives/src/action/delegate.rs):Action::DelegateV2— action discriminant 14 (V1Delegateis 8), carryingVersionedSignedDelegateAction { delegate_action, signature }.VersionedDelegateActionPayload::V2(DelegateActionV2) = 0— versioned wrapper; unknown version tags must be rejected.DelegateActionV2 { sender_id, receiver_id, actions: Vec<NonDelegateAction>, nonce: TransactionNonce, max_block_height, public_key }— identical to the V1DelegateActionexceptnonceis aTransactionNonceinstead of a plainu64.Current behavior. The app signs NEP-366 delegate actions through a dedicated flow (
SignMode::NEP366DelegateAction,INS_SIGN_NEP366_DELEGATE_ACTION,parsing/types/nep366_delegate_action/). There is no V2 path: the versioned payload, theTransactionNonce, and the NEP-611 signing prefix are all unhandled, and action tag 14 is unknown to the action parser.Work.
VersionedDelegateActionPayload: acceptV2(tag 0), reject unknown version tags.TransactionNonce: a plain access-key nonce, or a gas-key{ nonce, nonce_index }selecting a parallel nonce slot. Shares the versioned-nonce parsing with the gas-keys /TransactionV1work.Action::DelegateV2(tag 14) in the transaction action parser.Acceptance. A
DelegateActionV2payload parses and signs with the correct NEP-611 prefix; the versioned nonce (both plain and gas-key forms) is handled; unknown payload versions are rejected; tests cover a V2 delegate with both nonce forms.Reference.
near-cli-rsalready carries aSignedDelegateActionV2variant on the client side (src/transaction_signature_options/display/mod.rs) — useful prior art for the wire format.Depends on: #50 (gas keys) — shares the
TransactionNonceparsing. Related: #42 (versionedTransactionV1).Status note: gated behind the nightly gas-keys protocol feature (protocol v85), not yet on mainnet — P1, batched with gas keys for the consolidated audit.