From f9bde3e0972ff99e0040265aa6460c5ca0ab0a9b Mon Sep 17 00:00:00 2001 From: Potuz Date: Thu, 26 Sep 2024 13:42:46 -0300 Subject: [PATCH] export random execution request --- .../v1alpha1/validator/proposer_epbs_test.go | 1 + testing/util/random/epbs.go | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_epbs_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_epbs_test.go index ea263f3b9d6f..b263d84ea8eb 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_epbs_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_epbs_test.go @@ -92,6 +92,7 @@ func TestProposer_ComputePostPayloadStateRoot(t *testing.T) { expectedStateRoot := [32]byte{22, 85, 188, 95, 44, 156, 240, 10, 30, 106, 216, 244, 24, 39, 130, 196, 151, 118, 200, 94, 28, 42, 13, 170, 109, 206, 33, 83, 97, 154, 53, 251} p := &enginev1.ExecutionPayloadEnvelope{ Payload: &enginev1.ExecutionPayloadElectra{}, + ExecutionRequests: &enginev1.ExecutionRequests{}, BeaconBlockRoot: root[:], BlobKzgCommitments: make([][]byte, 0), StateRoot: expectedStateRoot[:], diff --git a/testing/util/random/epbs.go b/testing/util/random/epbs.go index 874fdd74b2d5..110d701f4448 100644 --- a/testing/util/random/epbs.go +++ b/testing/util/random/epbs.go @@ -371,13 +371,8 @@ func SignedExecutionPayloadEnvelope(t *testing.T) *enginev1.SignedExecutionPaylo func ExecutionPayloadEnvelope(t *testing.T) *enginev1.ExecutionPayloadEnvelope { withheld := randomUint64(t)%2 == 0 return &enginev1.ExecutionPayloadEnvelope{ - Payload: ExecutionPayload(t), - ExecutionRequests: &enginev1.ExecutionRequests{ - Deposits: []*enginev1.DepositRequest{DepositRequest(t), DepositRequest(t), DepositRequest(t), DepositRequest(t)}, - Withdrawals: WithdrawalRequests(t), - Consolidations: []*enginev1.ConsolidationRequest{ConsolidationRequest(t)}, - }, - BuilderIndex: primitives.ValidatorIndex(randomUint64(t)), + Payload: ExecutionPayload(t), + ExecutionRequests: ExecutionRequests(t), BuilderIndex: primitives.ValidatorIndex(randomUint64(t)), BeaconBlockRoot: randomBytes(32, t), BlobKzgCommitments: [][]byte{randomBytes(48, t), randomBytes(48, t), randomBytes(48, t)}, PayloadWithheld: withheld, @@ -385,6 +380,15 @@ func ExecutionPayloadEnvelope(t *testing.T) *enginev1.ExecutionPayloadEnvelope { } } +// ExecutionRequests creates a random Execution request object for testing purposes +func ExecutionRequests(t *testing.T) *enginev1.ExecutionRequests { + return &enginev1.ExecutionRequests{ + Deposits: []*enginev1.DepositRequest{DepositRequest(t), DepositRequest(t), DepositRequest(t), DepositRequest(t)}, + Withdrawals: WithdrawalRequests(t), + Consolidations: []*enginev1.ConsolidationRequest{ConsolidationRequest(t)}, + } +} + // ExecutionPayload creates a random ExecutionPayloadEPBS for testing purposes. func ExecutionPayload(t *testing.T) *enginev1.ExecutionPayloadElectra { return &enginev1.ExecutionPayloadElectra{