Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
56e2870
simplified version works :/
itamarreif Jun 6, 2024
921ae6f
startup logic
itamarreif Jun 6, 2024
5530e43
Merge branch 'main' of github.com:astriaorg/astria into itamarreif/br…
itamarreif Jun 6, 2024
509518a
watcher tests work
itamarreif Jun 6, 2024
83c9959
startup test works
itamarreif Jun 7, 2024
e49bccc
startup failure tests
itamarreif Jun 7, 2024
83616b8
fix clippy
itamarreif Jun 7, 2024
e840bc7
remove invalid tests
itamarreif Jun 7, 2024
5a0b9a6
Update crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watche…
itamarreif Jun 7, 2024
034d39f
Merge branch 'main' of github.com:astriaorg/astria into itamarreif/br…
itamarreif Jun 7, 2024
65735de
address pr comments
itamarreif Jun 8, 2024
14e0d9f
remove comment from config
itamarreif Jun 8, 2024
43dcf1a
cargo fmt the generated contracts
itamarreif Jun 8, 2024
9c87ce2
sync logic
itamarreif Jun 8, 2024
3bfd6fa
small fixes
itamarreif Jun 8, 2024
01e0425
break apart sync logic
itamarreif Jun 8, 2024
871c012
get next nonce from sync and add docs
itamarreif Jun 8, 2024
82e9689
use sync to fetch nonce
itamarreif Jun 8, 2024
98bf827
merge w main
noot Jun 9, 2024
022aad3
update BridgeAccountLastTxHashResponse to have optional tx hash
noot Jun 9, 2024
bb1ffcd
fix test
noot Jun 9, 2024
508c753
fix tests
itamarreif Jun 9, 2024
2e4c17c
block count fixes
noot Jun 9, 2024
bbfe195
Merge branch 'itamarreif/bridge-withdrawer-sync' of github.com:astria…
noot Jun 9, 2024
a5a4192
fix tests
itamarreif Jun 9, 2024
6ace856
Merge branch 'itamarreif/bridge-withdrawer-sync' of github.com:astria…
itamarreif Jun 9, 2024
eda7673
fix tests and cleanup
noot Jun 9, 2024
e1bad1a
fix tests
noot Jun 9, 2024
f7e7a18
clean up clippy
itamarreif Jun 9, 2024
62f58c7
readd nonce guards to tests
itamarreif Jun 9, 2024
69a6f5b
minor cleanup
noot Jun 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ pub(crate) struct Watcher {

impl Watcher {
pub(crate) async fn run(mut self) -> Result<()> {
let (provider, contract, fee_asset_id, asset_withdrawal_divisor) = self.startup().await?;
let (provider, contract, fee_asset_id, asset_withdrawal_divisor, next_rollup_block_height) =
self.startup().await?;

let Self {
contract_address: _contract_address,
Expand All @@ -138,15 +139,16 @@ impl Watcher {

tokio::task::spawn(batcher.run());

// start from block 1 right now
// TODO: determine the last block we've seen based on the sequencer data
let sequencer_withdrawal_event_handler = tokio::task::spawn(
watch_for_sequencer_withdrawal_events(contract.clone(), event_tx.clone(), 1),
);
let sequencer_withdrawal_event_handler =
tokio::task::spawn(watch_for_sequencer_withdrawal_events(
contract.clone(),
event_tx.clone(),
next_rollup_block_height,
));
let ics20_withdrawal_event_handler = tokio::task::spawn(watch_for_ics20_withdrawal_events(
contract,
event_tx.clone(),
1,
next_rollup_block_height,
));

state.set_watcher_ready();
Expand All @@ -169,8 +171,8 @@ impl Watcher {

/// Gets the startup data from the submitter and connects to the Ethereum node.
///
/// Returns the contract handle, the asset ID of the fee asset, and the divisor for the asset
/// withdrawal amount.
/// Returns the contract handle, the asset ID of the fee asset, the divisor for the asset
/// withdrawal amount, and the rollup block height to watch from.
///
/// # Errors
/// - If the fee asset ID provided in the config is not a valid fee asset on the sequencer.
Expand All @@ -183,10 +185,12 @@ impl Watcher {
IAstriaWithdrawer<Provider<Ws>>,
asset::Id,
u128,
u64,
)> {
// wait for submitter to be ready
let SequencerStartupInfo {
fee_asset_id,
next_batch_rollup_height,
} = self.submitter_handle.recv_startup_info().await?;

// connect to eth node
Expand Down Expand Up @@ -242,6 +246,7 @@ impl Watcher {
contract,
fee_asset_id,
asset_withdrawal_divisor,
next_batch_rollup_height,
))
}
}
Expand Down Expand Up @@ -556,6 +561,7 @@ mod tests {
startup_tx
.send(SequencerStartupInfo {
fee_asset_id: denom.id(),
next_batch_rollup_height: 0,
})
.unwrap();

Expand Down Expand Up @@ -647,6 +653,7 @@ mod tests {
startup_tx
.send(SequencerStartupInfo {
fee_asset_id: denom.id(),
next_batch_rollup_height: 0,
})
.unwrap();

Expand Down Expand Up @@ -768,6 +775,7 @@ mod tests {
startup_tx
.send(SequencerStartupInfo {
fee_asset_id: denom.id(),
next_batch_rollup_height: 0,
})
.unwrap();

Expand Down Expand Up @@ -869,6 +877,7 @@ mod tests {
startup_tx
.send(SequencerStartupInfo {
fee_asset_id: asset::Id::from_denom("transfer/channel-0/utia"),
next_batch_rollup_height: 0,
})
.unwrap();

Expand Down
1 change: 1 addition & 0 deletions crates/astria-bridge-withdrawer/src/withdrawer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ impl Service {
#[derive(Debug)]
pub struct SequencerStartupInfo {
pub fee_asset_id: asset::Id,
pub next_batch_rollup_height: u64,
}

/// A handle for instructing the [`Service`] to shut down.
Expand Down
Loading