sync blobs in initial-sync (#12522)

This commit is contained in:
kasey
2023-07-25 16:57:01 -05:00
committed by Preston Van Loon
parent 48f1f69695
commit 3476112d63
32 changed files with 1163 additions and 368 deletions

View File

@@ -1604,8 +1604,9 @@ func fixtures() map[string]interface{} {
func Test_fullPayloadFromExecutionBlock(t *testing.T) {
type args struct {
header *pb.ExecutionPayloadHeader
block *pb.ExecutionBlock
header *pb.ExecutionPayloadHeader
block *pb.ExecutionBlock
version int
}
wantedHash := common.BytesToHash([]byte("foo"))
tests := []struct {
@@ -1621,9 +1622,9 @@ func Test_fullPayloadFromExecutionBlock(t *testing.T) {
BlockHash: []byte("foo"),
},
block: &pb.ExecutionBlock{
Version: version.Bellatrix,
Hash: common.BytesToHash([]byte("bar")),
Hash: common.BytesToHash([]byte("bar")),
},
version: version.Bellatrix,
},
err: "does not match execution block hash",
},
@@ -1634,9 +1635,9 @@ func Test_fullPayloadFromExecutionBlock(t *testing.T) {
BlockHash: wantedHash[:],
},
block: &pb.ExecutionBlock{
Version: version.Bellatrix,
Hash: wantedHash,
Hash: wantedHash,
},
version: version.Bellatrix,
},
want: func() interfaces.ExecutionData {
p, err := blocks.WrappedExecutionPayload(&pb.ExecutionPayload{
@@ -1652,7 +1653,7 @@ func Test_fullPayloadFromExecutionBlock(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
wrapped, err := blocks.WrappedExecutionPayloadHeader(tt.args.header)
require.NoError(t, err)
got, err := fullPayloadFromExecutionBlock(wrapped, tt.args.block)
got, err := fullPayloadFromExecutionBlock(tt.args.version, wrapped, tt.args.block)
if err != nil {
assert.ErrorContains(t, tt.err, err)
} else {
@@ -1664,8 +1665,9 @@ func Test_fullPayloadFromExecutionBlock(t *testing.T) {
func Test_fullPayloadFromExecutionBlockCapella(t *testing.T) {
type args struct {
header *pb.ExecutionPayloadHeaderCapella
block *pb.ExecutionBlock
header *pb.ExecutionPayloadHeaderCapella
block *pb.ExecutionBlock
version int
}
wantedHash := common.BytesToHash([]byte("foo"))
tests := []struct {
@@ -1681,9 +1683,9 @@ func Test_fullPayloadFromExecutionBlockCapella(t *testing.T) {
BlockHash: []byte("foo"),
},
block: &pb.ExecutionBlock{
Version: version.Capella,
Hash: common.BytesToHash([]byte("bar")),
Hash: common.BytesToHash([]byte("bar")),
},
version: version.Capella,
},
err: "does not match execution block hash",
},
@@ -1694,9 +1696,9 @@ func Test_fullPayloadFromExecutionBlockCapella(t *testing.T) {
BlockHash: wantedHash[:],
},
block: &pb.ExecutionBlock{
Version: version.Capella,
Hash: wantedHash,
Hash: wantedHash,
},
version: version.Capella,
},
want: func() interfaces.ExecutionData {
p, err := blocks.WrappedExecutionPayloadCapella(&pb.ExecutionPayloadCapella{
@@ -1712,7 +1714,7 @@ func Test_fullPayloadFromExecutionBlockCapella(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
wrapped, err := blocks.WrappedExecutionPayloadHeaderCapella(tt.args.header, 0)
require.NoError(t, err)
got, err := fullPayloadFromExecutionBlock(wrapped, tt.args.block)
got, err := fullPayloadFromExecutionBlock(tt.args.version, wrapped, tt.args.block)
if err != nil {
assert.ErrorContains(t, tt.err, err)
} else {
@@ -1724,8 +1726,9 @@ func Test_fullPayloadFromExecutionBlockCapella(t *testing.T) {
func Test_fullPayloadFromExecutionBlockDeneb(t *testing.T) {
type args struct {
header *pb.ExecutionPayloadHeaderDeneb
block *pb.ExecutionBlock
header *pb.ExecutionPayloadHeaderDeneb
block *pb.ExecutionBlock
version int
}
wantedHash := common.BytesToHash([]byte("foo"))
tests := []struct {
@@ -1741,9 +1744,9 @@ func Test_fullPayloadFromExecutionBlockDeneb(t *testing.T) {
BlockHash: []byte("foo"),
},
block: &pb.ExecutionBlock{
Version: version.Deneb,
Hash: common.BytesToHash([]byte("bar")),
Hash: common.BytesToHash([]byte("bar")),
},
version: version.Deneb,
},
err: "does not match execution block hash",
},
@@ -1754,9 +1757,9 @@ func Test_fullPayloadFromExecutionBlockDeneb(t *testing.T) {
BlockHash: wantedHash[:],
},
block: &pb.ExecutionBlock{
Version: version.Deneb,
Hash: wantedHash,
Hash: wantedHash,
},
version: version.Deneb,
},
want: func() interfaces.ExecutionData {
p, err := blocks.WrappedExecutionPayloadDeneb(&pb.ExecutionPayloadDeneb{
@@ -1772,7 +1775,7 @@ func Test_fullPayloadFromExecutionBlockDeneb(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
wrapped, err := blocks.WrappedExecutionPayloadHeaderDeneb(tt.args.header, 0)
require.NoError(t, err)
got, err := fullPayloadFromExecutionBlock(wrapped, tt.args.block)
got, err := fullPayloadFromExecutionBlock(tt.args.version, wrapped, tt.args.block)
if err != nil {
assert.ErrorContains(t, tt.err, err)
} else {