@aztec/simulator 4.0.0-devnet.2-patch.4 → 4.0.0-devnet.3-patch.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/private/circuit_recording/circuit_recorder.js +2 -2
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +6 -5
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +9 -9
- package/dest/public/fixtures/utils.d.ts +2 -2
- package/dest/public/fixtures/utils.d.ts.map +1 -1
- package/dest/public/fixtures/utils.js +2 -2
- package/dest/public/hinting_db_sources.d.ts +4 -4
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/hinting_db_sources.js +6 -5
- package/dest/public/public_db_sources.d.ts +3 -3
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +9 -9
- package/dest/public/public_processor/guarded_merkle_tree.d.ts +4 -4
- package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.js +4 -4
- package/dest/public/public_processor/public_processor.d.ts +5 -3
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +53 -43
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +1 -1
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +2 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +2 -3
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +2 -2
- package/dest/public/public_tx_simulator/factories.d.ts +2 -2
- package/dest/public/public_tx_simulator/factories.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/factories.js +2 -2
- package/dest/public/public_tx_simulator/public_tx_simulator.js +4 -4
- package/package.json +16 -16
- package/src/private/circuit_recording/circuit_recorder.ts +2 -2
- package/src/public/fixtures/public_tx_simulation_tester.ts +28 -5
- package/src/public/fixtures/utils.ts +2 -1
- package/src/public/hinting_db_sources.ts +8 -6
- package/src/public/public_db_sources.ts +11 -13
- package/src/public/public_processor/guarded_merkle_tree.ts +5 -5
- package/src/public/public_processor/public_processor.ts +68 -55
- package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +2 -1
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +2 -3
- package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +2 -2
- package/src/public/public_tx_simulator/factories.ts +2 -1
- package/src/public/public_tx_simulator/public_tx_simulator.ts +5 -5
|
@@ -383,6 +383,7 @@ import { computeFeePayerBalanceLeafSlot, computeFeePayerBalanceStorageSlot } fro
|
|
|
383
383
|
import { AvmCircuitInputs, AvmExecutionHints, PublicDataWrite } from '@aztec/stdlib/avm';
|
|
384
384
|
import { computeTransactionFee } from '@aztec/stdlib/fees';
|
|
385
385
|
import { Gas } from '@aztec/stdlib/gas';
|
|
386
|
+
import { NullDebugLogStore } from '@aztec/stdlib/logs';
|
|
386
387
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
387
388
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
388
389
|
import { NestedProcessReturnValues, makeProcessedTxFromPrivateOnlyTx, makeProcessedTxFromTxWithPublicCalls } from '@aztec/stdlib/tx';
|
|
@@ -446,6 +447,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
446
447
|
dateProvider;
|
|
447
448
|
log;
|
|
448
449
|
opts;
|
|
450
|
+
debugLogStore;
|
|
449
451
|
static{
|
|
450
452
|
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
451
453
|
[
|
|
@@ -466,7 +468,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
466
468
|
], []));
|
|
467
469
|
}
|
|
468
470
|
metrics;
|
|
469
|
-
constructor(globalVariables, guardedMerkleTree, contractsDB, publicTxSimulator, dateProvider, telemetryClient = getTelemetryClient(), log, opts = {}){
|
|
471
|
+
constructor(globalVariables, guardedMerkleTree, contractsDB, publicTxSimulator, dateProvider, telemetryClient = getTelemetryClient(), log, opts = {}, debugLogStore = new NullDebugLogStore()){
|
|
470
472
|
this.globalVariables = globalVariables;
|
|
471
473
|
this.guardedMerkleTree = guardedMerkleTree;
|
|
472
474
|
this.contractsDB = contractsDB;
|
|
@@ -474,6 +476,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
474
476
|
this.dateProvider = dateProvider;
|
|
475
477
|
this.log = log;
|
|
476
478
|
this.opts = opts;
|
|
479
|
+
this.debugLogStore = debugLogStore;
|
|
477
480
|
_initProto(this);
|
|
478
481
|
this.metrics = new PublicProcessorMetrics(telemetryClient, 'PublicProcessor');
|
|
479
482
|
}
|
|
@@ -487,11 +490,12 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
487
490
|
* @param validator - Pre-process validator and nullifier cache to use for processing the txs.
|
|
488
491
|
* @returns The list of processed txs with their circuit simulation outputs.
|
|
489
492
|
*/ async process(txs, limits = {}, validator = {}) {
|
|
490
|
-
const { maxTransactions,
|
|
493
|
+
const { maxTransactions, deadline, maxBlockGas, maxBlobFields, isBuildingProposal } = limits;
|
|
491
494
|
const { preprocessValidator, nullifierCache } = validator;
|
|
492
495
|
const result = [];
|
|
493
496
|
const usedTxs = [];
|
|
494
497
|
const failed = [];
|
|
498
|
+
const debugLogs = [];
|
|
495
499
|
const timer = new Timer();
|
|
496
500
|
let totalSizeInBytes = 0;
|
|
497
501
|
let returns = [];
|
|
@@ -509,21 +513,23 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
509
513
|
this.log.warn(`Stopping tx processing due to timeout.`);
|
|
510
514
|
break;
|
|
511
515
|
}
|
|
512
|
-
// Skip this tx if it'd exceed max block size
|
|
513
516
|
const txHash = tx.getTxHash().toString();
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
+
// Skip this tx if its estimated blob fields would exceed the limit.
|
|
518
|
+
// Only done during proposal building: during re-execution we must process the exact txs from the proposal.
|
|
519
|
+
const txBlobFields = tx.getPrivateTxEffectsSizeInFields();
|
|
520
|
+
if (isBuildingProposal && maxBlobFields !== undefined && totalBlobFields + txBlobFields > maxBlobFields) {
|
|
521
|
+
this.log.warn(`Skipping tx ${txHash} with ${txBlobFields} fields from private side effects due to blob fields limit`, {
|
|
517
522
|
txHash,
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
523
|
+
txBlobFields,
|
|
524
|
+
totalBlobFields,
|
|
525
|
+
maxBlobFields
|
|
521
526
|
});
|
|
522
527
|
continue;
|
|
523
528
|
}
|
|
524
|
-
// Skip this tx if its gas limit would exceed the block gas limit
|
|
529
|
+
// Skip this tx if its gas limit would exceed the block gas limit (either da or l2).
|
|
530
|
+
// Only done during proposal building: during re-execution we must process the exact txs from the proposal.
|
|
525
531
|
const txGasLimit = tx.data.constants.txContext.gasSettings.gasLimits;
|
|
526
|
-
if (maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
532
|
+
if (isBuildingProposal && maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
527
533
|
this.log.warn(`Skipping processing of tx ${txHash} due to block gas limit`, {
|
|
528
534
|
txHash,
|
|
529
535
|
txGasLimit,
|
|
@@ -563,28 +569,15 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
563
569
|
const startStateReference = await this.guardedMerkleTree.getUnderlyingFork().getStateReference();
|
|
564
570
|
this.contractsDB.createCheckpoint();
|
|
565
571
|
try {
|
|
566
|
-
const [processedTx, returnValues] = await this.processTx(tx, deadline);
|
|
572
|
+
const [processedTx, returnValues, txDebugLogs] = await this.processTx(tx, deadline);
|
|
567
573
|
// Inject a fake processing failure after N txs if requested
|
|
568
574
|
const fakeThrowAfter = this.opts.fakeThrowAfterProcessingTxCount;
|
|
569
575
|
if (fakeThrowAfter !== undefined && result.length + failed.length + 1 >= fakeThrowAfter) {
|
|
570
576
|
throw new Error(`Fake error after processing ${fakeThrowAfter} txs`);
|
|
571
577
|
}
|
|
572
578
|
const txBlobFields = processedTx.txEffect.getNumBlobFields();
|
|
573
|
-
// If the actual size of this tx would exceed block size, skip it
|
|
574
579
|
const txSize = txBlobFields * Fr.SIZE_IN_BYTES;
|
|
575
|
-
|
|
576
|
-
this.log.debug(`Skipping processed tx ${txHash} sized ${txSize} due to max block size.`, {
|
|
577
|
-
txHash,
|
|
578
|
-
sizeInBytes: txSize,
|
|
579
|
-
totalSizeInBytes,
|
|
580
|
-
maxBlockSize
|
|
581
|
-
});
|
|
582
|
-
// Need to revert the checkpoint here and don't go any further
|
|
583
|
-
await checkpoint.revert();
|
|
584
|
-
this.contractsDB.revertCheckpoint();
|
|
585
|
-
continue;
|
|
586
|
-
}
|
|
587
|
-
// If the actual blob fields of this tx would exceed the limit, skip it
|
|
580
|
+
// If the actual blob fields of this tx would exceed the limit, skip it.
|
|
588
581
|
// Note: maxBlobFields already accounts for block end blob fields and previous blocks in checkpoint.
|
|
589
582
|
if (maxBlobFields !== undefined && totalBlobFields + txBlobFields > maxBlobFields) {
|
|
590
583
|
this.log.debug(`Skipping processed tx ${txHash} with ${txBlobFields} blob fields due to max blob fields limit.`, {
|
|
@@ -598,16 +591,34 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
598
591
|
this.contractsDB.revertCheckpoint();
|
|
599
592
|
continue;
|
|
600
593
|
}
|
|
594
|
+
// During re-execution, check if the actual gas used by this tx would push the block over the gas limit.
|
|
595
|
+
// Unlike the proposal-building check (which uses declared gas limits pessimistically before processing),
|
|
596
|
+
// this uses actual gas and stops processing when the limit is exceeded.
|
|
597
|
+
if (!isBuildingProposal && maxBlockGas !== undefined && totalBlockGas.add(processedTx.gasUsed.totalGas).gtAny(maxBlockGas)) {
|
|
598
|
+
this.log.warn(`Stopping re-execution since tx ${txHash} would push block gas over limit`, {
|
|
599
|
+
txHash,
|
|
600
|
+
txGas: processedTx.gasUsed.totalGas,
|
|
601
|
+
totalBlockGas,
|
|
602
|
+
maxBlockGas
|
|
603
|
+
});
|
|
604
|
+
await checkpoint.revert();
|
|
605
|
+
this.contractsDB.revertCheckpoint();
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
601
608
|
// FIXME(fcarreiro): it's ugly to have to notify the validator of nullifiers.
|
|
602
609
|
// I'd rather pass the validators the processedTx as well and let them deal with it.
|
|
603
610
|
nullifierCache?.addNullifiers(processedTx.txEffect.nullifiers.map((n)=>n.toBuffer()));
|
|
604
611
|
result.push(processedTx);
|
|
605
612
|
usedTxs.push(tx);
|
|
606
613
|
returns = returns.concat(returnValues);
|
|
614
|
+
debugLogs.push(...txDebugLogs);
|
|
615
|
+
this.debugLogStore.storeLogs(processedTx.hash.toString(), txDebugLogs);
|
|
607
616
|
totalPublicGas = totalPublicGas.add(processedTx.gasUsed.publicGas);
|
|
608
617
|
totalBlockGas = totalBlockGas.add(processedTx.gasUsed.totalGas);
|
|
609
618
|
totalSizeInBytes += txSize;
|
|
610
619
|
totalBlobFields += txBlobFields;
|
|
620
|
+
// Commit the tx-level contracts checkpoint on success
|
|
621
|
+
this.contractsDB.commitCheckpoint();
|
|
611
622
|
} catch (err) {
|
|
612
623
|
if (err?.name === 'PublicProcessorTimeoutError') {
|
|
613
624
|
this.log.warn(`Stopping tx processing due to timeout.`);
|
|
@@ -624,22 +635,19 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
624
635
|
// We now know there can't be any further access to world state. The fork is in a state where there is:
|
|
625
636
|
// 1. At least one outstanding checkpoint that has not been committed (the one created before we processed the tx).
|
|
626
637
|
// 2. Possible state updates on that checkpoint or any others created during execution.
|
|
627
|
-
//
|
|
628
|
-
//
|
|
629
|
-
//
|
|
630
|
-
await checkpoint.
|
|
631
|
-
// Now we want to revert any/all remaining checkpoints, destroying any outstanding state updates.
|
|
632
|
-
// This needs to be done directly on the underlying fork as the guarded fork has been stopped.
|
|
633
|
-
await this.guardedMerkleTree.getUnderlyingFork().revertAllCheckpoints();
|
|
638
|
+
// Revert all checkpoints at or above this checkpoint's depth (inclusive), destroying any outstanding state
|
|
639
|
+
// updates from this tx and any nested checkpoints created during execution. This preserves any checkpoints
|
|
640
|
+
// created by callers below our depth.
|
|
641
|
+
await checkpoint.revertToCheckpoint();
|
|
634
642
|
// Revert any contracts added to the DB for the tx.
|
|
635
643
|
this.contractsDB.revertCheckpoint();
|
|
636
644
|
// Ensure we're at the same state as when we started processing this tx.
|
|
637
645
|
await this.checkWorldStateUnchanged(startStateReference, txHash, err);
|
|
638
646
|
break;
|
|
639
647
|
}
|
|
640
|
-
// Roll back state to start of TX before proceeding to next TX
|
|
641
|
-
|
|
642
|
-
await
|
|
648
|
+
// Roll back state to start of TX before proceeding to next TX.
|
|
649
|
+
// Reverts all checkpoints at or above this checkpoint's depth, preserving any caller checkpoints below.
|
|
650
|
+
await checkpoint.revertToCheckpoint();
|
|
643
651
|
this.contractsDB.revertCheckpoint();
|
|
644
652
|
const errorMessage = err instanceof Error || err instanceof AssertionError ? err.message : 'Unknown error';
|
|
645
653
|
this.log.warn(`Failed to process tx ${txHash.toString()}: ${errorMessage} ${err?.stack}`);
|
|
@@ -653,7 +661,6 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
653
661
|
} finally{
|
|
654
662
|
// Base case is we always commit the checkpoint. Using the ForkCheckpoint means this has no effect if the tx was previously reverted
|
|
655
663
|
await checkpoint.commit();
|
|
656
|
-
this.contractsDB.commitCheckpointOkIfNone();
|
|
657
664
|
}
|
|
658
665
|
}
|
|
659
666
|
const duration = timer.s();
|
|
@@ -671,7 +678,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
671
678
|
failed,
|
|
672
679
|
usedTxs,
|
|
673
680
|
returns,
|
|
674
|
-
|
|
681
|
+
debugLogs
|
|
675
682
|
];
|
|
676
683
|
}
|
|
677
684
|
async checkWorldStateUnchanged(startStateReference, txHash, cause) {
|
|
@@ -688,7 +695,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
688
695
|
}
|
|
689
696
|
}
|
|
690
697
|
async processTx(tx, deadline) {
|
|
691
|
-
const [time, [processedTx, returnValues]] = await elapsed(()=>this.processTxWithinDeadline(tx, deadline));
|
|
698
|
+
const [time, [processedTx, returnValues, debugLogs]] = await elapsed(()=>this.processTxWithinDeadline(tx, deadline));
|
|
692
699
|
this.log.verbose(!tx.hasPublicCalls() ? `Processed tx ${processedTx.hash} with no public calls in ${time}ms` : `Processed tx ${processedTx.hash} with ${tx.numberOfPublicCalls()} public calls in ${time}ms`, {
|
|
693
700
|
txHash: processedTx.hash,
|
|
694
701
|
txFee: processedTx.txEffect.transactionFee.toBigInt(),
|
|
@@ -706,7 +713,8 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
706
713
|
});
|
|
707
714
|
return [
|
|
708
715
|
processedTx,
|
|
709
|
-
returnValues ?? []
|
|
716
|
+
returnValues ?? [],
|
|
717
|
+
debugLogs
|
|
710
718
|
];
|
|
711
719
|
}
|
|
712
720
|
async doTreeInsertionsForPrivateOnlyTx(processedTx) {
|
|
@@ -780,10 +788,11 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
780
788
|
this.metrics.recordClassPublication(...tx.getContractClassLogs().filter((log)=>ContractClassPublishedEvent.isContractClassPublishedEvent(log)).map((log)=>ContractClassPublishedEvent.fromLog(log)));
|
|
781
789
|
// Fee payment insertion has already been done. Do the rest.
|
|
782
790
|
await this.doTreeInsertionsForPrivateOnlyTx(processedTx);
|
|
783
|
-
|
|
791
|
+
this.contractsDB.addNewContracts(tx);
|
|
784
792
|
return [
|
|
785
793
|
processedTx,
|
|
786
|
-
undefined
|
|
794
|
+
undefined,
|
|
795
|
+
[]
|
|
787
796
|
];
|
|
788
797
|
}
|
|
789
798
|
async processTxWithPublicCalls(tx) {
|
|
@@ -805,7 +814,8 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
805
814
|
const processedTx = makeProcessedTxFromTxWithPublicCalls(tx, this.globalVariables, avmProvingRequest, publicTxEffect, gasUsed, revertCode, revertReason);
|
|
806
815
|
return [
|
|
807
816
|
processedTx,
|
|
808
|
-
appLogicReturnValues
|
|
817
|
+
appLogicReturnValues,
|
|
818
|
+
result.logs ?? []
|
|
809
819
|
];
|
|
810
820
|
}
|
|
811
821
|
/**
|
|
@@ -16,4 +16,4 @@ export declare class ContractProviderForCpp implements ContractProvider {
|
|
|
16
16
|
commitCheckpoint: () => Promise<void>;
|
|
17
17
|
revertCheckpoint: () => Promise<void>;
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfcHJvdmlkZXJfZm9yX2NwcC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3B1YmxpYy9wdWJsaWNfdHhfc2ltdWxhdG9yL2NvbnRyYWN0X3Byb3ZpZGVyX2Zvcl9jcHAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFlLEtBQUssY0FBYyxFQUFnQixNQUFNLHVCQUF1QixDQUFDO0FBQ3ZGLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sZUFBZSxDQUFDO0FBS3RELE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRXhELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFakUscUJBQWEsc0JBQXVCLFlBQVcsZ0JBQWdCO0lBSTNELE9BQU8sQ0FBQyxXQUFXO0lBQ25CLE9BQU8sQ0FBQyxlQUFlO0lBSnpCLE9BQU8sQ0FBQyxHQUFHLENBQVM7SUFFcEIsWUFDVSxXQUFXLEVBQUUsaUJBQWlCLEVBQzlCLGVBQWUsRUFBRSxlQUFlLEVBQ3hDLFFBQVEsQ0FBQyxFQUFFLGNBQWMsRUFHMUI7SUFFTSxtQkFBbUIsb0VBYXhCO0lBRUssZ0JBQWdCLG9FQWVyQjtJQUdLLFlBQVksMkVBV2pCO0lBRUsscUJBQXFCLG9FQWdCMUI7SUFFSyxvQkFBb0IscUVBc0J6QjtJQUVLLGdCQUFnQixzQkFHckI7SUFFSyxnQkFBZ0Isc0JBR3JCO0lBRUssZ0JBQWdCLHNCQUdyQjtDQUNIIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_provider_for_cpp.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/contract_provider_for_cpp.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AACvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,qBAAa,sBAAuB,YAAW,gBAAgB;IAI3D,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,eAAe;IAJzB,OAAO,CAAC,GAAG,CAAS;IAEpB,YACU,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EACxC,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAEM,mBAAmB,oEAaxB;IAEK,gBAAgB,oEAerB;
|
|
1
|
+
{"version":3,"file":"contract_provider_for_cpp.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/contract_provider_for_cpp.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AACvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,qBAAa,sBAAuB,YAAW,gBAAgB;IAI3D,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,eAAe;IAJzB,OAAO,CAAC,GAAG,CAAS;IAEpB,YACU,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EACxC,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAEM,mBAAmB,oEAaxB;IAEK,gBAAgB,oEAerB;IAGK,YAAY,2EAWjB;IAEK,qBAAqB,oEAgB1B;IAEK,oBAAoB,qEAsBzB;IAEK,gBAAgB,sBAGrB;IAEK,gBAAgB,sBAGrB;IAEK,gBAAgB,sBAGrB;CACH"}
|
|
@@ -40,7 +40,7 @@ export class ContractProviderForCpp {
|
|
|
40
40
|
const contractDeploymentData = ContractDeploymentData.fromPlainObject(rawData);
|
|
41
41
|
// Add contracts to the contracts DB
|
|
42
42
|
this.log.trace(`Calling contractsDB.addContracts`);
|
|
43
|
-
|
|
43
|
+
this.contractsDB.addContracts(contractDeploymentData);
|
|
44
44
|
};
|
|
45
45
|
this.getBytecodeCommitment = async (classId)=>{
|
|
46
46
|
this.log.trace(`Contract provider callback: getBytecodeCommitment(${classId})`);
|
|
@@ -89,6 +89,7 @@ export class ContractProviderForCpp {
|
|
|
89
89
|
}
|
|
90
90
|
getContractInstance;
|
|
91
91
|
getContractClass;
|
|
92
|
+
// eslint-disable-next-line require-await
|
|
92
93
|
addContracts;
|
|
93
94
|
getBytecodeCommitment;
|
|
94
95
|
getDebugFunctionName;
|
|
@@ -50,4 +50,4 @@ export declare class TelemetryCppPublicTxSimulator extends MeasuredCppPublicTxSi
|
|
|
50
50
|
readonly tracer: Tracer;
|
|
51
51
|
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, telemetryClient?: TelemetryClient, config?: Partial<PublicSimulatorConfig>, bindings?: LoggerBindings);
|
|
52
52
|
}
|
|
53
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3BwX3B1YmxpY190eF9zaW11bGF0b3IuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaWMvcHVibGljX3R4X3NpbXVsYXRvci9jcHBfcHVibGljX3R4X3NpbXVsYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQUUsS0FBSyxjQUFjLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFJdkYsT0FBTyxFQUdMLEtBQUsscUJBQXFCLEVBQzFCLGNBQWMsRUFFZixNQUFNLG1CQUFtQixDQUFDO0FBRTNCLE9BQU8sS0FBSyxFQUFFLHlCQUF5QixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDckUsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLEVBQUUsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRTVELE9BQU8sRUFBRSxLQUFLLGVBQWUsRUFBRSxLQUFLLE1BQU0sRUFBc0IsTUFBTSx5QkFBeUIsQ0FBQztBQUtoRyxPQUFPLEtBQUssRUFBRSx3QkFBd0IsRUFBRSxNQUFNLGtDQUFrQyxDQUFDO0FBQ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kFBaUIsRUFDOUIsZUFBZSxFQUFFLGVBQWUsRUFDYixPQUFPLEVBQUUsd0JBQXdCLEVBQ3BELE1BQU0sQ0FBQyxFQUFFLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBQyxFQUN2QyxRQUFRLENBQUMsRUFBRSxjQUFjLEVBRzFCO0lBRXFCLFFBQVEsQ0FBQyxFQUFFLEVBQUUsRUFBRSxFQUFFLE9BQU8sR0FBRSxNQUFzQixHQUFHLE9BQU8sQ0FBQyxjQUFjLENBQUMsQ0FTL0Y7Q0FDRjtBQUVEOztHQUVHO0FBQ0gscUJBQWEsNkJBQThCLFNBQVEsNEJBQTRCO0lBRTdFLFNBQWdCLE1BQU0sRUFBRSxNQUFNLENBQUM7SUFFL0IsWUFDRSxVQUFVLEVBQUUseUJBQXlCLEVBQ3JDLFdBQVcsRUFBRSxpQkFBaUIsRUFDOUIsZUFBZSxFQUFFLGVBQWUsRUFDaEMsZUFBZSxHQUFFLGVBQXNDLEVBQ3ZELE1BQU0sQ0FBQyxFQUFFLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBQyxFQUN2QyxRQUFRLENBQUMsRUFBRSxjQUFjLEVBSzFCO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cpp_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/cpp_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"cpp_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/cpp_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAIvF,OAAO,EAGL,KAAK,qBAAqB,EAC1B,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,yBAAyB,EAA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OAAO,CAAC,qBAAqB,CAAC,EACvC,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAEqB,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,cAAc,CAAC,CAS/F;CACF;AAED;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,4BAA4B;IAE7E,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,YACE,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,eAAe,GAAE,eAAsC,EACvD,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EACvC,QAAQ,CAAC,EAAE,cAAc,EAK1B;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createLogger
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { sleep } from '@aztec/foundation/sleep';
|
|
3
3
|
import { avmSimulate, cancelSimulation, createCancellationToken } from '@aztec/native';
|
|
4
4
|
import { ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
@@ -51,8 +51,7 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
|
51
51
|
this.cancellationToken = createCancellationToken();
|
|
52
52
|
// Store the promise so cancel() can wait for it
|
|
53
53
|
this.log.debug(`Calling C++ simulator for tx ${txHash}`);
|
|
54
|
-
this.simulationPromise = avmSimulate(inputBuffer, contractProvider, wsCppHandle,
|
|
55
|
-
undefined, this.cancellationToken);
|
|
54
|
+
this.simulationPromise = avmSimulate(inputBuffer, contractProvider, wsCppHandle, this.log.level, undefined, this.cancellationToken);
|
|
56
55
|
let resultBuffer;
|
|
57
56
|
try {
|
|
58
57
|
resultBuffer = await this.simulationPromise;
|
|
@@ -39,4 +39,4 @@ export declare class MeasuredCppPublicTxSimulatorHintedDbs extends CppPublicTxSi
|
|
|
39
39
|
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, metrics: ExecutorMetricsInterface, config?: Partial<PublicSimulatorConfig>, bindings?: LoggerBindings);
|
|
40
40
|
simulate(tx: Tx, txLabel?: string): Promise<PublicTxResult>;
|
|
41
41
|
}
|
|
42
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
42
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3BwX3B1YmxpY190eF9zaW11bGF0b3Jfd2l0aF9oaW50ZWRfZGJzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGljL3B1YmxpY190eF9zaW11bGF0b3IvY3BwX3B1YmxpY190eF9zaW11bGF0b3Jfd2l0aF9oaW50ZWRfZGJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBRSxLQUFLLGNBQWMsRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUV2RixPQUFPLEVBRUwsS0FBSyxxQkFBcUIsRUFDMUIsY0FBYyxFQUVmLE1BQU0sbUJBQW1CLENBQUM7QUFFM0IsT0FBTyxLQUFLLEVBQUUseUJBQXlCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRSxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsRUFBRSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFJNUQsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUNqRixPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ2pFLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUNWLGtDQUFrQyxFQUNsQywwQkFBMEIsRUFDM0IsTUFBTSxvQ0FBb0MsQ0FBQztBQUU1Qzs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ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"cpp_public_tx_simulator_with_hinted_dbs.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAEvF,OAAO,EAEL,KAAK,qBAAqB,EAC1B,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAI5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACV,kCAAkC,EAClC,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,6BAA8B,SAAQ,iBAAkB,YAAW,0BAA0B;IACxG,UAAmB,GAAG,EAAE,MAAM,CAAC;IAE/B,YACE,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EACvC,QAAQ,CAAC,EAAE,cAAc,EAI1B;IAED;;;;;;;;;OASG;IACmB,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CA8C9D;CACF;AAED;;;;;;GAMG;AACH,qBAAa,qCACX,SAAQ,6BACR,YAAW,kCAAkC;IAM3C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,wBAAwB;IAJtD,YACE,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EACb,OAAO,EAAE,wBAAwB,EACpD,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EACvC,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAEqB,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,cAAc,CAAC,CAS/F;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createLogger
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { avmSimulateWithHintedDbs } from '@aztec/native';
|
|
3
3
|
import { AvmCircuitInputs, PublicTxResult, deserializeFromMessagePack } from '@aztec/stdlib/avm';
|
|
4
4
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
@@ -43,7 +43,7 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
|
43
43
|
const inputBuffer = avmCircuitInputs.serializeWithMessagePack();
|
|
44
44
|
let resultBuffer;
|
|
45
45
|
try {
|
|
46
|
-
resultBuffer = await avmSimulateWithHintedDbs(inputBuffer,
|
|
46
|
+
resultBuffer = await avmSimulateWithHintedDbs(inputBuffer, this.log.level);
|
|
47
47
|
} catch (error) {
|
|
48
48
|
throw new SimulationError(`C++ hinted simulation failed: ${error.message}`, []);
|
|
49
49
|
}
|
|
@@ -10,5 +10,5 @@ import { DumpingCppPublicTxSimulator } from './dumping_cpp_public_tx_simulator.j
|
|
|
10
10
|
* Uses DumpingCppPublicTxSimulator if DUMP_AVM_INPUTS_TO_DIR env var is set (for CI/testing avm circuit),
|
|
11
11
|
* otherwise uses TelemetryCppPublicTxSimulator (for production).
|
|
12
12
|
*/
|
|
13
|
-
export declare function createPublicTxSimulatorForBlockBuilding(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, telemetryClient: TelemetryClient, bindings?: LoggerBindings): DumpingCppPublicTxSimulator | TelemetryCppPublicTxSimulator;
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
13
|
+
export declare function createPublicTxSimulatorForBlockBuilding(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, telemetryClient: TelemetryClient, bindings?: LoggerBindings, collectDebugLogs?: boolean): DumpingCppPublicTxSimulator | TelemetryCppPublicTxSimulator;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yaWVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGljL3B1YmxpY190eF9zaW11bGF0b3IvZmFjdG9yaWVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRTVELE9BQU8sS0FBSyxFQUFFLHlCQUF5QixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDckUsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDeEQsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFL0QsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUNqRSxPQUFPLEVBQUUsNkJBQTZCLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUM3RSxPQUFPLEVBQUUsMkJBQTJCLEVBQUUsTUFBTSxzQ0FBc0MsQ0FBQztBQUVuRjs7OztHQUlHO0FBQ0gsd0JBQWdCLHVDQUF1QyxDQUNyRCxVQUFVLEVBQUUseUJBQXlCLEVBQ3JDLFdBQVcsRUFBRSxpQkFBaUIsRUFDOUIsZUFBZSxFQUFFLGVBQWUsRUFDaEMsZUFBZSxFQUFFLGVBQWUsRUFDaEMsUUFBUSxDQUFDLEVBQUUsY0FBYyxFQUN6QixnQkFBZ0IsVUFBUSwrREFzQnpCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAEnF;;;;GAIG;AACH,wBAAgB,uCAAuC,CACrD,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,EAChC,QAAQ,CAAC,EAAE,cAAc,+
|
|
1
|
+
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAEnF;;;;GAIG;AACH,wBAAgB,uCAAuC,CACrD,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,EAChC,QAAQ,CAAC,EAAE,cAAc,EACzB,gBAAgB,UAAQ,+DAsBzB"}
|
|
@@ -5,10 +5,10 @@ import { DumpingCppPublicTxSimulator } from './dumping_cpp_public_tx_simulator.j
|
|
|
5
5
|
* Creates a public tx simulator for block building.
|
|
6
6
|
* Uses DumpingCppPublicTxSimulator if DUMP_AVM_INPUTS_TO_DIR env var is set (for CI/testing avm circuit),
|
|
7
7
|
* otherwise uses TelemetryCppPublicTxSimulator (for production).
|
|
8
|
-
*/ export function createPublicTxSimulatorForBlockBuilding(merkleTree, contractsDB, globalVariables, telemetryClient, bindings) {
|
|
8
|
+
*/ export function createPublicTxSimulatorForBlockBuilding(merkleTree, contractsDB, globalVariables, telemetryClient, bindings, collectDebugLogs = false) {
|
|
9
9
|
const config = PublicSimulatorConfig.from({
|
|
10
10
|
skipFeeEnforcement: false,
|
|
11
|
-
collectDebugLogs
|
|
11
|
+
collectDebugLogs,
|
|
12
12
|
collectHints: false,
|
|
13
13
|
collectPublicInputs: false,
|
|
14
14
|
collectStatistics: false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MAX_PROCESSABLE_L2_GAS } from '@aztec/constants';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { ProtocolContractAddress, ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
4
4
|
import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
@@ -137,7 +137,7 @@ export class PublicTxSimulator {
|
|
|
137
137
|
}
|
|
138
138
|
context.halt();
|
|
139
139
|
// Such transactions should be filtered by GasTxValidator.
|
|
140
|
-
assert(context.getActualGasUsed().l2Gas <=
|
|
140
|
+
assert(context.getActualGasUsed().l2Gas <= MAX_PROCESSABLE_L2_GAS, `Transaction consumes ${context.getActualGasUsed().l2Gas} L2 gas, which exceeds the maximum processable gas of ${MAX_PROCESSABLE_L2_GAS}`);
|
|
141
141
|
await this.payFee(context);
|
|
142
142
|
const publicInputs = await context.generateAvmCircuitPublicInputs();
|
|
143
143
|
const revertCode = context.getFinalRevertCode();
|
|
@@ -255,7 +255,7 @@ export class PublicTxSimulator {
|
|
|
255
255
|
// However, things work as expected because later calls to getters on the hintingContractsDB
|
|
256
256
|
// will pick up the new contracts and will generate the necessary hints.
|
|
257
257
|
// So, a consumer of the hints will always see the new contracts.
|
|
258
|
-
|
|
258
|
+
this.contractsDB.addContracts(context.nonRevertibleContractDeploymentData);
|
|
259
259
|
}
|
|
260
260
|
/**
|
|
261
261
|
* Insert the revertible accumulated data from private into the public state.
|
|
@@ -316,7 +316,7 @@ export class PublicTxSimulator {
|
|
|
316
316
|
// However, things work as expected because later calls to getters on the hintingContractsDB
|
|
317
317
|
// will pick up the new contracts and will generate the necessary hints.
|
|
318
318
|
// So, a consumer of the hints will always see the new contracts.
|
|
319
|
-
|
|
319
|
+
this.contractsDB.addContracts(context.revertibleContractDeploymentData);
|
|
320
320
|
}
|
|
321
321
|
async payFee(context) {
|
|
322
322
|
const txFee = context.getTransactionFee(TxExecutionPhase.TEARDOWN);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/simulator",
|
|
3
|
-
"version": "4.0.0-devnet.
|
|
3
|
+
"version": "4.0.0-devnet.3-patch.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/server.js",
|
|
@@ -64,26 +64,26 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@aztec/constants": "4.0.0-devnet.
|
|
68
|
-
"@aztec/foundation": "4.0.0-devnet.
|
|
69
|
-
"@aztec/native": "4.0.0-devnet.
|
|
70
|
-
"@aztec/noir-acvm_js": "4.0.0-devnet.
|
|
71
|
-
"@aztec/noir-noirc_abi": "4.0.0-devnet.
|
|
72
|
-
"@aztec/noir-protocol-circuits-types": "4.0.0-devnet.
|
|
73
|
-
"@aztec/noir-types": "4.0.0-devnet.
|
|
74
|
-
"@aztec/protocol-contracts": "4.0.0-devnet.
|
|
75
|
-
"@aztec/stdlib": "4.0.0-devnet.
|
|
76
|
-
"@aztec/telemetry-client": "4.0.0-devnet.
|
|
77
|
-
"@aztec/world-state": "4.0.0-devnet.
|
|
67
|
+
"@aztec/constants": "4.0.0-devnet.3-patch.0",
|
|
68
|
+
"@aztec/foundation": "4.0.0-devnet.3-patch.0",
|
|
69
|
+
"@aztec/native": "4.0.0-devnet.3-patch.0",
|
|
70
|
+
"@aztec/noir-acvm_js": "4.0.0-devnet.3-patch.0",
|
|
71
|
+
"@aztec/noir-noirc_abi": "4.0.0-devnet.3-patch.0",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "4.0.0-devnet.3-patch.0",
|
|
73
|
+
"@aztec/noir-types": "4.0.0-devnet.3-patch.0",
|
|
74
|
+
"@aztec/protocol-contracts": "4.0.0-devnet.3-patch.0",
|
|
75
|
+
"@aztec/stdlib": "4.0.0-devnet.3-patch.0",
|
|
76
|
+
"@aztec/telemetry-client": "4.0.0-devnet.3-patch.0",
|
|
77
|
+
"@aztec/world-state": "4.0.0-devnet.3-patch.0",
|
|
78
78
|
"lodash.clonedeep": "^4.5.0",
|
|
79
79
|
"lodash.merge": "^4.6.2",
|
|
80
80
|
"tslib": "^2.4.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@aztec/kv-store": "4.0.0-devnet.
|
|
84
|
-
"@aztec/merkle-tree": "4.0.0-devnet.
|
|
85
|
-
"@aztec/noir-contracts.js": "4.0.0-devnet.
|
|
86
|
-
"@aztec/noir-test-contracts.js": "4.0.0-devnet.
|
|
83
|
+
"@aztec/kv-store": "4.0.0-devnet.3-patch.0",
|
|
84
|
+
"@aztec/merkle-tree": "4.0.0-devnet.3-patch.0",
|
|
85
|
+
"@aztec/noir-contracts.js": "4.0.0-devnet.3-patch.0",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "4.0.0-devnet.3-patch.0",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/lodash.clonedeep": "^4.5.7",
|
|
@@ -161,11 +161,11 @@ export class CircuitRecorder {
|
|
|
161
161
|
throw new Error(`Oracle method ${name} not found when setting up recording callback`);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
const isExternalCall = (name as keyof ACIRCallback) === '
|
|
164
|
+
const isExternalCall = (name as keyof ACIRCallback) === 'aztec_prv_callPrivateFunction';
|
|
165
165
|
|
|
166
166
|
recordingCallback[name as keyof ACIRCallback] = (...args: ForeignCallInput[]): ReturnType<typeof fn> => {
|
|
167
167
|
const timer = new Timer();
|
|
168
|
-
// If we're entering another circuit via `
|
|
168
|
+
// If we're entering another circuit via `aztec_prv_callPrivateFunction`, we increase the stack depth and set the
|
|
169
169
|
// newCircuit variable to ensure we are creating a new recording object.
|
|
170
170
|
if (isExternalCall) {
|
|
171
171
|
this.stackDepth++;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_TEARDOWN_DA_GAS_LIMIT,
|
|
3
|
+
DEFAULT_TEARDOWN_L2_GAS_LIMIT,
|
|
4
|
+
PUBLIC_TX_L2_GAS_OVERHEAD,
|
|
5
|
+
TX_DA_GAS_OVERHEAD,
|
|
6
|
+
} from '@aztec/constants';
|
|
2
7
|
import { asyncMap } from '@aztec/foundation/async-map';
|
|
3
8
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
4
9
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -112,6 +117,7 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
112
117
|
feePayer: AztecAddress = sender,
|
|
113
118
|
/* need some unique first nullifier for note-nonce computations */
|
|
114
119
|
privateInsertions: TestPrivateInsertions = { nonRevertible: { nullifiers: [new Fr(420000 + this.txCount)] } },
|
|
120
|
+
gasLimits?: Gas,
|
|
115
121
|
): Promise<Tx> {
|
|
116
122
|
const setupCallRequests = await asyncMap(setupCalls, call =>
|
|
117
123
|
this.#createPubicCallRequestForCall(call, call.sender ?? sender),
|
|
@@ -131,9 +137,13 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
131
137
|
teardownCallRequest,
|
|
132
138
|
feePayer,
|
|
133
139
|
/*gasUsedByPrivate*/ teardownCall
|
|
134
|
-
? new Gas(
|
|
135
|
-
|
|
140
|
+
? new Gas(
|
|
141
|
+
DEFAULT_TEARDOWN_DA_GAS_LIMIT + TX_DA_GAS_OVERHEAD,
|
|
142
|
+
DEFAULT_TEARDOWN_L2_GAS_LIMIT + PUBLIC_TX_L2_GAS_OVERHEAD,
|
|
143
|
+
)
|
|
144
|
+
: new Gas(TX_DA_GAS_OVERHEAD, PUBLIC_TX_L2_GAS_OVERHEAD),
|
|
136
145
|
defaultGlobals(),
|
|
146
|
+
gasLimits,
|
|
137
147
|
);
|
|
138
148
|
}
|
|
139
149
|
|
|
@@ -146,8 +156,9 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
146
156
|
/* need some unique first nullifier for note-nonce computations */
|
|
147
157
|
privateInsertions?: TestPrivateInsertions,
|
|
148
158
|
txLabel: string = 'unlabeledTx',
|
|
159
|
+
gasLimits?: Gas,
|
|
149
160
|
): Promise<PublicTxResult> {
|
|
150
|
-
const tx = await this.createTx(sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions);
|
|
161
|
+
const tx = await this.createTx(sender, setupCalls, appCalls, teardownCall, feePayer, privateInsertions, gasLimits);
|
|
151
162
|
|
|
152
163
|
await this.setFeePayerBalance(feePayer);
|
|
153
164
|
|
|
@@ -190,8 +201,18 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
190
201
|
teardownCall?: TestEnqueuedCall,
|
|
191
202
|
feePayer?: AztecAddress,
|
|
192
203
|
privateInsertions?: TestPrivateInsertions,
|
|
204
|
+
gasLimits?: Gas,
|
|
193
205
|
): Promise<PublicTxResult> {
|
|
194
|
-
return await this.simulateTx(
|
|
206
|
+
return await this.simulateTx(
|
|
207
|
+
sender,
|
|
208
|
+
setupCalls,
|
|
209
|
+
appCalls,
|
|
210
|
+
teardownCall,
|
|
211
|
+
feePayer,
|
|
212
|
+
privateInsertions,
|
|
213
|
+
txLabel,
|
|
214
|
+
gasLimits,
|
|
215
|
+
);
|
|
195
216
|
}
|
|
196
217
|
|
|
197
218
|
/**
|
|
@@ -209,6 +230,7 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
209
230
|
teardownCall?: TestEnqueuedCall,
|
|
210
231
|
feePayer?: AztecAddress,
|
|
211
232
|
privateInsertions?: TestPrivateInsertions,
|
|
233
|
+
gasLimits?: Gas,
|
|
212
234
|
): Promise<PublicTxResult> {
|
|
213
235
|
return await this.simulateTxWithLabel(
|
|
214
236
|
txLabel,
|
|
@@ -218,6 +240,7 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
218
240
|
teardownCall,
|
|
219
241
|
feePayer,
|
|
220
242
|
privateInsertions,
|
|
243
|
+
gasLimits,
|
|
221
244
|
);
|
|
222
245
|
}
|
|
223
246
|
|
|
@@ -62,13 +62,14 @@ export async function createTxForPublicCalls(
|
|
|
62
62
|
feePayer = AztecAddress.zero(),
|
|
63
63
|
gasUsedByPrivate: Gas = Gas.empty(),
|
|
64
64
|
globals: GlobalVariables = GlobalVariables.empty(),
|
|
65
|
+
gasLimits?: Gas,
|
|
65
66
|
): Promise<Tx> {
|
|
66
67
|
assert(
|
|
67
68
|
setupCallRequests.length > 0 || appCallRequests.length > 0 || teardownCallRequest !== undefined,
|
|
68
69
|
"Can't create public tx with no enqueued calls",
|
|
69
70
|
);
|
|
70
71
|
// use max limits
|
|
71
|
-
|
|
72
|
+
gasLimits = gasLimits ?? new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
|
|
72
73
|
|
|
73
74
|
const forPublic = PartialPrivateTailPublicInputsForPublic.empty();
|
|
74
75
|
|
|
@@ -410,12 +410,12 @@ export class HintingMerkleWriteOperations implements MerkleTreeWriteOperations {
|
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
public async createCheckpoint(): Promise<
|
|
413
|
+
public async createCheckpoint(): Promise<number> {
|
|
414
414
|
const actionCounter = this.checkpointActionCounter++;
|
|
415
415
|
const oldCheckpointId = this.getCurrentCheckpointId();
|
|
416
416
|
const treesStateHash = await this.getTreesStateHash();
|
|
417
417
|
|
|
418
|
-
await this.db.createCheckpoint();
|
|
418
|
+
const depth = await this.db.createCheckpoint();
|
|
419
419
|
this.checkpointStack.push(this.nextCheckpointId++);
|
|
420
420
|
const newCheckpointId = this.getCurrentCheckpointId();
|
|
421
421
|
|
|
@@ -424,14 +424,16 @@ export class HintingMerkleWriteOperations implements MerkleTreeWriteOperations {
|
|
|
424
424
|
HintingMerkleWriteOperations.log.trace(
|
|
425
425
|
`[createCheckpoint:${actionCounter}] Checkpoint evolved ${oldCheckpointId} -> ${newCheckpointId} at trees state ${treesStateHash}.`,
|
|
426
426
|
);
|
|
427
|
+
|
|
428
|
+
return depth;
|
|
427
429
|
}
|
|
428
430
|
|
|
429
|
-
public
|
|
430
|
-
throw new Error('
|
|
431
|
+
public commitAllCheckpointsTo(_depth: number): Promise<void> {
|
|
432
|
+
throw new Error('commitAllCheckpointsTo is not supported in HintingMerkleWriteOperations.');
|
|
431
433
|
}
|
|
432
434
|
|
|
433
|
-
public
|
|
434
|
-
throw new Error('
|
|
435
|
+
public revertAllCheckpointsTo(_depth: number): Promise<void> {
|
|
436
|
+
throw new Error('revertAllCheckpointsTo is not supported in HintingMerkleWriteOperations.');
|
|
435
437
|
}
|
|
436
438
|
|
|
437
439
|
public async commitCheckpoint(): Promise<void> {
|