Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Jan 26, 2024
1 parent 95868f7 commit 8239c70
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 28 deletions.
3 changes: 0 additions & 3 deletions yarn-project/end-to-end/src/integration_l1_publisher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@ import {
to2Fields,
} from '@aztec/aztec.js';
import {
AppendOnlyTreeSnapshot,
Header,
KernelCircuitPublicInputs,
MAX_NEW_COMMITMENTS_PER_TX,
MAX_NEW_L2_TO_L1_MSGS_PER_TX,
MAX_NEW_NULLIFIERS_PER_TX,
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
PartialStateReference,
PublicDataUpdateRequest,
SideEffectLinkedToNoteHash,
StateReference,
} from '@aztec/circuits.js';
import {
fr,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/pxe/src/database/kv_pxe_database.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ContractDao, MerkleTreeId, NoteFilter, PublicKey } from '@aztec/circuit-types';
import { AztecAddress, Header, CompleteAddress } from '@aztec/circuits.js';
import { AztecAddress, CompleteAddress, Header } from '@aztec/circuits.js';
import { ContractArtifact } from '@aztec/foundation/abi';
import { Fr, Point } from '@aztec/foundation/fields';
import { AztecArray, AztecKVStore, AztecMap, AztecMultiMap, AztecSingleton } from '@aztec/kv-store';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
RootRollupPublicInputs,
SideEffect,
SideEffectLinkedToNoteHash,
StateReference
StateReference,
} from '@aztec/circuits.js';
import { computeBlockHashWithGlobals, computeContractLeaf } from '@aztec/circuits.js/abis';
import {
Expand All @@ -54,7 +54,7 @@ import { MerkleTreeOperations, MerkleTrees } from '@aztec/world-state';

import { MockProxy, mock } from 'jest-mock-extended';
import { default as levelup } from 'levelup';
import { default as memdown, type MemDown } from 'memdown';
import { type MemDown, default as memdown } from 'memdown';

import { VerificationKeys, getVerificationKeys } from '../mocks/verification_keys.js';
import { EmptyRollupProver } from '../prover/empty.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class SequencerClient {
const publicProcessorFactory = new PublicProcessorFactory(merkleTreeDb, contractDataSource, l1ToL2MessageSource);

const sequencer = new Sequencer(
publisher,
publisher,
globalsBuilder,
p2pClient,
worldStateSynchronizer,
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/sequencer-client/src/sequencer/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './sequencer.js';
export * from './config.js';
export * from './utils.js';
export * from './utils.js';
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class PublicProcessorFactory {
* @returns A new instance of a PublicProcessor.
*/
public async create(prevHeader: Header | undefined, globalVariables: GlobalVariables): Promise<PublicProcessor> {
prevHeader = prevHeader ?? await buildInitialHeader(this.merkleTree);
prevHeader = prevHeader ?? (await buildInitialHeader(this.merkleTree));

const publicContractsDB = new ContractsDataSourcePublicDB(this.contractDataSource);
const worldStatePublicDB = new WorldStatePublicDB(this.merkleTree);
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/sequencer-client/src/sequencer/sequencer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { Fr, GlobalVariables, Header, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, makeEmptyProof } from '@aztec/circuits.js';
import { times } from '@aztec/foundation/collection';
import { P2P, P2PClientState } from '@aztec/p2p';
import { CurrentTreeRoots, MerkleTreeOperations, WorldStateRunningState, WorldStateSynchronizer } from '@aztec/world-state';
import { MerkleTreeOperations, WorldStateRunningState, WorldStateSynchronizer } from '@aztec/world-state';

import { MockProxy, mock, mockFn } from 'jest-mock-extended';

Expand Down Expand Up @@ -77,7 +77,7 @@ describe('sequencer', () => {
});

sequencer = new TestSubject(
publisher,
publisher,
globalVariableBuilder,
p2p,
worldState,
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/sequencer-client/src/sequencer/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class Sequencer {

// TODO(benesjan): is this correct? Should we add a check that all the tree roots are really empty?
const prevHeader = (await this.l2BlockSource.getBlock(-1))?.header;

// Process txs and drop the ones that fail processing
// We create a fresh processor each time to reset any cached state (eg storage writes)
const processor = await this.publicProcessorFactory.create(prevHeader, newGlobalVariables);
Expand Down Expand Up @@ -201,7 +201,7 @@ export class Sequencer {
await assertBlockHeight();

const emptyTx = await processor.makeEmptyProcessedTx();
const [rollupCircuitsDuration, block] = await elapsed(() =>
const [rollupCircuitsDuration, block] = await elapsed(() =>
this.buildBlock(processedValidTxs, l1ToL2Messages, emptyTx, newGlobalVariables),
);

Expand Down
37 changes: 22 additions & 15 deletions yarn-project/sequencer-client/src/sequencer/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { AppendOnlyTreeSnapshot, Fr, GlobalVariables, Header, PartialStateReference, StateReference } from '@aztec/circuits.js';
import {
AppendOnlyTreeSnapshot,
Fr,
GlobalVariables,
Header,
PartialStateReference,
StateReference,
} from '@aztec/circuits.js';
import { MerkleTreeOperations } from '@aztec/world-state';

/**
Expand All @@ -8,19 +15,19 @@ export async function buildInitialHeader(
db: MerkleTreeOperations,
prevBlockGlobalVariables: GlobalVariables = GlobalVariables.empty(), // TODO(benesjan): this should most likely be removed
) {
const roots = await db.getTreeRoots();
return new Header(
AppendOnlyTreeSnapshot.empty(), // TODO(benesjan): is it correct that last archive is 0?
Buffer.alloc(32, 0),
new StateReference(
new AppendOnlyTreeSnapshot(Fr.fromBuffer(roots.l1Tol2MessageTreeRoot), 0),
new PartialStateReference(
new AppendOnlyTreeSnapshot(Fr.fromBuffer(roots.noteHashTreeRoot), 0),
new AppendOnlyTreeSnapshot(Fr.fromBuffer(roots.nullifierTreeRoot), 0),
new AppendOnlyTreeSnapshot(Fr.fromBuffer(roots.contractDataTreeRoot), 0),
new AppendOnlyTreeSnapshot(Fr.fromBuffer(roots.publicDataTreeRoot), 0),
),
const roots = await db.getTreeRoots();
return new Header(
AppendOnlyTreeSnapshot.empty(), // TODO(benesjan): is it correct that last archive is 0?
Buffer.alloc(32, 0),
new StateReference(
new AppendOnlyTreeSnapshot(Fr.fromBuffer(roots.l1Tol2MessageTreeRoot), 0),
new PartialStateReference(
new AppendOnlyTreeSnapshot(Fr.fromBuffer(roots.noteHashTreeRoot), 0),
new AppendOnlyTreeSnapshot(Fr.fromBuffer(roots.nullifierTreeRoot), 0),
new AppendOnlyTreeSnapshot(Fr.fromBuffer(roots.contractDataTreeRoot), 0),
new AppendOnlyTreeSnapshot(Fr.fromBuffer(roots.publicDataTreeRoot), 0),
),
prevBlockGlobalVariables,
);
),
prevBlockGlobalVariables,
);
}

0 comments on commit 8239c70

Please sign in to comment.