Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions yarn-project/archiver/src/archiver-store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ describe('Archiver Store', () => {
slotDuration: 24,
ethereumSlotDuration: 12,
proofSubmissionEpochs: 1,
targetCommitteeSize: 48,
genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT),
};

Expand Down
1 change: 1 addition & 0 deletions yarn-project/archiver/src/archiver-sync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ describe('Archiver Sync', () => {
slotDuration: 24,
ethereumSlotDuration: DefaultL1ContractsConfig.ethereumSlotDuration,
proofSubmissionEpochs: 1,
targetCommitteeSize: 48,
genesisArchiveRoot: GENESIS_ROOT,
};

Expand Down
24 changes: 16 additions & 8 deletions yarn-project/archiver/src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,21 @@ export async function createArchiver(
const inbox = new InboxContract(publicClient, config.l1Contracts.inboxAddress);

// Fetch L1 constants from rollup contract
const [l1StartBlock, l1GenesisTime, proofSubmissionEpochs, genesisArchiveRoot, slashingProposerAddress] =
await Promise.all([
rollup.getL1StartBlock(),
rollup.getL1GenesisTime(),
rollup.getProofSubmissionEpochs(),
rollup.getGenesisArchiveTreeRoot(),
rollup.getSlashingProposerAddress(),
] as const);
const [
l1StartBlock,
l1GenesisTime,
proofSubmissionEpochs,
genesisArchiveRoot,
slashingProposerAddress,
targetCommitteeSize,
] = await Promise.all([
rollup.getL1StartBlock(),
rollup.getL1GenesisTime(),
rollup.getProofSubmissionEpochs(),
rollup.getGenesisArchiveTreeRoot(),
rollup.getSlashingProposerAddress(),
rollup.getTargetCommitteeSize(),
] as const);

const l1StartBlockHash = await publicClient
.getBlock({ blockNumber: l1StartBlock, includeTransactions: false })
Expand All @@ -100,6 +107,7 @@ export async function createArchiver(
slotDuration,
ethereumSlotDuration,
proofSubmissionEpochs: Number(proofSubmissionEpochs),
targetCommitteeSize,
genesisArchiveRoot: Fr.fromString(genesisArchiveRoot.toString()),
};

Expand Down
1 change: 1 addition & 0 deletions yarn-project/aztec-node/src/sentinel/sentinel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ describe('sentinel', () => {
epochDuration: 8,
ethereumSlotDuration: 12,
proofSubmissionEpochs: 1,
targetCommitteeSize: 48,
};

epochCache.getEpochAndSlotNow.mockReturnValue({ epoch, slot, ts, nowMs: ts * 1000n });
Expand Down
1 change: 1 addition & 0 deletions yarn-project/end-to-end/src/e2e_epochs/epochs_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export class EpochsTestContext {
l1GenesisTime: await this.rollup.getL1GenesisTime(),
ethereumSlotDuration,
proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs()),
targetCommitteeSize: await this.rollup.getTargetCommitteeSize(),
};

this.logger.info(
Expand Down
1 change: 1 addition & 0 deletions yarn-project/epoch-cache/src/epoch_cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ describe('EpochCache', () => {
ethereumSlotDuration: SLOT_DURATION,
epochDuration: EPOCH_DURATION,
proofSubmissionEpochs: 1,
targetCommitteeSize: 48,
lagInEpochsForValidatorSet: 2,
lagInEpochsForRandao: 2,
};
Expand Down
4 changes: 4 additions & 0 deletions yarn-project/epoch-cache/src/epoch_cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface EpochCacheInterface {
getRegisteredValidators(): Promise<EthAddress[]>;
isInCommittee(slot: SlotTag, validator: EthAddress): Promise<boolean>;
filterInCommittee(slot: SlotTag, validators: EthAddress[]): Promise<EthAddress[]>;
getL1Constants(): L1RollupConstants;
}

/**
Expand Down Expand Up @@ -106,6 +107,7 @@ export class EpochCache implements EpochCacheInterface {
epochDuration,
lagInEpochsForValidatorSet,
lagInEpochsForRandao,
targetCommitteeSize,
] = await Promise.all([
rollup.getL1StartBlock(),
rollup.getL1GenesisTime(),
Expand All @@ -114,6 +116,7 @@ export class EpochCache implements EpochCacheInterface {
rollup.getEpochDuration(),
rollup.getLagInEpochsForValidatorSet(),
rollup.getLagInEpochsForRandao(),
rollup.getTargetCommitteeSize(),
] as const);

const l1RollupConstants = {
Expand All @@ -125,6 +128,7 @@ export class EpochCache implements EpochCacheInterface {
ethereumSlotDuration: config.ethereumSlotDuration,
lagInEpochsForValidatorSet: Number(lagInEpochsForValidatorSet),
lagInEpochsForRandao: Number(lagInEpochsForRandao),
targetCommitteeSize: Number(targetCommitteeSize),
};

return new EpochCache(rollup, l1RollupConstants, deps.dateProvider);
Expand Down
1 change: 1 addition & 0 deletions yarn-project/epoch-cache/src/test/test_epoch_cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const DEFAULT_L1_CONSTANTS: L1RollupConstants = {
epochDuration: 16,
ethereumSlotDuration: 12,
proofSubmissionEpochs: 2,
targetCommitteeSize: 48,
};

/**
Expand Down
18 changes: 11 additions & 7 deletions yarn-project/ethereum/src/contracts/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,20 +391,24 @@ export class RollupContract {
slotDuration: number;
epochDuration: number;
proofSubmissionEpochs: number;
targetCommitteeSize: number;
}> {
const [l1StartBlock, l1GenesisTime, slotDuration, epochDuration, proofSubmissionEpochs] = await Promise.all([
this.getL1StartBlock(),
this.getL1GenesisTime(),
this.getSlotDuration(),
this.getEpochDuration(),
this.getProofSubmissionEpochs(),
]);
const [l1StartBlock, l1GenesisTime, slotDuration, epochDuration, proofSubmissionEpochs, targetCommitteeSize] =
await Promise.all([
this.getL1StartBlock(),
this.getL1GenesisTime(),
this.getSlotDuration(),
this.getEpochDuration(),
this.getProofSubmissionEpochs(),
this.getTargetCommitteeSize(),
]);
return {
l1StartBlock,
l1GenesisTime,
slotDuration,
epochDuration: Number(epochDuration),
proofSubmissionEpochs: Number(proofSubmissionEpochs),
targetCommitteeSize,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ describe('p2p client integration batch txs', () => {
//@ts-expect-error - we want to mock the getEpochAndSlotInNextL1Slot method, mocking ts is enough
epochCache.getEpochAndSlotInNextL1Slot.mockReturnValue({ ts: BigInt(0) });
epochCache.getRegisteredValidators.mockResolvedValue([]);
epochCache.getL1Constants.mockReturnValue({
l1StartBlock: 0n,
l1GenesisTime: 0n,
slotDuration: 24,
epochDuration: 16,
ethereumSlotDuration: 12,
proofSubmissionEpochs: 2,
targetCommitteeSize: 48,
});

txPool.hasTxs.mockResolvedValue([]);
txPool.getAllTxs.mockImplementation(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ describe('p2p client integration block txs protocol ', () => {
//@ts-expect-error - we want to mock the getEpochAndSlotInNextL1Slot method, mocking ts is enough
epochCache.getEpochAndSlotInNextL1Slot.mockReturnValue({ ts: BigInt(0) });
epochCache.getRegisteredValidators.mockResolvedValue([]);
epochCache.getL1Constants.mockReturnValue({
l1StartBlock: 0n,
l1GenesisTime: 0n,
slotDuration: 24,
epochDuration: 16,
ethereumSlotDuration: 12,
proofSubmissionEpochs: 2,
targetCommitteeSize: 48,
});

txPool.isEmpty.mockResolvedValue(true);
txPool.hasTxs.mockResolvedValue([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ describe('p2p client integration message propagation', () => {
//@ts-expect-error - we want to mock the getEpochAndSlotInNextL1Slot method, mocking ts is enough
epochCache.getEpochAndSlotInNextL1Slot.mockReturnValue({ ts: BigInt(0) });
epochCache.getRegisteredValidators.mockResolvedValue([]);
epochCache.getL1Constants.mockReturnValue({
l1StartBlock: 0n,
l1GenesisTime: 0n,
slotDuration: 24,
epochDuration: 16,
ethereumSlotDuration: 12,
proofSubmissionEpochs: 2,
targetCommitteeSize: 48,
});

txPool.isEmpty.mockResolvedValue(true);
txPool.hasTxs.mockResolvedValue([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ describe('p2p client integration status handshake', () => {
//@ts-expect-error - we want to mock the getEpochAndSlotInNextL1Slot method, mocking ts is enough
epochCache.getEpochAndSlotInNextL1Slot.mockReturnValue({ ts: BigInt(0) });
epochCache.getRegisteredValidators.mockResolvedValue([]);
epochCache.getL1Constants.mockReturnValue({
l1StartBlock: 0n,
l1GenesisTime: 0n,
slotDuration: 24,
epochDuration: 16,
ethereumSlotDuration: 12,
proofSubmissionEpochs: 2,
targetCommitteeSize: 48,
});

txPool.isEmpty.mockResolvedValue(true);
attestationPool.isEmpty.mockResolvedValue(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ describe('p2p client integration', () => {
//@ts-expect-error - we want to mock the getEpochAndSlotInNextL1Slot method, mocking ts is enough
epochCache.getEpochAndSlotInNextL1Slot.mockReturnValue({ ts: BigInt(0) });
epochCache.getRegisteredValidators.mockResolvedValue([]);
epochCache.getL1Constants.mockReturnValue({
l1StartBlock: 0n,
l1GenesisTime: 0n,
slotDuration: 24,
epochDuration: 16,
ethereumSlotDuration: 12,
proofSubmissionEpochs: 2,
targetCommitteeSize: 48,
});

txPool.isEmpty.mockResolvedValue(true);
txPool.hasTxs.mockResolvedValue([]);
Expand Down
12 changes: 10 additions & 2 deletions yarn-project/p2p/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import { Fr } from '@aztec/foundation/curves/bn254';
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
import { FunctionSelector } from '@aztec/stdlib/abi/function-selector';
import { AztecAddress } from '@aztec/stdlib/aztec-address';
import { type AllowedElement, type ChainConfig, chainConfigMappings } from '@aztec/stdlib/config';
import {
type AllowedElement,
type ChainConfig,
type SequencerConfig,
chainConfigMappings,
sharedSequencerConfigMappings,
} from '@aztec/stdlib/config';

import {
type BatchTxRequesterConfig,
Expand All @@ -31,7 +37,8 @@ export interface P2PConfig
BatchTxRequesterConfig,
ChainConfig,
TxCollectionConfig,
TxFileStoreConfig {
TxFileStoreConfig,
Pick<SequencerConfig, 'blockDurationMs'> {
/** A flag dictating whether the P2P subsystem should be enabled. */
p2pEnabled: boolean;

Expand Down Expand Up @@ -441,6 +448,7 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
'Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus.',
...booleanConfigHelper(false),
},
...sharedSequencerConfigMappings,
...p2pReqRespConfigMappings,
...batchTxRequesterConfigMappings,
...chainConfigMappings,
Expand Down
Loading
Loading