Skip to content

Commit a00cd9d

Browse files
smrz2001claude
andcommitted
fix(anchor-evm): handle reverted transactions and missing block number
- Check receipt.status() and return error if transaction reverted - Use ok_or_else() instead of unwrap() for block_number 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c561529 commit a00cd9d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

anchor-evm/src/evm_transaction_manager.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use url::Url;
1818
use crate::{contract::AnchorContract, proof_builder::ProofBuilder};
1919

2020
/// Configuration for EVM transaction manager
21-
#[derive(Clone, Debug)]
21+
#[derive(Clone)]
2222
pub struct EvmConfig {
2323
/// RPC endpoint URL for the EVM chain
2424
pub rpc_url: String,
@@ -227,6 +227,14 @@ impl EvmTransactionManager {
227227
info!("Anchor transaction submitted: {}", tx_hash);
228228
previous_tx_hashes.push(tx_hash.clone());
229229

230+
// Check if transaction reverted
231+
if !receipt.status() {
232+
return Err(anyhow!(
233+
"Transaction {} reverted - anchor contract rejected the call",
234+
tx_hash
235+
));
236+
}
237+
230238
// Get block number from receipt - a mined transaction should always have this
231239
let block_number = receipt
232240
.block_number

0 commit comments

Comments
 (0)