-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a block builder that assembles an L2Block out of a set of processed txs without relying on base, merge, block root, or parity circuits, and works using only ts code. Keeps the same interface as the current block builder for drop-in replacement within the orchestrator. Replaces the orchestator-based block builder on the sequencer. In a 32-tx block with a simple public function per tx, this reduces block building time from 38 to 18 seconds. ``` aztec:sequencer [VERBOSE] Assembled block 5 (txEffectsHash: 00a201e4acd5f1d58d8369d385f3fa0a7c10c84c1a95c15c75844603660f5ff3) eventName=l2-block-built duration=18983.888042002916 publicProcessDuration=18955.1897890009 rollupCircuitsDuration=18983.70012800023 txCount=32 blockNumber=5 blockTimestamp=1726864978 noteEncryptedLogLength=256 noteEncryptedLogCount=0 encryptedLogLength=256 encryptedLogCount=0 unencryptedLogCount=0 unencryptedLogSize=384 +19s ``` ``` aztec:sequencer [VERBOSE] Assembled block 5 (txEffectsHash: 00414283d876d3b97871a671bc18660222211c7baa9eb106da5215b998752320) eventName=l2-block-built duration=38610.87693199888 publicProcessDuration=19141.498885001987 rollupCircuitsDuration=38610.68504599854 txCount=32 blockNumber=5 blockTimestamp=1726865139 noteEncryptedLogLength=256 noteEncryptedLogCount=0 encryptedLogLength=256 encryptedLogCount=0 unencryptedLogCount=0 unencryptedLogSize=384 +39s ```
- Loading branch information
1 parent
a9e412b
commit 1e922a5
Showing
24 changed files
with
821 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { type MerkleTreeOperations, makeProcessedTx, mockTx } from '@aztec/circuit-types'; | ||
import { | ||
Fr, | ||
GasSettings, | ||
type Header, | ||
KernelCircuitPublicInputs, | ||
LogHash, | ||
MAX_L2_TO_L1_MSGS_PER_TX, | ||
MAX_NOTE_HASHES_PER_TX, | ||
MAX_NULLIFIERS_PER_TX, | ||
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, | ||
PublicDataUpdateRequest, | ||
ScopedLogHash, | ||
} from '@aztec/circuits.js'; | ||
import { makeScopedL2ToL1Message } from '@aztec/circuits.js/testing'; | ||
import { makeTuple } from '@aztec/foundation/array'; | ||
|
||
/** Makes a bloated processed tx for testing purposes. */ | ||
export function makeBloatedProcessedTx( | ||
historicalHeaderOrDb: Header | MerkleTreeOperations, | ||
vkRoot: Fr, | ||
seed = 0x1, | ||
overrides: { inclusionFee?: Fr } = {}, | ||
) { | ||
seed *= MAX_NULLIFIERS_PER_TX; // Ensure no clashing given incremental seeds | ||
const tx = mockTx(seed); | ||
const kernelOutput = KernelCircuitPublicInputs.empty(); | ||
kernelOutput.constants.vkTreeRoot = vkRoot; | ||
kernelOutput.constants.historicalHeader = | ||
'getInitialHeader' in historicalHeaderOrDb ? historicalHeaderOrDb.getInitialHeader() : historicalHeaderOrDb; | ||
kernelOutput.end.publicDataUpdateRequests = makeTuple( | ||
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, | ||
i => new PublicDataUpdateRequest(new Fr(i), new Fr(i + 10), i + 20), | ||
seed + 0x500, | ||
); | ||
kernelOutput.end.publicDataUpdateRequests = makeTuple( | ||
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, | ||
i => new PublicDataUpdateRequest(new Fr(i), new Fr(i + 10), i + 20), | ||
seed + 0x600, | ||
); | ||
|
||
kernelOutput.constants.txContext.gasSettings = GasSettings.default({ inclusionFee: overrides.inclusionFee }); | ||
|
||
const processedTx = makeProcessedTx(tx, kernelOutput, []); | ||
|
||
processedTx.data.end.noteHashes = makeTuple(MAX_NOTE_HASHES_PER_TX, i => new Fr(i), seed + 0x100); | ||
processedTx.data.end.nullifiers = makeTuple(MAX_NULLIFIERS_PER_TX, i => new Fr(i), seed + 0x100000); | ||
|
||
processedTx.data.end.nullifiers[tx.data.forPublic!.end.nullifiers.length - 1] = Fr.zero(); | ||
|
||
processedTx.data.end.l2ToL1Msgs = makeTuple(MAX_L2_TO_L1_MSGS_PER_TX, makeScopedL2ToL1Message, seed + 0x300); | ||
processedTx.noteEncryptedLogs.unrollLogs().forEach((log, i) => { | ||
processedTx.data.end.noteEncryptedLogsHashes[i] = new LogHash(Fr.fromBuffer(log.hash()), 0, new Fr(log.length)); | ||
}); | ||
processedTx.encryptedLogs.unrollLogs().forEach((log, i) => { | ||
processedTx.data.end.encryptedLogsHashes[i] = new ScopedLogHash( | ||
new LogHash(Fr.fromBuffer(log.hash()), 0, new Fr(log.length)), | ||
log.maskedContractAddress, | ||
); | ||
}); | ||
|
||
return processedTx; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './factories.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from './unbalanced_merkle_root.js'; | ||
|
||
/** | ||
* A leaf of an indexed merkle tree. | ||
*/ | ||
|
Oops, something went wrong.