@aztec/ethereum 0.0.1-commit.24de95ac → 0.0.1-commit.2606882
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 +25 -3
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +60 -4
- package/dest/config.d.ts +29 -73
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +70 -387
- package/dest/constants.d.ts +1 -1
- 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 +7 -5
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +1 -1
- 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 +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/fee_juice.d.ts +1 -1
- package/dest/contracts/fee_juice.d.ts.map +1 -1
- package/dest/contracts/governance.d.ts +113 -36
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +207 -16
- package/dest/contracts/governance_proposer.d.ts +38 -4
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +455 -12
- 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 +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 +127 -12
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +201 -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 +5432 -131
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +1114 -231
- 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 → slashing_proposer.d.ts} +11 -10
- package/dest/contracts/slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/{tally_slashing_proposer.js → slashing_proposer.js} +21 -16
- package/dest/contracts/utils.d.ts +1 -1
- package/dest/deploy_aztec_l1_contracts.d.ts +256 -0
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
- package/dest/deploy_aztec_l1_contracts.js +411 -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 +19816 -16730
- 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 +11 -5
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +43 -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 +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 +26 -8
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +118 -70
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +19 -30
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +65 -168
- package/dest/l1_tx_utils/signer.d.ts +1 -1
- 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 +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 +21 -6
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +81 -7
- package/dest/queries.d.ts +14 -3
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +78 -9
- package/dest/test/chain_monitor.d.ts +48 -25
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +71 -38
- package/dest/test/eth_cheat_codes.d.ts +22 -6
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +28 -7
- 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 +46 -14
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +118 -42
- package/dest/test/start_anvil.d.ts +25 -2
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +143 -28
- 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 +24 -4
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +112 -16
- package/dest/zkPassportVerifierAddress.d.ts +1 -1
- package/package.json +35 -17
- package/src/client.ts +66 -2
- package/src/config.ts +91 -469
- package/src/contracts/README.md +157 -0
- package/src/contracts/chain_state_override.ts +200 -0
- package/src/contracts/empire_base.ts +6 -5
- 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 +74 -7
- 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 +243 -102
- package/src/contracts/outbox.ts +132 -0
- package/src/contracts/registry.ts +31 -1
- package/src/contracts/rollup.ts +819 -192
- package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +26 -21
- package/src/deploy_aztec_l1_contracts.ts +646 -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_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 +52 -11
- 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 +123 -52
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +79 -214
- package/src/{test → l1_tx_utils}/tx_delayer.ts +97 -58
- package/src/publisher_manager.ts +107 -10
- package/src/queries.ts +87 -10
- package/src/test/chain_monitor.ts +115 -51
- package/src/test/eth_cheat_codes.ts +25 -7
- package/src/test/index.ts +0 -2
- package/src/test/rollup_cheat_codes.ts +123 -45
- package/src/test/start_anvil.ts +179 -27
- 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 -65
- package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/empire_slashing_proposer.js +0 -194
- package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -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 -1473
- 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 -259
- package/src/deploy_l1_contracts.ts +0 -1849
- 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,287 +1,91 @@
|
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
aztecProofSubmissionEpochs: 1,
|
|
11
|
-
activationThreshold: 100n * 10n ** 18n,
|
|
12
|
-
ejectionThreshold: 50n * 10n ** 18n,
|
|
13
|
-
localEjectionThreshold: 98n * 10n ** 18n,
|
|
14
|
-
slashAmountSmall: 10n * 10n ** 18n,
|
|
15
|
-
slashAmountMedium: 20n * 10n ** 18n,
|
|
16
|
-
slashAmountLarge: 50n * 10n ** 18n,
|
|
17
|
-
slashingRoundSizeInEpochs: 4,
|
|
18
|
-
slashingLifetimeInRounds: 5,
|
|
19
|
-
slashingExecutionDelayInRounds: 0,
|
|
20
|
-
slashingVetoer: EthAddress.ZERO,
|
|
21
|
-
governanceProposerRoundSize: 300,
|
|
22
|
-
manaTarget: BigInt(1e10),
|
|
23
|
-
provingCostPerMana: BigInt(100),
|
|
24
|
-
exitDelaySeconds: 2 * 24 * 60 * 60,
|
|
25
|
-
slasherFlavor: 'tally',
|
|
26
|
-
slashingOffsetInRounds: 2,
|
|
27
|
-
slashingDisableDuration: 5 * 24 * 60 * 60
|
|
28
|
-
};
|
|
29
|
-
const LocalGovernanceConfiguration = {
|
|
30
|
-
proposeConfig: {
|
|
31
|
-
lockDelay: 60n * 60n * 24n * 30n,
|
|
32
|
-
lockAmount: 1n * 10n ** 24n
|
|
33
|
-
},
|
|
34
|
-
votingDelay: 60n,
|
|
35
|
-
votingDuration: 60n * 60n,
|
|
36
|
-
executionDelay: 60n,
|
|
37
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
38
|
-
quorum: 1n * 10n ** 17n,
|
|
39
|
-
requiredYeaMargin: 4n * 10n ** 16n,
|
|
40
|
-
minimumVotes: 400n * 10n ** 18n
|
|
41
|
-
};
|
|
42
|
-
const StagingPublicGovernanceConfiguration = {
|
|
43
|
-
proposeConfig: {
|
|
44
|
-
lockDelay: 60n * 60n * 24n * 30n,
|
|
45
|
-
lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n
|
|
46
|
-
},
|
|
47
|
-
votingDelay: 60n,
|
|
48
|
-
votingDuration: 60n * 60n,
|
|
49
|
-
executionDelay: 60n,
|
|
50
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
51
|
-
quorum: 3n * 10n ** 17n,
|
|
52
|
-
requiredYeaMargin: 4n * 10n ** 16n,
|
|
53
|
-
minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n
|
|
54
|
-
};
|
|
55
|
-
const TestnetGovernanceConfiguration = {
|
|
56
|
-
proposeConfig: {
|
|
57
|
-
lockDelay: 10n * 365n * 24n * 60n * 60n,
|
|
58
|
-
lockAmount: 1250n * 200_000n * 10n ** 18n
|
|
59
|
-
},
|
|
60
|
-
votingDelay: 12n * 60n * 60n,
|
|
61
|
-
votingDuration: 1n * 24n * 60n * 60n,
|
|
62
|
-
executionDelay: 12n * 60n * 60n,
|
|
63
|
-
gracePeriod: 1n * 24n * 60n * 60n,
|
|
64
|
-
quorum: 2n * 10n ** 17n,
|
|
65
|
-
requiredYeaMargin: 1n * 10n ** 17n,
|
|
66
|
-
minimumVotes: 100n * 200_000n * 10n ** 18n
|
|
67
|
-
};
|
|
68
|
-
const StagingIgnitionGovernanceConfiguration = {
|
|
69
|
-
proposeConfig: {
|
|
70
|
-
lockDelay: 10n * 365n * 24n * 60n * 60n,
|
|
71
|
-
lockAmount: 1250n * 200_000n * 10n ** 18n
|
|
72
|
-
},
|
|
73
|
-
votingDelay: 7n * 24n * 60n * 60n,
|
|
74
|
-
votingDuration: 7n * 24n * 60n * 60n,
|
|
75
|
-
executionDelay: 30n * 24n * 60n * 60n,
|
|
76
|
-
gracePeriod: 7n * 24n * 60n * 60n,
|
|
77
|
-
quorum: 2n * 10n ** 17n,
|
|
78
|
-
requiredYeaMargin: 1n * 10n ** 17n,
|
|
79
|
-
minimumVotes: 1250n * 200_000n * 10n ** 18n
|
|
80
|
-
};
|
|
81
|
-
const MainnetGovernanceConfiguration = {
|
|
82
|
-
proposeConfig: {
|
|
83
|
-
lockDelay: 90n * 24n * 60n * 60n,
|
|
84
|
-
lockAmount: 258_750_000n * 10n ** 18n
|
|
85
|
-
},
|
|
86
|
-
votingDelay: 3n * 24n * 60n * 60n,
|
|
87
|
-
votingDuration: 7n * 24n * 60n * 60n,
|
|
88
|
-
executionDelay: 7n * 24n * 60n * 60n,
|
|
89
|
-
gracePeriod: 7n * 24n * 60n * 60n,
|
|
90
|
-
quorum: 2n * 10n ** 17n,
|
|
91
|
-
requiredYeaMargin: 33n * 10n ** 16n,
|
|
92
|
-
minimumVotes: 1000n * 200_000n * 10n ** 18n
|
|
93
|
-
};
|
|
94
|
-
export const getGovernanceConfiguration = (networkName)=>{
|
|
95
|
-
switch(networkName){
|
|
96
|
-
case 'local':
|
|
97
|
-
return LocalGovernanceConfiguration;
|
|
98
|
-
case 'next-net':
|
|
99
|
-
return LocalGovernanceConfiguration;
|
|
100
|
-
case 'devnet':
|
|
101
|
-
return LocalGovernanceConfiguration;
|
|
102
|
-
case 'staging-public':
|
|
103
|
-
return StagingPublicGovernanceConfiguration;
|
|
104
|
-
case 'testnet':
|
|
105
|
-
return TestnetGovernanceConfiguration;
|
|
106
|
-
case 'staging-ignition':
|
|
107
|
-
return StagingIgnitionGovernanceConfiguration;
|
|
108
|
-
case 'mainnet':
|
|
109
|
-
return MainnetGovernanceConfiguration;
|
|
110
|
-
default:
|
|
111
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
// Making a default config here as we are only using it thought the deployment
|
|
115
|
-
// and do not expect to be using different setups, so having environment variables
|
|
116
|
-
// for it seems overkill
|
|
117
|
-
const DefaultRewardConfig = {
|
|
118
|
-
sequencerBps: 8000,
|
|
119
|
-
rewardDistributor: EthAddress.ZERO.toString(),
|
|
120
|
-
booster: EthAddress.ZERO.toString(),
|
|
121
|
-
blockReward: 500n * 10n ** 18n
|
|
122
|
-
};
|
|
123
|
-
const MainnetRewardConfig = {
|
|
124
|
-
sequencerBps: 7_000,
|
|
125
|
-
rewardDistributor: EthAddress.ZERO.toString(),
|
|
126
|
-
booster: EthAddress.ZERO.toString(),
|
|
127
|
-
blockReward: 400n * 10n ** 18n
|
|
128
|
-
};
|
|
129
|
-
export const getRewardConfig = (networkName)=>{
|
|
130
|
-
switch(networkName){
|
|
131
|
-
case 'local':
|
|
132
|
-
case 'devnet':
|
|
133
|
-
case 'next-net':
|
|
134
|
-
case 'staging-public':
|
|
135
|
-
case 'testnet':
|
|
136
|
-
case 'staging-ignition':
|
|
137
|
-
return DefaultRewardConfig;
|
|
138
|
-
case 'mainnet':
|
|
139
|
-
return MainnetRewardConfig;
|
|
140
|
-
default:
|
|
141
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
export const getRewardBoostConfig = ()=>{
|
|
145
|
-
// The reward configuration is specified with a precision of 1e5, and we use the same across
|
|
146
|
-
// all networks.
|
|
147
|
-
return {
|
|
148
|
-
increment: 125_000,
|
|
149
|
-
maxScore: 15_000_000,
|
|
150
|
-
a: 1_000,
|
|
151
|
-
k: 1_000_000,
|
|
152
|
-
minimum: 100_000
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
// Similar to the above, no need for environment variables for this.
|
|
156
|
-
const LocalEntryQueueConfig = {
|
|
157
|
-
bootstrapValidatorSetSize: 0n,
|
|
158
|
-
bootstrapFlushSize: 0n,
|
|
159
|
-
normalFlushSizeMin: 48n,
|
|
160
|
-
normalFlushSizeQuotient: 2n,
|
|
161
|
-
maxQueueFlushSize: 48n
|
|
162
|
-
};
|
|
163
|
-
const StagingPublicEntryQueueConfig = {
|
|
164
|
-
bootstrapValidatorSetSize: 48n,
|
|
165
|
-
bootstrapFlushSize: 48n,
|
|
166
|
-
normalFlushSizeMin: 1n,
|
|
167
|
-
normalFlushSizeQuotient: 2475n,
|
|
168
|
-
maxQueueFlushSize: 32n
|
|
169
|
-
};
|
|
170
|
-
const TestnetEntryQueueConfig = {
|
|
171
|
-
bootstrapValidatorSetSize: 256n,
|
|
172
|
-
bootstrapFlushSize: 256n,
|
|
173
|
-
normalFlushSizeMin: 4n,
|
|
174
|
-
normalFlushSizeQuotient: 2048n,
|
|
175
|
-
maxQueueFlushSize: 8n
|
|
176
|
-
};
|
|
177
|
-
const StagingIgnitionEntryQueueConfig = {
|
|
178
|
-
bootstrapValidatorSetSize: 48n,
|
|
179
|
-
bootstrapFlushSize: 48n,
|
|
180
|
-
normalFlushSizeMin: 1n,
|
|
181
|
-
normalFlushSizeQuotient: 2048n,
|
|
182
|
-
maxQueueFlushSize: 24n
|
|
183
|
-
};
|
|
184
|
-
const MainnetEntryQueueConfig = {
|
|
185
|
-
bootstrapValidatorSetSize: 1_000n,
|
|
186
|
-
bootstrapFlushSize: 1_000n,
|
|
187
|
-
normalFlushSizeMin: 1n,
|
|
188
|
-
normalFlushSizeQuotient: 2_048n,
|
|
189
|
-
maxQueueFlushSize: 8n
|
|
190
|
-
};
|
|
191
|
-
export const getEntryQueueConfig = (networkName)=>{
|
|
192
|
-
switch(networkName){
|
|
193
|
-
case 'local':
|
|
194
|
-
return LocalEntryQueueConfig;
|
|
195
|
-
case 'next-net':
|
|
196
|
-
return LocalEntryQueueConfig;
|
|
197
|
-
case 'devnet':
|
|
198
|
-
return LocalEntryQueueConfig;
|
|
199
|
-
case 'staging-public':
|
|
200
|
-
return StagingPublicEntryQueueConfig;
|
|
201
|
-
case 'testnet':
|
|
202
|
-
return TestnetEntryQueueConfig;
|
|
203
|
-
case 'staging-ignition':
|
|
204
|
-
return StagingIgnitionEntryQueueConfig;
|
|
205
|
-
case 'mainnet':
|
|
206
|
-
return MainnetEntryQueueConfig;
|
|
207
|
-
default:
|
|
208
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
export const l1ContractsConfigMappings = {
|
|
3
|
+
import { l1ContractsDefaultEnv } from './generated/l1-contracts-defaults.js';
|
|
4
|
+
import { l1TxUtilsConfigMappings } from './l1_tx_utils/config.js';
|
|
5
|
+
/**
|
|
6
|
+
* Config mappings for L1ContractsConfig.
|
|
7
|
+
* Default values come from generated l1-contracts-defaults.json (source: defaults.yml).
|
|
8
|
+
* Real deployments use forge scripts which require explicit env vars (vm.envUint).
|
|
9
|
+
*/ export const l1ContractsConfigMappings = {
|
|
212
10
|
ethereumSlotDuration: {
|
|
213
11
|
env: 'ETHEREUM_SLOT_DURATION',
|
|
214
12
|
description: 'How many seconds an L1 slot lasts.',
|
|
215
|
-
...numberConfigHelper(
|
|
13
|
+
...numberConfigHelper(l1ContractsDefaultEnv.ETHEREUM_SLOT_DURATION)
|
|
216
14
|
},
|
|
217
15
|
aztecSlotDuration: {
|
|
218
16
|
env: 'AZTEC_SLOT_DURATION',
|
|
219
17
|
description: 'How many seconds an L2 slots lasts (must be multiple of ethereum slot duration).',
|
|
220
|
-
...numberConfigHelper(
|
|
18
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLOT_DURATION)
|
|
221
19
|
},
|
|
222
20
|
aztecEpochDuration: {
|
|
223
21
|
env: 'AZTEC_EPOCH_DURATION',
|
|
224
|
-
description: `How many L2 slots an epoch lasts (maximum
|
|
225
|
-
...numberConfigHelper(
|
|
22
|
+
description: `How many L2 slots an epoch lasts (maximum MAX_CHECKPOINTS_PER_EPOCH).`,
|
|
23
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EPOCH_DURATION)
|
|
226
24
|
},
|
|
227
25
|
aztecTargetCommitteeSize: {
|
|
228
26
|
env: 'AZTEC_TARGET_COMMITTEE_SIZE',
|
|
229
27
|
description: 'The target validator committee size.',
|
|
230
|
-
...numberConfigHelper(
|
|
28
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_TARGET_COMMITTEE_SIZE)
|
|
231
29
|
},
|
|
232
|
-
|
|
233
|
-
env: '
|
|
30
|
+
lagInEpochsForValidatorSet: {
|
|
31
|
+
env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
|
|
234
32
|
description: 'The number of epochs to lag behind the current epoch for validator selection.',
|
|
235
|
-
...numberConfigHelper(
|
|
33
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET)
|
|
34
|
+
},
|
|
35
|
+
lagInEpochsForRandao: {
|
|
36
|
+
env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
|
|
37
|
+
description: 'The number of epochs to lag behind the current epoch for randao selection.',
|
|
38
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_LAG_IN_EPOCHS_FOR_RANDAO)
|
|
39
|
+
},
|
|
40
|
+
inboxLag: {
|
|
41
|
+
env: 'AZTEC_INBOX_LAG',
|
|
42
|
+
description: 'The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks).',
|
|
43
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_INBOX_LAG)
|
|
236
44
|
},
|
|
237
45
|
aztecProofSubmissionEpochs: {
|
|
238
46
|
env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
|
|
239
47
|
description: 'The number of epochs after an epoch ends that proofs are still accepted.',
|
|
240
|
-
...numberConfigHelper(
|
|
48
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_PROOF_SUBMISSION_EPOCHS)
|
|
241
49
|
},
|
|
242
50
|
activationThreshold: {
|
|
243
51
|
env: 'AZTEC_ACTIVATION_THRESHOLD',
|
|
244
52
|
description: 'The deposit amount for a validator',
|
|
245
|
-
...bigintConfigHelper(
|
|
53
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_ACTIVATION_THRESHOLD))
|
|
246
54
|
},
|
|
247
55
|
ejectionThreshold: {
|
|
248
56
|
env: 'AZTEC_EJECTION_THRESHOLD',
|
|
249
57
|
description: 'The minimum stake for a validator.',
|
|
250
|
-
...bigintConfigHelper(
|
|
58
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_EJECTION_THRESHOLD))
|
|
251
59
|
},
|
|
252
60
|
localEjectionThreshold: {
|
|
253
61
|
env: 'AZTEC_LOCAL_EJECTION_THRESHOLD',
|
|
254
62
|
description: 'The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup',
|
|
255
|
-
...bigintConfigHelper(
|
|
63
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_LOCAL_EJECTION_THRESHOLD))
|
|
256
64
|
},
|
|
257
65
|
slashingOffsetInRounds: {
|
|
258
66
|
env: 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
|
|
259
67
|
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)',
|
|
260
|
-
...numberConfigHelper(
|
|
68
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_OFFSET_IN_ROUNDS)
|
|
261
69
|
},
|
|
262
|
-
|
|
263
|
-
env: '
|
|
264
|
-
description: '
|
|
265
|
-
...
|
|
266
|
-
'empire',
|
|
267
|
-
'tally',
|
|
268
|
-
'none'
|
|
269
|
-
], DefaultL1ContractsConfig.slasherFlavor)
|
|
70
|
+
slasherEnabled: {
|
|
71
|
+
env: 'AZTEC_SLASHER_ENABLED',
|
|
72
|
+
description: 'Whether to deploy a slasher proposer',
|
|
73
|
+
...booleanConfigHelper(true)
|
|
270
74
|
},
|
|
271
75
|
slashAmountSmall: {
|
|
272
76
|
env: 'AZTEC_SLASH_AMOUNT_SMALL',
|
|
273
77
|
description: 'Small slashing amount for light offenses',
|
|
274
|
-
...bigintConfigHelper(
|
|
78
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_SMALL))
|
|
275
79
|
},
|
|
276
80
|
slashAmountMedium: {
|
|
277
81
|
env: 'AZTEC_SLASH_AMOUNT_MEDIUM',
|
|
278
82
|
description: 'Medium slashing amount for moderate offenses',
|
|
279
|
-
...bigintConfigHelper(
|
|
83
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_MEDIUM))
|
|
280
84
|
},
|
|
281
85
|
slashAmountLarge: {
|
|
282
86
|
env: 'AZTEC_SLASH_AMOUNT_LARGE',
|
|
283
87
|
description: 'Large slashing amount for severe offenses',
|
|
284
|
-
...bigintConfigHelper(
|
|
88
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_LARGE))
|
|
285
89
|
},
|
|
286
90
|
slashingQuorum: {
|
|
287
91
|
env: 'AZTEC_SLASHING_QUORUM',
|
|
@@ -291,28 +95,28 @@ export const l1ContractsConfigMappings = {
|
|
|
291
95
|
slashingRoundSizeInEpochs: {
|
|
292
96
|
env: 'AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS',
|
|
293
97
|
description: 'The slashing round size',
|
|
294
|
-
...numberConfigHelper(
|
|
98
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS)
|
|
295
99
|
},
|
|
296
100
|
slashingLifetimeInRounds: {
|
|
297
101
|
env: 'AZTEC_SLASHING_LIFETIME_IN_ROUNDS',
|
|
298
102
|
description: 'The slashing lifetime in rounds',
|
|
299
|
-
...numberConfigHelper(
|
|
103
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_LIFETIME_IN_ROUNDS)
|
|
300
104
|
},
|
|
301
105
|
slashingExecutionDelayInRounds: {
|
|
302
106
|
env: 'AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS',
|
|
303
107
|
description: 'The slashing execution delay in rounds',
|
|
304
|
-
...numberConfigHelper(
|
|
108
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS)
|
|
305
109
|
},
|
|
306
110
|
slashingVetoer: {
|
|
307
111
|
env: 'AZTEC_SLASHING_VETOER',
|
|
308
112
|
description: 'The slashing vetoer',
|
|
309
113
|
parseEnv: (val)=>EthAddress.fromString(val),
|
|
310
|
-
defaultValue:
|
|
114
|
+
defaultValue: EthAddress.fromString(l1ContractsDefaultEnv.AZTEC_SLASHING_VETOER)
|
|
311
115
|
},
|
|
312
116
|
slashingDisableDuration: {
|
|
313
117
|
env: 'AZTEC_SLASHING_DISABLE_DURATION',
|
|
314
118
|
description: 'How long slashing can be disabled for in seconds when vetoer disables it',
|
|
315
|
-
...numberConfigHelper(
|
|
119
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_DISABLE_DURATION)
|
|
316
120
|
},
|
|
317
121
|
governanceProposerQuorum: {
|
|
318
122
|
env: 'AZTEC_GOVERNANCE_PROPOSER_QUORUM',
|
|
@@ -322,25 +126,41 @@ export const l1ContractsConfigMappings = {
|
|
|
322
126
|
governanceProposerRoundSize: {
|
|
323
127
|
env: 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE',
|
|
324
128
|
description: 'The governance proposing round size',
|
|
325
|
-
...numberConfigHelper(
|
|
129
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE)
|
|
130
|
+
},
|
|
131
|
+
governanceVotingDuration: {
|
|
132
|
+
env: 'AZTEC_GOVERNANCE_VOTING_DURATION',
|
|
133
|
+
description: 'Governance voting duration in seconds (only for local/devnet/next-net)',
|
|
134
|
+
...numberConfigHelper(3600)
|
|
326
135
|
},
|
|
327
136
|
manaTarget: {
|
|
328
137
|
env: 'AZTEC_MANA_TARGET',
|
|
329
138
|
description: 'The mana target for the rollup',
|
|
330
|
-
...bigintConfigHelper(
|
|
139
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_MANA_TARGET))
|
|
331
140
|
},
|
|
332
141
|
provingCostPerMana: {
|
|
333
142
|
env: 'AZTEC_PROVING_COST_PER_MANA',
|
|
334
143
|
description: 'The proving cost per mana',
|
|
335
|
-
...bigintConfigHelper(
|
|
144
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_PROVING_COST_PER_MANA))
|
|
145
|
+
},
|
|
146
|
+
initialEthPerFeeAsset: {
|
|
147
|
+
env: 'AZTEC_INITIAL_ETH_PER_FEE_ASSET',
|
|
148
|
+
description: 'The initial ETH per fee asset price (with 1e12 precision)',
|
|
149
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_INITIAL_ETH_PER_FEE_ASSET))
|
|
336
150
|
},
|
|
337
151
|
exitDelaySeconds: {
|
|
338
152
|
env: 'AZTEC_EXIT_DELAY_SECONDS',
|
|
339
153
|
description: 'The delay before a validator can exit the set',
|
|
340
|
-
...numberConfigHelper(
|
|
154
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EXIT_DELAY_SECONDS)
|
|
341
155
|
},
|
|
342
|
-
...l1TxUtilsConfigMappings
|
|
156
|
+
...omitConfigMappings(l1TxUtilsConfigMappings, [
|
|
157
|
+
'ethereumSlotDuration'
|
|
158
|
+
])
|
|
343
159
|
};
|
|
160
|
+
/**
|
|
161
|
+
* Default L1 contracts configuration derived from l1ContractsConfigMappings.
|
|
162
|
+
* Source of truth: spartan/environments/defaults.yml -> defaults.l1-contracts
|
|
163
|
+
*/ export const DefaultL1ContractsConfig = getDefaultConfig(l1ContractsConfigMappings);
|
|
344
164
|
export const genesisStateConfigMappings = {
|
|
345
165
|
testAccounts: {
|
|
346
166
|
env: 'TEST_ACCOUNTS',
|
|
@@ -351,6 +171,12 @@ export const genesisStateConfigMappings = {
|
|
|
351
171
|
env: 'SPONSORED_FPC',
|
|
352
172
|
description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.',
|
|
353
173
|
...booleanConfigHelper(false)
|
|
174
|
+
},
|
|
175
|
+
prefundAddresses: {
|
|
176
|
+
env: 'PREFUND_ADDRESSES',
|
|
177
|
+
description: 'Comma-separated list of Aztec addresses to prefund with fee juice at genesis (local network only).',
|
|
178
|
+
parseEnv: (val)=>val.split(',').map((a)=>a.trim()).filter((a)=>a.length > 0),
|
|
179
|
+
defaultValue: []
|
|
354
180
|
}
|
|
355
181
|
};
|
|
356
182
|
export function getL1ContractsConfigEnvVars() {
|
|
@@ -359,146 +185,3 @@ export function getL1ContractsConfigEnvVars() {
|
|
|
359
185
|
export function getGenesisStateConfigEnvVars() {
|
|
360
186
|
return getConfigFromMappings(genesisStateConfigMappings);
|
|
361
187
|
}
|
|
362
|
-
/**
|
|
363
|
-
* Validates the L1 contracts configuration to ensure all requirements enforced by L1 contracts
|
|
364
|
-
* during construction are satisfied before deployment.
|
|
365
|
-
* Accumulates all validation errors and throws an exception listing them all if any are found.
|
|
366
|
-
*/ export function validateConfig(config) {
|
|
367
|
-
const errors = [];
|
|
368
|
-
// RollupCore constructor validation: normalFlushSizeMin > 0
|
|
369
|
-
// From: require(_config.stakingQueueConfig.normalFlushSizeMin > 0, Errors.Staking__InvalidStakingQueueConfig());
|
|
370
|
-
const entryQueueConfig = getEntryQueueConfig('testnet'); // Get config to check normalFlushSizeMin
|
|
371
|
-
if (entryQueueConfig.normalFlushSizeMin <= 0n) {
|
|
372
|
-
errors.push('normalFlushSizeMin must be greater than 0');
|
|
373
|
-
}
|
|
374
|
-
// TimeLib initialization validation: aztecSlotDuration should be a multiple of ethereumSlotDuration
|
|
375
|
-
// While not explicitly required in constructor, this is a common validation for time-based systems
|
|
376
|
-
if (config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
|
|
377
|
-
errors.push(`aztecSlotDuration (${config.aztecSlotDuration}) must be a multiple of ethereumSlotDuration (${config.ethereumSlotDuration})`);
|
|
378
|
-
}
|
|
379
|
-
// EmpireBase constructor validations for governance/slashing proposers
|
|
380
|
-
// From: require(QUORUM_SIZE > ROUND_SIZE / 2, Errors.EmpireBase__InvalidQuorumAndRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
381
|
-
const { governanceProposerQuorum, governanceProposerRoundSize } = config;
|
|
382
|
-
if (governanceProposerQuorum !== undefined && governanceProposerQuorum <= Math.floor(governanceProposerRoundSize / 2)) {
|
|
383
|
-
errors.push(`governanceProposerQuorum (${governanceProposerQuorum}) must be greater than half of governanceProposerRoundSize (${Math.floor(governanceProposerRoundSize / 2)})`);
|
|
384
|
-
}
|
|
385
|
-
// From: require(QUORUM_SIZE <= ROUND_SIZE, Errors.EmpireBase__QuorumCannotBeLargerThanRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
386
|
-
if (governanceProposerQuorum !== undefined && governanceProposerQuorum > governanceProposerRoundSize) {
|
|
387
|
-
errors.push(`governanceProposerQuorum (${governanceProposerQuorum}) cannot be larger than governanceProposerRoundSize (${governanceProposerRoundSize})`);
|
|
388
|
-
}
|
|
389
|
-
// Slashing quorum validations (similar to governance quorum)
|
|
390
|
-
const slashingRoundSize = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
391
|
-
const { slashingQuorum } = config;
|
|
392
|
-
if (slashingQuorum !== undefined && slashingQuorum <= Math.floor(slashingRoundSize / 2)) {
|
|
393
|
-
errors.push(`slashingQuorum (${slashingQuorum}) must be greater than half of slashingRoundSizeInEpochs (${Math.floor(slashingRoundSize / 2)})`);
|
|
394
|
-
}
|
|
395
|
-
if (slashingQuorum !== undefined && slashingQuorum > slashingRoundSize) {
|
|
396
|
-
errors.push(`slashingQuorum (${slashingQuorum}) cannot be larger than slashingRoundSizeInEpochs (${slashingRoundSize})`);
|
|
397
|
-
}
|
|
398
|
-
// EmpireBase and TallySlashingProposer lifetime and execution delay validation
|
|
399
|
-
// From: require(LIFETIME_IN_ROUNDS > EXECUTION_DELAY_IN_ROUNDS);
|
|
400
|
-
if (config.slashingLifetimeInRounds <= config.slashingExecutionDelayInRounds) {
|
|
401
|
-
errors.push(`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be greater than slashingExecutionDelayInRounds (${config.slashingExecutionDelayInRounds})`);
|
|
402
|
-
}
|
|
403
|
-
// Staking asset validation: activationThreshold > ejectionThreshold
|
|
404
|
-
if (config.activationThreshold < config.ejectionThreshold) {
|
|
405
|
-
errors.push(`activationThreshold (${config.activationThreshold}) must be greater than ejectionThreshold (${config.ejectionThreshold})`);
|
|
406
|
-
}
|
|
407
|
-
// TallySlashingProposer constructor validations
|
|
408
|
-
if (config.slasherFlavor === 'tally') {
|
|
409
|
-
validateTallySlasherConfig(config, errors);
|
|
410
|
-
}
|
|
411
|
-
// Epoch and slot duration validations
|
|
412
|
-
if (config.aztecSlotDuration <= 0) {
|
|
413
|
-
errors.push('aztecSlotDuration must be greater than 0');
|
|
414
|
-
}
|
|
415
|
-
if (config.ethereumSlotDuration <= 0) {
|
|
416
|
-
errors.push('ethereumSlotDuration must be greater than 0');
|
|
417
|
-
}
|
|
418
|
-
if (config.aztecEpochDuration <= 0) {
|
|
419
|
-
errors.push('aztecEpochDuration must be greater than 0');
|
|
420
|
-
}
|
|
421
|
-
// Committee size validation
|
|
422
|
-
if (config.aztecTargetCommitteeSize < 0) {
|
|
423
|
-
errors.push('aztecTargetCommitteeSize cannot be negative');
|
|
424
|
-
}
|
|
425
|
-
// Proof submission epochs validation
|
|
426
|
-
if (config.aztecProofSubmissionEpochs < 0) {
|
|
427
|
-
errors.push('aztecProofSubmissionEpochs cannot be negative');
|
|
428
|
-
}
|
|
429
|
-
// Exit delay validation
|
|
430
|
-
if (config.exitDelaySeconds < 0) {
|
|
431
|
-
errors.push('exitDelaySeconds cannot be negative');
|
|
432
|
-
}
|
|
433
|
-
// Mana validation
|
|
434
|
-
if (config.manaTarget < 0n) {
|
|
435
|
-
errors.push('manaTarget cannot be negative');
|
|
436
|
-
}
|
|
437
|
-
if (config.provingCostPerMana < 0n) {
|
|
438
|
-
errors.push('provingCostPerMana cannot be negative');
|
|
439
|
-
}
|
|
440
|
-
// If any errors were found, throw an exception with all of them
|
|
441
|
-
if (errors.length > 0) {
|
|
442
|
-
throw new Error(`L1 contracts configuration validation failed with ${errors.length} error(s):\n${errors.map((error, index)=>`${index + 1}. ${error}`).join('\n')}`);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
function validateTallySlasherConfig(config, errors) {
|
|
446
|
-
if (config.slasherFlavor !== 'tally') {
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
// From: require(SLASH_OFFSET_IN_ROUNDS > 0, Errors.TallySlashingProposer__SlashOffsetMustBeGreaterThanZero(...));
|
|
450
|
-
if (config.slashingOffsetInRounds <= 0) {
|
|
451
|
-
errors.push(`slashingOffsetInRounds (${config.slashingOffsetInRounds}) must be greater than 0`);
|
|
452
|
-
}
|
|
453
|
-
// From: require(ROUND_SIZE_IN_EPOCHS * _epochDuration == ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeMustBeMultipleOfEpochDuration(...));
|
|
454
|
-
const roundSizeInSlots = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
455
|
-
// From: require(QUORUM > 0, Errors.TallySlashingProposer__QuorumMustBeGreaterThanZero());
|
|
456
|
-
const { slashingQuorum } = config;
|
|
457
|
-
if (slashingQuorum !== undefined && slashingQuorum <= 0) {
|
|
458
|
-
errors.push(`slashingQuorum (${slashingQuorum}) must be greater than 0`);
|
|
459
|
-
}
|
|
460
|
-
// From: require(ROUND_SIZE > 1, Errors.TallySlashingProposer__InvalidQuorumAndRoundSize(QUORUM, ROUND_SIZE));
|
|
461
|
-
if (roundSizeInSlots <= 1) {
|
|
462
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be greater than 1`);
|
|
463
|
-
}
|
|
464
|
-
// From: require(_slashAmounts[0] <= _slashAmounts[1], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
465
|
-
if (config.slashAmountSmall > config.slashAmountMedium) {
|
|
466
|
-
errors.push(`slashAmountSmall (${config.slashAmountSmall}) must be less than or equal to slashAmountMedium (${config.slashAmountMedium})`);
|
|
467
|
-
}
|
|
468
|
-
// From: require(_slashAmounts[1] <= _slashAmounts[2], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
469
|
-
if (config.slashAmountMedium > config.slashAmountLarge) {
|
|
470
|
-
errors.push(`slashAmountMedium (${config.slashAmountMedium}) must be less than or equal to slashAmountLarge (${config.slashAmountLarge})`);
|
|
471
|
-
}
|
|
472
|
-
// From: require(LIFETIME_IN_ROUNDS < ROUNDABOUT_SIZE, Errors.TallySlashingProposer__LifetimeMustBeLessThanRoundabout(...));
|
|
473
|
-
const ROUNDABOUT_SIZE = 128; // Constant from TallySlashingProposer
|
|
474
|
-
if (config.slashingLifetimeInRounds >= ROUNDABOUT_SIZE) {
|
|
475
|
-
errors.push(`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be less than ${ROUNDABOUT_SIZE}`);
|
|
476
|
-
}
|
|
477
|
-
// From: require(ROUND_SIZE_IN_EPOCHS > 0, Errors.TallySlashingProposer__RoundSizeInEpochsMustBeGreaterThanZero(...));
|
|
478
|
-
if (config.slashingRoundSizeInEpochs <= 0) {
|
|
479
|
-
errors.push(`slashingRoundSizeInEpochs (${config.slashingRoundSizeInEpochs}) must be greater than 0`);
|
|
480
|
-
}
|
|
481
|
-
// From: require(ROUND_SIZE < MAX_ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeTooLarge(ROUND_SIZE, MAX_ROUND_SIZE));
|
|
482
|
-
const MAX_ROUND_SIZE = 1024; // Constant from TallySlashingProposer
|
|
483
|
-
if (roundSizeInSlots >= MAX_ROUND_SIZE) {
|
|
484
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be less than ${MAX_ROUND_SIZE}`);
|
|
485
|
-
}
|
|
486
|
-
// From: require(COMMITTEE_SIZE > 0, Errors.TallySlashingProposer__CommitteeSizeMustBeGreaterThanZero(COMMITTEE_SIZE));
|
|
487
|
-
if (config.aztecTargetCommitteeSize <= 0) {
|
|
488
|
-
errors.push(`aztecTargetCommitteeSize (${config.aztecTargetCommitteeSize}) must be greater than 0`);
|
|
489
|
-
}
|
|
490
|
-
// From: require(voteSize <= 128, Errors.TallySlashingProposer__VoteSizeTooBig(voteSize, 128));
|
|
491
|
-
// voteSize = COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS / 4
|
|
492
|
-
const voteSize = config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs / 4;
|
|
493
|
-
if (voteSize > 128) {
|
|
494
|
-
errors.push(`vote size (${voteSize}) must be <= 128 (committee size * round size in epochs / 4)`);
|
|
495
|
-
}
|
|
496
|
-
// From: require(COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS % 4 == 0, Errors.TallySlashingProposer__InvalidCommitteeAndRoundSize(...));
|
|
497
|
-
if (config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs % 4 !== 0) {
|
|
498
|
-
errors.push(`aztecTargetCommitteeSize * slashingRoundSizeInEpochs (${config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs}) must be divisible by 4`);
|
|
499
|
-
}
|
|
500
|
-
// Slashing offset validation: should be positive to allow proper slashing timing
|
|
501
|
-
if (config.slashingOffsetInRounds < 0) {
|
|
502
|
-
errors.push('slashingOffsetInRounds cannot be negative');
|
|
503
|
-
}
|
|
504
|
-
}
|
package/dest/constants.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Hex } from 'viem';
|
|
2
2
|
export declare const NULL_KEY: Hex;
|
|
3
3
|
export declare const AZTEC_TEST_CHAIN_ID = 677692;
|
|
4
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEdBQUcsRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUVoQyxlQUFPLE1BQU0sUUFBUSxFQUFFLEdBQStFLENBQUM7QUFDdkcsZUFBTyxNQUFNLG1CQUFtQixTQUFTLENBQUMifQ==
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import type { StateOverride } from 'viem';
|
|
5
|
+
import { type FeeHeader, RollupContract } from './rollup.js';
|
|
6
|
+
/**
|
|
7
|
+
* Override values for the pending checkpoint that the simulation should treat as already applied.
|
|
8
|
+
* Every field is optional at plan-building time so callers can populate them incrementally; whatever
|
|
9
|
+
* is present at translation time is forwarded to the partial `tempCheckpointLogs` helper so the
|
|
10
|
+
* load-bearing `slotNumber` can land even if other fields could not be derived locally.
|
|
11
|
+
*/
|
|
12
|
+
export type PendingCheckpointOverrideState = {
|
|
13
|
+
archive?: Fr;
|
|
14
|
+
feeHeader?: FeeHeader;
|
|
15
|
+
headerHash?: Fr;
|
|
16
|
+
outHash?: Fr;
|
|
17
|
+
payloadDigest?: Buffer32;
|
|
18
|
+
slotNumber?: SlotNumber;
|
|
19
|
+
};
|
|
20
|
+
export type ChainTipsOverride = {
|
|
21
|
+
pending?: CheckpointNumber;
|
|
22
|
+
proven?: CheckpointNumber;
|
|
23
|
+
};
|
|
24
|
+
/** Describes the simulated L1 rollup state that downstream calls should observe. */
|
|
25
|
+
export type SimulationOverridesPlan = {
|
|
26
|
+
chainTipsOverride?: ChainTipsOverride;
|
|
27
|
+
pendingCheckpointState?: PendingCheckpointOverrideState;
|
|
28
|
+
disableBlobCheck?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/** Builds a single-checkpoint simulation plan before it is translated into a viem state override. */
|
|
31
|
+
export declare class SimulationOverridesBuilder {
|
|
32
|
+
private chainTipsOverride?;
|
|
33
|
+
private pendingCheckpointState?;
|
|
34
|
+
private disableBlobCheck;
|
|
35
|
+
/** Starts from an existing plan so callers can extend or specialize it. */
|
|
36
|
+
static from(plan: SimulationOverridesPlan | undefined): SimulationOverridesBuilder;
|
|
37
|
+
/**
|
|
38
|
+
* Merges another plan into this builder. Later values win on a per-half basis for chain tips,
|
|
39
|
+
* but explicit `undefined` fields in the incoming plan are ignored so they cannot erase a
|
|
40
|
+
* previously-set value.
|
|
41
|
+
*/
|
|
42
|
+
merge(plan: SimulationOverridesPlan | undefined): this;
|
|
43
|
+
/**
|
|
44
|
+
* Sets the pending and/or proven checkpoint number overrides. Subsequent calls merge into the existing
|
|
45
|
+
* override on a per-half basis, so callers can set pending in one call and proven in another without
|
|
46
|
+
* clobbering each other.
|
|
47
|
+
*/
|
|
48
|
+
withChainTips(override: ChainTipsOverride): this;
|
|
49
|
+
/** Overrides the archive root for the configured pending checkpoint. */
|
|
50
|
+
withPendingArchive(archive: Fr): this;
|
|
51
|
+
/** Overrides the fee header for the configured pending checkpoint. */
|
|
52
|
+
withPendingFeeHeader(feeHeader: FeeHeader): this;
|
|
53
|
+
/**
|
|
54
|
+
* Overrides one or more `tempCheckpointLogs` cell fields for the configured pending checkpoint.
|
|
55
|
+
* Fields are independent: any subset can be provided. The translator (`makeTempCheckpointLogOverride`)
|
|
56
|
+
* emits a stateDiff entry per field actually set, so unspecified fields stay at their on-chain
|
|
57
|
+
* values.
|
|
58
|
+
*
|
|
59
|
+
* `slotNumber` is load-bearing for `STFLib.canPruneAtTime`: when the simulation overrides `pending`
|
|
60
|
+
* to a checkpoint that has no on-chain `tempCheckpointLogs` entry yet, the missing slotNumber falls
|
|
61
|
+
* back to 0 and the contract treats the pending tip as belonging to epoch 0, triggering a phantom
|
|
62
|
+
* prune that silently undoes the `pending` override.
|
|
63
|
+
*/
|
|
64
|
+
withPendingTempCheckpointLogFields(fields: {
|
|
65
|
+
headerHash?: Fr;
|
|
66
|
+
outHash?: Fr;
|
|
67
|
+
payloadDigest?: Buffer32;
|
|
68
|
+
slotNumber?: SlotNumber;
|
|
69
|
+
}): this;
|
|
70
|
+
/** Disables blob checking for simulations that cannot provide DA inputs. */
|
|
71
|
+
withoutBlobCheck(): this;
|
|
72
|
+
/** Builds the final plan, or `undefined` when no overrides were configured. */
|
|
73
|
+
build(): SimulationOverridesPlan | undefined;
|
|
74
|
+
private assertPendingCheckpointNumber;
|
|
75
|
+
}
|
|
76
|
+
/** Translates a simulation plan into the viem state override shape expected by rollup calls. */
|
|
77
|
+
export declare function buildSimulationOverridesStateOverride(rollup: RollupContract, plan: SimulationOverridesPlan | undefined): Promise<StateOverride>;
|
|
78
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhaW5fc3RhdGVfb3ZlcnJpZGUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdHMvY2hhaW5fc3RhdGVfb3ZlcnJpZGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsVUFBVSxF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