Skip to content

Commit

Permalink
extra logging
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Aug 9, 2024
1 parent ade6c02 commit c483039
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -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<string, Buffer>;

constructor(private db: AztecKVStore) {
constructor(private db: AztecKVStore, private log = createDebugLogger('aztec:archiver:block_body_store')) {
this.#blockBodies = db.openMap('archiver_block_bodies');
}

Expand Down Expand Up @@ -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');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_p2p_network.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
30 changes: 18 additions & 12 deletions yarn-project/sequencer-client/src/sequencer/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c483039

Please sign in to comment.