diff --git a/contracts/test-utils/src/constants.ts b/contracts/test-utils/src/constants.ts index 45bcc6ff72..5e33b32295 100644 --- a/contracts/test-utils/src/constants.ts +++ b/contracts/test-utils/src/constants.ts @@ -32,6 +32,7 @@ export const constants = { BASE_16: 16, INVALID_OPCODE: 'invalid opcode', TESTRPC_NETWORK_ID: 50, + TESTRPC_CHAIN_ID: 1337, // Note(albrow): In practice V8 and most other engines limit the minimum // interval for setInterval to 10ms. We still set it to 0 here in order to // ensure we always use the minimum interval. diff --git a/contracts/test-utils/test/mocha_blockchain.ts b/contracts/test-utils/test/mocha_blockchain.ts index bf21bbe41d..15c4ea43e5 100644 --- a/contracts/test-utils/test/mocha_blockchain.ts +++ b/contracts/test-utils/test/mocha_blockchain.ts @@ -18,7 +18,7 @@ blockchainTests('mocha blockchain extensions', env => { }); it('initializes the test environment', async () => { - expect(await env.getChainIdAsync()).to.eq(constants.TESTRPC_NETWORK_ID); + expect(await env.getChainIdAsync()).to.eq(constants.TESTRPC_CHAIN_ID); expect(await env.getAccountAddressesAsync()).to.be.not.empty(''); }); diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index 5056bca91e..04a5829780 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "4.4.0-beta.1", + "changes": [ + { + "note": "Update all contract deployments to pass the actual chain ID (rather than the network ID) via the newly modified @0x/utils/provider_utils", + "pr": 2270 + } + ] + }, { "version": "4.4.0-beta.0", "changes": [ diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index 356ae9535e..769fd80687 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "Consolidated FixedMathRevertErrors", "pr": 2255 + }, + { + "note": "Changed provider_utils.providerUtils.getChainIdAsync() to invoke RPC method eth_chainId rather than net_version", + "pr": 2270 } ] }, diff --git a/packages/utils/src/provider_utils.ts b/packages/utils/src/provider_utils.ts index 736d54fae4..0a9849bdb9 100644 --- a/packages/utils/src/provider_utils.ts +++ b/packages/utils/src/provider_utils.ts @@ -111,7 +111,7 @@ export const providerUtils = { { jsonrpc: '2.0', id: _.random(1, RPC_ID_MAX), - method: 'net_version', + method: 'eth_chainId', params: [], }, (err: Error | null, result?: JSONRPCResponsePayload) => { @@ -119,7 +119,7 @@ export const providerUtils = { reject(err); } if (!result) { - throw new Error("Invalid 'net_version' response"); + throw new Error("Invalid 'eth_chainId' response"); } accept(_.toNumber(result.result)); },