diff --git a/packages/block/test/testdata/testnetMerge.json b/packages/block/test/testdata/testnetMerge.json index 995d7b1d2a..e6698fa6b3 100644 --- a/packages/block/test/testdata/testnetMerge.json +++ b/packages/block/test/testdata/testnetMerge.json @@ -1,7 +1,6 @@ { "name": "testnetMerge", "chainId": 55555, - "networkId": 55555, "defaultHardfork": "istanbul", "consensus": { "type": "poa", diff --git a/packages/blockchain/test/testdata/testnet.json b/packages/blockchain/test/testdata/testnet.json index 177e9b5baa..3bf8733743 100644 --- a/packages/blockchain/test/testdata/testnet.json +++ b/packages/blockchain/test/testdata/testnet.json @@ -1,7 +1,6 @@ { "name": "mainnet", "chainId": 1, - "networkId": 1, "defaultHardfork": "london", "consensus": { "type": "pow", diff --git a/packages/client/bin/cli.ts b/packages/client/bin/cli.ts index 6e692ca1e9..ee1eccb7be 100755 --- a/packages/client/bin/cli.ts +++ b/packages/client/bin/cli.ts @@ -85,8 +85,16 @@ const args: ClientOpts = yargs choices: networks.map((n) => n[1]).filter((el) => isNaN(parseInt(el))), default: 'mainnet', }) + .option('chainId', { + describe: 'Chain ID', + choices: networks.map((n) => parseInt(n[0])).filter((el) => !isNaN(el)), + default: undefined, + conflicts: ['customChain', 'customGenesisState', 'gethGenesis'], // Disallows custom chain data and chainId + }) .option('networkId', { describe: 'Network ID', + deprecated: true, + deprecate: 'use --chainId instead', choices: networks.map((n) => parseInt(n[0])).filter((el) => !isNaN(el)), default: undefined, conflicts: ['customChain', 'customGenesisState', 'gethGenesis'], // Disallows custom chain data and networkId @@ -922,8 +930,9 @@ async function run() { // TODO sharding: Just initialize kzg library now, in future it can be optimized to be // loaded and initialized on the sharding hardfork activation - // Give network id precedence over network name - const chain = args.networkId ?? args.network ?? Chain.Mainnet + // Give chainId priority over networkId + // Give networkId precedence over network name + const chain = args.chainId ?? args.networkId ?? args.network ?? Chain.Mainnet const cryptoFunctions: CustomCrypto = {} const kzg = await loadKZG() diff --git a/packages/client/examples/private-geth-network.md b/packages/client/examples/private-geth-network.md index ab20204888..53eb07a96f 100644 --- a/packages/client/examples/private-geth-network.md +++ b/packages/client/examples/private-geth-network.md @@ -14,7 +14,7 @@ Second, get geth configured to use the genesis parameters file just updated. Now, let's run geth and ensure that its sealing blocks. Note, geth will prompt you for a password to unlock your signer account. -`geth --datadir data --nat extip:[your local ip address here] --networkid 15470 --unlock [the signer account you created] --mine --nodiscover` +`geth --datadir data --nat extip:[your local ip address here] --chainId 15470 --unlock [the signer account you created] --mine --nodiscover` You should start seeing logs like below: diff --git a/packages/client/src/blockchain/chain.ts b/packages/client/src/blockchain/chain.ts index b2adafd7b7..63f03235dd 100644 --- a/packages/client/src/blockchain/chain.ts +++ b/packages/client/src/blockchain/chain.ts @@ -226,10 +226,10 @@ export class Chain { } /** - * Network ID + * Chain ID */ - get networkId(): bigint { - return this.config.chainCommon.networkId() + get chainId(): bigint { + return this.config.chainCommon.chainId() } /** diff --git a/packages/client/src/net/protocol/ethprotocol.ts b/packages/client/src/net/protocol/ethprotocol.ts index 2c9d0ac0d5..bc94fec3dc 100644 --- a/packages/client/src/net/protocol/ethprotocol.ts +++ b/packages/client/src/net/protocol/ethprotocol.ts @@ -404,7 +404,7 @@ export class EthProtocol extends Protocol { */ encodeStatus(): any { return { - networkId: bigIntToUnpaddedBytes(this.chain.networkId), + chainId: bigIntToUnpaddedBytes(this.chain.chainId), td: bigIntToUnpaddedBytes(this.chain.blocks.td), bestHash: this.chain.blocks.latest!.hash(), genesisHash: this.chain.genesis.hash(), @@ -418,7 +418,7 @@ export class EthProtocol extends Protocol { */ decodeStatus(status: any): any { return { - networkId: bytesToBigInt(status.networkId), + chainId: bytesToBigInt(status.chainId), td: bytesToBigInt(status.td), bestHash: status.bestHash, genesisHash: status.genesisHash, diff --git a/packages/client/src/net/protocol/lesprotocol.ts b/packages/client/src/net/protocol/lesprotocol.ts index 97f4400cb9..b64324b774 100644 --- a/packages/client/src/net/protocol/lesprotocol.ts +++ b/packages/client/src/net/protocol/lesprotocol.ts @@ -194,7 +194,7 @@ export class LesProtocol extends Protocol { const forkID = [hexToBytes(forkHash), bigIntToUnpaddedBytes(nextFork ?? 0n)] return { - networkId: bigIntToUnpaddedBytes(this.chain.networkId), + chainId: bigIntToUnpaddedBytes(this.chain.chainId), headTd: bigIntToUnpaddedBytes(this.chain.headers.td), headHash: this.chain.headers.latest?.hash(), headNum: bigIntToUnpaddedBytes(this.chain.headers.height), @@ -223,7 +223,7 @@ export class LesProtocol extends Protocol { } } return { - networkId: bytesToBigInt(status.networkId), + chainId: bytesToBigInt(status.chainId), headTd: bytesToBigInt(status.headTd), headHash: status.headHash, headNum: bytesToBigInt(status.headNum), diff --git a/packages/client/src/rpc/modules/admin.ts b/packages/client/src/rpc/modules/admin.ts index 2da9a3c846..49a5c31234 100644 --- a/packages/client/src/rpc/modules/admin.ts +++ b/packages/client/src/rpc/modules/admin.ts @@ -45,7 +45,7 @@ export class Admin { const difficulty = latestHeader.difficulty.toString() const genesis = bytesToHex(this._chain.genesis.hash()) const head = bytesToHex(latestHeader.mixHash) - const network = this._chain.networkId.toString() + const network = this._chain.chainId.toString() const nodeInfo = { name: clientName, diff --git a/packages/client/src/types.ts b/packages/client/src/types.ts index bbebaabb05..0098d534f8 100644 --- a/packages/client/src/types.ts +++ b/packages/client/src/types.ts @@ -98,6 +98,8 @@ export type DnsNetwork = string export interface ClientOpts { network?: string + chainId?: number + // Deprecated, use chainId instead networkId?: number sync?: SyncMode lightServe?: boolean diff --git a/packages/client/test/blockchain/chain.spec.ts b/packages/client/test/blockchain/chain.spec.ts index 981573a9ab..2f6f945ca4 100644 --- a/packages/client/test/blockchain/chain.spec.ts +++ b/packages/client/test/blockchain/chain.spec.ts @@ -33,7 +33,7 @@ describe('[Chain]', () => { it('should retrieve chain properties', async () => { const chain = await Chain.create({ config }) await chain.open() - assert.equal(chain.networkId, BigInt(1), 'get chain.networkId') + assert.equal(chain.chainId, BigInt(1), 'get chain.chainId') assert.equal(chain.blocks.td.toString(10), '17179869184', 'get chain.blocks.td') assert.equal(chain.blocks.height.toString(10), '0', 'get chain.blocks.height') assert.equal( diff --git a/packages/client/test/cli/cli.spec.ts b/packages/client/test/cli/cli.spec.ts index 2fc1987eda..cabf9ee261 100644 --- a/packages/client/test/cli/cli.spec.ts +++ b/packages/client/test/cli/cli.spec.ts @@ -31,7 +31,7 @@ export function clientRunHelper( describe('[CLI]', () => { // chain network tests it('should successfully start client with a custom network and network id', async () => { - const cliArgs = ['--network=sepolia', '--networkId=11155111'] + const cliArgs = ['--network=sepolia', '--chainId=11155111'] const onData = (message: string, child: ChildProcessWithoutNullStreams, resolve: Function) => { if (message.includes('Initializing Ethereumjs client')) { assert.ok( @@ -648,7 +648,6 @@ describe('[CLI]', () => { const customChainJson = `{ "name": "customChain", "chainId": 11155111, - "networkId": 11155111, "defaultHardfork": "shanghai", "consensus": { "type": "pow", @@ -782,13 +781,13 @@ describe('[CLI]', () => { await clientRunHelper(cliArgs, onData, true) }, 5000) it('should not start client with conflicting parameters', async () => { - const cliArgs = ['--networkId', '--gethGenesis'] + const cliArgs = ['--chainId', '--gethGenesis'] const onData = async ( message: string, child: ChildProcessWithoutNullStreams, resolve: Function ) => { - if (message.includes('Arguments networkId and gethGenesis are mutually exclusive')) { + if (message.includes('Arguments chainId and gethGenesis are mutually exclusive')) { assert.ok(true, 'correctly errors on conflicting arguments') } child.kill(15) diff --git a/packages/client/test/net/protocol/ethprotocol.spec.ts b/packages/client/test/net/protocol/ethprotocol.spec.ts index 930aa794d0..82c423e52e 100644 --- a/packages/client/test/net/protocol/ethprotocol.spec.ts +++ b/packages/client/test/net/protocol/ethprotocol.spec.ts @@ -32,7 +32,7 @@ describe('[EthProtocol]', () => { const config = new Config({ accountCache: 10000, storageCache: 1000 }) const chain = await Chain.create({ config }) const p = new EthProtocol({ config, chain }) - Object.defineProperty(chain, 'networkId', { + Object.defineProperty(chain, 'chainId', { get: () => { return BigInt(1) }, @@ -53,7 +53,7 @@ describe('[EthProtocol]', () => { assert.deepEqual( p.encodeStatus(), { - networkId: hexToBytes('0x01'), + chainId: hexToBytes('0x01'), td: hexToBytes('0x64'), bestHash: '0xaa', genesisHash: '0xbb', @@ -62,13 +62,13 @@ describe('[EthProtocol]', () => { 'encode status' ) const status = p.decodeStatus({ - networkId: [0x01], + chainId: [0x01], td: hexToBytes('0x64'), bestHash: '0xaa', genesisHash: '0xbb', }) assert.ok( - status.networkId === BigInt(1) && + status.chainId === BigInt(1) && status.td === BigInt(100) && status.bestHash === '0xaa' && status.genesisHash === '0xbb', diff --git a/packages/client/test/net/protocol/lesprotocol.spec.ts b/packages/client/test/net/protocol/lesprotocol.spec.ts index 7d9719cb5a..e147f4b5b7 100644 --- a/packages/client/test/net/protocol/lesprotocol.spec.ts +++ b/packages/client/test/net/protocol/lesprotocol.spec.ts @@ -33,7 +33,7 @@ describe('[LesProtocol]', () => { mrc: { GetBlockHeaders: { base: 10, req: 10 } }, }) const p = new LesProtocol({ config, chain, flow }) - Object.defineProperty(chain, 'networkId', { + Object.defineProperty(chain, 'chainId', { get: () => { return BigInt(1) }, @@ -65,7 +65,7 @@ describe('[LesProtocol]', () => { }) let status = p.encodeStatus() assert.ok( - bytesToHex(status.networkId) === '0x01' && + bytesToHex(status.chainId) === '0x01' && bytesToHex(status.headTd) === '0x64' && status.headHash === '0xaa' && bytesToHex(status.headNum) === '0x64' && @@ -84,10 +84,10 @@ describe('[LesProtocol]', () => { bytesToHex(status['flowControl/MRC'][0][2]) === '0x0a', 'encode status' ) - status = { ...status, networkId: [0x01] } + status = { ...status, chainId: [0x01] } status = p.decodeStatus(status) assert.ok( - status.networkId === BigInt(1) && + status.chainId === BigInt(1) && status.headTd === BigInt(100) && status.headHash === '0xaa' && status.headNum === BigInt(100) && diff --git a/packages/client/test/rpc/eth/getProof.spec.ts b/packages/client/test/rpc/eth/getProof.spec.ts index 0c298ba2b7..9169ae06ce 100644 --- a/packages/client/test/rpc/eth/getProof.spec.ts +++ b/packages/client/test/rpc/eth/getProof.spec.ts @@ -42,7 +42,6 @@ const expectedProof = { const testnetData = { name: 'testnet2', chainId: 12345, - networkId: 12345, defaultHardfork: 'istanbul', consensus: { type: 'pow', diff --git a/packages/client/test/sim/beaconsync.spec.ts b/packages/client/test/sim/beaconsync.spec.ts index cbc46eb1e4..7611183123 100644 --- a/packages/client/test/sim/beaconsync.spec.ts +++ b/packages/client/test/sim/beaconsync.spec.ts @@ -51,7 +51,7 @@ describe('simple mainnet test run', async () => { } // Better add it as a option in startnetwork - process.env.NETWORKID = `${common.networkId()}` + process.env.NETWORKID = `${common.chainId()}` const { teardownCallBack, result } = await startNetwork(network, client, { filterKeywords, filterOutWords, diff --git a/packages/client/test/sim/snapsync.spec.ts b/packages/client/test/sim/snapsync.spec.ts index 81ab062c2f..e8aded7d90 100644 --- a/packages/client/test/sim/snapsync.spec.ts +++ b/packages/client/test/sim/snapsync.spec.ts @@ -58,7 +58,7 @@ describe('simple mainnet test run', async () => { process.env.EXTRA_CL_PARAMS = '--params.CAPELLA_FORK_EPOCH 0' } // Better add it as a option in startnetwork - process.env.NETWORKID = `${common.networkId()}` + process.env.NETWORKID = `${common.chainId()}` const { teardownCallBack, result } = await startNetwork(network, client, { filterKeywords, filterOutWords, diff --git a/packages/client/test/testdata/common/testnet.json b/packages/client/test/testdata/common/testnet.json index 0c7531e072..88e4a72ab5 100644 --- a/packages/client/test/testdata/common/testnet.json +++ b/packages/client/test/testdata/common/testnet.json @@ -1,7 +1,6 @@ { "name": "testnet", "chainId": 12345, - "networkId": 12345, "defaultHardfork": "byzantium", "consensus": { "type": "pow", diff --git a/packages/common/examples/genesisData/testnet.json b/packages/common/examples/genesisData/testnet.json index 1b208d2140..bfb6fe4974 100644 --- a/packages/common/examples/genesisData/testnet.json +++ b/packages/common/examples/genesisData/testnet.json @@ -1,7 +1,6 @@ { "name": "testnet1", "chainId": 22222, - "networkId": 22222, "defaultHardfork": "istanbul", "consensus": { "type": "poa", diff --git a/packages/common/examples/genesisData/testnet2.json b/packages/common/examples/genesisData/testnet2.json index 2215fde86c..5eec2f59ce 100644 --- a/packages/common/examples/genesisData/testnet2.json +++ b/packages/common/examples/genesisData/testnet2.json @@ -1,7 +1,6 @@ { "name": "testnet2", "chainId": 33333, - "networkId": 33333, "defaultHardfork": "istanbul", "consensus": { "type": "poa", diff --git a/packages/common/src/chains.ts b/packages/common/src/chains.ts index 946ed17c08..0443442b81 100644 --- a/packages/common/src/chains.ts +++ b/packages/common/src/chains.ts @@ -8,7 +8,6 @@ export const chains: ChainsDict = { mainnet: { name: 'mainnet', chainId: 1, - networkId: 1, defaultHardfork: 'shanghai', consensus: { type: 'pow', @@ -162,7 +161,6 @@ export const chains: ChainsDict = { goerli: { name: 'goerli', chainId: 5, - networkId: 5, defaultHardfork: 'shanghai', consensus: { type: 'poa', @@ -324,7 +322,6 @@ export const chains: ChainsDict = { sepolia: { name: 'sepolia', chainId: 11155111, - networkId: 11155111, defaultHardfork: 'shanghai', consensus: { type: 'pow', @@ -459,7 +456,6 @@ export const chains: ChainsDict = { holesky: { name: 'holesky', chainId: 17000, - networkId: 17000, defaultHardfork: 'paris', consensus: { type: 'pos', @@ -578,7 +574,6 @@ export const chains: ChainsDict = { kaustinen6: { name: 'kaustinen6', chainId: 69420, - networkId: 69420, defaultHardfork: 'osaka', consensus: { type: 'pos', diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index ddba7ecb36..33a0750450 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -106,7 +106,7 @@ export class Common { 'Chain must be a string, number, or bigint when initialized with customChains passed in' ) } - const required = ['networkId', 'genesis', 'hardforks', 'bootstrapNodes'] + const required = ['chainId', 'genesis', 'hardforks', 'bootstrapNodes'] for (const param of required) { if (!(param in chain)) { throw new Error(`Missing required chain parameter: ${param}`) @@ -847,14 +847,6 @@ export class Common { return this._chainParams.name } - /** - * Returns the Id of current network - * @returns network Id - */ - networkId(): bigint { - return BigInt(this._chainParams.networkId) - } - /** * Returns the additionally activated EIPs * (by using the `eips` constructor option) diff --git a/packages/common/src/constructors.ts b/packages/common/src/constructors.ts index 4fbb87208d..5ee817a7b5 100644 --- a/packages/common/src/constructors.ts +++ b/packages/common/src/constructors.ts @@ -48,7 +48,6 @@ export function createCustomCommon( { name: CustomChain.PolygonMainnet, chainId: 137, - networkId: 137, }, opts ) @@ -58,7 +57,6 @@ export function createCustomCommon( { name: CustomChain.PolygonMumbai, chainId: 80001, - networkId: 80001, }, opts ) @@ -68,7 +66,6 @@ export function createCustomCommon( { name: CustomChain.ArbitrumOne, chainId: 42161, - networkId: 42161, }, opts ) @@ -78,7 +75,6 @@ export function createCustomCommon( { name: CustomChain.xDaiChain, chainId: 100, - networkId: 100, }, opts ) @@ -89,7 +85,6 @@ export function createCustomCommon( { name: CustomChain.OptimisticKovan, chainId: 69, - networkId: 69, }, opts ) @@ -100,7 +95,6 @@ export function createCustomCommon( { name: CustomChain.OptimisticEthereum, chainId: 10, - networkId: 10, }, // Optimism has not implemented the London hardfork yet (targeting Q1.22) { hardfork: Hardfork.Berlin, ...opts } diff --git a/packages/common/src/types.ts b/packages/common/src/types.ts index a17d6b3d98..88c28f96d2 100644 --- a/packages/common/src/types.ts +++ b/packages/common/src/types.ts @@ -28,7 +28,6 @@ type ConsensusConfig = { export interface ChainConfig { name: string chainId: number | bigint - networkId: number | bigint defaultHardfork?: string comment?: string url?: string diff --git a/packages/common/src/utils.ts b/packages/common/src/utils.ts index 91b6db3931..975a256c02 100644 --- a/packages/common/src/utils.ts +++ b/packages/common/src/utils.ts @@ -88,7 +88,6 @@ function parseGethParams(json: any, mergeForkIdPostMerge: boolean = true) { const params = { name, chainId, - networkId: chainId, depositContractAddress, genesis: { timestamp, diff --git a/packages/common/test/chains.spec.ts b/packages/common/test/chains.spec.ts index 3a2da8caea..e0d25554b7 100644 --- a/packages/common/test/chains.spec.ts +++ b/packages/common/test/chains.spec.ts @@ -14,7 +14,6 @@ describe('[Common/Chains]: Initialization / Chain params', () => { let c = new Common({ chain: 'mainnet' }) assert.equal(c.chainName(), 'mainnet', 'should initialize with chain name') assert.equal(c.chainId(), BigInt(1), 'should return correct chain Id') - assert.equal(c.networkId(), BigInt(1), 'should return correct network Id') assert.equal(c.hardfork(), Hardfork.Shanghai, 'should set hardfork to current default hardfork') assert.equal( c.hardfork(), @@ -30,7 +29,6 @@ describe('[Common/Chains]: Initialization / Chain params', () => { const c = new Common({ chain: Chain.Mainnet }) assert.equal(c.chainName(), 'mainnet', 'should initialize with chain name') assert.equal(c.chainId(), BigInt(1), 'should return correct chain Id') - assert.equal(c.networkId(), BigInt(1), 'should return correct network Id') assert.equal(c.hardfork(), Hardfork.Shanghai, 'should set hardfork to current default hardfork') assert.equal( c.hardfork(), diff --git a/packages/common/test/customChains.spec.ts b/packages/common/test/customChains.spec.ts index 5efa8a83aa..71bdd0d9ae 100644 --- a/packages/common/test/customChains.spec.ts +++ b/packages/common/test/customChains.spec.ts @@ -21,7 +21,6 @@ describe('[Common]: Custom chains', () => { const c = new Common({ chain: testnet, hardfork: Hardfork.Byzantium }) assert.equal(c.chainName(), 'testnet', 'should initialize with chain name') assert.equal(c.chainId(), BigInt(12345), 'should return correct chain Id') - assert.equal(c.networkId(), BigInt(12345), 'should return correct network Id') assert.equal(c.hardforks()[3]['block'], 3, 'should return correct hardfork data') assert.equal(c.bootstrapNodes()[1].ip, '10.0.0.2', 'should return a bootstrap node array') }) @@ -42,7 +41,7 @@ describe('[Common]: Custom chains', () => { it('custom() -> base functionality', () => { const mainnetCommon = new Common({ chain: Chain.Mainnet }) - const customChainParams = { name: 'custom', chainId: 123, networkId: 678 } + const customChainParams = { name: 'custom', chainId: 123 } const customChainCommon = createCustomCommon(customChainParams, { hardfork: Hardfork.Byzantium, }) @@ -50,7 +49,6 @@ describe('[Common]: Custom chains', () => { // From custom chain params assert.equal(customChainCommon.chainName(), customChainParams.name) assert.equal(customChainCommon.chainId(), BigInt(customChainParams.chainId)) - assert.equal(customChainCommon.networkId(), BigInt(customChainParams.networkId)) // Fallback params from mainnet assert.equal(customChainCommon.genesis(), mainnetCommon.genesis()) @@ -63,12 +61,12 @@ describe('[Common]: Custom chains', () => { it('custom() -> behavior', () => { let common = createCustomCommon({ chainId: 123 }) - assert.deepEqual(common.networkId(), BigInt(1), 'should default to mainnet base chain') + assert.equal(common.consensusAlgorithm(), 'casper', 'should default to mainnet base chain') assert.equal(common.chainName(), 'custom-chain', 'should set default custom chain name') common = createCustomCommon(CustomChain.PolygonMumbai) assert.deepEqual( - common.networkId(), + common.chainId(), BigInt(80001), 'supported chain -> should initialize with correct chain ID' ) @@ -158,7 +156,6 @@ describe('[Common]: Custom chains', () => { const customChainParams: Partial = { name: 'custom', chainId: 123, - networkId: 678, depositContractAddress: '0x4242424242424242424242424242424242424242', } const customChainCommon = createCustomCommon(customChainParams, { diff --git a/packages/common/test/customCrypto.spec.ts b/packages/common/test/customCrypto.spec.ts index 0783026c84..7e5ae55f40 100644 --- a/packages/common/test/customCrypto.spec.ts +++ b/packages/common/test/customCrypto.spec.ts @@ -41,7 +41,7 @@ describe('[Common]: Custom Crypto', () => { msg = 'Should still work on a copied instance' assert.deepEqual(c.copy().customCrypto.keccak256!(value), new Uint8Array([2, 1]), msg) - const customChainParams = { name: 'custom', chainId: 123, networkId: 678 } + const customChainParams = { name: 'custom', chainId: 123 } c = createCustomCommon(customChainParams, { customCrypto }) msg = 'Should initialize with custom keccak256 function and use properly (custom() constructor)' assert.deepEqual(c.customCrypto.keccak256!(value), new Uint8Array([2, 1]), msg) diff --git a/packages/common/test/data/merge/testnetMerge.json b/packages/common/test/data/merge/testnetMerge.json index 995d7b1d2a..e6698fa6b3 100644 --- a/packages/common/test/data/merge/testnetMerge.json +++ b/packages/common/test/data/merge/testnetMerge.json @@ -1,7 +1,6 @@ { "name": "testnetMerge", "chainId": 55555, - "networkId": 55555, "defaultHardfork": "istanbul", "consensus": { "type": "poa", diff --git a/packages/common/test/data/merge/testnetPOS.json b/packages/common/test/data/merge/testnetPOS.json index 549193be0b..325c973033 100644 --- a/packages/common/test/data/merge/testnetPOS.json +++ b/packages/common/test/data/merge/testnetPOS.json @@ -1,7 +1,6 @@ { "name": "testnetPOS", "chainId": 66666, - "networkId": 66666, "defaultHardfork": "chainstart", "consensus": { "type": "pos", diff --git a/packages/common/test/data/testnet.json b/packages/common/test/data/testnet.json index 0c7531e072..88e4a72ab5 100644 --- a/packages/common/test/data/testnet.json +++ b/packages/common/test/data/testnet.json @@ -1,7 +1,6 @@ { "name": "testnet", "chainId": 12345, - "networkId": 12345, "defaultHardfork": "byzantium", "consensus": { "type": "pow", diff --git a/packages/common/test/data/testnet2.json b/packages/common/test/data/testnet2.json index ddbb57107a..a76bc09f7c 100644 --- a/packages/common/test/data/testnet2.json +++ b/packages/common/test/data/testnet2.json @@ -1,7 +1,6 @@ { "name": "testnet2", "chainId": 22222, - "networkId": 22222, "defaultHardfork": "istanbul", "consensus": { "type": "poa", diff --git a/packages/common/test/data/testnet3.json b/packages/common/test/data/testnet3.json index c8b59ac9f2..7a10962950 100644 --- a/packages/common/test/data/testnet3.json +++ b/packages/common/test/data/testnet3.json @@ -1,7 +1,6 @@ { "name": "testnet3", "chainId": 33333, - "networkId": 33333, "defaultHardfork": "istanbul", "consensus": { "type": "poa", diff --git a/packages/devp2p/src/protocol/eth.ts b/packages/devp2p/src/protocol/eth.ts index 4e4a6deeb1..c2dd7e0c92 100644 --- a/packages/devp2p/src/protocol/eth.ts +++ b/packages/devp2p/src/protocol/eth.ts @@ -203,13 +203,13 @@ export class ETH extends Protocol { ) const status: { - networkId: Uint8Array | Uint8Array[] + chainId: Uint8Array | Uint8Array[] td: Uint8Array bestHash: Uint8Array genesisHash: Uint8Array forkId?: Uint8Array | Uint8Array[] } = { - networkId: this._peerStatus[1], + chainId: this._peerStatus[1], td: this._peerStatus[2] as Uint8Array, bestHash: this._peerStatus[3] as Uint8Array, genesisHash: this._peerStatus[4] as Uint8Array, diff --git a/packages/devp2p/src/protocol/les.ts b/packages/devp2p/src/protocol/les.ts index 357c8d5c6d..a0950a7f17 100644 --- a/packages/devp2p/src/protocol/les.ts +++ b/packages/devp2p/src/protocol/les.ts @@ -127,8 +127,8 @@ export class LES extends Protocol { 'STATUS' ) assertEq( - this._status['networkId'], - this._peerStatus['networkId'], + this._status['chainId'], + this._peerStatus['chainId'], 'NetworkId mismatch', this.debug.bind(this), 'STATUS' @@ -153,7 +153,7 @@ export class LES extends Protocol { _getStatusString(status: LES.Status) { let sStr = `[V:${bytesToInt(status['protocolVersion'])}, ` - sStr += `NID:${bytesToInt(status['networkId'] as Uint8Array)}, HTD:${bytesToInt( + sStr += `NID:${bytesToInt(status['chainId'] as Uint8Array)}, HTD:${bytesToInt( status['headTd'] )}, ` sStr += `HeadH:${bytesToHex(status['headHash'])}, HeadN:${bytesToInt(status['headNum'])}, ` @@ -184,7 +184,7 @@ export class LES extends Protocol { status['announceType'] = intToBytes(DEFAULT_ANNOUNCE_TYPE) } status['protocolVersion'] = intToBytes(this._version) - status['networkId'] = bigIntToBytes(this._peer.common.chainId()) + status['chainId'] = bigIntToBytes(this._peer.common.chainId()) this._status = status @@ -284,7 +284,7 @@ export namespace LES { export interface Status { [key: string]: any protocolVersion: Uint8Array - networkId: Uint8Array + chainId: Uint8Array headTd: Uint8Array headHash: Uint8Array headNum: Uint8Array diff --git a/packages/tx/examples/custom-chain-tx.ts b/packages/tx/examples/custom-chain-tx.ts index b4f4c64a7c..8378dccf3a 100644 --- a/packages/tx/examples/custom-chain-tx.ts +++ b/packages/tx/examples/custom-chain-tx.ts @@ -6,12 +6,10 @@ import { hexToBytes } from '@ethereumjs/util' // In this example we create a transaction for a custom network. // This custom network has the same params as mainnet, -// except for name, chainId, and networkId, -// so we use the `Common.custom` method. +// except for name, chainId, so we use the `Common.custom` method. const customCommon = createCustomCommon( { name: 'my-network', - networkId: 123, chainId: 2134, }, { diff --git a/packages/tx/src/baseTransaction.ts b/packages/tx/src/baseTransaction.ts index 9f8c70f80d..2597dfa885 100644 --- a/packages/tx/src/baseTransaction.ts +++ b/packages/tx/src/baseTransaction.ts @@ -398,7 +398,6 @@ export abstract class BaseTransaction return createCustomCommon( { name: 'custom-chain', - networkId: chainIdBigInt, chainId: chainIdBigInt, }, { baseChain: this.DEFAULT_CHAIN } diff --git a/packages/vm/test/api/EIPs/eip-6800-verkle.spec.ts b/packages/vm/test/api/EIPs/eip-6800-verkle.spec.ts index 8e4213ada6..86792cce4a 100644 --- a/packages/vm/test/api/EIPs/eip-6800-verkle.spec.ts +++ b/packages/vm/test/api/EIPs/eip-6800-verkle.spec.ts @@ -13,7 +13,7 @@ import { VM } from '../../../src' import type { BlockData } from '@ethereumjs/block' import type { PrefixedHexString } from '@ethereumjs/util' -const customChainParams = { name: 'custom', chainId: 69420, networkId: 678 } +const customChainParams = { name: 'custom', chainId: 69420 } const common = createCustomCommon(customChainParams, { hardfork: Hardfork.Cancun, eips: [2935, 4895, 6800], diff --git a/packages/vm/test/api/index.spec.ts b/packages/vm/test/api/index.spec.ts index f35e792fe5..7d824395cf 100644 --- a/packages/vm/test/api/index.spec.ts +++ b/packages/vm/test/api/index.spec.ts @@ -182,7 +182,7 @@ describe('VM -> common (chain, HFs, EIPs)', () => { }) it('should accept a custom chain config (createCustomCommon() static constructor)', async () => { - const customChainParams = { name: 'custom', chainId: 123, networkId: 678 } + const customChainParams = { name: 'custom', chainId: 123 } const common = createCustomCommon(customChainParams, { baseChain: 'mainnet', hardfork: 'byzantium', diff --git a/packages/vm/test/api/runBlock.spec.ts b/packages/vm/test/api/runBlock.spec.ts index 78702db2ce..27b76b0a0a 100644 --- a/packages/vm/test/api/runBlock.spec.ts +++ b/packages/vm/test/api/runBlock.spec.ts @@ -139,7 +139,7 @@ describe('runBlock() -> successful API parameter usage', async () => { }) it('PoW block, Common custom chain (createCustomCommon() static constructor)', async () => { - const customChainParams = { name: 'custom', chainId: 123, networkId: 678 } + const customChainParams = { name: 'custom', chainId: 123 } const common = createCustomCommon(customChainParams, { baseChain: 'mainnet', hardfork: 'berlin', diff --git a/packages/vm/test/api/testdata/testnet.json b/packages/vm/test/api/testdata/testnet.json index b270831712..c503a09d32 100644 --- a/packages/vm/test/api/testdata/testnet.json +++ b/packages/vm/test/api/testdata/testnet.json @@ -1,7 +1,6 @@ { "name": "testnet", "chainId": 12345, - "networkId": 12345, "defaultHardfork": "byzantium", "consensus": { "type": "pow", diff --git a/packages/vm/test/api/testdata/testnet2.json b/packages/vm/test/api/testdata/testnet2.json index bbef65a16d..6d8db16448 100644 --- a/packages/vm/test/api/testdata/testnet2.json +++ b/packages/vm/test/api/testdata/testnet2.json @@ -1,7 +1,6 @@ { "name": "testnet2", "chainId": 22222, - "networkId": 22222, "defaultHardfork": "istanbul", "consensus": { "type": "pos", diff --git a/packages/vm/test/api/testdata/testnetMerge.json b/packages/vm/test/api/testdata/testnetMerge.json index 995d7b1d2a..e6698fa6b3 100644 --- a/packages/vm/test/api/testdata/testnetMerge.json +++ b/packages/vm/test/api/testdata/testnetMerge.json @@ -1,7 +1,6 @@ { "name": "testnetMerge", "chainId": 55555, - "networkId": 55555, "defaultHardfork": "istanbul", "consensus": { "type": "poa",