Skip to content

Commit

Permalink
chore: Remove references to padding txs (#11264)
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 authored Jan 16, 2025
1 parent a469c94 commit 32408f6
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 35 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 @@ -466,7 +466,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
6 changes: 1 addition & 5 deletions yarn-project/prover-client/src/block_builder/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
MerkleTreeId,
type MerkleTreeWriteOperations,
type ProcessedTx,
TxHash,
toNumBlobFields,
} from '@aztec/circuit-types';
import { Fr, type GlobalVariables, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/circuits.js';
Expand Down Expand Up @@ -47,9 +46,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 @@ -91,7 +88,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 @@ -270,11 +270,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 @@ -528,9 +523,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 @@ -558,11 +551,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 agentClient?: ProvingJobConsumer,
private telemetry: TelemetryClient = getTelemetryClient(),
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 32408f6

Please sign in to comment.