diff --git a/bridge-validators/config.toml b/bridge-validators/config.toml index 5a7e990..fa3f4ef 100644 --- a/bridge-validators/config.toml +++ b/bridge-validators/config.toml @@ -42,6 +42,11 @@ legacy_gas_estimation_percent = 130 ## fetching the receipt and scanning it for relevant logs. This is slow, but at least it works .. ## use_get_transactions = true +## Some chains (like ZQ1) insist on generating events for failed txns; these come with a status==0 +## value. However, other chains (eg. BSC) do not send a status==0 value but only generate events +## for txns which succeed. In order to fail safe, we need to mark when we should accept logs with +## nonexistent statuses +accept_events_with_no_status = true # BSC Mainnet # [[chain_configs]] diff --git a/bridge-validators/src/block.rs b/bridge-validators/src/block.rs index c98f710..01b2211 100644 --- a/bridge-validators/src/block.rs +++ b/bridge-validators/src/block.rs @@ -65,8 +65,10 @@ impl ChainClient { info!("[1] txn failed - skipping"); continue; } + } else if self.accept_events_with_no_status { + info!("[1] txn {:#x} has no status - accept_events_with_no_status = true; accepting", txn_hash); } else { - info!("[1] txn {:#x} has no status - ignoring", txn_hash); + info!("[1] txn {:#x} has no status - accept_events_with_no_status = false; rejecting", txn_hash); continue; } info!("Got receipt for txn {:#x}", txn_hash); @@ -168,7 +170,8 @@ impl BlockPolling for ChainClient { .filter(|log| { log.get("status") .and_then(|v| v.as_i64()) - .map_or(false, |s| { + .map_or( + self.accept_events_with_no_status, |s| { if s != 1 { info!("txn failed: status = {s:#x}"); false @@ -183,10 +186,12 @@ impl BlockPolling for ChainClient { .and_then(|val| val.parse::
().ok()) .map(|from_address| { if from_address == self.chain_gateway_address { + info!("event from {0:#x} has correct chain_gateway_address {1:#x}; accepting", + from_address, self.chain_gateway_address); true } else { info!( - "event from {0:#x} , chain gateway {1:#x}", + "event from {0:#x} , chain gateway {1:#x} - rejecting", from_address, self.chain_gateway_address ); false diff --git a/bridge-validators/src/client.rs b/bridge-validators/src/client.rs index 8af79d2..f4bd915 100644 --- a/bridge-validators/src/client.rs +++ b/bridge-validators/src/client.rs @@ -36,6 +36,7 @@ pub struct ChainClient { pub scan_behind_blocks: u64, pub log_strategy: LogStrategy, pub to_block_number: Option