Skip to content

Commit

Permalink
Replace regex in trie diff main (#758)
Browse files Browse the repository at this point in the history
* Replace trie diff regex

* RM previous regex crate
  • Loading branch information
sergerad authored Nov 4, 2024
1 parent 5383fbb commit a3f9a8d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
25 changes: 24 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion zero/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ hashbrown.workspace = true
hex.workspace = true
itertools.workspace = true
keccak-hash.workspace = true
lazy-regex = "3.3.0"
lru.workspace = true
mpt_trie.workspace = true
num-traits.workspace = true
once_cell.workspace = true
paladin-core.workspace = true
plonky2.workspace = true
plonky2_maybe_rayon.workspace = true
regex = "1.5.4"
rlp.workspace = true
ruint = { workspace = true, features = ["num-traits", "primitive-types"] }
serde.workspace = true
Expand Down
11 changes: 6 additions & 5 deletions zero/src/bin/trie_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use anyhow::Result;
use clap::{Parser, ValueHint};
use evm_arithmetization::generation::DebugOutputTries;
use futures::{future, TryStreamExt};
use lazy_regex::regex_captures;
use paladin::directive::{Directive, IndexedStream};
use paladin::runtime::Runtime;
use regex::Regex;
use trace_decoder::observer::TriesObserver;
use tracing::{error, info};
use zero::ops::register;
Expand Down Expand Up @@ -132,10 +132,11 @@ async fn main() -> Result<()> {
{
// Try to parse block and batch index from error message.
let error_message = e2.to_string();
let re = Regex::new(r"block:(\d+) batch:(\d+)")?;
if let Some(cap) = re.captures(&error_message) {
let block_number: u64 = cap[1].parse()?;
let batch_index: usize = cap[2].parse()?;
if let Some((_, block_number, block_index)) =
regex_captures!(r"block:(\d+) batch:(\d+)", error_message.as_str())
{
let block_number: u64 = block_number.parse()?;
let batch_index: usize = block_index.parse()?;

let prover_tries =
zero::debug_utils::load_tries_from_disk(block_number, batch_index)?;
Expand Down

0 comments on commit a3f9a8d

Please sign in to comment.