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

Conversation

matYang
Copy link
Collaborator

@matYang matYang commented Oct 9, 2024

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.

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 :)

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

@matYang matYang enabled auto-merge (squash) October 11, 2024 20:44
@matYang matYang merged commit 918ccf6 into ccip-develop Oct 11, 2024
111 checks passed
@matYang matYang deleted the port-mantle-chainid-detection branch October 11, 2024 21:00
@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
50.0% Coverage on New Code (required ≥ 75%)

See analysis details on SonarQube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants