consensus, core/typer: add 4844 excessDataGas to header, tie it to Cancun (#27046)
This commit is contained in:
parent
9b1a82c600
commit
91faf2c559
@ -263,11 +263,19 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa
|
|||||||
// Verify existence / non-existence of withdrawalsHash.
|
// Verify existence / non-existence of withdrawalsHash.
|
||||||
shanghai := chain.Config().IsShanghai(header.Time)
|
shanghai := chain.Config().IsShanghai(header.Time)
|
||||||
if shanghai && header.WithdrawalsHash == nil {
|
if shanghai && header.WithdrawalsHash == nil {
|
||||||
return fmt.Errorf("missing withdrawalsHash")
|
return errors.New("missing withdrawalsHash")
|
||||||
}
|
}
|
||||||
if !shanghai && header.WithdrawalsHash != nil {
|
if !shanghai && header.WithdrawalsHash != nil {
|
||||||
return fmt.Errorf("invalid withdrawalsHash: have %x, expected nil", header.WithdrawalsHash)
|
return fmt.Errorf("invalid withdrawalsHash: have %x, expected nil", header.WithdrawalsHash)
|
||||||
}
|
}
|
||||||
|
// Verify the existence / non-existence of excessDataGas
|
||||||
|
cancun := chain.Config().IsCancun(header.Time)
|
||||||
|
if cancun && header.ExcessDataGas == nil {
|
||||||
|
return errors.New("missing excessDataGas")
|
||||||
|
}
|
||||||
|
if !cancun && header.ExcessDataGas != nil {
|
||||||
|
return fmt.Errorf("invalid excessDataGas: have %d, expected nil", header.ExcessDataGas)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,6 +301,9 @@ func (c *Clique) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
|
|||||||
if chain.Config().IsShanghai(header.Time) {
|
if chain.Config().IsShanghai(header.Time) {
|
||||||
return fmt.Errorf("clique does not support shanghai fork")
|
return fmt.Errorf("clique does not support shanghai fork")
|
||||||
}
|
}
|
||||||
|
if chain.Config().IsCancun(header.Time) {
|
||||||
|
return fmt.Errorf("clique does not support cancun fork")
|
||||||
|
}
|
||||||
// If all checks passed, validate any special fields for hard forks
|
// If all checks passed, validate any special fields for hard forks
|
||||||
if err := misc.VerifyForkHashes(chain.Config(), header, false); err != nil {
|
if err := misc.VerifyForkHashes(chain.Config(), header, false); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -313,6 +313,9 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainHeaderReader, header, pa
|
|||||||
if chain.Config().IsShanghai(header.Time) {
|
if chain.Config().IsShanghai(header.Time) {
|
||||||
return fmt.Errorf("ethash does not support shanghai fork")
|
return fmt.Errorf("ethash does not support shanghai fork")
|
||||||
}
|
}
|
||||||
|
if chain.Config().IsCancun(header.Time) {
|
||||||
|
return fmt.Errorf("ethash does not support cancun fork")
|
||||||
|
}
|
||||||
// Verify the engine specific seal securing the block
|
// Verify the engine specific seal securing the block
|
||||||
if seal {
|
if seal {
|
||||||
if err := ethash.verifySeal(chain, header, false); err != nil {
|
if err := ethash.verifySeal(chain, header, false); err != nil {
|
||||||
|
@ -85,6 +85,9 @@ type Header struct {
|
|||||||
// WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.
|
// WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers.
|
||||||
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"`
|
WithdrawalsHash *common.Hash `json:"withdrawalsRoot" rlp:"optional"`
|
||||||
|
|
||||||
|
// ExcessDataGas was added by EIP-4844 and is ignored in legacy headers.
|
||||||
|
ExcessDataGas *big.Int `json:"excessDataGas" rlp:"optional"`
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO (MariusVanDerWijden) Add this field once needed
|
TODO (MariusVanDerWijden) Add this field once needed
|
||||||
// Random was added during the merge and contains the BeaconState randomness
|
// Random was added during the merge and contains the BeaconState randomness
|
||||||
|
Loading…
Reference in New Issue
Block a user