Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
a68dacf
Core preview build packages
jiexi Aug 29, 2023
8da19b1
Remove networkId from transactions
jiexi Aug 29, 2023
8a511da
Remove networkId from smart-transactions-controller
jiexi Aug 29, 2023
5fc2e60
fix mmc test
jiexi Aug 29, 2023
05b8946
update jsdoc in background.js
jiexi Aug 29, 2023
8ca270c
Merge branch 'develop' into jl/remove-network-id
jiexi Aug 29, 2023
5436611
fix remaining specs
jiexi Aug 29, 2023
e38946e
Update test fixtures
jiexi Aug 30, 2023
18c6564
Cleanup network constants. Fix remaining specs
jiexi Aug 30, 2023
7e875f1
Merge branch 'develop' into jl/remove-network-id
jiexi Aug 30, 2023
c611112
temporarily remove ppom package
jiexi Aug 30, 2023
72c7d55
PPOM temporary
jiexi Aug 30, 2023
3d2514c
temporarily disable fitness sinon assert
jiexi Aug 30, 2023
087f301
yarn dedupe
jiexi Aug 30, 2023
0b45205
lint
jiexi Aug 30, 2023
dfca596
Merge branch 'develop' into jl/remove-network-id
jiexi Aug 30, 2023
0e72501
revert chromedriver
jiexi Aug 30, 2023
f03d172
Update LavaMoat policies
metamaskbot Aug 30, 2023
4a9facf
restore networkVersion
jiexi Aug 30, 2023
3b40e6b
fix ens domain resolution
jiexi Aug 30, 2023
6dc3702
re-enable assert sinon fitness
jiexi Aug 31, 2023
234caaa
add deprcatedNetworkId to MMC
jiexi Sep 5, 2023
ad373ad
notifyChainChange only via NetworkController:networkDidChange
jiexi Sep 5, 2023
323e8e1
use deprecatedGetNetworkId
jiexi Sep 5, 2023
f7fb4f3
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 5, 2023
fad1557
add notifyChainChange back to state
jiexi Sep 6, 2023
638046d
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 6, 2023
b7d242b
fix specs
jiexi Sep 6, 2023
d4aae6c
Revert "use deprecatedGetNetworkId"
jiexi Sep 6, 2023
39b5657
remove networkId from missed transactionMatchesNetwork call
jiexi Sep 7, 2023
c346979
Use deprecatedNetworkIdMatchesChainId. Rename transactionMatchesNetwo…
jiexi Sep 7, 2023
f98a83d
lint
jiexi Sep 7, 2023
da2cece
Update LavaMoat policies
metamaskbot Sep 7, 2023
8789da5
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 7, 2023
df96d08
make metamaskNetworkId readonly deprecated. Make chainId Hex
jiexi Sep 7, 2023
aeb280b
fix jsdoc
jiexi Sep 7, 2023
11d0bef
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 7, 2023
85d641a
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 11, 2023
6504595
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 11, 2023
93d293b
Re-add getNetworkId in mmc
jiexi Sep 13, 2023
63089a4
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 13, 2023
d30d316
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 13, 2023
741b922
Update LavaMoat policies
metamaskbot Sep 13, 2023
5a9075a
check txParams.chainId
jiexi Sep 13, 2023
40d19fa
Merge remote-tracking branch 'origin/jl/remove-network-id' into jl/re…
jiexi Sep 13, 2023
79b2434
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 13, 2023
dfe31ff
yarn dedupe
jiexi Sep 13, 2023
5cd32df
Update policies
jiexi Sep 13, 2023
f0b28f6
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 14, 2023
ce3ab48
Fix yarn resolution. Update lavamoat
jiexi Sep 14, 2023
cf46600
Update LavaMoat policies
metamaskbot Sep 14, 2023
7498fa6
Lavamoat again
jiexi Sep 14, 2023
5d8bbf7
Yarn dedupe. Lavamoat
jiexi Sep 14, 2023
5d78d5d
check only txMeta.chainId
jiexi Sep 20, 2023
b2a4aad
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 20, 2023
ff67b39
Update LavaMoat policies
metamaskbot Sep 20, 2023
f755125
Fix test network state for unreleased network controller changes
jiexi Sep 20, 2023
f2aa2ca
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 20, 2023
3759306
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 21, 2023
936c0ea
Lint
jiexi Sep 21, 2023
b7aa3dc
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 21, 2023
07cdeb4
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 21, 2023
4a0586c
bump controller-utils, network-controller, selected-network-controller
jiexi Sep 27, 2023
924cdee
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 27, 2023
6f0f636
fetch net_version in MMC
jiexi Sep 27, 2023
0733280
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 27, 2023
e4af390
cleanup mmc
jiexi Sep 27, 2023
01f8b95
Reorder import
jiexi Sep 27, 2023
a640184
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 27, 2023
ee5156d
Merge branch 'develop' into jl/remove-network-id
jiexi Sep 27, 2023
5178dcf
Update LavaMoat policies
metamaskbot Sep 27, 2023
92a645a
Merge branch 'develop' into jl/remove-network-id
jiexi Oct 2, 2023
2fd26b4
Merge branch 'develop' into jl/remove-network-id
jiexi Oct 3, 2023
56c1acd
update txHelper usage
jiexi Oct 3, 2023
13c6336
Merge branch 'develop' into jl/remove-network-id
jiexi Oct 3, 2023
3403a54
Merge branch 'develop' into jl/remove-network-id
jiexi Oct 4, 2023
33d1f95
Merge branch 'develop' into jl/remove-network-id
jiexi Oct 6, 2023
22a94f5
Merge branch 'develop' into jl/remove-network-id
jiexi Oct 13, 2023
eff6b5f
Update LavaMoat policies
metamaskbot Oct 13, 2023
2ab475d
Merge branch 'develop' into jl/remove-network-id
jiexi Oct 17, 2023
0b7c955
Update LavaMoat policies
metamaskbot Oct 17, 2023
e1402f8
Merge branch 'develop' into jl/remove-network-id
jiexi Oct 17, 2023
94286c3
lint
jiexi Oct 17, 2023
3a91436
Update LavaMoat policies
metamaskbot Oct 17, 2023
25022c8
Remove networkId checks from provider-api e2e spec
jiexi Oct 17, 2023
1c3bb66
add migration
jiexi Oct 17, 2023
bb46c3e
include the migration...
jiexi Oct 17, 2023
d0cc587
Merge branch 'develop' into jl/remove-network-id
adonesky1 Oct 18, 2023
34fe4b8
Merge branch 'develop' into jl/remove-network-id
jiexi Oct 18, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export const currentNetworkTxListSample = {
"id": 7900715443136469,
"time": 1621395091737,
"status": "unapproved",
"metamaskNetworkId": "1337",
"chainId": "0x539",
"loadingDefaults": false,
"txParams": {
Expand All @@ -20,7 +19,6 @@ export const currentNetworkTxListSample = {
"id": 7900715443136469,
"time": 1621395091737,
"status": "unapproved",
"metamaskNetworkId": "1337",
"chainId": "0x539",
"loadingDefaults": true,
"txParams": {
Expand Down Expand Up @@ -53,4 +51,4 @@ export const subjectMetadata = {
"iconUrl": "https://metamask.github.io/test-dapp/metamask-fox.svg",
"subjectType": "website"
}
}
}
31 changes: 13 additions & 18 deletions .storybook/initial-states/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 643368596521636,
time: 1653527035634,
status: 'submitted',
metamaskNetworkId: '5',
originalGasEstimate: '5208',
userEditedGasLimit: false,
chainId: '0x5',
Expand All @@ -50,7 +49,6 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 643368596521636,
time: 1653527035634,
status: 'approved',
metamaskNetworkId: '5',
originalGasEstimate: '5208',
userEditedGasLimit: false,
chainId: '0x5',
Expand Down Expand Up @@ -158,7 +156,6 @@ export const MOCK_TRANSACTION_BY_TYPE = {
},
id: 7694052085150913,
loadingDefaults: true,
metamaskNetworkId: '5',
origin: 'https://remix.ethereum.org',
originalGasEstimate: '0x118f4',
sendFlowHistory: [],
Expand All @@ -181,7 +178,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
[MOCK_TX_TYPE.DEPLOY_CONTRACT]: {
blockNumber: '6195527',
id: 4243712234858468,
metamaskNetworkId: '5',
chainId: '0x5',
status: 'confirmed',
time: 1585088013000,
txParams: {
Expand Down Expand Up @@ -238,7 +235,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
[MOCK_TX_TYPE.INCOMING]: {
blockNumber: '6477257',
id: 4243712234858505,
metamaskNetworkId: '5',
chainId: '0x5',
status: 'confirmed',
time: 1589314295000,
txParams: {
Expand Down Expand Up @@ -292,7 +289,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 3938342322880462,
time: 1653459456297,
status: 'failed',
metamaskNetworkId: '5',
chainId: '0x5',
originalGasEstimate: '14609',
userEditedGasLimit: false,
chainId: '0x5',
Expand Down Expand Up @@ -322,7 +319,6 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 3938342322880462,
time: 1653459456297,
status: 'approved',
metamaskNetworkId: '5',
originalGasEstimate: '14609',
userEditedGasLimit: false,
chainId: '0x5',
Expand Down Expand Up @@ -481,7 +477,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 4243712234858512,
time: 1589314601567,
status: 'confirmed',
metamaskNetworkId: '5',
chainId: '0x5',
loadingDefaults: false,
txParams: {
from: '0xabca64466f257793eaa52fcfff5066894b76a149',
Expand All @@ -497,7 +493,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
[MOCK_TX_TYPE.SMART]: {
blockNumber: '6195527',
id: 4243712234858468,
metamaskNetworkId: '5',
chainId: '0x5',
status: 'confirmed',
time: 1585088013000,
txParams: {
Expand All @@ -517,7 +513,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
[MOCK_TX_TYPE.SWAP]: {
blockNumber: '6195527',
id: 4243712234858467,
metamaskNetworkId: '5',
chainId: '0x5',
status: 'confirmed',
time: 1585088013000,
txParams: {
Expand All @@ -536,7 +532,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
[MOCK_TX_TYPE.SWAP_APPROVAL]: {
blockNumber: '6195527',
id: 4243712234858467,
metamaskNetworkId: '5',
chainId: '0x5',
status: 'confirmed',
time: 1585088013000,
txParams: {
Expand All @@ -556,7 +552,6 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 5177046356058729,
time: 1653457101080,
status: 'submitted',
metamaskNetworkId: '5',
originalGasEstimate: '0xb427',
userEditedGasLimit: false,
chainId: '0x5',
Expand Down Expand Up @@ -584,7 +579,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 5177046356058729,
time: 1653457101080,
status: 'unapproved',
metamaskNetworkId: '5',
chainId: '0x5',
originalGasEstimate: '0xb427',
userEditedGasLimit: false,
chainId: '0x5',
Expand Down Expand Up @@ -760,7 +755,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 1441203963845330,
time: 1652206763566,
status: 'confirmed',
metamaskNetworkId: '5',
chainId: '0x5',
originalGasEstimate: '0x118e0',
userEditedGasLimit: false,
chainId: '0x5',
Expand Down Expand Up @@ -861,7 +856,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 5177046356058725,
time: 1653457077370,
status: 'confirmed',
metamaskNetworkId: '5',
chainId: '0x5',
originalGasEstimate: '0xea60',
userEditedGasLimit: false,
chainId: '0x5',
Expand Down Expand Up @@ -889,7 +884,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 5177046356058725,
time: 1653457077370,
status: 'unapproved',
metamaskNetworkId: '5',
chainId: '0x5',
originalGasEstimate: '0xea60',
userEditedGasLimit: false,
chainId: '0x5',
Expand Down Expand Up @@ -1215,7 +1210,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 5177046356058754,
time: 1653457323504,
status: 'confirmed',
metamaskNetworkId: '5',
chainId: '0x5',
originalGasEstimate: '0x10896',
userEditedGasLimit: false,
chainId: '0x5',
Expand Down Expand Up @@ -1265,7 +1260,7 @@ export const MOCK_TRANSACTION_BY_TYPE = {
id: 5177046356058754,
time: 1653457323504,
status: 'unapproved',
metamaskNetworkId: '5',
chainId: '0x5',
originalGasEstimate: '0x10896',
userEditedGasLimit: false,
chainId: '0x5',
Expand Down
14 changes: 4 additions & 10 deletions .storybook/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ const state = {
id: 3111025347726181,
time: 1620710815484,
status: 'unapproved',
metamaskNetworkId: '5',
msgParams: '0x64a845a5b02460acf8a3d84503b0d68d028b4bb4',
chainId: '0x5',
loadingDefaults: false,
Expand All @@ -339,7 +338,6 @@ const state = {
id: 7786962153682822,
time: 1620710815484,
status: 'unapproved',
metamaskNetworkId: '5',
chainId: '0x5',
loadingDefaults: true,
txParams: {
Expand Down Expand Up @@ -586,7 +584,6 @@ const state = {
dappSuggestedGasFees: null,
id: 2360388496987298,
loadingDefaults: true,
metamaskNetworkId: '56',
origin: 'metamask',
status: 'unapproved',
time: 1629582710520,
Expand Down Expand Up @@ -873,7 +870,6 @@ const state = {
],
id: 7900715443136469,
loadingDefaults: false,
metamaskNetworkId: '56',
origin: 'metamask',
r: '0x90a4dfb0646eef9815454d0ab543b5844acb8772101084565155c93ecce8ed69',
rawTx:
Expand Down Expand Up @@ -1153,7 +1149,7 @@ const state = {
'0x2de9256a7c604586f7ecfd87ae9509851e217f588f9f85feed793c54ed2ce0aa': {
blockNumber: '8888976',
id: 4678200543090532,
metamaskNetworkId: '1',
chainId: '0x1',
status: 'confirmed',
time: 1573114896000,
txParams: {
Expand All @@ -1170,7 +1166,7 @@ const state = {
'0x320a1fd769373578f78570e5d8f56e89bc7bce9657bb5f4c12d8fe790d471bfd': {
blockNumber: '9453174',
id: 4678200543090535,
metamaskNetworkId: '1',
chainId: '0x1',
status: 'confirmed',
time: 1581312411000,
txParams: {
Expand All @@ -1187,7 +1183,7 @@ const state = {
'0x8add6c1ea089a8de9b15fa2056b1875360f17916755c88ace9e5092b7a4b1239': {
blockNumber: '10892417',
id: 4678200543090542,
metamaskNetworkId: '1',
chainId: '0x1',
status: 'confirmed',
time: 1600515224000,
txParams: {
Expand All @@ -1204,7 +1200,7 @@ const state = {
'0x50be62ab1cabd03ff104c602c11fdef7a50f3d73c55006d5583ba97950ab1144': {
blockNumber: '10902987',
id: 4678200543090545,
metamaskNetworkId: '1',
chainId: '0x1',
status: 'confirmed',
time: 1600654021000,
txParams: {
Expand Down Expand Up @@ -1425,7 +1421,6 @@ const state = {
id: 3111025347726181,
time: 1620723786838,
status: 'unapproved',
metamaskNetworkId: '5',
chainId: '0x5',
loadingDefaults: false,
txParams: {
Expand All @@ -1444,7 +1439,6 @@ const state = {
id: 3111025347726181,
time: 1620723786838,
status: 'unapproved',
metamaskNetworkId: '5',
chainId: '0x5',
loadingDefaults: true,
txParams: {
Expand Down
1 change: 0 additions & 1 deletion app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ browser.runtime.onConnectExternal.addListener(async (...args) => {
* @property {object} providerConfig - The current selected network provider.
* @property {string} providerConfig.rpcUrl - The address for the RPC API, if using an RPC API.
* @property {string} providerConfig.type - An identifier for the type of network selected, allows MetaMask to use custom provider strategies for known networks.
* @property {string} networkId - The stringified number of the current network ID.
* @property {string} networkStatus - Either "unknown", "available", "unavailable", or "blocked", depending on the status of the currently selected network.
* @property {object} accounts - An object mapping lower-case hex addresses to objects with "balance" and "address" keys, both storing hex string values.
* @property {hex} currentBlockGasLimit - The most recently seen block gas limit, in a lower case hex prefixed string.
Expand Down
15 changes: 8 additions & 7 deletions app/scripts/controllers/ens/ens.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { Web3Provider } from '@ethersproject/providers';
import ensNetworkMap from 'ethereum-ens-network-map';
import { NETWORK_ID_TO_ETHERS_NETWORK_NAME_MAP } from '../../../../shared/constants/network';
import { CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP } from '../../../../shared/constants/network';

export default class Ens {
static getNetworkEnsSupport(network) {
return Boolean(ensNetworkMap[network]);
static getChainEnsSupport(chainId) {
return Boolean(ensNetworkMap[parseInt(chainId, 16).toString()]);
}

constructor({ network, provider } = {}) {
const networkName = NETWORK_ID_TO_ETHERS_NETWORK_NAME_MAP[network];
const ensAddress = ensNetworkMap[network];
constructor({ chainId, provider } = {}) {
const networkName = CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP[chainId];
const chainIdInt = parseInt(chainId, 16);
Copy link
Contributor

Choose a reason for hiding this comment

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

parseInt could return NaN — should we check for that?

Copy link
Contributor

@adonesky1 adonesky1 Oct 18, 2023

Choose a reason for hiding this comment

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

seems like this question has been addressed in a separate thread?

const ensAddress = ensNetworkMap[chainIdInt.toString()];
const ethProvider = new Web3Provider(provider, {
chainId: parseInt(network, 10),
chainId: chainIdInt,
name: networkName,
ensAddress,
});
Expand Down
11 changes: 4 additions & 7 deletions app/scripts/controllers/ens/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import punycode from 'punycode/punycode';
import { ObservableStore } from '@metamask/obs-store';
import log from 'loglevel';
import { CHAIN_ID_TO_NETWORK_ID_MAP } from '../../../../shared/constants/network';
import { toChecksumHexAddress } from '../../../../shared/modules/hexstring-utils';
import Ens from './ens';

Expand All @@ -17,10 +16,9 @@ export default class EnsController {
this._ens = ens;
if (!this._ens) {
const chainId = getCurrentChainId();
const network = CHAIN_ID_TO_NETWORK_ID_MAP[chainId];
if (Ens.getNetworkEnsSupport(network)) {
if (Ens.getChainEnsSupport(chainId)) {
this._ens = new Ens({
network,
chainId,
provider,
});
}
Expand All @@ -35,10 +33,9 @@ export default class EnsController {
onNetworkDidChange(() => {
this.store.putState(initState);
const chainId = getCurrentChainId();
const network = CHAIN_ID_TO_NETWORK_ID_MAP[chainId];
if (Ens.getNetworkEnsSupport(network)) {
if (Ens.getChainEnsSupport(chainId)) {
this._ens = new Ens({
network,
chainId,
provider,
});
} else {
Expand Down
1 change: 0 additions & 1 deletion app/scripts/controllers/mmi-controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ describe('MMIController', function () {
type: 'rinkeby',
},
getCurrentChainId: jest.fn(),
getNetworkId: jest.fn(),
onNetworkStateChange: jest.fn(),
}),
signatureController: new SignatureController({
Expand Down
13 changes: 8 additions & 5 deletions app/scripts/controllers/swaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,20 @@ export default class SwapsController {
this.indexOfNewestCallInFlight = 0;

this.ethersProvider = new Web3Provider(provider);
this._currentNetworkId = networkController.state.networkId;
this._currentChainId = networkController.state.providerConfig.chainId;
onNetworkStateChange(() => {
const { networkId, networksMetadata, selectedNetworkClientId } =
networkController.state;
const {
networksMetadata,
selectedNetworkClientId,
providerConfig: { chainId },
} = networkController.state;
const selectedNetworkStatus =
networksMetadata[selectedNetworkClientId]?.status;
if (
selectedNetworkStatus === NetworkStatus.Available &&
networkId !== this._currentNetworkId
chainId !== this._currentChainId
) {
this._currentNetworkId = networkId;
this._currentChainId = chainId;
this.ethersProvider = new Web3Provider(provider);
}
});
Expand Down
Loading