mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
fix engine_getPayloadV4 compliance error
Fix the issue on engine API: engine_getPayloadV4, to make it compliant with osaka engine API spec. According to issue listed in Fusaka contest: https://audits.sherlock.xyz/contests/1140/voting/157, the issue of API: engine_getPayloadV4 should also follow the spec restriction as the previous PR on getBlobsV1: https://github.com/ethereum/go-ethereum/pull/32731
This commit is contained in:
parent
ebc7dc9e37
commit
579374bec6
1 changed files with 10 additions and 0 deletions
|
|
@ -442,6 +442,12 @@ func (api *ConsensusAPI) GetPayloadV3(payloadID engine.PayloadID) (*engine.Execu
|
|||
// GetPayloadV4 returns a cached payload by id. This endpoint should only
|
||||
// be used for the Prague fork.
|
||||
func (api *ConsensusAPI) GetPayloadV4(payloadID engine.PayloadID) (*engine.ExecutionPayloadEnvelope, error) {
|
||||
// Reject the request if Osaka has been activated.
|
||||
// follow https://github.com/ethereum/execution-apis/blob/main/src/engine/osaka.md#prague-api
|
||||
head := api.eth.BlockChain().CurrentHeader()
|
||||
if !api.checkFork(head.Time, forks.Prague) {
|
||||
return nil, unsupportedForkErr("engine_getPayloadV4 is only available at Prague fork")
|
||||
}
|
||||
if !payloadID.Is(engine.PayloadV3) {
|
||||
return nil, engine.UnsupportedFork
|
||||
}
|
||||
|
|
@ -454,6 +460,10 @@ func (api *ConsensusAPI) GetPayloadV4(payloadID engine.PayloadID) (*engine.Execu
|
|||
// This method follows the same specification as engine_getPayloadV4 with
|
||||
// changes of returning BlobsBundleV2 with BlobSidecar version 1.
|
||||
func (api *ConsensusAPI) GetPayloadV5(payloadID engine.PayloadID) (*engine.ExecutionPayloadEnvelope, error) {
|
||||
head := api.eth.BlockChain().CurrentHeader()
|
||||
if api.config().LatestFork(head.Time) < forks.Osaka {
|
||||
return nil, unsupportedForkErr("engine_getPayloadV5 is not available before Osaka fork")
|
||||
}
|
||||
if !payloadID.Is(engine.PayloadV3) {
|
||||
return nil, engine.UnsupportedFork
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue