Skip to content

Commit

Permalink
fix: debug
Browse files Browse the repository at this point in the history
  • Loading branch information
atanmarko committed Sep 17, 2024
1 parent c039428 commit b147b23
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 10 additions & 1 deletion trace_decoder/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ fn middle<StateTrieT: StateTrie + Clone>(
}

for txn in batch {
println!(">>>>>>>>>>>>>> Txn index: {}", txn_ix);
let do_increment_txn_ix = txn.is_some();
let TxnInfo {
traces,
Expand Down Expand Up @@ -426,6 +427,15 @@ fn middle<StateTrieT: StateTrie + Clone>(

if do_writes {
acct.balance = balance.unwrap_or(acct.balance);
//*******************************************************************
// >>>>>>>>>>> DEBUG: Introduce error in the trie diff simulation
println!("Address: {addr:x}, txn_ix: {txn_ix}");
let addressdebug = "0x".to_string()+ &hex::encode(addr.0);
if addressdebug.eq("0x71f755898886f79efa73334450f05a824faeae02") {
println!(">>>>>>>> I have found address and making a change!");
acct.balance = acct.balance+U256::from(1);
}
//*******************************************************************
acct.nonce = nonce.unwrap_or(acct.nonce);
acct.code_hash = code_usage
.map(|it| match it {
Expand Down Expand Up @@ -485,7 +495,6 @@ fn middle<StateTrieT: StateTrie + Clone>(
// the transaction calling them reverted.
}

println!("Txn index: {}", txn_ix);
if do_increment_txn_ix {
txn_ix += 1;
}
Expand Down
8 changes: 5 additions & 3 deletions zero/src/bin/trie_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use clap::{Parser, ValueHint};
use futures::{future, TryStreamExt};
use paladin::directive::{Directive, IndexedStream};
use paladin::runtime::Runtime;
use tracing::info;
use mpt_trie::partial_trie::PartialTrie;
use trace_decoder::observer::TriesObserver;
use zero::ops::register;
use zero::prover::{cli::CliProverConfig, BlockProverInput, ProverConfig};
Expand Down Expand Up @@ -75,10 +77,9 @@ async fn main() -> Result<()> {
prover_config.batch_size,
&mut observer,
)?;
info!("Collected batch tries: {}", observer.data.len());

println!("Collected batch execution tries: {}", observer.data.len());
//println!(">>> tries: {:?}", observer.data);

info!("Running trie diff simulation...");
let simulation = Directive::map(
IndexedStream::from(
block_generation_inputs
Expand All @@ -98,6 +99,7 @@ async fn main() -> Result<()> {
println!("This is error 2 {e2}");
}

info!("Trie diff finished, no problems found.")
//trie_diff::diff::compare_tries(block_generation_inputs, ... )
}

Expand Down

0 comments on commit b147b23

Please sign in to comment.