diff --git a/zero/src/rpc/jerigon.rs b/zero/src/rpc/jerigon.rs index df00bc605..915176852 100644 --- a/zero/src/rpc/jerigon.rs +++ b/zero/src/rpc/jerigon.rs @@ -8,6 +8,12 @@ use super::fetch_other_block_data; use crate::prover::BlockProverInput; use crate::provider::CachedProvider; +const WITNESS_ENDPOINT: &str = if cfg!(feature = "cdk_erigon") { + "zkevm_getWitness" +} else { + "eth_getWitness" +}; + /// Transaction traces retrieved from Erigon zeroTracer. #[derive(Debug, Deserialize)] pub struct ZeroTxResult { @@ -40,7 +46,7 @@ where let block_witness = cached_provider .get_provider() .await? - .raw_request::<_, String>("eth_getWitness".into(), vec![target_block_id]) + .raw_request::<_, String>(WITNESS_ENDPOINT.into(), vec![target_block_id]) .await?; let other_data = @@ -51,7 +57,9 @@ where block_trace: BlockTrace { trie_pre_images: BlockTraceTriePreImages::Combined(CombinedPreImages { compact: hex::decode(block_witness.strip_prefix("0x").unwrap_or(&block_witness)) - .context("invalid hex returned from call to eth_getWitness")?, + .context(format!( + "invalid hex returned from call to {WITNESS_ENDPOINT}" + ))?, }), txn_info: tx_results.into_iter().map(|it| it.result).collect(), code_db: Default::default(),