From c4830392f371a33427a7a60ff50aa90e011caabf Mon Sep 17 00:00:00 2001 From: LHerskind Date: Thu, 8 Aug 2024 08:57:33 +0000 Subject: [PATCH] extra logging --- .../kv_archiver_store/block_body_store.ts | 7 ++++- .../composed/integration_l1_publisher.test.ts | 2 +- .../end-to-end/src/e2e_p2p_network.test.ts | 2 +- .../src/sequencer/sequencer.ts | 30 +++++++++++-------- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/yarn-project/archiver/src/archiver/kv_archiver_store/block_body_store.ts b/yarn-project/archiver/src/archiver/kv_archiver_store/block_body_store.ts index 62c718d5ae6b..5e7da7fac20c 100644 --- a/yarn-project/archiver/src/archiver/kv_archiver_store/block_body_store.ts +++ b/yarn-project/archiver/src/archiver/kv_archiver_store/block_body_store.ts @@ -1,11 +1,12 @@ import { Body } from '@aztec/circuit-types'; +import { createDebugLogger } from '@aztec/foundation/log'; import { type AztecKVStore, type AztecMap } from '@aztec/kv-store'; export class BlockBodyStore { /** Map block body hash to block body */ #blockBodies: AztecMap; - constructor(private db: AztecKVStore) { + constructor(private db: AztecKVStore, private log = createDebugLogger('aztec:archiver:block_body_store')) { this.#blockBodies = db.openMap('archiver_block_bodies'); } @@ -35,6 +36,10 @@ export class BlockBodyStore { ); if (blockBodiesBuffer.some(bodyBuffer => bodyBuffer === undefined)) { + this.log.error( + 'Block body buffer is undefined', + txsEffectsHashes.map(txsEffectsHash => txsEffectsHash.toString('hex')), + ); throw new Error('Block body buffer is undefined'); } diff --git a/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts b/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts index 5b8e3ff1f8a0..c77e40f96176 100644 --- a/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts +++ b/yarn-project/end-to-end/src/composed/integration_l1_publisher.test.ts @@ -135,7 +135,7 @@ describe('L1Publisher integration', () => { logger, )); - ethCheatCodes = new EthCheatCodes(config.rpcUrl); + ethCheatCodes = new EthCheatCodes(config.l1RpcUrl); rollupAddress = getAddress(l1ContractAddresses.rollupAddress.toString()); inboxAddress = getAddress(l1ContractAddresses.inboxAddress.toString()); diff --git a/yarn-project/end-to-end/src/e2e_p2p_network.test.ts b/yarn-project/end-to-end/src/e2e_p2p_network.test.ts index be15410bdc28..fb626830295b 100644 --- a/yarn-project/end-to-end/src/e2e_p2p_network.test.ts +++ b/yarn-project/end-to-end/src/e2e_p2p_network.test.ts @@ -91,7 +91,7 @@ describe('e2e_p2p_network', () => { // Now we jump ahead to the next epoch, such that the next epoch begins const timeToJump = (await rollup.read.EPOCH_DURATION()) * (await rollup.read.SLOT_DURATION()); - const cheatCodes = new EthCheatCodes(config.rpcUrl); + const cheatCodes = new EthCheatCodes(config.l1RpcUrl); const timestamp = (await cheatCodes.timestamp()) + Number(timeToJump); await cheatCodes.warp(timestamp); diff --git a/yarn-project/sequencer-client/src/sequencer/sequencer.ts b/yarn-project/sequencer-client/src/sequencer/sequencer.ts index 4cd78bdac27b..ffa1d5d8fb5b 100644 --- a/yarn-project/sequencer-client/src/sequencer/sequencer.ts +++ b/yarn-project/sequencer-client/src/sequencer/sequencer.ts @@ -174,16 +174,17 @@ export class Sequencer { try { // Update state when the previous block has been synced const prevBlockSynced = await this.isBlockSynced(); - if (prevBlockSynced && this.state === SequencerState.PUBLISHING_BLOCK) { - this.log.debug(`Block has been synced`); - this.state = SequencerState.IDLE; - } - // Do not go forward with new block if the previous one has not been mined and processed if (!prevBlockSynced) { + this.log.debug('Previous block has not been mined and processed yet'); return; } + if (prevBlockSynced && this.state === SequencerState.PUBLISHING_BLOCK) { + this.log.debug(`Block has been synced`); + this.state = SequencerState.IDLE; + } + const historicalHeader = (await this.l2BlockSource.getBlock(-1))?.header; const newBlockNumber = (historicalHeader === undefined @@ -360,13 +361,18 @@ export class Sequencer { await assertBlockHeight(); const workDuration = workTimer.ms(); - this.log.verbose(`Assembled block ${block.number}`, { - eventName: 'l2-block-built', - duration: workDuration, - publicProcessDuration: publicProcessorDuration, - rollupCircuitsDuration: blockBuildingTimer.ms(), - ...block.getStats(), - } satisfies L2BlockBuiltStats); + this.log.verbose( + `Assembled block ${block.number} (txEffectsHash: ${block.header.contentCommitment.txsEffectsHash.toString( + 'hex', + )})`, + { + eventName: 'l2-block-built', + duration: workDuration, + publicProcessDuration: publicProcessorDuration, + rollupCircuitsDuration: blockBuildingTimer.ms(), + ...block.getStats(), + } satisfies L2BlockBuiltStats, + ); try { const attestations = await this.collectAttestations(block);