Skip to content

Commit

Permalink
test(nightly): udpate compare params (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
revitteth authored Jun 13, 2024
1 parent 5e37493 commit f5dcde3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/nightly-node-compare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
erigon: "http://34.175.214.161:8500"
zkevm: "http://34.175.214.161:8505"
sequencer: "http://34.175.214.161:8005"
compare-blocks: 1000
allowed-block-diff: 2000

steps:
- name: Checkout code
Expand All @@ -35,4 +37,4 @@ jobs:
- name: Run block comparison
run: |
echo "Comparing blocks for pair: ${{ matrix.nodes.name }}"
./compare_blocks -erigon ${{ matrix.nodes.erigon }} -zkevm ${{ matrix.nodes.zkevm }} -sequencer ${{ matrix.nodes.sequencer }} -blocks 1000 -diff 10
./compare_blocks -erigon ${{ matrix.nodes.erigon }} -zkevm ${{ matrix.nodes.zkevm }} -sequencer ${{ matrix.nodes.sequencer }} -blocks ${{matrix.nodes.compare-blocks}} -diff ${{ matrix.nodes.allowed-block-diff }}
15 changes: 13 additions & 2 deletions zk/debug_tools/nightly-block-compare/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ func main() {
compareMode := flag.String("mode", "full", "Comparison mode: 'full' or 'root_and_hash'")
flag.Parse()

exitCode := 0
failureReason := ""

var (
erigonLatestBlock, zkevmLatestBlock, sequencerLatestBlock *big.Int
erigonVersion, zkevmVersion, sequencerVersion string
Expand Down Expand Up @@ -246,11 +249,15 @@ func main() {
log.Printf("Checking %d blocks\n", *numBlocks)

if erigonLatestBlock != nil && new(big.Int).Abs(new(big.Int).Sub(erigonLatestBlock, sequencerLatestBlock)).Cmp(big.NewInt(int64(*blockHeightDiff))) > 0 {
log.Printf("Warning: Erigon node is more than %d blocks apart from Sequencer: Erigon at %d, Sequencer at %d", *blockHeightDiff, erigonLatestBlock, sequencerLatestBlock)
log.Printf("Error: Erigon node is more than %d blocks apart from Sequencer: Erigon at %d, Sequencer at %d", *blockHeightDiff, erigonLatestBlock, sequencerLatestBlock)
failureReason = fmt.Sprintf("out of sync (Erigon) by %d blocks", new(big.Int).Abs(new(big.Int).Sub(erigonLatestBlock, sequencerLatestBlock)).Int64())
exitCode = 1
}

if zkevmLatestBlock != nil && new(big.Int).Abs(new(big.Int).Sub(zkevmLatestBlock, sequencerLatestBlock)).Cmp(big.NewInt(int64(*blockHeightDiff))) > 0 {
log.Printf("Warning: zkEVM node is more than %d blocks apart from Sequencer: zkEVM at %d, Sequencer at %d", *blockHeightDiff, zkevmLatestBlock, sequencerLatestBlock)
log.Printf("Error: zkEVM node is more than %d blocks apart from Sequencer: zkEVM at %d, Sequencer at %d", *blockHeightDiff, zkevmLatestBlock, sequencerLatestBlock)
failureReason = fmt.Sprintf("out of sync (zkEVM) by %d blocks", new(big.Int).Abs(new(big.Int).Sub(zkevmLatestBlock, sequencerLatestBlock)).Int64())
exitCode = 1
}

startBlock := sequencerLatestBlock
Expand Down Expand Up @@ -294,4 +301,8 @@ func main() {
}

log.Println("No differences found")
if failureReason != "" {
log.Println("Failure reason:", failureReason)
}
os.Exit(exitCode)
}

0 comments on commit f5dcde3

Please sign in to comment.