Skip to content

Commit

Permalink
feat: expand trace decoder tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atanmarko committed Jul 16, 2024
1 parent 3336055 commit e01ad9e
Show file tree
Hide file tree
Showing 19 changed files with 905 additions and 100 deletions.
140 changes: 122 additions & 18 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions trace_decoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ winnow = { workspace = true }
criterion = { workspace = true }
pretty_env_logger = { workspace = true }
serde_json = { workspace = true }
prover = { workspace = true }
serde_path_to_error = { workspace = true }
alloy-rpc-types-eth = "0.1.4"
rstest = "0.21.0"

[[bench]]
name = "block_processing"
Expand Down
16 changes: 10 additions & 6 deletions trace_decoder/src/type1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,13 @@ fn iter_leaves(node: Node) -> Box<dyn Iterator<Item = (Vec<U4>, IterLeaf)>> {
}

#[test]
fn test() {
for (ix, case) in
serde_json::from_str::<Vec<super::Case>>(include_str!("test_cases/zero_jerigon.json"))
.unwrap()
.into_iter()
.enumerate()
fn test_tries() {
for (ix, case) in serde_json::from_str::<Vec<super::Case>>(include_str!(
"../tests/data/tries/zero_jerigon.json"
))
.unwrap()
.into_iter()
.enumerate()
{
println!("case {}", ix);
let instructions = crate::wire::parse(&case.bytes).unwrap();
Expand All @@ -454,3 +455,6 @@ fn test() {
}
}
}

#[test]
fn test_witness_processing() {}
13 changes: 7 additions & 6 deletions trace_decoder/src/type2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,13 @@ fn iter_leaves(node: Node) -> Box<dyn Iterator<Item = (BitVec, Either<[u8; 32],
}

#[test]
fn test() {
for (ix, case) in
serde_json::from_str::<Vec<super::Case>>(include_str!("test_cases/hermez_cdk_erigon.json"))
.unwrap()
.into_iter()
.enumerate()
fn test_tries() {
for (ix, case) in serde_json::from_str::<Vec<super::Case>>(include_str!(
"../tests/data/tries/hermez_cdk_erigon.json"
))
.unwrap()
.into_iter()
.enumerate()
{
println!("case {}", ix);
let instructions = crate::wire::parse(&case.bytes).unwrap();
Expand Down
File renamed without changes.

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

Loading

0 comments on commit e01ad9e

Please sign in to comment.