@aztec/ethereum 0.0.0-test.0 → 0.0.1-commit.21caa21
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 +2 -0
- package/dest/account.d.ts.map +1 -0
- package/dest/account.js +4 -0
- package/dest/chain.d.ts +1 -1
- package/dest/client.d.ts +6 -4
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +16 -2
- package/dest/config.d.ts +111 -17
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +462 -22
- package/dest/constants.d.ts +1 -1
- package/dest/contracts/empire_base.d.ts +24 -8
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +75 -2
- package/dest/contracts/empire_slashing_proposer.d.ts +66 -0
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/empire_slashing_proposer.js +200 -0
- package/dest/contracts/errors.d.ts +7 -0
- package/dest/contracts/errors.d.ts.map +1 -0
- package/dest/contracts/errors.js +12 -0
- package/dest/contracts/fee_asset_handler.d.ts +19 -0
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -0
- package/dest/contracts/fee_asset_handler.js +57 -0
- package/dest/contracts/fee_juice.d.ts +6 -7
- package/dest/contracts/fee_juice.d.ts.map +1 -1
- package/dest/contracts/fee_juice.js +27 -20
- package/dest/contracts/governance.d.ts +43 -32
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +87 -84
- package/dest/contracts/governance_proposer.d.ts +16 -13
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +37 -17
- package/dest/contracts/gse.d.ts +32 -0
- package/dest/contracts/gse.d.ts.map +1 -0
- package/dest/contracts/gse.js +72 -0
- package/dest/contracts/inbox.d.ts +26 -0
- package/dest/contracts/inbox.d.ts.map +1 -0
- package/dest/contracts/inbox.js +45 -0
- package/dest/contracts/index.d.ts +9 -3
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +8 -2
- package/dest/contracts/multicall.d.ts +21 -0
- package/dest/contracts/multicall.d.ts.map +1 -0
- package/dest/contracts/multicall.js +156 -0
- package/dest/contracts/registry.d.ts +10 -5
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/registry.js +44 -16
- package/dest/contracts/rollup.d.ts +204 -40
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +529 -79
- package/dest/contracts/slasher_contract.d.ts +44 -0
- package/dest/contracts/slasher_contract.d.ts.map +1 -0
- package/dest/contracts/slasher_contract.js +75 -0
- package/dest/contracts/tally_slashing_proposer.d.ts +139 -0
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -0
- package/dest/contracts/tally_slashing_proposer.js +313 -0
- package/dest/contracts/utils.d.ts +3 -0
- package/dest/contracts/utils.d.ts.map +1 -0
- package/dest/contracts/utils.js +11 -0
- package/dest/deploy_l1_contracts.d.ts +577 -21114
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +1225 -421
- package/dest/eth-signer/eth-signer.d.ts +21 -0
- package/dest/eth-signer/eth-signer.d.ts.map +1 -0
- package/dest/eth-signer/eth-signer.js +5 -0
- package/dest/eth-signer/index.d.ts +2 -0
- package/dest/eth-signer/index.d.ts.map +1 -0
- package/dest/eth-signer/index.js +1 -0
- package/dest/index.d.ts +7 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +6 -2
- package/dest/l1_artifacts.d.ts +77344 -0
- package/dest/l1_artifacts.d.ts.map +1 -0
- package/dest/l1_artifacts.js +166 -0
- package/dest/l1_contract_addresses.d.ts +24 -4
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +22 -18
- package/dest/l1_reader.d.ts +2 -2
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +8 -8
- package/dest/l1_tx_utils/config.d.ts +59 -0
- package/dest/l1_tx_utils/config.d.ts.map +1 -0
- package/dest/l1_tx_utils/config.js +82 -0
- package/dest/l1_tx_utils/constants.d.ts +6 -0
- package/dest/l1_tx_utils/constants.d.ts.map +1 -0
- package/dest/l1_tx_utils/constants.js +14 -0
- package/dest/l1_tx_utils/factory.d.ts +24 -0
- package/dest/l1_tx_utils/factory.d.ts.map +1 -0
- package/dest/l1_tx_utils/factory.js +12 -0
- package/dest/l1_tx_utils/index.d.ts +10 -0
- package/dest/l1_tx_utils/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/index.js +10 -0
- package/dest/l1_tx_utils/interfaces.d.ts +76 -0
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
- package/dest/l1_tx_utils/interfaces.js +4 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +94 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils.js +610 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +26 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +26 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +94 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +430 -0
- package/dest/l1_tx_utils/signer.d.ts +4 -0
- package/dest/l1_tx_utils/signer.d.ts.map +1 -0
- package/dest/l1_tx_utils/signer.js +16 -0
- package/dest/l1_tx_utils/types.d.ts +67 -0
- package/dest/l1_tx_utils/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/types.js +26 -0
- package/dest/l1_tx_utils/utils.d.ts +4 -0
- package/dest/l1_tx_utils/utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/utils.js +14 -0
- package/dest/l1_types.d.ts +6 -0
- package/dest/l1_types.d.ts.map +1 -0
- package/dest/l1_types.js +1 -0
- package/dest/publisher_manager.d.ts +15 -0
- package/dest/publisher_manager.d.ts.map +1 -0
- package/dest/publisher_manager.js +88 -0
- package/dest/queries.d.ts +4 -2
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +53 -12
- package/dest/test/chain_monitor.d.ts +73 -0
- package/dest/test/chain_monitor.d.ts.map +1 -0
- package/dest/test/chain_monitor.js +215 -0
- package/dest/test/delayed_tx_utils.d.ts +8 -3
- package/dest/test/delayed_tx_utils.d.ts.map +1 -1
- package/dest/test/delayed_tx_utils.js +13 -6
- package/dest/test/eth_cheat_codes.d.ts +217 -0
- package/dest/test/eth_cheat_codes.d.ts.map +1 -0
- package/dest/test/eth_cheat_codes.js +558 -0
- package/dest/test/eth_cheat_codes_with_state.d.ts +2 -2
- package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes_with_state.js +1 -1
- package/dest/test/index.d.ts +4 -1
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +3 -0
- package/dest/test/rollup_cheat_codes.d.ts +87 -0
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -0
- package/dest/test/rollup_cheat_codes.js +266 -0
- package/dest/test/start_anvil.d.ts +7 -1
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +16 -7
- package/dest/test/tx_delayer.d.ts +18 -7
- package/dest/test/tx_delayer.d.ts.map +1 -1
- package/dest/test/tx_delayer.js +95 -19
- package/dest/test/upgrade_utils.d.ts +6 -5
- package/dest/test/upgrade_utils.d.ts.map +1 -1
- package/dest/test/upgrade_utils.js +23 -16
- package/dest/types.d.ts +7 -8
- package/dest/types.d.ts.map +1 -1
- package/dest/types.js +3 -1
- package/dest/utils.d.ts +2 -1
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +43 -88
- package/dest/zkPassportVerifierAddress.d.ts +15 -0
- package/dest/zkPassportVerifierAddress.d.ts.map +1 -0
- package/dest/zkPassportVerifierAddress.js +11 -0
- package/package.json +28 -19
- package/src/account.ts +5 -0
- package/src/client.ts +42 -4
- package/src/config.ts +592 -31
- package/src/contracts/empire_base.ts +77 -7
- package/src/contracts/empire_slashing_proposer.ts +265 -0
- package/src/contracts/errors.ts +13 -0
- package/src/contracts/fee_asset_handler.ts +63 -0
- package/src/contracts/fee_juice.ts +29 -15
- package/src/contracts/governance.ts +80 -77
- package/src/contracts/governance_proposer.ts +66 -24
- package/src/contracts/gse.ts +88 -0
- package/src/contracts/inbox.ts +63 -0
- package/src/contracts/index.ts +8 -2
- package/src/contracts/multicall.ts +155 -0
- package/src/contracts/registry.ts +51 -26
- package/src/contracts/rollup.ts +596 -74
- package/src/contracts/slasher_contract.ts +89 -0
- package/src/contracts/tally_slashing_proposer.ts +316 -0
- package/src/contracts/utils.ts +14 -0
- package/src/deploy_l1_contracts.ts +1459 -538
- package/src/eth-signer/eth-signer.ts +25 -0
- package/src/eth-signer/index.ts +1 -0
- package/src/index.ts +6 -2
- package/src/l1_artifacts.ts +254 -0
- package/src/l1_contract_addresses.ts +32 -19
- package/src/l1_reader.ts +9 -9
- package/src/l1_tx_utils/README.md +177 -0
- package/src/l1_tx_utils/config.ts +143 -0
- package/src/l1_tx_utils/constants.ts +18 -0
- package/src/l1_tx_utils/factory.ts +64 -0
- package/src/l1_tx_utils/index.ts +12 -0
- package/src/l1_tx_utils/interfaces.ts +86 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +718 -0
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +77 -0
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +558 -0
- package/src/l1_tx_utils/signer.ts +28 -0
- package/src/l1_tx_utils/types.ts +85 -0
- package/src/l1_tx_utils/utils.ts +16 -0
- package/src/l1_types.ts +6 -0
- package/src/publisher_manager.ts +106 -0
- package/src/queries.ts +73 -15
- package/src/test/chain_monitor.ts +243 -0
- package/src/test/delayed_tx_utils.ts +34 -6
- package/src/test/eth_cheat_codes.ts +588 -0
- package/src/test/eth_cheat_codes_with_state.ts +1 -1
- package/src/test/index.ts +3 -0
- package/src/test/rollup_cheat_codes.ts +307 -0
- package/src/test/start_anvil.ts +22 -5
- package/src/test/tx_delayer.ts +127 -26
- package/src/test/upgrade_utils.ts +30 -21
- package/src/types.ts +10 -8
- package/src/utils.ts +49 -90
- package/src/zkPassportVerifierAddress.ts +15 -0
- package/dest/contracts/forwarder.d.ts +0 -24
- package/dest/contracts/forwarder.d.ts.map +0 -1
- package/dest/contracts/forwarder.js +0 -101
- package/dest/contracts/slashing_proposer.d.ts +0 -21
- package/dest/contracts/slashing_proposer.d.ts.map +0 -1
- package/dest/contracts/slashing_proposer.js +0 -47
- package/dest/eth_cheat_codes.d.ts +0 -147
- package/dest/eth_cheat_codes.d.ts.map +0 -1
- package/dest/eth_cheat_codes.js +0 -303
- package/dest/l1_tx_utils.d.ts +0 -192
- package/dest/l1_tx_utils.d.ts.map +0 -1
- package/dest/l1_tx_utils.js +0 -641
- package/dest/l1_tx_utils_with_blobs.d.ts +0 -12
- package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils_with_blobs.js +0 -64
- package/src/contracts/forwarder.ts +0 -132
- package/src/contracts/slashing_proposer.ts +0 -51
- package/src/eth_cheat_codes.ts +0 -314
- package/src/l1_tx_utils.ts +0 -847
- package/src/l1_tx_utils_with_blobs.ts +0 -86
package/dest/config.js
CHANGED
|
@@ -1,16 +1,213 @@
|
|
|
1
|
-
import { bigintConfigHelper, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';
|
|
2
|
-
import {
|
|
1
|
+
import { bigintConfigHelper, booleanConfigHelper, enumConfigHelper, getConfigFromMappings, numberConfigHelper, optionalNumberConfigHelper } from '@aztec/foundation/config';
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { l1TxUtilsConfigMappings } from './l1_tx_utils/index.js';
|
|
3
4
|
export const DefaultL1ContractsConfig = {
|
|
4
5
|
ethereumSlotDuration: 12,
|
|
5
|
-
aztecSlotDuration:
|
|
6
|
-
aztecEpochDuration:
|
|
6
|
+
aztecSlotDuration: 36,
|
|
7
|
+
aztecEpochDuration: 32,
|
|
7
8
|
aztecTargetCommitteeSize: 48,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
lagInEpochsForValidatorSet: 2,
|
|
10
|
+
lagInEpochsForRandao: 2,
|
|
11
|
+
aztecProofSubmissionEpochs: 1,
|
|
12
|
+
activationThreshold: 100n * 10n ** 18n,
|
|
13
|
+
ejectionThreshold: 50n * 10n ** 18n,
|
|
14
|
+
localEjectionThreshold: 98n * 10n ** 18n,
|
|
15
|
+
slashAmountSmall: 10n * 10n ** 18n,
|
|
16
|
+
slashAmountMedium: 20n * 10n ** 18n,
|
|
17
|
+
slashAmountLarge: 50n * 10n ** 18n,
|
|
18
|
+
slashingRoundSizeInEpochs: 4,
|
|
19
|
+
slashingLifetimeInRounds: 5,
|
|
20
|
+
slashingExecutionDelayInRounds: 0,
|
|
21
|
+
slashingVetoer: EthAddress.ZERO,
|
|
22
|
+
governanceProposerRoundSize: 300,
|
|
23
|
+
manaTarget: BigInt(100e6),
|
|
24
|
+
provingCostPerMana: BigInt(100),
|
|
25
|
+
exitDelaySeconds: 2 * 24 * 60 * 60,
|
|
26
|
+
slasherFlavor: 'tally',
|
|
27
|
+
slashingOffsetInRounds: 2,
|
|
28
|
+
slashingDisableDuration: 5 * 24 * 60 * 60
|
|
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
|
+
}
|
|
14
211
|
};
|
|
15
212
|
export const l1ContractsConfigMappings = {
|
|
16
213
|
ethereumSlotDuration: {
|
|
@@ -33,38 +230,281 @@ export const l1ContractsConfigMappings = {
|
|
|
33
230
|
description: 'The target validator committee size.',
|
|
34
231
|
...numberConfigHelper(DefaultL1ContractsConfig.aztecTargetCommitteeSize)
|
|
35
232
|
},
|
|
36
|
-
|
|
37
|
-
env: '
|
|
38
|
-
description: 'The number of
|
|
39
|
-
...numberConfigHelper(DefaultL1ContractsConfig.
|
|
233
|
+
lagInEpochsForValidatorSet: {
|
|
234
|
+
env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
|
|
235
|
+
description: 'The number of epochs to lag behind the current epoch for validator selection.',
|
|
236
|
+
...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForValidatorSet)
|
|
40
237
|
},
|
|
41
|
-
|
|
42
|
-
env: '
|
|
238
|
+
lagInEpochsForRandao: {
|
|
239
|
+
env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
|
|
240
|
+
description: 'The number of epochs to lag behind the current epoch for randao selection.',
|
|
241
|
+
...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForRandao)
|
|
242
|
+
},
|
|
243
|
+
aztecProofSubmissionEpochs: {
|
|
244
|
+
env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
|
|
245
|
+
description: 'The number of epochs after an epoch ends that proofs are still accepted.',
|
|
246
|
+
...numberConfigHelper(DefaultL1ContractsConfig.aztecProofSubmissionEpochs)
|
|
247
|
+
},
|
|
248
|
+
activationThreshold: {
|
|
249
|
+
env: 'AZTEC_ACTIVATION_THRESHOLD',
|
|
250
|
+
description: 'The deposit amount for a validator',
|
|
251
|
+
...bigintConfigHelper(DefaultL1ContractsConfig.activationThreshold)
|
|
252
|
+
},
|
|
253
|
+
ejectionThreshold: {
|
|
254
|
+
env: 'AZTEC_EJECTION_THRESHOLD',
|
|
43
255
|
description: 'The minimum stake for a validator.',
|
|
44
|
-
...bigintConfigHelper(DefaultL1ContractsConfig.
|
|
256
|
+
...bigintConfigHelper(DefaultL1ContractsConfig.ejectionThreshold)
|
|
257
|
+
},
|
|
258
|
+
localEjectionThreshold: {
|
|
259
|
+
env: 'AZTEC_LOCAL_EJECTION_THRESHOLD',
|
|
260
|
+
description: 'The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup',
|
|
261
|
+
...bigintConfigHelper(DefaultL1ContractsConfig.localEjectionThreshold)
|
|
262
|
+
},
|
|
263
|
+
slashingOffsetInRounds: {
|
|
264
|
+
env: 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
|
|
265
|
+
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(DefaultL1ContractsConfig.slashingOffsetInRounds)
|
|
267
|
+
},
|
|
268
|
+
slasherFlavor: {
|
|
269
|
+
env: 'AZTEC_SLASHER_FLAVOR',
|
|
270
|
+
description: 'Type of slasher proposer (empire, tally, or none)',
|
|
271
|
+
...enumConfigHelper([
|
|
272
|
+
'empire',
|
|
273
|
+
'tally',
|
|
274
|
+
'none'
|
|
275
|
+
], DefaultL1ContractsConfig.slasherFlavor)
|
|
276
|
+
},
|
|
277
|
+
slashAmountSmall: {
|
|
278
|
+
env: 'AZTEC_SLASH_AMOUNT_SMALL',
|
|
279
|
+
description: 'Small slashing amount for light offenses',
|
|
280
|
+
...bigintConfigHelper(DefaultL1ContractsConfig.slashAmountSmall)
|
|
281
|
+
},
|
|
282
|
+
slashAmountMedium: {
|
|
283
|
+
env: 'AZTEC_SLASH_AMOUNT_MEDIUM',
|
|
284
|
+
description: 'Medium slashing amount for moderate offenses',
|
|
285
|
+
...bigintConfigHelper(DefaultL1ContractsConfig.slashAmountMedium)
|
|
286
|
+
},
|
|
287
|
+
slashAmountLarge: {
|
|
288
|
+
env: 'AZTEC_SLASH_AMOUNT_LARGE',
|
|
289
|
+
description: 'Large slashing amount for severe offenses',
|
|
290
|
+
...bigintConfigHelper(DefaultL1ContractsConfig.slashAmountLarge)
|
|
45
291
|
},
|
|
46
292
|
slashingQuorum: {
|
|
47
293
|
env: 'AZTEC_SLASHING_QUORUM',
|
|
48
294
|
description: 'The slashing quorum',
|
|
49
|
-
...
|
|
295
|
+
...optionalNumberConfigHelper()
|
|
50
296
|
},
|
|
51
|
-
|
|
52
|
-
env: '
|
|
297
|
+
slashingRoundSizeInEpochs: {
|
|
298
|
+
env: 'AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS',
|
|
53
299
|
description: 'The slashing round size',
|
|
54
|
-
...numberConfigHelper(DefaultL1ContractsConfig.
|
|
300
|
+
...numberConfigHelper(DefaultL1ContractsConfig.slashingRoundSizeInEpochs)
|
|
301
|
+
},
|
|
302
|
+
slashingLifetimeInRounds: {
|
|
303
|
+
env: 'AZTEC_SLASHING_LIFETIME_IN_ROUNDS',
|
|
304
|
+
description: 'The slashing lifetime in rounds',
|
|
305
|
+
...numberConfigHelper(DefaultL1ContractsConfig.slashingLifetimeInRounds)
|
|
306
|
+
},
|
|
307
|
+
slashingExecutionDelayInRounds: {
|
|
308
|
+
env: 'AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS',
|
|
309
|
+
description: 'The slashing execution delay in rounds',
|
|
310
|
+
...numberConfigHelper(DefaultL1ContractsConfig.slashingExecutionDelayInRounds)
|
|
311
|
+
},
|
|
312
|
+
slashingVetoer: {
|
|
313
|
+
env: 'AZTEC_SLASHING_VETOER',
|
|
314
|
+
description: 'The slashing vetoer',
|
|
315
|
+
parseEnv: (val)=>EthAddress.fromString(val),
|
|
316
|
+
defaultValue: DefaultL1ContractsConfig.slashingVetoer
|
|
317
|
+
},
|
|
318
|
+
slashingDisableDuration: {
|
|
319
|
+
env: 'AZTEC_SLASHING_DISABLE_DURATION',
|
|
320
|
+
description: 'How long slashing can be disabled for in seconds when vetoer disables it',
|
|
321
|
+
...numberConfigHelper(DefaultL1ContractsConfig.slashingDisableDuration)
|
|
55
322
|
},
|
|
56
323
|
governanceProposerQuorum: {
|
|
57
324
|
env: 'AZTEC_GOVERNANCE_PROPOSER_QUORUM',
|
|
58
325
|
description: 'The governance proposing quorum',
|
|
59
|
-
...
|
|
326
|
+
...optionalNumberConfigHelper()
|
|
60
327
|
},
|
|
61
328
|
governanceProposerRoundSize: {
|
|
62
329
|
env: 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE',
|
|
63
330
|
description: 'The governance proposing round size',
|
|
64
331
|
...numberConfigHelper(DefaultL1ContractsConfig.governanceProposerRoundSize)
|
|
65
332
|
},
|
|
333
|
+
manaTarget: {
|
|
334
|
+
env: 'AZTEC_MANA_TARGET',
|
|
335
|
+
description: 'The mana target for the rollup',
|
|
336
|
+
...bigintConfigHelper(DefaultL1ContractsConfig.manaTarget)
|
|
337
|
+
},
|
|
338
|
+
provingCostPerMana: {
|
|
339
|
+
env: 'AZTEC_PROVING_COST_PER_MANA',
|
|
340
|
+
description: 'The proving cost per mana',
|
|
341
|
+
...bigintConfigHelper(DefaultL1ContractsConfig.provingCostPerMana)
|
|
342
|
+
},
|
|
343
|
+
exitDelaySeconds: {
|
|
344
|
+
env: 'AZTEC_EXIT_DELAY_SECONDS',
|
|
345
|
+
description: 'The delay before a validator can exit the set',
|
|
346
|
+
...numberConfigHelper(DefaultL1ContractsConfig.exitDelaySeconds)
|
|
347
|
+
},
|
|
66
348
|
...l1TxUtilsConfigMappings
|
|
67
349
|
};
|
|
350
|
+
export const genesisStateConfigMappings = {
|
|
351
|
+
testAccounts: {
|
|
352
|
+
env: 'TEST_ACCOUNTS',
|
|
353
|
+
description: 'Whether to populate the genesis state with initial fee juice for the test accounts.',
|
|
354
|
+
...booleanConfigHelper(false)
|
|
355
|
+
},
|
|
356
|
+
sponsoredFPC: {
|
|
357
|
+
env: 'SPONSORED_FPC',
|
|
358
|
+
description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.',
|
|
359
|
+
...booleanConfigHelper(false)
|
|
360
|
+
}
|
|
361
|
+
};
|
|
68
362
|
export function getL1ContractsConfigEnvVars() {
|
|
69
363
|
return getConfigFromMappings(l1ContractsConfigMappings);
|
|
70
364
|
}
|
|
365
|
+
export function getGenesisStateConfigEnvVars() {
|
|
366
|
+
return getConfigFromMappings(genesisStateConfigMappings);
|
|
367
|
+
}
|
|
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
|
+
}
|
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==
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
4
|
+
import { type Hex, type TypedDataDefinition } from 'viem';
|
|
5
|
+
import type { L1TxRequest } from '../l1_tx_utils/index.js';
|
|
3
6
|
export interface IEmpireBase {
|
|
7
|
+
get address(): EthAddress;
|
|
4
8
|
getRoundInfo(rollupAddress: Hex, round: bigint): Promise<{
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
lastSignalSlot: SlotNumber;
|
|
10
|
+
payloadWithMostSignals: Hex;
|
|
7
11
|
executed: boolean;
|
|
8
12
|
}>;
|
|
9
|
-
computeRound(slot:
|
|
10
|
-
|
|
13
|
+
computeRound(slot: SlotNumber): Promise<bigint>;
|
|
14
|
+
createSignalRequest(payload: Hex): L1TxRequest;
|
|
15
|
+
createSignalRequestWithSignature(payload: Hex, slot: SlotNumber, chainId: number, signerAddress: Hex, signer: (msg: TypedDataDefinition) => Promise<Hex>): Promise<L1TxRequest>;
|
|
11
16
|
}
|
|
12
|
-
export declare function
|
|
13
|
-
|
|
17
|
+
export declare function encodeSignal(payload: Hex): Hex;
|
|
18
|
+
export declare function encodeSignalWithSignature(payload: Hex, signature: Signature): `0x${string}`;
|
|
19
|
+
/**
|
|
20
|
+
* Signs a signal proposal using EIP-712 typed data for use with signalWithSig
|
|
21
|
+
* @param walletClient - The viem wallet client to sign with
|
|
22
|
+
* @param payload - The payload address to signal
|
|
23
|
+
* @param verifyingContract - The address of the EmpireBase contract
|
|
24
|
+
* @param chainId - The chain ID where the contract is deployed
|
|
25
|
+
* @param account - The account to sign with (optional if hoisted on wallet client)
|
|
26
|
+
* @returns The EIP-712 signature
|
|
27
|
+
*/
|
|
28
|
+
export declare function signSignalWithSig(signer: (msg: TypedDataDefinition) => Promise<Hex>, payload: Hex, slot: SlotNumber, instance: Hex, verifyingContract: Hex, chainId: number): Promise<Signature>;
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1waXJlX2Jhc2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdHMvZW1waXJlX2Jhc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDbEUsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDaEUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRzVELE9BQU8sRUFBRSxLQUFLLEdBQUcsRUFBRSxLQUFLLG1CQUFtQixFQUFzQixNQUFNLE1BQU0sQ0FBQztBQUU5RSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUUzRCxNQUFNLFdBQVcsV0FBVztJQUMxQixJQUFJLE9BQU8sSUFBSSxVQUFVLENBQUM7SUFDMUIsWUFBWSxDQUNWLGFBQWEsRUFBRSxHQUFHLEVBQ2xCLEtBQUssRUFBRSxNQUFNLEdBQ1osT0FBTyxDQUFDO1FBQUUsY0FBYyxFQUFFLFVBQVUsQ0FBQztRQUFDLHNCQUFzQixFQUFFLEdBQUcsQ0FBQztRQUFDLFFBQVEsRUFBRSxPQUFPLENBQUE7S0FBRSxDQUFDLENBQUM7SUFDM0YsWUFBWSxDQUFDLElBQUksRUFBRSxVQUFVLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0lBQ2hELG1CQUFtQixDQUFDLE9BQU8sRUFBRSxHQUFHLEdBQUcsV0FBVyxDQUFDO0lBQy9DLGdDQUFnQyxDQUM5QixPQUFPLEVBQUUsR0FBRyxFQUNaLElBQUksRUFBRSxVQUFVLEVBQ2hCLE9BQU8sRUFBRSxNQUFNLEVBQ2YsYUFBYSxFQUFFLEdBQUcsRUFDbEIsTUFBTSxFQUFFLENBQUMsR0FBRyxFQUFFLG1CQUFtQixLQUFLLE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FDakQsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0NBQ3pCO0FBRUQsd0JBQWdCLFlBQVksQ0FBQyxPQUFPLEVBQUUsR0FBRyxHQUFHLEdBQUcsQ0FNOUM7QUFFRCx3QkFBZ0IseUJBQXlCLENBQUMsT0FBTyxFQUFFLEdBQUcsRUFBRSxTQUFTLEVBQUUsU0FBUyxpQkFNM0U7QUFFRDs7Ozs7Ozs7R0FRRztBQUNILHdCQUFzQixpQkFBaUIsQ0FDckMsTUFBTSxFQUFFLENBQUMsR0FBRyxFQUFFLG1CQUFtQixLQUFLLE9BQU8sQ0FBQyxHQUFHLENBQUMsRUFDbEQsT0FBTyxFQUFFLEdBQUcsRUFDWixJQUFJLEVBQUUsVUFBVSxFQUNoQixRQUFRLEVBQUUsR0FBRyxFQUNiLGlCQUFpQixFQUFFLEdBQUcsRUFDdEIsT0FBTyxFQUFFLE1BQU0sR0FDZCxPQUFPLENBQUMsU0FBUyxDQUFDLENBOEJwQiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empire_base.d.ts","sourceRoot":"","sources":["../../src/contracts/empire_base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"empire_base.d.ts","sourceRoot":"","sources":["../../src/contracts/empire_base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,mBAAmB,EAAsB,MAAM,MAAM,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,WAAW,WAAW;IAC1B,IAAI,OAAO,IAAI,UAAU,CAAC;IAC1B,YAAY,CACV,aAAa,EAAE,GAAG,EAClB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;QAAE,cAAc,EAAE,UAAU,CAAC;QAAC,sBAAsB,EAAE,GAAG,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC3F,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,mBAAmB,CAAC,OAAO,EAAE,GAAG,GAAG,WAAW,CAAC;IAC/C,gCAAgC,CAC9B,OAAO,EAAE,GAAG,EACZ,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,GAAG,EAClB,MAAM,EAAE,CAAC,GAAG,EAAE,mBAAmB,KAAK,OAAO,CAAC,GAAG,CAAC,GACjD,OAAO,CAAC,WAAW,CAAC,CAAC;CACzB;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,CAM9C;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,iBAM3E;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,CAAC,GAAG,EAAE,mBAAmB,KAAK,OAAO,CAAC,GAAG,CAAC,EAClD,OAAO,EAAE,GAAG,EACZ,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,GAAG,EACb,iBAAiB,EAAE,GAAG,EACtB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,CAAC,CA8BpB"}
|
|
@@ -1,11 +1,84 @@
|
|
|
1
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
1
2
|
import { EmpireBaseAbi } from '@aztec/l1-artifacts/EmpireBaseAbi';
|
|
2
3
|
import { encodeFunctionData } from 'viem';
|
|
3
|
-
export function
|
|
4
|
+
export function encodeSignal(payload) {
|
|
4
5
|
return encodeFunctionData({
|
|
5
6
|
abi: EmpireBaseAbi,
|
|
6
|
-
functionName: '
|
|
7
|
+
functionName: 'signal',
|
|
7
8
|
args: [
|
|
8
9
|
payload
|
|
9
10
|
]
|
|
10
11
|
});
|
|
11
12
|
}
|
|
13
|
+
export function encodeSignalWithSignature(payload, signature) {
|
|
14
|
+
return encodeFunctionData({
|
|
15
|
+
abi: EmpireBaseAbi,
|
|
16
|
+
functionName: 'signalWithSig',
|
|
17
|
+
args: [
|
|
18
|
+
payload,
|
|
19
|
+
signature.toViemSignature()
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Signs a signal proposal using EIP-712 typed data for use with signalWithSig
|
|
25
|
+
* @param walletClient - The viem wallet client to sign with
|
|
26
|
+
* @param payload - The payload address to signal
|
|
27
|
+
* @param verifyingContract - The address of the EmpireBase contract
|
|
28
|
+
* @param chainId - The chain ID where the contract is deployed
|
|
29
|
+
* @param account - The account to sign with (optional if hoisted on wallet client)
|
|
30
|
+
* @returns The EIP-712 signature
|
|
31
|
+
*/ export async function signSignalWithSig(signer, payload, slot, instance, verifyingContract, chainId) {
|
|
32
|
+
const domain = {
|
|
33
|
+
name: 'EmpireBase',
|
|
34
|
+
version: '1',
|
|
35
|
+
chainId,
|
|
36
|
+
verifyingContract
|
|
37
|
+
};
|
|
38
|
+
const types = {
|
|
39
|
+
EIP712Domain: [
|
|
40
|
+
{
|
|
41
|
+
name: 'name',
|
|
42
|
+
type: 'string'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'version',
|
|
46
|
+
type: 'string'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'chainId',
|
|
50
|
+
type: 'uint256'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'verifyingContract',
|
|
54
|
+
type: 'address'
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
Signal: [
|
|
58
|
+
{
|
|
59
|
+
name: 'payload',
|
|
60
|
+
type: 'address'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'slot',
|
|
64
|
+
type: 'uint256'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'instance',
|
|
68
|
+
type: 'address'
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
};
|
|
72
|
+
const message = {
|
|
73
|
+
payload,
|
|
74
|
+
slot: BigInt(slot),
|
|
75
|
+
instance
|
|
76
|
+
};
|
|
77
|
+
const typedData = {
|
|
78
|
+
domain,
|
|
79
|
+
types,
|
|
80
|
+
primaryType: 'Signal',
|
|
81
|
+
message
|
|
82
|
+
};
|
|
83
|
+
return Signature.fromString(await signer(typedData));
|
|
84
|
+
}
|