forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
op-e2e/actions: improve Holocene tests by adding log assertions (ethe…
…reum-optimism#12889) * fix double error in inferring isHolocene * add capture logging to l2faultproofenv * fold log expectations into holoceneExpectations * improve test failure output * attach log expectations to invalid batch test case * add more log expectations * add more log expectations * add more test expectations for invalid payloads * add log assertion for deposits-only attributes * improve test names * improve subtest names * move holocene helpers to separate file * remove shadow * add log assertions for holocene_batches_test.go * remove assertion on logs in frame queue
- Loading branch information
Showing
5 changed files
with
128 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package proofs | ||
|
||
import ( | ||
actionsHelpers "github.com/ethereum-optimism/optimism/op-e2e/actions/helpers" | ||
"github.com/ethereum-optimism/optimism/op-service/eth" | ||
"github.com/ethereum-optimism/optimism/op-service/testlog" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
type logExpectations struct { | ||
role string | ||
filter string | ||
num int | ||
} | ||
type expectations struct { | ||
safeHead uint64 | ||
logs []logExpectations | ||
} | ||
type holoceneExpectations struct { | ||
preHolocene, holocene expectations | ||
} | ||
|
||
func (h holoceneExpectations) RequireExpectedProgressAndLogs(t actionsHelpers.StatefulTesting, actualSafeHead eth.L2BlockRef, isHolocene bool, engine *actionsHelpers.L2Engine, logs *testlog.CapturingHandler) { | ||
var exp expectations | ||
if isHolocene { | ||
exp = h.holocene | ||
} else { | ||
exp = h.preHolocene | ||
} | ||
|
||
require.Equal(t, exp.safeHead, actualSafeHead.Number) | ||
expectedHash := engine.L2Chain().GetBlockByNumber(exp.safeHead).Hash() | ||
require.Equal(t, expectedHash, actualSafeHead.Hash) | ||
|
||
for _, l := range exp.logs { | ||
t.Helper() | ||
recs := logs.FindLogs(testlog.NewMessageContainsFilter(l.filter), testlog.NewAttributesFilter("role", l.role)) | ||
require.Len(t, recs, l.num, "searching for %d instances of '%s' in logs from role %s", l.num, l.filter, l.role) | ||
} | ||
|
||
} | ||
|
||
func sequencerOnce(filter string) []logExpectations { | ||
return []logExpectations{{filter: filter, role: "sequencer", num: 1}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters