@mixerx/config 0.5.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,27 +1,53 @@
1
1
  # @mixerx/config
2
2
 
3
- MixerX protocol config package.
4
-
5
- Supported network ids are exported from `SUPPORTED_NET_IDS`. Pool contracts live
6
- under `instances[chainId]`, and chain-level defaults live under
7
- `networkConfigByNetId[chainId]`.
3
+ Validated, immutable MixerX protocol config for Sepolia and a provisional Ethereum mainnet catalogue.
4
+
5
+ Supported network ids are exported from `SUPPORTED_NET_IDS`. Resolve data through
6
+ `getNetworkConfig(chainId)` and `getInstancesForNetId(chainId)` so unsupported
7
+ or prototype-derived keys fail closed. `instances` and `networkConfigByNetId`
8
+ remain exported for current consumers, but every exported object is frozen.
9
+
10
+ Mainnet (`1`) has its own immutable catalogue with provisional address and block values that currently match Sepolia
11
+ to allow backend configuration before the new MixerX contracts are deployed, as
12
+ agreed for the develop environment. These values do not describe a mainnet
13
+ deployment and do not provide on-chain readiness. Replace them with verified
14
+ mainnet addresses and deployment blocks when available.
15
+
16
+ A mainnet fork with chain ID `1` uses this same catalogue. Other chain IDs are
17
+ rejected; configure the actual node ID, never disguise mainnet as Sepolia.
18
+ Legacy Tornado Cash contracts and event layouts are not part of this catalogue.
19
+
20
+ The mainnet and Sepolia records are independently defined and maintained. This
21
+ package does not read environment variables or load an `.env` file: callers
22
+ select the catalogue explicitly by passing the network ID to the lookup APIs.
8
23
 
9
24
  ## Sepolia status
10
25
 
11
- Version `0.5.4` configures Sepolia (`11155111`) with the `sepolia_v5.4`
12
- generation: its deployed pools, router, registries, pool factories, relayer
26
+ The `sepolia_v5.4` catalogue generation configures Sepolia (`11155111`) with its
27
+ deployed pools, router, registries, pool factories, relayer
13
28
  aggregator, offchain oracle, and FDS token (`DSToken`).
14
29
 
15
- Custom pools that do not map to a fixed denomination use the string key
16
- `custom` in `instanceAddress`, producing pool ids like `eth-custom` or
17
- `fds-custom`.
30
+ The Sepolia ENS registry address is a MixerX deployment rather than the canonical
31
+ Ethereum ENS registry. It is retained because it is the registry used by the
32
+ deployed Phase 5 contracts.
33
+
34
+ The current Phase 5 deployment intentionally uses the FDS contract for both the
35
+ protocol token and wrapped stablecoin roles. Consumers must treat these as roles,
36
+ not as proof that two independent assets exist. A future deployment that separates
37
+ the assets must update both addresses and the contract tests together.
38
+
39
+ The catalogue exposes only the eight fixed-denomination pools currently enabled
40
+ in the Sepolia `InstanceRegistry`. Disabled custom-pool deployments are omitted
41
+ until their on-chain registry metadata and state are valid.
18
42
 
19
43
  Each currency declares `assetType` as `native` or `erc20`. ERC20 currencies also
20
- declare `tokenAddress`. Consumers derive pool kind from the denomination key:
21
- decimal keys are fixed pools and the `custom` key is a custom pool.
44
+ declare `tokenAddress`.
45
+ Use each currency's `denominations` array when order matters; JavaScript object-key
46
+ ordering is not a protocol ordering guarantee.
22
47
 
23
48
  ## Scripts
24
49
 
25
50
  - `yarn typecheck`
26
51
  - `yarn build`
27
52
  - `yarn check:shape`
