@aztec/simulator 0.47.1 → 0.48.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/acvm/oracle/oracle.d.ts +3 -3
- package/dest/acvm/oracle/oracle.d.ts.map +1 -1
- package/dest/acvm/oracle/oracle.js +8 -9
- package/dest/acvm/oracle/typed_oracle.d.ts +5 -5
- package/dest/acvm/oracle/typed_oracle.d.ts.map +1 -1
- package/dest/acvm/oracle/typed_oracle.js +6 -6
- package/dest/avm/fixtures/index.d.ts.map +1 -1
- package/dest/avm/fixtures/index.js +2 -2
- package/dest/avm/opcodes/commitment.js +4 -4
- package/dest/avm/serialization/instruction_serialization.js +2 -2
- package/dest/client/client_execution_context.d.ts +8 -8
- package/dest/client/client_execution_context.d.ts.map +1 -1
- package/dest/client/client_execution_context.js +22 -23
- package/dest/client/db_oracle.d.ts +4 -3
- package/dest/client/db_oracle.d.ts.map +1 -1
- package/dest/client/execution_note_cache.d.ts +17 -13
- package/dest/client/execution_note_cache.d.ts.map +1 -1
- package/dest/client/execution_note_cache.js +65 -26
- package/dest/client/execution_result.d.ts +3 -2
- package/dest/client/execution_result.d.ts.map +1 -1
- package/dest/client/execution_result.js +20 -9
- package/dest/client/private_execution.js +3 -3
- package/dest/client/simulator.d.ts +7 -6
- package/dest/client/simulator.d.ts.map +1 -1
- package/dest/client/simulator.js +14 -12
- package/dest/client/test_utils.d.ts +9 -0
- package/dest/client/test_utils.d.ts.map +1 -0
- package/dest/client/test_utils.js +21 -0
- package/dest/client/view_data_oracle.d.ts +2 -1
- package/dest/client/view_data_oracle.d.ts.map +1 -1
- package/dest/client/view_data_oracle.js +4 -3
- package/dest/index.d.ts +0 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -2
- package/dest/public/abstract_phase_manager.d.ts.map +1 -1
- package/dest/public/abstract_phase_manager.js +3 -3
- package/dest/public/executor.d.ts +4 -1
- package/dest/public/executor.d.ts.map +1 -1
- package/dest/public/executor.js +10 -2
- package/dest/public/executor_metrics.d.ts +10 -0
- package/dest/public/executor_metrics.d.ts.map +1 -0
- package/dest/public/executor_metrics.js +32 -0
- package/dest/public/fee_payment.d.ts +2 -2
- package/dest/public/fee_payment.d.ts.map +1 -1
- package/dest/public/fee_payment.js +9 -10
- package/dest/public/hints_builder.d.ts.map +1 -1
- package/dest/public/hints_builder.js +1 -1
- package/dest/public/public_processor.d.ts +3 -3
- package/dest/public/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor.js +33 -14
- package/dest/public/public_processor_metrics.d.ts +19 -0
- package/dest/public/public_processor_metrics.d.ts.map +1 -0
- package/dest/public/public_processor_metrics.js +57 -0
- package/package.json +9 -9
- package/src/acvm/oracle/oracle.ts +8 -23
- package/src/acvm/oracle/typed_oracle.ts +8 -21
- package/src/avm/fixtures/index.ts +1 -0
- package/src/avm/opcodes/commitment.ts +3 -3
- package/src/avm/serialization/instruction_serialization.ts +1 -1
- package/src/client/client_execution_context.ts +23 -20
- package/src/client/db_oracle.ts +9 -3
- package/src/client/execution_note_cache.ts +76 -25
- package/src/client/execution_result.ts +29 -9
- package/src/client/private_execution.ts +2 -2
- package/src/client/simulator.ts +18 -14
- package/src/client/test_utils.ts +30 -0
- package/src/client/view_data_oracle.ts +2 -1
- package/src/index.ts +0 -1
- package/src/public/abstract_phase_manager.ts +1 -2
- package/src/public/executor.ts +14 -1
- package/src/public/executor_metrics.ts +48 -0
- package/src/public/fee_payment.ts +8 -10
- package/src/public/hints_builder.ts +2 -2
- package/src/public/public_processor.ts +46 -15
- package/src/public/public_processor_metrics.ts +90 -0
- package/dest/utils.d.ts +0 -12
- package/dest/utils.d.ts.map +0 -1
- package/dest/utils.js +0 -11
- package/src/utils.ts +0 -18
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Attributes,
|
|
3
|
+
type Histogram,
|
|
4
|
+
Metrics,
|
|
5
|
+
type TelemetryClient,
|
|
6
|
+
type UpDownCounter,
|
|
7
|
+
ValueType,
|
|
8
|
+
} from '@aztec/telemetry-client';
|
|
9
|
+
|
|
10
|
+
export class ExecutorMetrics {
|
|
11
|
+
private fnCount: UpDownCounter;
|
|
12
|
+
private fnDuration: Histogram;
|
|
13
|
+
private bytecodeSize: Histogram;
|
|
14
|
+
|
|
15
|
+
constructor(client: TelemetryClient, name = 'PublicExecutor') {
|
|
16
|
+
const meter = client.getMeter(name);
|
|
17
|
+
|
|
18
|
+
this.fnCount = meter.createUpDownCounter(Metrics.PUBLIC_EXECUTOR_SIMULATION_COUNT, {
|
|
19
|
+
description: 'Number of functions executed',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
this.fnDuration = meter.createHistogram(Metrics.PUBLIC_EXECUTOR_SIMULATION_DURATION, {
|
|
23
|
+
description: 'How long it takes to execute a function',
|
|
24
|
+
unit: 'ms',
|
|
25
|
+
valueType: ValueType.INT,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
this.bytecodeSize = meter.createHistogram(Metrics.PUBLIC_EXECUTION_SIMULATION_BYTECODE_SIZE, {
|
|
29
|
+
description: 'Size of the function bytecode',
|
|
30
|
+
unit: 'By',
|
|
31
|
+
valueType: ValueType.INT,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
recordFunctionSimulation(bytecodeSize: number, durationMs: number) {
|
|
36
|
+
this.fnCount.add(1, {
|
|
37
|
+
[Attributes.OK]: true,
|
|
38
|
+
});
|
|
39
|
+
this.bytecodeSize.record(bytecodeSize);
|
|
40
|
+
this.fnDuration.record(Math.ceil(durationMs));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
recordFunctionSimulationFailure() {
|
|
44
|
+
this.fnCount.add(1, {
|
|
45
|
+
[Attributes.OK]: false,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { computePublicDataTreeLeafSlot } from '@aztec/circuits.js/hash';
|
|
1
|
+
import { FEE_JUICE_ADDRESS } from '@aztec/circuits.js';
|
|
2
|
+
import { computePublicDataTreeLeafSlot, deriveStorageSlotInMap } from '@aztec/circuits.js/hash';
|
|
3
3
|
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
4
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { computeSlotForMapping } from '../utils.js';
|
|
5
|
+
import { FeeJuiceArtifact } from '@aztec/protocol-contracts/fee-juice';
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
|
-
* Computes the storage slot within the
|
|
8
|
+
* Computes the storage slot within the Fee Juice contract for the balance of the fee payer.
|
|
11
9
|
*/
|
|
12
10
|
export function computeFeePayerBalanceStorageSlot(feePayer: AztecAddress) {
|
|
13
|
-
return
|
|
11
|
+
return deriveStorageSlotInMap(FeeJuiceArtifact.storageLayout.balances.slot, feePayer);
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
|
-
* Computes the leaf slot in the public data tree for the balance of the fee payer in the
|
|
15
|
+
* Computes the leaf slot in the public data tree for the balance of the fee payer in the Fee Juice.
|
|
18
16
|
*/
|
|
19
17
|
export function computeFeePayerBalanceLeafSlot(feePayer: AztecAddress): Fr {
|
|
20
18
|
if (feePayer.isZero()) {
|
|
21
19
|
return Fr.ZERO;
|
|
22
20
|
}
|
|
23
|
-
const
|
|
21
|
+
const feeJuice = AztecAddress.fromBigInt(FEE_JUICE_ADDRESS);
|
|
24
22
|
const balanceSlot = computeFeePayerBalanceStorageSlot(feePayer);
|
|
25
|
-
return computePublicDataTreeLeafSlot(
|
|
23
|
+
return computePublicDataTreeLeafSlot(feeJuice, balanceSlot);
|
|
26
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MerkleTreeId } from '@aztec/circuit-types';
|
|
1
|
+
import { type IndexedTreeId, MerkleTreeId } from '@aztec/circuit-types';
|
|
2
2
|
import {
|
|
3
3
|
type Fr,
|
|
4
4
|
type MAX_NULLIFIERS_PER_TX,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
buildSiloedNullifierReadRequestHints,
|
|
24
24
|
} from '@aztec/circuits.js';
|
|
25
25
|
import { type Tuple } from '@aztec/foundation/serialize';
|
|
26
|
-
import { type
|
|
26
|
+
import { type MerkleTreeOperations } from '@aztec/world-state';
|
|
27
27
|
|
|
28
28
|
export class HintsBuilder {
|
|
29
29
|
constructor(private db: MerkleTreeOperations) {}
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
} from '@aztec/circuit-types';
|
|
14
14
|
import {
|
|
15
15
|
AztecAddress,
|
|
16
|
-
|
|
16
|
+
ContractClassRegisteredEvent,
|
|
17
|
+
FEE_JUICE_ADDRESS,
|
|
17
18
|
type GlobalVariables,
|
|
18
19
|
type Header,
|
|
19
20
|
type KernelCircuitPublicInputs,
|
|
@@ -23,7 +24,9 @@ import {
|
|
|
23
24
|
} from '@aztec/circuits.js';
|
|
24
25
|
import { times } from '@aztec/foundation/collection';
|
|
25
26
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
27
|
+
import { Timer } from '@aztec/foundation/timer';
|
|
26
28
|
import { type ProtocolArtifact } from '@aztec/noir-protocol-circuits-types';
|
|
29
|
+
import { ClassRegistererAddress } from '@aztec/protocol-contracts/class-registerer';
|
|
27
30
|
import {
|
|
28
31
|
PublicExecutor,
|
|
29
32
|
type PublicStateDB,
|
|
@@ -40,6 +43,7 @@ import { PhaseManagerFactory } from './phase_manager_factory.js';
|
|
|
40
43
|
import { ContractsDataSourcePublicDB, WorldStateDB, WorldStatePublicDB } from './public_db_sources.js';
|
|
41
44
|
import { RealPublicKernelCircuitSimulator } from './public_kernel.js';
|
|
42
45
|
import { type PublicKernelCircuitSimulator } from './public_kernel_circuit_simulator.js';
|
|
46
|
+
import { PublicProcessorMetrics } from './public_processor_metrics.js';
|
|
43
47
|
|
|
44
48
|
/**
|
|
45
49
|
* Creates new instances of PublicProcessor given the provided merkle tree db and contract data source.
|
|
@@ -56,18 +60,24 @@ export class PublicProcessorFactory {
|
|
|
56
60
|
* Creates a new instance of a PublicProcessor.
|
|
57
61
|
* @param historicalHeader - The header of a block previous to the one in which the tx is included.
|
|
58
62
|
* @param globalVariables - The global variables for the block being processed.
|
|
59
|
-
* @param newContracts - Provides access to contract bytecode for public executions.
|
|
60
63
|
* @returns A new instance of a PublicProcessor.
|
|
61
64
|
*/
|
|
62
|
-
public create(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
public create(maybeHistoricalHeader: Header | undefined, globalVariables: GlobalVariables): PublicProcessor {
|
|
66
|
+
const { merkleTree, telemetryClient } = this;
|
|
67
|
+
const historicalHeader = maybeHistoricalHeader ?? merkleTree.getInitialHeader();
|
|
65
68
|
const publicContractsDB = new ContractsDataSourcePublicDB(this.contractDataSource);
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
+
|
|
70
|
+
const worldStatePublicDB = new WorldStatePublicDB(merkleTree);
|
|
71
|
+
const worldStateDB = new WorldStateDB(merkleTree);
|
|
72
|
+
const publicExecutor = new PublicExecutor(
|
|
73
|
+
worldStatePublicDB,
|
|
74
|
+
publicContractsDB,
|
|
75
|
+
worldStateDB,
|
|
76
|
+
historicalHeader,
|
|
77
|
+
telemetryClient,
|
|
78
|
+
);
|
|
69
79
|
return new PublicProcessor(
|
|
70
|
-
|
|
80
|
+
merkleTree,
|
|
71
81
|
publicExecutor,
|
|
72
82
|
new RealPublicKernelCircuitSimulator(this.simulator),
|
|
73
83
|
globalVariables,
|
|
@@ -84,7 +94,7 @@ export class PublicProcessorFactory {
|
|
|
84
94
|
* any public function calls in them. Txs with private calls only are unaffected.
|
|
85
95
|
*/
|
|
86
96
|
export class PublicProcessor {
|
|
87
|
-
|
|
97
|
+
private metrics: PublicProcessorMetrics;
|
|
88
98
|
constructor(
|
|
89
99
|
protected db: MerkleTreeOperations,
|
|
90
100
|
protected publicExecutor: PublicExecutor,
|
|
@@ -96,7 +106,11 @@ export class PublicProcessor {
|
|
|
96
106
|
telemetryClient: TelemetryClient,
|
|
97
107
|
private log = createDebugLogger('aztec:sequencer:public-processor'),
|
|
98
108
|
) {
|
|
99
|
-
this.
|
|
109
|
+
this.metrics = new PublicProcessorMetrics(telemetryClient, 'PublicProcessor');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
get tracer(): Tracer {
|
|
113
|
+
return this.metrics.tracer;
|
|
100
114
|
}
|
|
101
115
|
|
|
102
116
|
/**
|
|
@@ -188,12 +202,12 @@ export class PublicProcessor {
|
|
|
188
202
|
return finalPublicDataUpdateRequests;
|
|
189
203
|
}
|
|
190
204
|
|
|
191
|
-
const
|
|
205
|
+
const feeJuiceAddress = AztecAddress.fromBigInt(FEE_JUICE_ADDRESS);
|
|
192
206
|
const balanceSlot = computeFeePayerBalanceStorageSlot(feePayer);
|
|
193
207
|
const leafSlot = computeFeePayerBalanceLeafSlot(feePayer);
|
|
194
208
|
const txFee = tx.data.getTransactionFee(this.globalVariables.gasFees);
|
|
195
209
|
|
|
196
|
-
this.log.debug(`Deducting ${txFee} balance in
|
|
210
|
+
this.log.debug(`Deducting ${txFee} balance in Fee Juice for ${feePayer}`);
|
|
197
211
|
|
|
198
212
|
const existingBalanceWriteIndex = finalPublicDataUpdateRequests.findIndex(request =>
|
|
199
213
|
request.leafSlot.equals(leafSlot),
|
|
@@ -202,14 +216,14 @@ export class PublicProcessor {
|
|
|
202
216
|
const balance =
|
|
203
217
|
existingBalanceWriteIndex > -1
|
|
204
218
|
? finalPublicDataUpdateRequests[existingBalanceWriteIndex].newValue
|
|
205
|
-
: await this.publicStateDB.storageRead(
|
|
219
|
+
: await this.publicStateDB.storageRead(feeJuiceAddress, balanceSlot);
|
|
206
220
|
|
|
207
221
|
if (balance.lt(txFee)) {
|
|
208
222
|
throw new Error(`Not enough balance for fee payer to pay for transaction (got ${balance} needs ${txFee})`);
|
|
209
223
|
}
|
|
210
224
|
|
|
211
225
|
const updatedBalance = balance.sub(txFee);
|
|
212
|
-
await this.publicStateDB.storageWrite(
|
|
226
|
+
await this.publicStateDB.storageWrite(feeJuiceAddress, balanceSlot, updatedBalance);
|
|
213
227
|
|
|
214
228
|
finalPublicDataUpdateRequests[
|
|
215
229
|
existingBalanceWriteIndex > -1 ? existingBalanceWriteIndex : MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX
|
|
@@ -222,6 +236,7 @@ export class PublicProcessor {
|
|
|
222
236
|
[Attributes.TX_HASH]: tx.getTxHash().toString(),
|
|
223
237
|
}))
|
|
224
238
|
private async processTxWithPublicCalls(tx: Tx): Promise<[ProcessedTx, NestedProcessReturnValues[]]> {
|
|
239
|
+
const timer = new Timer();
|
|
225
240
|
let returnValues: NestedProcessReturnValues[] = [];
|
|
226
241
|
const publicProvingRequests: PublicProvingRequest[] = [];
|
|
227
242
|
let phase: AbstractPhaseManager | undefined = PhaseManagerFactory.phaseFromTx(
|
|
@@ -240,8 +255,18 @@ export class PublicProcessor {
|
|
|
240
255
|
let finalKernelOutput: KernelCircuitPublicInputs | undefined;
|
|
241
256
|
let revertReason: SimulationError | undefined;
|
|
242
257
|
const gasUsed: ProcessedTx['gasUsed'] = {};
|
|
258
|
+
let phaseCount = 0;
|
|
243
259
|
while (phase) {
|
|
260
|
+
phaseCount++;
|
|
261
|
+
const phaseTimer = new Timer();
|
|
244
262
|
const output = await phase.handle(tx, publicKernelPublicInput, lastKernelArtifact);
|
|
263
|
+
|
|
264
|
+
if (output.revertReason) {
|
|
265
|
+
this.metrics.recordRevertedPhase(phase.phase);
|
|
266
|
+
} else {
|
|
267
|
+
this.metrics.recordPhaseDuration(phase.phase, phaseTimer.ms());
|
|
268
|
+
}
|
|
269
|
+
|
|
245
270
|
gasUsed[phase.phase] = output.gasUsed;
|
|
246
271
|
if (phase.phase === PublicKernelType.APP_LOGIC) {
|
|
247
272
|
returnValues = output.returnValues;
|
|
@@ -265,9 +290,15 @@ export class PublicProcessor {
|
|
|
265
290
|
}
|
|
266
291
|
|
|
267
292
|
if (!finalKernelOutput) {
|
|
293
|
+
this.metrics.recordFailedTx();
|
|
268
294
|
throw new Error('Final public kernel was not executed.');
|
|
269
295
|
}
|
|
270
296
|
|
|
297
|
+
this.metrics.recordClassRegistration(
|
|
298
|
+
...ContractClassRegisteredEvent.fromLogs(tx.unencryptedLogs.unrollLogs(), ClassRegistererAddress),
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
this.metrics.recordTx(phaseCount, timer.ms());
|
|
271
302
|
const processedTx = makeProcessedTx(tx, finalKernelOutput, publicProvingRequests, revertReason, gasUsed);
|
|
272
303
|
return [processedTx, returnValues];
|
|
273
304
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type PublicKernelType } from '@aztec/circuit-types';
|
|
2
|
+
import { type ContractClassRegisteredEvent } from '@aztec/circuits.js';
|
|
3
|
+
import {
|
|
4
|
+
Attributes,
|
|
5
|
+
type Histogram,
|
|
6
|
+
Metrics,
|
|
7
|
+
type TelemetryClient,
|
|
8
|
+
type Tracer,
|
|
9
|
+
type UpDownCounter,
|
|
10
|
+
ValueType,
|
|
11
|
+
} from '@aztec/telemetry-client';
|
|
12
|
+
|
|
13
|
+
export class PublicProcessorMetrics {
|
|
14
|
+
public readonly tracer: Tracer;
|
|
15
|
+
|
|
16
|
+
private txDuration: Histogram;
|
|
17
|
+
private txCount: UpDownCounter;
|
|
18
|
+
private txPhaseCount: UpDownCounter;
|
|
19
|
+
|
|
20
|
+
private phaseDuration: Histogram;
|
|
21
|
+
private phaseCount: UpDownCounter;
|
|
22
|
+
|
|
23
|
+
private bytecodeDeployed: Histogram;
|
|
24
|
+
|
|
25
|
+
constructor(client: TelemetryClient, name = 'PublicProcessor') {
|
|
26
|
+
this.tracer = client.getTracer(name);
|
|
27
|
+
const meter = client.getMeter(name);
|
|
28
|
+
|
|
29
|
+
this.txDuration = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_TX_DURATION, {
|
|
30
|
+
description: 'How long it takes to process a transaction',
|
|
31
|
+
unit: 'ms',
|
|
32
|
+
valueType: ValueType.INT,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
this.txCount = meter.createUpDownCounter(Metrics.PUBLIC_PROCESSOR_TX_COUNT, {
|
|
36
|
+
description: 'Number of transactions processed',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
this.txPhaseCount = meter.createUpDownCounter(Metrics.PUBLIC_PROCESSOR_TX_PHASE_COUNT, {
|
|
40
|
+
description: 'Number of phases processed',
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
this.phaseDuration = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_PHASE_DURATION, {
|
|
44
|
+
description: 'How long it takes to process a phase',
|
|
45
|
+
unit: 'ms',
|
|
46
|
+
valueType: ValueType.INT,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
this.phaseCount = meter.createUpDownCounter(Metrics.PUBLIC_PROCESSOR_PHASE_COUNT, {
|
|
50
|
+
description: 'Number of failed phases',
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
this.bytecodeDeployed = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_DEPLOY_BYTECODE_SIZE, {
|
|
54
|
+
description: 'Size of deployed bytecode',
|
|
55
|
+
unit: 'By',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
recordPhaseDuration(phaseName: PublicKernelType, durationMs: number) {
|
|
60
|
+
this.phaseCount.add(1, { [Attributes.TX_PHASE_NAME]: phaseName, [Attributes.OK]: true });
|
|
61
|
+
this.phaseDuration.record(Math.ceil(durationMs), { [Attributes.TX_PHASE_NAME]: phaseName });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
recordTx(phaseCount: number, durationMs: number) {
|
|
65
|
+
this.txPhaseCount.add(phaseCount);
|
|
66
|
+
this.txDuration.record(Math.ceil(durationMs));
|
|
67
|
+
this.txCount.add(1, {
|
|
68
|
+
[Attributes.OK]: true,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
recordFailedTx() {
|
|
73
|
+
this.txCount.add(1, {
|
|
74
|
+
[Attributes.OK]: false,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
recordRevertedPhase(phaseName: PublicKernelType) {
|
|
79
|
+
this.phaseCount.add(1, { [Attributes.TX_PHASE_NAME]: phaseName, [Attributes.OK]: false });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
recordClassRegistration(...events: ContractClassRegisteredEvent[]) {
|
|
83
|
+
let totalBytecode = 0;
|
|
84
|
+
for (const event of events) {
|
|
85
|
+
totalBytecode += event.packedPublicBytecode.length;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
this.bytecodeDeployed.record(totalBytecode);
|
|
89
|
+
}
|
|
90
|
+
}
|
package/dest/utils.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Fr } from '@aztec/foundation/fields';
|
|
2
|
-
/**
|
|
3
|
-
* Computes the resulting storage slot for an entry in a mapping.
|
|
4
|
-
* @param mappingSlot - The slot of the mapping within state.
|
|
5
|
-
* @param key - The key of the mapping.
|
|
6
|
-
* @returns The slot in the contract storage where the value is stored.
|
|
7
|
-
*/
|
|
8
|
-
export declare function computeSlotForMapping(mappingSlot: Fr, key: {
|
|
9
|
-
/** Serialize to a field. */
|
|
10
|
-
toField: () => Fr;
|
|
11
|
-
}): Fr;
|
|
12
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dest/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,EAAE,EACf,GAAG,EAAE;IACH,4BAA4B;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,MAGF"}
|
package/dest/utils.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { pedersenHash } from '@aztec/foundation/crypto';
|
|
2
|
-
/**
|
|
3
|
-
* Computes the resulting storage slot for an entry in a mapping.
|
|
4
|
-
* @param mappingSlot - The slot of the mapping within state.
|
|
5
|
-
* @param key - The key of the mapping.
|
|
6
|
-
* @returns The slot in the contract storage where the value is stored.
|
|
7
|
-
*/
|
|
8
|
-
export function computeSlotForMapping(mappingSlot, key) {
|
|
9
|
-
return pedersenHash([mappingSlot, key.toField()]);
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBR3hEOzs7OztHQUtHO0FBQ0gsTUFBTSxVQUFVLHFCQUFxQixDQUNuQyxXQUFlLEVBQ2YsR0FHQztJQUVELE9BQU8sWUFBWSxDQUFDLENBQUMsV0FBVyxFQUFFLEdBQUcsQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQUFDLENBQUM7QUFDcEQsQ0FBQyJ9
|
package/src/utils.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { pedersenHash } from '@aztec/foundation/crypto';
|
|
2
|
-
import { type Fr } from '@aztec/foundation/fields';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Computes the resulting storage slot for an entry in a mapping.
|
|
6
|
-
* @param mappingSlot - The slot of the mapping within state.
|
|
7
|
-
* @param key - The key of the mapping.
|
|
8
|
-
* @returns The slot in the contract storage where the value is stored.
|
|
9
|
-
*/
|
|
10
|
-
export function computeSlotForMapping(
|
|
11
|
-
mappingSlot: Fr,
|
|
12
|
-
key: {
|
|
13
|
-
/** Serialize to a field. */
|
|
14
|
-
toField: () => Fr;
|
|
15
|
-
},
|
|
16
|
-
) {
|
|
17
|
-
return pedersenHash([mappingSlot, key.toField()]);
|
|
18
|
-
}
|