Skip to content

Commit

Permalink
[processor] Revert tx when execute_tx error (#3316)
Browse files Browse the repository at this point in the history
  • Loading branch information
jolestar authored Feb 13, 2025
1 parent a0db608 commit 1fbde46
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions crates/rooch-pipeline-processor/src/actor/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,11 @@ impl PipelineProcessorActor {
match self.execute_l2_tx(l2_tx.clone()).await {
Ok(_v) => {}
Err(err) => {
if is_vm_panic_error(&err) {
tracing::error!(
"Execute L2 Tx failed while VM panic occurred in process_sequenced_tx_on_startup. error: {:?}; tx_order: {}, tx_hash {:?}",
err, tx_order, tx_hash
);
return Err(err);
}
tracing::error!(
"Execute L2 Tx failed while VM panic occurred in process_sequenced_tx_on_startup. error: {:?}; tx_order: {}, tx_hash {:?}",
err, tx_order, tx_hash
);
return Err(err);
}
};
}
Expand Down Expand Up @@ -306,17 +304,15 @@ impl PipelineProcessorActor {
let result = match self.execute_tx(ledger_tx, moveos_tx).await {
Ok(v) => v,
Err(err) => {
if is_vm_panic_error(&err) {
let l2_tx_bcs_bytes = bcs::to_bytes(&tx)?;
tracing::error!(
"Execute L2 Tx failed while VM panic occurred and revert tx. error: {:?} tx info {}",
err, hex::encode(l2_tx_bcs_bytes)
);
self.da_server
.revert_tx(RevertTransactionMessage { tx_order })
.await?;
self.rooch_db.revert_tx(tx_hash)?;
}
let l2_tx_bcs_bytes = bcs::to_bytes(&tx)?;
tracing::error!(
"Execute L2 Tx failed while VM panic occurred and revert tx. error: {:?} tx info {}",
err, hex::encode(l2_tx_bcs_bytes)
);
self.da_server
.revert_tx(RevertTransactionMessage { tx_order })
.await?;
self.rooch_db.revert_tx(tx_hash)?;
return Err(err);
}
};
Expand Down

0 comments on commit 1fbde46

Please sign in to comment.