@aztec/ethereum 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107
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 +2 -2
- package/dest/client.d.ts.map +1 -1
- package/dest/client.js +6 -2
- package/dest/config.d.ts +18 -46
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +40 -285
- package/dest/constants.d.ts +1 -1
- package/dest/contracts/empire_base.d.ts +8 -6
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_base.js +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +8 -6
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +18 -3
- 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 +4 -4
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- 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 +16 -16
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +7 -3
- package/dest/contracts/governance_proposer.d.ts +7 -6
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +400 -12
- package/dest/contracts/gse.d.ts +1 -1
- package/dest/contracts/gse.d.ts.map +1 -1
- package/dest/contracts/inbox.d.ts +7 -3
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +4 -0
- package/dest/contracts/index.d.ts +1 -1
- package/dest/contracts/multicall.d.ts +5 -7
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +6 -4
- package/dest/contracts/registry.d.ts +1 -1
- package/dest/contracts/registry.d.ts.map +1 -1
- package/dest/contracts/rollup.d.ts +168 -117
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +712 -241
- package/dest/contracts/slasher_contract.d.ts +11 -1
- package/dest/contracts/slasher_contract.d.ts.map +1 -1
- package/dest/contracts/slasher_contract.js +18 -0
- package/dest/contracts/tally_slashing_proposer.d.ts +15 -7
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +15 -5
- package/dest/contracts/utils.d.ts +1 -1
- package/dest/deploy_aztec_l1_contracts.d.ts +247 -0
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
- package/dest/deploy_aztec_l1_contracts.js +336 -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/l1_artifacts.d.ts +17698 -6245
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +10 -5
- package/dest/l1_contract_addresses.d.ts +8 -4
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +5 -4
- package/dest/l1_reader.d.ts +4 -2
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +7 -1
- 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 +96 -0
- package/dest/l1_tx_utils/constants.d.ts +12 -0
- package/dest/l1_tx_utils/constants.d.ts.map +1 -0
- package/dest/l1_tx_utils/constants.js +39 -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/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 +48 -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 +12 -0
- package/dest/l1_tx_utils/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/index.js +12 -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_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 +94 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/l1_tx_utils.js +623 -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 +83 -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 +323 -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 +1 -1
- package/dest/publisher_manager.d.ts +8 -3
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +36 -8
- package/dest/queries.d.ts +1 -1
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +20 -14
- package/dest/test/chain_monitor.d.ts +29 -22
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +81 -38
- package/dest/test/delayed_tx_utils.d.ts +3 -3
- package/dest/test/delayed_tx_utils.d.ts.map +1 -1
- package/dest/test/delayed_tx_utils.js +2 -2
- package/dest/test/eth_cheat_codes.d.ts +36 -14
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +126 -31
- 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 -1
- package/dest/test/rollup_cheat_codes.d.ts +23 -20
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +82 -43
- package/dest/test/start_anvil.d.ts +4 -1
- package/dest/test/start_anvil.d.ts.map +1 -1
- package/dest/test/start_anvil.js +2 -1
- package/dest/test/tx_delayer.d.ts +1 -1
- package/dest/test/tx_delayer.d.ts.map +1 -1
- package/dest/test/tx_delayer.js +4 -3
- package/dest/test/upgrade_utils.d.ts +1 -1
- package/dest/test/upgrade_utils.d.ts.map +1 -1
- package/dest/test/upgrade_utils.js +3 -2
- package/dest/types.d.ts +57 -2
- package/dest/types.d.ts.map +1 -1
- package/dest/utils.d.ts +15 -3
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +28 -161
- package/dest/zkPassportVerifierAddress.d.ts +1 -1
- package/dest/zkPassportVerifierAddress.js +1 -1
- package/package.json +33 -14
- package/src/client.ts +3 -3
- package/src/config.ts +49 -358
- package/src/contracts/empire_base.ts +7 -6
- package/src/contracts/empire_slashing_proposer.ts +23 -8
- package/src/contracts/fee_asset_handler.ts +1 -1
- package/src/contracts/governance.ts +3 -3
- package/src/contracts/governance_proposer.ts +19 -9
- package/src/contracts/inbox.ts +7 -2
- package/src/contracts/multicall.ts +12 -10
- package/src/contracts/rollup.ts +373 -235
- package/src/contracts/slasher_contract.ts +22 -0
- package/src/contracts/tally_slashing_proposer.ts +21 -9
- package/src/deploy_aztec_l1_contracts.ts +557 -0
- package/src/deploy_l1_contract.ts +362 -0
- package/src/forwarder_proxy.ts +108 -0
- package/src/l1_artifacts.ts +14 -6
- package/src/l1_contract_addresses.ts +24 -20
- package/src/l1_reader.ts +10 -2
- package/src/l1_tx_utils/README.md +177 -0
- package/src/l1_tx_utils/config.ts +161 -0
- package/src/l1_tx_utils/constants.ts +29 -0
- package/src/l1_tx_utils/factory.ts +64 -0
- 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 +119 -0
- package/src/l1_tx_utils/index-blobs.ts +2 -0
- package/src/l1_tx_utils/index.ts +14 -0
- package/src/l1_tx_utils/interfaces.ts +86 -0
- package/src/l1_tx_utils/l1_fee_analyzer.ts +803 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +738 -0
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +77 -0
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +419 -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/publisher_manager.ts +51 -9
- package/src/queries.ts +24 -10
- package/src/test/chain_monitor.ts +102 -44
- package/src/test/delayed_tx_utils.ts +2 -2
- package/src/test/eth_cheat_codes.ts +150 -31
- package/src/test/rollup_cheat_codes.ts +95 -53
- package/src/test/start_anvil.ts +4 -0
- package/src/test/tx_delayer.ts +5 -3
- package/src/test/upgrade_utils.ts +3 -2
- package/src/types.ts +62 -0
- package/src/utils.ts +41 -184
- package/src/zkPassportVerifierAddress.ts +1 -1
- package/dest/deploy_l1_contracts.d.ts +0 -211
- package/dest/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/deploy_l1_contracts.js +0 -1267
- 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.d.ts +0 -250
- package/dest/l1_tx_utils.d.ts.map +0 -1
- package/dest/l1_tx_utils.js +0 -826
- package/dest/l1_tx_utils_with_blobs.d.ts +0 -19
- package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/dest/l1_tx_utils_with_blobs.js +0 -85
- package/src/deploy_l1_contracts.ts +0 -1596
- package/src/index.ts +0 -17
- package/src/l1_tx_utils.ts +0 -1105
- package/src/l1_tx_utils_with_blobs.ts +0 -144
package/src/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type ConfigMappingsType,
|
|
3
|
-
type NetworkNames,
|
|
3
|
+
// type NetworkNames,
|
|
4
4
|
bigintConfigHelper,
|
|
5
5
|
booleanConfigHelper,
|
|
6
6
|
enumConfigHelper,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@aztec/foundation/config';
|
|
11
11
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
12
|
|
|
13
|
-
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils.js';
|
|
13
|
+
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils/config.js';
|
|
14
14
|
|
|
15
15
|
export type GenesisStateConfig = {
|
|
16
16
|
/** Whether to populate the genesis state with initial fee juice for the test accounts */
|
|
@@ -28,12 +28,20 @@ export type L1ContractsConfig = {
|
|
|
28
28
|
aztecEpochDuration: number;
|
|
29
29
|
/** The target validator committee size. */
|
|
30
30
|
aztecTargetCommitteeSize: number;
|
|
31
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
32
|
+
lagInEpochsForValidatorSet: number;
|
|
33
|
+
/** The number of epochs to lag behind the current epoch for randao selection. */
|
|
34
|
+
lagInEpochsForRandao: number;
|
|
35
|
+
/** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
|
|
36
|
+
inboxLag: number;
|
|
31
37
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
32
38
|
aztecProofSubmissionEpochs: number;
|
|
33
39
|
/** The deposit amount for a validator */
|
|
34
40
|
activationThreshold: bigint;
|
|
35
41
|
/** The minimum stake for a validator. */
|
|
36
42
|
ejectionThreshold: bigint;
|
|
43
|
+
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
|
|
44
|
+
localEjectionThreshold: bigint;
|
|
37
45
|
/** The slashing quorum, i.e. how many slots must signal for the same payload in a round for it to be submittable to the Slasher (defaults to slashRoundSize / 2 + 1) */
|
|
38
46
|
slashingQuorum?: number;
|
|
39
47
|
/** The slashing round size, i.e. how many epochs are in a slashing round */
|
|
@@ -46,6 +54,8 @@ export type L1ContractsConfig = {
|
|
|
46
54
|
slashingVetoer: EthAddress;
|
|
47
55
|
/** How many slashing rounds back we slash (ie when slashing in round N, we slash for offenses committed during epochs of round N-offset) */
|
|
48
56
|
slashingOffsetInRounds: number;
|
|
57
|
+
/** How long slashing can be disabled for in seconds when vetoer disables it */
|
|
58
|
+
slashingDisableDuration: number;
|
|
49
59
|
/** Type of slasher proposer */
|
|
50
60
|
slasherFlavor: 'empire' | 'tally' | 'none';
|
|
51
61
|
/** Minimum amount that can be slashed in tally slashing */
|
|
@@ -71,172 +81,29 @@ export const DefaultL1ContractsConfig = {
|
|
|
71
81
|
aztecSlotDuration: 36,
|
|
72
82
|
aztecEpochDuration: 32,
|
|
73
83
|
aztecTargetCommitteeSize: 48,
|
|
84
|
+
lagInEpochsForValidatorSet: 2,
|
|
85
|
+
lagInEpochsForRandao: 2, // For PROD, this value should be > lagInEpochsForValidatorSet
|
|
86
|
+
inboxLag: 1, // Default inbox lag to prevent sequencer DOS attacks
|
|
74
87
|
aztecProofSubmissionEpochs: 1, // you have a full epoch to submit a proof after the epoch to prove ends
|
|
75
|
-
activationThreshold:
|
|
76
|
-
ejectionThreshold:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
activationThreshold: 100n * 10n ** 18n,
|
|
89
|
+
ejectionThreshold: 50n * 10n ** 18n,
|
|
90
|
+
localEjectionThreshold: 98n * 10n ** 18n,
|
|
91
|
+
slashAmountSmall: 10n * 10n ** 18n,
|
|
92
|
+
slashAmountMedium: 20n * 10n ** 18n,
|
|
93
|
+
slashAmountLarge: 50n * 10n ** 18n,
|
|
80
94
|
slashingRoundSizeInEpochs: 4,
|
|
81
95
|
slashingLifetimeInRounds: 5,
|
|
82
96
|
slashingExecutionDelayInRounds: 0, // round N may be submitted in round N + 1
|
|
83
97
|
slashingVetoer: EthAddress.ZERO,
|
|
84
98
|
governanceProposerRoundSize: 300,
|
|
85
|
-
manaTarget: BigInt(
|
|
99
|
+
manaTarget: BigInt(100e6),
|
|
86
100
|
provingCostPerMana: BigInt(100),
|
|
87
101
|
exitDelaySeconds: 2 * 24 * 60 * 60,
|
|
88
102
|
slasherFlavor: 'tally' as const,
|
|
89
103
|
slashingOffsetInRounds: 2,
|
|
104
|
+
slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
|
|
90
105
|
} satisfies L1ContractsConfig;
|
|
91
106
|
|
|
92
|
-
const LocalGovernanceConfiguration = {
|
|
93
|
-
proposeConfig: {
|
|
94
|
-
lockDelay: 60n * 60n * 24n * 30n,
|
|
95
|
-
lockAmount: 1n * 10n ** 24n,
|
|
96
|
-
},
|
|
97
|
-
votingDelay: 60n,
|
|
98
|
-
votingDuration: 60n * 60n,
|
|
99
|
-
executionDelay: 60n,
|
|
100
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
101
|
-
quorum: 1n * 10n ** 17n, // 10%
|
|
102
|
-
requiredYeaMargin: 4n * 10n ** 16n, // 4%
|
|
103
|
-
minimumVotes: 400n * 10n ** 18n,
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const TestnetGovernanceConfiguration = {
|
|
107
|
-
proposeConfig: {
|
|
108
|
-
lockDelay: 60n * 60n * 24n,
|
|
109
|
-
lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n,
|
|
110
|
-
},
|
|
111
|
-
votingDelay: 60n,
|
|
112
|
-
votingDuration: 60n * 60n,
|
|
113
|
-
executionDelay: 60n * 60n * 24n,
|
|
114
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
115
|
-
quorum: 3n * 10n ** 17n, // 30%
|
|
116
|
-
requiredYeaMargin: 4n * 10n ** 16n, // 4%
|
|
117
|
-
minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export const getGovernanceConfiguration = (networkName: NetworkNames) => {
|
|
121
|
-
switch (networkName) {
|
|
122
|
-
case 'alpha-testnet':
|
|
123
|
-
case 'testnet':
|
|
124
|
-
return TestnetGovernanceConfiguration;
|
|
125
|
-
case 'local':
|
|
126
|
-
return LocalGovernanceConfiguration;
|
|
127
|
-
default:
|
|
128
|
-
throw new Error('Unrecognized network name: ' + networkName);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const TestnetGSEConfiguration = {
|
|
133
|
-
activationThreshold: BigInt(100e18),
|
|
134
|
-
ejectionThreshold: BigInt(50e18),
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const LocalGSEConfiguration = {
|
|
138
|
-
activationThreshold: BigInt(100e18),
|
|
139
|
-
ejectionThreshold: BigInt(50e18),
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export const getGSEConfiguration = (networkName: NetworkNames) => {
|
|
143
|
-
switch (networkName) {
|
|
144
|
-
case 'alpha-testnet':
|
|
145
|
-
case 'testnet':
|
|
146
|
-
return TestnetGSEConfiguration;
|
|
147
|
-
case 'local':
|
|
148
|
-
return LocalGSEConfiguration;
|
|
149
|
-
default:
|
|
150
|
-
throw new Error('Unrecognized network name: ' + networkName);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
// Making a default config here as we are only using it thought the deployment
|
|
155
|
-
// and do not expect to be using different setups, so having environment variables
|
|
156
|
-
// for it seems overkill
|
|
157
|
-
const LocalRewardConfig = {
|
|
158
|
-
sequencerBps: 5000,
|
|
159
|
-
rewardDistributor: EthAddress.ZERO.toString(),
|
|
160
|
-
booster: EthAddress.ZERO.toString(),
|
|
161
|
-
blockReward: BigInt(50e18),
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const TestnetRewardConfig = {
|
|
165
|
-
sequencerBps: 5000,
|
|
166
|
-
rewardDistributor: EthAddress.ZERO.toString(),
|
|
167
|
-
booster: EthAddress.ZERO.toString(),
|
|
168
|
-
blockReward: BigInt(50e18),
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export const getRewardConfig = (networkName: NetworkNames) => {
|
|
172
|
-
switch (networkName) {
|
|
173
|
-
case 'alpha-testnet':
|
|
174
|
-
case 'testnet':
|
|
175
|
-
return TestnetRewardConfig;
|
|
176
|
-
case 'local':
|
|
177
|
-
return LocalRewardConfig;
|
|
178
|
-
default:
|
|
179
|
-
throw new Error('Unrecognized network name: ' + networkName);
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
const LocalRewardBoostConfig = {
|
|
184
|
-
increment: 200000,
|
|
185
|
-
maxScore: 5000000,
|
|
186
|
-
a: 5000,
|
|
187
|
-
k: 1000000,
|
|
188
|
-
minimum: 100000,
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const TestnetRewardBoostConfig = {
|
|
192
|
-
increment: 125000,
|
|
193
|
-
maxScore: 15000000,
|
|
194
|
-
a: 1000,
|
|
195
|
-
k: 1000000,
|
|
196
|
-
minimum: 100000,
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
export const getRewardBoostConfig = (networkName: NetworkNames) => {
|
|
200
|
-
switch (networkName) {
|
|
201
|
-
case 'alpha-testnet':
|
|
202
|
-
case 'testnet':
|
|
203
|
-
return TestnetRewardBoostConfig;
|
|
204
|
-
case 'local':
|
|
205
|
-
return LocalRewardBoostConfig;
|
|
206
|
-
default:
|
|
207
|
-
throw new Error('Unrecognized network name: ' + networkName);
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
// Similar to the above, no need for environment variables for this.
|
|
212
|
-
const LocalEntryQueueConfig = {
|
|
213
|
-
bootstrapValidatorSetSize: 0n,
|
|
214
|
-
bootstrapFlushSize: 0n,
|
|
215
|
-
normalFlushSizeMin: 48n, // will effectively be bounded by maxQueueFlushSize
|
|
216
|
-
normalFlushSizeQuotient: 2n,
|
|
217
|
-
maxQueueFlushSize: 48n,
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
const TestnetEntryQueueConfig = {
|
|
221
|
-
bootstrapValidatorSetSize: 750n,
|
|
222
|
-
bootstrapFlushSize: 75n, // will effectively be bounded by maxQueueFlushSize
|
|
223
|
-
normalFlushSizeMin: 1n,
|
|
224
|
-
normalFlushSizeQuotient: 2475n,
|
|
225
|
-
maxQueueFlushSize: 32n, // Limited to 32 so flush cost are kept below 15M gas.
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
export const getEntryQueueConfig = (networkName: NetworkNames) => {
|
|
229
|
-
switch (networkName) {
|
|
230
|
-
case 'alpha-testnet':
|
|
231
|
-
case 'testnet':
|
|
232
|
-
return TestnetEntryQueueConfig;
|
|
233
|
-
case 'local':
|
|
234
|
-
return LocalEntryQueueConfig;
|
|
235
|
-
default:
|
|
236
|
-
throw new Error('Unrecognized network name: ' + networkName);
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
|
|
240
107
|
export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> = {
|
|
241
108
|
ethereumSlotDuration: {
|
|
242
109
|
env: 'ETHEREUM_SLOT_DURATION',
|
|
@@ -258,6 +125,21 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
258
125
|
description: 'The target validator committee size.',
|
|
259
126
|
...numberConfigHelper(DefaultL1ContractsConfig.aztecTargetCommitteeSize),
|
|
260
127
|
},
|
|
128
|
+
lagInEpochsForValidatorSet: {
|
|
129
|
+
env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
|
|
130
|
+
description: 'The number of epochs to lag behind the current epoch for validator selection.',
|
|
131
|
+
...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForValidatorSet),
|
|
132
|
+
},
|
|
133
|
+
lagInEpochsForRandao: {
|
|
134
|
+
env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
|
|
135
|
+
description: 'The number of epochs to lag behind the current epoch for randao selection.',
|
|
136
|
+
...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForRandao),
|
|
137
|
+
},
|
|
138
|
+
inboxLag: {
|
|
139
|
+
env: 'AZTEC_INBOX_LAG',
|
|
140
|
+
description: 'The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks).',
|
|
141
|
+
...numberConfigHelper(DefaultL1ContractsConfig.inboxLag),
|
|
142
|
+
},
|
|
261
143
|
aztecProofSubmissionEpochs: {
|
|
262
144
|
env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
|
|
263
145
|
description: 'The number of epochs after an epoch ends that proofs are still accepted.',
|
|
@@ -273,6 +155,12 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
273
155
|
description: 'The minimum stake for a validator.',
|
|
274
156
|
...bigintConfigHelper(DefaultL1ContractsConfig.ejectionThreshold),
|
|
275
157
|
},
|
|
158
|
+
localEjectionThreshold: {
|
|
159
|
+
env: 'AZTEC_LOCAL_EJECTION_THRESHOLD',
|
|
160
|
+
description:
|
|
161
|
+
'The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup',
|
|
162
|
+
...bigintConfigHelper(DefaultL1ContractsConfig.localEjectionThreshold),
|
|
163
|
+
},
|
|
276
164
|
slashingOffsetInRounds: {
|
|
277
165
|
env: 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
|
|
278
166
|
description:
|
|
@@ -325,6 +213,11 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
325
213
|
parseEnv: (val: string) => EthAddress.fromString(val),
|
|
326
214
|
defaultValue: DefaultL1ContractsConfig.slashingVetoer,
|
|
327
215
|
},
|
|
216
|
+
slashingDisableDuration: {
|
|
217
|
+
env: 'AZTEC_SLASHING_DISABLE_DURATION',
|
|
218
|
+
description: 'How long slashing can be disabled for in seconds when vetoer disables it',
|
|
219
|
+
...numberConfigHelper(DefaultL1ContractsConfig.slashingDisableDuration),
|
|
220
|
+
},
|
|
328
221
|
governanceProposerQuorum: {
|
|
329
222
|
env: 'AZTEC_GOVERNANCE_PROPOSER_QUORUM',
|
|
330
223
|
description: 'The governance proposing quorum',
|
|
@@ -373,205 +266,3 @@ export function getL1ContractsConfigEnvVars(): L1ContractsConfig {
|
|
|
373
266
|
export function getGenesisStateConfigEnvVars(): GenesisStateConfig {
|
|
374
267
|
return getConfigFromMappings(genesisStateConfigMappings);
|
|
375
268
|
}
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Validates the L1 contracts configuration to ensure all requirements enforced by L1 contracts
|
|
379
|
-
* during construction are satisfied before deployment.
|
|
380
|
-
* Accumulates all validation errors and throws an exception listing them all if any are found.
|
|
381
|
-
*/
|
|
382
|
-
export function validateConfig(config: Omit<L1ContractsConfig, keyof L1TxUtilsConfig>): void {
|
|
383
|
-
const errors: string[] = [];
|
|
384
|
-
|
|
385
|
-
// RollupCore constructor validation: normalFlushSizeMin > 0
|
|
386
|
-
// From: require(_config.stakingQueueConfig.normalFlushSizeMin > 0, Errors.Staking__InvalidStakingQueueConfig());
|
|
387
|
-
const entryQueueConfig = getEntryQueueConfig('testnet'); // Get config to check normalFlushSizeMin
|
|
388
|
-
if (entryQueueConfig.normalFlushSizeMin <= 0n) {
|
|
389
|
-
errors.push('normalFlushSizeMin must be greater than 0');
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
// TimeLib initialization validation: aztecSlotDuration should be a multiple of ethereumSlotDuration
|
|
393
|
-
// While not explicitly required in constructor, this is a common validation for time-based systems
|
|
394
|
-
if (config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
|
|
395
|
-
errors.push(
|
|
396
|
-
`aztecSlotDuration (${config.aztecSlotDuration}) must be a multiple of ethereumSlotDuration (${config.ethereumSlotDuration})`,
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// EmpireBase constructor validations for governance/slashing proposers
|
|
401
|
-
// From: require(QUORUM_SIZE > ROUND_SIZE / 2, Errors.GovernanceProposer__InvalidQuorumAndRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
402
|
-
const { governanceProposerQuorum, governanceProposerRoundSize } = config;
|
|
403
|
-
if (
|
|
404
|
-
governanceProposerQuorum !== undefined &&
|
|
405
|
-
governanceProposerQuorum <= Math.floor(governanceProposerRoundSize / 2)
|
|
406
|
-
) {
|
|
407
|
-
errors.push(
|
|
408
|
-
`governanceProposerQuorum (${governanceProposerQuorum}) must be greater than half of governanceProposerRoundSize (${Math.floor(governanceProposerRoundSize / 2)})`,
|
|
409
|
-
);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// From: require(QUORUM_SIZE <= ROUND_SIZE, Errors.GovernanceProposer__QuorumCannotBeLargerThanRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
413
|
-
if (governanceProposerQuorum !== undefined && governanceProposerQuorum > governanceProposerRoundSize) {
|
|
414
|
-
errors.push(
|
|
415
|
-
`governanceProposerQuorum (${governanceProposerQuorum}) cannot be larger than governanceProposerRoundSize (${governanceProposerRoundSize})`,
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// Slashing quorum validations (similar to governance quorum)
|
|
420
|
-
const slashingRoundSize = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
421
|
-
const { slashingQuorum } = config;
|
|
422
|
-
if (slashingQuorum !== undefined && slashingQuorum <= Math.floor(slashingRoundSize / 2)) {
|
|
423
|
-
errors.push(
|
|
424
|
-
`slashingQuorum (${slashingQuorum}) must be greater than half of slashingRoundSizeInEpochs (${Math.floor(slashingRoundSize / 2)})`,
|
|
425
|
-
);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
if (slashingQuorum !== undefined && slashingQuorum > slashingRoundSize) {
|
|
429
|
-
errors.push(
|
|
430
|
-
`slashingQuorum (${slashingQuorum}) cannot be larger than slashingRoundSizeInEpochs (${slashingRoundSize})`,
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
// EmpireBase and TallySlashingProposer lifetime and execution delay validation
|
|
435
|
-
// From: require(LIFETIME_IN_ROUNDS > EXECUTION_DELAY_IN_ROUNDS);
|
|
436
|
-
if (config.slashingLifetimeInRounds <= config.slashingExecutionDelayInRounds) {
|
|
437
|
-
errors.push(
|
|
438
|
-
`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be greater than slashingExecutionDelayInRounds (${config.slashingExecutionDelayInRounds})`,
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
// Staking asset validation: activationThreshold > ejectionThreshold
|
|
443
|
-
if (config.activationThreshold < config.ejectionThreshold) {
|
|
444
|
-
errors.push(
|
|
445
|
-
`activationThreshold (${config.activationThreshold}) must be greater than ejectionThreshold (${config.ejectionThreshold})`,
|
|
446
|
-
);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
// TallySlashingProposer constructor validations
|
|
450
|
-
if (config.slasherFlavor === 'tally') {
|
|
451
|
-
validateTallySlasherConfig(config, errors);
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// Epoch and slot duration validations
|
|
455
|
-
if (config.aztecSlotDuration <= 0) {
|
|
456
|
-
errors.push('aztecSlotDuration must be greater than 0');
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
if (config.ethereumSlotDuration <= 0) {
|
|
460
|
-
errors.push('ethereumSlotDuration must be greater than 0');
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
if (config.aztecEpochDuration <= 0) {
|
|
464
|
-
errors.push('aztecEpochDuration must be greater than 0');
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
// Committee size validation
|
|
468
|
-
if (config.aztecTargetCommitteeSize < 0) {
|
|
469
|
-
errors.push('aztecTargetCommitteeSize cannot be negative');
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
// Proof submission epochs validation
|
|
473
|
-
if (config.aztecProofSubmissionEpochs < 0) {
|
|
474
|
-
errors.push('aztecProofSubmissionEpochs cannot be negative');
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
// Exit delay validation
|
|
478
|
-
if (config.exitDelaySeconds < 0) {
|
|
479
|
-
errors.push('exitDelaySeconds cannot be negative');
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
// Mana validation
|
|
483
|
-
if (config.manaTarget < 0n) {
|
|
484
|
-
errors.push('manaTarget cannot be negative');
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
if (config.provingCostPerMana < 0n) {
|
|
488
|
-
errors.push('provingCostPerMana cannot be negative');
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
// If any errors were found, throw an exception with all of them
|
|
492
|
-
if (errors.length > 0) {
|
|
493
|
-
throw new Error(
|
|
494
|
-
`L1 contracts configuration validation failed with ${errors.length} error(s):\n${errors.map((error, index) => `${index + 1}. ${error}`).join('\n')}`,
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
function validateTallySlasherConfig(config: L1ContractsConfig, errors: string[]) {
|
|
500
|
-
if (config.slasherFlavor !== 'tally') {
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
// From: require(SLASH_OFFSET_IN_ROUNDS > 0, Errors.TallySlashingProposer__SlashOffsetMustBeGreaterThanZero(...));
|
|
505
|
-
if (config.slashingOffsetInRounds <= 0) {
|
|
506
|
-
errors.push(`slashingOffsetInRounds (${config.slashingOffsetInRounds}) must be greater than 0`);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
// From: require(ROUND_SIZE_IN_EPOCHS * _epochDuration == ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeMustBeMultipleOfEpochDuration(...));
|
|
510
|
-
const roundSizeInSlots = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
511
|
-
|
|
512
|
-
// From: require(QUORUM > 0, Errors.TallySlashingProposer__QuorumMustBeGreaterThanZero());
|
|
513
|
-
const { slashingQuorum } = config;
|
|
514
|
-
if (slashingQuorum !== undefined && slashingQuorum <= 0) {
|
|
515
|
-
errors.push(`slashingQuorum (${slashingQuorum}) must be greater than 0`);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
// From: require(ROUND_SIZE > 1, Errors.TallySlashingProposer__InvalidQuorumAndRoundSize(QUORUM, ROUND_SIZE));
|
|
519
|
-
if (roundSizeInSlots <= 1) {
|
|
520
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be greater than 1`);
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
// From: require(_slashAmounts[0] <= _slashAmounts[1], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
524
|
-
if (config.slashAmountSmall > config.slashAmountMedium) {
|
|
525
|
-
errors.push(
|
|
526
|
-
`slashAmountSmall (${config.slashAmountSmall}) must be less than or equal to slashAmountMedium (${config.slashAmountMedium})`,
|
|
527
|
-
);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
// From: require(_slashAmounts[1] <= _slashAmounts[2], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
531
|
-
if (config.slashAmountMedium > config.slashAmountLarge) {
|
|
532
|
-
errors.push(
|
|
533
|
-
`slashAmountMedium (${config.slashAmountMedium}) must be less than or equal to slashAmountLarge (${config.slashAmountLarge})`,
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
// From: require(LIFETIME_IN_ROUNDS < ROUNDABOUT_SIZE, Errors.TallySlashingProposer__LifetimeMustBeLessThanRoundabout(...));
|
|
538
|
-
const ROUNDABOUT_SIZE = 128; // Constant from TallySlashingProposer
|
|
539
|
-
if (config.slashingLifetimeInRounds >= ROUNDABOUT_SIZE) {
|
|
540
|
-
errors.push(`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be less than ${ROUNDABOUT_SIZE}`);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
// From: require(ROUND_SIZE_IN_EPOCHS > 0, Errors.TallySlashingProposer__RoundSizeInEpochsMustBeGreaterThanZero(...));
|
|
544
|
-
if (config.slashingRoundSizeInEpochs <= 0) {
|
|
545
|
-
errors.push(`slashingRoundSizeInEpochs (${config.slashingRoundSizeInEpochs}) must be greater than 0`);
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
// From: require(ROUND_SIZE < MAX_ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeTooLarge(ROUND_SIZE, MAX_ROUND_SIZE));
|
|
549
|
-
const MAX_ROUND_SIZE = 1024; // Constant from TallySlashingProposer
|
|
550
|
-
if (roundSizeInSlots >= MAX_ROUND_SIZE) {
|
|
551
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be less than ${MAX_ROUND_SIZE}`);
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
// From: require(COMMITTEE_SIZE > 0, Errors.TallySlashingProposer__CommitteeSizeMustBeGreaterThanZero(COMMITTEE_SIZE));
|
|
555
|
-
if (config.aztecTargetCommitteeSize <= 0) {
|
|
556
|
-
errors.push(`aztecTargetCommitteeSize (${config.aztecTargetCommitteeSize}) must be greater than 0`);
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
// From: require(voteSize <= 128, Errors.TallySlashingProposer__VoteSizeTooBig(voteSize, 128));
|
|
560
|
-
// voteSize = COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS / 4
|
|
561
|
-
const voteSize = (config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs) / 4;
|
|
562
|
-
if (voteSize > 128) {
|
|
563
|
-
errors.push(`vote size (${voteSize}) must be <= 128 (committee size * round size in epochs / 4)`);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
// From: require(COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS % 4 == 0, Errors.TallySlashingProposer__InvalidCommitteeAndRoundSize(...));
|
|
567
|
-
if ((config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs) % 4 !== 0) {
|
|
568
|
-
errors.push(
|
|
569
|
-
`aztecTargetCommitteeSize * slashingRoundSizeInEpochs (${config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs}) must be divisible by 4`,
|
|
570
|
-
);
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
// Slashing offset validation: should be positive to allow proper slashing timing
|
|
574
|
-
if (config.slashingOffsetInRounds < 0) {
|
|
575
|
-
errors.push('slashingOffsetInRounds cannot be negative');
|
|
576
|
-
}
|
|
577
|
-
}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
3
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
3
4
|
import { EmpireBaseAbi } from '@aztec/l1-artifacts/EmpireBaseAbi';
|
|
4
5
|
|
|
5
6
|
import { type Hex, type TypedDataDefinition, encodeFunctionData } from 'viem';
|
|
6
7
|
|
|
7
|
-
import type { L1TxRequest } from '../l1_tx_utils.js';
|
|
8
|
+
import type { L1TxRequest } from '../l1_tx_utils/index.js';
|
|
8
9
|
|
|
9
10
|
export interface IEmpireBase {
|
|
10
11
|
get address(): EthAddress;
|
|
11
12
|
getRoundInfo(
|
|
12
13
|
rollupAddress: Hex,
|
|
13
14
|
round: bigint,
|
|
14
|
-
): Promise<{ lastSignalSlot:
|
|
15
|
-
computeRound(slot:
|
|
15
|
+
): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; quorumReached: boolean; executed: boolean }>;
|
|
16
|
+
computeRound(slot: SlotNumber): Promise<bigint>;
|
|
16
17
|
createSignalRequest(payload: Hex): L1TxRequest;
|
|
17
18
|
createSignalRequestWithSignature(
|
|
18
19
|
payload: Hex,
|
|
19
|
-
|
|
20
|
+
slot: SlotNumber,
|
|
20
21
|
chainId: number,
|
|
21
22
|
signerAddress: Hex,
|
|
22
23
|
signer: (msg: TypedDataDefinition) => Promise<Hex>,
|
|
@@ -51,7 +52,7 @@ export function encodeSignalWithSignature(payload: Hex, signature: Signature) {
|
|
|
51
52
|
export async function signSignalWithSig(
|
|
52
53
|
signer: (msg: TypedDataDefinition) => Promise<Hex>,
|
|
53
54
|
payload: Hex,
|
|
54
|
-
slot:
|
|
55
|
+
slot: SlotNumber,
|
|
55
56
|
instance: Hex,
|
|
56
57
|
verifyingContract: Hex,
|
|
57
58
|
chainId: number,
|
|
@@ -79,7 +80,7 @@ export async function signSignalWithSig(
|
|
|
79
80
|
|
|
80
81
|
const message = {
|
|
81
82
|
payload,
|
|
82
|
-
slot,
|
|
83
|
+
slot: BigInt(slot),
|
|
83
84
|
instance,
|
|
84
85
|
};
|
|
85
86
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
@@ -14,7 +15,7 @@ import {
|
|
|
14
15
|
getContract,
|
|
15
16
|
} from 'viem';
|
|
16
17
|
|
|
17
|
-
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils.js';
|
|
18
|
+
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
|
|
18
19
|
import type { ViemClient } from '../types.js';
|
|
19
20
|
import { FormattedViemError, tryExtractEvent } from '../utils.js';
|
|
20
21
|
import { type IEmpireBase, encodeSignal, encodeSignalWithSignature, signSignalWithSig } from './empire_base.js';
|
|
@@ -33,10 +34,14 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
|
|
|
33
34
|
|
|
34
35
|
constructor(
|
|
35
36
|
public readonly client: ViemClient,
|
|
36
|
-
address: Hex,
|
|
37
|
+
address: Hex | EthAddress,
|
|
37
38
|
) {
|
|
38
39
|
super();
|
|
39
|
-
this.proposer = getContract({
|
|
40
|
+
this.proposer = getContract({
|
|
41
|
+
address: typeof address === 'string' ? address : address.toString(),
|
|
42
|
+
abi: EmpireSlashingProposerAbi,
|
|
43
|
+
client,
|
|
44
|
+
});
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
public get address() {
|
|
@@ -63,8 +68,8 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
|
|
|
63
68
|
return this.proposer.read.getCurrentRound();
|
|
64
69
|
}
|
|
65
70
|
|
|
66
|
-
public computeRound(slot:
|
|
67
|
-
return this.proposer.read.computeRound([slot]);
|
|
71
|
+
public computeRound(slot: SlotNumber): Promise<bigint> {
|
|
72
|
+
return this.proposer.read.computeRound([BigInt(slot)]);
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
public getInstance() {
|
|
@@ -74,8 +79,18 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
|
|
|
74
79
|
public async getRoundInfo(
|
|
75
80
|
rollupAddress: Hex,
|
|
76
81
|
round: bigint,
|
|
77
|
-
): Promise<{ lastSignalSlot:
|
|
78
|
-
|
|
82
|
+
): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; quorumReached: boolean; executed: boolean }> {
|
|
83
|
+
const result = await this.proposer.read.getRoundData([rollupAddress, round]);
|
|
84
|
+
const [signalCount, quorum] = await Promise.all([
|
|
85
|
+
this.proposer.read.signalCount([rollupAddress, round, result.payloadWithMostSignals]),
|
|
86
|
+
this.getQuorumSize(),
|
|
87
|
+
]);
|
|
88
|
+
return {
|
|
89
|
+
lastSignalSlot: SlotNumber.fromBigInt(result.lastSignalSlot),
|
|
90
|
+
payloadWithMostSignals: result.payloadWithMostSignals,
|
|
91
|
+
quorumReached: signalCount >= quorum,
|
|
92
|
+
executed: result.executed,
|
|
93
|
+
};
|
|
79
94
|
}
|
|
80
95
|
|
|
81
96
|
public getPayloadSignals(rollupAddress: Hex, round: bigint, payload: Hex): Promise<bigint> {
|
|
@@ -91,7 +106,7 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
|
|
|
91
106
|
|
|
92
107
|
public async createSignalRequestWithSignature(
|
|
93
108
|
payload: Hex,
|
|
94
|
-
slot:
|
|
109
|
+
slot: SlotNumber,
|
|
95
110
|
chainId: number,
|
|
96
111
|
signerAddress: Hex,
|
|
97
112
|
signer: (msg: TypedDataDefinition) => Promise<Hex>,
|
|
@@ -3,7 +3,7 @@ import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts/FeeAssetHandlerAbi';
|
|
|
3
3
|
|
|
4
4
|
import { type Hex, encodeFunctionData, getContract } from 'viem';
|
|
5
5
|
|
|
6
|
-
import type { L1TxUtils } from '../l1_tx_utils.js';
|
|
6
|
+
import type { L1TxUtils } from '../l1_tx_utils/index.js';
|
|
7
7
|
|
|
8
8
|
export class FeeAssetHandlerContract {
|
|
9
9
|
public address: EthAddress;
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from 'viem';
|
|
15
15
|
|
|
16
16
|
import type { L1ContractAddresses } from '../l1_contract_addresses.js';
|
|
17
|
-
import { createL1TxUtilsFromViemWallet } from '../l1_tx_utils.js';
|
|
17
|
+
import { createL1TxUtilsFromViemWallet } from '../l1_tx_utils/index.js';
|
|
18
18
|
import { type ExtendedViemWalletClient, type ViemClient, isExtendedClient } from '../types.js';
|
|
19
19
|
|
|
20
20
|
export type L1GovernanceContractAddresses = Pick<
|
|
@@ -187,7 +187,7 @@ export class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
|
187
187
|
retries: number;
|
|
188
188
|
logger: Logger;
|
|
189
189
|
}) {
|
|
190
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, logger);
|
|
190
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, { logger });
|
|
191
191
|
const retryDelaySeconds = 12;
|
|
192
192
|
|
|
193
193
|
voteAmount = voteAmount ?? (await this.getPower());
|
|
@@ -244,7 +244,7 @@ export class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
|
244
244
|
retries: number;
|
|
245
245
|
logger: Logger;
|
|
246
246
|
}) {
|
|
247
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, logger);
|
|
247
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, { logger });
|
|
248
248
|
const retryDelaySeconds = 12;
|
|
249
249
|
let success = false;
|
|
250
250
|
for (let i = 0; i < retries; i++) {
|