Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit 918ccf6

Browse files
authored
use chain Id as opposed to chain type to identify Mantle (#1489) (#1494)
## Motivation Mantle chaintype is no longer used by the BIX team, Mantle's chaintype has been changed to optimism in chain toml ## Solution In order to match for Mantle and apply custom gas price interceptor, we can check for evm ChainId. Not going for a more generic solution given OCR2 plugins will be sunset soon, and Mantle should be the only chain that requires such custom logic before that. This is already included in 1.5.4 release and verified to work. Back-porting here to dev branch.
1 parent 2d5ff29 commit 918ccf6

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

core/services/relay/evm/evm.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"sync"
1313

1414
cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccip"
15-
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/chaintype"
15+
1616
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/estimatorconfig/interceptors/mantle"
1717

1818
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip"
@@ -413,12 +413,14 @@ func (r *Relayer) NewCCIPCommitProvider(rargs commontypes.RelayArgs, pargs commo
413413

414414
// CCIPCommit reads only when source chain is Mantle, then reports to dest chain
415415
// to minimize misconfigure risk, might make sense to wire Mantle only when Commit + Mantle + IsSourceProvider
416-
if r.chain.Config().EVM().ChainType() == chaintype.ChainMantle && commitPluginConfig.IsSourceProvider {
417-
mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client())
418-
if iErr != nil {
419-
return nil, iErr
416+
if r.chain.Config().EVM().ChainID().Uint64() == 5003 || r.chain.Config().EVM().ChainID().Uint64() == 5000 {
417+
if commitPluginConfig.IsSourceProvider {
418+
mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client())
419+
if iErr != nil {
420+
return nil, iErr
421+
}
422+
feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor)
420423
}
421-
feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor)
422424
}
423425

424426
// The src chain implementation of this provider does not need a configWatcher or contractTransmitter;
@@ -494,12 +496,14 @@ func (r *Relayer) NewCCIPExecProvider(rargs commontypes.RelayArgs, pargs commont
494496

495497
// CCIPExec reads when dest chain is mantle, and uses it to calc boosting in batching
496498
// to minimize misconfigure risk, make sense to wire Mantle only when Exec + Mantle + !IsSourceProvider
497-
if r.chain.Config().EVM().ChainType() == chaintype.ChainMantle && !execPluginConfig.IsSourceProvider {
498-
mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client())
499-
if iErr != nil {
500-
return nil, iErr
499+
if r.chain.Config().EVM().ChainID().Uint64() == 5003 || r.chain.Config().EVM().ChainID().Uint64() == 5000 {
500+
if !execPluginConfig.IsSourceProvider {
501+
mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client())
502+
if iErr != nil {
503+
return nil, iErr
504+
}
505+
feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor)
501506
}
502-
feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor)
503507
}
504508

505509
// The src chain implementation of this provider does not need a configWatcher or contractTransmitter;

0 commit comments

Comments
 (0)