@aztec/ethereum 3.0.0-nightly.20250910 → 3.0.0-nightly.20250912
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/config.d.ts +6 -4
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +12 -30
- package/dest/contracts/empire_slashing_proposer.d.ts +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.js +1 -1
- package/dest/contracts/rollup.d.ts +13 -6
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +49 -23
- package/dest/deploy_l1_contracts.d.ts +4 -4
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +51 -25
- package/dest/l1_artifacts.d.ts +689 -62
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_tx_utils.d.ts +4 -2
- package/dest/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils.js +21 -13
- package/dest/l1_tx_utils_with_blobs.d.ts +2 -1
- package/dest/l1_tx_utils_with_blobs.d.ts.map +1 -1
- package/dest/l1_tx_utils_with_blobs.js +7 -5
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +8 -11
- package/dest/test/chain_monitor.d.ts +4 -0
- package/dest/test/chain_monitor.d.ts.map +1 -1
- package/dest/test/chain_monitor.js +57 -11
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +10 -161
- package/package.json +5 -5
- package/src/config.ts +17 -35
- package/src/contracts/empire_slashing_proposer.ts +6 -2
- package/src/contracts/rollup.ts +58 -22
- package/src/deploy_l1_contracts.ts +65 -22
- package/src/l1_tx_utils.ts +28 -9
- package/src/l1_tx_utils_with_blobs.ts +8 -2
- package/src/queries.ts +9 -7
- package/src/test/chain_monitor.ts +64 -8
- package/src/utils.ts +13 -185
package/dest/config.d.ts
CHANGED
|
@@ -16,12 +16,16 @@ export type L1ContractsConfig = {
|
|
|
16
16
|
aztecEpochDuration: number;
|
|
17
17
|
/** The target validator committee size. */
|
|
18
18
|
aztecTargetCommitteeSize: number;
|
|
19
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
20
|
+
lagInEpochs: number;
|
|
19
21
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
20
22
|
aztecProofSubmissionEpochs: number;
|
|
21
23
|
/** The deposit amount for a validator */
|
|
22
24
|
activationThreshold: bigint;
|
|
23
25
|
/** The minimum stake for a validator. */
|
|
24
26
|
ejectionThreshold: bigint;
|
|
27
|
+
/** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
|
|
28
|
+
localEjectionThreshold: bigint;
|
|
25
29
|
/** 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) */
|
|
26
30
|
slashingQuorum?: number;
|
|
27
31
|
/** The slashing round size, i.e. how many epochs are in a slashing round */
|
|
@@ -58,9 +62,11 @@ export declare const DefaultL1ContractsConfig: {
|
|
|
58
62
|
aztecSlotDuration: number;
|
|
59
63
|
aztecEpochDuration: number;
|
|
60
64
|
aztecTargetCommitteeSize: number;
|
|
65
|
+
lagInEpochs: number;
|
|
61
66
|
aztecProofSubmissionEpochs: number;
|
|
62
67
|
activationThreshold: bigint;
|
|
63
68
|
ejectionThreshold: bigint;
|
|
69
|
+
localEjectionThreshold: bigint;
|
|
64
70
|
slashAmountSmall: bigint;
|
|
65
71
|
slashAmountMedium: bigint;
|
|
66
72
|
slashAmountLarge: bigint;
|
|
@@ -88,10 +94,6 @@ export declare const getGovernanceConfiguration: (networkName: NetworkNames) =>
|
|
|
88
94
|
requiredYeaMargin: bigint;
|
|
89
95
|
minimumVotes: bigint;
|
|
90
96
|
};
|
|
91
|
-
export declare const getGSEConfiguration: (networkName: NetworkNames) => {
|
|
92
|
-
activationThreshold: bigint;
|
|
93
|
-
ejectionThreshold: bigint;
|
|
94
|
-
};
|
|
95
97
|
export declare const getRewardConfig: (networkName: NetworkNames) => {
|
|
96
98
|
sequencerBps: number;
|
|
97
99
|
rewardDistributor: `0x${string}`;
|
package/dest/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAOlB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,KAAK,eAAe,EAA2B,MAAM,kBAAkB,CAAC;AAEjF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,yFAAyF;IACzF,YAAY,EAAE,OAAO,CAAC;IACtB,yFAAyF;IACzF,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,yCAAyC;IACzC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uFAAuF;IACvF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wCAAwC;IACxC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,wBAAwB,EAAE,MAAM,CAAC;IACjC,+EAA+E;IAC/E,0BAA0B,EAAE,MAAM,CAAC;IACnC,yCAAyC;IACzC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yCAAyC;IACzC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wKAAwK;IACxK,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,yBAAyB,EAAE,MAAM,CAAC;IAClC,gGAAgG;IAChG,wBAAwB,EAAE,MAAM,CAAC;IACjC,yGAAyG;IACzG,8BAA8B,EAAE,MAAM,CAAC;IACvC,yEAAyE;IACzE,cAAc,EAAE,UAAU,CAAC;IAC3B,4IAA4I;IAC5I,sBAAsB,EAAE,MAAM,CAAC;IAC/B,+BAA+B;IAC/B,aAAa,EAAE,QAAQ,GAAG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C,iBAAiB,CA6H3E,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,kBAAkB,CAAC,kBAAkB,CAW7E,CAAC;AAEF,wBAAgB,2BAA2B,IAAI,iBAAiB,CAE/D;AAED,wBAAgB,4BAA4B,IAAI,kBAAkB,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,eAAe,CAAC,GAAG,IAAI,CAmH3F"}
|
package/dest/config.js
CHANGED
|
@@ -6,9 +6,11 @@ export const DefaultL1ContractsConfig = {
|
|
|
6
6
|
aztecSlotDuration: 36,
|
|
7
7
|
aztecEpochDuration: 32,
|
|
8
8
|
aztecTargetCommitteeSize: 48,
|
|
9
|
+
lagInEpochs: 2,
|
|
9
10
|
aztecProofSubmissionEpochs: 1,
|
|
10
11
|
activationThreshold: BigInt(100e18),
|
|
11
12
|
ejectionThreshold: BigInt(50e18),
|
|
13
|
+
localEjectionThreshold: BigInt(98e18),
|
|
12
14
|
slashAmountSmall: BigInt(10e18),
|
|
13
15
|
slashAmountMedium: BigInt(20e18),
|
|
14
16
|
slashAmountLarge: BigInt(50e18),
|
|
@@ -89,36 +91,6 @@ export const getGovernanceConfiguration = (networkName)=>{
|
|
|
89
91
|
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
90
92
|
}
|
|
91
93
|
};
|
|
92
|
-
const LocalGSEConfiguration = {
|
|
93
|
-
activationThreshold: BigInt(100e18),
|
|
94
|
-
ejectionThreshold: BigInt(50e18)
|
|
95
|
-
};
|
|
96
|
-
const StagingPublicGSEConfiguration = {
|
|
97
|
-
activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
98
|
-
ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold
|
|
99
|
-
};
|
|
100
|
-
const TestnetGSEConfiguration = {
|
|
101
|
-
activationThreshold: BigInt(100e18),
|
|
102
|
-
ejectionThreshold: BigInt(50e18)
|
|
103
|
-
};
|
|
104
|
-
const StagingIgnitionGSEConfiguration = {
|
|
105
|
-
activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
106
|
-
ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold
|
|
107
|
-
};
|
|
108
|
-
export const getGSEConfiguration = (networkName)=>{
|
|
109
|
-
switch(networkName){
|
|
110
|
-
case 'local':
|
|
111
|
-
return LocalGSEConfiguration;
|
|
112
|
-
case 'staging-public':
|
|
113
|
-
return StagingPublicGSEConfiguration;
|
|
114
|
-
case 'testnet':
|
|
115
|
-
return TestnetGSEConfiguration;
|
|
116
|
-
case 'staging-ignition':
|
|
117
|
-
return StagingIgnitionGSEConfiguration;
|
|
118
|
-
default:
|
|
119
|
-
throw new Error(`Unrecognized network name: ${networkName}`);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
94
|
// Making a default config here as we are only using it thought the deployment
|
|
123
95
|
// and do not expect to be using different setups, so having environment variables
|
|
124
96
|
// for it seems overkill
|
|
@@ -245,6 +217,11 @@ export const l1ContractsConfigMappings = {
|
|
|
245
217
|
description: 'The target validator committee size.',
|
|
246
218
|
...numberConfigHelper(DefaultL1ContractsConfig.aztecTargetCommitteeSize)
|
|
247
219
|
},
|
|
220
|
+
lagInEpochs: {
|
|
221
|
+
env: 'AZTEC_LAG_IN_EPOCHS',
|
|
222
|
+
description: 'The number of epochs to lag behind the current epoch for validator selection.',
|
|
223
|
+
...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochs)
|
|
224
|
+
},
|
|
248
225
|
aztecProofSubmissionEpochs: {
|
|
249
226
|
env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
|
|
250
227
|
description: 'The number of epochs after an epoch ends that proofs are still accepted.',
|
|
@@ -260,6 +237,11 @@ export const l1ContractsConfigMappings = {
|
|
|
260
237
|
description: 'The minimum stake for a validator.',
|
|
261
238
|
...bigintConfigHelper(DefaultL1ContractsConfig.ejectionThreshold)
|
|
262
239
|
},
|
|
240
|
+
localEjectionThreshold: {
|
|
241
|
+
env: 'AZTEC_LOCAL_EJECTION_THRESHOLD',
|
|
242
|
+
description: 'The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup',
|
|
243
|
+
...bigintConfigHelper(DefaultL1ContractsConfig.localEjectionThreshold)
|
|
244
|
+
},
|
|
263
245
|
slashingOffsetInRounds: {
|
|
264
246
|
env: 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
|
|
265
247
|
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)',
|
|
@@ -12,7 +12,7 @@ export declare class EmpireSlashingProposerContract extends EventEmitter impleme
|
|
|
12
12
|
private readonly logger;
|
|
13
13
|
private readonly proposer;
|
|
14
14
|
readonly type: "empire";
|
|
15
|
-
constructor(client: ViemClient, address: Hex);
|
|
15
|
+
constructor(client: ViemClient, address: Hex | EthAddress);
|
|
16
16
|
get address(): EthAddress;
|
|
17
17
|
getQuorumSize(): Promise<bigint>;
|
|
18
18
|
getRoundSize(): Promise<bigint>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empire_slashing_proposer.d.ts","sourceRoot":"","sources":["../../src/contracts/empire_slashing_proposer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAK3D,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAGL,KAAK,GAAG,EACR,KAAK,GAAG,EACR,KAAK,mBAAmB,EAGzB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,KAAK,WAAW,EAA8D,MAAM,kBAAkB,CAAC;AAEhH,qBAAa,4BAA6B,SAAQ,KAAK;gBACzC,KAAK,EAAE,MAAM;CAG1B;AAED,qBAAa,8BAA+B,SAAQ,YAAa,YAAW,WAAW;aAOnE,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YAAY,CACvB,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,MAAM,GAAG,MAAM,GACrB,UAAU,CAAC,OAAO,OAAO,CAAC,yBAAyB,CAAC;CAiDxD"}
|
|
@@ -19,7 +19,7 @@ export class EmpireSlashingProposerContract extends EventEmitter {
|
|
|
19
19
|
constructor(client, address){
|
|
20
20
|
super(), this.client = client, this.logger = createLogger('ethereum:contracts:empire_slashing_proposer'), this.type = 'empire';
|
|
21
21
|
this.proposer = getContract({
|
|
22
|
-
address,
|
|
22
|
+
address: typeof address === 'string' ? address : address.toString(),
|
|
23
23
|
abi: EmpireSlashingProposerAbi,
|
|
24
24
|
client
|
|
25
25
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import type { ViemSignature } from '@aztec/foundation/eth-signature';
|
|
3
3
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
4
|
-
import { type Account, type GetContractReturnType, type Hex, type StateOverride } from 'viem';
|
|
4
|
+
import { type Account, type GetContractReturnType, type Hex, type StateOverride, type WatchContractEventReturnType } from 'viem';
|
|
5
5
|
import type { DeployL1ContractsReturnType } from '../deploy_l1_contracts.js';
|
|
6
6
|
import type { L1ContractAddresses } from '../l1_contract_addresses.js';
|
|
7
7
|
import type { L1ReaderConfig } from '../l1_reader.js';
|
|
@@ -81,6 +81,8 @@ export declare class RollupContract {
|
|
|
81
81
|
getSlotDuration(): Promise<bigint>;
|
|
82
82
|
getTargetCommitteeSize(): Promise<bigint>;
|
|
83
83
|
getEjectionThreshold(): Promise<bigint>;
|
|
84
|
+
getLocalEjectionThreshold(): Promise<bigint>;
|
|
85
|
+
getLagInEpochs(): Promise<bigint>;
|
|
84
86
|
getActivationThreshold(): Promise<bigint>;
|
|
85
87
|
getExitDelay(): Promise<bigint>;
|
|
86
88
|
getManaTarget(): Promise<bigint>;
|
|
@@ -101,11 +103,11 @@ export declare class RollupContract {
|
|
|
101
103
|
epochDuration: number;
|
|
102
104
|
proofSubmissionEpochs: number;
|
|
103
105
|
}>;
|
|
104
|
-
|
|
106
|
+
getSlasherAddress(): Promise<`0x${string}`>;
|
|
105
107
|
/**
|
|
106
108
|
* Returns a SlasherContract instance for interacting with the slasher contract.
|
|
107
109
|
*/
|
|
108
|
-
getSlasherContract(): Promise<SlasherContract>;
|
|
110
|
+
getSlasherContract(): Promise<SlasherContract | undefined>;
|
|
109
111
|
getOwner(): Promise<`0x${string}`>;
|
|
110
112
|
getActiveAttesterCount(): Promise<bigint>;
|
|
111
113
|
getSlashingProposerAddress(): Promise<EthAddress>;
|
|
@@ -146,7 +148,9 @@ export declare class RollupContract {
|
|
|
146
148
|
}>;
|
|
147
149
|
getTimestampForSlot(slot: bigint): Promise<bigint>;
|
|
148
150
|
getEntryQueueLength(): Promise<bigint>;
|
|
149
|
-
|
|
151
|
+
getNextFlushableEpoch(): Promise<bigint>;
|
|
152
|
+
getCurrentEpochNumber(): Promise<bigint>;
|
|
153
|
+
getEpochNumberForBlock(blockNumber: bigint): Promise<bigint>;
|
|
150
154
|
getRollupAddresses(): Promise<L1RollupContractAddresses>;
|
|
151
155
|
getFeeJuicePortal(): Promise<EthAddress>;
|
|
152
156
|
getEpochNumberForSlotNumber(slotNumber: bigint): Promise<bigint>;
|
|
@@ -238,7 +242,10 @@ export declare class RollupContract {
|
|
|
238
242
|
listenToSlasherChanged(callback: (args: {
|
|
239
243
|
oldSlasher: `0x${string}`;
|
|
240
244
|
newSlasher: `0x${string}`;
|
|
241
|
-
}) => unknown):
|
|
245
|
+
}) => unknown): WatchContractEventReturnType;
|
|
246
|
+
listenToBlockInvalidated(callback: (args: {
|
|
247
|
+
blockNumber: bigint;
|
|
248
|
+
}) => unknown): WatchContractEventReturnType;
|
|
242
249
|
getSlashEvents(l1BlockHash: Hex): Promise<{
|
|
243
250
|
amount: bigint;
|
|
244
251
|
attester: EthAddress;
|
|
@@ -246,6 +253,6 @@ export declare class RollupContract {
|
|
|
246
253
|
listenToSlash(callback: (args: {
|
|
247
254
|
amount: bigint;
|
|
248
255
|
attester: EthAddress;
|
|
249
|
-
}) => unknown):
|
|
256
|
+
}) => unknown): WatchContractEventReturnType;
|
|
250
257
|
}
|
|
251
258
|
//# sourceMappingURL=rollup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../src/contracts/rollup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../src/contracts/rollup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI1D,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,GAAG,EACR,KAAK,aAAa,EAClB,KAAK,4BAA4B,EAKlC,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,O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EAAE,CAAC;IAQ3F,aAAa,CAClB,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,UAAU,CAAA;KAAE,KAAK,OAAO,GACpE,4BAA4B;CAchC"}
|
package/dest/contracts/rollup.js
CHANGED
|
@@ -8,9 +8,8 @@ import { memoize } from '@aztec/foundation/decorators';
|
|
|
8
8
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
9
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
10
10
|
import { RollupStorage } from '@aztec/l1-artifacts/RollupStorage';
|
|
11
|
-
import { SlasherAbi } from '@aztec/l1-artifacts/SlasherAbi';
|
|
12
11
|
import chunk from 'lodash.chunk';
|
|
13
|
-
import { encodeFunctionData,
|
|
12
|
+
import { encodeFunctionData, getContract, hexToBigInt, keccak256 } from 'viem';
|
|
14
13
|
import { getPublicClient } from '../client.js';
|
|
15
14
|
import { formatViemError } from '../utils.js';
|
|
16
15
|
import { EmpireSlashingProposerContract } from './empire_slashing_proposer.js';
|
|
@@ -68,16 +67,11 @@ export class RollupContract {
|
|
|
68
67
|
return this.rollup;
|
|
69
68
|
}
|
|
70
69
|
async getSlashingProposer() {
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
70
|
+
const slasher = await this.getSlasherContract();
|
|
71
|
+
if (!slasher) {
|
|
73
72
|
return undefined;
|
|
74
73
|
}
|
|
75
|
-
const
|
|
76
|
-
address: slasherAddress,
|
|
77
|
-
abi: SlasherAbi,
|
|
78
|
-
client: this.client
|
|
79
|
-
});
|
|
80
|
-
const proposerAddress = await slasher.read.PROPOSER();
|
|
74
|
+
const proposerAddress = await slasher.getProposer();
|
|
81
75
|
const proposerAbi = [
|
|
82
76
|
{
|
|
83
77
|
type: 'function',
|
|
@@ -94,7 +88,7 @@ export class RollupContract {
|
|
|
94
88
|
}
|
|
95
89
|
];
|
|
96
90
|
const proposer = getContract({
|
|
97
|
-
address: proposerAddress,
|
|
91
|
+
address: proposerAddress.toString(),
|
|
98
92
|
abi: proposerAbi,
|
|
99
93
|
client: this.client
|
|
100
94
|
});
|
|
@@ -128,6 +122,12 @@ export class RollupContract {
|
|
|
128
122
|
getEjectionThreshold() {
|
|
129
123
|
return this.rollup.read.getEjectionThreshold();
|
|
130
124
|
}
|
|
125
|
+
getLocalEjectionThreshold() {
|
|
126
|
+
return this.rollup.read.getLocalEjectionThreshold();
|
|
127
|
+
}
|
|
128
|
+
getLagInEpochs() {
|
|
129
|
+
return this.rollup.read.getLagInEpochs();
|
|
130
|
+
}
|
|
131
131
|
getActivationThreshold() {
|
|
132
132
|
return this.rollup.read.getActivationThreshold();
|
|
133
133
|
}
|
|
@@ -175,14 +175,17 @@ export class RollupContract {
|
|
|
175
175
|
proofSubmissionEpochs: Number(proofSubmissionEpochs)
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
getSlasherAddress() {
|
|
179
179
|
return this.rollup.read.getSlasher();
|
|
180
180
|
}
|
|
181
181
|
/**
|
|
182
182
|
* Returns a SlasherContract instance for interacting with the slasher contract.
|
|
183
183
|
*/ async getSlasherContract() {
|
|
184
|
-
const slasherAddress = await this.
|
|
185
|
-
|
|
184
|
+
const slasherAddress = EthAddress.fromString(await this.getSlasherAddress());
|
|
185
|
+
if (slasherAddress.isZero()) {
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
return new SlasherContract(this.client, slasherAddress);
|
|
186
189
|
}
|
|
187
190
|
getOwner() {
|
|
188
191
|
return this.rollup.read.owner();
|
|
@@ -191,13 +194,11 @@ export class RollupContract {
|
|
|
191
194
|
return this.rollup.read.getActiveAttesterCount();
|
|
192
195
|
}
|
|
193
196
|
async getSlashingProposerAddress() {
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
});
|
|
200
|
-
return EthAddress.fromString(await slasher.read.PROPOSER());
|
|
197
|
+
const slasher = await this.getSlasherContract();
|
|
198
|
+
if (!slasher) {
|
|
199
|
+
return EthAddress.ZERO;
|
|
200
|
+
}
|
|
201
|
+
return await slasher.getProposer();
|
|
201
202
|
}
|
|
202
203
|
getBlockReward() {
|
|
203
204
|
return this.rollup.read.getBlockReward();
|
|
@@ -300,8 +301,13 @@ export class RollupContract {
|
|
|
300
301
|
getEntryQueueLength() {
|
|
301
302
|
return this.rollup.read.getEntryQueueLength();
|
|
302
303
|
}
|
|
303
|
-
|
|
304
|
-
|
|
304
|
+
getNextFlushableEpoch() {
|
|
305
|
+
return this.rollup.read.getNextFlushableEpoch();
|
|
306
|
+
}
|
|
307
|
+
getCurrentEpochNumber() {
|
|
308
|
+
return this.rollup.read.getCurrentEpoch();
|
|
309
|
+
}
|
|
310
|
+
getEpochNumberForBlock(blockNumber) {
|
|
305
311
|
return this.rollup.read.getEpochForBlock([
|
|
306
312
|
BigInt(blockNumber)
|
|
307
313
|
]);
|
|
@@ -573,6 +579,20 @@ export class RollupContract {
|
|
|
573
579
|
}
|
|
574
580
|
});
|
|
575
581
|
}
|
|
582
|
+
listenToBlockInvalidated(callback) {
|
|
583
|
+
return this.rollup.watchEvent.BlockInvalidated({}, {
|
|
584
|
+
onLogs: (logs)=>{
|
|
585
|
+
for (const log of logs){
|
|
586
|
+
const args = log.args;
|
|
587
|
+
if (args.blockNumber !== undefined) {
|
|
588
|
+
callback({
|
|
589
|
+
blockNumber: args.blockNumber
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
}
|
|
576
596
|
async getSlashEvents(l1BlockHash) {
|
|
577
597
|
const events = await this.rollup.getEvents.Slashed({}, {
|
|
578
598
|
blockHash: l1BlockHash,
|
|
@@ -619,6 +639,12 @@ _ts_decorate([
|
|
|
619
639
|
_ts_decorate([
|
|
620
640
|
memoize
|
|
621
641
|
], RollupContract.prototype, "getEjectionThreshold", null);
|
|
642
|
+
_ts_decorate([
|
|
643
|
+
memoize
|
|
644
|
+
], RollupContract.prototype, "getLocalEjectionThreshold", null);
|
|
645
|
+
_ts_decorate([
|
|
646
|
+
memoize
|
|
647
|
+
], RollupContract.prototype, "getLagInEpochs", null);
|
|
622
648
|
_ts_decorate([
|
|
623
649
|
memoize
|
|
624
650
|
], RollupContract.prototype, "getActivationThreshold", null);
|
|
@@ -122,7 +122,7 @@ export declare const deploySharedContracts: (l1Client: ExtendedViemWalletClient,
|
|
|
122
122
|
* @param logger - The logger.
|
|
123
123
|
* @param txUtilsConfig - The L1 tx utils config.
|
|
124
124
|
*/
|
|
125
|
-
export declare const deployRollupForUpgrade: (extendedClient: ExtendedViemWalletClient, args: Omit<DeployL1ContractsArgs, "governanceProposerQuorum" | "governanceProposerRoundSize" | "ejectionThreshold" | "activationThreshold">, registryAddress: EthAddress, logger: Logger, txUtilsConfig: L1TxUtilsConfig) => Promise<{
|
|
125
|
+
export declare const deployRollupForUpgrade: (extendedClient: ExtendedViemWalletClient, args: Omit<DeployL1ContractsArgs, "governanceProposerQuorum" | "governanceProposerRoundSize" | "ejectionThreshold" | "activationThreshold">, registryAddress: EthAddress, logger: Logger, txUtilsConfig: L1TxUtilsConfig, flushEntryQueue?: boolean) => Promise<{
|
|
126
126
|
rollup: RollupContract;
|
|
127
127
|
slashFactoryAddress: EthAddress;
|
|
128
128
|
}>;
|
|
@@ -131,12 +131,12 @@ export declare const deployUpgradePayload: (deployer: L1Deployer, addresses: Pic
|
|
|
131
131
|
/**
|
|
132
132
|
* Deploys a new rollup contract, funds and initializes the fee juice portal, and initializes the validator set.
|
|
133
133
|
*/
|
|
134
|
-
export declare const deployRollup: (extendedClient: ExtendedViemWalletClient, deployer: L1Deployer, args: Omit<DeployL1ContractsArgs, "governanceProposerQuorum" | "governanceProposerRoundSize" | "ejectionThreshold" | "activationThreshold">, addresses: Pick<L1ContractAddresses, "feeJuiceAddress" | "registryAddress" | "rewardDistributorAddress" | "stakingAssetAddress" | "gseAddress" | "governanceAddress">, logger: Logger) => Promise<{
|
|
134
|
+
export declare const deployRollup: (extendedClient: ExtendedViemWalletClient, deployer: L1Deployer, args: Omit<DeployL1ContractsArgs, "governanceProposerQuorum" | "governanceProposerRoundSize" | "ejectionThreshold" | "activationThreshold">, addresses: Pick<L1ContractAddresses, "feeJuiceAddress" | "registryAddress" | "rewardDistributorAddress" | "stakingAssetAddress" | "gseAddress" | "governanceAddress">, flushEntryQueue: boolean, logger: Logger) => Promise<{
|
|
135
135
|
rollup: RollupContract;
|
|
136
136
|
slashFactoryAddress: EthAddress;
|
|
137
137
|
}>;
|
|
138
138
|
export declare const handoverToGovernance: (extendedClient: ExtendedViemWalletClient, deployer: L1Deployer, registryAddress: EthAddress, gseAddress: EthAddress, coinIssuerAddress: EthAddress, feeAssetAddress: EthAddress, governanceAddress: EthAddress, logger: Logger, acceleratedTestDeployments: boolean | undefined) => Promise<void>;
|
|
139
|
-
export declare const addMultipleValidators: (extendedClient: ExtendedViemWalletClient, deployer: L1Deployer, gseAddress: Hex, rollupAddress: Hex, stakingAssetAddress: Hex, validators: Operator[], acceleratedTestDeployments: boolean | undefined, logger: Logger) => Promise<void>;
|
|
139
|
+
export declare const addMultipleValidators: (extendedClient: ExtendedViemWalletClient, deployer: L1Deployer, gseAddress: Hex, rollupAddress: Hex, stakingAssetAddress: Hex, validators: Operator[], acceleratedTestDeployments: boolean | undefined, flushEntryQueue: boolean, logger: Logger) => Promise<void>;
|
|
140
140
|
/**
|
|
141
141
|
* Initialize the fee asset handler and make it a minter on the fee asset.
|
|
142
142
|
* @note This function will only be used for testing purposes.
|
|
@@ -159,7 +159,7 @@ export declare const cheat_initializeFeeAssetHandler: (extendedClient: ExtendedV
|
|
|
159
159
|
* @param args - Arguments for initialization of L1 contracts
|
|
160
160
|
* @returns A list of ETH addresses of the deployed contracts.
|
|
161
161
|
*/
|
|
162
|
-
export declare const deployL1Contracts: (rpcUrls: string[], account: HDAccount | PrivateKeyAccount, chain: Chain, logger: Logger, args: DeployL1ContractsArgs, txUtilsConfig?: L1TxUtilsConfig, createVerificationJson?: string | false) => Promise<DeployL1ContractsReturnType>;
|
|
162
|
+
export declare const deployL1Contracts: (rpcUrls: string[], account: HDAccount | PrivateKeyAccount, chain: Chain, logger: Logger, args: DeployL1ContractsArgs, txUtilsConfig?: L1TxUtilsConfig, createVerificationJson?: string | false, flushEntryQueue?: boolean) => Promise<DeployL1ContractsReturnType>;
|
|
163
163
|
export declare class L1Deployer {
|
|
164
164
|
readonly client: ExtendedViemWalletClient;
|
|
165
165
|
private acceleratedTestDeployments;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../src/deploy_l1_contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAwB,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../src/deploy_l1_contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAwB,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EACL,KAAK,KAAK,EACV,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,iBAAiB,EAUvB,MAAM,M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,EAAE,SAAS,OAAO,EAAE,EACxB,IAAI,EAAE,GAAG;;;;EAeV"}
|
|
@@ -4,13 +4,14 @@ import { keccak256String } from '@aztec/foundation/crypto';
|
|
|
4
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
5
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
6
6
|
import { createLogger } from '@aztec/foundation/log';
|
|
7
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
7
8
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
8
9
|
import { mkdir, writeFile } from 'fs/promises';
|
|
9
10
|
import { concatHex, encodeAbiParameters, encodeDeployData, encodeFunctionData, getAddress, getContract, getContractAddress, numberToHex, padHex } from 'viem';
|
|
10
11
|
import { foundry } from 'viem/chains';
|
|
11
12
|
import { isAnvilTestChain } from './chain.js';
|
|
12
13
|
import { createExtendedL1Client } from './client.js';
|
|
13
|
-
import { getEntryQueueConfig,
|
|
14
|
+
import { getEntryQueueConfig, getGovernanceConfiguration, getRewardBoostConfig, getRewardConfig, validateConfig } from './config.js';
|
|
14
15
|
import { GSEContract } from './contracts/gse.js';
|
|
15
16
|
import { deployMulticall3 } from './contracts/multicall.js';
|
|
16
17
|
import { RegistryContract } from './contracts/registry.js';
|
|
@@ -36,12 +37,11 @@ export const deploySharedContracts = async (l1Client, deployer, args, logger)=>{
|
|
|
36
37
|
l1Client.account.address
|
|
37
38
|
]);
|
|
38
39
|
logger.verbose(`Deployed Staking Asset at ${stakingAssetAddress}`);
|
|
39
|
-
const gseConfiguration = getGSEConfiguration(networkName);
|
|
40
40
|
const gseAddress = await deployer.deploy(GSEArtifact, [
|
|
41
41
|
l1Client.account.address,
|
|
42
42
|
stakingAssetAddress.toString(),
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
args.activationThreshold,
|
|
44
|
+
args.ejectionThreshold
|
|
45
45
|
]);
|
|
46
46
|
logger.verbose(`Deployed GSE at ${gseAddress}`);
|
|
47
47
|
const registryAddress = await deployer.deploy(RegistryArtifact, [
|
|
@@ -240,10 +240,10 @@ const getZkPassportVerifierAddress = async (deployer, args)=>{
|
|
|
240
240
|
* @param registryAddress - The address of the registry.
|
|
241
241
|
* @param logger - The logger.
|
|
242
242
|
* @param txUtilsConfig - The L1 tx utils config.
|
|
243
|
-
*/ export const deployRollupForUpgrade = async (extendedClient, args, registryAddress, logger, txUtilsConfig)=>{
|
|
243
|
+
*/ export const deployRollupForUpgrade = async (extendedClient, args, registryAddress, logger, txUtilsConfig, flushEntryQueue = true)=>{
|
|
244
244
|
const deployer = new L1Deployer(extendedClient, args.salt, undefined, args.acceleratedTestDeployments, logger, txUtilsConfig);
|
|
245
245
|
const addresses = await RegistryContract.collectAddresses(extendedClient, registryAddress, 'canonical');
|
|
246
|
-
const { rollup, slashFactoryAddress } = await deployRollup(extendedClient, deployer, args, addresses, logger);
|
|
246
|
+
const { rollup, slashFactoryAddress } = await deployRollup(extendedClient, deployer, args, addresses, flushEntryQueue, logger);
|
|
247
247
|
await deployer.waitForDeployments();
|
|
248
248
|
return {
|
|
249
249
|
rollup,
|
|
@@ -281,7 +281,7 @@ function slasherFlavorToSolidityEnum(flavor) {
|
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
283
|
* Deploys a new rollup contract, funds and initializes the fee juice portal, and initializes the validator set.
|
|
284
|
-
*/ export const deployRollup = async (extendedClient, deployer, args, addresses, logger)=>{
|
|
284
|
+
*/ export const deployRollup = async (extendedClient, deployer, args, addresses, flushEntryQueue, logger)=>{
|
|
285
285
|
if (!addresses.gseAddress) {
|
|
286
286
|
throw new Error('GSE address is required when deploying');
|
|
287
287
|
}
|
|
@@ -303,6 +303,7 @@ function slasherFlavorToSolidityEnum(flavor) {
|
|
|
303
303
|
aztecSlotDuration: BigInt(args.aztecSlotDuration),
|
|
304
304
|
aztecEpochDuration: BigInt(args.aztecEpochDuration),
|
|
305
305
|
targetCommitteeSize: BigInt(args.aztecTargetCommitteeSize),
|
|
306
|
+
lagInEpochs: BigInt(args.lagInEpochs),
|
|
306
307
|
aztecProofSubmissionEpochs: BigInt(args.aztecProofSubmissionEpochs),
|
|
307
308
|
slashingQuorum: BigInt(args.slashingQuorum ?? args.slashingRoundSizeInEpochs * args.aztecEpochDuration / 2 + 1),
|
|
308
309
|
slashingRoundSize: BigInt(args.slashingRoundSizeInEpochs * args.aztecEpochDuration),
|
|
@@ -322,7 +323,8 @@ function slasherFlavorToSolidityEnum(flavor) {
|
|
|
322
323
|
args.slashAmountSmall,
|
|
323
324
|
args.slashAmountMedium,
|
|
324
325
|
args.slashAmountLarge
|
|
325
|
-
]
|
|
326
|
+
],
|
|
327
|
+
localEjectionThreshold: args.localEjectionThreshold
|
|
326
328
|
};
|
|
327
329
|
const genesisStateArgs = {
|
|
328
330
|
vkTreeRoot: args.vkTreeRoot.toString(),
|
|
@@ -438,7 +440,7 @@ function slasherFlavorToSolidityEnum(flavor) {
|
|
|
438
440
|
if (args.initialValidators && await gseContract.read.isRollupRegistered([
|
|
439
441
|
rollupContract.address
|
|
440
442
|
])) {
|
|
441
|
-
await addMultipleValidators(extendedClient, deployer, addresses.gseAddress.toString(), rollupAddress.toString(), addresses.stakingAssetAddress.toString(), args.initialValidators, args.acceleratedTestDeployments, logger);
|
|
443
|
+
await addMultipleValidators(extendedClient, deployer, addresses.gseAddress.toString(), rollupAddress.toString(), addresses.stakingAssetAddress.toString(), args.initialValidators, args.acceleratedTestDeployments, flushEntryQueue, logger);
|
|
442
444
|
}
|
|
443
445
|
// If the owner is not the Governance contract, transfer ownership to the Governance contract
|
|
444
446
|
logger.verbose(addresses.governanceAddress.toString());
|
|
@@ -580,7 +582,7 @@ export const handoverToGovernance = async (extendedClient, deployer, registryAdd
|
|
|
580
582
|
* @param validators - The validators to initialize.
|
|
581
583
|
* @param acceleratedTestDeployments - Whether to use accelerated test deployments.
|
|
582
584
|
* @param logger - The logger.
|
|
583
|
-
*/ export const addMultipleValidators = async (extendedClient, deployer, gseAddress, rollupAddress, stakingAssetAddress, validators, acceleratedTestDeployments, logger)=>{
|
|
585
|
+
*/ export const addMultipleValidators = async (extendedClient, deployer, gseAddress, rollupAddress, stakingAssetAddress, validators, acceleratedTestDeployments, flushEntryQueue, logger)=>{
|
|
584
586
|
const rollup = new RollupContract(extendedClient, rollupAddress);
|
|
585
587
|
const activationThreshold = await rollup.getActivationThreshold();
|
|
586
588
|
if (validators && validators.length > 0) {
|
|
@@ -637,22 +639,46 @@ export const handoverToGovernance = async (extendedClient, deployer, registryAdd
|
|
|
637
639
|
functionName: 'addValidators',
|
|
638
640
|
args: [
|
|
639
641
|
validatorsTuples,
|
|
640
|
-
true
|
|
642
|
+
/* skip flushing */ true
|
|
641
643
|
]
|
|
642
644
|
})
|
|
643
645
|
}, {
|
|
644
646
|
gasLimit: 40_000_000n
|
|
645
647
|
});
|
|
646
|
-
await
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
648
|
+
let queueLength = await rollup.getEntryQueueLength();
|
|
649
|
+
while(flushEntryQueue && queueLength > 0n){
|
|
650
|
+
logger.info(`Flushing entry queue with ${queueLength} entries`);
|
|
651
|
+
try {
|
|
652
|
+
await deployer.l1TxUtils.sendAndMonitorTransaction({
|
|
653
|
+
to: rollupAddress,
|
|
654
|
+
data: encodeFunctionData({
|
|
655
|
+
abi: RollupArtifact.contractAbi,
|
|
656
|
+
functionName: 'flushEntryQueue',
|
|
657
|
+
args: []
|
|
658
|
+
})
|
|
659
|
+
}, {
|
|
660
|
+
gasLimit: 20_000_000n
|
|
661
|
+
});
|
|
662
|
+
} catch (err) {
|
|
663
|
+
logger.warn('Failed to flush queue', {
|
|
664
|
+
err
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
queueLength = await rollup.getEntryQueueLength();
|
|
668
|
+
// check if we drained the queue enough here so we can avoid sleep
|
|
669
|
+
if (queueLength === 0n) {
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
logger.info(`Waiting for next flushable epoch to flush remaining ${queueLength} entries`);
|
|
673
|
+
await retryUntil(async ()=>{
|
|
674
|
+
const [currentEpoch, flushableEpoch] = await Promise.all([
|
|
675
|
+
rollup.getCurrentEpochNumber(),
|
|
676
|
+
rollup.getNextFlushableEpoch()
|
|
677
|
+
]);
|
|
678
|
+
logger.debug(`Next flushable epoch is ${flushableEpoch} (current epoch is ${currentEpoch})`);
|
|
679
|
+
return currentEpoch >= flushableEpoch;
|
|
680
|
+
}, 'wait for next flushable epoch', 3600, 12);
|
|
681
|
+
}
|
|
656
682
|
} else {
|
|
657
683
|
await deployer.l1TxUtils.sendAndMonitorTransaction({
|
|
658
684
|
to: multiAdder.toString(),
|
|
@@ -661,7 +687,7 @@ export const handoverToGovernance = async (extendedClient, deployer, registryAdd
|
|
|
661
687
|
functionName: 'addValidators',
|
|
662
688
|
args: [
|
|
663
689
|
validatorsTuples,
|
|
664
|
-
|
|
690
|
+
/* skip flushing */ !flushEntryQueue
|
|
665
691
|
]
|
|
666
692
|
})
|
|
667
693
|
}, {
|
|
@@ -717,7 +743,7 @@ export const cheat_initializeFeeAssetHandler = async (extendedClient, deployer,
|
|
|
717
743
|
* @param logger - A logger object.
|
|
718
744
|
* @param args - Arguments for initialization of L1 contracts
|
|
719
745
|
* @returns A list of ETH addresses of the deployed contracts.
|
|
720
|
-
*/ export const deployL1Contracts = async (rpcUrls, account, chain, logger, args, txUtilsConfig = getL1TxUtilsConfigEnvVars(), createVerificationJson = false)=>{
|
|
746
|
+
*/ export const deployL1Contracts = async (rpcUrls, account, chain, logger, args, txUtilsConfig = getL1TxUtilsConfigEnvVars(), createVerificationJson = false, flushEntryQueue = true)=>{
|
|
721
747
|
logger.info(`Deploying L1 contracts with config: ${jsonStringify(args)}`);
|
|
722
748
|
validateConfig(args);
|
|
723
749
|
const l1Client = createExtendedL1Client(rpcUrls, account, chain);
|
|
@@ -753,7 +779,7 @@ export const cheat_initializeFeeAssetHandler = async (extendedClient, deployer,
|
|
|
753
779
|
rewardDistributorAddress,
|
|
754
780
|
stakingAssetAddress,
|
|
755
781
|
governanceAddress
|
|
756
|
-
}, logger);
|
|
782
|
+
}, flushEntryQueue, logger);
|
|
757
783
|
logger.verbose('Waiting for rollup and slash factory to be deployed');
|
|
758
784
|
await deployer.waitForDeployments();
|
|
759
785
|
// Now that the rollup has been deployed and added to the registry, transfer ownership to governance
|
|
@@ -814,7 +840,7 @@ export const cheat_initializeFeeAssetHandler = async (extendedClient, deployer,
|
|
|
814
840
|
});
|
|
815
841
|
// Include Slasher and SlashingProposer (if deployed) in verification data
|
|
816
842
|
try {
|
|
817
|
-
const slasherAddrHex = await rollup.
|
|
843
|
+
const slasherAddrHex = await rollup.getSlasherAddress();
|
|
818
844
|
const slasherAddr = EthAddress.fromString(slasherAddrHex);
|
|
819
845
|
if (!slasherAddr.isZero()) {
|
|
820
846
|
// Slasher constructor: (address _vetoer, address _governance)
|