@aztec/simulator 0.0.1-commit.29c6b1a3 → 0.0.1-commit.2d9cb6034
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/README.md +4 -4
- package/dest/private/acvm/acvm.d.ts +4 -2
- package/dest/private/acvm/acvm.d.ts.map +1 -1
- package/dest/private/acvm/acvm.js +4 -3
- package/dest/private/acvm_native.d.ts +5 -3
- package/dest/private/acvm_native.d.ts.map +1 -1
- package/dest/private/acvm_native.js +8 -6
- package/dest/private/acvm_wasm.d.ts +4 -3
- package/dest/private/acvm_wasm.d.ts.map +1 -1
- package/dest/private/acvm_wasm.js +4 -4
- package/dest/private/circuit_recording/circuit_recorder.d.ts +4 -3
- package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/circuit_recorder.js +7 -5
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts +3 -2
- package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/file_circuit_recorder.js +2 -2
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts +7 -2
- package/dest/private/circuit_recording/memory_circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/memory_circuit_recorder.js +4 -4
- package/dest/private/factory.d.ts +3 -3
- package/dest/private/factory.d.ts.map +1 -1
- package/dest/private/factory.js +7 -4
- package/dest/public/avm/avm_gas.js +3 -3
- package/dest/public/avm/avm_simulator.js +1 -1
- package/dest/public/avm/calldata.d.ts +1 -1
- package/dest/public/avm/calldata.d.ts.map +1 -1
- package/dest/public/avm/calldata.js +3 -2
- package/dest/public/avm/fixtures/account_proof_fetcher.d.ts +2 -0
- package/dest/public/avm/fixtures/account_proof_fetcher.d.ts.map +1 -0
- package/dest/public/avm/fixtures/account_proof_fetcher.js +152 -0
- package/dest/public/avm/opcodes/accrued_substate.d.ts +2 -2
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
- package/dest/public/avm/opcodes/accrued_substate.js +3 -4
- package/dest/public/avm/serialization/bytecode_serialization.js +3 -3
- package/dest/public/avm/serialization/instruction_serialization.d.ts +2 -2
- package/dest/public/avm/serialization/instruction_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/instruction_serialization.js +1 -1
- package/dest/public/contracts_db_checkpoint.d.ts +2 -2
- package/dest/public/contracts_db_checkpoint.d.ts.map +1 -1
- package/dest/public/contracts_db_checkpoint.js +1 -1
- package/dest/public/executor_metrics.d.ts +1 -1
- package/dest/public/executor_metrics.d.ts.map +1 -1
- package/dest/public/executor_metrics.js +7 -2
- package/dest/public/fixtures/amm_test.js +2 -2
- package/dest/public/fixtures/opcode_spammer.d.ts +1 -1
- package/dest/public/fixtures/opcode_spammer.d.ts.map +1 -1
- package/dest/public/fixtures/opcode_spammer.js +6 -6
- 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 +36 -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 +6 -6
- package/dest/public/hinting_db_sources.d.ts +5 -5
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/hinting_db_sources.js +7 -6
- package/dest/public/public_db_sources.d.ts +6 -5
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +14 -14
- package/dest/public/public_processor/guarded_merkle_tree.d.ts +5 -5
- package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
- package/dest/public/public_processor/guarded_merkle_tree.js +5 -5
- package/dest/public/public_processor/public_processor.d.ts +8 -4
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +60 -47
- package/dest/public/public_processor/public_processor_metrics.d.ts +2 -2
- package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor_metrics.js +20 -4
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +3 -2
- 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 +4 -3
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +5 -5
- 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 +10 -11
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +4 -4
- 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 +7 -7
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +4 -4
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +6 -6
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts +3 -2
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.js +2 -2
- package/dest/public/public_tx_simulator/factories.d.ts +3 -2
- package/dest/public/public_tx_simulator/factories.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/factories.js +4 -4
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +10 -5
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +14 -10
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +4 -3
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +9 -7
- package/dest/public/side_effect_trace.d.ts +4 -4
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +3 -3
- package/dest/public/state_manager/state_manager.d.ts +4 -4
- package/dest/public/state_manager/state_manager.d.ts.map +1 -1
- package/dest/public/state_manager/state_manager.js +5 -5
- package/dest/public/test_executor_metrics.d.ts +8 -2
- package/dest/public/test_executor_metrics.d.ts.map +1 -1
- package/dest/public/test_executor_metrics.js +24 -2
- package/package.json +15 -16
- package/src/private/acvm/acvm.ts +4 -3
- package/src/private/acvm_native.ts +11 -5
- package/src/private/acvm_wasm.ts +7 -3
- package/src/private/circuit_recording/circuit_recorder.ts +7 -5
- package/src/private/circuit_recording/file_circuit_recorder.ts +7 -2
- package/src/private/circuit_recording/memory_circuit_recorder.ts +6 -4
- package/src/private/factory.ts +7 -4
- package/src/public/avm/avm_gas.ts +2 -2
- package/src/public/avm/avm_simulator.ts +1 -1
- package/src/public/avm/calldata.ts +3 -2
- package/src/public/avm/fixtures/account_proof.json +553 -0
- package/src/public/avm/fixtures/account_proof_fetcher.ts +166 -0
- package/src/public/avm/opcodes/accrued_substate.ts +3 -4
- package/src/public/avm/opcodes/external_calls.ts +1 -1
- package/src/public/avm/serialization/bytecode_serialization.ts +2 -2
- package/src/public/avm/serialization/instruction_serialization.ts +1 -1
- package/src/public/contracts_db_checkpoint.ts +1 -1
- package/src/public/executor_metrics.ts +4 -1
- package/src/public/fixtures/amm_test.ts +2 -2
- package/src/public/fixtures/opcode_spammer.ts +6 -10
- package/src/public/fixtures/public_tx_simulation_tester.ts +51 -5
- package/src/public/fixtures/utils.ts +6 -5
- package/src/public/fuzzing/avm_fuzzer_simulator.ts +1 -1
- package/src/public/hinting_db_sources.ts +9 -7
- package/src/public/public_db_sources.ts +27 -19
- package/src/public/public_processor/guarded_merkle_tree.ts +6 -6
- package/src/public/public_processor/public_processor.ts +86 -60
- package/src/public/public_processor/public_processor_metrics.ts +10 -4
- package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +8 -4
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +10 -8
- package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +7 -5
- package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +7 -5
- package/src/public/public_tx_simulator/dumping_cpp_public_tx_simulator.ts +3 -1
- package/src/public/public_tx_simulator/factories.ts +6 -3
- package/src/public/public_tx_simulator/public_tx_context.ts +19 -8
- package/src/public/public_tx_simulator/public_tx_simulator.ts +11 -7
- package/src/public/side_effect_trace.ts +5 -2
- package/src/public/state_manager/state_manager.ts +19 -4
- package/src/public/test_executor_metrics.ts +27 -3
|
@@ -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';
|
|
@@ -399,10 +400,12 @@ import { PublicProcessorMetrics } from './public_processor_metrics.js';
|
|
|
399
400
|
contractDataSource;
|
|
400
401
|
dateProvider;
|
|
401
402
|
telemetryClient;
|
|
402
|
-
|
|
403
|
+
log;
|
|
404
|
+
constructor(contractDataSource, dateProvider = new DateProvider(), telemetryClient = getTelemetryClient(), bindings){
|
|
403
405
|
this.contractDataSource = contractDataSource;
|
|
404
406
|
this.dateProvider = dateProvider;
|
|
405
407
|
this.telemetryClient = telemetryClient;
|
|
408
|
+
this.log = createLogger('simulator:public-processor-factory', bindings);
|
|
406
409
|
}
|
|
407
410
|
/**
|
|
408
411
|
* Creates a new instance of a PublicProcessor.
|
|
@@ -410,13 +413,14 @@ import { PublicProcessorMetrics } from './public_processor_metrics.js';
|
|
|
410
413
|
* @param skipFeeEnforcement - Allows disabling balance checks for fee estimations.
|
|
411
414
|
* @returns A new instance of a PublicProcessor.
|
|
412
415
|
*/ create(merkleTree, globalVariables, config) {
|
|
413
|
-
const
|
|
416
|
+
const bindings = this.log.getBindings();
|
|
417
|
+
const contractsDB = new PublicContractsDB(this.contractDataSource, bindings);
|
|
414
418
|
const guardedFork = new GuardedMerkleTreeOperations(merkleTree);
|
|
415
419
|
const publicTxSimulator = this.createPublicTxSimulator(guardedFork, contractsDB, globalVariables, config);
|
|
416
|
-
return new PublicProcessor(globalVariables, guardedFork, contractsDB, publicTxSimulator, this.dateProvider, this.telemetryClient);
|
|
420
|
+
return new PublicProcessor(globalVariables, guardedFork, contractsDB, publicTxSimulator, this.dateProvider, this.telemetryClient, createLogger('simulator:public-processor', bindings));
|
|
417
421
|
}
|
|
418
422
|
createPublicTxSimulator(merkleTree, contractsDB, globalVariables, config) {
|
|
419
|
-
return new TelemetryCppPublicTxSimulator(merkleTree, contractsDB, globalVariables, this.telemetryClient, config);
|
|
423
|
+
return new TelemetryCppPublicTxSimulator(merkleTree, contractsDB, globalVariables, this.telemetryClient, config, this.log.getBindings());
|
|
420
424
|
}
|
|
421
425
|
}
|
|
422
426
|
class PublicProcessorTimeoutError extends Error {
|
|
@@ -443,6 +447,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
443
447
|
dateProvider;
|
|
444
448
|
log;
|
|
445
449
|
opts;
|
|
450
|
+
debugLogStore;
|
|
446
451
|
static{
|
|
447
452
|
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
448
453
|
[
|
|
@@ -463,7 +468,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
463
468
|
], []));
|
|
464
469
|
}
|
|
465
470
|
metrics;
|
|
466
|
-
constructor(globalVariables, guardedMerkleTree, contractsDB, publicTxSimulator, dateProvider, telemetryClient = getTelemetryClient(), log =
|
|
471
|
+
constructor(globalVariables, guardedMerkleTree, contractsDB, publicTxSimulator, dateProvider, telemetryClient = getTelemetryClient(), log, opts = {}, debugLogStore = new NullDebugLogStore()){
|
|
467
472
|
this.globalVariables = globalVariables;
|
|
468
473
|
this.guardedMerkleTree = guardedMerkleTree;
|
|
469
474
|
this.contractsDB = contractsDB;
|
|
@@ -471,6 +476,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
471
476
|
this.dateProvider = dateProvider;
|
|
472
477
|
this.log = log;
|
|
473
478
|
this.opts = opts;
|
|
479
|
+
this.debugLogStore = debugLogStore;
|
|
474
480
|
_initProto(this);
|
|
475
481
|
this.metrics = new PublicProcessorMetrics(telemetryClient, 'PublicProcessor');
|
|
476
482
|
}
|
|
@@ -484,11 +490,12 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
484
490
|
* @param validator - Pre-process validator and nullifier cache to use for processing the txs.
|
|
485
491
|
* @returns The list of processed txs with their circuit simulation outputs.
|
|
486
492
|
*/ async process(txs, limits = {}, validator = {}) {
|
|
487
|
-
const { maxTransactions,
|
|
493
|
+
const { maxTransactions, deadline, maxBlockGas, maxBlobFields, isBuildingProposal } = limits;
|
|
488
494
|
const { preprocessValidator, nullifierCache } = validator;
|
|
489
495
|
const result = [];
|
|
490
496
|
const usedTxs = [];
|
|
491
497
|
const failed = [];
|
|
498
|
+
const debugLogs = [];
|
|
492
499
|
const timer = new Timer();
|
|
493
500
|
let totalSizeInBytes = 0;
|
|
494
501
|
let returns = [];
|
|
@@ -506,21 +513,23 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
506
513
|
this.log.warn(`Stopping tx processing due to timeout.`);
|
|
507
514
|
break;
|
|
508
515
|
}
|
|
509
|
-
// Skip this tx if it'd exceed max block size
|
|
510
516
|
const txHash = tx.getTxHash().toString();
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
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`, {
|
|
514
522
|
txHash,
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
523
|
+
txBlobFields,
|
|
524
|
+
totalBlobFields,
|
|
525
|
+
maxBlobFields
|
|
518
526
|
});
|
|
519
527
|
continue;
|
|
520
528
|
}
|
|
521
|
-
// 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.
|
|
522
531
|
const txGasLimit = tx.data.constants.txContext.gasSettings.gasLimits;
|
|
523
|
-
if (maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
532
|
+
if (isBuildingProposal && maxBlockGas !== undefined && totalBlockGas.add(txGasLimit).gtAny(maxBlockGas)) {
|
|
524
533
|
this.log.warn(`Skipping processing of tx ${txHash} due to block gas limit`, {
|
|
525
534
|
txHash,
|
|
526
535
|
txGasLimit,
|
|
@@ -560,28 +569,15 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
560
569
|
const startStateReference = await this.guardedMerkleTree.getUnderlyingFork().getStateReference();
|
|
561
570
|
this.contractsDB.createCheckpoint();
|
|
562
571
|
try {
|
|
563
|
-
const [processedTx, returnValues] = await this.processTx(tx, deadline);
|
|
572
|
+
const [processedTx, returnValues, txDebugLogs] = await this.processTx(tx, deadline);
|
|
564
573
|
// Inject a fake processing failure after N txs if requested
|
|
565
574
|
const fakeThrowAfter = this.opts.fakeThrowAfterProcessingTxCount;
|
|
566
575
|
if (fakeThrowAfter !== undefined && result.length + failed.length + 1 >= fakeThrowAfter) {
|
|
567
576
|
throw new Error(`Fake error after processing ${fakeThrowAfter} txs`);
|
|
568
577
|
}
|
|
569
578
|
const txBlobFields = processedTx.txEffect.getNumBlobFields();
|
|
570
|
-
// If the actual size of this tx would exceed block size, skip it
|
|
571
579
|
const txSize = txBlobFields * Fr.SIZE_IN_BYTES;
|
|
572
|
-
|
|
573
|
-
this.log.debug(`Skipping processed tx ${txHash} sized ${txSize} due to max block size.`, {
|
|
574
|
-
txHash,
|
|
575
|
-
sizeInBytes: txSize,
|
|
576
|
-
totalSizeInBytes,
|
|
577
|
-
maxBlockSize
|
|
578
|
-
});
|
|
579
|
-
// Need to revert the checkpoint here and don't go any further
|
|
580
|
-
await checkpoint.revert();
|
|
581
|
-
this.contractsDB.revertCheckpoint();
|
|
582
|
-
continue;
|
|
583
|
-
}
|
|
584
|
-
// 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.
|
|
585
581
|
// Note: maxBlobFields already accounts for block end blob fields and previous blocks in checkpoint.
|
|
586
582
|
if (maxBlobFields !== undefined && totalBlobFields + txBlobFields > maxBlobFields) {
|
|
587
583
|
this.log.debug(`Skipping processed tx ${txHash} with ${txBlobFields} blob fields due to max blob fields limit.`, {
|
|
@@ -595,16 +591,34 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
595
591
|
this.contractsDB.revertCheckpoint();
|
|
596
592
|
continue;
|
|
597
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
|
+
}
|
|
598
608
|
// FIXME(fcarreiro): it's ugly to have to notify the validator of nullifiers.
|
|
599
609
|
// I'd rather pass the validators the processedTx as well and let them deal with it.
|
|
600
610
|
nullifierCache?.addNullifiers(processedTx.txEffect.nullifiers.map((n)=>n.toBuffer()));
|
|
601
611
|
result.push(processedTx);
|
|
602
612
|
usedTxs.push(tx);
|
|
603
613
|
returns = returns.concat(returnValues);
|
|
614
|
+
debugLogs.push(...txDebugLogs);
|
|
615
|
+
this.debugLogStore.storeLogs(processedTx.hash.toString(), txDebugLogs);
|
|
604
616
|
totalPublicGas = totalPublicGas.add(processedTx.gasUsed.publicGas);
|
|
605
617
|
totalBlockGas = totalBlockGas.add(processedTx.gasUsed.totalGas);
|
|
606
618
|
totalSizeInBytes += txSize;
|
|
607
619
|
totalBlobFields += txBlobFields;
|
|
620
|
+
// Commit the tx-level contracts checkpoint on success
|
|
621
|
+
this.contractsDB.commitCheckpoint();
|
|
608
622
|
} catch (err) {
|
|
609
623
|
if (err?.name === 'PublicProcessorTimeoutError') {
|
|
610
624
|
this.log.warn(`Stopping tx processing due to timeout.`);
|
|
@@ -621,22 +635,19 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
621
635
|
// We now know there can't be any further access to world state. The fork is in a state where there is:
|
|
622
636
|
// 1. At least one outstanding checkpoint that has not been committed (the one created before we processed the tx).
|
|
623
637
|
// 2. Possible state updates on that checkpoint or any others created during execution.
|
|
624
|
-
//
|
|
625
|
-
//
|
|
626
|
-
//
|
|
627
|
-
await checkpoint.
|
|
628
|
-
// Now we want to revert any/all remaining checkpoints, destroying any outstanding state updates.
|
|
629
|
-
// This needs to be done directly on the underlying fork as the guarded fork has been stopped.
|
|
630
|
-
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();
|
|
631
642
|
// Revert any contracts added to the DB for the tx.
|
|
632
643
|
this.contractsDB.revertCheckpoint();
|
|
633
644
|
// Ensure we're at the same state as when we started processing this tx.
|
|
634
645
|
await this.checkWorldStateUnchanged(startStateReference, txHash, err);
|
|
635
646
|
break;
|
|
636
647
|
}
|
|
637
|
-
// Roll back state to start of TX before proceeding to next TX
|
|
638
|
-
|
|
639
|
-
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();
|
|
640
651
|
this.contractsDB.revertCheckpoint();
|
|
641
652
|
const errorMessage = err instanceof Error || err instanceof AssertionError ? err.message : 'Unknown error';
|
|
642
653
|
this.log.warn(`Failed to process tx ${txHash.toString()}: ${errorMessage} ${err?.stack}`);
|
|
@@ -650,7 +661,6 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
650
661
|
} finally{
|
|
651
662
|
// Base case is we always commit the checkpoint. Using the ForkCheckpoint means this has no effect if the tx was previously reverted
|
|
652
663
|
await checkpoint.commit();
|
|
653
|
-
this.contractsDB.commitCheckpointOkIfNone();
|
|
654
664
|
}
|
|
655
665
|
}
|
|
656
666
|
const duration = timer.s();
|
|
@@ -668,7 +678,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
668
678
|
failed,
|
|
669
679
|
usedTxs,
|
|
670
680
|
returns,
|
|
671
|
-
|
|
681
|
+
debugLogs
|
|
672
682
|
];
|
|
673
683
|
}
|
|
674
684
|
async checkWorldStateUnchanged(startStateReference, txHash, cause) {
|
|
@@ -685,7 +695,7 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
685
695
|
}
|
|
686
696
|
}
|
|
687
697
|
async processTx(tx, deadline) {
|
|
688
|
-
const [time, [processedTx, returnValues]] = await elapsed(()=>this.processTxWithinDeadline(tx, deadline));
|
|
698
|
+
const [time, [processedTx, returnValues, debugLogs]] = await elapsed(()=>this.processTxWithinDeadline(tx, deadline));
|
|
689
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`, {
|
|
690
700
|
txHash: processedTx.hash,
|
|
691
701
|
txFee: processedTx.txEffect.transactionFee.toBigInt(),
|
|
@@ -703,7 +713,8 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
703
713
|
});
|
|
704
714
|
return [
|
|
705
715
|
processedTx,
|
|
706
|
-
returnValues ?? []
|
|
716
|
+
returnValues ?? [],
|
|
717
|
+
debugLogs
|
|
707
718
|
];
|
|
708
719
|
}
|
|
709
720
|
async doTreeInsertionsForPrivateOnlyTx(processedTx) {
|
|
@@ -777,10 +788,11 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
777
788
|
this.metrics.recordClassPublication(...tx.getContractClassLogs().filter((log)=>ContractClassPublishedEvent.isContractClassPublishedEvent(log)).map((log)=>ContractClassPublishedEvent.fromLog(log)));
|
|
778
789
|
// Fee payment insertion has already been done. Do the rest.
|
|
779
790
|
await this.doTreeInsertionsForPrivateOnlyTx(processedTx);
|
|
780
|
-
|
|
791
|
+
this.contractsDB.addNewContracts(tx);
|
|
781
792
|
return [
|
|
782
793
|
processedTx,
|
|
783
|
-
undefined
|
|
794
|
+
undefined,
|
|
795
|
+
[]
|
|
784
796
|
];
|
|
785
797
|
}
|
|
786
798
|
async processTxWithPublicCalls(tx) {
|
|
@@ -802,7 +814,8 @@ _dec = trackSpan('PublicProcessor.processTx', (tx)=>({
|
|
|
802
814
|
const processedTx = makeProcessedTxFromTxWithPublicCalls(tx, this.globalVariables, avmProvingRequest, publicTxEffect, gasUsed, revertCode, revertReason);
|
|
803
815
|
return [
|
|
804
816
|
processedTx,
|
|
805
|
-
appLogicReturnValues
|
|
817
|
+
appLogicReturnValues,
|
|
818
|
+
result.logs ?? []
|
|
806
819
|
];
|
|
807
820
|
}
|
|
808
821
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContractClassPublishedEvent } from '@aztec/protocol-contracts/class-registry';
|
|
2
2
|
import type { Gas } from '@aztec/stdlib/gas';
|
|
3
|
-
import
|
|
3
|
+
import { TxExecutionPhase } from '@aztec/stdlib/tx';
|
|
4
4
|
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
5
5
|
export declare class PublicProcessorMetrics {
|
|
6
6
|
readonly tracer: Tracer;
|
|
@@ -24,4 +24,4 @@ export declare class PublicProcessorMetrics {
|
|
|
24
24
|
recordClassPublication(...events: ContractClassPublishedEvent[]): void;
|
|
25
25
|
recordTreeInsertions(durationUs: number): void;
|
|
26
26
|
}
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX3Byb2Nlc3Nvcl9tZXRyaWNzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGljL3B1YmxpY19wcm9jZXNzb3IvcHVibGljX3Byb2Nlc3Nvcl9tZXRyaWNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sMENBQTBDLENBQUM7QUFDNUYsT0FBTyxLQUFLLEVBQUUsR0FBRyxFQUF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QUFzQixDQUFDLEdBQUcsTUFBTSxFQUFFLDJCQUEyQixFQUFFLFFBUzlEO0lBRUQsb0JBQW9CLENBQUMsVUFBVSxFQUFFLE1BQU0sUUFFdEM7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_processor_metrics.d.ts","sourceRoot":"","sources":["../../../src/public/public_processor/public_processor_metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"public_processor_metrics.d.ts","sourceRoot":"","sources":["../../../src/public/public_processor/public_processor_metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,qBAAa,sBAAsB;IACjC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,YAAY,CAAgB;IAEpC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,UAAU,CAAgB;IAElC,OAAO,CAAC,gBAAgB,CAAY;IACpC,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,iBAAiB,CAAY;IACrC,OAAO,CAAC,OAAO,CAAY;IAC3B,OAAO,CAAC,KAAK,CAAY;IAEzB,OAAO,CAAC,qBAAqB,CAAY;IAEzC,YAAY,MAAM,EAAE,eAAe,EAAE,IAAI,SAAoB,EA8B5D;IAED,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,QAGlE;IAED,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,QAY5D;IAED,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,QAgB1C;IAED,cAAc,SAIb;IAED,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,QAE9C;IAED,sBAAsB,CAAC,GAAG,MAAM,EAAE,2BAA2B,EAAE,QAS9D;IAED,oBAAoB,CAAC,UAAU,EAAE,MAAM,QAEtC;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TxExecutionPhase } from '@aztec/stdlib/tx';
|
|
2
|
+
import { Attributes, Metrics, createUpDownCounterWithDefault } from '@aztec/telemetry-client';
|
|
2
3
|
export class PublicProcessorMetrics {
|
|
3
4
|
tracer;
|
|
4
5
|
txDuration;
|
|
@@ -16,10 +17,25 @@ export class PublicProcessorMetrics {
|
|
|
16
17
|
this.tracer = client.getTracer(name);
|
|
17
18
|
const meter = client.getMeter(name);
|
|
18
19
|
this.txDuration = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_TX_DURATION);
|
|
19
|
-
this.txCount = meter
|
|
20
|
-
|
|
20
|
+
this.txCount = createUpDownCounterWithDefault(meter, Metrics.PUBLIC_PROCESSOR_TX_COUNT, {
|
|
21
|
+
[Attributes.OK]: [
|
|
22
|
+
true,
|
|
23
|
+
false
|
|
24
|
+
]
|
|
25
|
+
});
|
|
26
|
+
this.txPhaseCount = createUpDownCounterWithDefault(meter, Metrics.PUBLIC_PROCESSOR_TX_PHASE_COUNT);
|
|
21
27
|
this.phaseDuration = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_PHASE_DURATION);
|
|
22
|
-
this.phaseCount = meter
|
|
28
|
+
this.phaseCount = createUpDownCounterWithDefault(meter, Metrics.PUBLIC_PROCESSOR_PHASE_COUNT, {
|
|
29
|
+
[Attributes.TX_PHASE_NAME]: [
|
|
30
|
+
TxExecutionPhase.SETUP,
|
|
31
|
+
TxExecutionPhase.APP_LOGIC,
|
|
32
|
+
TxExecutionPhase.TEARDOWN
|
|
33
|
+
],
|
|
34
|
+
[Attributes.OK]: [
|
|
35
|
+
true,
|
|
36
|
+
false
|
|
37
|
+
]
|
|
38
|
+
});
|
|
23
39
|
this.bytecodeDeployed = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_DEPLOY_BYTECODE_SIZE);
|
|
24
40
|
this.totalGas = meter.createGauge(Metrics.PUBLIC_PROCESSOR_TOTAL_GAS);
|
|
25
41
|
this.totalGasHistogram = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_TOTAL_GAS_HISTOGRAM);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LoggerBindings } from '@aztec/foundation/log';
|
|
1
2
|
import type { ContractProvider } from '@aztec/native';
|
|
2
3
|
import type { GlobalVariables } from '@aztec/stdlib/tx';
|
|
3
4
|
import type { PublicContractsDB } from '../public_db_sources.js';
|
|
@@ -5,7 +6,7 @@ export declare class ContractProviderForCpp implements ContractProvider {
|
|
|
5
6
|
private contractsDB;
|
|
6
7
|
private globalVariables;
|
|
7
8
|
private log;
|
|
8
|
-
constructor(contractsDB: PublicContractsDB, globalVariables: GlobalVariables);
|
|
9
|
+
constructor(contractsDB: PublicContractsDB, globalVariables: GlobalVariables, bindings?: LoggerBindings);
|
|
9
10
|
getContractInstance: (address: string) => Promise<Buffer<ArrayBufferLike> | undefined>;
|
|
10
11
|
getContractClass: (classId: string) => Promise<Buffer<ArrayBufferLike> | undefined>;
|
|
11
12
|
addContracts: (contractDeploymentDataBuffer: Buffer<ArrayBufferLike>) => Promise<void>;
|
|
@@ -15,4 +16,4 @@ export declare class ContractProviderForCpp implements ContractProvider {
|
|
|
15
16
|
commitCheckpoint: () => Promise<void>;
|
|
16
17
|
revertCheckpoint: () => Promise<void>;
|
|
17
18
|
}
|
|
18
|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_provider_for_cpp.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/contract_provider_for_cpp.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -8,10 +8,9 @@ export class ContractProviderForCpp {
|
|
|
8
8
|
contractsDB;
|
|
9
9
|
globalVariables;
|
|
10
10
|
log;
|
|
11
|
-
constructor(contractsDB, globalVariables){
|
|
11
|
+
constructor(contractsDB, globalVariables, bindings){
|
|
12
12
|
this.contractsDB = contractsDB;
|
|
13
13
|
this.globalVariables = globalVariables;
|
|
14
|
-
this.log = createLogger('simulator:contract_provider_for_cpp');
|
|
15
14
|
this.getContractInstance = async (address)=>{
|
|
16
15
|
this.log.trace(`Contract provider callback: getContractInstance(${address})`);
|
|
17
16
|
const aztecAddr = AztecAddress.fromString(address);
|
|
@@ -41,7 +40,7 @@ export class ContractProviderForCpp {
|
|
|
41
40
|
const contractDeploymentData = ContractDeploymentData.fromPlainObject(rawData);
|
|
42
41
|
// Add contracts to the contracts DB
|
|
43
42
|
this.log.trace(`Calling contractsDB.addContracts`);
|
|
44
|
-
|
|
43
|
+
this.contractsDB.addContracts(contractDeploymentData);
|
|
45
44
|
};
|
|
46
45
|
this.getBytecodeCommitment = async (classId)=>{
|
|
47
46
|
this.log.trace(`Contract provider callback: getBytecodeCommitment(${classId})`);
|
|
@@ -86,9 +85,11 @@ export class ContractProviderForCpp {
|
|
|
86
85
|
this.log.trace(`Contract provider callback: revertCheckpoint`);
|
|
87
86
|
return Promise.resolve(this.contractsDB.revertCheckpoint());
|
|
88
87
|
};
|
|
88
|
+
this.log = createLogger('simulator:contract_provider_for_cpp', bindings);
|
|
89
89
|
}
|
|
90
90
|
getContractInstance;
|
|
91
91
|
getContractClass;
|
|
92
|
+
// eslint-disable-next-line require-await
|
|
92
93
|
addContracts;
|
|
93
94
|
getBytecodeCommitment;
|
|
94
95
|
getDebugFunctionName;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Logger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings } from '@aztec/foundation/log';
|
|
2
2
|
import { type PublicSimulatorConfig, PublicTxResult } from '@aztec/stdlib/avm';
|
|
3
3
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
4
4
|
import type { GlobalVariables, Tx } from '@aztec/stdlib/tx';
|
|
@@ -18,7 +18,7 @@ export declare class CppPublicTxSimulator extends PublicTxSimulator implements P
|
|
|
18
18
|
private cancellationToken?;
|
|
19
19
|
/** Current simulation promise, used to wait for completion after cancellation. */
|
|
20
20
|
private simulationPromise?;
|
|
21
|
-
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, config?: Partial<PublicSimulatorConfig
|
|
21
|
+
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, config?: Partial<PublicSimulatorConfig>, bindings?: LoggerBindings);
|
|
22
22
|
/**
|
|
23
23
|
* Simulate a transaction's public portion using the C++ avvm simulator.
|
|
24
24
|
*
|
|
@@ -40,7 +40,7 @@ export declare class CppPublicTxSimulator extends PublicTxSimulator implements P
|
|
|
40
40
|
}
|
|
41
41
|
export declare class MeasuredCppPublicTxSimulator extends CppPublicTxSimulator implements MeasuredPublicTxSimulatorInterface {
|
|
42
42
|
protected readonly metrics: ExecutorMetricsInterface;
|
|
43
|
-
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, metrics: ExecutorMetricsInterface, config?: Partial<PublicSimulatorConfig
|
|
43
|
+
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, metrics: ExecutorMetricsInterface, config?: Partial<PublicSimulatorConfig>, bindings?: LoggerBindings);
|
|
44
44
|
simulate(tx: Tx, txLabel?: string): Promise<PublicTxResult>;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -48,6 +48,6 @@ export declare class MeasuredCppPublicTxSimulator extends CppPublicTxSimulator i
|
|
|
48
48
|
*/
|
|
49
49
|
export declare class TelemetryCppPublicTxSimulator extends MeasuredCppPublicTxSimulator {
|
|
50
50
|
readonly tracer: Tracer;
|
|
51
|
-
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, telemetryClient?: TelemetryClient, config?: Partial<PublicSimulatorConfig
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3B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0IsWUFDRSxVQUFVLEVBQUUseUJBQXlCLEVBQ3JDLFdBQVcsRUFBRSxpQkFBaUIsRUFDOUIsZUFBZSxFQUFFLGVBQWUsRUFDaEMsZUFBZSxHQUFFLGVBQXNDLEVBQ3ZELE1BQU0sQ0FBQyxFQUFFLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBQyxFQUN2QyxRQUFRLENBQUMsRUFBRSxjQUFjLEVBSzFCO0NBQ0YifQ==
|
|
@@ -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,
|
|
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,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,MAAM,EAAsB,MAAM,yBAAyB,CAAC;AAKhG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACV,kCAAkC,EAClC,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,iBAAkB,YAAW,0BAA0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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';
|
|
@@ -18,9 +18,9 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
|
18
18
|
log;
|
|
19
19
|
/** Current cancellation token for in-flight simulation. */ cancellationToken;
|
|
20
20
|
/** Current simulation promise, used to wait for completion after cancellation. */ simulationPromise;
|
|
21
|
-
constructor(merkleTree, contractsDB, globalVariables, config){
|
|
22
|
-
super(merkleTree, contractsDB, globalVariables, config);
|
|
23
|
-
this.log = createLogger(`simulator:cpp_public_tx_simulator
|
|
21
|
+
constructor(merkleTree, contractsDB, globalVariables, config, bindings){
|
|
22
|
+
super(merkleTree, contractsDB, globalVariables, config, undefined, bindings);
|
|
23
|
+
this.log = createLogger(`simulator:cpp_public_tx_simulator`, bindings);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Simulate a transaction's public portion using the C++ avvm simulator.
|
|
@@ -43,7 +43,7 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
|
43
43
|
const protocolContracts = ProtocolContractsList;
|
|
44
44
|
const fastSimInputs = new AvmFastSimulationInputs(wsRevision, this.config, txHint, this.globalVariables, protocolContracts);
|
|
45
45
|
// Create contract provider for callbacks to TypeScript PublicContractsDB from C++
|
|
46
|
-
const contractProvider = new ContractProviderForCpp(this.contractsDB, this.globalVariables);
|
|
46
|
+
const contractProvider = new ContractProviderForCpp(this.contractsDB, this.globalVariables, this.bindings);
|
|
47
47
|
// Serialize to msgpack and call the C++ simulator
|
|
48
48
|
this.log.trace(`Serializing fast simulation inputs to msgpack...`);
|
|
49
49
|
const inputBuffer = fastSimInputs.serializeWithMessagePack();
|
|
@@ -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;
|
|
@@ -106,8 +105,8 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
|
106
105
|
}
|
|
107
106
|
export class MeasuredCppPublicTxSimulator extends CppPublicTxSimulator {
|
|
108
107
|
metrics;
|
|
109
|
-
constructor(merkleTree, contractsDB, globalVariables, metrics, config){
|
|
110
|
-
super(merkleTree, contractsDB, globalVariables, config), this.metrics = metrics;
|
|
108
|
+
constructor(merkleTree, contractsDB, globalVariables, metrics, config, bindings){
|
|
109
|
+
super(merkleTree, contractsDB, globalVariables, config, bindings), this.metrics = metrics;
|
|
111
110
|
}
|
|
112
111
|
async simulate(tx, txLabel = 'unlabeledTx') {
|
|
113
112
|
this.metrics.startRecordingTxSimulation(txLabel);
|
|
@@ -124,9 +123,9 @@ export class MeasuredCppPublicTxSimulator extends CppPublicTxSimulator {
|
|
|
124
123
|
* A C++ public tx simulator that tracks runtime/production metrics with telemetry.
|
|
125
124
|
*/ export class TelemetryCppPublicTxSimulator extends MeasuredCppPublicTxSimulator {
|
|
126
125
|
/* tracer needed by trackSpans */ tracer;
|
|
127
|
-
constructor(merkleTree, contractsDB, globalVariables, telemetryClient = getTelemetryClient(), config){
|
|
126
|
+
constructor(merkleTree, contractsDB, globalVariables, telemetryClient = getTelemetryClient(), config, bindings){
|
|
128
127
|
const metrics = new ExecutorMetrics(telemetryClient, 'CppPublicTxSimulator');
|
|
129
|
-
super(merkleTree, contractsDB, globalVariables, metrics, config);
|
|
128
|
+
super(merkleTree, contractsDB, globalVariables, metrics, config, bindings);
|
|
130
129
|
this.tracer = metrics.tracer;
|
|
131
130
|
}
|
|
132
131
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Logger } from '@aztec/foundation/log';
|
|
1
|
+
import { type Logger, type LoggerBindings } from '@aztec/foundation/log';
|
|
2
2
|
import { type PublicSimulatorConfig, PublicTxResult } from '@aztec/stdlib/avm';
|
|
3
3
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
4
4
|
import type { GlobalVariables, Tx } from '@aztec/stdlib/tx';
|
|
@@ -14,7 +14,7 @@ import type { MeasuredPublicTxSimulatorInterface, PublicTxSimulatorInterface } f
|
|
|
14
14
|
*/
|
|
15
15
|
export declare class CppPublicTxSimulatorHintedDbs extends PublicTxSimulator implements PublicTxSimulatorInterface {
|
|
16
16
|
protected log: Logger;
|
|
17
|
-
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, config?: Partial<PublicSimulatorConfig
|
|
17
|
+
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, config?: Partial<PublicSimulatorConfig>, bindings?: LoggerBindings);
|
|
18
18
|
/**
|
|
19
19
|
* Simulate a transaction's public portion using the C++ vm2 simulator with hinted DBs.
|
|
20
20
|
*
|
|
@@ -36,7 +36,7 @@ export declare class CppPublicTxSimulatorHintedDbs extends PublicTxSimulator imp
|
|
|
36
36
|
*/
|
|
37
37
|
export declare class MeasuredCppPublicTxSimulatorHintedDbs extends CppPublicTxSimulatorHintedDbs implements MeasuredPublicTxSimulatorInterface {
|
|
38
38
|
protected readonly metrics: ExecutorMetricsInterface;
|
|
39
|
-
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, metrics: ExecutorMetricsInterface, config?: Partial<PublicSimulatorConfig
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3BwX3B1YmxpY190eF9zaW11bGF0b3Jfd2l0aF9oaW50ZWRfZGJzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGljL3B1YmxpY190eF9zaW11bGF0b3IvY3BwX3B1YmxpY190eF9zaW11bGF0b3Jfd2l0aF9oaW50ZWRfZGJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBRSxLQUFLLGNBQWMsRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUV2RixPQUFPLEVBRUwsS0FBSyxxQkFBcUIsRUFDMUIsY0FBYyxFQUVmLE1BQU0sbUJBQW1CLENBQUM7QUFFM0IsT0FBTyxLQUFLLEVBQUUseUJBQXlCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRSxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsRUFBRSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFJNUQsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUNqRixPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ2pFLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUNWLGtDQUFrQyxFQUNsQywwQkFB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","sources":["../../../src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,
|
|
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';
|
|
@@ -11,9 +11,9 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
|
11
11
|
* to C++ to run hinted simulation.
|
|
12
12
|
*/ export class CppPublicTxSimulatorHintedDbs extends PublicTxSimulator {
|
|
13
13
|
log;
|
|
14
|
-
constructor(merkleTree, contractsDB, globalVariables, config){
|
|
15
|
-
super(merkleTree, contractsDB, globalVariables, config);
|
|
16
|
-
this.log = createLogger(`simulator:cpp_public_tx_simulator_hinted_dbs
|
|
14
|
+
constructor(merkleTree, contractsDB, globalVariables, config, bindings){
|
|
15
|
+
super(merkleTree, contractsDB, globalVariables, config, undefined, bindings);
|
|
16
|
+
this.log = createLogger(`simulator:cpp_public_tx_simulator_hinted_dbs`, bindings);
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Simulate a transaction's public portion using the C++ vm2 simulator with hinted DBs.
|
|
@@ -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
|
}
|
|
@@ -70,8 +70,8 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
|
70
70
|
* to TS for tracking.
|
|
71
71
|
*/ export class MeasuredCppPublicTxSimulatorHintedDbs extends CppPublicTxSimulatorHintedDbs {
|
|
72
72
|
metrics;
|
|
73
|
-
constructor(merkleTree, contractsDB, globalVariables, metrics, config){
|
|
74
|
-
super(merkleTree, contractsDB, globalVariables, config), this.metrics = metrics;
|
|
73
|
+
constructor(merkleTree, contractsDB, globalVariables, metrics, config, bindings){
|
|
74
|
+
super(merkleTree, contractsDB, globalVariables, config, bindings), this.metrics = metrics;
|
|
75
75
|
}
|
|
76
76
|
async simulate(tx, txLabel = 'unlabeledTx') {
|
|
77
77
|
this.metrics.startRecordingTxSimulation(txLabel);
|