Skip to content

Commit 34b21d6

Browse files
committed
eth/catalyst: fix tests for getPayload change (ethereum#33322)
Fixes a test/lint regression introduced by ethereum#32754
1 parent 81b8673 commit 34b21d6

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

eth/catalyst/api.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,13 @@ func (api *ConsensusAPI) GetPayloadV5(payloadID engine.PayloadID) (*engine.Execu
466466
})
467467
}
468468

469-
// getPayload will retreive the specified payload and verify it conforms to the
469+
// getPayload will retrieve the specified payload and verify it conforms to the
470470
// endpoint's allowed payload versions and forks.
471+
//
472+
// Note passing nil `forks`, `versions` disables the respective check.
471473
func (api *ConsensusAPI) getPayload(payloadID engine.PayloadID, full bool, versions []engine.PayloadVersion, forks []forks.Fork) (*engine.ExecutionPayloadEnvelope, error) {
472474
log.Trace("Engine API request received", "method", "GetPayload", "id", payloadID)
473-
if !payloadID.Is(versions...) {
475+
if versions != nil && !payloadID.Is(versions...) {
474476
return nil, engine.UnsupportedFork
475477
}
476478
data := api.localBlocks.get(payloadID, full)

eth/catalyst/api_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func TestEth2PrepareAndGetPayload(t *testing.T) {
203203
BeaconRoot: blockParams.BeaconRoot,
204204
Version: engine.PayloadV1,
205205
}).Id()
206-
execData, err := api.getPayload(payloadID, true)
206+
execData, err := api.getPayload(payloadID, true, nil, nil)
207207
if err != nil {
208208
t.Fatalf("error getting payload, err=%v", err)
209209
}
@@ -636,7 +636,7 @@ func TestNewPayloadOnInvalidChain(t *testing.T) {
636636
t.Fatalf("error preparing payload, invalid status: %v", resp.PayloadStatus.Status)
637637
}
638638
// give the payload some time to be built
639-
if payload, err = api.getPayload(*resp.PayloadID, true); err != nil {
639+
if payload, err = api.getPayload(*resp.PayloadID, true, nil, nil); err != nil {
640640
t.Fatalf("can't get payload: %v", err)
641641
}
642642
if len(payload.ExecutionPayload.Transactions) > 0 {
@@ -1219,7 +1219,7 @@ func TestNilWithdrawals(t *testing.T) {
12191219
Random: test.blockParams.Random,
12201220
Version: payloadVersion,
12211221
}).Id()
1222-
execData, err := api.GetPayloadV2(payloadID)
1222+
execData, err := api.getPayload(payloadID, false, nil, nil)
12231223
if err != nil {
12241224
t.Fatalf("error getting payload, err=%v", err)
12251225
}
@@ -1674,7 +1674,7 @@ func TestWitnessCreationAndConsumption(t *testing.T) {
16741674
BeaconRoot: blockParams.BeaconRoot,
16751675
Version: engine.PayloadV3,
16761676
}).Id()
1677-
envelope, err := api.getPayload(payloadID, true)
1677+
envelope, err := api.getPayload(payloadID, true, nil, nil)
16781678
if err != nil {
16791679
t.Fatalf("error getting payload, err=%v", err)
16801680
}

eth/catalyst/simulated_beacon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
214214
return nil
215215
}
216216

217-
envelope, err := c.engineAPI.getPayload(*fcResponse.PayloadID, true)
217+
envelope, err := c.engineAPI.getPayload(*fcResponse.PayloadID, true, nil, nil)
218218
if err != nil {
219219
return err
220220
}

0 commit comments

Comments
 (0)