@aztec/ethereum 0.0.1-commit.5daedc8 → 0.0.1-commit.6201a7b05
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 +16 -2
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +27 -3
- package/dest/config.d.ts +26 -73
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +64 -387
- package/dest/contracts/chain_state_override.d.ts +38 -0
- package/dest/contracts/chain_state_override.d.ts.map +1 -0
- package/dest/contracts/chain_state_override.js +100 -0
- package/dest/contracts/empire_base.d.ts +4 -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 +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/governance.d.ts +3 -1
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +14 -4
- package/dest/contracts/governance_proposer.d.ts +4 -1
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +404 -9
- package/dest/contracts/inbox.d.ts +24 -3
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +41 -1
- 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 +51 -2
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +87 -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 +3 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/registry.js +30 -1
- package/dest/contracts/rollup.d.ts +5178 -108
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +1004 -188
- 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 +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/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 +14161 -17158
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +9 -24
- package/dest/l1_contract_addresses.d.ts +1 -5
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +3 -9
- package/dest/l1_reader.d.ts +5 -1
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +13 -2
- 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 +31 -4
- 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 +20 -7
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +98 -61
- 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 +61 -164
- 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/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 +74 -7
- package/dest/test/chain_monitor.d.ts +36 -14
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +45 -11
- package/dest/test/eth_cheat_codes.d.ts +18 -4
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +10 -6
- 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 +13 -6
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +41 -7
- 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 +143 -29
- 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 +80 -12
- package/package.json +33 -16
- package/src/client.ts +28 -2
- package/src/config.ts +82 -468
- package/src/contracts/README.md +157 -0
- package/src/contracts/chain_state_override.ts +147 -0
- package/src/contracts/empire_base.ts +3 -1
- 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 +16 -2
- package/src/contracts/inbox.ts +63 -3
- package/src/contracts/index.ts +5 -2
- package/src/contracts/log.ts +13 -0
- package/src/contracts/multicall.ts +70 -3
- package/src/contracts/outbox.ts +98 -0
- package/src/contracts/registry.ts +31 -1
- package/src/contracts/rollup.ts +701 -149
- package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +18 -14
- 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 +21 -26
- package/src/l1_reader.ts +22 -2
- package/src/l1_tx_utils/config.ts +44 -6
- 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 +98 -40
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +75 -210
- package/src/{test → l1_tx_utils}/tx_delayer.ts +82 -52
- package/src/publisher_manager.ts +107 -10
- package/src/queries.ts +81 -7
- package/src/test/chain_monitor.ts +82 -18
- package/src/test/eth_cheat_codes.ts +8 -6
- package/src/test/index.ts +0 -2
- package/src/test/rollup_cheat_codes.ts +43 -10
- package/src/test/start_anvil.ts +178 -28
- package/src/test/upgrade_utils.ts +2 -2
- package/src/types.ts +62 -0
- package/src/utils.ts +100 -15
- 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,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
|
-
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
|
|
29
|
-
};
|
|
30
|
-
const LocalGovernanceConfiguration = {
|
|
31
|
-
proposeConfig: {
|
|
32
|
-
lockDelay: 60n * 60n * 24n * 30n,
|
|
33
|
-
lockAmount: 1n * 10n ** 24n
|
|
34
|
-
},
|
|
35
|
-
votingDelay: 60n,
|
|
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 = {
|
|
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 = {
|
|
213
10
|
ethereumSlotDuration: {
|
|
214
11
|
env: 'ETHEREUM_SLOT_DURATION',
|
|
215
12
|
description: 'How many seconds an L1 slot lasts.',
|
|
216
|
-
...numberConfigHelper(
|
|
13
|
+
...numberConfigHelper(l1ContractsDefaultEnv.ETHEREUM_SLOT_DURATION)
|
|
217
14
|
},
|
|
218
15
|
aztecSlotDuration: {
|
|
219
16
|
env: 'AZTEC_SLOT_DURATION',
|
|
220
17
|
description: 'How many seconds an L2 slots lasts (must be multiple of ethereum slot duration).',
|
|
221
|
-
...numberConfigHelper(
|
|
18
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLOT_DURATION)
|
|
222
19
|
},
|
|
223
20
|
aztecEpochDuration: {
|
|
224
21
|
env: 'AZTEC_EPOCH_DURATION',
|
|
225
|
-
description: `How many L2 slots an epoch lasts (maximum
|
|
226
|
-
...numberConfigHelper(
|
|
22
|
+
description: `How many L2 slots an epoch lasts (maximum MAX_CHECKPOINTS_PER_EPOCH).`,
|
|
23
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EPOCH_DURATION)
|
|
227
24
|
},
|
|
228
25
|
aztecTargetCommitteeSize: {
|
|
229
26
|
env: 'AZTEC_TARGET_COMMITTEE_SIZE',
|
|
230
27
|
description: 'The target validator committee size.',
|
|
231
|
-
...numberConfigHelper(
|
|
28
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_TARGET_COMMITTEE_SIZE)
|
|
232
29
|
},
|
|
233
30
|
lagInEpochsForValidatorSet: {
|
|
234
31
|
env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
|
|
235
32
|
description: 'The number of epochs to lag behind the current epoch for validator selection.',
|
|
236
|
-
...numberConfigHelper(
|
|
33
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET)
|
|
237
34
|
},
|
|
238
35
|
lagInEpochsForRandao: {
|
|
239
36
|
env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
|
|
240
37
|
description: 'The number of epochs to lag behind the current epoch for randao selection.',
|
|
241
|
-
...numberConfigHelper(
|
|
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)
|
|
242
44
|
},
|
|
243
45
|
aztecProofSubmissionEpochs: {
|
|
244
46
|
env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
|
|
245
47
|
description: 'The number of epochs after an epoch ends that proofs are still accepted.',
|
|
246
|
-
...numberConfigHelper(
|
|
48
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_PROOF_SUBMISSION_EPOCHS)
|
|
247
49
|
},
|
|
248
50
|
activationThreshold: {
|
|
249
51
|
env: 'AZTEC_ACTIVATION_THRESHOLD',
|
|
250
52
|
description: 'The deposit amount for a validator',
|
|
251
|
-
...bigintConfigHelper(
|
|
53
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_ACTIVATION_THRESHOLD))
|
|
252
54
|
},
|
|
253
55
|
ejectionThreshold: {
|
|
254
56
|
env: 'AZTEC_EJECTION_THRESHOLD',
|
|
255
57
|
description: 'The minimum stake for a validator.',
|
|
256
|
-
...bigintConfigHelper(
|
|
58
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_EJECTION_THRESHOLD))
|
|
257
59
|
},
|
|
258
60
|
localEjectionThreshold: {
|
|
259
61
|
env: 'AZTEC_LOCAL_EJECTION_THRESHOLD',
|
|
260
62
|
description: 'The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup',
|
|
261
|
-
...bigintConfigHelper(
|
|
63
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_LOCAL_EJECTION_THRESHOLD))
|
|
262
64
|
},
|
|
263
65
|
slashingOffsetInRounds: {
|
|
264
66
|
env: 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
|
|
265
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)',
|
|
266
|
-
...numberConfigHelper(
|
|
68
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_OFFSET_IN_ROUNDS)
|
|
267
69
|
},
|
|
268
|
-
|
|
269
|
-
env: '
|
|
270
|
-
description: '
|
|
271
|
-
...
|
|
272
|
-
'empire',
|
|
273
|
-
'tally',
|
|
274
|
-
'none'
|
|
275
|
-
], DefaultL1ContractsConfig.slasherFlavor)
|
|
70
|
+
slasherEnabled: {
|
|
71
|
+
env: 'AZTEC_SLASHER_ENABLED',
|
|
72
|
+
description: 'Whether to deploy a slasher proposer',
|
|
73
|
+
...booleanConfigHelper(true)
|
|
276
74
|
},
|
|
277
75
|
slashAmountSmall: {
|
|
278
76
|
env: 'AZTEC_SLASH_AMOUNT_SMALL',
|
|
279
77
|
description: 'Small slashing amount for light offenses',
|
|
280
|
-
...bigintConfigHelper(
|
|
78
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_SMALL))
|
|
281
79
|
},
|
|
282
80
|
slashAmountMedium: {
|
|
283
81
|
env: 'AZTEC_SLASH_AMOUNT_MEDIUM',
|
|
284
82
|
description: 'Medium slashing amount for moderate offenses',
|
|
285
|
-
...bigintConfigHelper(
|
|
83
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_MEDIUM))
|
|
286
84
|
},
|
|
287
85
|
slashAmountLarge: {
|
|
288
86
|
env: 'AZTEC_SLASH_AMOUNT_LARGE',
|
|
289
87
|
description: 'Large slashing amount for severe offenses',
|
|
290
|
-
...bigintConfigHelper(
|
|
88
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_SLASH_AMOUNT_LARGE))
|
|
291
89
|
},
|
|
292
90
|
slashingQuorum: {
|
|
293
91
|
env: 'AZTEC_SLASHING_QUORUM',
|
|
@@ -297,28 +95,28 @@ export const l1ContractsConfigMappings = {
|
|
|
297
95
|
slashingRoundSizeInEpochs: {
|
|
298
96
|
env: 'AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS',
|
|
299
97
|
description: 'The slashing round size',
|
|
300
|
-
...numberConfigHelper(
|
|
98
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS)
|
|
301
99
|
},
|
|
302
100
|
slashingLifetimeInRounds: {
|
|
303
101
|
env: 'AZTEC_SLASHING_LIFETIME_IN_ROUNDS',
|
|
304
102
|
description: 'The slashing lifetime in rounds',
|
|
305
|
-
...numberConfigHelper(
|
|
103
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_LIFETIME_IN_ROUNDS)
|
|
306
104
|
},
|
|
307
105
|
slashingExecutionDelayInRounds: {
|
|
308
106
|
env: 'AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS',
|
|
309
107
|
description: 'The slashing execution delay in rounds',
|
|
310
|
-
...numberConfigHelper(
|
|
108
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS)
|
|
311
109
|
},
|
|
312
110
|
slashingVetoer: {
|
|
313
111
|
env: 'AZTEC_SLASHING_VETOER',
|
|
314
112
|
description: 'The slashing vetoer',
|
|
315
113
|
parseEnv: (val)=>EthAddress.fromString(val),
|
|
316
|
-
defaultValue:
|
|
114
|
+
defaultValue: EthAddress.fromString(l1ContractsDefaultEnv.AZTEC_SLASHING_VETOER)
|
|
317
115
|
},
|
|
318
116
|
slashingDisableDuration: {
|
|
319
117
|
env: 'AZTEC_SLASHING_DISABLE_DURATION',
|
|
320
118
|
description: 'How long slashing can be disabled for in seconds when vetoer disables it',
|
|
321
|
-
...numberConfigHelper(
|
|
119
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_SLASHING_DISABLE_DURATION)
|
|
322
120
|
},
|
|
323
121
|
governanceProposerQuorum: {
|
|
324
122
|
env: 'AZTEC_GOVERNANCE_PROPOSER_QUORUM',
|
|
@@ -328,25 +126,41 @@ export const l1ContractsConfigMappings = {
|
|
|
328
126
|
governanceProposerRoundSize: {
|
|
329
127
|
env: 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE',
|
|
330
128
|
description: 'The governance proposing round size',
|
|
331
|
-
...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)
|
|
332
135
|
},
|
|
333
136
|
manaTarget: {
|
|
334
137
|
env: 'AZTEC_MANA_TARGET',
|
|
335
138
|
description: 'The mana target for the rollup',
|
|
336
|
-
...bigintConfigHelper(
|
|
139
|
+
...bigintConfigHelper(BigInt(l1ContractsDefaultEnv.AZTEC_MANA_TARGET))
|
|
337
140
|
},
|
|
338
141
|
provingCostPerMana: {
|
|
339
142
|
env: 'AZTEC_PROVING_COST_PER_MANA',
|
|
340
143
|
description: 'The proving cost per mana',
|
|
341
|
-
...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))
|
|
342
150
|
},
|
|
343
151
|
exitDelaySeconds: {
|
|
344
152
|
env: 'AZTEC_EXIT_DELAY_SECONDS',
|
|
345
153
|
description: 'The delay before a validator can exit the set',
|
|
346
|
-
...numberConfigHelper(
|
|
154
|
+
...numberConfigHelper(l1ContractsDefaultEnv.AZTEC_EXIT_DELAY_SECONDS)
|
|
347
155
|
},
|
|
348
|
-
...l1TxUtilsConfigMappings
|
|
156
|
+
...omitConfigMappings(l1TxUtilsConfigMappings, [
|
|
157
|
+
'ethereumSlotDuration'
|
|
158
|
+
])
|
|
349
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);
|
|
350
164
|
export const genesisStateConfigMappings = {
|
|
351
165
|
testAccounts: {
|
|
352
166
|
env: 'TEST_ACCOUNTS',
|
|
@@ -357,6 +171,12 @@ export const genesisStateConfigMappings = {
|
|
|
357
171
|
env: 'SPONSORED_FPC',
|
|
358
172
|
description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.',
|
|
359
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: []
|
|
360
180
|
}
|
|
361
181
|
};
|
|
362
182
|
export function getL1ContractsConfigEnvVars() {
|
|
@@ -365,146 +185,3 @@ export function getL1ContractsConfigEnvVars() {
|
|
|
365
185
|
export function getGenesisStateConfigEnvVars() {
|
|
366
186
|
return getConfigFromMappings(genesisStateConfigMappings);
|
|
367
187
|
}
|
|
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
|
-
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { StateOverride } from 'viem';
|
|
4
|
+
import { type FeeHeader, RollupContract } from './rollup.js';
|
|
5
|
+
export type PendingCheckpointOverrideState = {
|
|
6
|
+
archive?: Fr;
|
|
7
|
+
feeHeader?: FeeHeader;
|
|
8
|
+
};
|
|
9
|
+
/** Describes the simulated L1 rollup state that downstream calls should observe. */
|
|
10
|
+
export type SimulationOverridesPlan = {
|
|
11
|
+
pendingCheckpointNumber?: CheckpointNumber;
|
|
12
|
+
pendingCheckpointState?: PendingCheckpointOverrideState;
|
|
13
|
+
disableBlobCheck?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** Builds a single-checkpoint simulation plan before it is translated into a viem state override. */
|
|
16
|
+
export declare class SimulationOverridesBuilder {
|
|
17
|
+
private pendingCheckpointNumber?;
|
|
18
|
+
private pendingCheckpointState?;
|
|
19
|
+
private disableBlobCheck;
|
|
20
|
+
/** Starts from an existing plan so callers can extend or specialize it. */
|
|
21
|
+
static from(plan: SimulationOverridesPlan | undefined): SimulationOverridesBuilder;
|
|
22
|
+
/** Merges another plan into this builder. Later values win. */
|
|
23
|
+
merge(plan: SimulationOverridesPlan | undefined): this;
|
|
24
|
+
/** Sets the checkpoint number that archive and fee header overrides should attach to. */
|
|
25
|
+
forPendingCheckpoint(pendingCheckpointNumber: CheckpointNumber | undefined): this;
|
|
26
|
+
/** Overrides the archive root for the configured pending checkpoint. */
|
|
27
|
+
withPendingArchive(archive: Fr): this;
|
|
28
|
+
/** Overrides the fee header for the configured pending checkpoint. */
|
|
29
|
+
withPendingFeeHeader(feeHeader: FeeHeader): this;
|
|
30
|
+
/** Disables blob checking for simulations that cannot provide DA inputs. */
|
|
31
|
+
withoutBlobCheck(): this;
|
|
32
|
+
/** Builds the final plan, or `undefined` when no overrides were configured. */
|
|
33
|
+
build(): SimulationOverridesPlan | undefined;
|
|
34
|
+
private assertPendingCheckpointNumber;
|
|
35
|
+
}
|
|
36
|
+
/** Translates a simulation plan into the viem state override shape expected by rollup calls. */
|
|
37
|
+
export declare function buildSimulationOverridesStateOverride(rollup: RollupContract, plan: SimulationOverridesPlan | undefined): Promise<StateOverride>;
|
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhaW5fc3RhdGVfb3ZlcnJpZGUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdHMvY2hhaW5fc3RhdGVfb3ZlcnJpZGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUV6RCxPQUFPLEtBQUssRUFBRSxhQUFhLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFFMUMsT0FBTyxFQUFFLEtBQUssU0FBUyxFQUFFLGNBQWMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUU3RCxNQUFNLE1BQU0sOEJBQThCLEdBQUc7SUFDM0MsT0FBTyxDQUFDLEVBQUUsRUFBRSxDQUFDO0lBQ2IsU0FBUyxDQUFDLEVBQUUsU0FBUyxDQUFDO0NBQ3ZCLENBQUM7QUFFRixvRkFBb0Y7QUFDcEYsTUFBTSxNQUFNLHVCQUF1QixHQUFHO0lBQ3BDLHVCQUF1QixDQUFDLEVBQUUsZ0JBQWdCLENBQUM7SUFDM0Msc0JBQXNCLENBQUMsRUFBRSw4QkFBOEIsQ0FBQztJQUN4RCxnQkFBZ0IsQ0FBQyxFQUFFLE9BQU8sQ0FBQztDQUM1QixDQUFDO0FBRUYscUdBQXFHO0FBQ3JHLHFCQUFhLDBCQUEwQjtJQUNyQyxPQUFPLENBQUMsdUJBQXVCLENBQUMsQ0FBbUI7SUFDbkQsT0FBTyxDQUFDLHNCQUFzQixDQUFDLENBQWlDO0lBQ2hFLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBUztJQUVqQywyRUFBMkU7SUFDM0UsT0FBYyxJQUFJLENBQUMsSUFBSSxFQUFFLHVCQUF1QixHQUFHLFNBQVMsR0FBRywwQkFBMEIsQ0FFeEY7SUFFRCwrREFBK0Q7SUFDeEQsS0FBSyxDQUFDLElBQUksRUFBRSx1QkFBdUIsR0FBRyxTQUFTLEdBQUcsSUFBSSxDQVk1RDtJQUVELHlGQUF5RjtJQUNsRixvQkFBb0IsQ0FBQyx1QkFBdUIsRUFBRSxnQkFBZ0IsR0FBRyxTQUFTLEdBQUcsSUFBSSxDQUd2RjtJQUVELHdFQUF3RTtJQUNqRSxrQkFBa0IsQ0FBQyxPQUFPLEVBQUUsRUFBRSxHQUFHLElBQUksQ0FJM0M7SUFFRCxzRUFBc0U7SUFDL0Qsb0JBQW9CLENBQUMsU0FBUyxFQUFFLFNBQVMsR0FBRyxJQUFJLENBSXREO0lBRUQsNEVBQTRFO0lBQ3JFLGdCQUFnQixJQUFJLElBQUksQ0FHOUI7SUFFRCwrRUFBK0U7SUFDeEUsS0FBSyxJQUFJLHVCQUF1QixHQUFHLFNBQVMsQ0FVbEQ7SUFFRCxPQUFPLENBQUMsNkJBQTZCO0NBS3RDO0FBRUQsZ0dBQWdHO0FBQ2hHLHdCQUFzQixxQ0FBcUMsQ0FDekQsTUFBTSxFQUFFLGNBQWMsRUFDdEIsSUFBSSxFQUFFLHVCQUF1QixHQUFHLFNBQVMsR0FDeEMsT0FBTyxDQUFDLGFBQWEsQ0FBQyxDQTZDeEIifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain_state_override.d.ts","sourceRoot":"","sources":["../../src/contracts/chain_state_override.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,KAAK,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7D,MAAM,MAAM,8BAA8B,GAAG;IAC3C,OAAO,CAAC,EAAE,EAAE,CAAC;IACb,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,oFAAoF;AACpF,MAAM,MAAM,uBAAuB,GAAG;IACpC,uBAAuB,CAAC,EAAE,gBAAgB,CAAC;IAC3C,sBAAsB,CAAC,EAAE,8BAA8B,CAAC;IACxD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,qGAAqG;AACrG,qBAAa,0BAA0B;IACrC,OAAO,CAAC,uBAAuB,CAAC,CAAmB;IACnD,OAAO,CAAC,sBAAsB,CAAC,CAAiC;IAChE,OAAO,CAAC,gBAAgB,CAAS;IAEjC,2EAA2E;IAC3E,OAAc,IAAI,CAAC,IAAI,EAAE,uBAAuB,GAAG,SAAS,GAAG,0BAA0B,CAExF;IAED,+DAA+D;IACxD,KAAK,CAAC,IAAI,EAAE,uBAAuB,GAAG,SAAS,GAAG,IAAI,CAY5D;IAED,yFAAyF;IAClF,oBAAoB,CAAC,uBAAuB,EAAE,gBAAgB,GAAG,SAAS,GAAG,IAAI,CAGvF;IAED,wEAAwE;IACjE,kBAAkB,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,CAI3C;IAED,sEAAsE;IAC/D,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAItD;IAED,4EAA4E;IACrE,gBAAgB,IAAI,IAAI,CAG9B;IAED,+EAA+E;IACxE,KAAK,IAAI,uBAAuB,GAAG,SAAS,CAUlD;IAED,OAAO,CAAC,6BAA6B;CAKtC;AAED,gGAAgG;AAChG,wBAAsB,qCAAqC,CACzD,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,uBAAuB,GAAG,SAAS,GACxC,OAAO,CAAC,aAAa,CAAC,CA6CxB"}
|