Skip to content

feat: add linea networks support #1423

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

Merged
merged 8 commits into from
Jul 12, 2023
Merged

Conversation

VGau
Copy link
Contributor

@VGau VGau commented Jun 11, 2023

Description

  • Added linea networks support in controller utils
  • Added linea networks support in network controller
  • Added linea networks support in transaction controller
  • Updated @metamask/eth-json-rpc-infura package version to 8.1.0 to support linea networks

Changes

@metamask/controller-utils

  • ADDED: Add Linea networks to TESTNET_TICKER_SYMBOLS, BUILT_IN_NETWORKS, NETWORK_ID_TO_ETHERS_NETWORK_NAME_MAP, InfuraNetworkType, NetworkType, BuiltInNetworkName, ChainId, NetworkId, and NetworksTicker
    • isNetworkType will now return true when given linea-mainnet or linea-goerli

@metamask/network-controller

  • ADDED: Add support for Infura provider types linea-mainnet and linea-goerli
  • CHANGED: Update @metamask/eth-json-rpc-infura package version to 8.1.0 to support Linea networks

@metamask/transaction-controller

  • CHANGED: Update approveTransaction, stopTransaction, and speedUpTransaction to use proper chain ID and network ID when creating transaction for Linea networks

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation for new or updated code as appropriate (note: this will usually be JSDoc)
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

Copy link

@Arschieqwe Arschieqwe left a comment

Choose a reason for hiding this comment

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

Thanks

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Looks good, but I just had one suggestion.

@mcmire
Copy link
Contributor

mcmire commented Jun 12, 2023

Also, there are some differences between the "Description" and "Changes" sections in the PR description that perhaps we ought to clarify better:

  • The Description is intended for you to explain the purpose and scope of your changes and share knowledge that people might not be able to see just from reading the PR. The audience for this section is other developers who are maintaining this code. They might want to know: What is motivating this change (is there a ticket or can you provide some more context)? How do the changes work? If you had to upgrade a package, why?
  • The Changes is intended to be a list of your changes from the perspective of each package in the monorepo. The audience is consumers of the package (i.e. developers working on either the extension or mobile app) who will scan the changelog when they upgrade to a new version. They want to know: What are the exact changes to the API I need to be aware of (types, interfaces, functions, methods)? What are the effects on whichever platform might want to make use of these changes?

With that in mind, something you might want to highlight in the Description is, why did you have to upgrade @metamask/eth-json-rpc-infura? Why did you have to exclude Linea from the getCommonConfiguration method?

As for Changes, I think you could borrow from what you have in the Description. What if you updated Changes to the following?

### `@metamask/controller-utils`

- **ADDED:** Add Linea networks to `TESTNET_TICKER_SYMBOLS`, `BUILT_IN_NETWORKS`, `NETWORK_ID_TO_ETHERS_NETWORK_NAME_MAP`, `InfuraNetworkType`, `NetworkType`, `BuiltInNetworkName`, `ChainId`, `NetworkId`, and `NetworksTicker`
  - `isNetworkType` will now return true when given `linea-mainnet` or `linea-goerli`

### `@metamask/network-controller`

- **ADDED:** Add support for Infura provider types `linea-mainnet` and `linea-goerli`
- **CHANGED:** Update `@metamask/eth-json-rpc-infura` package version to 8.1.0 to support Linea networks

### `@metamask/transaction-controller`

- **CHANGED:** Update `approveTransaction`, `stopTransaction`, and `speedUpTransaction` to use proper chain ID and network ID when creating transaction for Linea networks

I filled in what I thought was a proper summary of the changes to the transaction controller from what I could guess, but feel free to clarify that further if you have more knowledge.

This should help us when building the changelog for a new release.

@VGau
Copy link
Contributor Author

VGau commented Jun 13, 2023

Also, there are some differences between the "Description" and "Changes" sections in the PR description that perhaps we ought to clarify better:

  • The Description is intended for you to explain the purpose and scope of your changes and share knowledge that people might not be able to see just from reading the PR. The audience for this section is other developers who are maintaining this code. They might want to know: What is motivating this change (is there a ticket or can you provide some more context)? How do the changes work? If you had to upgrade a package, why?
  • The Changes is intended to be a list of your changes from the perspective of each package in the monorepo. The audience is consumers of the package (i.e. developers working on either the extension or mobile app) who will scan the changelog when they upgrade to a new version. They want to know: What are the exact changes to the API I need to be aware of (types, interfaces, functions, methods)? What are the effects on whichever platform might want to make use of these changes?

With that in mind, something you might want to highlight in the Description is, why did you have to upgrade @metamask/eth-json-rpc-infura? Why did you have to exclude Linea from the getCommonConfiguration method?

As for Changes, I think you could borrow from what you have in the Description. What if you updated Changes to the following?

### `@metamask/controller-utils`

- **ADDED:** Add Linea networks to `TESTNET_TICKER_SYMBOLS`, `BUILT_IN_NETWORKS`, `NETWORK_ID_TO_ETHERS_NETWORK_NAME_MAP`, `InfuraNetworkType`, `NetworkType`, `BuiltInNetworkName`, `ChainId`, `NetworkId`, and `NetworksTicker`
  - `isNetworkType` will now return true when given `linea-mainnet` or `linea-goerli`

