@@ -13,17 +13,17 @@ import (
1313func TestWithdrawalCredentials (t * testing.T ) {
1414 t .Run ("0x01 from hex address" , func (t * testing.T ) {
1515 eth1Address := common .HexToAddress ("d999bc994e0274235b65ca72ec430b8de3eb7df9" )
16- require .EqualValues (t , WithdrawalCredentials (ETH1WithdrawalPrefix , eth1Address [:] ), []byte {1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0xd9 , 0x99 , 0xbc , 0x99 , 0x4e , 0x2 , 0x74 , 0x23 , 0x5b , 0x65 , 0xca , 0x72 , 0xec , 0x43 , 0xb , 0x8d , 0xe3 , 0xeb , 0x7d , 0xf9 })
16+ require .EqualValues (t , WithdrawalCredentials (ETH1WithdrawalPrefix , eth1Address ), []byte {1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0xd9 , 0x99 , 0xbc , 0x99 , 0x4e , 0x2 , 0x74 , 0x23 , 0x5b , 0x65 , 0xca , 0x72 , 0xec , 0x43 , 0xb , 0x8d , 0xe3 , 0xeb , 0x7d , 0xf9 })
1717 })
1818
1919 t .Run ("0x01 from byte address" , func (t * testing.T ) {
2020 eth1Address := common.Address {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 }
21- require .EqualValues (t , WithdrawalCredentials (ETH1WithdrawalPrefix , eth1Address [:] ), []byte {1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 })
21+ require .EqualValues (t , WithdrawalCredentials (ETH1WithdrawalPrefix , eth1Address ), []byte {1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 })
2222 })
2323
2424 t .Run ("0x02 compounding" , func (t * testing.T ) {
2525 addr := common.Address {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 }
26- creds := WithdrawalCredentials (CompoundingWithdrawalPrefix , addr [:] )
26+ creds := WithdrawalCredentials (CompoundingWithdrawalPrefix , addr )
2727
2828 require .Len (t , creds , 32 )
2929 require .Equal (t , byte (2 ), creds [0 ], "first byte should be 0x02" )
@@ -36,7 +36,7 @@ func TestWithdrawalCredentials(t *testing.T) {
3636
3737func TestComputeDepositMessageSigningRoot (t * testing.T ) {
3838 // Effective 20-byte address used across signing root tests.
39- addr := []byte {1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
39+ addr := [20 ]byte {1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
4040
4141 t .Run ("mainnet" , func (t * testing.T ) {
4242 r , err := ComputeDepositMessageSigningRoot (core .MainNetwork , & phase0.DepositMessage {
@@ -60,7 +60,7 @@ func TestComputeDepositMessageSigningRoot(t *testing.T) {
6060}
6161
6262func TestDepositDataRootForFork (t * testing.T ) {
63- addr := []byte {1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
63+ addr := [20 ]byte {1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 }
6464
6565 t .Run ("mainnet" , func (t * testing.T ) {
6666 r , err := DepositDataRootForFork (
@@ -93,16 +93,16 @@ func TestValidateWithdrawalCredentials(t *testing.T) {
9393 }{
9494 {
9595 name : "valid 32-byte 0x01" ,
96- input : WithdrawalCredentials (ETH1WithdrawalPrefix , []byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 }),
96+ input : WithdrawalCredentials (ETH1WithdrawalPrefix , [20 ]byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 }),
9797 },
9898 {
9999 name : "valid 32-byte 0x02" ,
100- input : WithdrawalCredentials (CompoundingWithdrawalPrefix , []byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 }),
100+ input : WithdrawalCredentials (CompoundingWithdrawalPrefix , [20 ]byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 }),
101101 },
102102 {
103103 name : "non-zero padding accepted" ,
104104 input : func () []byte {
105- c := WithdrawalCredentials (ETH1WithdrawalPrefix , make ([ ]byte , 20 ) )
105+ c := WithdrawalCredentials (ETH1WithdrawalPrefix , [ 20 ]byte {} )
106106 c [5 ] = 0xFF
107107 return c
108108 }(),
@@ -148,7 +148,7 @@ func TestValidateWithdrawalCredentials(t *testing.T) {
148148
149149func TestDepositDataRootForFork_0x02 (t * testing.T ) {
150150 t .Run ("mainnet 0x02" , func (t * testing.T ) {
151- creds := WithdrawalCredentials (CompoundingWithdrawalPrefix , []byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 })
151+ creds := WithdrawalCredentials (CompoundingWithdrawalPrefix , [20 ]byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 })
152152 _ , err := DepositDataRootForFork (
153153 phase0.Version {0 , 0 , 0 , 0 },
154154 []byte {1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 },
@@ -167,7 +167,7 @@ func TestVerifyDepositData_0x02(t *testing.T) {
167167 pk := phase0.BLSPubKey {}
168168 copy (pk [:], sk .GetPublicKey ().Serialize ())
169169
170- creds := WithdrawalCredentials (CompoundingWithdrawalPrefix , []byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 })
170+ creds := WithdrawalCredentials (CompoundingWithdrawalPrefix , [20 ]byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 })
171171
172172 r , err := ComputeDepositMessageSigningRoot (core .MainNetwork , & phase0.DepositMessage {
173173 PublicKey : pk ,
0 commit comments