Fix Engine Capabilites Check (#14924)

* Fix Capabilities Check

* Changelog
This commit is contained in:
Nishant Das
2025-02-13 21:37:05 +08:00
committed by GitHub
parent 66878deb2c
commit 3eec5a5cb6
3 changed files with 18 additions and 2 deletions

View File

@@ -36,17 +36,19 @@ var (
NewPayloadMethod,
NewPayloadMethodV2,
NewPayloadMethodV3,
NewPayloadMethodV4,
ForkchoiceUpdatedMethod,
ForkchoiceUpdatedMethodV2,
ForkchoiceUpdatedMethodV3,
GetPayloadMethod,
GetPayloadMethodV2,
GetPayloadMethodV3,
GetPayloadMethodV4,
GetPayloadBodiesByHashV1,
GetPayloadBodiesByRangeV1,
}
electraEngineEndpoints = []string{
NewPayloadMethodV4,
GetPayloadMethodV4,
}
)
const (
@@ -296,6 +298,10 @@ func (s *Service) ExchangeCapabilities(ctx context.Context) ([]string, error) {
ctx, span := trace.StartSpan(ctx, "powchain.engine-api-client.ExchangeCapabilities")
defer span.End()
// Only check for electra related engine methods if it has been activated.
if params.ElectraEnabled() {
supportedEngineEndpoints = append(supportedEngineEndpoints, electraEngineEndpoints...)
}
var result []string
err := s.rpcClient.CallContext(ctx, &result, ExchangeCapabilities, supportedEngineEndpoints)
if err != nil {

View File

@@ -0,0 +1,3 @@
### Fixed
- Only check for electra related engine methods if electra is active.

View File

@@ -426,6 +426,13 @@ func DenebEnabled() bool {
return BeaconConfig().DenebForkEpoch < math.MaxUint64
}
// ElectraEnabled centralizes the check to determine if code paths
// that are specific to electra should be allowed to execute. This will make it easier to find call sites that do this
// kind of check and remove them post-electra.
func ElectraEnabled() bool {
return BeaconConfig().ElectraForkEpoch < math.MaxUint64
}
// PeerDASEnabled centralizes the check to determine if code paths
// that are specific to peerdas should be allowed to execute.
func PeerDASEnabled() bool {