@aztec/ethereum 0.0.1-commit.1142ef1 → 0.0.1-commit.18ccd8f0
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 +15 -28
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +46 -55
- package/dest/contracts/governance.d.ts +3 -1
- package/dest/contracts/governance.d.ts.map +1 -1
- package/dest/contracts/governance.js +9 -1
- package/dest/contracts/inbox.d.ts +18 -1
- package/dest/contracts/inbox.d.ts.map +1 -1
- package/dest/contracts/inbox.js +32 -1
- package/dest/contracts/index.d.ts +2 -1
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +1 -0
- package/dest/contracts/log.d.ts +13 -0
- package/dest/contracts/log.d.ts.map +1 -0
- package/dest/contracts/log.js +1 -0
- package/dest/contracts/rollup.d.ts +34 -3
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +67 -3
- package/dest/deploy_aztec_l1_contracts.d.ts +6 -1
- package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_aztec_l1_contracts.js +20 -7
- package/dest/generated/l1-contracts-defaults.d.ts +30 -0
- package/dest/generated/l1-contracts-defaults.d.ts.map +1 -0
- package/dest/generated/l1-contracts-defaults.js +30 -0
- package/dest/l1_artifacts.d.ts +1394 -471
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/publisher_manager.d.ts +3 -2
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +2 -2
- package/dest/queries.d.ts +2 -2
- package/dest/queries.d.ts.map +1 -1
- package/dest/queries.js +4 -1
- package/dest/test/eth_cheat_codes.d.ts +13 -1
- package/dest/test/eth_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.d.ts +4 -2
- package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
- package/dest/test/rollup_cheat_codes.js +10 -1
- package/dest/test/start_anvil.js +1 -1
- package/package.json +8 -7
- package/src/config.ts +55 -54
- package/src/contracts/README.md +157 -0
- package/src/contracts/governance.ts +8 -1
- package/src/contracts/inbox.ts +48 -1
- package/src/contracts/index.ts +1 -0
- package/src/contracts/log.ts +13 -0
- package/src/contracts/rollup.ts +96 -4
- package/src/deploy_aztec_l1_contracts.ts +21 -7
- package/src/generated/l1-contracts-defaults.ts +32 -0
- package/src/publisher_manager.ts +4 -2
- package/src/queries.ts +3 -1
- package/src/test/rollup_cheat_codes.ts +11 -2
- package/src/test/start_anvil.ts +1 -1
package/src/contracts/rollup.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { memoize } from '@aztec/foundation/decorators';
|
|
|
5
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
6
|
import type { ViemSignature } from '@aztec/foundation/eth-signature';
|
|
7
7
|
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
8
|
+
import { EscapeHatchAbi } from '@aztec/l1-artifacts/EscapeHatchAbi';
|
|
8
9
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
9
10
|
import { RollupStorage } from '@aztec/l1-artifacts/RollupStorage';
|
|
10
11
|
|
|
@@ -30,6 +31,7 @@ import type { ViemClient } from '../types.js';
|
|
|
30
31
|
import { formatViemError } from '../utils.js';
|
|
31
32
|
import { EmpireSlashingProposerContract } from './empire_slashing_proposer.js';
|
|
32
33
|
import { GSEContract } from './gse.js';
|
|
34
|
+
import type { L1EventLog } from './log.js';
|
|
33
35
|
import { SlasherContract } from './slasher_contract.js';
|
|
34
36
|
import { TallySlashingProposerContract } from './tally_slashing_proposer.js';
|
|
35
37
|
import { checkBlockTag } from './utils.js';
|
|
@@ -69,6 +71,7 @@ export type ViemHeader = {
|
|
|
69
71
|
blockHeadersHash: `0x${string}`;
|
|
70
72
|
blobsHash: `0x${string}`;
|
|
71
73
|
inHash: `0x${string}`;
|
|
74
|
+
outHash: `0x${string}`;
|
|
72
75
|
slotNumber: bigint;
|
|
73
76
|
timestamp: bigint;
|
|
74
77
|
coinbase: `0x${string}`;
|
|
@@ -105,7 +108,7 @@ export enum AttesterStatus {
|
|
|
105
108
|
export type FeeHeader = {
|
|
106
109
|
excessMana: bigint;
|
|
107
110
|
manaUsed: bigint;
|
|
108
|
-
|
|
111
|
+
ethPerFeeAsset: bigint;
|
|
109
112
|
congestionCost: bigint;
|
|
110
113
|
proverCost: bigint;
|
|
111
114
|
};
|
|
@@ -185,10 +188,28 @@ export type RollupStatusResponse = {
|
|
|
185
188
|
archiveOfMyCheckpoint: Fr;
|
|
186
189
|
};
|
|
187
190
|
|
|
191
|
+
/** Arguments for the CheckpointProposed event. */
|
|
192
|
+
export type CheckpointProposedArgs = {
|
|
193
|
+
checkpointNumber: CheckpointNumber;
|
|
194
|
+
archive: Fr;
|
|
195
|
+
versionedBlobHashes: Buffer[];
|
|
196
|
+
/** Hash of attestations. Undefined for older events (backwards compatibility). */
|
|
197
|
+
attestationsHash?: Buffer32;
|
|
198
|
+
/** Digest of the payload. Undefined for older events (backwards compatibility). */
|
|
199
|
+
payloadDigest?: Buffer32;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/** Log type for CheckpointProposed events. */
|
|
203
|
+
export type CheckpointProposedLog = L1EventLog<CheckpointProposedArgs>;
|
|
204
|
+
|
|
188
205
|
export class RollupContract {
|
|
189
206
|
private readonly rollup: GetContractReturnType<typeof RollupAbi, ViemClient>;
|
|
190
207
|
|
|
191
208
|
private static cachedStfStorageSlot: Hex | undefined;
|
|
209
|
+
private cachedEscapeHatch?: {
|
|
210
|
+
address: EthAddress;
|
|
211
|
+
contract: GetContractReturnType<typeof EscapeHatchAbi, ViemClient>;
|
|
212
|
+
};
|
|
192
213
|
|
|
193
214
|
static get checkBlobStorageSlot(): bigint {
|
|
194
215
|
const asString = RollupStorage.find(storage => storage.label === 'checkBlob')?.slot;
|
|
@@ -391,6 +412,58 @@ export class RollupContract {
|
|
|
391
412
|
return EthAddress.fromString(await this.rollup.read.getSlasher());
|
|
392
413
|
}
|
|
393
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Returns the configured escape hatch contract address, or zero if disabled.
|
|
417
|
+
*/
|
|
418
|
+
async getEscapeHatchAddress(): Promise<EthAddress> {
|
|
419
|
+
return EthAddress.fromString(await this.rollup.read.getEscapeHatch());
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
private async getEscapeHatchContract(): Promise<
|
|
423
|
+
GetContractReturnType<typeof EscapeHatchAbi, ViemClient> | undefined
|
|
424
|
+
> {
|
|
425
|
+
const escapeHatchAddress = await this.getEscapeHatchAddress();
|
|
426
|
+
if (escapeHatchAddress.isZero()) {
|
|
427
|
+
return undefined;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Cache the viem contract wrapper since it will be used frequently.
|
|
431
|
+
if (!this.cachedEscapeHatch || !this.cachedEscapeHatch.address.equals(escapeHatchAddress)) {
|
|
432
|
+
this.cachedEscapeHatch = {
|
|
433
|
+
address: escapeHatchAddress,
|
|
434
|
+
contract: getContract({
|
|
435
|
+
address: escapeHatchAddress.toString(),
|
|
436
|
+
abi: EscapeHatchAbi,
|
|
437
|
+
client: this.client,
|
|
438
|
+
}),
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
return this.cachedEscapeHatch.contract;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Returns whether the escape hatch is open for the given epoch.
|
|
447
|
+
* If escape hatch is not configured, returns false.
|
|
448
|
+
*
|
|
449
|
+
* This function is intentionally defensive: any failure to query the escape hatch
|
|
450
|
+
* (RPC issues, transient errors, etc.) is treated as "closed" to avoid callers
|
|
451
|
+
* needing to sprinkle try/catch everywhere.
|
|
452
|
+
*/
|
|
453
|
+
async isEscapeHatchOpen(epoch: EpochNumber): Promise<boolean> {
|
|
454
|
+
try {
|
|
455
|
+
const escapeHatch = await this.getEscapeHatchContract();
|
|
456
|
+
if (!escapeHatch) {
|
|
457
|
+
return false;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
const [isOpen] = await escapeHatch.read.isHatchOpen([BigInt(epoch)]);
|
|
461
|
+
return isOpen;
|
|
462
|
+
} catch {
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
394
467
|
/**
|
|
395
468
|
* Returns a SlasherContract instance for interacting with the slasher contract.
|
|
396
469
|
*/
|
|
@@ -442,8 +515,8 @@ export class RollupContract {
|
|
|
442
515
|
};
|
|
443
516
|
}
|
|
444
517
|
|
|
445
|
-
|
|
446
|
-
return this.rollup.read.
|
|
518
|
+
getEthPerFeeAsset(): Promise<bigint> {
|
|
519
|
+
return this.rollup.read.getEthPerFeeAsset();
|
|
447
520
|
}
|
|
448
521
|
|
|
449
522
|
async getCommitteeAt(timestamp: bigint): Promise<EthAddress[] | undefined> {
|
|
@@ -528,7 +601,7 @@ export class RollupContract {
|
|
|
528
601
|
feeHeader: {
|
|
529
602
|
excessMana: result.feeHeader.excessMana,
|
|
530
603
|
manaUsed: result.feeHeader.manaUsed,
|
|
531
|
-
|
|
604
|
+
ethPerFeeAsset: result.feeHeader.ethPerFeeAsset,
|
|
532
605
|
congestionCost: result.feeHeader.congestionCost,
|
|
533
606
|
proverCost: result.feeHeader.proverCost,
|
|
534
607
|
},
|
|
@@ -965,4 +1038,23 @@ export class RollupContract {
|
|
|
965
1038
|
},
|
|
966
1039
|
);
|
|
967
1040
|
}
|
|
1041
|
+
|
|
1042
|
+
/** Fetches CheckpointProposed events within the given block range. */
|
|
1043
|
+
async getCheckpointProposedEvents(fromBlock: bigint, toBlock: bigint): Promise<CheckpointProposedLog[]> {
|
|
1044
|
+
const logs = await this.rollup.getEvents.CheckpointProposed({}, { fromBlock, toBlock });
|
|
1045
|
+
return logs
|
|
1046
|
+
.filter(log => log.blockNumber! >= fromBlock && log.blockNumber! <= toBlock)
|
|
1047
|
+
.map(log => ({
|
|
1048
|
+
l1BlockNumber: log.blockNumber!,
|
|
1049
|
+
l1BlockHash: Buffer32.fromString(log.blockHash!),
|
|
1050
|
+
l1TransactionHash: log.transactionHash!,
|
|
1051
|
+
args: {
|
|
1052
|
+
checkpointNumber: CheckpointNumber.fromBigInt(log.args.checkpointNumber!),
|
|
1053
|
+
archive: Fr.fromString(log.args.archive!),
|
|
1054
|
+
versionedBlobHashes: log.args.versionedBlobHashes!.map(h => Buffer.from(h.slice(2), 'hex')),
|
|
1055
|
+
attestationsHash: log.args.attestationsHash ? Buffer32.fromString(log.args.attestationsHash) : undefined,
|
|
1056
|
+
payloadDigest: log.args.payloadDigest ? Buffer32.fromString(log.args.payloadDigest) : undefined,
|
|
1057
|
+
},
|
|
1058
|
+
}));
|
|
1059
|
+
}
|
|
968
1060
|
}
|
|
@@ -10,7 +10,7 @@ import { fileURLToPath } from '@aztec/foundation/url';
|
|
|
10
10
|
import { bn254 } from '@noble/curves/bn254';
|
|
11
11
|
import type { Abi, Narrow } from 'abitype';
|
|
12
12
|
import { spawn } from 'child_process';
|
|
13
|
-
import { cpSync, existsSync, mkdirSync, mkdtempSync,
|
|
13
|
+
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'fs';
|
|
14
14
|
import { tmpdir } from 'os';
|
|
15
15
|
import { dirname, join, resolve } from 'path';
|
|
16
16
|
import readline from 'readline';
|
|
@@ -141,11 +141,14 @@ function cleanupDeployDir() {
|
|
|
141
141
|
*/
|
|
142
142
|
export function prepareL1ContractsForDeployment(): string {
|
|
143
143
|
if (preparedDeployDir && existsSync(preparedDeployDir)) {
|
|
144
|
+
logger.verbose(`Using cached deployment directory: ${preparedDeployDir}`);
|
|
144
145
|
return preparedDeployDir;
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
const basePath = getL1ContractsPath();
|
|
149
|
+
logger.verbose(`Preparing L1 contracts from: ${basePath}`);
|
|
148
150
|
const tempDir = mkdtempSync(join(tmpdir(), '.foundry-deploy-'));
|
|
151
|
+
logger.verbose(`Created temp directory for deployment: ${tempDir}`);
|
|
149
152
|
preparedDeployDir = tempDir;
|
|
150
153
|
process.on('exit', cleanupDeployDir);
|
|
151
154
|
|
|
@@ -157,13 +160,21 @@ export function prepareL1ContractsForDeployment(): string {
|
|
|
157
160
|
cpSync(join(basePath, 'src'), join(tempDir, 'src'), copyOpts);
|
|
158
161
|
cpSync(join(basePath, 'script'), join(tempDir, 'script'), copyOpts);
|
|
159
162
|
cpSync(join(basePath, 'generated'), join(tempDir, 'generated'), copyOpts);
|
|
160
|
-
|
|
163
|
+
// Kludge: copy test/ to appease forge cache which references test/shouting.t.sol
|
|
164
|
+
cpSync(join(basePath, 'test'), join(tempDir, 'test'), copyOpts);
|
|
161
165
|
cpSync(join(basePath, 'foundry.lock'), join(tempDir, 'foundry.lock'));
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
|
|
167
|
+
// Update foundry.toml to use absolute path to solc binary (avoids copying to noexec tmpfs)
|
|
168
|
+
const foundryTomlPath = join(basePath, 'foundry.toml');
|
|
169
|
+
let foundryToml = readFileSync(foundryTomlPath, 'utf-8');
|
|
170
|
+
const solcPathMatch = foundryToml.match(/solc\s*=\s*"\.\/solc-([^"]+)"/);
|
|
171
|
+
if (solcPathMatch) {
|
|
172
|
+
const solcVersion = solcPathMatch[1];
|
|
173
|
+
const absoluteSolcPath = join(basePath, `solc-${solcVersion}`);
|
|
174
|
+
foundryToml = foundryToml.replace(/solc\s*=\s*"\.\/solc-[^"]+"/, `solc = "${absoluteSolcPath}"`);
|
|
175
|
+
logger.verbose(`Updated solc path in foundry.toml to: ${absoluteSolcPath}`);
|
|
166
176
|
}
|
|
177
|
+
writeFileSync(join(tempDir, 'foundry.toml'), foundryToml);
|
|
167
178
|
|
|
168
179
|
mkdirSync(join(tempDir, 'broadcast'));
|
|
169
180
|
return tempDir;
|
|
@@ -308,7 +319,7 @@ export async function deployAztecL1Contracts(
|
|
|
308
319
|
}
|
|
309
320
|
|
|
310
321
|
// From heuristic testing. More caused issues with anvil.
|
|
311
|
-
const MAGIC_ANVIL_BATCH_SIZE =
|
|
322
|
+
const MAGIC_ANVIL_BATCH_SIZE = 8;
|
|
312
323
|
// Anvil seems to stall with unbounded batch size. Otherwise no max batch size is desirable.
|
|
313
324
|
const forgeArgs = [
|
|
314
325
|
'script',
|
|
@@ -497,6 +508,7 @@ export function getDeployAztecL1ContractsEnvVars(args: DeployAztecL1ContractsArg
|
|
|
497
508
|
AZTEC_EJECTION_THRESHOLD: args.ejectionThreshold?.toString(),
|
|
498
509
|
AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: args.governanceProposerRoundSize?.toString(),
|
|
499
510
|
AZTEC_GOVERNANCE_PROPOSER_QUORUM: args.governanceProposerQuorum?.toString(),
|
|
511
|
+
AZTEC_GOVERNANCE_VOTING_DURATION: args.governanceVotingDuration?.toString(),
|
|
500
512
|
ZKPASSPORT_DOMAIN: args.zkPassportArgs?.zkPassportDomain,
|
|
501
513
|
ZKPASSPORT_SCOPE: args.zkPassportArgs?.zkPassportScope,
|
|
502
514
|
} as const;
|
|
@@ -531,11 +543,13 @@ export function getDeployRollupForUpgradeEnvVars(
|
|
|
531
543
|
AZTEC_PROOF_SUBMISSION_EPOCHS: args.aztecProofSubmissionEpochs.toString(),
|
|
532
544
|
AZTEC_LOCAL_EJECTION_THRESHOLD: args.localEjectionThreshold.toString(),
|
|
533
545
|
AZTEC_SLASHING_LIFETIME_IN_ROUNDS: args.slashingLifetimeInRounds.toString(),
|
|
546
|
+
AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS: args.slashingExecutionDelayInRounds.toString(),
|
|
534
547
|
AZTEC_SLASHING_VETOER: args.slashingVetoer.toString(),
|
|
535
548
|
AZTEC_SLASHING_DISABLE_DURATION: args.slashingDisableDuration.toString(),
|
|
536
549
|
AZTEC_MANA_TARGET: args.manaTarget.toString(),
|
|
537
550
|
AZTEC_EXIT_DELAY_SECONDS: args.exitDelaySeconds.toString(),
|
|
538
551
|
AZTEC_PROVING_COST_PER_MANA: args.provingCostPerMana.toString(),
|
|
552
|
+
AZTEC_INITIAL_ETH_PER_FEE_ASSET: args.initialEthPerFeeAsset.toString(),
|
|
539
553
|
AZTEC_SLASHER_FLAVOR: args.slasherFlavor,
|
|
540
554
|
AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: args.slashingRoundSizeInEpochs.toString(),
|
|
541
555
|
AZTEC_SLASHING_QUORUM: args.slashingQuorum?.toString(),
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Auto-generated from spartan/environments/network-defaults.yml
|
|
2
|
+
// Do not edit manually - run yarn generate to regenerate
|
|
3
|
+
|
|
4
|
+
/** Default L1 contracts configuration values from network-defaults.yml */
|
|
5
|
+
export const l1ContractsDefaultEnv = {
|
|
6
|
+
ETHEREUM_SLOT_DURATION: 12,
|
|
7
|
+
AZTEC_SLOT_DURATION: 36,
|
|
8
|
+
AZTEC_EPOCH_DURATION: 32,
|
|
9
|
+
AZTEC_TARGET_COMMITTEE_SIZE: 48,
|
|
10
|
+
AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: 2,
|
|
11
|
+
AZTEC_LAG_IN_EPOCHS_FOR_RANDAO: 2,
|
|
12
|
+
AZTEC_ACTIVATION_THRESHOLD: 100000000000000000000,
|
|
13
|
+
AZTEC_EJECTION_THRESHOLD: 50000000000000000000,
|
|
14
|
+
AZTEC_LOCAL_EJECTION_THRESHOLD: 98000000000000000000,
|
|
15
|
+
AZTEC_EXIT_DELAY_SECONDS: 172800,
|
|
16
|
+
AZTEC_INBOX_LAG: 1,
|
|
17
|
+
AZTEC_PROOF_SUBMISSION_EPOCHS: 1,
|
|
18
|
+
AZTEC_MANA_TARGET: 100000000,
|
|
19
|
+
AZTEC_PROVING_COST_PER_MANA: 100,
|
|
20
|
+
AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000,
|
|
21
|
+
AZTEC_SLASHER_FLAVOR: 'tally',
|
|
22
|
+
AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: 4,
|
|
23
|
+
AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 5,
|
|
24
|
+
AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS: 0,
|
|
25
|
+
AZTEC_SLASHING_OFFSET_IN_ROUNDS: 2,
|
|
26
|
+
AZTEC_SLASHING_VETOER: '0x0000000000000000000000000000000000000000',
|
|
27
|
+
AZTEC_SLASHING_DISABLE_DURATION: 432000,
|
|
28
|
+
AZTEC_SLASH_AMOUNT_SMALL: 10000000000000000000,
|
|
29
|
+
AZTEC_SLASH_AMOUNT_MEDIUM: 20000000000000000000,
|
|
30
|
+
AZTEC_SLASH_AMOUNT_LARGE: 50000000000000000000,
|
|
31
|
+
AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: 300,
|
|
32
|
+
} as const;
|
package/src/publisher_manager.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pick } from '@aztec/foundation/collection';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
|
|
4
4
|
import { L1TxUtils, TxUtilsState } from './l1_tx_utils/index.js';
|
|
5
5
|
|
|
@@ -28,13 +28,15 @@ const busyStates: TxUtilsState[] = [
|
|
|
28
28
|
export type PublisherFilter<UtilsType extends L1TxUtils> = (utils: UtilsType) => boolean;
|
|
29
29
|
|
|
30
30
|
export class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
|
|
31
|
-
private log
|
|
31
|
+
private log: Logger;
|
|
32
32
|
private config: { publisherAllowInvalidStates?: boolean };
|
|
33
33
|
|
|
34
34
|
constructor(
|
|
35
35
|
private publishers: UtilsType[],
|
|
36
36
|
config: { publisherAllowInvalidStates?: boolean },
|
|
37
|
+
bindings?: LoggerBindings,
|
|
37
38
|
) {
|
|
39
|
+
this.log = createLogger('publisher:manager', bindings);
|
|
38
40
|
this.log.info(`PublisherManager initialized with ${publishers.length} publishers.`);
|
|
39
41
|
this.publishers = publishers;
|
|
40
42
|
this.config = pick(config, 'publisherAllowInvalidStates');
|
package/src/queries.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import { DefaultL1ContractsConfig, type L1ContractsConfig } from './config.js';
|
|
4
4
|
import { ReadOnlyGovernanceContract } from './contracts/governance.js';
|
|
5
5
|
import { GovernanceProposerContract } from './contracts/governance_proposer.js';
|
|
6
6
|
import { InboxContract } from './contracts/inbox.js';
|
|
@@ -99,6 +99,7 @@ export async function getL1ContractsConfig(
|
|
|
99
99
|
inboxLag: Number(inboxLag),
|
|
100
100
|
governanceProposerQuorum: Number(governanceProposerQuorum),
|
|
101
101
|
governanceProposerRoundSize: Number(governanceProposerRoundSize),
|
|
102
|
+
governanceVotingDuration: DefaultL1ContractsConfig.governanceVotingDuration,
|
|
102
103
|
activationThreshold,
|
|
103
104
|
ejectionThreshold,
|
|
104
105
|
localEjectionThreshold,
|
|
@@ -118,5 +119,6 @@ export async function getL1ContractsConfig(
|
|
|
118
119
|
slashAmountSmall: slashingAmounts[0],
|
|
119
120
|
slashAmountMedium: slashingAmounts[1],
|
|
120
121
|
slashAmountLarge: slashingAmounts[2],
|
|
122
|
+
initialEthPerFeeAsset: DefaultL1ContractsConfig.initialEthPerFeeAsset,
|
|
121
123
|
};
|
|
122
124
|
}
|
|
@@ -56,6 +56,15 @@ export class RollupCheatCodes {
|
|
|
56
56
|
return SlotNumber.fromBigInt(await this.rollup.read.getSlotAt([ts]));
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/** Returns the number of seconds until the start of the given slot based on L1 block timestamp. */
|
|
60
|
+
public async getSecondsUntilSlot(slot: SlotNumber): Promise<number> {
|
|
61
|
+
const [currentTimestamp, targetTimestamp] = await Promise.all([
|
|
62
|
+
this.client.getBlock().then(b => BigInt(b.timestamp)),
|
|
63
|
+
this.rollup.read.getTimestampForSlot([BigInt(slot)]),
|
|
64
|
+
]);
|
|
65
|
+
return Math.max(0, Number(targetTimestamp - currentTimestamp));
|
|
66
|
+
}
|
|
67
|
+
|
|
59
68
|
/** Returns the current epoch */
|
|
60
69
|
public async getEpoch(): Promise<EpochNumber> {
|
|
61
70
|
const slotNumber = await this.getSlot();
|
|
@@ -124,7 +133,7 @@ export class RollupCheatCodes {
|
|
|
124
133
|
} = {},
|
|
125
134
|
) {
|
|
126
135
|
const { epochDuration: slotsInEpoch } = await this.getConfig();
|
|
127
|
-
const slotNumber = SlotNumber(epoch * Number(slotsInEpoch));
|
|
136
|
+
const slotNumber = SlotNumber(Number(epoch) * Number(slotsInEpoch));
|
|
128
137
|
const timestamp = (await this.rollup.read.getTimestampForSlot([BigInt(slotNumber)])) + BigInt(opts.offset ?? 0);
|
|
129
138
|
try {
|
|
130
139
|
await this.ethCheatCodes.warp(Number(timestamp), { ...opts, silent: true, resetBlockInterval: true });
|
|
@@ -176,7 +185,7 @@ export class RollupCheatCodes {
|
|
|
176
185
|
* Marks the specified checkpoint (or latest if none) as proven
|
|
177
186
|
* @param maybeCheckpointNumber - The checkpoint number to mark as proven (defaults to latest pending)
|
|
178
187
|
*/
|
|
179
|
-
public markAsProven(maybeCheckpointNumber?:
|
|
188
|
+
public markAsProven(maybeCheckpointNumber?: CheckpointNumber) {
|
|
180
189
|
return this.ethCheatCodes.execWithPausedAnvil(async () => {
|
|
181
190
|
const tipsBefore = await this.getTips();
|
|
182
191
|
const { pending, proven } = tipsBefore;
|
package/src/test/start_anvil.ts
CHANGED
|
@@ -33,7 +33,7 @@ export async function startAnvil(
|
|
|
33
33
|
const anvil = createAnvil({
|
|
34
34
|
anvilBinary,
|
|
35
35
|
host: '127.0.0.1',
|
|
36
|
-
port: opts.port ?? 8545,
|
|
36
|
+
port: opts.port ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : 8545),
|
|
37
37
|
blockTime: opts.l1BlockTime,
|
|
38
38
|
stopTimeout: 1000,
|
|
39
39
|
accounts: opts.accounts ?? 20,
|