Skip to content

Commit f72415b

Browse files
committed
Peer scoring
1 parent 3bbc5a3 commit f72415b

38 files changed

+1416
-61
lines changed

yarn-project/archiver/src/archiver-store.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ describe('Archiver Store', () => {
7171
slotDuration: 24,
7272
ethereumSlotDuration: 12,
7373
proofSubmissionEpochs: 1,
74+
targetCommitteeSize: 48,
7475
genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT),
7576
};
7677

yarn-project/archiver/src/archiver-sync.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ describe('Archiver Sync', () => {
7373
slotDuration: 24,
7474
ethereumSlotDuration: DefaultL1ContractsConfig.ethereumSlotDuration,
7575
proofSubmissionEpochs: 1,
76+
targetCommitteeSize: 48,
7677
genesisArchiveRoot: GENESIS_ROOT,
7778
};
7879

yarn-project/archiver/src/factory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export async function createArchiver(
100100
slotDuration,
101101
ethereumSlotDuration,
102102
proofSubmissionEpochs: Number(proofSubmissionEpochs),
103+
targetCommitteeSize: config.aztecTargetCommitteeSize,
103104
genesisArchiveRoot: Fr.fromString(genesisArchiveRoot.toString()),
104105
};
105106

yarn-project/aztec-node/src/sentinel/sentinel.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ describe('sentinel', () => {
7575
epochDuration: 8,
7676
ethereumSlotDuration: 12,
7777
proofSubmissionEpochs: 1,
78+
targetCommitteeSize: 48,
7879
};
7980

8081
epochCache.getEpochAndSlotNow.mockReturnValue({ epoch, slot, ts, nowMs: ts * 1000n });

yarn-project/end-to-end/src/e2e_epochs/epochs_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ export class EpochsTestContext {
194194
l1GenesisTime: await this.rollup.getL1GenesisTime(),
195195
ethereumSlotDuration,
196196
proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs()),
197+
targetCommitteeSize: await this.rollup.getTargetCommitteeSize(),
197198
};
198199

199200
this.logger.info(

yarn-project/epoch-cache/src/epoch_cache.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ describe('EpochCache', () => {
7272
ethereumSlotDuration: SLOT_DURATION,
7373
epochDuration: EPOCH_DURATION,
7474
proofSubmissionEpochs: 1,
75+
targetCommitteeSize: 48,
7576
lagInEpochsForValidatorSet: 2,
7677
lagInEpochsForRandao: 2,
7778
};

yarn-project/epoch-cache/src/epoch_cache.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export interface EpochCacheInterface {
4545
getRegisteredValidators(): Promise<EthAddress[]>;
4646
isInCommittee(slot: SlotTag, validator: EthAddress): Promise<boolean>;
4747
filterInCommittee(slot: SlotTag, validators: EthAddress[]): Promise<EthAddress[]>;
48+
getL1Constants(): L1RollupConstants;
4849
}
4950

5051
/**
@@ -106,6 +107,7 @@ export class EpochCache implements EpochCacheInterface {
106107
epochDuration,
107108
lagInEpochsForValidatorSet,
108109
lagInEpochsForRandao,
110+
targetCommitteeSize,
109111
] = await Promise.all([
110112
rollup.getL1StartBlock(),
111113
rollup.getL1GenesisTime(),
@@ -114,6 +116,7 @@ export class EpochCache implements EpochCacheInterface {
114116
rollup.getEpochDuration(),
115117
rollup.getLagInEpochsForValidatorSet(),
116118
rollup.getLagInEpochsForRandao(),
119+
rollup.getTargetCommitteeSize(),
117120
] as const);
118121

119122
const l1RollupConstants = {
@@ -125,6 +128,7 @@ export class EpochCache implements EpochCacheInterface {
125128
ethereumSlotDuration: config.ethereumSlotDuration,
126129
lagInEpochsForValidatorSet: Number(lagInEpochsForValidatorSet),
127130
lagInEpochsForRandao: Number(lagInEpochsForRandao),
131+
targetCommitteeSize: Number(targetCommitteeSize),
128132
};
129133

130134
return new EpochCache(rollup, l1RollupConstants, deps.dateProvider);

yarn-project/epoch-cache/src/test/test_epoch_cache.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const DEFAULT_L1_CONSTANTS: L1RollupConstants = {
1313
epochDuration: 16,
1414
ethereumSlotDuration: 12,
1515
proofSubmissionEpochs: 2,
16+
targetCommitteeSize: 48,
1617
};
1718

1819
/**

yarn-project/ethereum/src/contracts/rollup.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,20 +391,24 @@ export class RollupContract {
391391
slotDuration: number;
392392
epochDuration: number;
393393
proofSubmissionEpochs: number;
394+
targetCommitteeSize: number;
394395
}> {
395-
const [l1StartBlock, l1GenesisTime, slotDuration, epochDuration, proofSubmissionEpochs] = await Promise.all([
396-
this.getL1StartBlock(),
397-
this.getL1GenesisTime(),
398-
this.getSlotDuration(),
399-
this.getEpochDuration(),
400-
this.getProofSubmissionEpochs(),
401-
]);
396+
const [l1StartBlock, l1GenesisTime, slotDuration, epochDuration, proofSubmissionEpochs, targetCommitteeSize] =
397+
await Promise.all([
398+
this.getL1StartBlock(),
399+
this.getL1GenesisTime(),
400+
this.getSlotDuration(),
401+
this.getEpochDuration(),
402+
this.getProofSubmissionEpochs(),
403+
this.getTargetCommitteeSize(),
404+
]);
402405
return {
403406
l1StartBlock,
404407
l1GenesisTime,
405408
slotDuration,
406409
epochDuration: Number(epochDuration),
407410
proofSubmissionEpochs: Number(proofSubmissionEpochs),
411+
targetCommitteeSize,
408412
};
409413
}
410414

yarn-project/p2p/src/client/test/p2p_client.integration_batch_txs.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ describe('p2p client integration batch txs', () => {
6464
//@ts-expect-error - we want to mock the getEpochAndSlotInNextL1Slot method, mocking ts is enough
6565
epochCache.getEpochAndSlotInNextL1Slot.mockReturnValue({ ts: BigInt(0) });
6666
epochCache.getRegisteredValidators.mockResolvedValue([]);
67+
epochCache.getL1Constants.mockReturnValue({
68+
l1StartBlock: 0n,
69+
l1GenesisTime: 0n,
70+
slotDuration: 24,
71+
epochDuration: 16,
72+
ethereumSlotDuration: 12,
73+
proofSubmissionEpochs: 2,
74+
targetCommitteeSize: 48,
75+
});
6776

6877
txPool.hasTxs.mockResolvedValue([]);
6978
txPool.getAllTxs.mockImplementation(() => {

0 commit comments

Comments
 (0)