From a772f74c895b5db0165f98f5930169ae82150842 Mon Sep 17 00:00:00 2001 From: Potuz Date: Thu, 26 Sep 2024 13:42:46 -0300 Subject: [PATCH] export random execution request --- .../rpc/prysm/v1alpha1/validator/BUILD.bazel | 1 + .../v1alpha1/validator/proposer_epbs_test.go | 1 + testing/util/random/epbs.go | 18 +++++++++++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel b/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel index 663b72f3a037..7037f4e6c195 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel @@ -236,5 +236,6 @@ go_test( embed = [":go_default_library"], deps = common_deps + [ "//proto/prysm/v1alpha1/attestation/aggregation/testing:go_default_library", + "//testing/util/random:go_default_library", ], ) 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{