Skip to content

Commit

Permalink
feat: Use light builder in sequencer
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Sep 20, 2024
1 parent d65926c commit 7967c6f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
32 changes: 30 additions & 2 deletions yarn-project/end-to-end/src/e2e_block_building.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from '@aztec/aztec.js';
import { times } from '@aztec/foundation/collection';
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
import { StatefulTestContractArtifact } from '@aztec/noir-contracts.js';
import { StatefulTestContract, StatefulTestContractArtifact } from '@aztec/noir-contracts.js';
import { TestContract } from '@aztec/noir-contracts.js/Test';
import { TokenContract } from '@aztec/noir-contracts.js/Token';

Expand Down Expand Up @@ -89,7 +89,35 @@ describe('e2e_block_building', () => {
expect(areDeployed).toEqual(times(TX_COUNT, () => true));
});

it.skip('can call public function from different tx in same block', async () => {
it('assembles a block with multiple txs with public fns', async () => {
// First deploy the contract
const ownerAddress = owner.getCompleteAddress().address;
const contract = await StatefulTestContract.deploy(owner, ownerAddress, ownerAddress, 1).send().deployed();

// Assemble N contract deployment txs
// We need to create them sequentially since we cannot have parallel calls to a circuit
const TX_COUNT = 8;
await aztecNode.setConfig({ minTxsPerBlock: TX_COUNT });

const methods = times(TX_COUNT, i => contract.methods.increment_public_value(ownerAddress, i));
for (let i = 0; i < TX_COUNT; i++) {
await methods[i].create({});
await methods[i].prove({});
}

// Send them simultaneously to be picked up by the sequencer
const txs = await Promise.all(methods.map(method => method.send()));
logger.info(`Txs sent with hashes: `);
for (const tx of txs) {
logger.info(` ${await tx.getTxHash()}`);
}

// Await txs to be mined and assert they are all mined on the same block
const receipts = await Promise.all(txs.map(tx => tx.wait()));
expect(receipts.map(r => r.blockNumber)).toEqual(times(TX_COUNT, () => receipts[0].blockNumber));
});

it.skip('can call public function from different tx in same block as deployed', async () => {
// Ensure both txs will land on the same block
await aztecNode.setConfig({ minTxsPerBlock: 2 });

Expand Down
4 changes: 2 additions & 2 deletions yarn-project/sequencer-client/src/client/sequencer-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { type TelemetryClient } from '@aztec/telemetry-client';
import { type ContractDataSource } from '@aztec/types/contracts';
import { type ValidatorClient } from '@aztec/validator-client';

import { OrchestratorBlockBuilderFactory } from '../block_builder/index.js';
import { LightweightBlockBuilderFactory } from '../block_builder/index.js';
import { type SequencerClientConfig } from '../config.js';
import { GlobalVariableBuilder } from '../global_variable_builder/index.js';
import { L1Publisher } from '../publisher/index.js';
Expand Down Expand Up @@ -60,7 +60,7 @@ export class SequencerClient {
globalsBuilder,
p2pClient,
worldStateSynchronizer,
new OrchestratorBlockBuilderFactory(simulationProvider, telemetryClient),
new LightweightBlockBuilderFactory(telemetryClient),
l2BlockSource,
l1ToL2MessageSource,
publicProcessorFactory,
Expand Down

0 comments on commit 7967c6f

Please sign in to comment.