Repository navigation
CLI: Accept relay signatures in transaction submit - #73
Conversation
75e1ba7 to
f8663f8
Compare
5e34581 to
dfbed3f
Compare
295c96a to
59d5c14
Compare
22d3465 to
f339265
Compare
f339265 to
2788eee
Compare
joncinque
left a comment
There was a problem hiding this comment.
Looks great overall! Just some tiny points
| /// separately. Requires --blockhash, so this run builds the same relay transaction as the | ||
| /// --sign-only runs. | ||
| #[clap(long, value_name = "ADDRESS=SIGNATURE", requires = "blockhash")] | ||
| relay_signature: Vec<String>, |
There was a problem hiding this comment.
nit: for consistency with the normal offline arg of --signer, let's call this --relay-signer
There was a problem hiding this comment.
Discussed offline, --relay-signer is being used to pass signers for the relay transaction. --relay-signature is the equivalent of --signer, ie it passes <address>=<signature> pairs, only for the relay transaction instead of the authorization message.
So they're mutually exclusive, but they're different data types and we need both args.
Happy to rename any of these args if we want to, but I think the clearer rename might be to rename --signer to something like --authorization-signature (or swap both signature for presigner?). I think --relay-signer and --relay-signature are probably the clearest option for these two args.
| // provides. Relay signatures are not loaded as presigners, because | ||
| // `signer_from_source_with_config` looks those up in the `--signer` arg, which holds | ||
| // authorization message signatures here. |
There was a problem hiding this comment.
Blech, that's annoying. We can definitely go with this now, but we should update clap-utils to allow for customizing the "signer" argument.
| for (address, _) in &relay_signers.signers { | ||
| ensure!( | ||
| !relay_signatures.contains_key(address), | ||
| "{address} has both a local signer and a --relay-signature" | ||
| ); | ||
| } |
There was a problem hiding this comment.
nit: This was a bit confusing -- can we rename one of the variables to make it clear which is which? Maybe rename relay_signatures to relay_presigners?
| assert!(second.bad_sig.is_empty()); | ||
| } | ||
|
|
||
| /// A forwarded signer's relay signature stands in for --relay-signer, and an address fee payer |
There was a problem hiding this comment.
Heh, this comment agrees with me on the parameter name 😁
2788eee to
da367f0
Compare
da367f0 to
63f5938
Compare
This PR adds a repeatable `--relay-signature ADDRESS=SIGNATURE` arg to `transaction submit`, for signatures returned by `--sign-only` runs. This allows passing a signature instead of a signer source for signers of the relay transaction. Paired with `--sign-only`, every relay transaction signer can now be offline. Like `--sign-only`, `--relay-signature` requires `--blockhash`. - `--fee-payer` and `--durable-nonce-authority` accept an address when a matching `--relay-signature` is given. I don't think enabling an offline fee payer is particularly important (it won't be possible with SPL nonce AFAIK), but it falls out of the design. And supporting an offline durable nonce authority is important. - a forwarded signer's relay signature replaces `--relay-signer`, and it is not shown the signing summary, since it approved in its own run - the relay transaction is now built before the signing summary, so each relay signature is checked against it before local signers are asked to sign. A signature that does not verify means its `--sign-only` run used different arguments - an address given both as a local signer and a `--relay-signature` is rejected - with `--sign-only`, relay signatures are included in the output, so signatures can be collected in a chain - `--sign-only` output includes the relay message hash, so separate runs can check they sign the same message. `--dump-transaction-message` remains for inspecting the message, or finding why hashes differ The signing summary is still only shown to signers on the authorization message. A fee payer or durable nonce authority that only signs the relay transaction can only pay a fee or advance a nonce, which it signs off on through the relay message hash. Relay signatures are written into their transaction signature slots rather than loaded as presigners, because `signer_from_source_with_config` reads presigner signatures from `--signer`, which for `transaction submit` holds authorization message signatures.
63f5938 to
bafaa29
Compare
joncinque
left a comment
There was a problem hiding this comment.
Looks good! We can potentially revisit the parameter names later if needed
This PR adds a repeatable
--relay-signature ADDRESS=SIGNATUREarg totransaction submit, for signatures returned by--sign-onlyruns.This allows passing a signature instead of a signer source for signers of the relay transaction. Paired with
--sign-only, every relay transaction signer can now be offline.Like
--sign-only,--relay-signaturerequires--blockhash.--fee-payerand--durable-nonce-authorityaccept an address when a matching--relay-signatureis given. I don't think enabling an offline fee payer is particularly important (it won't be possible with SPL nonce AFAIK), but it falls out of the design. And supporting an offline durable nonce authority is important.a forwarded signer's relay signature replaces
--relay-signer, and it is not shown the signing summary, since it approved in its own runthe relay transaction is now built before the signing summary, so each relay signature is checked against it before local signers are asked to sign. A signature that does not verify means its
--sign-onlyrun used different argumentsan address given both as a local signer and a
--relay-signatureis rejectedwith
--sign-only, relay signatures are included in the output, so signatures can be collected in a chain--sign-onlyoutput includes the relay message hash, so separate runs can check they sign the same message.--dump-transaction-messageremains for inspecting the message, or finding why hashes differThe signing summary is still only shown to signers on the authorization message. A fee payer or durable nonce authority that only signs the relay transaction can only pay a fee or advance a nonce, which it signs off on through the relay message hash.
Relay signatures are written into their transaction signature slots rather than loaded as presigners, because
signer_from_source_with_configreads presigner signatures from--signer, which fortransaction submitholds authorization message signatures.