Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ filegroup(
url = "https://github.com/ethereum/EIPs/archive/5480440fe51742ed23342b68cf106cefd427e39d.tar.gz",
)

consensus_spec_version = "v1.4.0-alpha.0"
consensus_spec_version = "v1.4.0-alpha.1"

bls_test_version = "v0.1.1"

Expand All @@ -221,7 +221,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "afd64b47edb689b2f4e9fe5d3bcc9c64c342a950a01a675bc56da629aa099cd8",
sha256 = "1118a663be4a00ba00f0635eb20287157f2b2f993aed64335bfbcd04af424c2b",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/general.tar.gz" % consensus_spec_version,
)

Expand All @@ -237,7 +237,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "cae3293f30e538d1c478925a58284ad163931cc9fddcb3974dd417eaf7080fff",
sha256 = "acde6e10940d14f22277eda5b55b65a24623ac88e4c7a2e34134a6069f5eea82",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/minimal.tar.gz" % consensus_spec_version,
)

Expand All @@ -253,7 +253,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "5cf94d30eba3d35312c90b42745c2c496f018c8a0a5e56e878f0a8b9a53e4e90",
sha256 = "49c022f3a3478cea849ba8f877a9f7e4c1ded549edddc09993550bbc5bb192e1",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/mainnet.tar.gz" % consensus_spec_version,
)

