Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use chain Id as opposed to chain type to identify Mantle (#1489) #1494

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions core/services/relay/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, but iErr looks weird. I think the Go pattern is to have just err, no matter of the context. If err is already used (or defined in outer scope) you just go with err1, err2 etc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially, it was my implementation :) Linter argued about the shadowed declaration. So, InterceptorError => iErr :)

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;
Expand Down Expand Up @@ -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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

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;
Expand Down
Loading