From e12ee2a0e1e8115e4b8ae21770341c2f296710f1 Mon Sep 17 00:00:00 2001 From: "nvrakeshreddy@bitgo.com" Date: Mon, 29 Jun 2026 13:08:44 +0000 Subject: [PATCH] feat(statics): add PolyxNetwork interface with v8SpecVersion and v8TxVersion Polymesh runtime v8 is live on testnet. This commit adds the infrastructure prerequisite fields to support the v8 migration: - Introduce PolyxNetwork interface extending AccountNetwork with Polymesh-specific fields: specName, genesisHash, specVersion, chainName, txVersion, v8SpecVersion, and v8TxVersion. - Update Polymesh (mainnet) and PolymeshTestnet classes to implement PolyxNetwork instead of plain AccountNetwork. - Set v8SpecVersion = 8000000 and v8TxVersion = 8 on both network classes to reflect the Polymesh v8 runtime version. - Add unit tests verifying v8 fields on both mainnet and testnet network instances. These fields are required by BASE-2 (v8 metadata/builders) and downstream services (indexer, wallet-platform, HSM parsing) that need to gate logic on the runtime version. Ticket: CECHO-1470 Session-Id: 45130683-1dd5-4330-af56-4edc9845062a Task-Id: 64b6fe5d-9398-4f7c-9331-e87d098b8d9e --- modules/statics/src/networks.ts | 20 ++++++++++++--- modules/statics/test/unit/networks.ts | 35 ++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/modules/statics/src/networks.ts b/modules/statics/src/networks.ts index 647d1f77be..c0d1f7c8d7 100644 --- a/modules/statics/src/networks.ts +++ b/modules/statics/src/networks.ts @@ -160,6 +160,16 @@ export interface DotNetwork extends AccountNetwork { readonly txVersion: number; } +export interface PolyxNetwork extends AccountNetwork { + readonly specName: SubstrateSpecNameType; + readonly genesisHash: string; + readonly specVersion: number; + readonly chainName: string; + readonly txVersion: number; + readonly v8SpecVersion: number; + readonly v8TxVersion: number; +} + export interface EthereumNetwork extends AccountNetwork { // unique chain id used for replay-protecting transactions readonly chainId: number; @@ -2444,18 +2454,20 @@ class BaseChain extends Mainnet implements EthereumNetwork { walletImplementationAddress = '0x92db2759d1dca129a0d9d46877f361be819184c4'; } -class Polymesh extends Mainnet implements AccountNetwork { +class Polymesh extends Mainnet implements PolyxNetwork { name = 'Polymesh'; family = CoinFamily.POLYX; explorerUrl = 'https://polymesh.subscan.io/extrinsic/'; - specName = 'polymesh_mainnet'; + specName = 'polymesh_mainnet' as SubstrateSpecNameType; genesisHash = '0x6fbd74e5e1d0a61d52ccfe9d4adaed16dd3a7caa37c6bc4d0c2fa12e8b2f4063'; specVersion = 7002000; chainName = 'Polymesh Mainnet'; txVersion = 7; + v8SpecVersion = 8000000; + v8TxVersion = 8; } -class PolymeshTestnet extends Testnet implements AccountNetwork { +class PolymeshTestnet extends Testnet implements PolyxNetwork { name = 'PolymeshTestnet'; family = CoinFamily.POLYX; explorerUrl = 'https://polymesh-testnet.subscan.io/extrinsic/'; @@ -2464,6 +2476,8 @@ class PolymeshTestnet extends Testnet implements AccountNetwork { specVersion = 7002000; chainName = 'Polymesh Testnet'; txVersion = 7; + v8SpecVersion = 8000000; + v8TxVersion = 8; } class Vet extends Mainnet implements EthereumNetwork { diff --git a/modules/statics/test/unit/networks.ts b/modules/statics/test/unit/networks.ts index c859bd45d5..99fe196a20 100644 --- a/modules/statics/test/unit/networks.ts +++ b/modules/statics/test/unit/networks.ts @@ -1,5 +1,13 @@ import 'should'; -import { AccountNetwork, BaseNetwork, DynamicNetwork, getNetwork, Networks, NetworkType } from '../../src/networks'; +import { + AccountNetwork, + BaseNetwork, + DynamicNetwork, + getNetwork, + Networks, + NetworkType, + PolyxNetwork, +} from '../../src/networks'; Object.entries(Networks).forEach(([category, networks]) => { Object.entries(networks).forEach(([networkName, network]) => { @@ -131,6 +139,31 @@ describe('Cosmos-family addressPrefix', function () { } }); +describe('Polymesh (POLYX) v8 network fields', function () { + it('mainnet has v8SpecVersion and v8TxVersion', function () { + const network: PolyxNetwork = Networks.main.polyx as PolyxNetwork; + network.should.have.property('v8SpecVersion', 8000000); + network.should.have.property('v8TxVersion', 8); + network.should.have.property('specVersion', 7002000); + network.should.have.property('txVersion', 7); + }); + + it('testnet has v8SpecVersion and v8TxVersion', function () { + const network: PolyxNetwork = Networks.test.polyx as PolyxNetwork; + network.should.have.property('v8SpecVersion', 8000000); + network.should.have.property('v8TxVersion', 8); + network.should.have.property('specVersion', 7002000); + network.should.have.property('txVersion', 7); + }); + + it('PolyxNetwork interface has required fields', function () { + const network: PolyxNetwork = Networks.main.polyx as PolyxNetwork; + network.should.have.property('specName', 'polymesh_mainnet'); + network.should.have.property('genesisHash'); + network.should.have.property('chainName', 'Polymesh Mainnet'); + }); +}); + describe('DynamicNetwork and getNetwork', function () { it('DynamicNetwork should be an instance of BaseNetwork', function () { const network = new DynamicNetwork({ name: 'TestDynNet', type: 'testnet', family: 'eth' });