Skip to content

Commit 19800a4

Browse files
committed
use new block verifier
1 parent 29296e4 commit 19800a4

File tree

5 files changed

+21
-97
lines changed

5 files changed

+21
-97
lines changed

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,5 @@ jobs:
159159
run: just run_demo -s /tmp/stamp --ignore-stamp -k test-configs/local-2.json --rounds 10000 --yapper --nitro
160160
- name: Verify sequencer blocks
161161
run: |
162-
just verify_blocks
162+
RUST_LOG=info just verify_blocks
163163

Cargo.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ mkconfig_docker_full NUM_NODES RPC_URL PARENT_CHAIN_ID PARENT_INBOX_ADDRESS *ARG
110110
--mode "increment-address" {{ARGS}} | jq
111111

112112
verify_blocks:
113-
./scripts/verify-blocks
113+
cargo run --bin block_verifier
114114

115115
####################
116116
####TEST COMMANDS###

scripts/verify-blocks

Lines changed: 0 additions & 89 deletions
This file was deleted.

tests/block-verifier/src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ async fn main() -> Result<()> {
4242
let min_block = join_all(providers.iter().map(|p| async {
4343
p.get_block_number()
4444
.await
45-
.map(|b| b)
4645
.context("provider request failed")
4746
}))
4847
.await
@@ -57,7 +56,6 @@ async fn main() -> Result<()> {
5756
let blocks = join_all(providers.iter().map(|p| async {
5857
p.get_block_by_number(BlockNumberOrTag::Number(i))
5958
.await
60-
.map(|b| b)
6159
.context("provider request failed")
6260
}))
6361
.await
@@ -66,24 +64,26 @@ async fn main() -> Result<()> {
6664
let first_block = blocks
6765
.first()
6866
.and_then(|b| b.as_ref())
69-
.ok_or_else(|| anyhow::anyhow!("No blocks received from any provider"))?;
70-
info!(hash = %first_block.hash(), "verifying against block hash");
71-
for block in blocks.iter().skip(1) {
67+
.ok_or_else(|| anyhow::anyhow!("no blocks received from any provider"))?;
68+
for (i, block) in blocks.iter().enumerate().skip(1) {
7269
let b = block
7370
.as_ref()
7471
.ok_or_else(|| anyhow::anyhow!("provider returned no block"))?;
7572
if b != first_block {
7673
error!(
7774
block_a = ?b,
7875
block_b = ?first_block,
79-
"block mismatch between block state"
76+
"block mismatch between state"
8077
);
8178
anyhow::bail!(
8279
"block mismatch between blocks: left: {:?}, right: {:?}",
8380
b,
8481
first_block
8582
);
8683
}
84+
if i == blocks.len() - 1 {
85+
info!(block_hash = %b.hash(), txns = ?b.transactions, "✅ verified block");
86+
}
8787
}
8888
}
8989

0 commit comments

Comments
 (0)