Skip to content

Commit

Permalink
export random execution request
Browse files Browse the repository at this point in the history
  • Loading branch information
potuz committed Sep 26, 2024
1 parent 294a246 commit a772f74
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions beacon-chain/rpc/prysm/v1alpha1/validator/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -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[:],
Expand Down
18 changes: 11 additions & 7 deletions testing/util/random/epbs.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,20 +371,24 @@ 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,
StateRoot: randomBytes(32, t),
}
}

// 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{
Expand Down

0 comments on commit a772f74

Please sign in to comment.