MetaMask / MetaMask/metamask-extension

Multichain: Stop Using Partial State for getCurrentChainId Params in metamask-controller

Open
#28,304 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

multichain-final-boss
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

What is this about?

As part of the work to get Default RPCs work out, we used some partial states in metamask-controller.js for usages of getCurrentChainId parameters for controllers, including:

  • TokenListController
  • AssetsContractController
  • TokensController
  • NftController
  • NftDetectionController
  • MetaMetricsController
  • GasFeeController
  • PPOMController
  • TransactionController
  • getAddTransactionRequest
  • getProviderConfig

When the concept of the global chain ID goes away, we need these to be contextual. This pattern can be easily identified by:

fn({ metamask: this.networkController.state })
Scenario

No response

Design

No response

Technical Details

No response

Threat Modeling Framework

No response

Acceptance Criteria

No response

Stakeholder review needed before the work gets merged
  • Engineering (needed in most cases)
  • Design
  • Product
  • QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
  • Security
  • Legal
  • Marketing
  • Management (please specify)
  • Other (please specify)
References

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in metamask-controller.js and search for the listed getCurrentChainId usages matching fn({ metamask: this.networkController.state }). Review how each named controller receives chain context. Done means those usages no longer rely on partial state and all listed integrations work with contextual chain IDs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, networking
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.