Skip to content

Commit

Permalink
Merge pull request #35 from Layr-Labs/epociask--v3.1.2-ci
Browse files Browse the repository at this point in the history
fix: Update EigenDA challenge tests
  • Loading branch information
epociask authored Sep 9, 2024
2 parents adbc5a5 + 05bdba4 commit e8981ff
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
version: v1.59.0
skip-pkg-cache: true
- name: Custom Lint
run: |
Expand Down
1 change: 0 additions & 1 deletion cmd/replay/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func (db PreimageDb) Get(key []byte) ([]byte, error) {
return nil, fmt.Errorf("preimage DB attempted to access non-hash key %v", hex.EncodeToString(key))
}

println("Reading pre-image", hex.EncodeToString(hash[:]))
return wavmio.ResolveTypedPreimage(arbutil.Keccak256PreimageType, hash)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/replay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go-ethereum
25 changes: 21 additions & 4 deletions system_tests/full_challenge_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,14 @@ func RunChallengeTest(t *testing.T, asserterIsCorrect bool, useStubs bool, chall
conf.InboxReader.CheckDelay = time.Second

if useEigenDA {
t.Log("Using EigenDA configurations for challenge test")
builder.chainConfig = params.ArbitrumDevTestEigenDAConfig()
builder.chainConfig.ArbitrumChainParams.EigenDA = true
builder.nodeConfig.EigenDA = eigenda.EigenDAConfig{
Enable: true,
Rpc: "http://localhost:4242",
}

chainConfig = params.ArbitrumDevTestEigenDAConfig()
chainConfig.ArbitrumChainParams.EigenDA = true
conf.EigenDA = eigenda.EigenDAConfig{
Expand Down Expand Up @@ -402,9 +410,19 @@ func RunChallengeTest(t *testing.T, asserterIsCorrect bool, useStubs bool, chall
challengerRollupAddresses.Bridge = challengerBridgeAddr
challengerRollupAddresses.SequencerInbox = challengerSeqInboxAddr
challengerL2Info := NewArbTestInfo(t, chainConfig.ChainID)
challengerParams := SecondNodeParams{
addresses: &challengerRollupAddresses,
initData: &challengerL2Info.ArbInitData,

var challengerParams SecondNodeParams
if useEigenDA {
challengerParams = SecondNodeParams{
nodeConfig: conf,
addresses: &challengerRollupAddresses,
initData: &challengerL2Info.ArbInitData,
}
} else {
challengerParams = SecondNodeParams{
addresses: &challengerRollupAddresses,
initData: &challengerL2Info.ArbInitData,
}
}
challenger, challengerCleanup := builder.Build2ndNode(t, &challengerParams)
defer challengerCleanup()
Expand Down Expand Up @@ -508,7 +526,6 @@ func RunChallengeTest(t *testing.T, asserterIsCorrect bool, useStubs bool, chall
confirmLatestBlock(ctx, t, l1Info, l1Backend)

readers := make([]daprovider.Reader, 1)

if useEigenDA {
eigenDA, err := eigenda.NewEigenDA(&conf.EigenDA)

Expand Down
4 changes: 2 additions & 2 deletions system_tests/full_challenge_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import "testing"
func TestMockChallengeManagerAsserterIncorrect(t *testing.T) {
defaultWasmRootDir := ""
for i := int64(1); i <= makeBatch_MsgsPerBatch*3; i++ {
RunChallengeTest(t, false, true, i, true, defaultWasmRootDir)
RunChallengeTest(t, false, true, i, false, defaultWasmRootDir)
RunChallengeTest(t, false, true, i, true, defaultWasmRootDir)
}
}

func TestMockChallengeManagerAsserterCorrect(t *testing.T) {
defaultWasmRootDir := ""
for i := int64(1); i <= makeBatch_MsgsPerBatch*3; i++ {
RunChallengeTest(t, true, true, i, true, defaultWasmRootDir)
RunChallengeTest(t, true, true, i, false, defaultWasmRootDir)
RunChallengeTest(t, true, true, i, true, defaultWasmRootDir)
}
}
4 changes: 4 additions & 0 deletions system_tests/full_challenge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func TestChallengeManagerFullAsserterIncorrect(t *testing.T) {
t.Parallel()
defaultWasmRootDir := ""
RunChallengeTest(t, false, false, makeBatch_MsgsPerBatch+1, false, defaultWasmRootDir)
RunChallengeTest(t, false, false, makeBatch_MsgsPerBatch+1, true, defaultWasmRootDir)
}

func TestChallengeManagerFullAsserterIncorrectWithPublishedMachine(t *testing.T) {
Expand All @@ -25,12 +26,14 @@ func TestChallengeManagerFullAsserterIncorrectWithPublishedMachine(t *testing.T)
Require(t, err)
machPath := populateMachineDir(t, cr)
RunChallengeTest(t, false, true, makeBatch_MsgsPerBatch+1, false, machPath)
RunChallengeTest(t, false, true, makeBatch_MsgsPerBatch+1, true, machPath)
}

func TestChallengeManagerFullAsserterCorrect(t *testing.T) {
t.Parallel()
defaultWasmRootDir := ""
RunChallengeTest(t, true, false, makeBatch_MsgsPerBatch+2, false, defaultWasmRootDir)
RunChallengeTest(t, true, false, makeBatch_MsgsPerBatch+2, true, defaultWasmRootDir)
}

func TestChallengeManagerFullAsserterCorrectWithPublishedMachine(t *testing.T) {
Expand All @@ -39,4 +42,5 @@ func TestChallengeManagerFullAsserterCorrectWithPublishedMachine(t *testing.T) {
Require(t, err)
machPath := populateMachineDir(t, cr)
RunChallengeTest(t, true, true, makeBatch_MsgsPerBatch+2, false, machPath)
RunChallengeTest(t, true, true, makeBatch_MsgsPerBatch+2, true, machPath)
}

0 comments on commit e8981ff

Please sign in to comment.