-
Notifications
You must be signed in to change notification settings - Fork 20.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eth/catalyst: add timestamp checks to fcu and new payload and improve param checks #28230
eth/catalyst: add timestamp checks to fcu and new payload and improve param checks #28230
Conversation
141a590
to
1bafd52
Compare
fa574ad
to
f5894ac
Compare
f5894ac
to
56d1258
Compare
56d1258
to
36aabc3
Compare
Agreed, the string comparison sucks. I am just hesitant to expose a new public interface for the fork order. I too another stab at it in the last commit though. |
|
||
const ( | ||
Frontier = iota | ||
FrontierThawing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have never heard of frontierThawing before, very interesting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me neither... Do you have a reference @lightclient ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was the fork that increased the gaslimit so transactions could be executed. I don't know if it was a hardfork or a softfork though
GrayGlacier | ||
Paris | ||
Shanghai | ||
Cancun | ||
Prague |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, what is paris, and why is it before shanghai?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Paris was the official name for the merge
dc3cee6
to
b395fc1
Compare
@parithosh told me that the devnet-10 branch (which I think contains this) had some issues on a shadowfork.
even though the node was post-shanghai already. The CL node send (imo correctly) and empty withdrawal slice post-shanghai via v2, which should be accepted |
b395fc1
to
82626f8
Compare
Currently we're failing a handful of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
eth/catalyst/api.go
Outdated
func (api *ConsensusAPI) NewPayloadV2(params engine.ExecutableData) (engine.PayloadStatusV1, error) { | ||
if api.eth.BlockChain().Config().IsShanghai(new(big.Int).SetUint64(params.Number), params.Timestamp) { | ||
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) == forks.Shanghai { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't something like this work?
if api.eth.BlockChain().Config.IsCancun(..) {
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(errors.New("NewPayloadV2 used post-shanghai"))
}
if api.eth.BlockChain().Config().LatestFork(params.Timestamp) == forks.Shanghai {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
… param checks (ethereum#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 ethereum#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 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 beacon/engine, eth/catalyst, miner: 4788 CL/EL protocol updates #27872. At the time I expected the pattern fromforkchoiceUpdatedV2
to continue where the previous version's payload attributes would be accepted by the method if the timestamp allowed. It turns out this is only a special case inforkchoiceUpdatedV2
. InforkchoiceUpdatedV3
is not possible to providePayloadAttributesV2
. OnlyV3
is accepted. This sort of defeats the purpose of the shared method.To see this in the spec, you may first view the parameters for
forkchoiceUpdatedV2
which accepts bothPayloadAttributesV1
andPayloadAttributesV2
versus the parameters forforkchoiceUpdatedV3
which accepts onlyPayloadAttributesV3
.For this reason I have removed
verifyPayloadAttributes(..)
and its related functions in favor of a more straight forward approach of verifying the existence of optional values onengine.PayloadAttributes
. I went ahead and updated this logic forforkchoiceUpdatedV2
even though it should technically still allowV1
payload attributes, because we have passed Paris on all networks and have no need to continue support of building V1 blocks viaforkchoiceUpdatedV2
. I think it also simplifies the API to not have these two conflicting approaches for V1 vs. V2 fcu.Next I have added timestamp validation to fcu payload attributes as required (section 2) by the Engine API spec. I back ported this from
forkchoiceUpdatedV3
toforkchoiceUpdatedV2
so that it is only possible to callforkchoiceUpdatedV2
with attributes occurring in the Shanghai fork. This is done for the same reason a referenced above.For the new payload methods, I also update the verification of the executable data. For
newPayloadV2
, it does not currently ensure that cancun values arenil
. Which could make it possible to submit cancun payloads through it.Additionally, it verifies the timestamp of the payload is exactly within the Shanghai fork. Both of these break the ability to useDecided to retain support for v1 payloads in new payload v2.newPayloadV2
for pre-shanghai blocks, but as already stated, all networks are past this point and it is not necessary to continue support.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.
--
The general flow of all engine API methods are: