forked from cerc-io/plugeth
eth/catalyst: add timestamp checks to fcu and new payload and improve param checks (#28230)
This PR introduces a few changes with respect to payload verification in fcu and new payload requests: * First of all, it undoes the `verifyPayloadAttributes(..)` simplification I attempted in #27872. * Adds timestamp validation to fcu payload attributes [as required](https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#specification-1) (section 2) by the Engine API spec. * For the new payload methods, I also update the verification of the executable data. For `newPayloadV2`, it does not currently ensure that cancun values are `nil`. Which could make it possible to submit cancun payloads through it. * On `newPayloadV3` the same types of checks are added. All shanghai and cancun related fields in the executable data must be non-nil, with the addition that the timestamp is _only_ with cancun. * Finally it updates a newly failing catalyst test to call the correct fcu and new payload methods depending on the fork.
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/params/forks"
|
||||
)
|
||||
|
||||
// Genesis hashes to enforce below configs on.
|
||||
@@ -750,6 +751,23 @@ func (c *ChainConfig) ElasticityMultiplier() uint64 {
|
||||
return DefaultElasticityMultiplier
|
||||
}
|
||||
|
||||
// LatestFork returns the latest time-based fork that would be active for the given time.
|
||||
func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
|
||||
// Assume last non-time-based fork has passed.
|
||||
london := c.LondonBlock
|
||||
|
||||
switch {
|
||||
case c.IsPrague(london, time):
|
||||
return forks.Prague
|
||||
case c.IsCancun(london, time):
|
||||
return forks.Cancun
|
||||
case c.IsShanghai(london, time):
|
||||
return forks.Shanghai
|
||||
default:
|
||||
return forks.Paris
|
||||
}
|
||||
}
|
||||
|
||||
// isForkBlockIncompatible returns true if a fork scheduled at block s1 cannot be
|
||||
// rescheduled to block s2 because head is already past the fork.
|
||||
func isForkBlockIncompatible(s1, s2, head *big.Int) bool {
|
||||
|
||||
Reference in New Issue
Block a user