@aztec/ethereum 0.0.1-fake-c83136db25 → 0.0.2-commit.217f559981
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/account.d.ts +1 -1
- package/dest/chain.d.ts +1 -1
- package/dest/client.d.ts +1 -1
- package/dest/client.js +6 -2
- package/dest/config.d.ts +22 -68
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +61 -348
- package/dest/constants.d.ts +1 -1
- package/dest/contracts/empire_base.d.ts +9 -5
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +8 -4
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +39 -17
- package/dest/contracts/errors.d.ts +1 -1
- package/dest/contracts/errors.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 +101 -0
- package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
- package/dest/contracts/fee_asset_price_oracle.js +651 -0
- package/dest/contracts/fee_juice.d.ts +1 -1
- package/dest/contracts/fee_juice.d.ts.map +1 -1
- package/dest/contracts/governance.d.ts +18 -16
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +14 -4
- package/dest/contracts/governance_proposer.d.ts +8 -4
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +412 -11
- package/dest/contracts/gse.d.ts +1 -1
- package/dest/contracts/gse.d.ts.map +1 -1
- package/dest/contracts/inbox.d.ts +24 -3
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +36 -1
- package/dest/contracts/index.d.ts +4 -1
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +3 -0
- 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 +2 -2
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +2 -1
- package/dest/contracts/outbox.d.ts +41 -0
- package/dest/contracts/outbox.d.ts.map +1 -0
- package/dest/contracts/outbox.js +86 -0
- package/dest/contracts/registry.d.ts +1 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/rollup.d.ts +195 -123
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +755 -187
- package/dest/contracts/slasher_contract.d.ts +1 -1
- package/dest/contracts/slasher_contract.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.d.ts +9 -7
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +11 -4
- package/dest/contracts/utils.d.ts +1 -1
- package/dest/deploy_aztec_l1_contracts.d.ts +259 -0
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
- package/dest/deploy_aztec_l1_contracts.js +413 -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/eth-signer/eth-signer.d.ts +1 -1
- package/dest/eth-signer/index.d.ts +1 -1
- 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/generated/l1-contracts-defaults.d.ts +30 -0
- package/dest/generated/l1-contracts-defaults.d.ts.map +1 -0
- package/dest/generated/l1-contracts-defaults.js +30 -0
- package/dest/l1_artifacts.d.ts +11884 -1956
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_contract_addresses.d.ts +3 -3
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +3 -3
- package/dest/l1_reader.d.ts +3 -1
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +6 -0
- package/dest/l1_tx_utils/config.d.ts +11 -5
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +45 -9
- 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 +233 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +15 -6
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +64 -17
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +19 -17
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +69 -40
- package/dest/l1_tx_utils/signer.d.ts +1 -1
- package/dest/l1_tx_utils/tx_delayer.d.ts +56 -0
- package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
- package/dest/{test → l1_tx_utils}/tx_delayer.js +65 -36
- package/dest/l1_tx_utils/types.d.ts +1 -1
- package/dest/l1_tx_utils/types.d.ts.map +1 -1
- package/dest/l1_tx_utils/utils.d.ts +1 -1
- package/dest/l1_types.d.ts +1 -1
- package/dest/publisher_manager.d.ts +3 -2
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +2 -2
- package/dest/queries.d.ts +2 -2
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +16 -6
- package/dest/test/chain_monitor.d.ts +27 -24
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +33 -36
- package/dest/test/eth_cheat_codes.d.ts +11 -3
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +11 -3
- package/dest/test/eth_cheat_codes_with_state.d.ts +1 -1
- package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
- package/dest/test/index.d.ts +1 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +0 -2
- package/dest/test/rollup_cheat_codes.d.ts +17 -13
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +62 -38
- package/dest/test/start_anvil.d.ts +4 -1
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +3 -2
- package/dest/test/upgrade_utils.d.ts +1 -1
- 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 +16 -3
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +64 -0
- package/dest/zkPassportVerifierAddress.d.ts +1 -1
- package/package.json +34 -14
- package/src/client.ts +2 -2
- package/src/config.ts +74 -424
- package/src/contracts/README.md +157 -0
- package/src/contracts/empire_base.ts +8 -5
- package/src/contracts/empire_slashing_proposer.ts +38 -32
- package/src/contracts/fee_asset_handler.ts +10 -7
- package/src/contracts/fee_asset_price_oracle.ts +280 -0
- package/src/contracts/governance.ts +13 -4
- package/src/contracts/governance_proposer.ts +26 -6
- package/src/contracts/inbox.ts +55 -3
- package/src/contracts/index.ts +3 -0
- package/src/contracts/log.ts +13 -0
- package/src/contracts/multicall.ts +5 -2
- package/src/contracts/outbox.ts +98 -0
- package/src/contracts/rollup.ts +432 -167
- package/src/contracts/tally_slashing_proposer.ts +15 -8
- package/src/deploy_aztec_l1_contracts.ts +650 -0
- package/src/deploy_l1_contract.ts +362 -0
- package/src/forwarder_proxy.ts +108 -0
- package/src/generated/l1-contracts-defaults.ts +32 -0
- package/src/l1_contract_addresses.ts +22 -20
- package/src/l1_reader.ts +8 -0
- package/src/l1_tx_utils/config.ts +54 -13
- 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 +803 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +76 -21
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +92 -45
- package/src/{test → l1_tx_utils}/tx_delayer.ts +82 -52
- package/src/publisher_manager.ts +4 -2
- package/src/queries.ts +17 -6
- package/src/test/chain_monitor.ts +51 -49
- package/src/test/eth_cheat_codes.ts +9 -3
- package/src/test/index.ts +0 -2
- package/src/test/rollup_cheat_codes.ts +63 -43
- package/src/test/start_anvil.ts +5 -1
- package/src/test/upgrade_utils.ts +2 -2
- package/src/types.ts +62 -0
- package/src/utils.ts +83 -1
- package/dest/deploy_l1_contracts.d.ts +0 -226
- package/dest/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/deploy_l1_contracts.js +0 -1460
- 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/deploy_l1_contracts.ts +0 -1838
- 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/src/config.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type ConfigMappingsType,
|
|
3
|
-
type NetworkNames,
|
|
4
3
|
bigintConfigHelper,
|
|
5
4
|
booleanConfigHelper,
|
|
6
5
|
enumConfigHelper,
|
|
7
6
|
getConfigFromMappings,
|
|
7
|
+
getDefaultConfig,
|
|
8
8
|
numberConfigHelper,
|
|
9
|
+
omitConfigMappings,
|
|
9
10
|
optionalNumberConfigHelper,
|
|
10
11
|
} from '@aztec/foundation/config';
|
|
11
12
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
13
|
|
|
13
|
-
import {
|
|
14
|
+
import { l1ContractsDefaultEnv } from './generated/l1-contracts-defaults.js';
|
|
15
|
+
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils/config.js';
|
|
14
16
|
|
|
15
17
|
export type GenesisStateConfig = {
|
|
16
18
|
/** Whether to populate the genesis state with initial fee juice for the test accounts */
|
|
@@ -29,7 +31,11 @@ export type L1ContractsConfig = {
|
|
|
29
31
|
/** The target validator committee size. */
|
|
30
32
|
aztecTargetCommitteeSize: number;
|
|
31
33
|
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
32
|
-
|
|
34
|
+
lagInEpochsForValidatorSet: number;
|
|
35
|
+
/** The number of epochs to lag behind the current epoch for randao selection. */
|
|
36
|
+
lagInEpochsForRandao: number;
|
|
37
|
+
/** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
|
|
38
|
+
inboxLag: number;
|
|
33
39
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
34
40
|
aztecProofSubmissionEpochs: number;
|
|
35
41
|
/** The deposit amount for a validator */
|
|
@@ -64,278 +70,108 @@ export type L1ContractsConfig = {
|
|
|
64
70
|
governanceProposerQuorum?: number;
|
|
65
71
|
/** Governance proposing round size */
|
|
66
72
|
governanceProposerRoundSize: number;
|
|
73
|
+
/** Governance voting duration in seconds (only for local/devnet/next-net, default 3600) */
|
|
74
|
+
governanceVotingDuration?: number;
|
|
67
75
|
/** The mana target for the rollup */
|
|
68
76
|
manaTarget: bigint;
|
|
69
77
|
/** The proving cost per mana */
|
|
70
78
|
provingCostPerMana: bigint;
|
|
79
|
+
/** The initial ETH per fee asset price (with 1e12 precision) */
|
|
80
|
+
initialEthPerFeeAsset: bigint;
|
|
71
81
|
/** The number of seconds to wait for an exit */
|
|
72
82
|
exitDelaySeconds: number;
|
|
73
83
|
} & L1TxUtilsConfig;
|
|
74
84
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
lagInEpochs: 2,
|
|
81
|
-
aztecProofSubmissionEpochs: 1, // you have a full epoch to submit a proof after the epoch to prove ends
|
|
82
|
-
activationThreshold: 100n * 10n ** 18n,
|
|
83
|
-
ejectionThreshold: 50n * 10n ** 18n,
|
|
84
|
-
localEjectionThreshold: 98n * 10n ** 18n,
|
|
85
|
-
slashAmountSmall: 10n * 10n ** 18n,
|
|
86
|
-
slashAmountMedium: 20n * 10n ** 18n,
|
|
87
|
-
slashAmountLarge: 50n * 10n ** 18n,
|
|
88
|
-
slashingRoundSizeInEpochs: 4,
|
|
89
|
-
slashingLifetimeInRounds: 5,
|
|
90
|
-
slashingExecutionDelayInRounds: 0, // round N may be submitted in round N + 1
|
|
91
|
-
slashingVetoer: EthAddress.ZERO,
|
|
92
|
-
governanceProposerRoundSize: 300,
|
|
93
|
-
manaTarget: BigInt(1e10),
|
|
94
|
-
provingCostPerMana: BigInt(100),
|
|
95
|
-
exitDelaySeconds: 2 * 24 * 60 * 60,
|
|
96
|
-
slasherFlavor: 'tally' as const,
|
|
97
|
-
slashingOffsetInRounds: 2,
|
|
98
|
-
slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
|
|
99
|
-
} satisfies L1ContractsConfig;
|
|
100
|
-
|
|
101
|
-
const LocalGovernanceConfiguration = {
|
|
102
|
-
proposeConfig: {
|
|
103
|
-
lockDelay: 60n * 60n * 24n * 30n,
|
|
104
|
-
lockAmount: 1n * 10n ** 24n,
|
|
105
|
-
},
|
|
106
|
-
votingDelay: 60n,
|
|
107
|
-
votingDuration: 60n * 60n,
|
|
108
|
-
executionDelay: 60n,
|
|
109
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
110
|
-
quorum: 1n * 10n ** 17n, // 10%
|
|
111
|
-
requiredYeaMargin: 4n * 10n ** 16n, // 4%
|
|
112
|
-
minimumVotes: 400n * 10n ** 18n,
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const StagingPublicGovernanceConfiguration = {
|
|
116
|
-
proposeConfig: {
|
|
117
|
-
lockDelay: 60n * 60n * 24n * 30n,
|
|
118
|
-
lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n,
|
|
119
|
-
},
|
|
120
|
-
votingDelay: 60n,
|
|
121
|
-
votingDuration: 60n * 60n,
|
|
122
|
-
executionDelay: 60n,
|
|
123
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
124
|
-
quorum: 3n * 10n ** 17n, // 30%
|
|
125
|
-
requiredYeaMargin: 4n * 10n ** 16n, // 4%
|
|
126
|
-
minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n, // >= 200 validators must vote
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const TestnetGovernanceConfiguration = {
|
|
130
|
-
proposeConfig: {
|
|
131
|
-
lockDelay: 10n * 365n * 24n * 60n * 60n,
|
|
132
|
-
lockAmount: 1250n * 200_000n * 10n ** 18n,
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
votingDelay: 12n * 60n * 60n, // 12 hours
|
|
136
|
-
votingDuration: 1n * 24n * 60n * 60n, // 1 day
|
|
137
|
-
executionDelay: 12n * 60n * 60n, // 12 hours
|
|
138
|
-
gracePeriod: 1n * 24n * 60n * 60n, // 1 day
|
|
139
|
-
quorum: 2n * 10n ** 17n, // 20%
|
|
140
|
-
requiredYeaMargin: 1n * 10n ** 17n, // 10%
|
|
141
|
-
minimumVotes: 1250n * 200_000n * 10n ** 18n,
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const StagingIgnitionGovernanceConfiguration = {
|
|
145
|
-
proposeConfig: {
|
|
146
|
-
lockDelay: 10n * 365n * 24n * 60n * 60n,
|
|
147
|
-
lockAmount: 1250n * 200_000n * 10n ** 18n,
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
votingDelay: 7n * 24n * 60n * 60n,
|
|
151
|
-
votingDuration: 7n * 24n * 60n * 60n,
|
|
152
|
-
executionDelay: 30n * 24n * 60n * 60n,
|
|
153
|
-
gracePeriod: 7n * 24n * 60n * 60n,
|
|
154
|
-
quorum: 2n * 10n ** 17n, // 20%
|
|
155
|
-
requiredYeaMargin: 1n * 10n ** 17n, // 10%
|
|
156
|
-
minimumVotes: 1250n * 200_000n * 10n ** 18n,
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export const getGovernanceConfiguration = (networkName: NetworkNames) => {
|
|
160
|
-
switch (networkName) {
|
|
161
|
-
case 'local':
|
|
162
|
-
return LocalGovernanceConfiguration;
|
|
163
|
-
case 'next-net':
|
|
164
|
-
return LocalGovernanceConfiguration;
|
|
165
|
-
case 'devnet':
|
|
166
|
-
return LocalGovernanceConfiguration;
|
|
167
|
-
case 'staging-public':
|
|
168
|
-
return StagingPublicGovernanceConfiguration;
|
|
169
|
-
case 'testnet':
|
|
170
|
-
return TestnetGovernanceConfiguration;
|
|
171
|
-
case 'staging-ignition':
|
|
172
|
-
return StagingIgnitionGovernanceConfiguration;
|
|
173
|
-
default:
|
|
174
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
// Making a default config here as we are only using it thought the deployment
|
|
179
|
-
// and do not expect to be using different setups, so having environment variables
|
|
180
|
-
// for it seems overkill
|
|
181
|
-
|
|
182
|
-
const DefaultRewardConfig = {
|
|
183
|
-
sequencerBps: 8000,
|
|
184
|
-
rewardDistributor: EthAddress.ZERO.toString(),
|
|
185
|
-
booster: EthAddress.ZERO.toString(),
|
|
186
|
-
blockReward: 500n * 10n ** 18n,
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
export const getRewardConfig = (networkName: NetworkNames) => {
|
|
190
|
-
switch (networkName) {
|
|
191
|
-
case 'local':
|
|
192
|
-
case 'devnet':
|
|
193
|
-
case 'next-net':
|
|
194
|
-
case 'staging-public':
|
|
195
|
-
case 'testnet':
|
|
196
|
-
case 'staging-ignition':
|
|
197
|
-
return DefaultRewardConfig;
|
|
198
|
-
default:
|
|
199
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
export const getRewardBoostConfig = () => {
|
|
204
|
-
// The reward configuration is specified with a precision of 1e5, and we use the same across
|
|
205
|
-
// all networks.
|
|
206
|
-
return {
|
|
207
|
-
increment: 125000, // 1.25
|
|
208
|
-
maxScore: 15000000, // 150
|
|
209
|
-
a: 1000, // 0.01
|
|
210
|
-
k: 1000000, // 10
|
|
211
|
-
minimum: 100000, // 1
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
// Similar to the above, no need for environment variables for this.
|
|
216
|
-
const LocalEntryQueueConfig = {
|
|
217
|
-
bootstrapValidatorSetSize: 0n,
|
|
218
|
-
bootstrapFlushSize: 0n,
|
|
219
|
-
normalFlushSizeMin: 48n,
|
|
220
|
-
normalFlushSizeQuotient: 2n,
|
|
221
|
-
maxQueueFlushSize: 48n,
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
const StagingPublicEntryQueueConfig = {
|
|
225
|
-
bootstrapValidatorSetSize: 48n,
|
|
226
|
-
bootstrapFlushSize: 48n,
|
|
227
|
-
normalFlushSizeMin: 1n,
|
|
228
|
-
normalFlushSizeQuotient: 2475n,
|
|
229
|
-
maxQueueFlushSize: 32n, // Limited to 32 so flush cost are kept below 15M gas.
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
const TestnetEntryQueueConfig = {
|
|
233
|
-
bootstrapValidatorSetSize: 750n,
|
|
234
|
-
bootstrapFlushSize: 32n,
|
|
235
|
-
normalFlushSizeMin: 32n,
|
|
236
|
-
normalFlushSizeQuotient: 2475n,
|
|
237
|
-
maxQueueFlushSize: 32n,
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
const StagingIgnitionEntryQueueConfig = {
|
|
241
|
-
bootstrapValidatorSetSize: 48n,
|
|
242
|
-
bootstrapFlushSize: 48n,
|
|
243
|
-
normalFlushSizeMin: 1n,
|
|
244
|
-
normalFlushSizeQuotient: 2048n,
|
|
245
|
-
maxQueueFlushSize: 24n,
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
export const getEntryQueueConfig = (networkName: NetworkNames) => {
|
|
249
|
-
switch (networkName) {
|
|
250
|
-
case 'local':
|
|
251
|
-
return LocalEntryQueueConfig;
|
|
252
|
-
case 'next-net':
|
|
253
|
-
return LocalEntryQueueConfig;
|
|
254
|
-
case 'devnet':
|
|
255
|
-
return LocalEntryQueueConfig;
|
|
256
|
-
case 'staging-public':
|
|
257
|
-
return StagingPublicEntryQueueConfig;
|
|
258
|
-
case 'testnet':
|
|
259
|
-
return TestnetEntryQueueConfig;
|
|
260
|
-
case 'staging-ignition':
|
|
261
|
-
return StagingIgnitionEntryQueueConfig;
|
|
262
|
-
default:
|
|
263
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Config mappings for L1ContractsConfig.
|
|
87
|
+
* Default values come from generated l1-contracts-defaults.json (source: defaults.yml).
|
|
88
|
+
* Real deployments use forge scripts which require explicit env vars (vm.envUint).
|
|
89
|
+
*/
|
|
267
90
|
export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> = {
|
|
268
91
|
ethereumSlotDuration: {
|
|
269
92
|
env: 'ETHEREUM_SLOT_DURATION',
|
|
270
93
|
description: 'How many seconds an L1 slot lasts.',
|
|
271
|
-
...numberConfigHelper(
|
|
94
|
+
...numberConfigHelper(l1ContractsDefaultEnv.ETHEREUM_SLOT_DURATION),
|
|
272
95
|
},
|
|
273
96
|
aztecSlotDuration: {
|
|
274
97
|
env: 'AZTEC_SLOT_DURATION',
|
|
275
98
|
description: 'How many seconds an L2 slots lasts (must be multiple of ethereum slot duration).',
|
|
276
|
-
...numberConfigHelper(
|
|
99
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLOT_DURATION),
|
|
277
100
|
},
|
|
278
101
|
aztecEpochDuration: {
|
|
279
102
|
env: 'AZTEC_EPOCH_DURATION',
|
|
280
|
-
description: `How many L2 slots an epoch lasts (maximum
|
|
281
|
-
...numberConfigHelper(
|
|
103
|
+
description: `How many L2 slots an epoch lasts (maximum MAX_CHECKPOINTS_PER_EPOCH).`,
|
|
104
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EPOCH_DURATION),
|
|
282
105
|
},
|
|
283
106
|
aztecTargetCommitteeSize: {
|
|
284
107
|
env: 'AZTEC_TARGET_COMMITTEE_SIZE',
|
|
285
108
|
description: 'The target validator committee size.',
|
|
286
|
-
...numberConfigHelper(
|
|
109
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_TARGET_COMMITTEE_SIZE),
|
|
287
110
|
},
|
|
288
|
-
|
|
289
|
-
env: '
|
|
111
|
+
lagInEpochsForValidatorSet: {
|
|
112
|
+
env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
|
|
290
113
|
description: 'The number of epochs to lag behind the current epoch for validator selection.',
|
|
291
|
-
...numberConfigHelper(
|
|
114
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET),
|
|
115
|
+
},
|
|
116
|
+
lagInEpochsForRandao: {
|
|
117
|
+
env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
|
|
118
|
+
description: 'The number of epochs to lag behind the current epoch for randao selection.',
|
|
119
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_LAG_IN_EPOCHS_FOR_RANDAO),
|
|
120
|
+
},
|
|
121
|
+
inboxLag: {
|
|
122
|
+
env: 'AZTEC_INBOX_LAG',
|
|
123
|
+
description: 'The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks).',
|
|
124
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_INBOX_LAG),
|
|
292
125
|
},
|
|
293
126
|
aztecProofSubmissionEpochs: {
|
|
294
127
|
env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
|
|
295
128
|
description: 'The number of epochs after an epoch ends that proofs are still accepted.',
|
|
296
|
-
...numberConfigHelper(
|
|
129
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_PROOF_SUBMISSION_EPOCHS),
|
|
297
130
|
},
|
|
298
131
|
activationThreshold: {
|
|
299
132
|
env: 'AZTEC_ACTIVATION_THRESHOLD',
|
|
300
133
|
description: 'The deposit amount for a validator',
|
|
301
|
-
...bigintConfigHelper(
|
|
134
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_ACTIVATION_THRESHOLD)),
|
|
302
135
|
},
|
|
303
136
|
ejectionThreshold: {
|
|
304
137
|
env: 'AZTEC_EJECTION_THRESHOLD',
|
|
305
138
|
description: 'The minimum stake for a validator.',
|
|
306
|
-
...bigintConfigHelper(
|
|
139
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_EJECTION_THRESHOLD)),
|
|
307
140
|
},
|
|
308
141
|
localEjectionThreshold: {
|
|
309
142
|
env: 'AZTEC_LOCAL_EJECTION_THRESHOLD',
|
|
310
143
|
description:
|
|
311
144
|
'The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup',
|
|
312
|
-
...bigintConfigHelper(
|
|
145
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_LOCAL_EJECTION_THRESHOLD)),
|
|
313
146
|
},
|
|
314
147
|
slashingOffsetInRounds: {
|
|
315
148
|
env: 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
|
|
316
149
|
description:
|
|
317
150
|
'How many slashing rounds back we slash (ie when slashing in round N, we slash for offenses committed during epochs of round N-offset)',
|
|
318
|
-
...numberConfigHelper(
|
|
151
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_OFFSET_IN_ROUNDS),
|
|
319
152
|
},
|
|
320
153
|
slasherFlavor: {
|
|
321
154
|
env: 'AZTEC_SLASHER_FLAVOR',
|
|
322
155
|
description: 'Type of slasher proposer (empire, tally, or none)',
|
|
323
|
-
...enumConfigHelper(
|
|
156
|
+
...enumConfigHelper(
|
|
157
|
+
['empire', 'tally', 'none'] as const,
|
|
158
|
+
l1ContractsDefaultEnv.AZTEC_SLASHER_FLAVOR as 'empire' | 'tally' | 'none',
|
|
159
|
+
),
|
|
324
160
|
},
|
|
325
161
|
slashAmountSmall: {
|
|
326
162
|
env: 'AZTEC_SLASH_AMOUNT_SMALL',
|
|
327
163
|
description: 'Small slashing amount for light offenses',
|
|
328
|
-
...bigintConfigHelper(
|
|
164
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_SMALL)),
|
|
329
165
|
},
|
|
330
166
|
slashAmountMedium: {
|
|
331
167
|
env: 'AZTEC_SLASH_AMOUNT_MEDIUM',
|
|
332
168
|
description: 'Medium slashing amount for moderate offenses',
|
|
333
|
-
...bigintConfigHelper(
|
|
169
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_MEDIUM)),
|
|
334
170
|
},
|
|
335
171
|
slashAmountLarge: {
|
|
336
172
|
env: 'AZTEC_SLASH_AMOUNT_LARGE',
|
|
337
173
|
description: 'Large slashing amount for severe offenses',
|
|
338
|
-
...bigintConfigHelper(
|
|
174
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_LARGE)),
|
|
339
175
|
},
|
|
340
176
|
slashingQuorum: {
|
|
341
177
|
env: 'AZTEC_SLASHING_QUORUM',
|
|
@@ -345,28 +181,28 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
345
181
|
slashingRoundSizeInEpochs: {
|
|
346
182
|
env: 'AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS',
|
|
347
183
|
description: 'The slashing round size',
|
|
348
|
-
...numberConfigHelper(
|
|
184
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS),
|
|
349
185
|
},
|
|
350
186
|
slashingLifetimeInRounds: {
|
|
351
187
|
env: 'AZTEC_SLASHING_LIFETIME_IN_ROUNDS',
|
|
352
188
|
description: 'The slashing lifetime in rounds',
|
|
353
|
-
...numberConfigHelper(
|
|
189
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_LIFETIME_IN_ROUNDS),
|
|
354
190
|
},
|
|
355
191
|
slashingExecutionDelayInRounds: {
|
|
356
192
|
env: 'AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS',
|
|
357
193
|
description: 'The slashing execution delay in rounds',
|
|
358
|
-
...numberConfigHelper(
|
|
194
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS),
|
|
359
195
|
},
|
|
360
196
|
slashingVetoer: {
|
|
361
197
|
env: 'AZTEC_SLASHING_VETOER',
|
|
362
198
|
description: 'The slashing vetoer',
|
|
363
199
|
parseEnv: (val: string) => EthAddress.fromString(val),
|
|
364
|
-
defaultValue:
|
|
200
|
+
defaultValue: EthAddress.fromString(l1ContractsDefaultEnv.AZTEC_SLASHING_VETOER),
|
|
365
201
|
},
|
|
366
202
|
slashingDisableDuration: {
|
|
367
203
|
env: 'AZTEC_SLASHING_DISABLE_DURATION',
|
|
368
204
|
description: 'How long slashing can be disabled for in seconds when vetoer disables it',
|
|
369
|
-
...numberConfigHelper(
|
|
205
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_DISABLE_DURATION),
|
|
370
206
|
},
|
|
371
207
|
governanceProposerQuorum: {
|
|
372
208
|
env: 'AZTEC_GOVERNANCE_PROPOSER_QUORUM',
|
|
@@ -376,26 +212,42 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
376
212
|
governanceProposerRoundSize: {
|
|
377
213
|
env: 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE',
|
|
378
214
|
description: 'The governance proposing round size',
|
|
379
|
-
...numberConfigHelper(
|
|
215
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE),
|
|
216
|
+
},
|
|
217
|
+
governanceVotingDuration: {
|
|
218
|
+
env: 'AZTEC_GOVERNANCE_VOTING_DURATION',
|
|
219
|
+
description: 'Governance voting duration in seconds (only for local/devnet/next-net)',
|
|
220
|
+
...numberConfigHelper(3600), // 1 hour default, not in generated defaults as it's deployment-time only
|
|
380
221
|
},
|
|
381
222
|
manaTarget: {
|
|
382
223
|
env: 'AZTEC_MANA_TARGET',
|
|
383
224
|
description: 'The mana target for the rollup',
|
|
384
|
-
...bigintConfigHelper(
|
|
225
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_MANA_TARGET)),
|
|
385
226
|
},
|
|
386
227
|
provingCostPerMana: {
|
|
387
228
|
env: 'AZTEC_PROVING_COST_PER_MANA',
|
|
388
229
|
description: 'The proving cost per mana',
|
|
389
|
-
...bigintConfigHelper(
|
|
230
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_PROVING_COST_PER_MANA)),
|
|
231
|
+
},
|
|
232
|
+
initialEthPerFeeAsset: {
|
|
233
|
+
env: 'AZTEC_INITIAL_ETH_PER_FEE_ASSET',
|
|
234
|
+
description: 'The initial ETH per fee asset price (with 1e12 precision)',
|
|
235
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_INITIAL_ETH_PER_FEE_ASSET)),
|
|
390
236
|
},
|
|
391
237
|
exitDelaySeconds: {
|
|
392
238
|
env: 'AZTEC_EXIT_DELAY_SECONDS',
|
|
393
239
|
description: 'The delay before a validator can exit the set',
|
|
394
|
-
...numberConfigHelper(
|
|
240
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EXIT_DELAY_SECONDS),
|
|
395
241
|
},
|
|
396
|
-
...l1TxUtilsConfigMappings,
|
|
242
|
+
...omitConfigMappings(l1TxUtilsConfigMappings, ['ethereumSlotDuration']),
|
|
397
243
|
};
|
|
398
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Default L1 contracts configuration derived from l1ContractsConfigMappings.
|
|
247
|
+
* Source of truth: spartan/environments/defaults.yml -> defaults.l1-contracts
|
|
248
|
+
*/
|
|
249
|
+
export const DefaultL1ContractsConfig = getDefaultConfig(l1ContractsConfigMappings);
|
|
250
|
+
|
|
399
251
|
export const genesisStateConfigMappings: ConfigMappingsType<GenesisStateConfig> = {
|
|
400
252
|
testAccounts: {
|
|
401
253
|
env: 'TEST_ACCOUNTS',
|
|
@@ -416,205 +268,3 @@ export function getL1ContractsConfigEnvVars(): L1ContractsConfig {
|
|
|
416
268
|
export function getGenesisStateConfigEnvVars(): GenesisStateConfig {
|
|
417
269
|
return getConfigFromMappings(genesisStateConfigMappings);
|
|
418
270
|
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Validates the L1 contracts configuration to ensure all requirements enforced by L1 contracts
|
|
422
|
-
* during construction are satisfied before deployment.
|
|
423
|
-
* Accumulates all validation errors and throws an exception listing them all if any are found.
|
|
424
|
-
*/
|
|
425
|
-
export function validateConfig(config: Omit<L1ContractsConfig, keyof L1TxUtilsConfig>): void {
|
|
426
|
-
const errors: string[] = [];
|
|
427
|
-
|
|
428
|
-
// RollupCore constructor validation: normalFlushSizeMin > 0
|
|
429
|
-
// From: require(_config.stakingQueueConfig.normalFlushSizeMin > 0, Errors.Staking__InvalidStakingQueueConfig());
|
|
430
|
-
const entryQueueConfig = getEntryQueueConfig('testnet'); // Get config to check normalFlushSizeMin
|
|
431
|
-
if (entryQueueConfig.normalFlushSizeMin <= 0n) {
|
|
432
|
-
errors.push('normalFlushSizeMin must be greater than 0');
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
// TimeLib initialization validation: aztecSlotDuration should be a multiple of ethereumSlotDuration
|
|
436
|
-
// While not explicitly required in constructor, this is a common validation for time-based systems
|
|
437
|
-
if (config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
|
|
438
|
-
errors.push(
|
|
439
|
-
`aztecSlotDuration (${config.aztecSlotDuration}) must be a multiple of ethereumSlotDuration (${config.ethereumSlotDuration})`,
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
// EmpireBase constructor validations for governance/slashing proposers
|
|
444
|
-
// From: require(QUORUM_SIZE > ROUND_SIZE / 2, Errors.EmpireBase__InvalidQuorumAndRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
445
|
-
const { governanceProposerQuorum, governanceProposerRoundSize } = config;
|
|
446
|
-
if (
|
|
447
|
-
governanceProposerQuorum !== undefined &&
|
|
448
|
-
governanceProposerQuorum <= Math.floor(governanceProposerRoundSize / 2)
|
|
449
|
-
) {
|
|
450
|
-
errors.push(
|
|
451
|
-
`governanceProposerQuorum (${governanceProposerQuorum}) must be greater than half of governanceProposerRoundSize (${Math.floor(governanceProposerRoundSize / 2)})`,
|
|
452
|
-
);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// From: require(QUORUM_SIZE <= ROUND_SIZE, Errors.EmpireBase__QuorumCannotBeLargerThanRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
456
|
-
if (governanceProposerQuorum !== undefined && governanceProposerQuorum > governanceProposerRoundSize) {
|
|
457
|
-
errors.push(
|
|
458
|
-
`governanceProposerQuorum (${governanceProposerQuorum}) cannot be larger than governanceProposerRoundSize (${governanceProposerRoundSize})`,
|
|
459
|
-
);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
// Slashing quorum validations (similar to governance quorum)
|
|
463
|
-
const slashingRoundSize = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
464
|
-
const { slashingQuorum } = config;
|
|
465
|
-
if (slashingQuorum !== undefined && slashingQuorum <= Math.floor(slashingRoundSize / 2)) {
|
|
466
|
-
errors.push(
|
|
467
|
-
`slashingQuorum (${slashingQuorum}) must be greater than half of slashingRoundSizeInEpochs (${Math.floor(slashingRoundSize / 2)})`,
|
|
468
|
-
);
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
if (slashingQuorum !== undefined && slashingQuorum > slashingRoundSize) {
|
|
472
|
-
errors.push(
|
|
473
|
-
`slashingQuorum (${slashingQuorum}) cannot be larger than slashingRoundSizeInEpochs (${slashingRoundSize})`,
|
|
474
|
-
);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
// EmpireBase and TallySlashingProposer lifetime and execution delay validation
|
|
478
|
-
// From: require(LIFETIME_IN_ROUNDS > EXECUTION_DELAY_IN_ROUNDS);
|
|
479
|
-
if (config.slashingLifetimeInRounds <= config.slashingExecutionDelayInRounds) {
|
|
480
|
-
errors.push(
|
|
481
|
-
`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be greater than slashingExecutionDelayInRounds (${config.slashingExecutionDelayInRounds})`,
|
|
482
|
-
);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// Staking asset validation: activationThreshold > ejectionThreshold
|
|
486
|
-
if (config.activationThreshold < config.ejectionThreshold) {
|
|
487
|
-
errors.push(
|
|
488
|
-
`activationThreshold (${config.activationThreshold}) must be greater than ejectionThreshold (${config.ejectionThreshold})`,
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
// TallySlashingProposer constructor validations
|
|
493
|
-
if (config.slasherFlavor === 'tally') {
|
|
494
|
-
validateTallySlasherConfig(config, errors);
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
// Epoch and slot duration validations
|
|
498
|
-
if (config.aztecSlotDuration <= 0) {
|
|
499
|
-
errors.push('aztecSlotDuration must be greater than 0');
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
if (config.ethereumSlotDuration <= 0) {
|
|
503
|
-
errors.push('ethereumSlotDuration must be greater than 0');
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
if (config.aztecEpochDuration <= 0) {
|
|
507
|
-
errors.push('aztecEpochDuration must be greater than 0');
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
// Committee size validation
|
|
511
|
-
if (config.aztecTargetCommitteeSize < 0) {
|
|
512
|
-
errors.push('aztecTargetCommitteeSize cannot be negative');
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
// Proof submission epochs validation
|
|
516
|
-
if (config.aztecProofSubmissionEpochs < 0) {
|
|
517
|
-
errors.push('aztecProofSubmissionEpochs cannot be negative');
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
// Exit delay validation
|
|
521
|
-
if (config.exitDelaySeconds < 0) {
|
|
522
|
-
errors.push('exitDelaySeconds cannot be negative');
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
// Mana validation
|
|
526
|
-
if (config.manaTarget < 0n) {
|
|
527
|
-
errors.push('manaTarget cannot be negative');
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
if (config.provingCostPerMana < 0n) {
|
|
531
|
-
errors.push('provingCostPerMana cannot be negative');
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
// If any errors were found, throw an exception with all of them
|
|
535
|
-
if (errors.length > 0) {
|
|
536
|
-
throw new Error(
|
|
537
|
-
`L1 contracts configuration validation failed with ${errors.length} error(s):\n${errors.map((error, index) => `${index + 1}. ${error}`).join('\n')}`,
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
function validateTallySlasherConfig(config: L1ContractsConfig, errors: string[]) {
|
|
543
|
-
if (config.slasherFlavor !== 'tally') {
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
// From: require(SLASH_OFFSET_IN_ROUNDS > 0, Errors.TallySlashingProposer__SlashOffsetMustBeGreaterThanZero(...));
|
|
548
|
-
if (config.slashingOffsetInRounds <= 0) {
|
|
549
|
-
errors.push(`slashingOffsetInRounds (${config.slashingOffsetInRounds}) must be greater than 0`);
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
// From: require(ROUND_SIZE_IN_EPOCHS * _epochDuration == ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeMustBeMultipleOfEpochDuration(...));
|
|
553
|
-
const roundSizeInSlots = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
554
|
-
|
|
555
|
-
// From: require(QUORUM > 0, Errors.TallySlashingProposer__QuorumMustBeGreaterThanZero());
|
|
556
|
-
const { slashingQuorum } = config;
|
|
557
|
-
if (slashingQuorum !== undefined && slashingQuorum <= 0) {
|
|
558
|
-
errors.push(`slashingQuorum (${slashingQuorum}) must be greater than 0`);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
// From: require(ROUND_SIZE > 1, Errors.TallySlashingProposer__InvalidQuorumAndRoundSize(QUORUM, ROUND_SIZE));
|
|
562
|
-
if (roundSizeInSlots <= 1) {
|
|
563
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be greater than 1`);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
// From: require(_slashAmounts[0] <= _slashAmounts[1], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
567
|
-
if (config.slashAmountSmall > config.slashAmountMedium) {
|
|
568
|
-
errors.push(
|
|
569
|
-
`slashAmountSmall (${config.slashAmountSmall}) must be less than or equal to slashAmountMedium (${config.slashAmountMedium})`,
|
|
570
|
-
);
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
// From: require(_slashAmounts[1] <= _slashAmounts[2], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
574
|
-
if (config.slashAmountMedium > config.slashAmountLarge) {
|
|
575
|
-
errors.push(
|
|
576
|
-
`slashAmountMedium (${config.slashAmountMedium}) must be less than or equal to slashAmountLarge (${config.slashAmountLarge})`,
|
|
577
|
-
);
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
// From: require(LIFETIME_IN_ROUNDS < ROUNDABOUT_SIZE, Errors.TallySlashingProposer__LifetimeMustBeLessThanRoundabout(...));
|
|
581
|
-
const ROUNDABOUT_SIZE = 128; // Constant from TallySlashingProposer
|
|
582
|
-
if (config.slashingLifetimeInRounds >= ROUNDABOUT_SIZE) {
|
|
583
|
-
errors.push(`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be less than ${ROUNDABOUT_SIZE}`);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
// From: require(ROUND_SIZE_IN_EPOCHS > 0, Errors.TallySlashingProposer__RoundSizeInEpochsMustBeGreaterThanZero(...));
|
|
587
|
-
if (config.slashingRoundSizeInEpochs <= 0) {
|
|
588
|
-
errors.push(`slashingRoundSizeInEpochs (${config.slashingRoundSizeInEpochs}) must be greater than 0`);
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
// From: require(ROUND_SIZE < MAX_ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeTooLarge(ROUND_SIZE, MAX_ROUND_SIZE));
|
|
592
|
-
const MAX_ROUND_SIZE = 1024; // Constant from TallySlashingProposer
|
|
593
|
-
if (roundSizeInSlots >= MAX_ROUND_SIZE) {
|
|
594
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be less than ${MAX_ROUND_SIZE}`);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
// From: require(COMMITTEE_SIZE > 0, Errors.TallySlashingProposer__CommitteeSizeMustBeGreaterThanZero(COMMITTEE_SIZE));
|
|
598
|
-
if (config.aztecTargetCommitteeSize <= 0) {
|
|
599
|
-
errors.push(`aztecTargetCommitteeSize (${config.aztecTargetCommitteeSize}) must be greater than 0`);
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
// From: require(voteSize <= 128, Errors.TallySlashingProposer__VoteSizeTooBig(voteSize, 128));
|
|
603
|
-
// voteSize = COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS / 4
|
|
604
|
-
const voteSize = (config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs) / 4;
|
|
605
|
-
if (voteSize > 128) {
|
|
606
|
-
errors.push(`vote size (${voteSize}) must be <= 128 (committee size * round size in epochs / 4)`);
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
// From: require(COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS % 4 == 0, Errors.TallySlashingProposer__InvalidCommitteeAndRoundSize(...));
|
|
610
|
-
if ((config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs) % 4 !== 0) {
|
|
611
|
-
errors.push(
|
|
612
|
-
`aztecTargetCommitteeSize * slashingRoundSizeInEpochs (${config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs}) must be divisible by 4`,
|
|
613
|
-
);
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
// Slashing offset validation: should be positive to allow proper slashing timing
|
|
617
|
-
if (config.slashingOffsetInRounds < 0) {
|
|
618
|
-
errors.push('slashingOffsetInRounds cannot be negative');
|
|
619
|
-
}
|
|
620
|
-
}
|