### `@metamask/network-controller`

- **ADDED:** Add support for Infura provider types `linea-mainnet` and `linea-goerli`
- **CHANGED:** Update `@metamask/eth-json-rpc-infura` package version to 8.1.0 to support Linea networks

### `@metamask/transaction-controller`

- **CHANGED:** Update `approveTransaction`, `stopTransaction`, and `speedUpTransaction` to use proper chain ID and network ID when creating transaction for Linea networks

I filled in what I thought was a proper summary of the changes to the transaction controller from what I could guess, but feel free to clarify that further if you have more knowledge.

This should help us when building the changelog for a new release.

Thanks for you comment @mcmire :) I updated "Changes" part in the PR description.

Regarding this Why did you have to exclude Linea from the getCommonConfiguration method?:
I needed to exclude Linea because @ethereumjs/common does not support Linea networks for now.

@mcmire
Copy link
Contributor

mcmire commented Jun 13, 2023

@VGau Thanks! I think it would be good to add a test, even if it's just for approveTransaction, that guarantees that a transaction for Linea looks the way we expect, and then I can approve this PR.

@VGau VGau force-pushed the feat/add-linea-networks branch from b0314d4 to 45672b5 Compare June 30, 2023 18:20
@socket-security
Copy link

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
@metamask/eth-json-rpc-infura 8.0.0...8.1.0 None +0/-0 47.6 kB gudahtt

@mcmire
Copy link
Contributor

mcmire commented Jul 6, 2023

@VGau Is this ready for another review?

@VGau
Copy link
Contributor Author

VGau commented Jul 7, 2023

@VGau Is this ready for another review?

@mcmire Yes it is ready for another review :)

@VGau VGau force-pushed the feat/add-linea-networks branch from 45672b5 to 17a9fef Compare July 7, 2023 06:54
mcmire
mcmire previously approved these changes Jul 7, 2023
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

This looks good to me! Sorry for the long wait on this.

@mcmire
Copy link
Contributor

mcmire commented Jul 7, 2023

The test failures for assets-controller look intermittent — try re-running CI and they should work.

@mcmire
Copy link
Contributor

mcmire commented Jul 11, 2023

@metamaskbot publish-preview

@mcmire
Copy link
Contributor

mcmire commented Jul 11, 2023

Ah, I see, this is from a fork, so we can't create a preview-build. Temp PR created here: #1478

@mcmire
Copy link
Contributor

mcmire commented Jul 11, 2023

Here are the preview builds for anyone who wants to test this in extension (note: you'll need to first add @metamask/eth-json-rpc-infura to package.json to populate the cache, then you can upgrade @metamask/controller-utils and @metamask/network-controller):

{
  "@metamask/address-book-controller": "3.0.0-preview.be1b962",
  "@metamask/announcement-controller": "4.0.0-preview.be1b962",
  "@metamask/approval-controller": "3.4.0-preview.be1b962",
  "@metamask/assets-controllers": "9.2.0-preview.be1b962",
  "@metamask/base-controller": "3.0.0-preview.be1b962",
  "@metamask/composable-controller": "3.0.0-preview.be1b962",
  "@metamask/controller-utils": "4.1.0-preview.be1b962",
  "@metamask/ens-controller": "4.0.0-preview.be1b962",
  "@metamask/gas-fee-controller": "6.0.1-preview.be1b962",
  "@metamask/keyring-controller": "6.0.0-preview.be1b962",
  "@metamask/logging-controller": "1.0.0-preview.be1b962",
  "@metamask/message-manager": "7.0.2-preview.be1b962",
  "@metamask/network-controller": "10.3.0-preview.be1b962",
  "@metamask/notification-controller": "3.0.0-preview.be1b962",
  "@metamask/permission-controller": "4.0.1-preview.be1b962",
  "@metamask/phishing-controller": "5.0.0-preview.be1b962",
  "@metamask/preferences-controller": "4.2.0-preview.be1b962",
  "@metamask/rate-limit-controller": "3.0.0-preview.be1b962",
  "@metamask/signature-controller": "5.1.0-preview.be1b962",
  "@metamask/transaction-controller": "7.0.0-preview.be1b962"
}

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

@VGau I added some more tests yesterday so be sure to do a pull on your side if you need to add any more changes.

Regardless, everything here looks good to me.

@danjm danjm dismissed legobeat’s stale review July 12, 2023 19:20

Requested change won't be addressed at this time, but may be considered in the future

@mcmire mcmire merged commit ea3b5e9 into MetaMask:main Jul 12, 2023
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
- Added linea networks support in controller utils
- Added linea networks support in network controller
- Added linea networks support in transaction controller
- Updated `@metamask/eth-json-rpc-infura` package version to 8.1.0 to support linea networks

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
- Added linea networks support in controller utils
- Added linea networks support in network controller
- Added linea networks support in transaction controller
- Updated `@metamask/eth-json-rpc-infura` package version to 8.1.0 to support linea networks

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
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.

5 participants