Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sim flakiness #2123

Merged
merged 10 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions go/enclave/components/rollup_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,22 @@ func (rc *rollupConsumerImpl) extractAndVerifyRollups(br *common.BlockAndReceipt
return rollups, nil
}

// there may be many rollups in one block so the blobHashes array, so it is possible that the rollupHashes array is a
// subset of the blobHashes array
func verifyBlobHashes(rollupHashes *ethadapter.L1RollupHashes, blobHashes []gethcommon.Hash) error {
for i, hash := range rollupHashes.BlobHashes {
if hash != blobHashes[i] {
return fmt.Errorf("hash mismatch at index %d: rollupHash (%s) != blobHash (%s)", i, hash.Hex(), blobHashes[i].Hex())
// more efficient lookup
blobHashSet := make(map[gethcommon.Hash]struct{}, len(blobHashes))
for _, h := range blobHashes {
blobHashSet[h] = struct{}{}
}

for i, rollupHash := range rollupHashes.BlobHashes {
if _, exists := blobHashSet[rollupHash]; !exists {
return fmt.Errorf(
"rollupHash at index %d (%s) not found in blobHashes",
i,
rollupHash.Hex(),
)
}
}
return nil
Expand Down
9 changes: 4 additions & 5 deletions integration/simulation/simulation_tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,13 @@ func testSimulation(t *testing.T, netw network.Network, params *params.SimParams
// run tests
fmt.Printf("Validating simulation results\n")
testlog.Logger().Info("Validating simulation results")

checkNetworkValidity(t, &simulation)

fmt.Printf("Stopping simulation\n")
testlog.Logger().Info("Stopping simulation")
simulation.Stop()

// generate and print the final stats
t.Logf("Simulation results:%+v", NewOutputStats(&simulation))
testlog.Logger().Info(fmt.Sprintf("Simulation results:%+v", NewOutputStats(&simulation)))

fmt.Printf("Stopping simulation\n")
testlog.Logger().Info("Stopping simulation")
simulation.Stop()
}
Loading