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

simulators/ethereum/engine: Fix incomplete transactions test #893

Merged
merged 1 commit into from
Sep 29, 2023
Merged
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
12 changes: 8 additions & 4 deletions simulators/ethereum/engine/suites/engine/invalid_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (tc InvalidPayloadTestCase) Execute(t *test.Env) {
var (
alteredPayload *typ.ExecutableData
invalidDetectedOnSync bool = tc.InvalidDetectedOnSync
nilLatestValidHash bool = tc.NilLatestValidHash
err error
)

Expand All @@ -131,10 +132,13 @@ func (tc InvalidPayloadTestCase) Execute(t *test.Env) {
t.Fatalf("FAIL (%s): Unable to modify payload (%v): %v", t.TestName, tc.InvalidField, err)
}

if t.CLMock.LatestPayloadBuilt.VersionedHashes != nil && len(*t.CLMock.LatestPayloadBuilt.VersionedHashes) > 0 && tc.InvalidField == helper.RemoveTransaction {
if t.CLMock.LatestPayloadBuilt.VersionedHashes != nil &&
len(*t.CLMock.LatestPayloadBuilt.VersionedHashes) > 0 &&
tc.InvalidField == helper.RemoveTransaction {
// If the payload has versioned hashes, and we removed any transaction, it's highly likely the client will
// be able to detect the invalid payload even when syncing because of the blob gas used.
invalidDetectedOnSync = true
nilLatestValidHash = true
}

// Depending on the field we modified, we expect a different status
Expand All @@ -157,7 +161,7 @@ func (tc InvalidPayloadTestCase) Execute(t *test.Env) {
}
} else {
r.ExpectStatus(test.Invalid)
if !(tc.NilLatestValidHash && r.Status.LatestValidHash == nil) {
if !(nilLatestValidHash && r.Status.LatestValidHash == nil) {
r.ExpectLatestValidHash(&alteredPayload.ParentHash)
}
}
Expand Down Expand Up @@ -222,7 +226,7 @@ func (tc InvalidPayloadTestCase) Execute(t *test.Env) {
} else {
// Otherwise the response should be INVALID.
q.ExpectStatus(test.Invalid)
if !(tc.NilLatestValidHash && r.Status.LatestValidHash == nil) {
if !(nilLatestValidHash && r.Status.LatestValidHash == nil) {
q.ExpectLatestValidHash(&t.CLMock.LatestExecutedPayload.BlockHash)
}
}
Expand Down Expand Up @@ -282,7 +286,7 @@ func (tc InvalidPayloadTestCase) Execute(t *test.Env) {
if r.Status.Status == test.Accepted || r.Status.Status == test.Syncing {
r.ExpectLatestValidHash(nil)
} else if r.Status.Status == test.Invalid {
if !(tc.NilLatestValidHash && r.Status.LatestValidHash == nil) {
if !(nilLatestValidHash && r.Status.LatestValidHash == nil) {
r.ExpectLatestValidHash(&alteredPayload.ParentHash)
}
}
Expand Down