From 890450dd8f631f1502e4f85c0d2a2cc155695968 Mon Sep 17 00:00:00 2001 From: Chunkai Yang Date: Sun, 6 Oct 2024 01:19:37 -0400 Subject: [PATCH] use chain Id as opposed to chain type to identify Mantle (#1489) ## Motivation ## Solution --- core/services/relay/evm/evm.go | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index ae5244f5f0..f2143ceded 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -12,7 +12,7 @@ import ( "sync" cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccip" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/chaintype" + "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/estimatorconfig/interceptors/mantle" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip" @@ -413,12 +413,14 @@ func (r *Relayer) NewCCIPCommitProvider(rargs commontypes.RelayArgs, pargs commo // CCIPCommit reads only when source chain is Mantle, then reports to dest chain // to minimize misconfigure risk, might make sense to wire Mantle only when Commit + Mantle + IsSourceProvider - if r.chain.Config().EVM().ChainType() == chaintype.ChainMantle && commitPluginConfig.IsSourceProvider { - mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client()) - if iErr != nil { - return nil, iErr + if r.chain.Config().EVM().ChainID().Uint64() == 5003 || r.chain.Config().EVM().ChainID().Uint64() == 5000 { + if commitPluginConfig.IsSourceProvider { + mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client()) + if iErr != nil { + return nil, iErr + } + feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor) } - feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor) } // 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 // CCIPExec reads when dest chain is mantle, and uses it to calc boosting in batching // to minimize misconfigure risk, make sense to wire Mantle only when Exec + Mantle + !IsSourceProvider - if r.chain.Config().EVM().ChainType() == chaintype.ChainMantle && !execPluginConfig.IsSourceProvider { - mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client()) - if iErr != nil { - return nil, iErr + if r.chain.Config().EVM().ChainID().Uint64() == 5003 || r.chain.Config().EVM().ChainID().Uint64() == 5000 { + if !execPluginConfig.IsSourceProvider { + mantleInterceptor, iErr := mantle.NewInterceptor(ctx, r.chain.Client()) + if iErr != nil { + return nil, iErr + } + feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor) } - feeEstimatorConfig.AddGasPriceInterceptor(mantleInterceptor) } // The src chain implementation of this provider does not need a configWatcher or contractTransmitter;