From 8799b62130dfa9866c58783e78f95f56501be95b Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Mon, 9 Sep 2024 14:52:28 -0400 Subject: [PATCH] remove dbug stmts --- cmd/replay/main.go | 2 +- staker/challenge_test.go | 91 ++++++++++++------------ system_tests/full_challenge_impl_test.go | 3 - system_tests/full_challenge_test.go | 1 - txt | 0 5 files changed, 47 insertions(+), 50 deletions(-) delete mode 100644 txt diff --git a/cmd/replay/main.go b/cmd/replay/main.go index 34b749edc..6666f5f6b 100644 --- a/cmd/replay/main.go +++ b/cmd/replay/main.go @@ -246,9 +246,9 @@ func main() { if dasEnabled { // DAS batch and keysets are all together in the same preimage binary. dasReader = &PreimageDASReader{} + dasKeysetFetcher = &PreimageDASReader{} } else if eigenDAEnabled { eigenDAReader = &EigenDAPreimageReader{} - dasKeysetFetcher = &PreimageDASReader{} } backend := WavmInbox{} var keysetValidationMode = daprovider.KeysetPanicIfInvalid diff --git a/staker/challenge_test.go b/staker/challenge_test.go index b86d37629..4534b04a2 100644 --- a/staker/challenge_test.go +++ b/staker/challenge_test.go @@ -22,6 +22,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/offchainlabs/nitro/solgen/go/mocksgen" "github.com/offchainlabs/nitro/solgen/go/ospgen" + "github.com/offchainlabs/nitro/validator" "github.com/offchainlabs/nitro/validator/server_arb" ) @@ -255,48 +256,48 @@ func createBaseMachine(t *testing.T, wasmname string, wasmModules []string) *ser return machine } -// func TestChallengeToOSP(t *testing.T) { -// machine := createBaseMachine(t, "global-state.wasm", []string{"global-state-wrapper.wasm"}) -// IncorrectMachine := server_arb.NewIncorrectMachine(machine, 200) -// runChallengeTest(t, machine, IncorrectMachine, false, false, 0) -// } - -// func TestChallengeToFailedOSP(t *testing.T) { -// machine := createBaseMachine(t, "global-state.wasm", []string{"global-state-wrapper.wasm"}) -// IncorrectMachine := server_arb.NewIncorrectMachine(machine, 200) -// runChallengeTest(t, machine, IncorrectMachine, true, false, 0) -// } - -// func TestChallengeToErroredOSP(t *testing.T) { -// machine := createBaseMachine(t, "const.wasm", nil) -// IncorrectMachine := server_arb.NewIncorrectMachine(machine, 10) -// runChallengeTest(t, machine, IncorrectMachine, false, false, 0) -// } - -// func TestChallengeToFailedErroredOSP(t *testing.T) { -// machine := createBaseMachine(t, "const.wasm", nil) -// IncorrectMachine := server_arb.NewIncorrectMachine(machine, 10) -// runChallengeTest(t, machine, IncorrectMachine, true, false, 0) -// } - -// func TestChallengeToTimeout(t *testing.T) { -// machine := createBaseMachine(t, "global-state.wasm", []string{"global-state-wrapper.wasm"}) -// IncorrectMachine := server_arb.NewIncorrectMachine(machine, 200) -// runChallengeTest(t, machine, IncorrectMachine, false, true, 0) -// } - -// func TestChallengeToTooFar(t *testing.T) { -// machine := createBaseMachine(t, "read-inboxmsg-10.wasm", []string{"global-state-wrapper.wasm"}) -// Require(t, machine.SetGlobalState(validator.GoGlobalState{PosInBatch: 10})) -// incorrectMachine := machine.Clone() -// Require(t, incorrectMachine.AddSequencerInboxMessage(10, []byte{0, 1, 2, 3})) -// runChallengeTest(t, machine, incorrectMachine, false, false, 9) -// } - -// func TestChallengeToFailedTooFar(t *testing.T) { -// machine := createBaseMachine(t, "read-inboxmsg-10.wasm", []string{"global-state-wrapper.wasm"}) -// Require(t, machine.SetGlobalState(validator.GoGlobalState{PosInBatch: 10})) -// incorrectMachine := machine.Clone() -// Require(t, machine.AddSequencerInboxMessage(10, []byte{0, 1, 2, 3})) -// runChallengeTest(t, machine, incorrectMachine, true, false, 11) -// } +func TestChallengeToOSP(t *testing.T) { + machine := createBaseMachine(t, "global-state.wasm", []string{"global-state-wrapper.wasm"}) + IncorrectMachine := server_arb.NewIncorrectMachine(machine, 200) + runChallengeTest(t, machine, IncorrectMachine, false, false, 0) +} + +func TestChallengeToFailedOSP(t *testing.T) { + machine := createBaseMachine(t, "global-state.wasm", []string{"global-state-wrapper.wasm"}) + IncorrectMachine := server_arb.NewIncorrectMachine(machine, 200) + runChallengeTest(t, machine, IncorrectMachine, true, false, 0) +} + +func TestChallengeToErroredOSP(t *testing.T) { + machine := createBaseMachine(t, "const.wasm", nil) + IncorrectMachine := server_arb.NewIncorrectMachine(machine, 10) + runChallengeTest(t, machine, IncorrectMachine, false, false, 0) +} + +func TestChallengeToFailedErroredOSP(t *testing.T) { + machine := createBaseMachine(t, "const.wasm", nil) + IncorrectMachine := server_arb.NewIncorrectMachine(machine, 10) + runChallengeTest(t, machine, IncorrectMachine, true, false, 0) +} + +func TestChallengeToTimeout(t *testing.T) { + machine := createBaseMachine(t, "global-state.wasm", []string{"global-state-wrapper.wasm"}) + IncorrectMachine := server_arb.NewIncorrectMachine(machine, 200) + runChallengeTest(t, machine, IncorrectMachine, false, true, 0) +} + +func TestChallengeToTooFar(t *testing.T) { + machine := createBaseMachine(t, "read-inboxmsg-10.wasm", []string{"global-state-wrapper.wasm"}) + Require(t, machine.SetGlobalState(validator.GoGlobalState{PosInBatch: 10})) + incorrectMachine := machine.Clone() + Require(t, incorrectMachine.AddSequencerInboxMessage(10, []byte{0, 1, 2, 3})) + runChallengeTest(t, machine, incorrectMachine, false, false, 9) +} + +func TestChallengeToFailedTooFar(t *testing.T) { + machine := createBaseMachine(t, "read-inboxmsg-10.wasm", []string{"global-state-wrapper.wasm"}) + Require(t, machine.SetGlobalState(validator.GoGlobalState{PosInBatch: 10})) + incorrectMachine := machine.Clone() + Require(t, machine.AddSequencerInboxMessage(10, []byte{0, 1, 2, 3})) + runChallengeTest(t, machine, incorrectMachine, true, false, 11) +} diff --git a/system_tests/full_challenge_impl_test.go b/system_tests/full_challenge_impl_test.go index 88d7a0ee7..91b2cb80b 100644 --- a/system_tests/full_challenge_impl_test.go +++ b/system_tests/full_challenge_impl_test.go @@ -484,8 +484,6 @@ func RunChallengeTest(t *testing.T, asserterIsCorrect bool, useStubs bool, chall } } - t.Log("WASM MODULE ROOT:", wasmModuleRoot.Hex()) - asserterGenesis := asserterExec.ArbInterface.BlockChain().Genesis() challengerGenesis := challengerExec.ArbInterface.BlockChain().Genesis() if asserterGenesis.Hash() != challengerGenesis.Hash() { @@ -509,7 +507,6 @@ func RunChallengeTest(t *testing.T, asserterIsCorrect bool, useStubs bool, chall } numBlocks := asserterLatestBlock.Number.Uint64() - asserterGenesis.NumberU64() - println("CREATING CHALLENGE") resultReceiver, challengeManagerAddr := CreateChallenge( t, ctx, diff --git a/system_tests/full_challenge_test.go b/system_tests/full_challenge_test.go index 024a778fe..f8c92a00e 100644 --- a/system_tests/full_challenge_test.go +++ b/system_tests/full_challenge_test.go @@ -20,7 +20,6 @@ func TestChallengeManagerFullAsserterIncorrect(t *testing.T) { RunChallengeTest(t, false, false, makeBatch_MsgsPerBatch+1, true, defaultWasmRootDir) } - func TestChallengeManagerFullAsserterIncorrectWithPublishedMachine(t *testing.T) { t.Parallel() cr, err := github.LatestConsensusRelease(context.Background()) diff --git a/txt b/txt deleted file mode 100644 index e69de29bb..000000000