From f9a408b957900ae85bab3f5b5a2c609d5308a262 Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Wed, 24 Sep 2025 22:47:33 +0800 Subject: [PATCH] eth/catalyst: add fork constraint for GetBlobs APIs --- eth/catalyst/api.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index e22dc5b179..c44d8d58d1 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -494,9 +494,9 @@ func (api *ConsensusAPI) getPayload(payloadID engine.PayloadID, full bool) (*eng func (api *ConsensusAPI) GetBlobsV1(hashes []common.Hash) ([]*engine.BlobAndProofV1, error) { // Reject the request if Osaka has been activated. // follow https://github.com/ethereum/execution-apis/blob/main/src/engine/osaka.md#cancun-api - header := api.eth.BlockChain().CurrentHeader() - if api.config().IsOsaka(header.Number, header.Time) { - return nil, unsupportedForkErr("engine_getBlobsV1 is not supported after Osaka fork") + head := api.eth.BlockChain().CurrentHeader() + if !api.checkFork(head.Time, forks.Cancun, forks.Prague) { + return nil, unsupportedForkErr("engine_getBlobsV1 is only available at Cancun/Prague fork") } if len(hashes) > 128 { return nil, engine.TooLargeRequest.With(fmt.Errorf("requested blob count too large: %v", len(hashes))) @@ -538,9 +538,6 @@ func (api *ConsensusAPI) GetBlobsV1(hashes []common.Hash) ([]*engine.BlobAndProo // - if the request is [A_versioned_hash_for_blob_with_blob_proof], the response // MUST be null as well. // -// Note, geth internally make the conversion from old version to new one, so the -// data will be returned normally. -// // Client software MUST support request sizes of at least 128 blob versioned // hashes. The client MUST return -38004: Too large request error if the number // of requested blobs is too large. @@ -548,6 +545,10 @@ func (api *ConsensusAPI) GetBlobsV1(hashes []common.Hash) ([]*engine.BlobAndProo // Client software MUST return null if syncing or otherwise unable to serve // blob pool data. func (api *ConsensusAPI) GetBlobsV2(hashes []common.Hash) ([]*engine.BlobAndProofV2, error) { + head := api.eth.BlockChain().CurrentHeader() + if !api.checkFork(head.Time, forks.Osaka) { + return nil, unsupportedForkErr("engine_getBlobsV2 is only available at Osaka fork") + } if len(hashes) > 128 { return nil, engine.TooLargeRequest.With(fmt.Errorf("requested blob count too large: %v", len(hashes))) }