Commit 2a1b398f authored by Adrian Sutton's avatar Adrian Sutton

op-challenger: Use claim with no pre-image. Improve logging.

parent 12dd92cb
...@@ -5,7 +5,6 @@ import ( ...@@ -5,7 +5,6 @@ import (
"encoding/hex" "encoding/hex"
"testing" "testing"
"github.com/ethereum-optimism/optimism/cannon/mipsevm"
faulttest "github.com/ethereum-optimism/optimism/op-challenger/game/fault/test" faulttest "github.com/ethereum-optimism/optimism/op-challenger/game/fault/test"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
...@@ -90,13 +89,8 @@ func TestCalculateNextActions(t *testing.T) { ...@@ -90,13 +89,8 @@ func TestCalculateNextActions(t *testing.T) {
name: "PoisonedPreState", name: "PoisonedPreState",
agreeWithOutputRoot: true, agreeWithOutputRoot: true,
setupGame: func(builder *faulttest.GameBuilder) { setupGame: func(builder *faulttest.GameBuilder) {
// Create a cannon state that is exited and resolved that the output root was invalid // A claim hash that has no pre-image
maliciousState := mipsevm.State{ maliciousStateHash := common.Hash{0x01, 0xaa}
Memory: mipsevm.NewMemory(),
ExitCode: 1,
Exited: true,
}
maliciousStateHash, _ := maliciousState.EncodeWitness().StateHash()
// Dishonest actor counters their own claims to set up a situation with an invalid prestate // Dishonest actor counters their own claims to set up a situation with an invalid prestate
// The honest actor should attack all claims that support the root claim (disagree with the output root) // The honest actor should attack all claims that support the root claim (disagree with the output root)
...@@ -120,7 +114,8 @@ func TestCalculateNextActions(t *testing.T) { ...@@ -120,7 +114,8 @@ func TestCalculateNextActions(t *testing.T) {
test.setupGame(builder) test.setupGame(builder)
game := builder.Game game := builder.Game
for i, claim := range game.Claims() { for i, claim := range game.Claims() {
t.Logf("Claim %v: Pos: %v ParentIdx: %v, Countered: %v, Value: %v", i, claim.Position.ToGIndex(), claim.ParentContractIndex, claim.Countered, claim.Value) t.Logf("Claim %v: Pos: %v TraceIdx: %v ParentIdx: %v, Countered: %v, Value: %v",
i, claim.Position.ToGIndex(), claim.Position.TraceIndex(maxDepth), claim.ParentContractIndex, claim.Countered, claim.Value)
} }
solver := NewGameSolver(maxDepth, claimBuilder.CorrectTraceProvider()) solver := NewGameSolver(maxDepth, claimBuilder.CorrectTraceProvider())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment