@@ -7,12 +7,13 @@ import (
77 "math/big"
88
99 "github.com/holiman/uint256"
10+ "github.com/ledgerwatch/log/v3"
11+
1012 libcommon "github.com/ledgerwatch/erigon-lib/common"
1113 "github.com/ledgerwatch/erigon-lib/gointerfaces"
1214 "github.com/ledgerwatch/erigon-lib/gointerfaces/remote"
1315 types2 "github.com/ledgerwatch/erigon-lib/gointerfaces/types"
1416 "github.com/ledgerwatch/erigon-lib/kv"
15- "github.com/ledgerwatch/log/v3"
1617
1718 "github.com/ledgerwatch/erigon/common"
1819 "github.com/ledgerwatch/erigon/common/hexutil"
@@ -388,6 +389,47 @@ func (e *EngineImpl) GetPayloadBodiesByRangeV1(ctx context.Context, start uint64
388389 return convertExecutionPayloadV1 (apiRes ), nil
389390}
390391
392+ var ourCapabilities = []string {
393+ "engine_forkchoiceUpdatedV1" ,
394+ "engine_forkchoiceUpdatedV2" ,
395+ "engine_newPayloadV1" ,
396+ "engine_newPayloadV2" ,
397+ "engine_getPayloadV1" ,
398+ "engine_getPayloadV2" ,
399+ "engine_exchangeTransitionConfigurationV1" ,
400+ "engine_getPayloadBodiesByHashV1" ,
401+ "engine_getPayloadBodiesByRangeV1" ,
402+ }
403+
404+ func (e * EngineImpl ) ExchangeCapabilities (fromCl []string ) []string {
405+ missingOurs := compareCapabilities (fromCl , ourCapabilities )
406+ missingCl := compareCapabilities (ourCapabilities , fromCl )
407+
408+ if len (missingCl ) > 0 || len (missingOurs ) > 0 {
409+ log .Debug ("ExchangeCapabilities mismatches" , "cl_unsupported" , missingCl , "erigon_unsupported" , missingOurs )
410+ }
411+
412+ return ourCapabilities
413+ }
414+
415+ func compareCapabilities (from []string , to []string ) []string {
416+ result := make ([]string , 0 )
417+ for _ , f := range from {
418+ found := false
419+ for _ , t := range to {
420+ if f == t {
421+ found = true
422+ break
423+ }
424+ }
425+ if ! found {
426+ result = append (result , f )
427+ }
428+ }
429+
430+ return result
431+ }
432+
391433func convertExecutionPayloadV1 (response * remote.EngineGetPayloadBodiesV1Response ) []* ExecutionPayloadBodyV1 {
392434 result := make ([]* ExecutionPayloadBodyV1 , len (response .Bodies ))
393435 for idx , body := range response .Bodies {
0 commit comments