Skip to content

Commit

Permalink
chore: Remove references to padding txs
Browse files Browse the repository at this point in the history
In #11096 the empty padding tx was removed in favor of other circuits
(yay!). This PR removes all dangling references to padding txs.
  • Loading branch information
spalladino committed Jan 16, 2025
1 parent 642bce6 commit f9f0af2
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 34 deletions.
1 change: 0 additions & 1 deletion yarn-project/circuit-types/src/interfaces/block-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export interface BlockBuilder extends ProcessedTxHandler {
addTxs(txs: ProcessedTx[]): Promise<void>;

/**
* Pads the block with empty txs if it hasn't reached the declared number of txs.
* Assembles the block and updates the archive tree.
*/
setBlockCompleted(expectedBlockHeader?: BlockHeader): Promise<L2Block>;
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/circuit-types/src/interfaces/epoch-prover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface EpochProver extends Omit<BlockBuilder, 'setBlockCompleted'> {
*/
startTubeCircuits(txs: Tx[]): void;

/** Pads the block with empty txs if it hasn't reached the declared number of txs. */
/** Returns the block. */
setBlockCompleted(blockNumber: number, expectedBlockHeader?: BlockHeader): Promise<L2Block>;

/** Pads the epoch with empty block roots if needed and blocks until proven. Throws if proving has failed. */
Expand Down
6 changes: 0 additions & 6 deletions yarn-project/circuit-types/src/tx/processed_tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ export type ProcessedTx = {
* Reason the tx was reverted.
*/
revertReason: SimulationError | undefined;
/**
* Flag indicating the tx is 'empty' meaning it's a padding tx to take us to a power of 2.
*/
isEmpty: boolean;
};

/**
Expand Down Expand Up @@ -123,7 +119,6 @@ export function makeProcessedTxFromPrivateOnlyTx(
txEffect,
gasUsed,
revertReason: undefined,
isEmpty: false,
};
}

Expand Down Expand Up @@ -181,6 +176,5 @@ export function makeProcessedTxFromTxWithPublicCalls(
txEffect,
gasUsed,
revertReason,
isEmpty: false,
};
}
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/e2e_block_building.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ describe('e2e_block_building', () => {
});

// Regression for https://github.com/AztecProtocol/aztec-packages/issues/7918
it('publishes two blocks with only padding txs', async () => {
it('publishes two empty blocks', async () => {
({ teardown, pxe, logger, aztecNode } = await setup(0, {
minTxsPerBlock: 0,
skipProtocolContracts: true,
Expand Down
5 changes: 1 addition & 4 deletions yarn-project/prover-client/src/block_builder/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ export class LightweightBlockBuilder implements BlockBuilder {
async addTxs(txs: ProcessedTx[]): Promise<void> {
this.spongeBlobState = SpongeBlob.init(toNumBlobFields(txs));
for (const tx of txs) {
this.logger.debug(tx.hash.equals(TxHash.zero()) ? 'Adding padding tx to block' : 'Adding new tx to block', {
txHash: tx.hash.toString(),
});
this.logger.debug('Adding new tx to block', { txHash: tx.hash.toString() });
this.txs.push(tx);
await buildBaseRollupHints(tx, this.globalVariables!, this.db, this.spongeBlobState!);
}
Expand Down Expand Up @@ -92,7 +90,6 @@ export class LightweightBlockBuilderFactory {

/**
* Creates a block builder under the hood with the given txs and messages and creates a block.
* Automatically adds padding txs to get to a minimum of 2 txs in the block.
* @param db - A db fork to use for block building.
*/
export async function buildBlock(
Expand Down
15 changes: 2 additions & 13 deletions yarn-project/prover-client/src/orchestrator/orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,6 @@ export class ProvingOrchestrator implements EpochProver {

logger.info(`Received transaction: ${tx.hash}`);

if (tx.isEmpty) {
logger.warn(`Ignoring empty transaction ${tx.hash} - it will not be added to this block`);
continue;
}

const [hints, treeSnapshots] = await this.prepareTransaction(tx, provingState);
const txProvingState = new TxProvingState(tx, hints, treeSnapshots);
const txIndex = provingState.addNewTx(txProvingState);
Expand Down Expand Up @@ -521,9 +516,7 @@ export class ProvingOrchestrator implements EpochProver {
buildBaseRollupHints(tx, provingState.globalVariables, db, provingState.spongeBlobState),
);

if (!tx.isEmpty) {
this.metrics.recordBaseRollupInputs(ms);
}
this.metrics.recordBaseRollupInputs(ms);

const promises = [MerkleTreeId.NOTE_HASH_TREE, MerkleTreeId.NULLIFIER_TREE, MerkleTreeId.PUBLIC_DATA_TREE].map(
async (id: MerkleTreeId) => {
Expand Down Expand Up @@ -551,11 +544,7 @@ export class ProvingOrchestrator implements EpochProver {
const { processedTx } = txProvingState;
const { rollupType, inputs } = txProvingState.getBaseRollupTypeAndInputs();

logger.debug(
`Enqueuing deferred proving base rollup${
processedTx.isEmpty ? ' with padding tx' : ''
} for ${processedTx.hash.toString()}`,
);
logger.debug(`Enqueuing deferred proving base rollup for ${processedTx.hash.toString()}`);

this.deferredProving(
provingState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ export class ProverClient implements EpochProverManager {
private orchestratorClient: ProvingJobProducer,
private agentClient?: ProvingJobConsumer,
private log = createLogger('prover-client:tx-prover'),
) {
// TODO(palla/prover-node): Cache the paddingTx here, and not in each proving orchestrator,
// so it can be reused across multiple ones and not recomputed every time.
}
) {}

public createEpochProver(): EpochProver {
const facade = new BrokerCircuitProverFacade(this.orchestratorClient);
Expand All @@ -60,10 +57,6 @@ export class ProverClient implements EpochProverManager {
await this.createAndStartAgents();
}

if (!this.config.realProofs && newConfig.realProofs) {
// TODO(palla/prover-node): Reset padding tx here once we cache it at this class
}

this.config = newConfig;
}

Expand Down

0 comments on commit f9f0af2

Please sign in to comment.