Expand All @@ -268,7 +268,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "97d61ad60ebef68ae0f94f6d4d9d3d56b432a751602dc28d690dd41aa9b3e6f5",
sha256 = "c3e246ff01f6b7b9e9e41939954a6ff89dfca7297415f88781809165fa83267c",
strip_prefix = "consensus-specs-" + consensus_spec_version[1:],
url = "https://github.com/ethereum/consensus-specs/archive/refs/tags/%s.tar.gz" % consensus_spec_version,
)
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/core/blocks/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ func NewGenesisBlockForState(ctx context.Context, st state.BeaconState) (interfa
BlockHash: make([]byte, 32),
Transactions: make([][]byte, 0),
Withdrawals: make([]*enginev1.Withdrawal, 0),
ExcessDataGas: make([]byte, 32), // New in Deneb.
},
BlsToExecutionChanges: make([]*ethpb.SignedBLSToExecutionChange, 0),
BlobKzgCommitments: make([][]byte, 0),
Expand Down
3 changes: 2 additions & 1 deletion beacon-chain/core/deneb/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ func UpgradeToDeneb(state state.BeaconState) (state.BeaconState, error) {
ExtraData: payloadHeader.ExtraData(),
BaseFeePerGas: payloadHeader.BaseFeePerGas(),
BlockHash: payloadHeader.BlockHash(),
ExcessDataGas: make([]byte, 32),
ExcessDataGas: 0,
DataGasUsed: 0,
TransactionsRoot: txRoot,
WithdrawalsRoot: wdRoot,
},
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/core/deneb/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ func TestUpgradeToDeneb(t *testing.T) {
BlockHash: prevHeader.BlockHash(),
TransactionsRoot: txRoot,
WithdrawalsRoot: wdRoot,
ExcessDataGas: make([]byte, 32),
}
require.DeepEqual(t, wanted, protoHeader)
}
14 changes: 10 additions & 4 deletions beacon-chain/execution/engine_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,10 @@ func TestClient_HTTP(t *testing.T) {
require.NoError(t, err)
g, err := resp.ExcessDataGas()
require.NoError(t, err)
require.DeepEqual(t, bytesutil.PadTo([]byte{0x45, 0x3}, 32), g)
require.DeepEqual(t, uint64(3), g)
g, err = resp.DataGasUsed()
require.NoError(t, err)
require.DeepEqual(t, uint64(2), g)

commitments := [][]byte{bytesutil.PadTo([]byte("commitment1"), fieldparams.BLSPubkeyLength), bytesutil.PadTo([]byte("commitment2"), fieldparams.BLSPubkeyLength)}
require.DeepEqual(t, commitments, blobsBundle.KzgCommitments)
Expand Down Expand Up @@ -1381,7 +1384,6 @@ func fixtures() map[string]interface{} {
bar := bytesutil.PadTo([]byte("bar"), 20)
baz := bytesutil.PadTo([]byte("baz"), 256)
baseFeePerGas := big.NewInt(12345)
excessiveDataGas := big.NewInt(33434)
executionPayloadFixture := &pb.ExecutionPayload{
ParentHash: foo[:],
FeeRecipient: bar,
Expand Down Expand Up @@ -1431,7 +1433,8 @@ func fixtures() map[string]interface{} {
BlockHash: foo[:],
Transactions: [][]byte{foo[:]},
Withdrawals: []*pb.Withdrawal{},
ExcessDataGas: bytesutil.PadTo(excessiveDataGas.Bytes(), fieldparams.RootLength),
DataGasUsed: 2,
ExcessDataGas: 3,
}
hexUint := hexutil.Uint64(1)
executionPayloadWithValueFixtureCapella := &pb.GetPayloadV2ResponseJson{
Expand All @@ -1453,6 +1456,8 @@ func fixtures() map[string]interface{} {
},
BlockValue: "0x11fffffffff",
}
dgu := hexutil.Uint64(2)
edg := hexutil.Uint64(3)
executionPayloadWithValueFixtureDeneb := &pb.GetPayloadV3ResponseJson{
ExecutionPayload: &pb.ExecutionPayloadDenebJSON{
ParentHash: &common.Hash{'a'},
Expand All @@ -1469,7 +1474,8 @@ func fixtures() map[string]interface{} {
GasLimit: &hexUint,
GasUsed: &hexUint,
Timestamp: &hexUint,
ExcessDataGas: "0x345",
DataGasUsed: &dgu,
ExcessDataGas: &edg,
},
BlockValue: "0x11fffffffff",
BlobsBundle: &pb.BlobBundleJSON{
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ func TestServer_GetBeaconBlock_Deneb(t *testing.T) {
PrevRandao: make([]byte, fieldparams.RootLength),
BaseFeePerGas: make([]byte, fieldparams.RootLength),
BlockHash: make([]byte, fieldparams.RootLength),
ExcessDataGas: make([]byte, fieldparams.RootLength),
},
},
},
Expand Down Expand Up @@ -510,7 +509,8 @@ func TestServer_GetBeaconBlock_Deneb(t *testing.T) {
GasLimit: 2,
GasUsed: 3,
Timestamp: uint64(timeStamp.Unix()),
ExcessDataGas: make([]byte, fieldparams.RootLength),
DataGasUsed: 4,
ExcessDataGas: 5,
}

kc := make([][]byte, 0)
Expand Down
59 changes: 46 additions & 13 deletions consensus-types/blocks/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,14 @@ func (executionPayload) WithdrawalsRoot() ([]byte, error) {
return nil, consensus_types.ErrUnsupportedField
}

// DataGasUsed --
func (e executionPayload) DataGasUsed() (uint64, error) {
return 0, consensus_types.ErrUnsupportedField
}

// ExcessDataGas --
func (e executionPayload) ExcessDataGas() ([]byte, error) {
return nil, consensus_types.ErrUnsupportedField
func (e executionPayload) ExcessDataGas() (uint64, error) {
return 0, consensus_types.ErrUnsupportedField
}

// PbBellatrix --
Expand Down Expand Up @@ -326,9 +331,14 @@ func (executionPayloadHeader) WithdrawalsRoot() ([]byte, error) {
return nil, consensus_types.ErrUnsupportedField
}

// DataGasUsed --
func (e executionPayloadHeader) DataGasUsed() (uint64, error) {
return 0, consensus_types.ErrUnsupportedField
}

// ExcessDataGas --
func (e executionPayloadHeader) ExcessDataGas() ([]byte, error) {
return nil, consensus_types.ErrUnsupportedField
func (e executionPayloadHeader) ExcessDataGas() (uint64, error) {
return 0, consensus_types.ErrUnsupportedField
}

// PbV2 --
Expand Down Expand Up @@ -521,9 +531,14 @@ func (executionPayloadCapella) WithdrawalsRoot() ([]byte, error) {
return nil, consensus_types.ErrUnsupportedField
}

// ExcessDataGas returns error for executionPayloadCapella.
func (e executionPayloadCapella) ExcessDataGas() ([]byte, error) {
return nil, consensus_types.ErrUnsupportedField
// DataGasUsed --
func (e executionPayloadCapella) DataGasUsed() (uint64, error) {
return 0, consensus_types.ErrUnsupportedField
}

// ExcessDataGas --
func (e executionPayloadCapella) ExcessDataGas() (uint64, error) {
return 0, consensus_types.ErrUnsupportedField
}

// PbV2 --
Expand Down Expand Up @@ -688,9 +703,14 @@ func (e executionPayloadHeaderCapella) WithdrawalsRoot() ([]byte, error) {
return e.p.WithdrawalsRoot, nil
}

// ExcessDataGas returns error for executionPayloadHeaderCapella.
func (e executionPayloadHeaderCapella) ExcessDataGas() ([]byte, error) {
return nil, consensus_types.ErrUnsupportedField
// DataGasUsed --
func (e executionPayloadHeaderCapella) DataGasUsed() (uint64, error) {
return 0, consensus_types.ErrUnsupportedField
}

// ExcessDataGas --
func (e executionPayloadHeaderCapella) ExcessDataGas() (uint64, error) {
return 0, consensus_types.ErrUnsupportedField
}

// PbV2 --
Expand Down Expand Up @@ -764,6 +784,10 @@ func PayloadToHeaderDeneb(payload interfaces.ExecutionData) (*enginev1.Execution
if err != nil {
return nil, err
}
dataGasUsed, err := payload.DataGasUsed()
if err != nil {
return nil, err
}
excessDataGas, err := payload.ExcessDataGas()
if err != nil {
return nil, err
Expand All @@ -785,7 +809,8 @@ func PayloadToHeaderDeneb(payload interfaces.ExecutionData) (*enginev1.Execution
BlockHash: bytesutil.SafeCopyBytes(payload.BlockHash()),
TransactionsRoot: txRoot[:],
WithdrawalsRoot: withdrawalsRoot[:],
ExcessDataGas: bytesutil.SafeCopyBytes(excessDataGas),
DataGasUsed: dataGasUsed,
ExcessDataGas: excessDataGas,
}, nil
}

Expand Down Expand Up @@ -988,7 +1013,11 @@ func (e executionPayloadHeaderDeneb) WithdrawalsRoot() ([]byte, error) {
return e.p.WithdrawalsRoot, nil
}

func (e executionPayloadHeaderDeneb) ExcessDataGas() ([]byte, error) {
func (e executionPayloadHeaderDeneb) DataGasUsed() (uint64, error) {
return e.p.DataGasUsed, nil
}

func (e executionPayloadHeaderDeneb) ExcessDataGas() (uint64, error) {
return e.p.ExcessDataGas, nil
}

Expand Down Expand Up @@ -1153,7 +1182,11 @@ func (e executionPayloadDeneb) WithdrawalsRoot() ([]byte, error) {
return nil, consensus_types.ErrUnsupportedField
}

func (e executionPayloadDeneb) ExcessDataGas() ([]byte, error) {
func (e executionPayloadDeneb) DataGasUsed() (uint64, error) {
return e.p.DataGasUsed, nil
}

func (e executionPayloadDeneb) ExcessDataGas() (uint64, error) {
return e.p.ExcessDataGas, nil
}

Expand Down
28 changes: 20 additions & 8 deletions consensus-types/blocks/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,22 @@ func TestWrapExecutionPayloadDeneb(t *testing.T) {
Address: []byte("executionaddress"),
Amount: 77,
}},
ExcessDataGas: []byte("excessdatagas"),
DataGasUsed: 88,
ExcessDataGas: 99,
}
payload, err := blocks.WrappedExecutionPayloadDeneb(data, 420)
require.NoError(t, err)
v, err := payload.ValueInGwei()
require.NoError(t, err)
assert.Equal(t, uint64(420), v)

g, err := payload.ExcessDataGas()
g, err := payload.DataGasUsed()
require.NoError(t, err)
require.DeepEqual(t, []byte("excessdatagas"), g)
require.DeepEqual(t, uint64(88), g)

g, err = payload.ExcessDataGas()
require.NoError(t, err)
require.DeepEqual(t, uint64(99), g)
}

func TestWrapExecutionPayloadHeaderDeneb(t *testing.T) {
Expand All @@ -294,7 +299,8 @@ func TestWrapExecutionPayloadHeaderDeneb(t *testing.T) {
BlockHash: []byte("blockhash"),
TransactionsRoot: []byte("transactionsroot"),
WithdrawalsRoot: []byte("withdrawalsroot"),
ExcessDataGas: []byte("excessdatagas"),
DataGasUsed: 88,
ExcessDataGas: 99,
}
payload, err := blocks.WrappedExecutionPayloadHeaderDeneb(data, 10)
require.NoError(t, err)
Expand All @@ -303,9 +309,13 @@ func TestWrapExecutionPayloadHeaderDeneb(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, uint64(10), v)

g, err := payload.ExcessDataGas()
g, err := payload.DataGasUsed()
require.NoError(t, err)
require.DeepEqual(t, uint64(88), g)

g, err = payload.ExcessDataGas()
require.NoError(t, err)
require.DeepEqual(t, []byte("excessdatagas"), g)
require.DeepEqual(t, uint64(99), g)
}

func TestWrapExecutionPayloadDeneb_SSZ(t *testing.T) {
Expand Down Expand Up @@ -443,7 +453,8 @@ func createWrappedPayloadDeneb(t testing.TB) interfaces.ExecutionData {
BlockHash: make([]byte, fieldparams.RootLength),
Transactions: make([][]byte, 0),
Withdrawals: make([]*enginev1.Withdrawal, 0),
ExcessDataGas: make([]byte, fieldparams.RootLength),
DataGasUsed: 0,
ExcessDataGas: 0,
}, 0)
require.NoError(t, err)
return payload
Expand All @@ -466,7 +477,8 @@ func createWrappedPayloadHeaderDeneb(t testing.TB) interfaces.ExecutionData {
BlockHash: make([]byte, fieldparams.RootLength),
TransactionsRoot: make([]byte, fieldparams.RootLength),
WithdrawalsRoot: make([]byte, fieldparams.RootLength),
ExcessDataGas: make([]byte, fieldparams.RootLength),
DataGasUsed: 0,
ExcessDataGas: 0,
}, 0)
require.NoError(t, err)
return payload
Expand Down
4 changes: 2 additions & 2 deletions consensus-types/blocks/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ func TestBuildSignedBeaconBlockFromExecutionPayload(t *testing.T) {
BaseFeePerGas: make([]byte, fieldparams.RootLength),
BlockHash: make([]byte, fieldparams.RootLength),
Transactions: make([][]byte, 0),
ExcessDataGas: bytesutil.PadTo([]byte{123}, 32),
ExcessDataGas: 123,
}
wrapped, err := WrappedExecutionPayloadDeneb(payload, 123)
require.NoError(t, err)
Expand All @@ -531,6 +531,6 @@ func TestBuildSignedBeaconBlockFromExecutionPayload(t *testing.T) {
got, err := builtBlock.Block().Body().Execution()
require.NoError(t, err)
require.DeepEqual(t, payload, got.Proto())
require.DeepEqual(t, bytesutil.PadTo([]byte{123}, 32), payload.ExcessDataGas)
require.DeepEqual(t, uint64(123), payload.ExcessDataGas)
})
}
Loading