all: tie timestamp based forks to the passage of London (#27279)

This commit is contained in:
Péter Szilágyi
2023-05-19 11:27:19 +03:00
committed by GitHub
parent 6a6318b1d2
commit 85a4b82b33
14 changed files with 31 additions and 29 deletions
+3 -3
View File
@@ -261,7 +261,7 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa
return err
}
// Verify existence / non-existence of withdrawalsHash.
shanghai := chain.Config().IsShanghai(header.Time)
shanghai := chain.Config().IsShanghai(header.Number, header.Time)
if shanghai && header.WithdrawalsHash == nil {
return errors.New("missing withdrawalsHash")
}
@@ -269,7 +269,7 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa
return fmt.Errorf("invalid withdrawalsHash: have %x, expected nil", header.WithdrawalsHash)
}
// Verify the existence / non-existence of excessDataGas
cancun := chain.Config().IsCancun(header.Time)
cancun := chain.Config().IsCancun(header.Number, header.Time)
if cancun && header.ExcessDataGas == nil {
return errors.New("missing excessDataGas")
}
@@ -356,7 +356,7 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
if !beacon.IsPoSHeader(header) {
return beacon.ethone.FinalizeAndAssemble(chain, header, state, txs, uncles, receipts, nil)
}
shanghai := chain.Config().IsShanghai(header.Time)
shanghai := chain.Config().IsShanghai(header.Number, header.Time)
if shanghai {
// All blocks after Shanghai must include a withdrawals root.
if withdrawals == nil {
+2 -2
View File
@@ -298,10 +298,10 @@ func (c *Clique) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
if header.GasLimit > params.MaxGasLimit {
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, params.MaxGasLimit)
}
if chain.Config().IsShanghai(header.Time) {
if chain.Config().IsShanghai(header.Number, header.Time) {
return fmt.Errorf("clique does not support shanghai fork")
}
if chain.Config().IsCancun(header.Time) {
if chain.Config().IsCancun(header.Number, header.Time) {
return fmt.Errorf("clique does not support cancun fork")
}
// All basic checks passed, verify cascading fields
+2 -2
View File
@@ -262,10 +262,10 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainHeaderReader, header, pa
if diff := new(big.Int).Sub(header.Number, parent.Number); diff.Cmp(big.NewInt(1)) != 0 {
return consensus.ErrInvalidNumber
}
if chain.Config().IsShanghai(header.Time) {
if chain.Config().IsShanghai(header.Number, header.Time) {
return fmt.Errorf("ethash does not support shanghai fork")
}
if chain.Config().IsCancun(header.Time) {
if chain.Config().IsCancun(header.Number, header.Time) {
return fmt.Errorf("ethash does not support cancun fork")
}
// Add some fake checks for tests