Skip to content

Commit

Permalink
feat(state_update_job): Simple comments for context
Browse files Browse the repository at this point in the history
  • Loading branch information
akhercha committed Jun 28, 2024
1 parent b6d8de7 commit 9da6baa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/orchestrator/src/jobs/state_update_job/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ impl Job for StateUpdateJob {
job.metadata.insert(JOB_METADATA_STATE_UPDATE_LAST_FAILED_BLOCK_NO.into(), block_no.to_string());
return Ok(tx_inclusion_status.into());
}
// If the tx is still pending, we wait for it to be finalized and check again the status.
SettlementVerificationStatus::Pending => {
settlement_client.wait_for_tx_finality(tx_hash).await?;
let new_status = settlement_client.verify_tx_inclusion(tx_hash).await?;
Expand All @@ -137,7 +138,6 @@ impl Job for StateUpdateJob {
}
// verify that the last settled block is indeed the one we expect to be
let expected_last_block_number = block_numbers.last().expect("Block numbers list should not be empty.");

let out_last_block_number = settlement_client.get_last_settled_block().await?;
let block_status = if out_last_block_number == *expected_last_block_number {
SettlementVerificationStatus::Verified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ pub trait SettlementClient: Send + Sync {
/// Should verify the inclusion of a tx in the settlement layer
async fn verify_tx_inclusion(&self, tx_hash: &str) -> Result<SettlementVerificationStatus>;

/// Should wait that the pending tx_hash is finalized
async fn wait_for_tx_finality(&self, tx_hash: &str) -> Result<()>;

/// Should retrieves the last settled block in the settlement layer
async fn get_last_settled_block(&self) -> Result<u64>;
}

Expand Down

0 comments on commit 9da6baa

Please sign in to comment.