@aztec/ethereum 0.0.1-commit.d3ec352c → 0.0.1-commit.d58ff9d0
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/dest/client.d.ts +25 -3
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +60 -4
- package/dest/config.d.ts +45 -73
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +114 -386
- package/dest/contracts/chain_state_override.d.ts +78 -0
- package/dest/contracts/chain_state_override.d.ts.map +1 -0
- package/dest/contracts/chain_state_override.js +137 -0
- package/dest/contracts/empire_base.d.ts +2 -1
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.d.ts +6 -5
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.js +11 -9
- package/dest/contracts/fee_asset_price_oracle.d.ts +105 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
- package/dest/contracts/fee_asset_price_oracle.js +656 -0
- package/dest/contracts/governance.d.ts +110 -33
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +207 -16
- package/dest/contracts/governance_proposer.d.ts +34 -1
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +447 -10
- package/dest/contracts/gse.d.ts +4 -2
- package/dest/contracts/gse.d.ts.map +1 -1
- package/dest/contracts/gse.js +2 -2
- package/dest/contracts/inbox.d.ts +24 -3
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +42 -2
- package/dest/contracts/index.d.ts +6 -3
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +5 -2
- package/dest/contracts/log.d.ts +13 -0
- package/dest/contracts/log.d.ts.map +1 -0
- package/dest/contracts/log.js +1 -0
- package/dest/contracts/multicall.d.ts +130 -13
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +203 -93
- package/dest/contracts/outbox.d.ts +64 -0
- package/dest/contracts/outbox.d.ts.map +1 -0
- package/dest/contracts/outbox.js +113 -0
- package/dest/contracts/registry.d.ts +3 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/registry.js +30 -1
- package/dest/contracts/rollup.d.ts +5571 -102
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +1076 -192
- package/dest/contracts/{tally_slashing_proposer.d.ts → slashing_proposer.d.ts} +5 -5
- package/dest/contracts/slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/{tally_slashing_proposer.js → slashing_proposer.js} +18 -13
- package/dest/deploy_aztec_l1_contracts.d.ts +267 -0
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
- package/dest/deploy_aztec_l1_contracts.js +424 -0
- package/dest/deploy_l1_contract.d.ts +68 -0
- package/dest/deploy_l1_contract.d.ts.map +1 -0
- package/dest/deploy_l1_contract.js +312 -0
- package/dest/forwarder_proxy.d.ts +32 -0
- package/dest/forwarder_proxy.d.ts.map +1 -0
- package/dest/forwarder_proxy.js +93 -0
- package/dest/foundry_binary.d.ts +13 -0
- package/dest/foundry_binary.d.ts.map +1 -0
- package/dest/foundry_binary.js +52 -0
- package/dest/l1_artifacts.d.ts +19674 -16606
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +9 -24
- package/dest/l1_contract_addresses.d.ts +61 -65
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +99 -80
- package/dest/l1_reader.d.ts +7 -5
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +15 -7
- package/dest/l1_tx_utils/config.d.ts +9 -3
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +34 -7
- package/dest/l1_tx_utils/constants.d.ts +8 -2
- package/dest/l1_tx_utils/constants.d.ts.map +1 -1
- package/dest/l1_tx_utils/constants.js +27 -2
- package/dest/l1_tx_utils/factory.d.ts +18 -10
- package/dest/l1_tx_utils/factory.d.ts.map +1 -1
- package/dest/l1_tx_utils/factory.js +17 -7
- package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +42 -0
- package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
- package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/index-blobs.js +2 -0
- package/dest/l1_tx_utils/index.d.ts +4 -1
- package/dest/l1_tx_utils/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/index.js +3 -0
- package/dest/l1_tx_utils/interfaces.d.ts +2 -2
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +252 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.js +568 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +26 -7
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +202 -92
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +4 -15
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +63 -165
- package/dest/l1_tx_utils/tx_delayer.d.ts +58 -0
- package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
- package/dest/{test → l1_tx_utils}/tx_delayer.js +70 -39
- package/dest/l1_tx_utils/types.d.ts +27 -1
- package/dest/l1_tx_utils/types.d.ts.map +1 -1
- package/dest/l1_tx_utils/types.js +10 -0
- package/dest/publisher_manager.d.ts +34 -7
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +119 -8
- package/dest/queries.d.ts +14 -3
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +80 -7
- package/dest/test/blob_kzg_warmup.d.ts +19 -0
- package/dest/test/blob_kzg_warmup.d.ts.map +1 -0
- package/dest/test/blob_kzg_warmup.js +64 -0
- package/dest/test/chain_monitor.d.ts +55 -4
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +105 -5
- package/dest/test/eth_cheat_codes.d.ts +49 -6
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +93 -43
- package/dest/test/index.d.ts +2 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +1 -2
- package/dest/test/rollup_cheat_codes.d.ts +64 -4
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +109 -8
- package/dest/test/start_anvil.d.ts +24 -2
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +182 -32
- package/dest/test/upgrade_utils.js +2 -2
- package/dest/types.d.ts +57 -2
- package/dest/types.d.ts.map +1 -1
- package/dest/utils.d.ts +24 -4
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +112 -16
- package/package.json +31 -15
- package/src/client.ts +66 -2
- package/src/config.ts +153 -469
- package/src/contracts/README.md +157 -0
- package/src/contracts/chain_state_override.ts +200 -0
- package/src/contracts/empire_base.ts +1 -1
- package/src/contracts/fee_asset_handler.ts +10 -7
- package/src/contracts/fee_asset_price_oracle.ts +285 -0
- package/src/contracts/governance.ts +279 -13
- package/src/contracts/governance_proposer.ts +64 -3
- package/src/contracts/gse.ts +7 -2
- package/src/contracts/inbox.ts +64 -4
- package/src/contracts/index.ts +5 -2
- package/src/contracts/log.ts +13 -0
- package/src/contracts/multicall.ts +247 -103
- package/src/contracts/outbox.ts +132 -0
- package/src/contracts/registry.ts +31 -1
- package/src/contracts/rollup.ts +789 -154
- package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +18 -14
- package/src/deploy_aztec_l1_contracts.ts +664 -0
- package/src/deploy_l1_contract.ts +362 -0
- package/src/forwarder_proxy.ts +108 -0
- package/src/foundry_binary.ts +57 -0
- package/src/l1_artifacts.ts +12 -35
- package/src/l1_contract_addresses.ts +120 -92
- package/src/l1_reader.ts +25 -10
- package/src/l1_tx_utils/config.ts +47 -9
- package/src/l1_tx_utils/constants.ts +13 -2
- package/src/l1_tx_utils/factory.ts +31 -31
- package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
- package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
- package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +108 -0
- package/src/l1_tx_utils/index-blobs.ts +2 -0
- package/src/l1_tx_utils/index.ts +3 -0
- package/src/l1_tx_utils/interfaces.ts +1 -1
- package/src/l1_tx_utils/l1_fee_analyzer.ts +875 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +194 -72
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +77 -211
- package/src/{test → l1_tx_utils}/tx_delayer.ts +97 -58
- package/src/l1_tx_utils/types.ts +32 -0
- package/src/publisher_manager.ts +145 -12
- package/src/queries.ts +87 -7
- package/src/test/blob_kzg_warmup.ts +65 -0
- package/src/test/chain_monitor.ts +150 -4
- package/src/test/eth_cheat_codes.ts +84 -47
- package/src/test/index.ts +1 -2
- package/src/test/rollup_cheat_codes.ts +136 -8
- package/src/test/start_anvil.ts +213 -31
- package/src/test/upgrade_utils.ts +2 -2
- package/src/types.ts +62 -0
- package/src/utils.ts +128 -19
- package/dest/contracts/empire_slashing_proposer.d.ts +0 -66
- package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/empire_slashing_proposer.js +0 -200
- package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -1
- package/dest/deploy_l1_contracts.d.ts +0 -673
- package/dest/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/deploy_l1_contracts.js +0 -1491
- package/dest/index.d.ts +0 -18
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -17
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +0 -26
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +0 -26
- package/dest/test/delayed_tx_utils.d.ts +0 -13
- package/dest/test/delayed_tx_utils.d.ts.map +0 -1
- package/dest/test/delayed_tx_utils.js +0 -28
- package/dest/test/tx_delayer.d.ts +0 -36
- package/dest/test/tx_delayer.d.ts.map +0 -1
- package/src/contracts/empire_slashing_proposer.ts +0 -265
- package/src/deploy_l1_contracts.ts +0 -1869
- package/src/index.ts +0 -17
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +0 -77
- package/src/test/delayed_tx_utils.ts +0 -52
package/dest/config.js
CHANGED
|
@@ -1,293 +1,93 @@
|
|
|
1
|
-
import { bigintConfigHelper, booleanConfigHelper,
|
|
1
|
+
import { bigintConfigHelper, booleanConfigHelper, getConfigFromMappings, getDefaultConfig, numberConfigHelper, omitConfigMappings, optionalNumberConfigHelper } from '@aztec/foundation/config';
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
ethereumSlotDuration: 12,
|
|
6
|
-
aztecSlotDuration: 36,
|
|
7
|
-
aztecEpochDuration: 32,
|
|
8
|
-
aztecTargetCommitteeSize: 48,
|
|
9
|
-
lagInEpochsForValidatorSet: 2,
|
|
10
|
-
lagInEpochsForRandao: 2,
|
|
11
|
-
aztecProofSubmissionEpochs: 1,
|
|
12
|
-
activationThreshold: 100n * 10n ** 18n,
|
|
13
|
-
ejectionThreshold: 50n * 10n ** 18n,
|
|
14
|
-
localEjectionThreshold: 98n * 10n ** 18n,
|
|
15
|
-
slashAmountSmall: 10n * 10n ** 18n,
|
|
16
|
-
slashAmountMedium: 20n * 10n ** 18n,
|
|
17
|
-
slashAmountLarge: 50n * 10n ** 18n,
|
|
18
|
-
slashingRoundSizeInEpochs: 4,
|
|
19
|
-
slashingLifetimeInRounds: 5,
|
|
20
|
-
slashingExecutionDelayInRounds: 0,
|
|
21
|
-
slashingVetoer: EthAddress.ZERO,
|
|
22
|
-
governanceProposerRoundSize: 300,
|
|
23
|
-
manaTarget: BigInt(100e6),
|
|
24
|
-
provingCostPerMana: BigInt(100),
|
|
25
|
-
exitDelaySeconds: 2 * 24 * 60 * 60,
|
|
26
|
-
slasherFlavor: 'tally',
|
|
27
|
-
slashingOffsetInRounds: 2,
|
|
28
|
-
slashingDisableDuration: 5 * 24 * 60 * 60
|
|
3
|
+
import l1ContractsDefaultEnv from '@aztec/l1-artifacts/network-defaults.json' with {
|
|
4
|
+
type: 'json'
|
|
29
5
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
votingDuration: 60n * 60n,
|
|
37
|
-
executionDelay: 60n,
|
|
38
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
39
|
-
quorum: 1n * 10n ** 17n,
|
|
40
|
-
requiredYeaMargin: 4n * 10n ** 16n,
|
|
41
|
-
minimumVotes: 400n * 10n ** 18n
|
|
42
|
-
};
|
|
43
|
-
const StagingPublicGovernanceConfiguration = {
|
|
44
|
-
proposeConfig: {
|
|
45
|
-
lockDelay: 60n * 60n * 24n * 30n,
|
|
46
|
-
lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n
|
|
47
|
-
},
|
|
48
|
-
votingDelay: 60n,
|
|
49
|
-
votingDuration: 60n * 60n,
|
|
50
|
-
executionDelay: 60n,
|
|
51
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
52
|
-
quorum: 3n * 10n ** 17n,
|
|
53
|
-
requiredYeaMargin: 4n * 10n ** 16n,
|
|
54
|
-
minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n
|
|
55
|
-
};
|
|
56
|
-
const TestnetGovernanceConfiguration = {
|
|
57
|
-
proposeConfig: {
|
|
58
|
-
lockDelay: 10n * 365n * 24n * 60n * 60n,
|
|
59
|
-
lockAmount: 1250n * 200_000n * 10n ** 18n
|
|
60
|
-
},
|
|
61
|
-
votingDelay: 12n * 60n * 60n,
|
|
62
|
-
votingDuration: 1n * 24n * 60n * 60n,
|
|
63
|
-
executionDelay: 12n * 60n * 60n,
|
|
64
|
-
gracePeriod: 1n * 24n * 60n * 60n,
|
|
65
|
-
quorum: 2n * 10n ** 17n,
|
|
66
|
-
requiredYeaMargin: 1n * 10n ** 17n,
|
|
67
|
-
minimumVotes: 100n * 200_000n * 10n ** 18n
|
|
68
|
-
};
|
|
69
|
-
const StagingIgnitionGovernanceConfiguration = {
|
|
70
|
-
proposeConfig: {
|
|
71
|
-
lockDelay: 10n * 365n * 24n * 60n * 60n,
|
|
72
|
-
lockAmount: 1250n * 200_000n * 10n ** 18n
|
|
73
|
-
},
|
|
74
|
-
votingDelay: 7n * 24n * 60n * 60n,
|
|
75
|
-
votingDuration: 7n * 24n * 60n * 60n,
|
|
76
|
-
executionDelay: 30n * 24n * 60n * 60n,
|
|
77
|
-
gracePeriod: 7n * 24n * 60n * 60n,
|
|
78
|
-
quorum: 2n * 10n ** 17n,
|
|
79
|
-
requiredYeaMargin: 1n * 10n ** 17n,
|
|
80
|
-
minimumVotes: 1250n * 200_000n * 10n ** 18n
|
|
81
|
-
};
|
|
82
|
-
const MainnetGovernanceConfiguration = {
|
|
83
|
-
proposeConfig: {
|
|
84
|
-
lockDelay: 90n * 24n * 60n * 60n,
|
|
85
|
-
lockAmount: 258_750_000n * 10n ** 18n
|
|
86
|
-
},
|
|
87
|
-
votingDelay: 3n * 24n * 60n * 60n,
|
|
88
|
-
votingDuration: 7n * 24n * 60n * 60n,
|
|
89
|
-
executionDelay: 7n * 24n * 60n * 60n,
|
|
90
|
-
gracePeriod: 7n * 24n * 60n * 60n,
|
|
91
|
-
quorum: 2n * 10n ** 17n,
|
|
92
|
-
requiredYeaMargin: 33n * 10n ** 16n,
|
|
93
|
-
minimumVotes: 1000n * 200_000n * 10n ** 18n
|
|
94
|
-
};
|
|
95
|
-
export const getGovernanceConfiguration = (networkName)=>{
|
|
96
|
-
switch(networkName){
|
|
97
|
-
case 'local':
|
|
98
|
-
return LocalGovernanceConfiguration;
|
|
99
|
-
case 'next-net':
|
|
100
|
-
return LocalGovernanceConfiguration;
|
|
101
|
-
case 'devnet':
|
|
102
|
-
return LocalGovernanceConfiguration;
|
|
103
|
-
case 'staging-public':
|
|
104
|
-
return StagingPublicGovernanceConfiguration;
|
|
105
|
-
case 'testnet':
|
|
106
|
-
return TestnetGovernanceConfiguration;
|
|
107
|
-
case 'staging-ignition':
|
|
108
|
-
return StagingIgnitionGovernanceConfiguration;
|
|
109
|
-
case 'mainnet':
|
|
110
|
-
return MainnetGovernanceConfiguration;
|
|
111
|
-
default:
|
|
112
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
// Making a default config here as we are only using it thought the deployment
|
|
116
|
-
// and do not expect to be using different setups, so having environment variables
|
|
117
|
-
// for it seems overkill
|
|
118
|
-
const DefaultRewardConfig = {
|
|
119
|
-
sequencerBps: 8000,
|
|
120
|
-
rewardDistributor: EthAddress.ZERO.toString(),
|
|
121
|
-
booster: EthAddress.ZERO.toString(),
|
|
122
|
-
checkpointReward: 500n * 10n ** 18n
|
|
123
|
-
};
|
|
124
|
-
const MainnetRewardConfig = {
|
|
125
|
-
sequencerBps: 7_000,
|
|
126
|
-
rewardDistributor: EthAddress.ZERO.toString(),
|
|
127
|
-
booster: EthAddress.ZERO.toString(),
|
|
128
|
-
checkpointReward: 400n * 10n ** 18n
|
|
129
|
-
};
|
|
130
|
-
export const getRewardConfig = (networkName)=>{
|
|
131
|
-
switch(networkName){
|
|
132
|
-
case 'local':
|
|
133
|
-
case 'devnet':
|
|
134
|
-
case 'next-net':
|
|
135
|
-
case 'staging-public':
|
|
136
|
-
case 'testnet':
|
|
137
|
-
case 'staging-ignition':
|
|
138
|
-
return DefaultRewardConfig;
|
|
139
|
-
case 'mainnet':
|
|
140
|
-
return MainnetRewardConfig;
|
|
141
|
-
default:
|
|
142
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
export const getRewardBoostConfig = ()=>{
|
|
146
|
-
// The reward configuration is specified with a precision of 1e5, and we use the same across
|
|
147
|
-
// all networks.
|
|
148
|
-
return {
|
|
149
|
-
increment: 125_000,
|
|
150
|
-
maxScore: 15_000_000,
|
|
151
|
-
a: 1_000,
|
|
152
|
-
k: 1_000_000,
|
|
153
|
-
minimum: 100_000
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
// Similar to the above, no need for environment variables for this.
|
|
157
|
-
const LocalEntryQueueConfig = {
|
|
158
|
-
bootstrapValidatorSetSize: 0n,
|
|
159
|
-
bootstrapFlushSize: 0n,
|
|
160
|
-
normalFlushSizeMin: 48n,
|
|
161
|
-
normalFlushSizeQuotient: 2n,
|
|
162
|
-
maxQueueFlushSize: 48n
|
|
163
|
-
};
|
|
164
|
-
const StagingPublicEntryQueueConfig = {
|
|
165
|
-
bootstrapValidatorSetSize: 48n,
|
|
166
|
-
bootstrapFlushSize: 48n,
|
|
167
|
-
normalFlushSizeMin: 1n,
|
|
168
|
-
normalFlushSizeQuotient: 2475n,
|
|
169
|
-
maxQueueFlushSize: 32n
|
|
170
|
-
};
|
|
171
|
-
const TestnetEntryQueueConfig = {
|
|
172
|
-
bootstrapValidatorSetSize: 256n,
|
|
173
|
-
bootstrapFlushSize: 256n,
|
|
174
|
-
normalFlushSizeMin: 4n,
|
|
175
|
-
normalFlushSizeQuotient: 2048n,
|
|
176
|
-
maxQueueFlushSize: 8n
|
|
177
|
-
};
|
|
178
|
-
const StagingIgnitionEntryQueueConfig = {
|
|
179
|
-
bootstrapValidatorSetSize: 48n,
|
|
180
|
-
bootstrapFlushSize: 48n,
|
|
181
|
-
normalFlushSizeMin: 1n,
|
|
182
|
-
normalFlushSizeQuotient: 2048n,
|
|
183
|
-
maxQueueFlushSize: 24n
|
|
184
|
-
};
|
|
185
|
-
const MainnetEntryQueueConfig = {
|
|
186
|
-
bootstrapValidatorSetSize: 1_000n,
|
|
187
|
-
bootstrapFlushSize: 1_000n,
|
|
188
|
-
normalFlushSizeMin: 1n,
|
|
189
|
-
normalFlushSizeQuotient: 2_048n,
|
|
190
|
-
maxQueueFlushSize: 8n
|
|
191
|
-
};
|
|
192
|
-
export const getEntryQueueConfig = (networkName)=>{
|
|
193
|
-
switch(networkName){
|
|
194
|
-
case 'local':
|
|
195
|
-
return LocalEntryQueueConfig;
|
|
196
|
-
case 'next-net':
|
|
197
|
-
return LocalEntryQueueConfig;
|
|
198
|
-
case 'devnet':
|
|
199
|
-
return LocalEntryQueueConfig;
|
|
200
|
-
case 'staging-public':
|
|
201
|
-
return StagingPublicEntryQueueConfig;
|
|
202
|
-
case 'testnet':
|
|
203
|
-
return TestnetEntryQueueConfig;
|
|
204
|
-
case 'staging-ignition':
|
|
205
|
-
return StagingIgnitionEntryQueueConfig;
|
|
206
|
-
case 'mainnet':
|
|
207
|
-
return MainnetEntryQueueConfig;
|
|
208
|
-
default:
|
|
209
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
export const l1ContractsConfigMappings = {
|
|
6
|
+
import { l1TxUtilsConfigMappings } from './l1_tx_utils/config.js';
|
|
7
|
+
/**
|
|
8
|
+
* Config mappings for L1ContractsConfig.
|
|
9
|
+
* Default values come from l1-contracts/scripts/network-defaults.json (published via @aztec/l1-artifacts).
|
|
10
|
+
* Real deployments use forge scripts which require explicit env vars (vm.envUint).
|
|
11
|
+
*/ export const l1ContractsConfigMappings = {
|
|
213
12
|
ethereumSlotDuration: {
|
|
214
13
|
env: 'ETHEREUM_SLOT_DURATION',
|
|
215
14
|
description: 'How many seconds an L1 slot lasts.',
|
|
216
|
-
...numberConfigHelper(
|
|
15
|
+
...numberConfigHelper(l1ContractsDefaultEnv.ETHEREUM_SLOT_DURATION)
|
|
217
16
|
},
|
|
218
17
|
aztecSlotDuration: {
|
|
219
18
|
env: 'AZTEC_SLOT_DURATION',
|
|
220
19
|
description: 'How many seconds an L2 slots lasts (must be multiple of ethereum slot duration).',
|
|
221
|
-
...numberConfigHelper(
|
|
20
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLOT_DURATION)
|
|
222
21
|
},
|
|
223
22
|
aztecEpochDuration: {
|
|
224
23
|
env: 'AZTEC_EPOCH_DURATION',
|
|
225
|
-
description: `How many L2 slots an epoch lasts (maximum
|
|
226
|
-
...numberConfigHelper(
|
|
24
|
+
description: `How many L2 slots an epoch lasts (maximum MAX_CHECKPOINTS_PER_EPOCH).`,
|
|
25
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EPOCH_DURATION)
|
|
227
26
|
},
|
|
228
27
|
aztecTargetCommitteeSize: {
|
|
229
28
|
env: 'AZTEC_TARGET_COMMITTEE_SIZE',
|
|
230
29
|
description: 'The target validator committee size.',
|
|
231
|
-
...numberConfigHelper(
|
|
30
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_TARGET_COMMITTEE_SIZE)
|
|
232
31
|
},
|
|
233
32
|
lagInEpochsForValidatorSet: {
|
|
234
33
|
env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
|
|
235
34
|
description: 'The number of epochs to lag behind the current epoch for validator selection.',
|
|
236
|
-
...numberConfigHelper(
|
|
35
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET)
|
|
237
36
|
},
|
|
238
37
|
lagInEpochsForRandao: {
|
|
239
38
|
env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
|
|
240
39
|
description: 'The number of epochs to lag behind the current epoch for randao selection.',
|
|
241
|
-
...numberConfigHelper(
|
|
40
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_LAG_IN_EPOCHS_FOR_RANDAO)
|
|
41
|
+
},
|
|
42
|
+
inboxLag: {
|
|
43
|
+
env: 'AZTEC_INBOX_LAG',
|
|
44
|
+
description: 'The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks).',
|
|
45
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_INBOX_LAG)
|
|
242
46
|
},
|
|
243
47
|
aztecProofSubmissionEpochs: {
|
|
244
48
|
env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
|
|
245
49
|
description: 'The number of epochs after an epoch ends that proofs are still accepted.',
|
|
246
|
-
...numberConfigHelper(
|
|
50
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_PROOF_SUBMISSION_EPOCHS)
|
|
247
51
|
},
|
|
248
52
|
activationThreshold: {
|
|
249
53
|
env: 'AZTEC_ACTIVATION_THRESHOLD',
|
|
250
54
|
description: 'The deposit amount for a validator',
|
|
251
|
-
...bigintConfigHelper(
|
|
55
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_ACTIVATION_THRESHOLD))
|
|
252
56
|
},
|
|
253
57
|
ejectionThreshold: {
|
|
254
58
|
env: 'AZTEC_EJECTION_THRESHOLD',
|
|
255
59
|
description: 'The minimum stake for a validator.',
|
|
256
|
-
...bigintConfigHelper(
|
|
60
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_EJECTION_THRESHOLD))
|
|
257
61
|
},
|
|
258
62
|
localEjectionThreshold: {
|
|
259
63
|
env: 'AZTEC_LOCAL_EJECTION_THRESHOLD',
|
|
260
64
|
description: 'The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup',
|
|
261
|
-
...bigintConfigHelper(
|
|
65
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_LOCAL_EJECTION_THRESHOLD))
|
|
262
66
|
},
|
|
263
67
|
slashingOffsetInRounds: {
|
|
264
68
|
env: 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
|
|
265
69
|
description: 'How many slashing rounds back we slash (ie when slashing in round N, we slash for offenses committed during epochs of round N-offset)',
|
|
266
|
-
...numberConfigHelper(
|
|
70
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_OFFSET_IN_ROUNDS)
|
|
267
71
|
},
|
|
268
|
-
|
|
269
|
-
env: '
|
|
270
|
-
description: '
|
|
271
|
-
...
|
|
272
|
-
'empire',
|
|
273
|
-
'tally',
|
|
274
|
-
'none'
|
|
275
|
-
], DefaultL1ContractsConfig.slasherFlavor)
|
|
72
|
+
slasherEnabled: {
|
|
73
|
+
env: 'AZTEC_SLASHER_ENABLED',
|
|
74
|
+
description: 'Whether to deploy a slasher proposer',
|
|
75
|
+
...booleanConfigHelper(true)
|
|
276
76
|
},
|
|
277
77
|
slashAmountSmall: {
|
|
278
78
|
env: 'AZTEC_SLASH_AMOUNT_SMALL',
|
|
279
79
|
description: 'Small slashing amount for light offenses',
|
|
280
|
-
...bigintConfigHelper(
|
|
80
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_SMALL))
|
|
281
81
|
},
|
|
282
82
|
slashAmountMedium: {
|
|
283
83
|
env: 'AZTEC_SLASH_AMOUNT_MEDIUM',
|
|
284
84
|
description: 'Medium slashing amount for moderate offenses',
|
|
285
|
-
...bigintConfigHelper(
|
|
85
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_MEDIUM))
|
|
286
86
|
},
|
|
287
87
|
slashAmountLarge: {
|
|
288
88
|
env: 'AZTEC_SLASH_AMOUNT_LARGE',
|
|
289
89
|
description: 'Large slashing amount for severe offenses',
|
|
290
|
-
...bigintConfigHelper(
|
|
90
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_LARGE))
|
|
291
91
|
},
|
|
292
92
|
slashingQuorum: {
|
|
293
93
|
env: 'AZTEC_SLASHING_QUORUM',
|
|
@@ -297,28 +97,28 @@ export const l1ContractsConfigMappings = {
|
|
|
297
97
|
slashingRoundSizeInEpochs: {
|
|
298
98
|
env: 'AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS',
|
|
299
99
|
description: 'The slashing round size',
|
|
300
|
-
...numberConfigHelper(
|
|
100
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS)
|
|
301
101
|
},
|
|
302
102
|
slashingLifetimeInRounds: {
|
|
303
103
|
env: 'AZTEC_SLASHING_LIFETIME_IN_ROUNDS',
|
|
304
104
|
description: 'The slashing lifetime in rounds',
|
|
305
|
-
...numberConfigHelper(
|
|
105
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_LIFETIME_IN_ROUNDS)
|
|
306
106
|
},
|
|
307
107
|
slashingExecutionDelayInRounds: {
|
|
308
108
|
env: 'AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS',
|
|
309
109
|
description: 'The slashing execution delay in rounds',
|
|
310
|
-
...numberConfigHelper(
|
|
110
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS)
|
|
311
111
|
},
|
|
312
112
|
slashingVetoer: {
|
|
313
113
|
env: 'AZTEC_SLASHING_VETOER',
|
|
314
114
|
description: 'The slashing vetoer',
|
|
315
115
|
parseEnv: (val)=>EthAddress.fromString(val),
|
|
316
|
-
defaultValue:
|
|
116
|
+
defaultValue: EthAddress.fromString(l1ContractsDefaultEnv.AZTEC_SLASHING_VETOER)
|
|
317
117
|
},
|
|
318
118
|
slashingDisableDuration: {
|
|
319
119
|
env: 'AZTEC_SLASHING_DISABLE_DURATION',
|
|
320
120
|
description: 'How long slashing can be disabled for in seconds when vetoer disables it',
|
|
321
|
-
...numberConfigHelper(
|
|
121
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_DISABLE_DURATION)
|
|
322
122
|
},
|
|
323
123
|
governanceProposerQuorum: {
|
|
324
124
|
env: 'AZTEC_GOVERNANCE_PROPOSER_QUORUM',
|
|
@@ -328,25 +128,90 @@ export const l1ContractsConfigMappings = {
|
|
|
328
128
|
governanceProposerRoundSize: {
|
|
329
129
|
env: 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE',
|
|
330
130
|
description: 'The governance proposing round size',
|
|
331
|
-
...numberConfigHelper(
|
|
131
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE)
|
|
132
|
+
},
|
|
133
|
+
governanceVotingDuration: {
|
|
134
|
+
env: 'AZTEC_GOVERNANCE_VOTING_DURATION',
|
|
135
|
+
description: 'Governance voting duration in seconds (only for local/devnet/next-net)',
|
|
136
|
+
...numberConfigHelper(3600)
|
|
332
137
|
},
|
|
333
138
|
manaTarget: {
|
|
334
139
|
env: 'AZTEC_MANA_TARGET',
|
|
335
140
|
description: 'The mana target for the rollup',
|
|
336
|
-
...bigintConfigHelper(
|
|
141
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_MANA_TARGET))
|
|
337
142
|
},
|
|
338
143
|
provingCostPerMana: {
|
|
339
144
|
env: 'AZTEC_PROVING_COST_PER_MANA',
|
|
340
145
|
description: 'The proving cost per mana',
|
|
341
|
-
...bigintConfigHelper(
|
|
146
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_PROVING_COST_PER_MANA))
|
|
147
|
+
},
|
|
148
|
+
initialEthPerFeeAsset: {
|
|
149
|
+
env: 'AZTEC_INITIAL_ETH_PER_FEE_ASSET',
|
|
150
|
+
description: 'The initial ETH per fee asset price (with 1e12 precision)',
|
|
151
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_INITIAL_ETH_PER_FEE_ASSET))
|
|
342
152
|
},
|
|
343
153
|
exitDelaySeconds: {
|
|
344
154
|
env: 'AZTEC_EXIT_DELAY_SECONDS',
|
|
345
155
|
description: 'The delay before a validator can exit the set',
|
|
346
|
-
...numberConfigHelper(
|
|
156
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EXIT_DELAY_SECONDS)
|
|
157
|
+
},
|
|
158
|
+
entryQueueBootstrapValidatorSetSize: {
|
|
159
|
+
env: 'AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE',
|
|
160
|
+
description: 'Validator set size at or below which the entry queue uses the bootstrap flush size.',
|
|
161
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE)
|
|
162
|
+
},
|
|
163
|
+
entryQueueBootstrapFlushSize: {
|
|
164
|
+
env: 'AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE',
|
|
165
|
+
description: 'Number of validators admitted from the entry queue per flush during the bootstrap phase.',
|
|
166
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_BOOTSTRAP_FLUSH_SIZE)
|
|
347
167
|
},
|
|
348
|
-
|
|
168
|
+
entryQueueFlushSizeMin: {
|
|
169
|
+
env: 'AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN',
|
|
170
|
+
description: 'Minimum number of validators admitted from the entry queue per flush.',
|
|
171
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_FLUSH_SIZE_MIN)
|
|
172
|
+
},
|
|
173
|
+
entryQueueFlushSizeQuotient: {
|
|
174
|
+
env: 'AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT',
|
|
175
|
+
description: 'Divisor applied to the queue size to derive the normal per-flush admission count.',
|
|
176
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_FLUSH_SIZE_QUOTIENT)
|
|
177
|
+
},
|
|
178
|
+
entryQueueMaxFlushSize: {
|
|
179
|
+
env: 'AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE',
|
|
180
|
+
description: 'Maximum number of validators admitted from the entry queue per flush.',
|
|
181
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_ENTRY_QUEUE_MAX_FLUSH_SIZE)
|
|
182
|
+
},
|
|
183
|
+
...omitConfigMappings(l1TxUtilsConfigMappings, [
|
|
184
|
+
'ethereumSlotDuration'
|
|
185
|
+
])
|
|
349
186
|
};
|
|
187
|
+
/**
|
|
188
|
+
* Default L1 contracts configuration derived from l1ContractsConfigMappings.
|
|
189
|
+
* Source of truth: l1-contracts/scripts/network-defaults.json (published via @aztec/l1-artifacts).
|
|
190
|
+
*/ export const DefaultL1ContractsConfig = getDefaultConfig(l1ContractsConfigMappings);
|
|
191
|
+
/**
|
|
192
|
+
* Validates that `ethereumSlotDuration` and `aztecSlotDuration` are positive and that the L2 slot is an exact
|
|
193
|
+
* multiple of the L1 slot. Every L2 slot boundary must land on an L1 slot boundary; a non-multiple pairing
|
|
194
|
+
* desyncs the epoch/checkpoint timing math throughout the sequencer, validator client, and timetables. Returns
|
|
195
|
+
* a list of error messages (empty when valid).
|
|
196
|
+
*/ export function validateSlotDurations(config) {
|
|
197
|
+
const errors = [];
|
|
198
|
+
if (config.ethereumSlotDuration <= 0) {
|
|
199
|
+
errors.push(`ethereumSlotDuration must be positive (got ${config.ethereumSlotDuration})`);
|
|
200
|
+
}
|
|
201
|
+
if (config.aztecSlotDuration <= 0) {
|
|
202
|
+
errors.push(`aztecSlotDuration must be positive (got ${config.aztecSlotDuration})`);
|
|
203
|
+
}
|
|
204
|
+
if (config.ethereumSlotDuration > 0 && config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
|
|
205
|
+
errors.push(`aztecSlotDuration (${config.aztecSlotDuration}s) must be a multiple of ethereumSlotDuration ` + `(${config.ethereumSlotDuration}s)`);
|
|
206
|
+
}
|
|
207
|
+
return errors;
|
|
208
|
+
}
|
|
209
|
+
/** Throws if {@link validateSlotDurations} reports any errors. */ export function assertValidSlotDurations(config) {
|
|
210
|
+
const errors = validateSlotDurations(config);
|
|
211
|
+
if (errors.length > 0) {
|
|
212
|
+
throw new Error(`Invalid slot duration configuration:\n${errors.map((e)=>` - ${e}`).join('\n')}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
350
215
|
export const genesisStateConfigMappings = {
|
|
351
216
|
testAccounts: {
|
|
352
217
|
env: 'TEST_ACCOUNTS',
|
|
@@ -357,6 +222,12 @@ export const genesisStateConfigMappings = {
|
|
|
357
222
|
env: 'SPONSORED_FPC',
|
|
358
223
|
description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.',
|
|
359
224
|
...booleanConfigHelper(false)
|
|
225
|
+
},
|
|
226
|
+
prefundAddresses: {
|
|
227
|
+
env: 'PREFUND_ADDRESSES',
|
|
228
|
+
description: 'Comma-separated list of Aztec addresses to prefund with fee juice at genesis (local network only).',
|
|
229
|
+
parseEnv: (val)=>val.split(',').map((a)=>a.trim()).filter((a)=>a.length > 0),
|
|
230
|
+
defaultValue: []
|
|
360
231
|
}
|
|
361
232
|
};
|
|
362
233
|
export function getL1ContractsConfigEnvVars() {
|
|
@@ -365,146 +236,3 @@ export function getL1ContractsConfigEnvVars() {
|
|
|
365
236
|
export function getGenesisStateConfigEnvVars() {
|
|
366
237
|
return getConfigFromMappings(genesisStateConfigMappings);
|
|
367
238
|
}
|
|
368
|
-
/**
|
|
369
|
-
* Validates the L1 contracts configuration to ensure all requirements enforced by L1 contracts
|
|
370
|
-
* during construction are satisfied before deployment.
|
|
371
|
-
* Accumulates all validation errors and throws an exception listing them all if any are found.
|
|
372
|
-
*/ export function validateConfig(config) {
|
|
373
|
-
const errors = [];
|
|
374
|
-
// RollupCore constructor validation: normalFlushSizeMin > 0
|
|
375
|
-
// From: require(_config.stakingQueueConfig.normalFlushSizeMin > 0, Errors.Staking__InvalidStakingQueueConfig());
|
|
376
|
-
const entryQueueConfig = getEntryQueueConfig('testnet'); // Get config to check normalFlushSizeMin
|
|
377
|
-
if (entryQueueConfig.normalFlushSizeMin <= 0n) {
|
|
378
|
-
errors.push('normalFlushSizeMin must be greater than 0');
|
|
379
|
-
}
|
|
380
|
-
// TimeLib initialization validation: aztecSlotDuration should be a multiple of ethereumSlotDuration
|
|
381
|
-
// While not explicitly required in constructor, this is a common validation for time-based systems
|
|
382
|
-
if (config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
|
|
383
|
-
errors.push(`aztecSlotDuration (${config.aztecSlotDuration}) must be a multiple of ethereumSlotDuration (${config.ethereumSlotDuration})`);
|
|
384
|
-
}
|
|
385
|
-
// EmpireBase constructor validations for governance/slashing proposers
|
|
386
|
-
// From: require(QUORUM_SIZE > ROUND_SIZE / 2, Errors.EmpireBase__InvalidQuorumAndRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
387
|
-
const { governanceProposerQuorum, governanceProposerRoundSize } = config;
|
|
388
|
-
if (governanceProposerQuorum !== undefined && governanceProposerQuorum <= Math.floor(governanceProposerRoundSize / 2)) {
|
|
389
|
-
errors.push(`governanceProposerQuorum (${governanceProposerQuorum}) must be greater than half of governanceProposerRoundSize (${Math.floor(governanceProposerRoundSize / 2)})`);
|
|
390
|
-
}
|
|
391
|
-
// From: require(QUORUM_SIZE <= ROUND_SIZE, Errors.EmpireBase__QuorumCannotBeLargerThanRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
392
|
-
if (governanceProposerQuorum !== undefined && governanceProposerQuorum > governanceProposerRoundSize) {
|
|
393
|
-
errors.push(`governanceProposerQuorum (${governanceProposerQuorum}) cannot be larger than governanceProposerRoundSize (${governanceProposerRoundSize})`);
|
|
394
|
-
}
|
|
395
|
-
// Slashing quorum validations (similar to governance quorum)
|
|
396
|
-
const slashingRoundSize = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
397
|
-
const { slashingQuorum } = config;
|
|
398
|
-
if (slashingQuorum !== undefined && slashingQuorum <= Math.floor(slashingRoundSize / 2)) {
|
|
399
|
-
errors.push(`slashingQuorum (${slashingQuorum}) must be greater than half of slashingRoundSizeInEpochs (${Math.floor(slashingRoundSize / 2)})`);
|
|
400
|
-
}
|
|
401
|
-
if (slashingQuorum !== undefined && slashingQuorum > slashingRoundSize) {
|
|
402
|
-
errors.push(`slashingQuorum (${slashingQuorum}) cannot be larger than slashingRoundSizeInEpochs (${slashingRoundSize})`);
|
|
403
|
-
}
|
|
404
|
-
// EmpireBase and TallySlashingProposer lifetime and execution delay validation
|
|
405
|
-
// From: require(LIFETIME_IN_ROUNDS > EXECUTION_DELAY_IN_ROUNDS);
|
|
406
|
-
if (config.slashingLifetimeInRounds <= config.slashingExecutionDelayInRounds) {
|
|
407
|
-
errors.push(`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be greater than slashingExecutionDelayInRounds (${config.slashingExecutionDelayInRounds})`);
|
|
408
|
-
}
|
|
409
|
-
// Staking asset validation: activationThreshold > ejectionThreshold
|
|
410
|
-
if (config.activationThreshold < config.ejectionThreshold) {
|
|
411
|
-
errors.push(`activationThreshold (${config.activationThreshold}) must be greater than ejectionThreshold (${config.ejectionThreshold})`);
|
|
412
|
-
}
|
|
413
|
-
// TallySlashingProposer constructor validations
|
|
414
|
-
if (config.slasherFlavor === 'tally') {
|
|
415
|
-
validateTallySlasherConfig(config, errors);
|
|
416
|
-
}
|
|
417
|
-
// Epoch and slot duration validations
|
|
418
|
-
if (config.aztecSlotDuration <= 0) {
|
|
419
|
-
errors.push('aztecSlotDuration must be greater than 0');
|
|
420
|
-
}
|
|
421
|
-
if (config.ethereumSlotDuration <= 0) {
|
|
422
|
-
errors.push('ethereumSlotDuration must be greater than 0');
|
|
423
|
-
}
|
|
424
|
-
if (config.aztecEpochDuration <= 0) {
|
|
425
|
-
errors.push('aztecEpochDuration must be greater than 0');
|
|
426
|
-
}
|
|
427
|
-
// Committee size validation
|
|
428
|
-
if (config.aztecTargetCommitteeSize < 0) {
|
|
429
|
-
errors.push('aztecTargetCommitteeSize cannot be negative');
|
|
430
|
-
}
|
|
431
|
-
// Proof submission epochs validation
|
|
432
|
-
if (config.aztecProofSubmissionEpochs < 0) {
|
|
433
|
-
errors.push('aztecProofSubmissionEpochs cannot be negative');
|
|
434
|
-
}
|
|
435
|
-
// Exit delay validation
|
|
436
|
-
if (config.exitDelaySeconds < 0) {
|
|
437
|
-
errors.push('exitDelaySeconds cannot be negative');
|
|
438
|
-
}
|
|
439
|
-
// Mana validation
|
|
440
|
-
if (config.manaTarget < 0n) {
|
|
441
|
-
errors.push('manaTarget cannot be negative');
|
|
442
|
-
}
|
|
443
|
-
if (config.provingCostPerMana < 0n) {
|
|
444
|
-
errors.push('provingCostPerMana cannot be negative');
|
|
445
|
-
}
|
|
446
|
-
// If any errors were found, throw an exception with all of them
|
|
447
|
-
if (errors.length > 0) {
|
|
448
|
-
throw new Error(`L1 contracts configuration validation failed with ${errors.length} error(s):\n${errors.map((error, index)=>`${index + 1}. ${error}`).join('\n')}`);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
function validateTallySlasherConfig(config, errors) {
|
|
452
|
-
if (config.slasherFlavor !== 'tally') {
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
// From: require(SLASH_OFFSET_IN_ROUNDS > 0, Errors.TallySlashingProposer__SlashOffsetMustBeGreaterThanZero(...));
|
|
456
|
-
if (config.slashingOffsetInRounds <= 0) {
|
|
457
|
-
errors.push(`slashingOffsetInRounds (${config.slashingOffsetInRounds}) must be greater than 0`);
|
|
458
|
-
}
|
|
459
|
-
// From: require(ROUND_SIZE_IN_EPOCHS * _epochDuration == ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeMustBeMultipleOfEpochDuration(...));
|
|
460
|
-
const roundSizeInSlots = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
461
|
-
// From: require(QUORUM > 0, Errors.TallySlashingProposer__QuorumMustBeGreaterThanZero());
|
|
462
|
-
const { slashingQuorum } = config;
|
|
463
|
-
if (slashingQuorum !== undefined && slashingQuorum <= 0) {
|
|
464
|
-
errors.push(`slashingQuorum (${slashingQuorum}) must be greater than 0`);
|
|
465
|
-
}
|
|
466
|
-
// From: require(ROUND_SIZE > 1, Errors.TallySlashingProposer__InvalidQuorumAndRoundSize(QUORUM, ROUND_SIZE));
|
|
467
|
-
if (roundSizeInSlots <= 1) {
|
|
468
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be greater than 1`);
|
|
469
|
-
}
|
|
470
|
-
// From: require(_slashAmounts[0] <= _slashAmounts[1], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
471
|
-
if (config.slashAmountSmall > config.slashAmountMedium) {
|
|
472
|
-
errors.push(`slashAmountSmall (${config.slashAmountSmall}) must be less than or equal to slashAmountMedium (${config.slashAmountMedium})`);
|
|
473
|
-
}
|
|
474
|
-
// From: require(_slashAmounts[1] <= _slashAmounts[2], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
475
|
-
if (config.slashAmountMedium > config.slashAmountLarge) {
|
|
476
|
-
errors.push(`slashAmountMedium (${config.slashAmountMedium}) must be less than or equal to slashAmountLarge (${config.slashAmountLarge})`);
|
|
477
|
-
}
|
|
478
|
-
// From: require(LIFETIME_IN_ROUNDS < ROUNDABOUT_SIZE, Errors.TallySlashingProposer__LifetimeMustBeLessThanRoundabout(...));
|
|
479
|
-
const ROUNDABOUT_SIZE = 128; // Constant from TallySlashingProposer
|
|
480
|
-
if (config.slashingLifetimeInRounds >= ROUNDABOUT_SIZE) {
|
|
481
|
-
errors.push(`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be less than ${ROUNDABOUT_SIZE}`);
|
|
482
|
-
}
|
|
483
|
-
// From: require(ROUND_SIZE_IN_EPOCHS > 0, Errors.TallySlashingProposer__RoundSizeInEpochsMustBeGreaterThanZero(...));
|
|
484
|
-
if (config.slashingRoundSizeInEpochs <= 0) {
|
|
485
|
-
errors.push(`slashingRoundSizeInEpochs (${config.slashingRoundSizeInEpochs}) must be greater than 0`);
|
|
486
|
-
}
|
|
487
|
-
// From: require(ROUND_SIZE < MAX_ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeTooLarge(ROUND_SIZE, MAX_ROUND_SIZE));
|
|
488
|
-
const MAX_ROUND_SIZE = 1024; // Constant from TallySlashingProposer
|
|
489
|
-
if (roundSizeInSlots >= MAX_ROUND_SIZE) {
|
|
490
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be less than ${MAX_ROUND_SIZE}`);
|
|
491
|
-
}
|
|
492
|
-
// From: require(COMMITTEE_SIZE > 0, Errors.TallySlashingProposer__CommitteeSizeMustBeGreaterThanZero(COMMITTEE_SIZE));
|
|
493
|
-
if (config.aztecTargetCommitteeSize <= 0) {
|
|
494
|
-
errors.push(`aztecTargetCommitteeSize (${config.aztecTargetCommitteeSize}) must be greater than 0`);
|
|
495
|
-
}
|
|
496
|
-
// From: require(voteSize <= 128, Errors.TallySlashingProposer__VoteSizeTooBig(voteSize, 128));
|
|
497
|
-
// voteSize = COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS / 4
|
|
498
|
-
const voteSize = config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs / 4;
|
|
499
|
-
if (voteSize > 128) {
|
|
500
|
-
errors.push(`vote size (${voteSize}) must be <= 128 (committee size * round size in epochs / 4)`);
|
|
501
|
-
}
|
|
502
|
-
// From: require(COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS % 4 == 0, Errors.TallySlashingProposer__InvalidCommitteeAndRoundSize(...));
|
|
503
|
-
if (config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs % 4 !== 0) {
|
|
504
|
-
errors.push(`aztecTargetCommitteeSize * slashingRoundSizeInEpochs (${config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs}) must be divisible by 4`);
|
|
505
|
-
}
|
|
506
|
-
// Slashing offset validation: should be positive to allow proper slashing timing
|
|
507
|
-
if (config.slashingOffsetInRounds < 0) {
|
|
508
|
-
errors.push('slashingOffsetInRounds cannot be negative');
|
|
509
|
-
}
|
|
510
|
-
}
|