Skip to content

Commit

Permalink
Fix witness endpoint for cdk (#773)
Browse files Browse the repository at this point in the history
* Fix witness endpoint for cdk

* Fix
  • Loading branch information
Nashtare authored Nov 6, 2024
1 parent 4646b2f commit fa114e8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions zero/src/rpc/jerigon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 =
Expand All @@ -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(),
Expand Down

0 comments on commit fa114e8

Please sign in to comment.