53
+ - `yarn test` (build, shape validation and contract/regression tests)
@@ -1,34 +1,2 @@
1
- import type { Address, Instances, Mining, NetworkConfig, RewardSwap, TokenConfig, Torn, TornadoTrees, Vesting, Voucher } from './types.js';
2
- export declare function assertValidConfigShape(input: {
3
- torn: Torn;
4
- miningV2: Mining;
5
- vesting: Vesting;
6
- instances: Instances;
7
- voucher: Voucher;
8
- rewardSwap: RewardSwap;
9
- tornadoTrees: TornadoTrees;
10
- governance: Address;
11
- governanceImpl: Address;
12
- tornadoProxy: Address;
13
- tornadoProxyLight: Address;
14
- rewardVerifier: Address;
15
- treeUpdateVerifier: Address;
16
- withdrawVerifier: Address;
17
- poseidonHasher2: Address;
18
- poseidonHasher3: Address;
19
- feeManager: Address;
20
- tornadoStakingRewards: Address;
21
- relayerRegistry: Address;
22
- tornadoRouter: Address;
23
- instanceRegistry: Address;
24
- deployer: Address;
25
- relayerRegistryProxy: Address;
26
- aggregator: Address;
27
- offchainOracle: Address;
28
- governanceProxy: Address;
29
- tornadoProxyMainnet: Address;
30
- mixerxToken: TokenConfig;
31
- wrappedStablecoin: Address;
32
- networkConfigByNetId: Partial<Record<number, NetworkConfig>>;
33
- }): void;
34
- //# sourceMappingURL=assertions.d.ts.map
1
+ import { type MixerXConfig } from './types.js';
2
+ export declare function assertValidConfigShape(input: unknown): asserts input is MixerXConfig;
@@ -1,236 +1,238 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assertValidConfigShape = assertValidConfigShape;
4
- const DECIMAL_DENOMINATION_PATTERN = /^\d+(?:\.\d+)?$/;
5
- const isValidAssetType = (value) => {
6
- return value === 'native' || value === 'erc20';
7
- };
8
- const mainnetRequiredContracts = [
9
- 'relayerRegistryAddress',
10
- 'relayerRegistry',
4
+ const types_js_1 = require("./types.js");
5
+ const EVM_ADDRESS_PATTERN = /^0x[0-9a-fA-F]{40}$/u;
6
+ const ZERO_EVM_ADDRESS = '0x0000000000000000000000000000000000000000';
7
+ const DECIMAL_DENOMINATION_PATTERN = /^(?:0|[1-9]\d*)(?:\.\d+)?$/u;
8
+ const TOKEN_SYMBOL_PATTERN = /^[A-Za-z0-9._-]{1,16}$/u;
9
+ const MAX_TOKEN_DECIMALS = 36;
10
+ const CONTRACT_KEYS = [
11
11
  'aggregator',
12
- 'offchainOracleAddress',
13
- 'tornadoRouter',
14
- 'deployer',
15
- 'feeManager',
16
- 'governance',
17
- 'governanceImpl',
18
- 'governanceAddress',
19
- 'instanceRegistry',
20
- 'oldMixerXProxy',
21
- 'poseidonHasher2',
22
- 'poseidonHasher3',
23
- 'rewardSwap',
24
- 'rewardVerifier',
25
- 'tornadoProxy',
26
- 'tornadoProxyLight',
27
- 'tornadoStakingRewards',
28
- 'tornadoTrees',
29
- 'treeUpdateVerifier',
30
- 'voucher',
31
- 'withdrawVerifier',
32
- ];
33
- const sepoliaRequiredContracts = [
34
- 'fds',
35
- 'roles',
36
12
  'config',
37
- 'pauser',
38
- 'feeManager',
39
- 'instanceRegistry',
40
- 'ethPoolFactory',
41
13
  'erc20PoolFactory',
42
- 'relayerRegistryAddress',
43
- 'relayerRegistry',
44
- 'mixerXRouter',
45
- 'verifier',
14
+ 'ensRegistryAddress',
15
+ 'ethPoolFactory',
16
+ 'fds',
17
+ 'feeManager',
46
18
  'hasher',
47
19
  'huffVerifier',
48
- 'aggregator',
20
+ 'instanceRegistry',
21
+ 'mixerXRouter',
49
22
  'noteBackup',
50
- 'ensRegistryAddress',
51
23
  'offchainOracleAddress',
24
+ 'pauser',
25
+ 'relayerRegistry',
26
+ 'relayerRegistryAddress',
27
+ 'roles',
28
+ 'verifier',
52
29
  ];
53
- function assertString(value, key) {
54
- if (typeof value !== 'string' || value.length === 0) {
55
- throw new Error(`Missing ${key}`);
56
- }
57
- }
58
- function assertDeploymentBlock(value, key) {
59
- if (!Number.isInteger(value) || value <= 0) {
60
- throw new Error(`Missing deploymentBlock for ${key}`);
61
- }
62
- }
63
- function assertAddressLike(value, key) {
64
- assertString(value.address, `${key}.address`);
65
- }
66
- function assertToken(value, key) {
67
- assertString(value.address, `${key}.address`);
68
- assertString(value.symbol, `${key}.symbol`);
69
- if (!Number.isFinite(value.decimals) || !Number.isInteger(value.decimals) || value.decimals < 0) {
70
- throw new Error(`Invalid ${key}.decimals`);
71
- }
72
- }
73
- function assertTorn(value) {
74
- assertString(value.address, 'torn.address');
75
- assertString(value.capitalization, 'torn.capitalization');
76
- if (!Number.isFinite(value.pausePeriod) || value.pausePeriod <= 0) {
77
- throw new Error('Invalid torn.pausePeriod');
78
- }
79
- for (const key of ['airdrop', 'miningV2', 'governance', 'team1', 'team2', 'team3', 'team4', 'team5']) {
80
- assertString(value.distribution[key].to, `torn.distribution.${key}.to`);
81
- assertString(value.distribution[key].amount, `torn.distribution.${key}.amount`);
30
+ const CONTRACT_DEPLOYMENT_BLOCK_KEYS = [
31
+ 'erc20PoolFactoryDeploymentBlock',
32
+ 'ensRegistryDeploymentBlock',
33
+ 'ethPoolFactoryDeploymentBlock',
34
+ 'instanceRegistryDeploymentBlock',
35
+ 'relayerRegistryDeploymentBlock',
36
+ ];
37
+ const SUPPORTED_CONTRACT_KEYS = new Set([
38
+ ...CONTRACT_KEYS,
39
+ ...CONTRACT_DEPLOYMENT_BLOCK_KEYS,
40
+ ]);
41
+ function assertRecord(value, label) {
42
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
43
+ throw new Error(`${label} must be an object`);
82
44
  }
83
45
  }
84
- function assertMining(value) {
85
- assertString(value.address, 'miningV2.address');
86
- assertString(value.initialBalance, 'miningV2.initialBalance');
87
- if (!Array.isArray(value.rates) || value.rates.length === 0) {
88
- throw new Error('Invalid miningV2.rates');
46
+ function assertEvmAddress(value, label) {
47
+ if (typeof value !== 'string' || !EVM_ADDRESS_PATTERN.test(value)) {
48
+ throw new Error(`${label} must be a 20-byte EVM address`);
89
49
  }
90
- for (const [index, rate] of value.rates.entries()) {
91
- assertString(rate.instance, `miningV2.rates.${index}.instance`);
92
- assertString(rate.value, `miningV2.rates.${index}.value`);
50
+ if (value.toLowerCase() === ZERO_EVM_ADDRESS) {
51
+ throw new Error(`${label} must not be the zero address`);
93
52
  }
94
53
  }
95
- function assertVesting(value) {
96
- for (const key of ['team1', 'team2', 'team3', 'team4', 'team5', 'governance']) {
97
- const vestingInfo = value[key];
98
- assertString(vestingInfo.address, `vesting.${key}.address`);
99
- if (!Number.isFinite(vestingInfo.cliff) || !Number.isFinite(vestingInfo.duration)) {
100
- throw new Error(`Invalid vesting.${key} schedule`);
101
- }
54
+ function assertPositiveInteger(value, label) {
55
+ if (!Number.isSafeInteger(value) || value <= 0) {
56
+ throw new Error(`${label} must be a positive integer`);
102
57
  }
103
58
  }
104
- function assertVoucher(value) {
105
- assertString(value.address, 'voucher.address');
106
- if (!Number.isFinite(value.duration) || value.duration <= 0) {
107
- throw new Error('Invalid voucher.duration');
59
+ function assertDecimals(value, label) {
60
+ if (!Number.isInteger(value) || value < 0 || value > MAX_TOKEN_DECIMALS) {
61
+ throw new Error(`${label} must be an integer from 0 to ${MAX_TOKEN_DECIMALS}`);
108
62
  }
109
63
  }
110
- function assertRewardSwap(value) {
111
- assertString(value.address, 'rewardSwap.address');
112
- if (!Number.isFinite(value.poolWeight) || value.poolWeight <= 0) {
113
- throw new Error('Invalid rewardSwap.poolWeight');
64
+ function assertTokenSymbol(value, label) {
65
+ if (typeof value !== 'string' || !TOKEN_SYMBOL_PATTERN.test(value)) {
66
+ throw new Error(`${label} must be a 1 to 16 character token symbol`);
114
67
  }
115
68
  }
116
- function assertTornadoTrees(value) {
117
- assertString(value.address, 'tornadoTrees.address');
118
- if (!Number.isInteger(value.levels) || value.levels <= 0) {
119
- throw new Error('Invalid tornadoTrees.levels');
120
- }
69
+ function compareDecimalDenominations(left, right) {
70
+ const [leftInteger = '', leftFraction = ''] = left.split('.');
71
+ const [rightInteger = '', rightFraction = ''] = right.split('.');
72
+ if (leftInteger.length !== rightInteger.length) {
73
+ return leftInteger.length - rightInteger.length;
74
+ }
75
+ if (leftInteger !== rightInteger) {
76
+ return leftInteger < rightInteger ? -1 : 1;
77
+ }
78
+ const fractionLength = Math.max(leftFraction.length, rightFraction.length);
79
+ const normalizedLeftFraction = leftFraction.padEnd(fractionLength, '0');
80
+ const normalizedRightFraction = rightFraction.padEnd(fractionLength, '0');
81
+ if (normalizedLeftFraction === normalizedRightFraction) {
82
+ return 0;
83
+ }
84
+ return normalizedLeftFraction < normalizedRightFraction ? -1 : 1;
121
85
  }
122
- function assertCurrency(network, key, value) {
123
- if (!value.symbol || !Number.isFinite(value.decimals)) {
124
- throw new Error(`Invalid currency metadata for instances.${network}.${key}`);
125
- }
126
- if (!value.instanceAddress || Object.keys(value.instanceAddress).length === 0) {
127
- throw new Error(`Invalid instanceAddress for instances.${network}.${key}`);
128
- }
129
- if (!isValidAssetType(value.assetType)) {
130
- throw new Error(`Invalid assetType for instances.${network}.${key}`);
131
- }
132
- if (value.assetType === 'erc20') {
133
- assertString(value.tokenAddress, `instances.${network}.${key}.tokenAddress`);
134
- }
135
- if (value.assetType === 'native' && 'tokenAddress' in value) {
136
- throw new Error(`Native currency cannot define tokenAddress for instances.${network}.${key}`);
137
- }
138
- for (const [denomination, address] of Object.entries(value.instanceAddress)) {
139
- assertString(address, `instances.${network}.${key}.instanceAddress.${denomination}`);
140
- if (network === '11155111') {
141
- assertDeploymentBlock(value.deploymentBlock?.[denomination], `instances.${network}.${key}.deploymentBlock.${denomination}`);
142
- }
86
+ function assertCurrency(currency, label, poolAddresses) {
87
+ assertRecord(currency, label);
88
+ if (currency.assetType !== 'native' && currency.assetType !== 'erc20') {
89
+ throw new Error(`${label}.assetType must be native or erc20`);
90
+ }
91
+ assertTokenSymbol(currency.symbol, `${label}.symbol`);
92
+ assertDecimals(currency.decimals, `${label}.decimals`);
93
+ if (!Array.isArray(currency.denominations) || currency.denominations.length === 0) {
94
+ throw new Error(`${label}.denominations must be a non-empty array`);
95
+ }
96
+ assertRecord(currency.instanceAddress, `${label}.instanceAddress`);
97
+ assertRecord(currency.deploymentBlock, `${label}.deploymentBlock`);
98
+ const pools = Object.entries(currency.instanceAddress);
99
+ if (pools.length === 0) {
100
+ throw new Error(`${label} must define at least one pool`);
101
+ }
102
+ if (currency.assetType === 'erc20') {
103
+ assertEvmAddress(currency.tokenAddress, `${label}.tokenAddress`);
104
+ }
105
+ else if ('tokenAddress' in currency) {
106
+ throw new Error(`${label} native currency cannot define tokenAddress`);
107
+ }
108
+ const denominationKeys = new Set(pools.map(([denomination]) => denomination));
109
+ if (new Set(currency.denominations).size !== currency.denominations.length ||
110
+ currency.denominations.some((denomination) => !denominationKeys.has(denomination)) ||
111
+ currency.denominations.length !== denominationKeys.size) {
112
+ throw new Error(`${label}.denominations must list each configured pool exactly once`);
113
+ }
114
+ for (const [denomination, address] of pools) {
143
115
  if (denomination !== 'custom' && !DECIMAL_DENOMINATION_PATTERN.test(denomination)) {
144
- throw new Error(`Invalid pool denomination for instances.${network}.${key}.${denomination}`);
116
+ throw new Error(`${label}.${denomination} is not a valid denomination`);
117
+ }
118
+ assertEvmAddress(address, `${label}.instanceAddress.${denomination}`);
119
+ const normalized = address.toLowerCase();
120
+ if (poolAddresses.has(normalized)) {
121
+ throw new Error(`Duplicate pool address ${address}`);
145
122
  }
123
+ poolAddresses.add(normalized);
124
+ assertPositiveInteger(currency.deploymentBlock[denomination], `${label}.deploymentBlock.${denomination}`);
146
125
  }
147
- }
148
- function assertInstances(instances) {
149
- const networks = Object.entries(instances);
150
- if (networks.length === 0) {
151
- throw new Error('Instances config is empty');
152
- }
153
- for (const [network, currencies] of networks) {
154
- const entries = Object.entries(currencies ?? {});
155
- if (entries.length === 0) {
156
- throw new Error(`Network ${network} has no currencies`);
126
+ const expectedOrder = [...denominationKeys].sort((left, right) => {
127
+ if (left === 'custom') {
128
+ return 1;
157
129
  }
158
- for (const [currency, config] of entries) {
159
- assertCurrency(network, currency, config);
130
+ if (right === 'custom') {
131
+ return -1;
160
132
  }
133
+ return compareDecimalDenominations(left, right);
134
+ });
135
+ if (currency.denominations.some((denomination, index) => denomination !== expectedOrder[index])) {
136
+ throw new Error(`${label}.denominations must be in ascending numeric order with custom last`);
161
137
  }
162
138
  }
163
- function assertCompleteNetworkConfig(network, value, requiredContracts) {
164
- if (!value || typeof value !== 'object' || !('contracts' in value) || !value.contracts) {
165
- throw new Error(`Invalid ${network} config: missing contracts`);
166
- }
167
- if (!('tokens' in value) || !value.tokens) {
168
- throw new Error(`Invalid ${network} config: missing tokens`);
169
- }
170
- const { contracts, tokens } = value;
171
- for (const contractKey of requiredContracts) {
172
- assertString(contracts[contractKey], `${network}.contracts.${String(contractKey)}`);
173
- }
174
- if (network === 'sepolia') {
175
- assertDeploymentBlock(contracts.relayerRegistryDeploymentBlock, `${network}.contracts.relayerRegistryDeploymentBlock`);
176
- assertDeploymentBlock(contracts.instanceRegistryDeploymentBlock, `${network}.contracts.instanceRegistryDeploymentBlock`);
177
- assertDeploymentBlock(contracts.ethPoolFactoryDeploymentBlock, `${network}.contracts.ethPoolFactoryDeploymentBlock`);
178
- assertDeploymentBlock(contracts.erc20PoolFactoryDeploymentBlock, `${network}.contracts.erc20PoolFactoryDeploymentBlock`);
179
- assertDeploymentBlock(contracts.ensRegistryDeploymentBlock, `${network}.contracts.ensRegistryDeploymentBlock`);
180
- }
181
- if (!tokens.mixerXTokenAddress ||
182
- !tokens.mixerXTokenSymbol ||
183
- !Number.isFinite(tokens.mixerXTokenDecimals) ||
184
- !tokens.wrappedStablecoinAddress) {
185
- throw new Error(`Invalid ${network} tokens config`);
186
- }
139
+ function assertNetwork(network, poolAddresses, netId) {
140
+ const label = netId === types_js_1.SEPOLIA_NET_ID ? 'sepolia' : `network ${netId}`;
141
+ const name = netId === types_js_1.SEPOLIA_NET_ID ? 'Sepolia' : `Network ${netId}`;
142
+ assertRecord(network, `networkConfigByNetId.${netId}`);
143
+ assertRecord(network.contracts, `networkConfigByNetId.${netId}.contracts`);
144
+ assertRecord(network.tokens, `networkConfigByNetId.${netId}.tokens`);
145
+ const unknownContractKey = Object.keys(network.contracts).find((key) => !SUPPORTED_CONTRACT_KEYS.has(key));
146
+ if (unknownContractKey) {
147
+ throw new Error(`${label}.contracts contains unsupported key ${unknownContractKey}`);
148
+ }
149
+ for (const key of CONTRACT_KEYS) {
150
+ assertEvmAddress(network.contracts[key], `${label}.contracts.${key}`);
151
+ }
152
+ const contractAddressRoles = new Map();
153
+ for (const key of CONTRACT_KEYS) {
154
+ if (key === 'relayerRegistryAddress') {
155
+ continue;
156
+ }
157
+ const contractAddress = network.contracts[key];
158
+ assertEvmAddress(contractAddress, `${label}.contracts.${key}`);
159
+ const normalizedAddress = contractAddress.toLowerCase();
160
+ const existingRole = contractAddressRoles.get(normalizedAddress);
161
+ if (existingRole) {
162
+ throw new Error(`${name} contract roles ${key} and ${existingRole} must not share an address`);
163
+ }
164
+ if (poolAddresses.has(normalizedAddress)) {
165
+ if (key === 'mixerXRouter') {
166
+ throw new Error(`${name} router address must not equal a pool address`);
167
+ }
168
+ throw new Error(`${name} contract ${key} address must not equal a pool address`);
169
+ }
170
+ contractAddressRoles.set(normalizedAddress, key);
171
+ }
172
+ assertPositiveInteger(network.contracts.relayerRegistryDeploymentBlock, `${label}.contracts.relayerRegistryDeploymentBlock`);
173
+ assertPositiveInteger(network.contracts.ensRegistryDeploymentBlock, `${label}.contracts.ensRegistryDeploymentBlock`);
174
+ assertPositiveInteger(network.contracts.instanceRegistryDeploymentBlock, `${label}.contracts.instanceRegistryDeploymentBlock`);
175
+ assertPositiveInteger(network.contracts.ethPoolFactoryDeploymentBlock, `${label}.contracts.ethPoolFactoryDeploymentBlock`);
176
+ assertPositiveInteger(network.contracts.erc20PoolFactoryDeploymentBlock, `${label}.contracts.erc20PoolFactoryDeploymentBlock`);
177
+ if (String(network.contracts.relayerRegistry).toLowerCase() !==
178
+ String(network.contracts.relayerRegistryAddress).toLowerCase()) {
179
+ throw new Error(`${name} relayer registry aliases must resolve to the same address`);
180
+ }
181
+ const routerAddress = network.contracts.mixerXRouter;
182
+ assertEvmAddress(routerAddress, `${label}.contracts.mixerXRouter`);
183
+ assertEvmAddress(network.tokens.mixerXTokenAddress, `${label}.tokens.mixerXTokenAddress`);
184
+ assertEvmAddress(network.tokens.wrappedStablecoinAddress, `${label}.tokens.wrappedStablecoinAddress`);
185
+ assertTokenSymbol(network.tokens.mixerXTokenSymbol, `${label}.tokens.mixerXTokenSymbol`);
186
+ assertDecimals(network.tokens.mixerXTokenDecimals, `${label}.tokens.mixerXTokenDecimals`);
187
187
  }
188
- function assertNetworkConfig(value) {
189
- const mainnetConfig = value[1];
190
- if (!mainnetConfig) {
191
- throw new Error('Missing networkConfigByNetId.1');
188
+ function assertFdsTokenAliases(network, currencies, netId) {
189
+ const name = netId === types_js_1.SEPOLIA_NET_ID ? 'Sepolia' : `Network ${netId}`;
190
+ const fdsCurrency = currencies.fds;
191
+ assertRecord(fdsCurrency, `instances.${netId}.fds`);
192
+ assertEvmAddress(fdsCurrency.tokenAddress, `instances.${netId}.fds.tokenAddress`);
193
+ const addresses = [
194
+ network.contracts.fds,
195
+ network.tokens.mixerXTokenAddress,
196
+ network.tokens.wrappedStablecoinAddress,
197
+ fdsCurrency.tokenAddress,
198
+ ];
199
+ if (new Set(addresses.map((address) => address.toLowerCase())).size !== 1) {
200
+ throw new Error(`${name} FDS address aliases must resolve to the same address`);
201
+ }
202
+ if (fdsCurrency.symbol !== network.tokens.mixerXTokenSymbol ||
203
+ fdsCurrency.decimals !== network.tokens.mixerXTokenDecimals) {
204
+ throw new Error(`${name} FDS symbol and decimals aliases must match`);
192
205
  }
193
- const sepoliaConfig = value[11155111];
194
- if (!sepoliaConfig) {
195
- throw new Error('Missing networkConfigByNetId.11155111');
196
- }
197
- assertCompleteNetworkConfig('mainnet', mainnetConfig, mainnetRequiredContracts);
198
- assertCompleteNetworkConfig('sepolia', sepoliaConfig, sepoliaRequiredContracts);
199
206
  }
200
207
  function assertValidConfigShape(input) {
201
- assertTorn(input.torn);
202
- assertMining(input.miningV2);
203
- assertVesting(input.vesting);
204
- assertInstances(input.instances);
205
- assertVoucher(input.voucher);
206
- assertRewardSwap(input.rewardSwap);
207
- assertTornadoTrees(input.tornadoTrees);
208
- for (const [key, value] of [
209
- ['governance', input.governance],
210
- ['governanceImpl', input.governanceImpl],
211
- ['tornadoProxy', input.tornadoProxy],
212
- ['tornadoProxyLight', input.tornadoProxyLight],
213
- ['rewardVerifier', input.rewardVerifier],
214
- ['treeUpdateVerifier', input.treeUpdateVerifier],
215
- ['withdrawVerifier', input.withdrawVerifier],
216
- ['poseidonHasher2', input.poseidonHasher2],
217
- ['poseidonHasher3', input.poseidonHasher3],
218
- ['feeManager', input.feeManager],
219
- ['tornadoStakingRewards', input.tornadoStakingRewards],
220
- ['relayerRegistry', input.relayerRegistry],
221
- ['tornadoRouter', input.tornadoRouter],
222
- ['instanceRegistry', input.instanceRegistry],
223
- ['deployer', input.deployer],
224
- ['relayerRegistryProxy', input.relayerRegistryProxy],
225
- ['aggregator', input.aggregator],
226
- ['offchainOracle', input.offchainOracle],
227
- ['governanceProxy', input.governanceProxy],
228
- ['tornadoProxyMainnet', input.tornadoProxyMainnet],
229
- ['wrappedStablecoin', input.wrappedStablecoin],
208
+ assertRecord(input, 'config');
209
+ assertRecord(input.instances, 'instances');
210
+ assertRecord(input.networkConfigByNetId, 'networkConfigByNetId');
211
+ const expectedNetIds = types_js_1.SUPPORTED_NET_IDS.map(String);
212
+ for (const [label, catalogue] of [
213
+ ['networkConfigByNetId', input.networkConfigByNetId],
214
+ ['instances', input.instances],
230
215
  ]) {
231
- assertAddressLike(value, key);
216
+ const configuredNetIds = Object.keys(catalogue);
217
+ if (configuredNetIds.length !== expectedNetIds.length ||
218
+ configuredNetIds.some((netId) => !expectedNetIds.includes(netId))) {
219
+ throw new Error(`${label} must configure exactly networks ${expectedNetIds.join(', ')}`);
220
+ }
221
+ }
222
+ for (const netId of types_js_1.SUPPORTED_NET_IDS) {
223
+ const currencies = input.instances[netId];
224
+ assertRecord(currencies, `instances.${netId}`);
225
+ const currencyEntries = Object.entries(currencies);
226
+ if (currencyEntries.length === 0) {
227
+ throw new Error(`instances.${netId} must define at least one currency`);
228
+ }
229
+ const poolAddresses = new Set();
230
+ for (const [currencyName, currency] of currencyEntries) {
231
+ assertCurrency(currency, `instances.${netId}.${currencyName}`, poolAddresses);
232
+ }
233
+ const network = input.networkConfigByNetId[netId];
234
+ assertNetwork(network, poolAddresses, netId);
235
+ assertFdsTokenAliases(network, currencies, netId);
232
236
  }
233
- assertToken(input.mixerxToken, 'mixerxToken');
234
- assertNetworkConfig(input.networkConfigByNetId);
235
237
  }
236
238
  //# sourceMappingURL=assertions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"assertions.js","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":";;AA4PA,wDAoEC;AAjTD,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;AAEvD,MAAM,g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\nconst EVM_ADDRESS_PATTERN = /^0x[0-9a-fA-F]{40}$/u;\nconst ZERO_EVM_ADDRESS = '0x0000000000000000000000000000000000000000';\nconst DECIMAL_DENOMINATION_PATTERN = /^(?:0|[1-9]\\d*)(?:\\.\\d+)?$/u;\nconst TOKEN_SYMBOL_PATTERN = /^[A-Za-z0-9._-]{1,16}$/u;\nconst MAX_TOKEN_DECIMALS = 36;\nconst CONTRACT_KEYS = [\n 'aggregator',\n 'config',\n 'erc20PoolFactory',\n 'ensRegistryAddress',\n 'ethPoolFactory',\n 'fds',\n 'feeManager',\n 'hasher',\n 'huffVerifier',\n 'instanceRegistry',\n 'mixerXRouter',\n 'noteBackup',\n 'offchainOracleAddress',\n 'pauser',\n 'relayerRegistry',\n 'relayerRegistryAddress',\n 'roles',\n 'verifier',\n] as const satisfies readonly (keyof NetworkContractsConfig)[];\nconst CONTRACT_DEPLOYMENT_BLOCK_KEYS = [\n 'erc20PoolFactoryDeploymentBlock',\n 'ensRegistryDeploymentBlock',\n 'ethPoolFactoryDeploymentBlock',\n 'instanceRegistryDeploymentBlock',\n 'relayerRegistryDeploymentBlock',\n] as const satisfies readonly (keyof NetworkContractsConfig)[];\nconst SUPPORTED_CONTRACT_KEYS = new Set<string>([\n ...CONTRACT_KEYS,\n ...CONTRACT_DEPLOYMENT_BLOCK_KEYS,\n]);\n\nfunction assertRecord(value: unknown, label: string): asserts value is Record<string, unknown> {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new Error(`${label} must be an object`);\n }\n}\n\nfunction assertEvmAddress(value: unknown, label: string): asserts value is `0x${string}` {\n if (typeof value !== 'string' || !EVM_ADDRESS_PATTERN.test(value)) {\n throw new Error(`${label} must be a 20-byte EVM address`);\n }\n if (value.toLowerCase() === ZERO_EVM_ADDRESS) {\n throw new Error(`${label} must not be the zero address`);\n }\n}\n\nfunction assertPositiveInteger(value: unknown, label: string): asserts value is number {\n if (!Number.isSafeInteger(value) || (value as number) <= 0) {\n throw new Error(`${label} must be a positive integer`);\n }\n}\n\nfunction assertDecimals(value: unknown, label: string): asserts value is number {\n if (!Number.isInteger(value) || (value as number) < 0 || (value as number) > MAX_TOKEN_DECIMALS) {\n throw new Error(`${label} must be an integer from 0 to ${MAX_TOKEN_DECIMALS}`);\n }\n}\n\nfunction assertTokenSymbol(value: unknown, label: string): asserts value is string {\n if (typeof value !== 'string' || !TOKEN_SYMBOL_PATTERN.test(value)) {\n throw new Error(`${label} must be a 1 to 16 character token symbol`);\n }\n}\n\nfunction compareDecimalDenominations(left: string, right: string): number {\n const [leftInteger = '', leftFraction = ''] = left.split('.');\n const [rightInteger = '', rightFraction = ''] = right.split('.');\n if (leftInteger.length !== rightInteger.length) {\n return leftInteger.length - rightInteger.length;\n }\n if (leftInteger !== rightInteger) {\n return leftInteger < rightInteger ? -1 : 1;\n }\n\n const fractionLength = Math.max(leftFraction.length, rightFraction.length);\n const normalizedLeftFraction = leftFraction.padEnd(fractionLength, '0');\n const normalizedRightFraction = rightFraction.padEnd(fractionLength, '0');\n if (normalizedLeftFraction === normalizedRightFraction) {\n return 0;\n }\n return normalizedLeftFraction < normalizedRightFraction ? -1 : 1;\n}\n\nfunction assertCurrency(\n currency: unknown,\n label: string,\n poolAddresses: Set<string>,\n): asserts currency is InstanceCurrency {\n assertRecord(currency, label);\n if (currency.assetType !== 'native' && currency.assetType !== 'erc20') {\n throw new Error(`${label}.assetType must be native or erc20`);\n }\n assertTokenSymbol(currency.symbol, `${label}.symbol`);\n assertDecimals(currency.decimals, `${label}.decimals`);\n if (!Array.isArray(currency.denominations) || currency.denominations.length === 0) {\n throw new Error(`${label}.denominations must be a non-empty array`);\n }\n assertRecord(currency.instanceAddress, `${label}.instanceAddress`);\n assertRecord(currency.deploymentBlock, `${label}.deploymentBlock`);\n const pools = Object.entries(currency.instanceAddress);\n if (pools.length === 0) {\n throw new Error(`${label} must define at least one pool`);\n }\n if (currency.assetType === 'erc20') {\n assertEvmAddress(currency.tokenAddress, `${label}.tokenAddress`);\n } else if ('tokenAddress' in currency) {\n throw new Error(`${label} native currency cannot define tokenAddress`);\n }\n\n const denominationKeys = new Set(pools.map(([denomination]) => denomination));\n if (\n new Set(currency.denominations).size !== currency.denominations.length ||\n currency.denominations.some((denomination) => !denominationKeys.has(denomination)) ||\n currency.denominations.length !== denominationKeys.size\n ) {\n throw new Error(`${label}.denominations must list each configured pool exactly once`);\n }\n\n for (const [denomination, address] of pools) {\n if (denomination !== 'custom' && !DECIMAL_DENOMINATION_PATTERN.test(denomination)) {\n throw new Error(`${label}.${denomination} is not a valid denomination`);\n }\n assertEvmAddress(address, `${label}.instanceAddress.${denomination}`);\n const normalized = address.toLowerCase();\n if (poolAddresses.has(normalized)) {\n throw new Error(`Duplicate pool address ${address}`);\n }\n poolAddresses.add(normalized);\n assertPositiveInteger(\n currency.deploymentBlock[denomination],\n `${label}.deploymentBlock.${denomination}`,\n );\n }\n\n const expectedOrder = [...denominationKeys].sort((left, right) => {\n if (left === 'custom') {\n return 1;\n }\n if (right === 'custom') {\n return -1;\n }\n return compareDecimalDenominations(left, right);\n });\n if (currency.denominations.some((denomination, index) => denomination !== expectedOrder[index])) {\n throw new Error(`${label}.denominations must be in ascending numeric order with custom last`);\n }\n}\n\nfunction assertNetwork(\n network: unknown,\n poolAddresses: Set<string>,\n netId: number,\n): asserts network is NetworkConfig {\n const label = netId === SEPOLIA_NET_ID ? 'sepolia' : `network ${netId}`;\n const name = netId === SEPOLIA_NET_ID ? 'Sepolia' : `Network ${netId}`;\n assertRecord(network, `networkConfigByNetId.${netId}`);\n assertRecord(network.contracts, `networkConfigByNetId.${netId}.contracts`);\n assertRecord(network.tokens, `networkConfigByNetId.${netId}.tokens`);\n const unknownContractKey = Object.keys(network.contracts).find(\n (key) => !SUPPORTED_CONTRACT_KEYS.has(key),\n );\n if (unknownContractKey) {\n throw new Error(`${label}.contracts contains unsupported key ${unknownContractKey}`);\n }\n for (const key of CONTRACT_KEYS) {\n assertEvmAddress(network.contracts[key], `${label}.contracts.${key}`);\n }\n const contractAddressRoles = new Map<string, string>();\n for (const key of CONTRACT_KEYS) {\n if (key === 'relayerRegistryAddress') {\n continue;\n }\n const contractAddress = network.contracts[key];\n assertEvmAddress(contractAddress, `${label}.contracts.${key}`);\n const normalizedAddress = contractAddress.toLowerCase();\n const existingRole = contractAddressRoles.get(normalizedAddress);\n if (existingRole) {\n throw new Error(`${name} contract roles ${key} and ${existingRole} must not share an address`);\n }\n if (poolAddresses.has(normalizedAddress)) {\n if (key === 'mixerXRouter') {\n throw new Error(`${name} router address must not equal a pool address`);\n }\n throw new Error(`${name} contract ${key} address must not equal a pool address`);\n }\n contractAddressRoles.set(normalizedAddress, key);\n }\n assertPositiveInteger(\n network.contracts.relayerRegistryDeploymentBlock,\n `${label}.contracts.relayerRegistryDeploymentBlock`,\n );\n assertPositiveInteger(\n network.contracts.ensRegistryDeploymentBlock,\n `${label}.contracts.ensRegistryDeploymentBlock`,\n );\n assertPositiveInteger(\n network.contracts.instanceRegistryDeploymentBlock,\n `${label}.contracts.instanceRegistryDeploymentBlock`,\n );\n assertPositiveInteger(\n network.contracts.ethPoolFactoryDeploymentBlock,\n `${label}.contracts.ethPoolFactoryDeploymentBlock`,\n );\n assertPositiveInteger(\n network.contracts.erc20PoolFactoryDeploymentBlock,\n `${label}.contracts.erc20PoolFactoryDeploymentBlock`,\n );\n if (\n String(network.contracts.relayerRegistry).toLowerCase() !==\n String(network.contracts.relayerRegistryAddress).toLowerCase()\n ) {\n throw new Error(`${name} relayer registry aliases must resolve to the same address`);\n }\n const routerAddress = network.contracts.mixerXRouter;\n assertEvmAddress(routerAddress, `${label}.contracts.mixerXRouter`);\n assertEvmAddress(network.tokens.mixerXTokenAddress, `${label}.tokens.mixerXTokenAddress`);\n assertEvmAddress(\n network.tokens.wrappedStablecoinAddress,\n `${label}.tokens.wrappedStablecoinAddress`,\n );\n assertTokenSymbol(network.tokens.mixerXTokenSymbol, `${label}.tokens.mixerXTokenSymbol`);\n assertDecimals(network.tokens.mixerXTokenDecimals, `${label}.tokens.mixerXTokenDecimals`);\n}\n\nfunction assertFdsTokenAliases(\n network: NetworkConfig,\n currencies: Record<string, unknown>,\n netId: number,\n): void {\n const name = netId === SEPOLIA_NET_ID ? 'Sepolia' : `Network ${netId}`;\n const fdsCurrency = currencies.fds;\n assertRecord(fdsCurrency, `instances.${netId}.fds`);\n assertEvmAddress(fdsCurrency.tokenAddress, `instances.${netId}.fds.tokenAddress`);\n\n const addresses = [\n network.contracts.fds,\n network.tokens.mixerXTokenAddress,\n network.tokens.wrappedStablecoinAddress,\n fdsCurrency.tokenAddress,\n ];\n if (new Set(addresses.map((address) => address.toLowerCase())).size !== 1) {\n throw new Error(`${name} FDS address aliases must resolve to the same address`);\n }\n if (\n fdsCurrency.symbol !== network.tokens.mixerXTokenSymbol ||\n fdsCurrency.decimals !== network.tokens.mixerXTokenDecimals\n ) {\n throw new Error(`${name} FDS symbol and decimals aliases must match`);\n }\n}\n\nexport function assertValidConfigShape(input: unknown): asserts input is MixerXConfig {\n assertRecord(input, 'config');\n assertRecord(input.instances, 'instances');\n assertRecord(input.networkConfigByNetId, 'networkConfigByNetId');\n\n const expectedNetIds = SUPPORTED_NET_IDS.map(String);\n for (const [label, catalogue] of [\n ['networkConfigByNetId', input.networkConfigByNetId],\n ['instances', input.instances],\n ] as const) {\n const configuredNetIds = Object.keys(catalogue);\n if (\n configuredNetIds.length !== expectedNetIds.length ||\n configuredNetIds.some((netId) => !expectedNetIds.includes(netId))\n ) {\n throw new Error(`${label} must configure exactly networks ${expectedNetIds.join(', ')}`);\n }\n }\n for (const netId of SUPPORTED_NET_IDS) {\n const currencies = input.instances[netId];\n assertRecord(currencies, `instances.${netId}`);\n const currencyEntries = Object.entries(currencies);\n if (currencyEntries.length === 0) {\n throw new Error(`instances.${netId} must define at least one currency`);\n }\n const poolAddresses = new Set<string>();\n for (const [currencyName, currency] of currencyEntries) {\n assertCurrency(currency, `instances.${netId}.${currencyName}`, poolAddresses);\n }\n const network = input.networkConfigByNetId[netId];\n assertNetwork(network, poolAddresses, netId);\n assertFdsTokenAliases(network, currencies, netId);\n }\n}\n"]}
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=check-shape.d.ts.map
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  const assertions_js_1 = require("./assertions.js");
7
- const config_js_1 = __importDefault(require("./config.js"));
4
+ const config_js_1 = require("./config.js");
8
5
  try {
9
- (0, assertions_js_1.assertValidConfigShape)(config_js_1.default);
6
+ (0, assertions_js_1.assertValidConfigShape)(config_js_1.config);
10
7
  }
11
8
  catch (error) {
12
9
  const message = error instanceof Error ? error.message : String(error);