@aztec/simulator 0.85.0-alpha-testnet.2 → 0.85.0-nightly.20250418
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/public/avm/fixtures/avm_simulation_tester.d.ts +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.js +1 -1
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +1 -1
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/index.d.ts +1 -1
- package/dest/public/avm/index.d.ts.map +1 -1
- package/dest/public/avm/index.js +1 -1
- package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
- package/dest/public/avm/opcodes/accrued_substate.js +1 -1
- package/dest/{common → public}/debug_fn_name.d.ts +1 -1
- package/dest/{common → public}/debug_fn_name.d.ts.map +1 -1
- package/dest/public/fixtures/index.d.ts +1 -0
- package/dest/public/fixtures/index.d.ts.map +1 -1
- package/dest/public/fixtures/index.js +1 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +3 -4
- package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -0
- package/dest/public/{avm/fixtures → fixtures}/simple_contract_data_source.js +1 -1
- package/dest/public/hinting_db_sources.d.ts +15 -5
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/hinting_db_sources.js +65 -27
- package/dest/public/index.d.ts +3 -5
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +3 -5
- package/dest/public/public_db_sources.d.ts +19 -52
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +96 -107
- package/dest/public/public_processor/public_processor.d.ts +6 -6
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +24 -26
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +3 -2
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +2 -2
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +3 -4
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +11 -21
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +5 -4
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +21 -10
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +3 -2
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +2 -2
- package/dest/public/side_effect_trace.d.ts +1 -3
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +3 -2
- package/dest/public/state_manager/state_manager.d.ts +6 -4
- package/dest/public/state_manager/state_manager.d.ts.map +1 -1
- package/dest/public/state_manager/state_manager.js +20 -41
- package/package.json +14 -16
- package/src/public/avm/fixtures/avm_simulation_tester.ts +1 -1
- package/src/public/avm/fixtures/base_avm_simulation_tester.ts +1 -1
- package/src/public/avm/index.ts +1 -1
- package/src/public/avm/opcodes/accrued_substate.ts +1 -5
- package/src/{common → public}/debug_fn_name.ts +1 -1
- package/src/public/fixtures/index.ts +1 -0
- package/src/public/fixtures/public_tx_simulation_tester.ts +3 -5
- package/src/public/{avm/fixtures → fixtures}/simple_contract_data_source.ts +1 -1
- package/src/public/hinting_db_sources.ts +104 -39
- package/src/public/index.ts +3 -5
- package/src/public/public_db_sources.ts +111 -164
- package/src/public/public_processor/public_processor.ts +27 -29
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +4 -3
- package/src/public/public_tx_simulator/public_tx_context.ts +10 -47
- package/src/public/public_tx_simulator/public_tx_simulator.ts +25 -10
- package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +4 -3
- package/src/public/side_effect_trace.ts +2 -4
- package/src/public/state_manager/state_manager.ts +24 -50
- package/dest/public/avm/fixtures/simple_contract_data_source.d.ts.map +0 -1
- /package/dest/{common → public}/debug_fn_name.js +0 -0
- /package/dest/public/{avm/fixtures → fixtures}/simple_contract_data_source.d.ts +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
2
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
3
3
|
import type { AvmContractCallResult } from '../../avm/avm_contract_call_result.js';
|
|
4
|
+
import { SimpleContractDataSource } from '../../fixtures/simple_contract_data_source.js';
|
|
4
5
|
import { PublicPersistableStateManager } from '../../state_manager/state_manager.js';
|
|
5
6
|
import { BaseAvmSimulationTester } from './base_avm_simulation_tester.js';
|
|
6
|
-
import { SimpleContractDataSource } from './simple_contract_data_source.js';
|
|
7
7
|
/**
|
|
8
8
|
* A test class that extends the BaseAvmSimulationTester to enable real-app testing of the core AvmSimulator.
|
|
9
9
|
* It provides an interface for simulating one top-level call at a time and maintains state between
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avm_simulation_tester.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/fixtures/avm_simulation_tester.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAKjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"avm_simulation_tester.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/fixtures/avm_simulation_tester.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAKjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AASnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAEzF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AAErF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAK1E;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,uBAAuB;IAI5D,OAAO,CAAC,YAAY;gBAFpB,kBAAkB,EAAE,wBAAwB,EAC5C,WAAW,EAAE,yBAAyB,EAC9B,YAAY,EAAE,6BAA6B;WAKxC,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAmBnD;;OAEG;IACG,YAAY,CAChB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,GAAG,EAAE,EACX,YAAY,UAAQ,GACnB,OAAO,CAAC,qBAAqB,CAAC;CAsClC"}
|
|
@@ -5,11 +5,11 @@ import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
|
5
5
|
import { NativeWorldStateService } from '@aztec/world-state';
|
|
6
6
|
import { SideEffectTrace } from '../../../public/side_effect_trace.js';
|
|
7
7
|
import { DEFAULT_BLOCK_NUMBER, getContractFunctionAbi, getFunctionSelector, initContext, initExecutionEnvironment, resolveContractAssertionMessage } from '../../avm/fixtures/index.js';
|
|
8
|
+
import { SimpleContractDataSource } from '../../fixtures/simple_contract_data_source.js';
|
|
8
9
|
import { PublicContractsDB, PublicTreesDB } from '../../public_db_sources.js';
|
|
9
10
|
import { PublicPersistableStateManager } from '../../state_manager/state_manager.js';
|
|
10
11
|
import { AvmSimulator } from '../avm_simulator.js';
|
|
11
12
|
import { BaseAvmSimulationTester } from './base_avm_simulation_tester.js';
|
|
12
|
-
import { SimpleContractDataSource } from './simple_contract_data_source.js';
|
|
13
13
|
const TIMESTAMP = new Fr(99833);
|
|
14
14
|
const DEFAULT_GAS_FEES = new GasFees(2, 3);
|
|
15
15
|
/**
|
|
@@ -3,7 +3,7 @@ import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
5
5
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
6
|
-
import type { SimpleContractDataSource } from '
|
|
6
|
+
import type { SimpleContractDataSource } from '../../fixtures/simple_contract_data_source.js';
|
|
7
7
|
/**
|
|
8
8
|
* An abstract test class that enables tests of real apps in the AVM without requiring e2e tests.
|
|
9
9
|
* It enables this by letting us (1) perform pseudo-contract-deployments (and registrations)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base_avm_simulation_tester.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/fixtures/base_avm_simulation_tester.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"base_avm_simulation_tester.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/fixtures/base_avm_simulation_tester.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAGjF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAG9F;;;;;;;;;;GAUG;AACH,8BAAsB,uBAAuB;IAIlC,kBAAkB,EAAE,wBAAwB;IAC5C,WAAW,EAAE,yBAAyB;IAC7C,OAAO,CAAC,sBAAsB;IALzB,MAAM,yCAAyC;gBAG7C,kBAAkB,EAAE,wBAAwB,EAC5C,WAAW,EAAE,yBAAyB,EACrC,sBAAsB,KAAmB;IAG7C,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,KAA8B;IAMhF,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE;IAOjE;;;OAGG;IACG,yBAAyB,CAC7B,eAAe,EAAE,GAAG,EAAE,EACtB,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,sBAAsB,UAAQ,EAC9B,IAAI,SAAI,EACR,uBAAuB,CAAC,EAAE,EAAE,GAC3B,OAAO,CAAC,2BAA2B,CAAC;IAiBjC,wBAAwB,IAAI,OAAO,CAAC,2BAA2B,CAAC;IAWhE,mBAAmB,CAAC,gBAAgB,EAAE,2BAA2B,EAAE,sBAAsB,UAAQ;YAOzF,8BAA8B;CAO7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/avm/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/avm/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,4CAA4C,CAAC"}
|
package/dest/public/avm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './avm_simulator.js';
|
|
2
|
-
export * from '
|
|
2
|
+
export * from '../fixtures/simple_contract_data_source.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accrued_substate.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/opcodes/accrued_substate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAEpF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,cAAe,SAAQ,WAAW;IAa3C,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,YAAY;IAftB,MAAM,CAAC,IAAI,EAAE,MAAM,CAAoB;IACvC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAyB;IAEvD,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAMxB;gBAGQ,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM;IAKjB,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAezD;AAED,qBAAa,YAAa,SAAQ,WAAW;IAM/B,OAAO,CAAC,QAAQ;IAAU,OAAO,CAAC,cAAc;IAL5D,MAAM,CAAC,IAAI,EAAE,MAAM,CAAkB;IACrC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAuB;IAErD,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAA8D;gBAEpE,QAAQ,EAAE,MAAM,EAAU,cAAc,EAAE,MAAM;IAIvD,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBzD;AAED,qBAAa,eAAgB,SAAQ,WAAW;IAa5C,O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AAE,MAAM,CAAwB;IAC3C,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAA6B;IAE3D,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAkF;gBAExF,QAAQ,EAAE,MAAM,EAAU,SAAS,EAAE,MAAM,EAAU,aAAa,EAAE,MAAM;IAIjF,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAoBzD;AAED,qBAAa,iBAAkB,SAAQ,WAAW;IAMpC,OAAO,CAAC,QAAQ;IAAU,OAAO,CAAC,eAAe;IAAU,OAAO,CAAC,aAAa;IAL5F,MAAM,CAAC,IAAI,EAAE,MAAM,CAAmB;IACtC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAwB;IAEtD,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAkF;gBAExF,QAAQ,EAAE,MAAM,EAAU,eAAe,EAAE,MAAM,EAAU,aAAa,EAAE,MAAM;IAIvF,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBzD"}
|
|
@@ -175,7 +175,7 @@ export class L1ToL2MessageExists extends Instruction {
|
|
|
175
175
|
memory.checkTags(TypeTag.FIELD, msgHashOffset, msgLeafIndexOffset);
|
|
176
176
|
const msgHash = memory.get(msgHashOffset).toFr();
|
|
177
177
|
const msgLeafIndex = memory.get(msgLeafIndexOffset).toFr();
|
|
178
|
-
const exists = await context.persistableState.checkL1ToL2MessageExists(
|
|
178
|
+
const exists = await context.persistableState.checkL1ToL2MessageExists(msgHash, msgLeafIndex);
|
|
179
179
|
memory.set(existsOffset, exists ? new Uint1(1) : new Uint1(0));
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { PublicContractsDBInterface } from '
|
|
3
|
+
import type { PublicContractsDBInterface } from './db_interfaces.js';
|
|
4
4
|
export declare function getPublicFunctionDebugName(db: PublicContractsDBInterface, contractAddress: AztecAddress, calldata: Fr[]): Promise<string>;
|
|
5
5
|
//# sourceMappingURL=debug_fn_name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug_fn_name.d.ts","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"debug_fn_name.d.ts","sourceRoot":"","sources":["../../src/public/debug_fn_name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAErE,wBAAsB,0BAA0B,CAC9C,EAAE,EAAE,0BAA0B,EAC9B,eAAe,EAAE,YAAY,EAC7B,QAAQ,EAAE,EAAE,EAAE,GACb,OAAO,CAAC,MAAM,CAAC,CAOjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,YAAY,CAAC;AAC3B,cAAc,kCAAkC,CAAC"}
|
|
@@ -4,9 +4,9 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
4
4
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
5
5
|
import { GlobalVariables, type Tx } from '@aztec/stdlib/tx';
|
|
6
6
|
import { BaseAvmSimulationTester } from '../avm/fixtures/base_avm_simulation_tester.js';
|
|
7
|
-
import { SimpleContractDataSource } from '../avm/fixtures/simple_contract_data_source.js';
|
|
8
7
|
import type { PublicTxResult } from '../public_tx_simulator/public_tx_simulator.js';
|
|
9
8
|
import { TestExecutorMetrics } from '../test_executor_metrics.js';
|
|
9
|
+
import { SimpleContractDataSource } from './simple_contract_data_source.js';
|
|
10
10
|
export type TestEnqueuedCall = {
|
|
11
11
|
sender?: AztecAddress;
|
|
12
12
|
address: AztecAddress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_tx_simulation_tester.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/public_tx_simulation_tester.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAiC,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAG3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"public_tx_simulation_tester.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/public_tx_simulation_tester.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAiC,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAG3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAIxF,OAAO,KAAK,EAAE,cAAc,E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sB,GAC9B,OAAO,CAAC,cAAc,CAAC;IAyBb,mBAAmB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,EACpB,UAAU,CAAC,EAAE,gBAAgB,EAAE,EAC/B,QAAQ,CAAC,EAAE,gBAAgB,EAAE,EAC7B,YAAY,CAAC,EAAE,gBAAgB,EAC/B,QAAQ,CAAC,EAAE,YAAY,EACvB,cAAc,CAAC,EAAE,EAAE,GAClB,OAAO,CAAC,cAAc,CAAC;IAInB,kBAAkB;CAuB1B;AAED,wBAAgB,cAAc,oBAM7B"}
|
|
@@ -7,10 +7,10 @@ import { GlobalVariables, PublicCallRequestWithCalldata } from '@aztec/stdlib/tx
|
|
|
7
7
|
import { NativeWorldStateService } from '@aztec/world-state';
|
|
8
8
|
import { BaseAvmSimulationTester } from '../avm/fixtures/base_avm_simulation_tester.js';
|
|
9
9
|
import { DEFAULT_BLOCK_NUMBER, getContractFunctionAbi, getFunctionSelector } from '../avm/fixtures/index.js';
|
|
10
|
-
import {
|
|
11
|
-
import { PublicContractsDB, PublicTreesDB } from '../public_db_sources.js';
|
|
10
|
+
import { PublicContractsDB } from '../public_db_sources.js';
|
|
12
11
|
import { MeasuredPublicTxSimulator } from '../public_tx_simulator/measured_public_tx_simulator.js';
|
|
13
12
|
import { TestExecutorMetrics } from '../test_executor_metrics.js';
|
|
13
|
+
import { SimpleContractDataSource } from './simple_contract_data_source.js';
|
|
14
14
|
import { createTxForPublicCalls } from './utils.js';
|
|
15
15
|
const TIMESTAMP = new Fr(99833);
|
|
16
16
|
const DEFAULT_GAS_FEES = new GasFees(2, 3);
|
|
@@ -25,9 +25,8 @@ const DEFAULT_GAS_FEES = new GasFees(2, 3);
|
|
|
25
25
|
metricsPrefix;
|
|
26
26
|
constructor(merkleTree, contractDataSource, globals = defaultGlobals(), metrics = new TestExecutorMetrics()){
|
|
27
27
|
super(contractDataSource, merkleTree), this.metrics = metrics, this.txCount = 0;
|
|
28
|
-
const treesDB = new PublicTreesDB(merkleTree);
|
|
29
28
|
const contractsDB = new PublicContractsDB(contractDataSource);
|
|
30
|
-
this.simulator = new MeasuredPublicTxSimulator(
|
|
29
|
+
this.simulator = new MeasuredPublicTxSimulator(merkleTree, contractsDB, globals, /*doMerkleOperations=*/ true, /*skipFeeEnforcement=*/ false, this.metrics);
|
|
31
30
|
}
|
|
32
31
|
static async create(globals = defaultGlobals(), metrics = new TestExecutorMetrics()) {
|
|
33
32
|
const contractDataSource = new SimpleContractDataSource();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple_contract_data_source.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/simple_contract_data_source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAInH;;;;;;GAMG;AACH,qBAAa,wBAAyB,YAAW,kBAAkB;IAC1D,MAAM,yCAA+C;IAG5D,OAAO,CAAC,eAAe,CAA+C;IAEtE,OAAO,CAAC,iBAAiB,CAAuD;IAEhF,OAAO,CAAC,iBAAiB,CAA4C;IAErE,OAAO,CAAC,iBAAiB,CAAkC;IAI3D;;;OAGG;IACG,cAAc,CAClB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,mBAAmB,EAClC,gBAAgB,EAAE,2BAA2B;IAOzC,mBAAmB,CAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,gBAAgB;IAkBjE,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAIjC,gBAAgB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAIlE,qBAAqB,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAIvD,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC;IAIpF,mBAAmB,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;IAI9B,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAWjF,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAiB9F,kCAAkC,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhG,gBAAgB,CAAC,aAAa,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnE,mBAAmB,CAAC,gBAAgB,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;CAIlF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { getFunctionSelector } from '
|
|
2
|
+
import { getFunctionSelector } from '../avm/fixtures/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* This class is used during public/avm testing to function as a database of
|
|
5
5
|
* contract contract classes and instances. Tests can populate it with classes
|
|
@@ -6,9 +6,8 @@ import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
|
6
6
|
import { type AvmExecutionHints } from '@aztec/stdlib/avm';
|
|
7
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
8
|
import type { ContractClassPublic, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
9
|
-
import { type IndexedTreeId, MerkleTreeId, type MerkleTreeLeafType, type SequentialInsertionResult } from '@aztec/stdlib/trees';
|
|
9
|
+
import { type BatchInsertionResult, type IndexedTreeId, MerkleTreeId, type MerkleTreeLeafType, type MerkleTreeWriteOperations, type SequentialInsertionResult } from '@aztec/stdlib/trees';
|
|
10
10
|
import type { PublicContractsDBInterface } from './db_interfaces.js';
|
|
11
|
-
import { PublicTreesDB } from './public_db_sources.js';
|
|
12
11
|
/**
|
|
13
12
|
* A public contracts database that forwards requests and collects AVM hints.
|
|
14
13
|
*/
|
|
@@ -22,15 +21,17 @@ export declare class HintingPublicContractsDB implements PublicContractsDBInterf
|
|
|
22
21
|
getDebugFunctionName(contractAddress: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
|
-
* A
|
|
24
|
+
* A low-level merkle DB that collects hints.
|
|
26
25
|
*/
|
|
27
|
-
export declare class
|
|
26
|
+
export declare class HintingMerkleWriteOperations implements MerkleTreeWriteOperations {
|
|
27
|
+
private db;
|
|
28
28
|
private hints;
|
|
29
29
|
private static readonly log;
|
|
30
30
|
private checkpointStack;
|
|
31
31
|
private nextCheckpointId;
|
|
32
32
|
private checkpointActionCounter;
|
|
33
|
-
|
|
33
|
+
static create(db: MerkleTreeWriteOperations, hints: AvmExecutionHints): Promise<HintingMerkleWriteOperations>;
|
|
34
|
+
private constructor();
|
|
34
35
|
getSiblingPath<N extends number>(treeId: MerkleTreeId, index: bigint): Promise<SiblingPath<N>>;
|
|
35
36
|
getPreviousValueIndex<ID extends IndexedTreeId>(treeId: ID, value: bigint): Promise<{
|
|
36
37
|
index: bigint;
|
|
@@ -48,5 +49,14 @@ export declare class HintingPublicTreesDB extends PublicTreesDB {
|
|
|
48
49
|
private getTreesStateHash;
|
|
49
50
|
private static logTreeChange;
|
|
50
51
|
private appendLeafInternal;
|
|
52
|
+
getTreeInfo(treeId: MerkleTreeId): Promise<import("@aztec/stdlib/trees").TreeInfo>;
|
|
53
|
+
getStateReference(): Promise<import("@aztec/stdlib/tx").StateReference>;
|
|
54
|
+
getInitialHeader(): import("@aztec/stdlib/tx").BlockHeader;
|
|
55
|
+
updateArchive(header: any): Promise<void>;
|
|
56
|
+
batchInsert<TreeHeight extends number, SubtreeSiblingPathHeight extends number, ID extends IndexedTreeId>(treeId: ID, leaves: Buffer[], subtreeHeight: number): Promise<BatchInsertionResult<TreeHeight, SubtreeSiblingPathHeight>>;
|
|
57
|
+
close(): Promise<void>;
|
|
58
|
+
findLeafIndices<ID extends MerkleTreeId>(treeId: ID, values: MerkleTreeLeafType<ID>[]): Promise<(bigint | undefined)[]>;
|
|
59
|
+
findLeafIndicesAfter<ID extends MerkleTreeId>(treeId: ID, values: MerkleTreeLeafType<ID>[], startIndex: bigint): Promise<(bigint | undefined)[]>;
|
|
60
|
+
getBlockNumbersForLeafIndices<ID extends MerkleTreeId>(treeId: ID, leafIndices: bigint[]): Promise<(bigint | undefined)[]>;
|
|
51
61
|
}
|
|
52
62
|
//# sourceMappingURL=hinting_db_sources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hinting_db_sources.d.ts","sourceRoot":"","sources":["../../src/public/hinting_db_sources.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAOL,KAAK,iBAAiB,EASvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAEL,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"hinting_db_sources.d.ts","sourceRoot":"","sources":["../../src/public/hinting_db_sources.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC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O,CAAC,IAAI,CAAC;YAsChC,UAAU;IAKxB,OAAO,CAAC,sBAAsB;YAKhB,iBAAiB;IAK/B,OAAO,CAAC,MAAM,CAAC,aAAa;YAYd,kBAAkB;IAqBnB,WAAW,CAAC,MAAM,EAAE,YAAY;IAIhC,iBAAiB;IAIvB,gBAAgB;IAIV,aAAa,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,WAAW,CACtB,UAAU,SAAS,MAAM,EACzB,wBAAwB,SAAS,MAAM,EACvC,EAAE,SAAS,aAAa,EAExB,MAAM,EAAE,EAAE,EACV,MAAM,EAAE,MAAM,EAAE,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,oBAAoB,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC;IAIzD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,eAAe,CAAC,EAAE,SAAS,YAAY,EAClD,MAAM,EAAE,EAAE,EACV,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,EAAE,GAC/B,OAAO,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAIrB,oBAAoB,CAAC,EAAE,SAAS,YAAY,EACvD,MAAM,EAAE,EAAE,EACV,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAIrB,6BAA6B,CAAC,EAAE,SAAS,YAAY,EAChE,MAAM,EAAE,EAAE,EACV,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;CAGnC"}
|
|
@@ -3,8 +3,8 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { AvmAppendLeavesHint, AvmBytecodeCommitmentHint, AvmCommitCheckpointHint, AvmContractClassHint, AvmContractInstanceHint, AvmCreateCheckpointHint, AvmGetLeafPreimageHintNullifierTree, AvmGetLeafPreimageHintPublicDataTree, AvmGetLeafValueHint, AvmGetPreviousValueIndexHint, AvmGetSiblingPathHint, AvmRevertCheckpointHint, AvmSequentialInsertHintNullifierTree, AvmSequentialInsertHintPublicDataTree } from '@aztec/stdlib/avm';
|
|
5
5
|
import { AppendOnlyTreeSnapshot, MerkleTreeId, NullifierLeaf, PublicDataTreeLeaf, getTreeName, merkleTreeIds } from '@aztec/stdlib/trees';
|
|
6
|
+
import { TreeSnapshots } from '@aztec/stdlib/tx';
|
|
6
7
|
import { strict as assert } from 'assert';
|
|
7
|
-
import { PublicTreesDB } from './public_db_sources.js';
|
|
8
8
|
/**
|
|
9
9
|
* A public contracts database that forwards requests and collects AVM hints.
|
|
10
10
|
*/ export class HintingPublicContractsDB {
|
|
@@ -41,10 +41,11 @@ import { PublicTreesDB } from './public_db_sources.js';
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* A
|
|
45
|
-
*/ export class
|
|
44
|
+
* A low-level merkle DB that collects hints.
|
|
45
|
+
*/ export class HintingMerkleWriteOperations {
|
|
46
|
+
db;
|
|
46
47
|
hints;
|
|
47
|
-
static log = createLogger('
|
|
48
|
+
static log = createLogger('simulator:hinting-merkle-db');
|
|
48
49
|
// This stack is only for debugging purposes.
|
|
49
50
|
// The top of the stack is the current checkpoint id.
|
|
50
51
|
// We need the stack to be non-empty and use 0 as an arbitrary initial checkpoint id.
|
|
@@ -52,20 +53,31 @@ import { PublicTreesDB } from './public_db_sources.js';
|
|
|
52
53
|
checkpointStack;
|
|
53
54
|
nextCheckpointId;
|
|
54
55
|
checkpointActionCounter;
|
|
56
|
+
static async create(db, hints) {
|
|
57
|
+
const hintingTreesDB = new HintingMerkleWriteOperations(db, hints);
|
|
58
|
+
const startStateReference = await db.getStateReference();
|
|
59
|
+
hints.startingTreeRoots = new TreeSnapshots(startStateReference.l1ToL2MessageTree, startStateReference.partial.noteHashTree, startStateReference.partial.nullifierTree, startStateReference.partial.publicDataTree);
|
|
60
|
+
return hintingTreesDB;
|
|
61
|
+
}
|
|
62
|
+
// Use create() to instantiate.
|
|
55
63
|
constructor(db, hints){
|
|
56
|
-
|
|
64
|
+
this.db = db;
|
|
65
|
+
this.hints = hints;
|
|
66
|
+
this.checkpointStack = [
|
|
57
67
|
0
|
|
58
|
-
]
|
|
68
|
+
];
|
|
69
|
+
this.nextCheckpointId = 1;
|
|
70
|
+
this.checkpointActionCounter = 0;
|
|
59
71
|
}
|
|
60
72
|
// Getters.
|
|
61
73
|
async getSiblingPath(treeId, index) {
|
|
62
|
-
const path = await
|
|
74
|
+
const path = await this.db.getSiblingPath(treeId, index);
|
|
63
75
|
const key = await this.getHintKey(treeId);
|
|
64
76
|
this.hints.getSiblingPathHints.push(new AvmGetSiblingPathHint(key, treeId, index, path.toFields()));
|
|
65
77
|
return Promise.resolve(path);
|
|
66
78
|
}
|
|
67
79
|
async getPreviousValueIndex(treeId, value) {
|
|
68
|
-
const result = await
|
|
80
|
+
const result = await this.db.getPreviousValueIndex(treeId, value);
|
|
69
81
|
if (result === undefined) {
|
|
70
82
|
throw new Error(`getPreviousValueIndex(${getTreeName(treeId)}, ${value}}) returned undefined. Possible wrong tree setup or corrupted state.`);
|
|
71
83
|
}
|
|
@@ -74,7 +86,7 @@ import { PublicTreesDB } from './public_db_sources.js';
|
|
|
74
86
|
return result;
|
|
75
87
|
}
|
|
76
88
|
async getLeafPreimage(treeId, index) {
|
|
77
|
-
const preimage = await
|
|
89
|
+
const preimage = await this.db.getLeafPreimage(treeId, index);
|
|
78
90
|
if (preimage) {
|
|
79
91
|
const key = await this.getHintKey(treeId);
|
|
80
92
|
switch(treeId){
|
|
@@ -95,7 +107,7 @@ import { PublicTreesDB } from './public_db_sources.js';
|
|
|
95
107
|
async getLeafValue(treeId, index) {
|
|
96
108
|
// Use getLeafPreimage for PublicDataTree and NullifierTree.
|
|
97
109
|
assert(treeId == MerkleTreeId.NOTE_HASH_TREE || treeId == MerkleTreeId.L1_TO_L2_MESSAGE_TREE);
|
|
98
|
-
const value = await
|
|
110
|
+
const value = await this.db.getLeafValue(treeId, index);
|
|
99
111
|
if (value) {
|
|
100
112
|
const key = await this.getHintKey(treeId);
|
|
101
113
|
// We can cast to Fr because we know the type of the tree.
|
|
@@ -112,10 +124,9 @@ import { PublicTreesDB } from './public_db_sources.js';
|
|
|
112
124
|
// We only support 1 leaf at a time for now. Can easily be extended.
|
|
113
125
|
assert(leaves.length === 1, 'sequentialInsert supports only one leaf at a time!');
|
|
114
126
|
const beforeState = await this.getHintKey(treeId);
|
|
115
|
-
const result = await
|
|
127
|
+
const result = await this.db.sequentialInsert(treeId, leaves);
|
|
116
128
|
const afterState = await this.getHintKey(treeId);
|
|
117
|
-
|
|
118
|
-
HintingPublicTreesDB.logTreeChange(beforeState, afterState, treeId);
|
|
129
|
+
HintingMerkleWriteOperations.logTreeChange('sequentialInsert', beforeState, afterState, treeId);
|
|
119
130
|
switch(treeId){
|
|
120
131
|
case MerkleTreeId.PUBLIC_DATA_TREE:
|
|
121
132
|
this.hints.sequentialInsertHintsPublicDataTree.push(new AvmSequentialInsertHintPublicDataTree(beforeState, afterState, treeId, PublicDataTreeLeaf.fromBuffer(leaves[0]), {
|
|
@@ -158,21 +169,21 @@ import { PublicTreesDB } from './public_db_sources.js';
|
|
|
158
169
|
const actionCounter = this.checkpointActionCounter++;
|
|
159
170
|
const oldCheckpointId = this.getCurrentCheckpointId();
|
|
160
171
|
const treesStateHash = await this.getTreesStateHash();
|
|
161
|
-
await
|
|
172
|
+
await this.db.createCheckpoint();
|
|
162
173
|
this.checkpointStack.push(this.nextCheckpointId++);
|
|
163
174
|
const newCheckpointId = this.getCurrentCheckpointId();
|
|
164
175
|
this.hints.createCheckpointHints.push(new AvmCreateCheckpointHint(actionCounter, oldCheckpointId, newCheckpointId));
|
|
165
|
-
|
|
176
|
+
HintingMerkleWriteOperations.log.trace(`[createCheckpoint:${actionCounter}] Checkpoint evolved ${oldCheckpointId} -> ${newCheckpointId} at trees state ${treesStateHash}.`);
|
|
166
177
|
}
|
|
167
178
|
async commitCheckpoint() {
|
|
168
179
|
const actionCounter = this.checkpointActionCounter++;
|
|
169
180
|
const oldCheckpointId = this.getCurrentCheckpointId();
|
|
170
181
|
const treesStateHash = await this.getTreesStateHash();
|
|
171
|
-
await
|
|
182
|
+
await this.db.commitCheckpoint();
|
|
172
183
|
this.checkpointStack.pop();
|
|
173
184
|
const newCheckpointId = this.getCurrentCheckpointId();
|
|
174
185
|
this.hints.commitCheckpointHints.push(new AvmCommitCheckpointHint(actionCounter, oldCheckpointId, newCheckpointId));
|
|
175
|
-
|
|
186
|
+
HintingMerkleWriteOperations.log.trace(`[commitCheckpoint:${actionCounter}] Checkpoint evolved ${oldCheckpointId} -> ${newCheckpointId} at trees state ${treesStateHash}.`);
|
|
176
187
|
}
|
|
177
188
|
async revertCheckpoint() {
|
|
178
189
|
const actionCounter = this.checkpointActionCounter++;
|
|
@@ -185,7 +196,7 @@ import { PublicTreesDB } from './public_db_sources.js';
|
|
|
185
196
|
[MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: await this.getHintKey(MerkleTreeId.L1_TO_L2_MESSAGE_TREE),
|
|
186
197
|
[MerkleTreeId.ARCHIVE]: await this.getHintKey(MerkleTreeId.ARCHIVE)
|
|
187
198
|
};
|
|
188
|
-
await
|
|
199
|
+
await this.db.revertCheckpoint();
|
|
189
200
|
this.checkpointStack.pop();
|
|
190
201
|
const newCheckpointId = this.getCurrentCheckpointId();
|
|
191
202
|
const afterState = {
|
|
@@ -196,14 +207,14 @@ import { PublicTreesDB } from './public_db_sources.js';
|
|
|
196
207
|
[MerkleTreeId.ARCHIVE]: await this.getHintKey(MerkleTreeId.ARCHIVE)
|
|
197
208
|
};
|
|
198
209
|
this.hints.revertCheckpointHints.push(AvmRevertCheckpointHint.create(actionCounter, oldCheckpointId, newCheckpointId, beforeState, afterState));
|
|
199
|
-
|
|
210
|
+
HintingMerkleWriteOperations.log.trace(`[revertCheckpoint:${actionCounter}] Checkpoint evolved ${oldCheckpointId} -> ${newCheckpointId} at trees state ${treesStateHash}.`);
|
|
200
211
|
for (const treeId of merkleTreeIds()){
|
|
201
|
-
|
|
212
|
+
HintingMerkleWriteOperations.logTreeChange('revertCheckpoint', beforeState[treeId], afterState[treeId], treeId);
|
|
202
213
|
}
|
|
203
214
|
}
|
|
204
215
|
// Private methods.
|
|
205
216
|
async getHintKey(treeId) {
|
|
206
|
-
const treeInfo = await
|
|
217
|
+
const treeInfo = await this.db.getTreeInfo(treeId);
|
|
207
218
|
return new AppendOnlyTreeSnapshot(Fr.fromBuffer(treeInfo.root), Number(treeInfo.size));
|
|
208
219
|
}
|
|
209
220
|
getCurrentCheckpointId() {
|
|
@@ -211,26 +222,53 @@ import { PublicTreesDB } from './public_db_sources.js';
|
|
|
211
222
|
}
|
|
212
223
|
// For logging/debugging purposes.
|
|
213
224
|
async getTreesStateHash() {
|
|
214
|
-
const stateReferenceFields = (await
|
|
225
|
+
const stateReferenceFields = (await this.db.getStateReference()).toFields();
|
|
215
226
|
return Fr.fromBuffer(sha256Trunc(Buffer.concat(stateReferenceFields.map((field)=>field.toBuffer()))));
|
|
216
227
|
}
|
|
217
|
-
static logTreeChange(beforeState, afterState, treeId) {
|
|
228
|
+
static logTreeChange(action, beforeState, afterState, treeId) {
|
|
218
229
|
const treeName = getTreeName(treeId);
|
|
219
|
-
|
|
230
|
+
HintingMerkleWriteOperations.log.trace(`[${action}] ${treeName} tree state: ${beforeState.root}, ${beforeState.nextAvailableLeafIndex} -> ${afterState.root}, ${afterState.nextAvailableLeafIndex}.`);
|
|
220
231
|
}
|
|
221
232
|
async appendLeafInternal(treeId, leaf) {
|
|
222
233
|
// Use sequentialInsert for PublicDataTree and NullifierTree.
|
|
223
234
|
assert(treeId == MerkleTreeId.NOTE_HASH_TREE || treeId == MerkleTreeId.L1_TO_L2_MESSAGE_TREE);
|
|
224
235
|
const beforeState = await this.getHintKey(treeId);
|
|
225
|
-
await
|
|
236
|
+
await this.db.appendLeaves(treeId, [
|
|
226
237
|
leaf
|
|
227
238
|
]);
|
|
228
239
|
const afterState = await this.getHintKey(treeId);
|
|
229
|
-
|
|
230
|
-
HintingPublicTreesDB.logTreeChange(beforeState, afterState, treeId);
|
|
240
|
+
HintingMerkleWriteOperations.logTreeChange('appendLeaves', beforeState, afterState, treeId);
|
|
231
241
|
this.hints.appendLeavesHints.push(new AvmAppendLeavesHint(beforeState, afterState, treeId, [
|
|
232
242
|
leaf
|
|
233
243
|
]));
|
|
234
244
|
return await this.getSiblingPath(treeId, BigInt(beforeState.nextAvailableLeafIndex));
|
|
235
245
|
}
|
|
246
|
+
// Non-hinted required methods from MerkleTreeWriteOperations interface
|
|
247
|
+
async getTreeInfo(treeId) {
|
|
248
|
+
return await this.db.getTreeInfo(treeId);
|
|
249
|
+
}
|
|
250
|
+
async getStateReference() {
|
|
251
|
+
return await this.db.getStateReference();
|
|
252
|
+
}
|
|
253
|
+
getInitialHeader() {
|
|
254
|
+
return this.db.getInitialHeader();
|
|
255
|
+
}
|
|
256
|
+
async updateArchive(header) {
|
|
257
|
+
return await this.db.updateArchive(header);
|
|
258
|
+
}
|
|
259
|
+
async batchInsert(treeId, leaves, subtreeHeight) {
|
|
260
|
+
return await this.db.batchInsert(treeId, leaves, subtreeHeight);
|
|
261
|
+
}
|
|
262
|
+
async close() {
|
|
263
|
+
return await this.db.close();
|
|
264
|
+
}
|
|
265
|
+
async findLeafIndices(treeId, values) {
|
|
266
|
+
return await this.db.findLeafIndices(treeId, values);
|
|
267
|
+
}
|
|
268
|
+
async findLeafIndicesAfter(treeId, values, startIndex) {
|
|
269
|
+
return await this.db.findLeafIndicesAfter(treeId, values, startIndex);
|
|
270
|
+
}
|
|
271
|
+
async getBlockNumbersForLeafIndices(treeId, leafIndices) {
|
|
272
|
+
return await this.db.getBlockNumbersForLeafIndices(treeId, leafIndices);
|
|
273
|
+
}
|
|
236
274
|
}
|
package/dest/public/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export * from './public_db_sources.js';
|
|
1
|
+
export { PublicContractsDB } from './public_db_sources.js';
|
|
2
|
+
export { type PublicTxResult, PublicTxSimulator, TelemetryPublicTxSimulator } from './public_tx_simulator/index.js';
|
|
4
3
|
export { PublicProcessor, PublicProcessorFactory } from './public_processor/public_processor.js';
|
|
5
|
-
export { SideEffectTrace } from './side_effect_trace.js';
|
|
6
4
|
export { PublicTxSimulationTester } from './fixtures/index.js';
|
|
7
|
-
export * from './avm/index.js';
|
|
8
5
|
export { getCallRequestsWithCalldataByPhase } from './utils.js';
|
|
6
|
+
export { SimpleContractDataSource } from './fixtures/simple_contract_data_source.js';
|
|
9
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/public/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/public/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,KAAK,cAAc,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AACpH,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AACjG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,kCAAkC,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC"}
|
package/dest/public/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export * from './public_db_sources.js';
|
|
1
|
+
export { PublicContractsDB } from './public_db_sources.js';
|
|
2
|
+
export { PublicTxSimulator, TelemetryPublicTxSimulator } from './public_tx_simulator/index.js';
|
|
4
3
|
export { PublicProcessor, PublicProcessorFactory } from './public_processor/public_processor.js';
|
|
5
|
-
export { SideEffectTrace } from './side_effect_trace.js';
|
|
6
4
|
export { PublicTxSimulationTester } from './fixtures/index.js';
|
|
7
|
-
export * from './avm/index.js';
|
|
8
5
|
export { getCallRequestsWithCalldataByPhase } from './utils.js';
|
|
6
|
+
export { SimpleContractDataSource } from './fixtures/simple_contract_data_source.js';
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import type { IndexedTreeLeafPreimage, SiblingPath } from '@aztec/foundation/trees';
|
|
5
2
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
4
|
import { type ContractClassPublic, type ContractDataSource, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
8
|
-
import type {
|
|
5
|
+
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
9
6
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
10
|
-
import
|
|
7
|
+
import { TreeSnapshots, type Tx } from '@aztec/stdlib/tx';
|
|
11
8
|
import type { PublicContractsDBInterface, PublicStateDBInterface } from './db_interfaces.js';
|
|
12
9
|
/**
|
|
13
10
|
* Implements the PublicContractsDBInterface using a ContractDataSource.
|
|
@@ -91,62 +88,32 @@ export declare class PublicContractsDB implements PublicContractsDBInterface {
|
|
|
91
88
|
getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
92
89
|
}
|
|
93
90
|
/**
|
|
94
|
-
*
|
|
91
|
+
* A high-level class that provides access to the merkle trees.
|
|
95
92
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
getStateReference(): Promise<StateReference>;
|
|
105
|
-
getInitialHeader(): BlockHeader;
|
|
106
|
-
getSiblingPath<N extends number>(treeId: MerkleTreeId, index: bigint): Promise<SiblingPath<N>>;
|
|
107
|
-
getPreviousValueIndex<ID extends IndexedTreeId>(treeId: ID, value: bigint): Promise<{
|
|
108
|
-
index: bigint;
|
|
109
|
-
alreadyPresent: boolean;
|
|
110
|
-
} | undefined>;
|
|
111
|
-
getLeafPreimage<ID extends IndexedTreeId>(treeId: ID, index: bigint): Promise<IndexedTreeLeafPreimage | undefined>;
|
|
112
|
-
findLeafIndices<ID extends MerkleTreeId>(treeId: ID, values: MerkleTreeLeafType<ID>[]): Promise<(bigint | undefined)[]>;
|
|
113
|
-
findLeafIndicesAfter<ID extends MerkleTreeId>(treeId: ID, values: MerkleTreeLeafType<ID>[], startIndex: bigint): Promise<(bigint | undefined)[]>;
|
|
114
|
-
getLeafValue<ID extends MerkleTreeId>(treeId: ID, index: bigint): Promise<MerkleTreeLeafType<typeof treeId> | undefined>;
|
|
115
|
-
getBlockNumbersForLeafIndices<ID extends MerkleTreeId>(treeId: ID, leafIndices: bigint[]): Promise<(bigint | undefined)[]>;
|
|
116
|
-
createCheckpoint(): Promise<void>;
|
|
117
|
-
commitCheckpoint(): Promise<void>;
|
|
118
|
-
revertCheckpoint(): Promise<void>;
|
|
119
|
-
appendLeaves<ID extends MerkleTreeId>(treeId: ID, leaves: MerkleTreeLeafType<ID>[]): Promise<void>;
|
|
120
|
-
updateArchive(header: BlockHeader): Promise<void>;
|
|
121
|
-
batchInsert<TreeHeight extends number, SubtreeSiblingPathHeight extends number, ID extends IndexedTreeId>(treeId: ID, leaves: Buffer[], subtreeHeight: number): Promise<BatchInsertionResult<TreeHeight, SubtreeSiblingPathHeight>>;
|
|
122
|
-
sequentialInsert<TreeHeight extends number, ID extends IndexedTreeId>(treeId: ID, leaves: Buffer[]): Promise<SequentialInsertionResult<TreeHeight>>;
|
|
123
|
-
close(): Promise<void>;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* A class that provides access to the merkle trees, and other helper methods.
|
|
93
|
+
* This class is just a helper wrapper around a merkle db. Anything that you can do with it
|
|
94
|
+
* can also be done directly with the merkle db. This class should NOT be exposed or used
|
|
95
|
+
* outside of `simulator/src/public`.
|
|
96
|
+
*
|
|
97
|
+
* NOTE: This class is currently written in such a way that it would generate the
|
|
98
|
+
* necessary hints if used with a hinting merkle db. This is a bit of a leak of concepts.
|
|
99
|
+
* Eventually we can have everything depend on a config/factory at the TxSimulator level
|
|
100
|
+
* to decide whether to use hints or not (same with tracing, etc).
|
|
127
101
|
*/
|
|
128
|
-
export declare class PublicTreesDB
|
|
102
|
+
export declare class PublicTreesDB implements PublicStateDBInterface {
|
|
103
|
+
private readonly db;
|
|
129
104
|
private logger;
|
|
130
105
|
constructor(db: MerkleTreeWriteOperations);
|
|
131
|
-
/**
|
|
132
|
-
* Reads a value from public storage, returning zero if none.
|
|
133
|
-
* @param contract - Owner of the storage.
|
|
134
|
-
* @param slot - Slot to read in the contract storage.
|
|
135
|
-
* @returns The current value in the storage slot.
|
|
136
|
-
*/
|
|
137
106
|
storageRead(contract: AztecAddress, slot: Fr): Promise<Fr>;
|
|
138
|
-
/**
|
|
139
|
-
* Records a write to public storage.
|
|
140
|
-
* @param contract - Owner of the storage.
|
|
141
|
-
* @param slot - Slot to read in the contract storage.
|
|
142
|
-
* @param newValue - The new value to store.
|
|
143
|
-
* @returns The slot of the written leaf in the public data tree.
|
|
144
|
-
*/
|
|
145
107
|
storageWrite(contract: AztecAddress, slot: Fr, newValue: Fr): Promise<void>;
|
|
146
108
|
getL1ToL2LeafValue(leafIndex: bigint): Promise<Fr | undefined>;
|
|
147
109
|
getNoteHash(leafIndex: bigint): Promise<Fr | undefined>;
|
|
110
|
+
writeNoteHash(noteHash: Fr): Promise<void>;
|
|
148
111
|
checkNullifierExists(nullifier: Fr): Promise<boolean>;
|
|
112
|
+
writeNullifier(siloedNullifier: Fr): Promise<void>;
|
|
149
113
|
padTree(treeId: MerkleTreeId, leavesToInsert: number): Promise<void>;
|
|
114
|
+
createCheckpoint(): Promise<void>;
|
|
115
|
+
commitCheckpoint(): Promise<void>;
|
|
116
|
+
revertCheckpoint(): Promise<void>;
|
|
117
|
+
getTreeSnapshots(): Promise<TreeSnapshots>;
|
|
150
118
|
}
|
|
151
|
-
export {};
|
|
152
119
|
//# sourceMappingURL=public_db_sources.d.ts.map
|