@aztec/ethereum 0.0.1-commit.d3ec352c → 0.0.1-commit.fcb71a6
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.js +6 -2
- package/dest/config.d.ts +6 -42
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +9 -327
- package/dest/contracts/empire_base.d.ts +2 -1
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +2 -1
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +9 -0
- package/dest/contracts/governance_proposer.d.ts +2 -1
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +9 -0
- 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/rollup.d.ts +19 -3
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +14 -0
- package/dest/contracts/tally_slashing_proposer.d.ts +3 -2
- package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/tally_slashing_proposer.js +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/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 +136 -98
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_contract_addresses.d.ts +1 -1
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +3 -3
- package/dest/l1_reader.d.ts +3 -1
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +6 -0
- package/dest/l1_tx_utils/config.d.ts +3 -3
- package/dest/l1_tx_utils/config.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.js +17 -3
- package/dest/l1_tx_utils/constants.d.ts +7 -1
- package/dest/l1_tx_utils/constants.d.ts.map +1 -1
- package/dest/l1_tx_utils/constants.js +25 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts +9 -0
- package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/index.js +11 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +18 -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 +111 -0
- package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +32 -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 +173 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts +64 -0
- package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/fee-strategies/types.js +24 -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 +3 -1
- package/dest/l1_tx_utils/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/index.js +2 -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 +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +17 -4
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +4 -11
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +68 -138
- package/dest/queries.d.ts +1 -1
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +6 -1
- package/dest/test/chain_monitor.d.ts +2 -2
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/eth_cheat_codes.js +4 -2
- package/dest/test/rollup_cheat_codes.d.ts +2 -2
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +8 -3
- package/dest/test/start_anvil.d.ts +3 -1
- package/dest/test/start_anvil.d.ts.map +1 -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/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 +18 -0
- package/package.json +28 -10
- package/src/client.ts +2 -2
- package/src/config.ts +10 -406
- package/src/contracts/empire_base.ts +1 -1
- package/src/contracts/empire_slashing_proposer.ts +6 -1
- package/src/contracts/governance_proposer.ts +6 -1
- package/src/contracts/inbox.ts +7 -2
- package/src/contracts/rollup.ts +18 -2
- package/src/contracts/tally_slashing_proposer.ts +3 -1
- 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_contract_addresses.ts +22 -20
- package/src/l1_reader.ts +8 -0
- package/src/l1_tx_utils/config.ts +24 -6
- package/src/l1_tx_utils/constants.ts +11 -0
- package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +159 -0
- package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +241 -0
- package/src/l1_tx_utils/fee-strategies/types.ts +88 -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 +2 -0
- package/src/l1_tx_utils/interfaces.ts +1 -1
- package/src/l1_tx_utils/l1_fee_analyzer.ts +804 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +24 -4
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +76 -176
- package/src/queries.ts +6 -0
- package/src/test/chain_monitor.ts +2 -1
- package/src/test/eth_cheat_codes.ts +2 -2
- package/src/test/rollup_cheat_codes.ts +4 -3
- package/src/test/start_anvil.ts +2 -0
- package/src/test/tx_delayer.ts +5 -3
- package/src/types.ts +62 -0
- package/src/utils.ts +30 -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/src/deploy_l1_contracts.ts +0 -1869
- package/src/index.ts +0 -17
package/dest/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
|
-
import { type Abi, type ContractEventName, type DecodeEventLogReturnType, type Hex, type Log } from 'viem';
|
|
3
|
+
import { type Abi, type ContractEventName, type DecodeEventLogReturnType, type FormattedTransaction, type Hex, type Log } from 'viem';
|
|
4
4
|
export interface L2Claim {
|
|
5
5
|
claimSecret: Fr;
|
|
6
6
|
claimAmount: Fr;
|
|
@@ -22,4 +22,16 @@ export declare function prettyLogViemErrorMsg(err: any): any;
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function formatViemError(error: any, abi?: Abi): FormattedViemError;
|
|
24
24
|
export declare function tryGetCustomErrorName(err: any): string | undefined;
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Type guard to check if a transaction is a blob transaction (EIP-4844).
|
|
27
|
+
* Blob transactions have maxFeePerBlobGas and blobVersionedHashes fields.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isBlobTransaction(tx: FormattedTransaction): tx is FormattedTransaction & {
|
|
30
|
+
maxFeePerBlobGas: bigint;
|
|
31
|
+
blobVersionedHashes: readonly Hex[];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Calculates a percentile from an array of bigints
|
|
35
|
+
*/
|
|
36
|
+
export declare function calculatePercentile(values: bigint[], percentile: number): bigint;
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUdwRCxPQUFPLEVBQ0wsS0FBSyxHQUFHLEVBRVIsS0FBSyxpQkFBaUIsRUFFdEIsS0FBSyx3QkFBd0IsRUFDN0IsS0FBSyxvQkFBb0IsRUFDekIsS0FBSyxHQUFHLEVBQ1IsS0FBSyxHQUFHLEVBR1QsTUFBTSxNQUFNLENBQUM7QUFFZCxNQUFNLFdBQVcsT0FBTztJQUN0Qix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AE,EAAE,SAAS,EAAE,IAAI,CAAC,EAE/E,IAAI,EAAE,GAAG,EAAE,EACX,OAAO,EAAE,GAAG,EACZ,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,UAAU,EACrB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,OAAO,EACrC,MAAM,CAAC,EAAE,MAAM,GACd,UAAU,GAAG,SAAS,CAgBxB;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,OAW7C;AA0BD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,GAAE,GAAe,GAAG,kBAAkB,CAwEpF;AAyBD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,sBAa7C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,oBAAoB,GAAG,EAAE,IAAI,oBAAoB,GAAG;IACxF,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,SAAS,GAAG,EAAE,CAAC;CACrC,CAOA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAOhF"}
|
package/dest/utils.js
CHANGED
|
@@ -162,3 +162,21 @@ export function tryGetCustomErrorName(err) {
|
|
|
162
162
|
return undefined;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Type guard to check if a transaction is a blob transaction (EIP-4844).
|
|
167
|
+
* Blob transactions have maxFeePerBlobGas and blobVersionedHashes fields.
|
|
168
|
+
*/ export function isBlobTransaction(tx) {
|
|
169
|
+
return 'maxFeePerBlobGas' in tx && tx.maxFeePerBlobGas !== undefined && 'blobVersionedHashes' in tx && tx.blobVersionedHashes !== undefined;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Calculates a percentile from an array of bigints
|
|
173
|
+
*/ export function calculatePercentile(values, percentile) {
|
|
174
|
+
if (values.length === 0) {
|
|
175
|
+
return 0n;
|
|
176
|
+
}
|
|
177
|
+
const sorted = [
|
|
178
|
+
...values
|
|
179
|
+
].sort((a, b)=>a < b ? -1 : a > b ? 1 : 0);
|
|
180
|
+
const index = Math.ceil((sorted.length - 1) * (percentile / 100));
|
|
181
|
+
return sorted[index];
|
|
182
|
+
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/ethereum",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.fcb71a6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
|
-
"
|
|
7
|
-
"./
|
|
6
|
+
"./account": "./dest/account.js",
|
|
7
|
+
"./chain": "./dest/chain.js",
|
|
8
|
+
"./client": "./dest/client.js",
|
|
9
|
+
"./config": "./dest/config.js",
|
|
10
|
+
"./constants": "./dest/constants.js",
|
|
8
11
|
"./contracts": "./dest/contracts/index.js",
|
|
9
|
-
"./deploy-l1-contracts": "./dest/
|
|
12
|
+
"./deploy-aztec-l1-contracts": "./dest/deploy_aztec_l1_contracts.js",
|
|
13
|
+
"./deploy-l1-contract": "./dest/deploy_l1_contract.js",
|
|
14
|
+
"./contracts/registry": "./dest/contracts/registry.js",
|
|
15
|
+
"./contracts/rollup": "./dest/contracts/rollup.js",
|
|
16
|
+
"./eth-signer": "./dest/eth-signer/index.js",
|
|
17
|
+
"./forwarder-proxy": "./dest/forwarder_proxy.js",
|
|
18
|
+
"./l1-artifacts": "./dest/l1_artifacts.js",
|
|
10
19
|
"./l1-contract-addresses": "./dest/l1_contract_addresses.js",
|
|
11
|
-
"./l1-
|
|
20
|
+
"./l1-fee-analysis": "./dest/l1_tx_utils/l1_fee_analyzer.js",
|
|
21
|
+
"./l1-reader": "./dest/l1_reader.js",
|
|
22
|
+
"./l1-tx-utils": "./dest/l1_tx_utils/index.js",
|
|
23
|
+
"./l1-tx-utils-with-blobs": "./dest/l1_tx_utils/index-blobs.js",
|
|
24
|
+
"./l1-tx-utils/config": "./dest/l1_tx_utils/config.js",
|
|
25
|
+
"./l1-types": "./dest/l1_types.js",
|
|
26
|
+
"./publisher-manager": "./dest/publisher_manager.js",
|
|
27
|
+
"./queries": "./dest/queries.js",
|
|
28
|
+
"./test": "./dest/test/index.js",
|
|
29
|
+
"./types": "./dest/types.js",
|
|
12
30
|
"./utils": "./dest/utils.js"
|
|
13
31
|
},
|
|
14
32
|
"typedocOptions": {
|
|
@@ -31,10 +49,10 @@
|
|
|
31
49
|
"../package.common.json"
|
|
32
50
|
],
|
|
33
51
|
"dependencies": {
|
|
34
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
35
|
-
"@aztec/constants": "0.0.1-commit.
|
|
36
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
37
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
52
|
+
"@aztec/blob-lib": "0.0.1-commit.fcb71a6",
|
|
53
|
+
"@aztec/constants": "0.0.1-commit.fcb71a6",
|
|
54
|
+
"@aztec/foundation": "0.0.1-commit.fcb71a6",
|
|
55
|
+
"@aztec/l1-artifacts": "0.0.1-commit.fcb71a6",
|
|
38
56
|
"@viem/anvil": "^0.0.10",
|
|
39
57
|
"dotenv": "^16.0.3",
|
|
40
58
|
"lodash.chunk": "^4.2.0",
|
|
@@ -63,7 +81,7 @@
|
|
|
63
81
|
"src",
|
|
64
82
|
"!*.test.*"
|
|
65
83
|
],
|
|
66
|
-
"types": "./dest/
|
|
84
|
+
"types": "./dest/types.d.ts",
|
|
67
85
|
"jest": {
|
|
68
86
|
"moduleNameMapper": {
|
|
69
87
|
"^(\\.{1,2}/.*)\\.[cm]?js$": "$1"
|
package/src/client.ts
CHANGED
|
@@ -36,7 +36,7 @@ export function getPublicClient(config: Config): ViemPublicClient {
|
|
|
36
36
|
const chain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
37
37
|
return createPublicClient({
|
|
38
38
|
chain: chain.chainInfo,
|
|
39
|
-
transport: fallback(config.l1RpcUrls.map(url => http(url))),
|
|
39
|
+
transport: fallback(config.l1RpcUrls.map(url => http(url, { batch: false }))),
|
|
40
40
|
pollingInterval: config.viemPollingIntervalMS,
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -88,7 +88,7 @@ export function createExtendedL1Client(
|
|
|
88
88
|
const extendedClient = createWalletClient({
|
|
89
89
|
account: hdAccount,
|
|
90
90
|
chain,
|
|
91
|
-
transport: fallback(rpcUrls.map(url => http(url))),
|
|
91
|
+
transport: fallback(rpcUrls.map(url => http(url, { batch: false }))),
|
|
92
92
|
pollingInterval: pollingIntervalMS,
|
|
93
93
|
}).extend(publicActions);
|
|
94
94
|
|
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/
|
|
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 */
|
|
@@ -32,6 +32,8 @@ export type L1ContractsConfig = {
|
|
|
32
32
|
lagInEpochsForValidatorSet: number;
|
|
33
33
|
/** The number of epochs to lag behind the current epoch for randao selection. */
|
|
34
34
|
lagInEpochsForRandao: number;
|
|
35
|
+
/** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
|
|
36
|
+
inboxLag: number;
|
|
35
37
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
36
38
|
aztecProofSubmissionEpochs: number;
|
|
37
39
|
/** The deposit amount for a validator */
|
|
@@ -81,6 +83,7 @@ export const DefaultL1ContractsConfig = {
|
|
|
81
83
|
aztecTargetCommitteeSize: 48,
|
|
82
84
|
lagInEpochsForValidatorSet: 2,
|
|
83
85
|
lagInEpochsForRandao: 2, // For PROD, this value should be > lagInEpochsForValidatorSet
|
|
86
|
+
inboxLag: 1, // Default inbox lag to prevent sequencer DOS attacks
|
|
84
87
|
aztecProofSubmissionEpochs: 1, // you have a full epoch to submit a proof after the epoch to prove ends
|
|
85
88
|
activationThreshold: 100n * 10n ** 18n,
|
|
86
89
|
ejectionThreshold: 50n * 10n ** 18n,
|
|
@@ -101,208 +104,6 @@ export const DefaultL1ContractsConfig = {
|
|
|
101
104
|
slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
|
|
102
105
|
} satisfies L1ContractsConfig;
|
|
103
106
|
|
|
104
|
-
const LocalGovernanceConfiguration = {
|
|
105
|
-
proposeConfig: {
|
|
106
|
-
lockDelay: 60n * 60n * 24n * 30n,
|
|
107
|
-
lockAmount: 1n * 10n ** 24n,
|
|
108
|
-
},
|
|
109
|
-
votingDelay: 60n,
|
|
110
|
-
votingDuration: 60n * 60n,
|
|
111
|
-
executionDelay: 60n,
|
|
112
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
113
|
-
quorum: 1n * 10n ** 17n, // 10%
|
|
114
|
-
requiredYeaMargin: 4n * 10n ** 16n, // 4%
|
|
115
|
-
minimumVotes: 400n * 10n ** 18n,
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const StagingPublicGovernanceConfiguration = {
|
|
119
|
-
proposeConfig: {
|
|
120
|
-
lockDelay: 60n * 60n * 24n * 30n,
|
|
121
|
-
lockAmount: DefaultL1ContractsConfig.activationThreshold * 100n,
|
|
122
|
-
},
|
|
123
|
-
votingDelay: 60n,
|
|
124
|
-
votingDuration: 60n * 60n,
|
|
125
|
-
executionDelay: 60n,
|
|
126
|
-
gracePeriod: 60n * 60n * 24n * 7n,
|
|
127
|
-
quorum: 3n * 10n ** 17n, // 30%
|
|
128
|
-
requiredYeaMargin: 4n * 10n ** 16n, // 4%
|
|
129
|
-
minimumVotes: DefaultL1ContractsConfig.ejectionThreshold * 200n, // >= 200 validators must vote
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const TestnetGovernanceConfiguration = {
|
|
133
|
-
proposeConfig: {
|
|
134
|
-
lockDelay: 10n * 365n * 24n * 60n * 60n,
|
|
135
|
-
lockAmount: 1250n * 200_000n * 10n ** 18n,
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
votingDelay: 12n * 60n * 60n, // 12 hours
|
|
139
|
-
votingDuration: 1n * 24n * 60n * 60n, // 1 day
|
|
140
|
-
executionDelay: 12n * 60n * 60n, // 12 hours
|
|
141
|
-
gracePeriod: 1n * 24n * 60n * 60n, // 1 day
|
|
142
|
-
quorum: 2n * 10n ** 17n, // 20%
|
|
143
|
-
requiredYeaMargin: 1n * 10n ** 17n, // 10%
|
|
144
|
-
minimumVotes: 100n * 200_000n * 10n ** 18n,
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const StagingIgnitionGovernanceConfiguration = {
|
|
148
|
-
proposeConfig: {
|
|
149
|
-
lockDelay: 10n * 365n * 24n * 60n * 60n,
|
|
150
|
-
lockAmount: 1250n * 200_000n * 10n ** 18n,
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
votingDelay: 7n * 24n * 60n * 60n,
|
|
154
|
-
votingDuration: 7n * 24n * 60n * 60n,
|
|
155
|
-
executionDelay: 30n * 24n * 60n * 60n,
|
|
156
|
-
gracePeriod: 7n * 24n * 60n * 60n,
|
|
157
|
-
quorum: 2n * 10n ** 17n, // 20%
|
|
158
|
-
requiredYeaMargin: 1n * 10n ** 17n, // 10%
|
|
159
|
-
minimumVotes: 1250n * 200_000n * 10n ** 18n,
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const MainnetGovernanceConfiguration = {
|
|
163
|
-
proposeConfig: {
|
|
164
|
-
lockDelay: 90n * 24n * 60n * 60n,
|
|
165
|
-
lockAmount: 258_750_000n * 10n ** 18n,
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
votingDelay: 3n * 24n * 60n * 60n,
|
|
169
|
-
votingDuration: 7n * 24n * 60n * 60n,
|
|
170
|
-
executionDelay: 7n * 24n * 60n * 60n,
|
|
171
|
-
gracePeriod: 7n * 24n * 60n * 60n,
|
|
172
|
-
quorum: 2n * 10n ** 17n, // 20%
|
|
173
|
-
requiredYeaMargin: 33n * 10n ** 16n, // 33%
|
|
174
|
-
minimumVotes: 1000n * 200_000n * 10n ** 18n,
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export const getGovernanceConfiguration = (networkName: NetworkNames) => {
|
|
178
|
-
switch (networkName) {
|
|
179
|
-
case 'local':
|
|
180
|
-
return LocalGovernanceConfiguration;
|
|
181
|
-
case 'next-net':
|
|
182
|
-
return LocalGovernanceConfiguration;
|
|
183
|
-
case 'devnet':
|
|
184
|
-
return LocalGovernanceConfiguration;
|
|
185
|
-
case 'staging-public':
|
|
186
|
-
return StagingPublicGovernanceConfiguration;
|
|
187
|
-
case 'testnet':
|
|
188
|
-
return TestnetGovernanceConfiguration;
|
|
189
|
-
case 'staging-ignition':
|
|
190
|
-
return StagingIgnitionGovernanceConfiguration;
|
|
191
|
-
case 'mainnet':
|
|
192
|
-
return MainnetGovernanceConfiguration;
|
|
193
|
-
default:
|
|
194
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
// Making a default config here as we are only using it thought the deployment
|
|
199
|
-
// and do not expect to be using different setups, so having environment variables
|
|
200
|
-
// for it seems overkill
|
|
201
|
-
|
|
202
|
-
const DefaultRewardConfig = {
|
|
203
|
-
sequencerBps: 8000,
|
|
204
|
-
rewardDistributor: EthAddress.ZERO.toString(),
|
|
205
|
-
booster: EthAddress.ZERO.toString(),
|
|
206
|
-
checkpointReward: 500n * 10n ** 18n,
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const MainnetRewardConfig = {
|
|
210
|
-
sequencerBps: 7_000,
|
|
211
|
-
rewardDistributor: EthAddress.ZERO.toString(),
|
|
212
|
-
booster: EthAddress.ZERO.toString(),
|
|
213
|
-
checkpointReward: 400n * 10n ** 18n,
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export const getRewardConfig = (networkName: NetworkNames) => {
|
|
217
|
-
switch (networkName) {
|
|
218
|
-
case 'local':
|
|
219
|
-
case 'devnet':
|
|
220
|
-
case 'next-net':
|
|
221
|
-
case 'staging-public':
|
|
222
|
-
case 'testnet':
|
|
223
|
-
case 'staging-ignition':
|
|
224
|
-
return DefaultRewardConfig;
|
|
225
|
-
case 'mainnet':
|
|
226
|
-
return MainnetRewardConfig;
|
|
227
|
-
default:
|
|
228
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
export const getRewardBoostConfig = () => {
|
|
233
|
-
// The reward configuration is specified with a precision of 1e5, and we use the same across
|
|
234
|
-
// all networks.
|
|
235
|
-
return {
|
|
236
|
-
increment: 125_000, // 1.25
|
|
237
|
-
maxScore: 15_000_000, // 150
|
|
238
|
-
a: 1_000, // 0.01
|
|
239
|
-
k: 1_000_000, // 10
|
|
240
|
-
minimum: 100_000, // 1
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
// Similar to the above, no need for environment variables for this.
|
|
245
|
-
const LocalEntryQueueConfig = {
|
|
246
|
-
bootstrapValidatorSetSize: 0n,
|
|
247
|
-
bootstrapFlushSize: 0n,
|
|
248
|
-
normalFlushSizeMin: 48n,
|
|
249
|
-
normalFlushSizeQuotient: 2n,
|
|
250
|
-
maxQueueFlushSize: 48n,
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
const StagingPublicEntryQueueConfig = {
|
|
254
|
-
bootstrapValidatorSetSize: 48n,
|
|
255
|
-
bootstrapFlushSize: 48n,
|
|
256
|
-
normalFlushSizeMin: 1n,
|
|
257
|
-
normalFlushSizeQuotient: 2475n,
|
|
258
|
-
maxQueueFlushSize: 32n, // Limited to 32 so flush cost are kept below 15M gas.
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
const TestnetEntryQueueConfig = {
|
|
262
|
-
bootstrapValidatorSetSize: 256n,
|
|
263
|
-
bootstrapFlushSize: 256n,
|
|
264
|
-
normalFlushSizeMin: 4n,
|
|
265
|
-
normalFlushSizeQuotient: 2048n,
|
|
266
|
-
maxQueueFlushSize: 8n,
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
const StagingIgnitionEntryQueueConfig = {
|
|
270
|
-
bootstrapValidatorSetSize: 48n,
|
|
271
|
-
bootstrapFlushSize: 48n,
|
|
272
|
-
normalFlushSizeMin: 1n,
|
|
273
|
-
normalFlushSizeQuotient: 2048n,
|
|
274
|
-
maxQueueFlushSize: 24n,
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const MainnetEntryQueueConfig = {
|
|
278
|
-
bootstrapValidatorSetSize: 1_000n,
|
|
279
|
-
bootstrapFlushSize: 1_000n,
|
|
280
|
-
normalFlushSizeMin: 1n,
|
|
281
|
-
normalFlushSizeQuotient: 2_048n,
|
|
282
|
-
maxQueueFlushSize: 8n,
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
export const getEntryQueueConfig = (networkName: NetworkNames) => {
|
|
286
|
-
switch (networkName) {
|
|
287
|
-
case 'local':
|
|
288
|
-
return LocalEntryQueueConfig;
|
|
289
|
-
case 'next-net':
|
|
290
|
-
return LocalEntryQueueConfig;
|
|
291
|
-
case 'devnet':
|
|
292
|
-
return LocalEntryQueueConfig;
|
|
293
|
-
case 'staging-public':
|
|
294
|
-
return StagingPublicEntryQueueConfig;
|
|
295
|
-
case 'testnet':
|
|
296
|
-
return TestnetEntryQueueConfig;
|
|
297
|
-
case 'staging-ignition':
|
|
298
|
-
return StagingIgnitionEntryQueueConfig;
|
|
299
|
-
case 'mainnet':
|
|
300
|
-
return MainnetEntryQueueConfig;
|
|
301
|
-
default:
|
|
302
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
|
|
306
107
|
export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> = {
|
|
307
108
|
ethereumSlotDuration: {
|
|
308
109
|
env: 'ETHEREUM_SLOT_DURATION',
|
|
@@ -334,6 +135,11 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
|
|
|
334
135
|
description: 'The number of epochs to lag behind the current epoch for randao selection.',
|
|
335
136
|
...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForRandao),
|
|
336
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
|
+
},
|
|
337
143
|
aztecProofSubmissionEpochs: {
|
|
338
144
|
env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
|
|
339
145
|
description: 'The number of epochs after an epoch ends that proofs are still accepted.',
|
|
@@ -460,205 +266,3 @@ export function getL1ContractsConfigEnvVars(): L1ContractsConfig {
|
|
|
460
266
|
export function getGenesisStateConfigEnvVars(): GenesisStateConfig {
|
|
461
267
|
return getConfigFromMappings(genesisStateConfigMappings);
|
|
462
268
|
}
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* Validates the L1 contracts configuration to ensure all requirements enforced by L1 contracts
|
|
466
|
-
* during construction are satisfied before deployment.
|
|
467
|
-
* Accumulates all validation errors and throws an exception listing them all if any are found.
|
|
468
|
-
*/
|
|
469
|
-
export function validateConfig(config: Omit<L1ContractsConfig, keyof L1TxUtilsConfig>): void {
|
|
470
|
-
const errors: string[] = [];
|
|
471
|
-
|
|
472
|
-
// RollupCore constructor validation: normalFlushSizeMin > 0
|
|
473
|
-
// From: require(_config.stakingQueueConfig.normalFlushSizeMin > 0, Errors.Staking__InvalidStakingQueueConfig());
|
|
474
|
-
const entryQueueConfig = getEntryQueueConfig('testnet'); // Get config to check normalFlushSizeMin
|
|
475
|
-
if (entryQueueConfig.normalFlushSizeMin <= 0n) {
|
|
476
|
-
errors.push('normalFlushSizeMin must be greater than 0');
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
// TimeLib initialization validation: aztecSlotDuration should be a multiple of ethereumSlotDuration
|
|
480
|
-
// While not explicitly required in constructor, this is a common validation for time-based systems
|
|
481
|
-
if (config.aztecSlotDuration % config.ethereumSlotDuration !== 0) {
|
|
482
|
-
errors.push(
|
|
483
|
-
`aztecSlotDuration (${config.aztecSlotDuration}) must be a multiple of ethereumSlotDuration (${config.ethereumSlotDuration})`,
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
// EmpireBase constructor validations for governance/slashing proposers
|
|
488
|
-
// From: require(QUORUM_SIZE > ROUND_SIZE / 2, Errors.EmpireBase__InvalidQuorumAndRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
489
|
-
const { governanceProposerQuorum, governanceProposerRoundSize } = config;
|
|
490
|
-
if (
|
|
491
|
-
governanceProposerQuorum !== undefined &&
|
|
492
|
-
governanceProposerQuorum <= Math.floor(governanceProposerRoundSize / 2)
|
|
493
|
-
) {
|
|
494
|
-
errors.push(
|
|
495
|
-
`governanceProposerQuorum (${governanceProposerQuorum}) must be greater than half of governanceProposerRoundSize (${Math.floor(governanceProposerRoundSize / 2)})`,
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
// From: require(QUORUM_SIZE <= ROUND_SIZE, Errors.EmpireBase__QuorumCannotBeLargerThanRoundSize(QUORUM_SIZE, ROUND_SIZE));
|
|
500
|
-
if (governanceProposerQuorum !== undefined && governanceProposerQuorum > governanceProposerRoundSize) {
|
|
501
|
-
errors.push(
|
|
502
|
-
`governanceProposerQuorum (${governanceProposerQuorum}) cannot be larger than governanceProposerRoundSize (${governanceProposerRoundSize})`,
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
// Slashing quorum validations (similar to governance quorum)
|
|
507
|
-
const slashingRoundSize = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
508
|
-
const { slashingQuorum } = config;
|
|
509
|
-
if (slashingQuorum !== undefined && slashingQuorum <= Math.floor(slashingRoundSize / 2)) {
|
|
510
|
-
errors.push(
|
|
511
|
-
`slashingQuorum (${slashingQuorum}) must be greater than half of slashingRoundSizeInEpochs (${Math.floor(slashingRoundSize / 2)})`,
|
|
512
|
-
);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
if (slashingQuorum !== undefined && slashingQuorum > slashingRoundSize) {
|
|
516
|
-
errors.push(
|
|
517
|
-
`slashingQuorum (${slashingQuorum}) cannot be larger than slashingRoundSizeInEpochs (${slashingRoundSize})`,
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
// EmpireBase and TallySlashingProposer lifetime and execution delay validation
|
|
522
|
-
// From: require(LIFETIME_IN_ROUNDS > EXECUTION_DELAY_IN_ROUNDS);
|
|
523
|
-
if (config.slashingLifetimeInRounds <= config.slashingExecutionDelayInRounds) {
|
|
524
|
-
errors.push(
|
|
525
|
-
`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be greater than slashingExecutionDelayInRounds (${config.slashingExecutionDelayInRounds})`,
|
|
526
|
-
);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
// Staking asset validation: activationThreshold > ejectionThreshold
|
|
530
|
-
if (config.activationThreshold < config.ejectionThreshold) {
|
|
531
|
-
errors.push(
|
|
532
|
-
`activationThreshold (${config.activationThreshold}) must be greater than ejectionThreshold (${config.ejectionThreshold})`,
|
|
533
|
-
);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
// TallySlashingProposer constructor validations
|
|
537
|
-
if (config.slasherFlavor === 'tally') {
|
|
538
|
-
validateTallySlasherConfig(config, errors);
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
// Epoch and slot duration validations
|
|
542
|
-
if (config.aztecSlotDuration <= 0) {
|
|
543
|
-
errors.push('aztecSlotDuration must be greater than 0');
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
if (config.ethereumSlotDuration <= 0) {
|
|
547
|
-
errors.push('ethereumSlotDuration must be greater than 0');
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
if (config.aztecEpochDuration <= 0) {
|
|
551
|
-
errors.push('aztecEpochDuration must be greater than 0');
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
// Committee size validation
|
|
555
|
-
if (config.aztecTargetCommitteeSize < 0) {
|
|
556
|
-
errors.push('aztecTargetCommitteeSize cannot be negative');
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
// Proof submission epochs validation
|
|
560
|
-
if (config.aztecProofSubmissionEpochs < 0) {
|
|
561
|
-
errors.push('aztecProofSubmissionEpochs cannot be negative');
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
// Exit delay validation
|
|
565
|
-
if (config.exitDelaySeconds < 0) {
|
|
566
|
-
errors.push('exitDelaySeconds cannot be negative');
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
// Mana validation
|
|
570
|
-
if (config.manaTarget < 0n) {
|
|
571
|
-
errors.push('manaTarget cannot be negative');
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
if (config.provingCostPerMana < 0n) {
|
|
575
|
-
errors.push('provingCostPerMana cannot be negative');
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
// If any errors were found, throw an exception with all of them
|
|
579
|
-
if (errors.length > 0) {
|
|
580
|
-
throw new Error(
|
|
581
|
-
`L1 contracts configuration validation failed with ${errors.length} error(s):\n${errors.map((error, index) => `${index + 1}. ${error}`).join('\n')}`,
|
|
582
|
-
);
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
function validateTallySlasherConfig(config: L1ContractsConfig, errors: string[]) {
|
|
587
|
-
if (config.slasherFlavor !== 'tally') {
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
// From: require(SLASH_OFFSET_IN_ROUNDS > 0, Errors.TallySlashingProposer__SlashOffsetMustBeGreaterThanZero(...));
|
|
592
|
-
if (config.slashingOffsetInRounds <= 0) {
|
|
593
|
-
errors.push(`slashingOffsetInRounds (${config.slashingOffsetInRounds}) must be greater than 0`);
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
// From: require(ROUND_SIZE_IN_EPOCHS * _epochDuration == ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeMustBeMultipleOfEpochDuration(...));
|
|
597
|
-
const roundSizeInSlots = config.slashingRoundSizeInEpochs * config.aztecEpochDuration;
|
|
598
|
-
|
|
599
|
-
// From: require(QUORUM > 0, Errors.TallySlashingProposer__QuorumMustBeGreaterThanZero());
|
|
600
|
-
const { slashingQuorum } = config;
|
|
601
|
-
if (slashingQuorum !== undefined && slashingQuorum <= 0) {
|
|
602
|
-
errors.push(`slashingQuorum (${slashingQuorum}) must be greater than 0`);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
// From: require(ROUND_SIZE > 1, Errors.TallySlashingProposer__InvalidQuorumAndRoundSize(QUORUM, ROUND_SIZE));
|
|
606
|
-
if (roundSizeInSlots <= 1) {
|
|
607
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be greater than 1`);
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
// From: require(_slashAmounts[0] <= _slashAmounts[1], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
611
|
-
if (config.slashAmountSmall > config.slashAmountMedium) {
|
|
612
|
-
errors.push(
|
|
613
|
-
`slashAmountSmall (${config.slashAmountSmall}) must be less than or equal to slashAmountMedium (${config.slashAmountMedium})`,
|
|
614
|
-
);
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
// From: require(_slashAmounts[1] <= _slashAmounts[2], Errors.TallySlashingProposer__InvalidSlashAmounts(_slashAmounts));
|
|
618
|
-
if (config.slashAmountMedium > config.slashAmountLarge) {
|
|
619
|
-
errors.push(
|
|
620
|
-
`slashAmountMedium (${config.slashAmountMedium}) must be less than or equal to slashAmountLarge (${config.slashAmountLarge})`,
|
|
621
|
-
);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
// From: require(LIFETIME_IN_ROUNDS < ROUNDABOUT_SIZE, Errors.TallySlashingProposer__LifetimeMustBeLessThanRoundabout(...));
|
|
625
|
-
const ROUNDABOUT_SIZE = 128; // Constant from TallySlashingProposer
|
|
626
|
-
if (config.slashingLifetimeInRounds >= ROUNDABOUT_SIZE) {
|
|
627
|
-
errors.push(`slashingLifetimeInRounds (${config.slashingLifetimeInRounds}) must be less than ${ROUNDABOUT_SIZE}`);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
// From: require(ROUND_SIZE_IN_EPOCHS > 0, Errors.TallySlashingProposer__RoundSizeInEpochsMustBeGreaterThanZero(...));
|
|
631
|
-
if (config.slashingRoundSizeInEpochs <= 0) {
|
|
632
|
-
errors.push(`slashingRoundSizeInEpochs (${config.slashingRoundSizeInEpochs}) must be greater than 0`);
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
// From: require(ROUND_SIZE < MAX_ROUND_SIZE, Errors.TallySlashingProposer__RoundSizeTooLarge(ROUND_SIZE, MAX_ROUND_SIZE));
|
|
636
|
-
const MAX_ROUND_SIZE = 1024; // Constant from TallySlashingProposer
|
|
637
|
-
if (roundSizeInSlots >= MAX_ROUND_SIZE) {
|
|
638
|
-
errors.push(`slashing round size in slots (${roundSizeInSlots}) must be less than ${MAX_ROUND_SIZE}`);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
// From: require(COMMITTEE_SIZE > 0, Errors.TallySlashingProposer__CommitteeSizeMustBeGreaterThanZero(COMMITTEE_SIZE));
|
|
642
|
-
if (config.aztecTargetCommitteeSize <= 0) {
|
|
643
|
-
errors.push(`aztecTargetCommitteeSize (${config.aztecTargetCommitteeSize}) must be greater than 0`);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
// From: require(voteSize <= 128, Errors.TallySlashingProposer__VoteSizeTooBig(voteSize, 128));
|
|
647
|
-
// voteSize = COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS / 4
|
|
648
|
-
const voteSize = (config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs) / 4;
|
|
649
|
-
if (voteSize > 128) {
|
|
650
|
-
errors.push(`vote size (${voteSize}) must be <= 128 (committee size * round size in epochs / 4)`);
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// From: require(COMMITTEE_SIZE * ROUND_SIZE_IN_EPOCHS % 4 == 0, Errors.TallySlashingProposer__InvalidCommitteeAndRoundSize(...));
|
|
654
|
-
if ((config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs) % 4 !== 0) {
|
|
655
|
-
errors.push(
|
|
656
|
-
`aztecTargetCommitteeSize * slashingRoundSizeInEpochs (${config.aztecTargetCommitteeSize * config.slashingRoundSizeInEpochs}) must be divisible by 4`,
|
|
657
|
-
);
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
// Slashing offset validation: should be positive to allow proper slashing timing
|
|
661
|
-
if (config.slashingOffsetInRounds < 0) {
|
|
662
|
-
errors.push('slashingOffsetInRounds cannot be negative');
|
|
663
|
-
}
|
|
664
|
-
}
|
|
@@ -12,7 +12,7 @@ export interface IEmpireBase {
|
|
|
12
12
|
getRoundInfo(
|
|
13
13
|
rollupAddress: Hex,
|
|
14
14
|
round: bigint,
|
|
15
|
-
): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; executed: boolean }>;
|
|
15
|
+
): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; quorumReached: boolean; executed: boolean }>;
|
|
16
16
|
computeRound(slot: SlotNumber): Promise<bigint>;
|
|
17
17
|
createSignalRequest(payload: Hex): L1TxRequest;
|
|
18
18
|
createSignalRequestWithSignature(
|
|
@@ -79,11 +79,16 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
|
|
|
79
79
|
public async getRoundInfo(
|
|
80
80
|
rollupAddress: Hex,
|
|
81
81
|
round: bigint,
|
|
82
|
-
): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; executed: boolean }> {
|
|
82
|
+
): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; quorumReached: boolean; executed: boolean }> {
|
|
83
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
|
+
]);
|
|
84
88
|
return {
|
|
85
89
|
lastSignalSlot: SlotNumber.fromBigInt(result.lastSignalSlot),
|
|
86
90
|
payloadWithMostSignals: result.payloadWithMostSignals,
|
|
91
|
+
quorumReached: signalCount >= quorum,
|
|
87
92
|
executed: result.executed,
|
|
88
93
|
};
|
|
89
94
|
}
|
|
@@ -62,11 +62,16 @@ export class GovernanceProposerContract implements IEmpireBase {
|
|
|
62
62
|
public async getRoundInfo(
|
|
63
63
|
rollupAddress: Hex,
|
|
64
64
|
round: bigint,
|
|
65
|
-
): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; executed: boolean }> {
|
|
65
|
+
): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; quorumReached: boolean; executed: boolean }> {
|
|
66
66
|
const result = await this.proposer.read.getRoundData([rollupAddress, round]);
|
|
67
|
+
const [signalCount, quorum] = await Promise.all([
|
|
68
|
+
this.proposer.read.signalCount([rollupAddress, round, result.payloadWithMostSignals]),
|
|
69
|
+
this.getQuorumSize(),
|
|
70
|
+
]);
|
|
67
71
|
return {
|
|
68
72
|
lastSignalSlot: SlotNumber.fromBigInt(result.lastSignalSlot),
|
|
69
73
|
payloadWithMostSignals: result.payloadWithMostSignals,
|
|
74
|
+
quorumReached: signalCount >= quorum,
|
|
70
75
|
executed: result.executed,
|
|
71
76
|
};
|
|
72
77
|
}
|