Update block Beacon APIs to Capella (#11706)

* proto+ssz

* refactor GetBlindedBlockSSZ

(cherry picked from commit 97483c339f99b0d96bd81846a979383ffd2b0cda)

# Conflicts:
#	beacon-chain/rpc/eth/beacon/blocks.go
(cherry picked from commit 9e4e82d2c5)

# Conflicts:
#	beacon-chain/rpc/eth/beacon/blocks.go

* add Capella version

(cherry picked from commit 5d6fd0bbe663e5dd16df5b2e773f68982bbcd24e)
(cherry picked from commit 82f6ddb693)

* support SSZ lol

(cherry picked from commit 52bc2c8d617ac3e1254c493fa053cdce4a1ebd63)
(cherry picked from commit d7d70bc25b)

* update withdrawals proto

* refactor and test GetBlockV2

(cherry picked from commit c1d4eaa79d)

# Conflicts:
#	beacon-chain/rpc/eth/beacon/blocks.go

* refactor and test GetSSZBlockV2

(cherry picked from commit fbc4e73d31)

# Conflicts:
#	beacon-chain/rpc/eth/beacon/blocks.go

* test other functions

(cherry picked from commit 31d4a4cd11)

* move stuff to blinded_blocks.go

(cherry picked from commit 0a9e1658dd)

# Conflicts:
#	beacon-chain/rpc/eth/beacon/blocks.go

* fix migration code

* add Capella to SubmitBlock

* custom hooks

* missing structs

* fix tests

* fix tests

* review

* fix build issues

* replace ioutil with io

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Radosław Kapka
2022-12-16 00:42:07 +01:00
committed by GitHub
parent e843cafe7d
commit cb02a6897d
35 changed files with 2180 additions and 1175 deletions

View File

@@ -98,10 +98,10 @@ func TestWrapExecutionPayloadCapella(t *testing.T) {
BlockHash: []byte("blockhash"),
Transactions: [][]byte{[]byte("transaction")},
Withdrawals: []*enginev1.Withdrawal{{
WithdrawalIndex: 55,
ValidatorIndex: 66,
ExecutionAddress: []byte("executionaddress"),
Amount: 77,
Index: 55,
ValidatorIndex: 66,
Address: []byte("executionaddress"),
Amount: 77,
}},
}
payload, err := blocks.WrappedExecutionPayloadCapella(data)

View File

@@ -1243,9 +1243,9 @@ func getFields() fields {
},
Withdrawals: []*enginev1.Withdrawal{
{
WithdrawalIndex: 128,
ExecutionAddress: b20,
Amount: 128,
Index: 128,
Address: b20,
Amount: 128,
},
},
}

View File

@@ -58,7 +58,7 @@ func TestPayloadAttributeGetters(t *testing.T) {
{
name: "Get withdrawals (capella)",
tc: func(t *testing.T) {
wd := []*enginev1.Withdrawal{{WithdrawalIndex: 1}, {WithdrawalIndex: 2}, {WithdrawalIndex: 3}}
wd := []*enginev1.Withdrawal{{Index: 1}, {Index: 2}, {Index: 3}}
a, err := New(&enginev1.PayloadAttributesV2{Withdrawals: wd})
require.NoError(t, err)
got, err := a.Withdrawals()
@@ -126,7 +126,7 @@ func TestPayloadAttributeGetters(t *testing.T) {
Timestamp: 1,
PrevRandao: []byte{1, 2, 3},
SuggestedFeeRecipient: []byte{4, 5, 6},
Withdrawals: []*enginev1.Withdrawal{{WithdrawalIndex: 1}, {WithdrawalIndex: 2}, {WithdrawalIndex: 3}},
Withdrawals: []*enginev1.Withdrawal{{Index: 1}, {Index: 2}, {Index: 3}},
}
a, err := New(p)
require.NoError(t, err)