feat(bridge-withdrawer): Bridge withdrawer transaction submission#1087
feat(bridge-withdrawer): Bridge withdrawer transaction submission#1087noot merged 25 commits intoitamarreif/bridge-scaffoldingfrom
Conversation
crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
the event.sender is an evm address - we need to parse the event.memo to get the destination sequencer address (or check if it's an ics20withdrawal)
also thinking amount needs a "precision" as well, as going to the evm for example we multiply by some precision so here we'd need to divide by that precision
memo should also be updated to store the evm block number and tx hash
There was a problem hiding this comment.
i propose the evm tx memo looks like:
{
"astria": {
"recipient_address": "astriaaddress",
},
"forward": {
"receiver": "destinationchainbech32address",
"port": "transfer",
"channel": "channel-123"
}
} where forward is set only if this is an ics20 withdrawal, and astria can be unset. if it's a withdrawal to a sequencer account, then astria is set and forward is unset
There was a problem hiding this comment.
i also propose the memo for BridgeUnlockAction looks like
{
"rollup_block_number": 99,
"rollup_tx_hash": "tx_hash"
}tx_hash comes from event_with_metadata.
There was a problem hiding this comment.
no more evm tx memo for withdrawals to sequencer, see #1101
for ibc withdrawals, channel/port are hardcoded. the ibc packet memo should contain whatever is in the Ics20Withdrawal event memo plus additional data:
{
"rollup_block_number": 99,
"rollup_tx_hash": "tx_hash",
"rollup_sender_address": "0x..."
}
crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs
Outdated
Show resolved
Hide resolved
crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs
Outdated
Show resolved
Hide resolved
noot
left a comment
There was a problem hiding this comment.
mostly looks good, my main concerns before merging:
- fetching chain id from sequencer instead of config
- fetching fee asset id from sequencer or setting in config instead of hardcoding
- conversion of event into action needs to be updated
Summary
This adds the
Submitterand merges in theWatcherrelated logic into a singleWithdrawService.Submitterreceives batches of rollup transactions that have been converted into sequencerActions from theBatcherand does the following:UnsignedTransactionbroadcast_tx_commitIf submission to the sequencer fails for any reason (either in
CheckTxorDeliverTx), theSubmitterwill stop, instead relying on the service's recovery process to reconstruct the batch from rollup transaction and resubmit.Background
Withdrawal batches need to be submitted to the sequencer.
Changes
SubmitterActionsTesting
How are these changes tested?
Metrics
Related Issues
Link any issues that are related, prefer full github links.
closes