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
Add sign and submit subcommands to sequencer CLI (#1696)
## Summary
> [!NOTE]
> Most of the code is copied from Sam
(#1695) and Jordan's
(#1694) PRs.
Add two new subcommands `sign` and `submit` to the `sequencer`
subcommand.
### `sign`
1. Reads a pbjson formatted
`astria.protocol.transaction.v1.TransactionBody` from a file or `STDIN`
(`file` is a positional argument; `STDIN` is read when providing `-` as
the trailing argument).
2. Signs it with a given private key (`--private-key`).
3. Writes the pbjson formatted
`astria.protocol.transaction.v1.Transaction` to `--output`/`-o`, if
provided, or `STDOUT`.
### `submit`
1. 1. Reads a pbjson formatted
`astria.protocol.transaction.v1.Transaction` from a file or `STDIN`
(`file` is a positional argument; `STDIN` is read when providing `-` as
the trailing argument).
2. Submits it to a sequencer's CometBFT url (`--sequencer-url`)
## Background
We want to be able to test the submitting txs signed via FROST threshold
signing (see #1654) but do not
have a CLI command to submit already signed transactions. The `submit`
command resolves this.
To test the `submit` command it is desirable to have a corresponding
`sign` command which creates a signed `Transaction` from a single
private key.
## Changes
- List changes which were made.
## Testing
1. Run a local sequencer network using `astria-cli-go`
```
just run dev purge all
just run dev init
just run dev run --network local
```
2. Sign a `TransactionBody`:
```
cargo run -p astria-cli -- sequencer sign --private-key 2bd806c97f0e00af1a1fc3328fa763a9269723c8db8fac4f93af71db186d6e90 - <<EOF
{
"params": {
"nonce": 0,
"chainId": "sequencer-test-chain-0"
},
"actions": [
{
"ibcRelayerChange": {
"removal": {
"bech32m": "astria13r24h8mj42sdfqflqyg2fycqf9mdqqzmm2xllj"
}
}
}
]
}
EOF
```
3. Submit the signed `Transaction`
```
cargo run -p astria-cli -- sequencer submit --sequencer-url http://127.0.0.1:26657 - <<EOF
{
"signature": "+hb4bd8kEM8/AQ3wJ2znXcF3Ds1iLZu6OieNOnxY7n1SZsiDr5NQP3lMK4s5134O629XjXhae/FsL+qtbXnBDw==",
"publicKey": "1b9KP8znF7A4i8wnSevBSK2ZabI/Re4bYF/Vh3hXasQ=",
"body": {
"typeUrl": "/astria.protocol.transaction.v1.TransactionBody",
"value": "ChgSFnNlcXVlbmNlci10ZXN0LWNoYWluLTASNKIDMRIvEi1hc3RyaWExM3IyNGg4bWo0MnNkZnFmbHF5ZzJmeWNxZjltZHFxem1tMnhsbGo="
}
}
EOF
```
> [!NOTE]
> You can also do this is in a single command using `xargs -0`
```
cargo run -p astria-cli -- sequencer sign --private-key 2bd806c97f0e00af1a1fc3328fa763a9269723c8db8fac4f93af71db186d6e90 - <<EOF
{
"params": {
"nonce": 3,
"chainId": "sequencer-test-chain-0"
},
"actions": [
{
"ibcRelayerChange": {
"removal": {
"bech32m": "astria13r24h8mj42sdfqflqyg2fycqf9mdqqzmm2xllj"
}
}
}
]
}
EOF | xargs -0 cargo run -p astria-cli -- sequencer submit --sequencer-url http://127.0.0.1:26657
```
## Metrics
- List out metrics added by PR, delete section if none.
## Breaking Changelist
- Bulleted list of breaking changes, any notes on migration. Delete
section if none.
## Related Issues
Link any issues that are related, prefer full github links.
closes <!-- list any issues closed here -->
---------
Co-authored-by: Sam Bukowski <[email protected]>
Co-authored-by: Richard Janis Goldschmidt <[email protected]>
Co-authored-by: Fraser Hutchison <[email protected]>
Co-authored-by: Jordan Oroshiba <[email protected]>
0 commit comments