@@ -7,12 +7,13 @@ import (
7
7
"math/big"
8
8
9
9
"github.com/holiman/uint256"
10
+ "github.com/ledgerwatch/log/v3"
11
+
10
12
libcommon "github.com/ledgerwatch/erigon-lib/common"
11
13
"github.com/ledgerwatch/erigon-lib/gointerfaces"
12
14
"github.com/ledgerwatch/erigon-lib/gointerfaces/remote"
13
15
types2 "github.com/ledgerwatch/erigon-lib/gointerfaces/types"
14
16
"github.com/ledgerwatch/erigon-lib/kv"
15
- "github.com/ledgerwatch/log/v3"
16
17
17
18
"github.com/ledgerwatch/erigon/common"
18
19
"github.com/ledgerwatch/erigon/common/hexutil"
@@ -388,6 +389,47 @@ func (e *EngineImpl) GetPayloadBodiesByRangeV1(ctx context.Context, start uint64
388
389
return convertExecutionPayloadV1 (apiRes ), nil
389
390
}
390
391
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
+
391
433
func convertExecutionPayloadV1 (response * remote.EngineGetPayloadBodiesV1Response ) []* ExecutionPayloadBodyV1 {
392
434
result := make ([]* ExecutionPayloadBodyV1 , len (response .Bodies ))
393
435
for idx , body := range response .Bodies {
0 commit comments