Skip to content

Commit

Permalink
fix test fixture setup
Browse files Browse the repository at this point in the history
  • Loading branch information
kasey committed May 10, 2024
1 parent 44036af commit b1826ea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 10 additions & 6 deletions beacon-chain/execution/engine_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1472,11 +1472,11 @@ func fixtures() map[string]interface{} {
address.SetBytes([]byte{0, 0, byte(i)})
pubkey := pb.BlsPubkey{}
copy(pubkey[:], []byte{0, byte(i)})
withdrawalRequests = append(withdrawalRequests, pb.WithdrawalRequestV1{
withdrawalRequests[i] = pb.WithdrawalRequestV1{
SourceAddress: address,
ValidatorPubkey: &pubkey,
Amount: &amount,
})
}
}
depositRequests := make([]pb.DepositRequestV1, 3)
for i := range depositRequests {
Expand All @@ -1488,13 +1488,17 @@ func fixtures() map[string]interface{} {
sig := pb.BlsSig{}
copy(sig[:], []byte{0, 0, 0, byte(i)})
idx := hexutil.Uint64(i)
depositRequests = append(depositRequests, pb.DepositRequestV1{
depositRequests[i] = pb.DepositRequestV1{
PubKey: &pubkey,
WithdrawalCredentials: creds,
Amount: &amount,
Signature: &sig,
Index: &idx,
})
}
}
outer := &pb.ExecutionPayloadElectraJSON{
WithdrawalRequests: withdrawalRequests,
DepositRequests: depositRequests,
}
executionPayloadFixtureElectra := &pb.ExecutionPayloadElectra{
ParentHash: foo[:],
Expand All @@ -1514,8 +1518,8 @@ func fixtures() map[string]interface{} {
Withdrawals: []*pb.Withdrawal{},
BlobGasUsed: 2,
ExcessBlobGas: 3,
DepositReceipts: depositRequests,
WithdrawalRequests: withdrawalRequests,
DepositReceipts: outer.ElectraDepositReceipts(),
WithdrawalRequests: outer.ElectraExecutionLayerWithdrawalRequests(),
}
hexUint := hexutil.Uint64(1)
executionPayloadWithValueFixtureCapella := &pb.GetPayloadV2ResponseJson{
Expand Down
8 changes: 4 additions & 4 deletions proto/engine/v1/json_marshal_unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -949,13 +949,13 @@ func (j *ExecutionPayloadElectraJSON) ElectraDepositReceipts() []*DepositReceipt

for i := range j.DepositRequests {
req := j.DepositRequests[i]
rcpt[i] = &DepositReceipt{
rcpt = append(rcpt, &DepositReceipt{
Pubkey: req.PubKey.Bytes(),
WithdrawalCredentials: req.WithdrawalCredentials.Bytes(),
Amount: uint64(*req.Amount),
Signature: req.Signature.Bytes(),
Index: uint64(*req.Index),
}
})
}

return rcpt
Expand All @@ -969,11 +969,11 @@ func (j *ExecutionPayloadElectraJSON) ElectraExecutionLayerWithdrawalRequests()

for i := range j.WithdrawalRequests {
req := j.WithdrawalRequests[i]
reqs[i] = &ExecutionLayerWithdrawalRequest{
reqs = append(reqs, &ExecutionLayerWithdrawalRequest{
SourceAddress: req.SourceAddress.Bytes(),
ValidatorPubkey: req.ValidatorPubkey.Bytes(),
Amount: uint64(*req.Amount),
}
})
}

return reqs
Expand Down

0 comments on commit b1826ea

Please sign in to comment.