@aztec/pxe 0.0.1-commit.fff30aa → 0.0.1-dev
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/bin/check_oracle_version.js +1 -1
- package/dest/block_synchronizer/block_synchronizer.d.ts +5 -3
- package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
- package/dest/block_synchronizer/block_synchronizer.js +10 -2
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +4 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +18 -10
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +5 -2
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +4 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +53 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +10 -14
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +16 -14
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +19 -2
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +108 -5
- package/dest/contract_sync/contract_sync_service.d.ts +2 -1
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +41 -7
- package/dest/contract_sync/helpers.d.ts +2 -3
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/contract_sync/helpers.js +12 -19
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +2 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +2 -1
- package/dest/entrypoints/pxe_creation_options.d.ts +4 -1
- package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
- package/dest/entrypoints/server/index.d.ts +2 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +1 -0
- package/dest/entrypoints/server/utils.d.ts +1 -1
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +2 -1
- package/dest/events/event_service.d.ts +13 -5
- package/dest/events/event_service.d.ts.map +1 -1
- package/dest/events/event_service.js +28 -7
- package/dest/hooks/authorize_utility_call.d.ts +37 -0
- package/dest/hooks/authorize_utility_call.d.ts.map +1 -0
- package/dest/hooks/authorize_utility_call.js +4 -0
- package/dest/hooks/execution_hooks.d.ts +42 -0
- package/dest/hooks/execution_hooks.d.ts.map +1 -0
- package/dest/hooks/execution_hooks.js +9 -0
- package/dest/hooks/index.d.ts +4 -0
- package/dest/hooks/index.d.ts.map +1 -0
- package/dest/hooks/index.js +1 -0
- package/dest/logs/log_service.d.ts +1 -1
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +20 -35
- package/dest/messages/message_context_service.d.ts +1 -1
- package/dest/messages/message_context_service.d.ts.map +1 -1
- package/dest/messages/message_context_service.js +12 -10
- package/dest/notes/note_service.d.ts +25 -3
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +80 -65
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +2 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +18 -4
- package/dest/private_kernel/private_kernel_oracle.d.ts +1 -1
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +7 -2
- package/dest/pxe.d.ts +20 -5
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +61 -59
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts +42 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/kv_store_snapshot.js +93 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts +15 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/schema_tests.js +588 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts +19 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.d.ts.map +1 -0
- package/dest/storage/backwards_compatibility_tests/store_spy.js +63 -0
- package/dest/storage/open_pxe_stores.d.ts +31 -0
- package/dest/storage/open_pxe_stores.d.ts.map +1 -0
- package/dest/storage/open_pxe_stores.js +26 -0
- package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +3 -0
- package/dest/tagging/index.d.ts +4 -3
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +3 -2
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts +29 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/persist_sender_tagging_index_ranges.js +42 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts +56 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.d.ts.map +1 -0
- package/dest/tagging/recipient_sync/sync_tagged_private_logs.js +158 -0
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts +36 -0
- package/dest/tagging/reconcile_tagging_index_ranges.d.ts.map +1 -0
- package/dest/tagging/reconcile_tagging_index_ranges.js +74 -0
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +19 -8
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +11 -6
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +21 -0
- package/package.json +17 -16
- package/src/bin/check_oracle_version.ts +1 -1
- package/src/block_synchronizer/block_synchronizer.ts +11 -3
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +32 -9
- package/src/contract_function_simulator/oracle/interfaces.ts +12 -1
- package/src/contract_function_simulator/oracle/oracle.ts +73 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +25 -21
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +165 -29
- package/src/contract_sync/contract_sync_service.ts +55 -23
- package/src/contract_sync/helpers.ts +11 -23
- package/src/entrypoints/client/bundle/utils.ts +1 -0
- package/src/entrypoints/client/lazy/utils.ts +1 -0
- package/src/entrypoints/pxe_creation_options.ts +4 -0
- package/src/entrypoints/server/index.ts +1 -0
- package/src/entrypoints/server/utils.ts +1 -0
- package/src/events/event_service.ts +52 -17
- package/src/hooks/authorize_utility_call.ts +40 -0
- package/src/hooks/execution_hooks.ts +48 -0
- package/src/hooks/index.ts +7 -0
- package/src/logs/log_service.ts +46 -71
- package/src/messages/message_context_service.ts +25 -24
- package/src/notes/note_service.ts +115 -91
- package/src/oracle_version.ts +2 -2
- package/src/private_kernel/private_kernel_execution_prover.ts +29 -3
- package/src/private_kernel/private_kernel_oracle.ts +15 -5
- package/src/pxe.ts +116 -53
- package/src/storage/backwards_compatibility_tests/__snapshots__/AddressStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/AnchorBlockStore.json +3 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/CapsuleStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/ContractStore.json +28 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/KeyStore.json +52 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/L2TipsKVStore.json +42 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/NoteStore.json +36 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/PrivateEventStore.json +44 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/RecipientTaggingStore.json +18 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderAddressBookStore.json +16 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/SenderTaggingStore.json +22 -0
- package/src/storage/backwards_compatibility_tests/__snapshots__/opened_stores.json +97 -0
- package/src/storage/backwards_compatibility_tests/kv_store_snapshot.ts +122 -0
- package/src/storage/backwards_compatibility_tests/schema_tests.ts +707 -0
- package/src/storage/backwards_compatibility_tests/store_spy.ts +73 -0
- package/src/storage/open_pxe_stores.ts +47 -0
- package/src/tagging/get_all_logs_by_tags.ts +4 -0
- package/src/tagging/index.ts +3 -2
- package/src/tagging/persist_sender_tagging_index_ranges.ts +57 -0
- package/src/tagging/recipient_sync/sync_tagged_private_logs.ts +236 -0
- package/src/tagging/reconcile_tagging_index_ranges.ts +102 -0
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +33 -10
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +23 -8
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +0 -14
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +0 -85
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +0 -14
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +0 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +0 -33
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +0 -130
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +0 -44
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import type { AztecNode } from '@aztec/stdlib/interfaces/server';
|
|
2
2
|
import { TxHash } from '@aztec/stdlib/tx';
|
|
3
|
+
/** Classification of a batch of pending tx hashes by the status change implied by their receipts. */
|
|
4
|
+
export type StatusChange = {
|
|
5
|
+
txHashesToFinalize: TxHash[];
|
|
6
|
+
txHashesToDrop: TxHash[];
|
|
7
|
+
txHashesWithExecutionReverted: TxHash[];
|
|
8
|
+
};
|
|
9
|
+
export declare const EMPTY_STATUS_CHANGE: StatusChange;
|
|
10
|
+
/** Concatenates two status changes field-by-field. */
|
|
11
|
+
export declare function mergeStatusChanges(a: StatusChange, b: StatusChange): StatusChange;
|
|
3
12
|
/**
|
|
4
13
|
* Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized,
|
|
5
14
|
* dropped, or execution-reverted (but mined).
|
|
6
15
|
*/
|
|
7
|
-
export declare function getStatusChangeOfPending(pending: TxHash[], aztecNode: AztecNode): Promise<
|
|
8
|
-
|
|
9
|
-
txHashesToDrop: TxHash[];
|
|
10
|
-
txHashesWithExecutionReverted: TxHash[];
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsTUFBTSxFQUFZLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQ7OztHQUdHO0FBQ0gsd0JBQXNCLHdCQUF3QixDQUM1QyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQ2pCLFNBQVMsRUFBRSxTQUFTLEdBQ25CLE9BQU8sQ0FBQztJQUNULGtCQUFrQixFQUFFLE1BQU0sRUFBRSxDQUFDO0lBQzdCLGNBQWMsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUN6Qiw2QkFBNkIsRUFBRSxNQUFNLEVBQUUsQ0FBQztDQUN6QyxDQUFDLENBb0NEIn0=
|
|
16
|
+
export declare function getStatusChangeOfPending(pending: TxHash[], aztecNode: AztecNode): Promise<StatusChange>;
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3RhZ2dpbmcvc2VuZGVyX3N5bmMvdXRpbHMvZ2V0X3N0YXR1c19jaGFuZ2Vfb2ZfcGVuZGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNqRSxPQUFPLEVBQUUsTUFBTSxFQUFZLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQscUdBQXFHO0FBQ3JHLE1BQU0sTUFBTSxZQUFZLEdBQUc7SUFDekIsa0JBQWtCLEVBQUUsTUFBTSxFQUFFLENBQUM7SUFDN0IsY0FBYyxFQUFFLE1BQU0sRUFBRSxDQUFDO0lBQ3pCLDZCQUE2QixFQUFFLE1BQU0sRUFBRSxDQUFDO0NBQ3pDLENBQUM7QUFFRixlQUFPLE1BQU0sbUJBQW1CLEVBQUUsWUFJakMsQ0FBQztBQUVGLHNEQUFzRDtBQUN0RCx3QkFBZ0Isa0JBQWtCLENBQUMsQ0FBQyxFQUFFLFlBQVksRUFBRSxDQUFDLEVBQUUsWUFBWSxHQUFHLFlBQVksQ0FNakY7QUFFRDs7O0dBR0c7QUFDSCx3QkFBc0Isd0JBQXdCLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxFQUFFLFNBQVMsRUFBRSxTQUFTLEdBQUcsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQW9DN0cifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_status_change_of_pending.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/get_status_change_of_pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAY,MAAM,kBAAkB,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"get_status_change_of_pending.d.ts","sourceRoot":"","sources":["../../../../src/tagging/sender_sync/utils/get_status_change_of_pending.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAY,MAAM,kBAAkB,CAAC;AAEpD,qGAAqG;AACrG,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,6BAA6B,EAAE,MAAM,EAAE,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,YAIjC,CAAC;AAEF,sDAAsD;AACtD,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,YAAY,CAMjF;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAoC7G"}
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { TxStatus } from '@aztec/stdlib/tx';
|
|
2
|
+
export const EMPTY_STATUS_CHANGE = {
|
|
3
|
+
txHashesToFinalize: [],
|
|
4
|
+
txHashesToDrop: [],
|
|
5
|
+
txHashesWithExecutionReverted: []
|
|
6
|
+
};
|
|
7
|
+
/** Concatenates two status changes field-by-field. */ export function mergeStatusChanges(a, b) {
|
|
8
|
+
return {
|
|
9
|
+
txHashesToFinalize: [
|
|
10
|
+
...a.txHashesToFinalize,
|
|
11
|
+
...b.txHashesToFinalize
|
|
12
|
+
],
|
|
13
|
+
txHashesToDrop: [
|
|
14
|
+
...a.txHashesToDrop,
|
|
15
|
+
...b.txHashesToDrop
|
|
16
|
+
],
|
|
17
|
+
txHashesWithExecutionReverted: [
|
|
18
|
+
...a.txHashesWithExecutionReverted,
|
|
19
|
+
...b.txHashesWithExecutionReverted
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
2
23
|
/**
|
|
3
24
|
* Based on receipts obtained from `aztecNode` returns which pending transactions changed their status to finalized,
|
|
4
25
|
* dropped, or execution-reverted (but mined).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-dev",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"typedocOptions": {
|
|
6
6
|
"entryPoints": [
|
|
@@ -70,19 +70,19 @@
|
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@aztec/bb-prover": "0.0.1-
|
|
74
|
-
"@aztec/bb.js": "0.0.1-
|
|
75
|
-
"@aztec/builder": "0.0.1-
|
|
76
|
-
"@aztec/constants": "0.0.1-
|
|
77
|
-
"@aztec/ethereum": "0.0.1-
|
|
78
|
-
"@aztec/foundation": "0.0.1-
|
|
79
|
-
"@aztec/key-store": "0.0.1-
|
|
80
|
-
"@aztec/kv-store": "0.0.1-
|
|
81
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-
|
|
82
|
-
"@aztec/noir-types": "0.0.1-
|
|
83
|
-
"@aztec/protocol-contracts": "0.0.1-
|
|
84
|
-
"@aztec/simulator": "0.0.1-
|
|
85
|
-
"@aztec/stdlib": "0.0.1-
|
|
73
|
+
"@aztec/bb-prover": "0.0.1-dev",
|
|
74
|
+
"@aztec/bb.js": "0.0.1-dev",
|
|
75
|
+
"@aztec/builder": "0.0.1-dev",
|
|
76
|
+
"@aztec/constants": "0.0.1-dev",
|
|
77
|
+
"@aztec/ethereum": "0.0.1-dev",
|
|
78
|
+
"@aztec/foundation": "0.0.1-dev",
|
|
79
|
+
"@aztec/key-store": "0.0.1-dev",
|
|
80
|
+
"@aztec/kv-store": "0.0.1-dev",
|
|
81
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-dev",
|
|
82
|
+
"@aztec/noir-types": "0.0.1-dev",
|
|
83
|
+
"@aztec/protocol-contracts": "0.0.1-dev",
|
|
84
|
+
"@aztec/simulator": "0.0.1-dev",
|
|
85
|
+
"@aztec/stdlib": "0.0.1-dev",
|
|
86
86
|
"koa": "^2.16.1",
|
|
87
87
|
"koa-router": "^13.1.1",
|
|
88
88
|
"lodash.omit": "^4.5.0",
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@aztec/merkle-tree": "0.0.1-
|
|
95
|
-
"@aztec/noir-test-contracts.js": "0.0.1-
|
|
94
|
+
"@aztec/merkle-tree": "0.0.1-dev",
|
|
95
|
+
"@aztec/noir-test-contracts.js": "0.0.1-dev",
|
|
96
96
|
"@jest/globals": "^30.0.0",
|
|
97
97
|
"@types/jest": "^30.0.0",
|
|
98
98
|
"@types/lodash.omit": "^4.5.7",
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
"@types/node": "^22.15.17",
|
|
101
101
|
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
102
102
|
"jest": "^30.0.0",
|
|
103
|
+
"jest-file-snapshot": "^0.7.0",
|
|
103
104
|
"jest-mock-extended": "^4.0.0",
|
|
104
105
|
"lodash.times": "^4.3.2",
|
|
105
106
|
"ts-node": "^10.9.1",
|
|
@@ -17,7 +17,7 @@ import { ORACLE_INTERFACE_HASH } from '../oracle_version.js';
|
|
|
17
17
|
* - If the change is backward-breaking (e.g. removing/renaming an oracle), bump ORACLE_VERSION_MAJOR.
|
|
18
18
|
* - If the change is an oracle addition (non-breaking), bump ORACLE_VERSION_MINOR.
|
|
19
19
|
*
|
|
20
|
-
* TODO(
|
|
20
|
+
* TODO(F-667): The following only takes into consideration changes to the oracles defined in Oracle.ts and omits TXE
|
|
21
21
|
* oracles. Ensure this checks TXE oracles as well. This hasn't been implemented yet since we don't have a clean TXE
|
|
22
22
|
* oracle interface like we do in PXE (i.e., there is no single Oracle class that contains only the oracles).
|
|
23
23
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { SerialQueue } from '@aztec/foundation/queue';
|
|
3
4
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
5
|
import type { L2TipsKVStore } from '@aztec/kv-store/stores';
|
|
5
6
|
import { BlockHash, L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
|
|
@@ -20,6 +21,7 @@ import type { PrivateEventStore } from '../storage/private_event_store/private_e
|
|
|
20
21
|
export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
21
22
|
private log: Logger;
|
|
22
23
|
private isSyncing: Promise<void> | undefined;
|
|
24
|
+
private readonly eventQueue = new SerialQueue();
|
|
23
25
|
protected readonly blockStream: L2BlockStream;
|
|
24
26
|
|
|
25
27
|
constructor(
|
|
@@ -35,6 +37,7 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
35
37
|
) {
|
|
36
38
|
this.log = createLogger('pxe:block_synchronizer', bindings);
|
|
37
39
|
this.blockStream = this.createBlockStream(config);
|
|
40
|
+
this.eventQueue.start();
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
protected createBlockStream(config: Partial<BlockSynchronizerConfig>): L2BlockStream {
|
|
@@ -52,8 +55,12 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
52
55
|
);
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
/** Handle events emitted by the block stream. */
|
|
56
|
-
public
|
|
58
|
+
/** Handle events emitted by the block stream. Serialized to prevent concurrent mutations to anchor state. */
|
|
59
|
+
public handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void> {
|
|
60
|
+
return this.eventQueue.put(() => this.doHandleBlockStreamEvent(event));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private async doHandleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void> {
|
|
57
64
|
await this.l2TipsStore.handleBlockStreamEvent(event);
|
|
58
65
|
|
|
59
66
|
switch (event.type) {
|
|
@@ -167,10 +174,11 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
|
|
|
167
174
|
}
|
|
168
175
|
}
|
|
169
176
|
|
|
170
|
-
/** Stops the block synchronizer, waiting for any in-progress sync to complete. */
|
|
177
|
+
/** Stops the block synchronizer, waiting for any in-progress sync and queued events to complete. */
|
|
171
178
|
public async stop() {
|
|
172
179
|
await this.isSyncing;
|
|
173
180
|
await this.blockStream.stop();
|
|
181
|
+
await this.eventQueue.end();
|
|
174
182
|
}
|
|
175
183
|
|
|
176
184
|
private async doSync() {
|
|
@@ -76,6 +76,7 @@ import {
|
|
|
76
76
|
import { PrivateLog } from '@aztec/stdlib/logs';
|
|
77
77
|
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
78
78
|
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
79
|
+
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
79
80
|
import {
|
|
80
81
|
BlockHeader,
|
|
81
82
|
CallContext,
|
|
@@ -90,6 +91,7 @@ import {
|
|
|
90
91
|
} from '@aztec/stdlib/tx';
|
|
91
92
|
|
|
92
93
|
import type { ContractSyncService } from '../contract_sync/contract_sync_service.js';
|
|
94
|
+
import type { ExecutionHooks } from '../hooks/index.js';
|
|
93
95
|
import type { MessageContextService } from '../messages/message_context_service.js';
|
|
94
96
|
import type { AddressStore } from '../storage/address_store/address_store.js';
|
|
95
97
|
import { CapsuleService } from '../storage/capsule_store/capsule_service.js';
|
|
@@ -143,6 +145,7 @@ export type ContractFunctionSimulatorArgs = {
|
|
|
143
145
|
simulator: CircuitSimulator;
|
|
144
146
|
contractSyncService: ContractSyncService;
|
|
145
147
|
messageContextService: MessageContextService;
|
|
148
|
+
hooks?: ExecutionHooks;
|
|
146
149
|
};
|
|
147
150
|
|
|
148
151
|
/**
|
|
@@ -164,6 +167,7 @@ export class ContractFunctionSimulator {
|
|
|
164
167
|
private readonly simulator: CircuitSimulator;
|
|
165
168
|
private readonly contractSyncService: ContractSyncService;
|
|
166
169
|
private readonly messageContextService: MessageContextService;
|
|
170
|
+
private readonly hooks: ExecutionHooks | undefined;
|
|
167
171
|
|
|
168
172
|
constructor(args: ContractFunctionSimulatorArgs) {
|
|
169
173
|
this.contractStore = args.contractStore;
|
|
@@ -180,6 +184,7 @@ export class ContractFunctionSimulator {
|
|
|
180
184
|
this.simulator = args.simulator;
|
|
181
185
|
this.contractSyncService = args.contractSyncService;
|
|
182
186
|
this.messageContextService = args.messageContextService;
|
|
187
|
+
this.hooks = args.hooks;
|
|
183
188
|
this.log = createLogger('simulator');
|
|
184
189
|
}
|
|
185
190
|
|
|
@@ -208,7 +213,7 @@ export class ContractFunctionSimulator {
|
|
|
208
213
|
}
|
|
209
214
|
|
|
210
215
|
if (request.origin !== contractAddress) {
|
|
211
|
-
|
|
216
|
+
throw new Error(
|
|
212
217
|
`Request origin does not match contract address in simulation. Request origin: ${request.origin}, contract address: ${contractAddress}`,
|
|
213
218
|
);
|
|
214
219
|
}
|
|
@@ -259,6 +264,7 @@ export class ContractFunctionSimulator {
|
|
|
259
264
|
senderForTags,
|
|
260
265
|
simulator: this.simulator,
|
|
261
266
|
l2TipsStore: this.l2TipsStore,
|
|
267
|
+
hooks: this.hooks,
|
|
262
268
|
});
|
|
263
269
|
|
|
264
270
|
const setupTime = simulatorSetupTimer.ms();
|
|
@@ -309,7 +315,6 @@ export class ContractFunctionSimulator {
|
|
|
309
315
|
}
|
|
310
316
|
}
|
|
311
317
|
|
|
312
|
-
// docs:start:execute_utility_function
|
|
313
318
|
/**
|
|
314
319
|
* Runs a utility function.
|
|
315
320
|
* @param call - The function call to execute.
|
|
@@ -332,6 +337,10 @@ export class ContractFunctionSimulator {
|
|
|
332
337
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
333
338
|
}
|
|
334
339
|
|
|
340
|
+
const utilityExecutor = async (syncCall: FunctionCall, execScopes: AztecAddress[]) => {
|
|
341
|
+
await this.runUtility(syncCall, [], anchorBlockHeader, execScopes, jobId);
|
|
342
|
+
};
|
|
343
|
+
|
|
335
344
|
const oracle = new UtilityExecutionOracle({
|
|
336
345
|
contractAddress: call.to,
|
|
337
346
|
authWitnesses: authwits,
|
|
@@ -351,6 +360,9 @@ export class ContractFunctionSimulator {
|
|
|
351
360
|
l2TipsStore: this.l2TipsStore,
|
|
352
361
|
jobId,
|
|
353
362
|
scopes,
|
|
363
|
+
simulator: this.simulator,
|
|
364
|
+
hooks: this.hooks,
|
|
365
|
+
utilityExecutor,
|
|
354
366
|
});
|
|
355
367
|
|
|
356
368
|
try {
|
|
@@ -384,7 +396,6 @@ export class ContractFunctionSimulator {
|
|
|
384
396
|
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
385
397
|
}
|
|
386
398
|
}
|
|
387
|
-
// docs:end:execute_utility_function
|
|
388
399
|
|
|
389
400
|
/**
|
|
390
401
|
* Returns the execution statistics collected during the simulator run.
|
|
@@ -753,7 +764,7 @@ function squashTransientSideEffects(
|
|
|
753
764
|
* at the tx's anchor block, mimicking the behavior of the kernels
|
|
754
765
|
*/
|
|
755
766
|
async function verifyReadRequests(
|
|
756
|
-
node: Pick<AztecNode, '
|
|
767
|
+
node: Pick<AztecNode, 'findLeavesIndexes'>,
|
|
757
768
|
anchorBlockHash: BlockParameter,
|
|
758
769
|
noteHashReadRequests: ScopedReadRequest[],
|
|
759
770
|
nullifierReadRequests: ScopedReadRequest[],
|
|
@@ -786,13 +797,25 @@ async function verifyReadRequests(
|
|
|
786
797
|
}
|
|
787
798
|
}
|
|
788
799
|
|
|
789
|
-
const [
|
|
790
|
-
|
|
791
|
-
|
|
800
|
+
const [noteHashResults, nullifierResults] = await Promise.all([
|
|
801
|
+
settledNoteHashReads.length > 0
|
|
802
|
+
? node.findLeavesIndexes(
|
|
803
|
+
anchorBlockHash,
|
|
804
|
+
MerkleTreeId.NOTE_HASH_TREE,
|
|
805
|
+
settledNoteHashReads.map(({ value }) => value),
|
|
806
|
+
)
|
|
807
|
+
: [],
|
|
808
|
+
settledNullifierReads.length > 0
|
|
809
|
+
? node.findLeavesIndexes(
|
|
810
|
+
anchorBlockHash,
|
|
811
|
+
MerkleTreeId.NULLIFIER_TREE,
|
|
812
|
+
settledNullifierReads.map(({ value }) => value),
|
|
813
|
+
)
|
|
814
|
+
: [],
|
|
792
815
|
]);
|
|
793
816
|
|
|
794
817
|
for (let i = 0; i < settledNoteHashReads.length; i++) {
|
|
795
|
-
if (!
|
|
818
|
+
if (!noteHashResults[i]) {
|
|
796
819
|
throw new Error(
|
|
797
820
|
`Note hash read request at index ${settledNoteHashReads[i].index} is reading an unknown note hash: ${settledNoteHashReads[i].value}`,
|
|
798
821
|
);
|
|
@@ -800,7 +823,7 @@ async function verifyReadRequests(
|
|
|
800
823
|
}
|
|
801
824
|
|
|
802
825
|
for (let i = 0; i < settledNullifierReads.length; i++) {
|
|
803
|
-
if (!
|
|
826
|
+
if (!nullifierResults[i]) {
|
|
804
827
|
throw new Error(
|
|
805
828
|
`Nullifier read request at index ${settledNullifierReads[i].index} is reading an unknown nullifier: ${settledNullifierReads[i].value}`,
|
|
806
829
|
);
|
|
@@ -12,7 +12,7 @@ import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
|
12
12
|
import type { ContractClassLog, Tag } from '@aztec/stdlib/logs';
|
|
13
13
|
import type { Note, NoteStatus } from '@aztec/stdlib/note';
|
|
14
14
|
import { type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
15
|
-
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
15
|
+
import type { BlockHeader, TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
16
16
|
|
|
17
17
|
import type { UtilityContext } from '../noir-structs/utility_context.js';
|
|
18
18
|
import type { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
@@ -144,6 +144,7 @@ export interface IUtilityExecutionOracle {
|
|
|
144
144
|
): Promise<void>;
|
|
145
145
|
getLogsByTagV2(requestArrayBaseSlot: Fr): Promise<Fr>;
|
|
146
146
|
getMessageContextsByTxHashV2(requestArrayBaseSlot: Fr): Promise<Fr>;
|
|
147
|
+
getTxEffect(txHash: TxHash): Promise<TxEffect | null>;
|
|
147
148
|
getMessageContextsByTxHash(
|
|
148
149
|
contractAddress: AztecAddress,
|
|
149
150
|
messageContextRequestsArrayBaseSlot: Fr,
|
|
@@ -164,6 +165,11 @@ export interface IUtilityExecutionOracle {
|
|
|
164
165
|
getSharedSecret(address: AztecAddress, ephPk: Point, contractAddress: AztecAddress): Promise<Fr>;
|
|
165
166
|
setContractSyncCacheInvalid(contractAddress: AztecAddress, scopes: AztecAddress[]): void;
|
|
166
167
|
emitOffchainEffect(data: Fr[]): Promise<void>;
|
|
168
|
+
callUtilityFunction(
|
|
169
|
+
targetContractAddress: AztecAddress,
|
|
170
|
+
functionSelector: FunctionSelector,
|
|
171
|
+
args: Fr[],
|
|
172
|
+
): Promise<Fr[]>;
|
|
167
173
|
|
|
168
174
|
// Ephemeral array methods
|
|
169
175
|
pushEphemeral(slot: Fr, elements: Fr[]): number;
|
|
@@ -204,6 +210,11 @@ export interface IPrivateExecutionOracle {
|
|
|
204
210
|
sideEffectCounter: number,
|
|
205
211
|
isStaticCall: boolean,
|
|
206
212
|
): Promise<{ endSideEffectCounter: Fr; returnsHash: Fr }>;
|
|
213
|
+
callUtilityFunction(
|
|
214
|
+
targetContractAddress: AztecAddress,
|
|
215
|
+
functionSelector: FunctionSelector,
|
|
216
|
+
args: Fr[],
|
|
217
|
+
): Promise<Fr[]>;
|
|
207
218
|
assertValidPublicCalldata(calldataHash: Fr): Promise<void>;
|
|
208
219
|
notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void>;
|
|
209
220
|
isExecutionInRevertiblePhase(sideEffectCounter: number): Promise<boolean>;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ARCHIVE_HEIGHT,
|
|
3
|
+
MAX_CONTRACT_CLASS_LOGS_PER_TX,
|
|
4
|
+
MAX_L2_TO_L1_MSGS_PER_TX,
|
|
5
|
+
MAX_NOTE_HASHES_PER_TX,
|
|
6
|
+
MAX_NULLIFIERS_PER_TX,
|
|
7
|
+
MAX_PRIVATE_LOGS_PER_TX,
|
|
8
|
+
MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
|
|
9
|
+
} from '@aztec/constants';
|
|
1
10
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
11
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
2
12
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
13
|
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
14
|
+
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
4
15
|
import {
|
|
5
16
|
type ACIRCallback,
|
|
6
17
|
type ACVMField,
|
|
@@ -11,9 +22,11 @@ import {
|
|
|
11
22
|
toACVMField,
|
|
12
23
|
} from '@aztec/simulator/client';
|
|
13
24
|
import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
25
|
+
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
14
26
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
27
|
import { BlockHash } from '@aztec/stdlib/block';
|
|
16
|
-
import { ContractClassLog, ContractClassLogFields } from '@aztec/stdlib/logs';
|
|
28
|
+
import { ContractClassLog, ContractClassLogFields, FlatPublicLogs, PrivateLog } from '@aztec/stdlib/logs';
|
|
29
|
+
import { TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
17
30
|
|
|
18
31
|
import { ORACLE_VERSION_MAJOR, ORACLE_VERSION_MINOR } from '../../oracle_version.js';
|
|
19
32
|
import type { IMiscOracle, IPrivateExecutionOracle, IUtilityExecutionOracle } from './interfaces.js';
|
|
@@ -237,6 +250,7 @@ export class Oracle {
|
|
|
237
250
|
return witness.toNoirRepresentation();
|
|
238
251
|
}
|
|
239
252
|
|
|
253
|
+
// TODO(https://linear.app/aztec-labs/issue/F-651): drop this
|
|
240
254
|
// eslint-disable-next-line camelcase
|
|
241
255
|
async aztec_utl_getBlockHashMembershipWitness(
|
|
242
256
|
[anchorBlockHash]: ACVMField[],
|
|
@@ -254,6 +268,20 @@ export class Oracle {
|
|
|
254
268
|
return witness.toNoirRepresentation();
|
|
255
269
|
}
|
|
256
270
|
|
|
271
|
+
// TODO(https://linear.app/aztec-labs/issue/F-651): rename to aztec_utl_getBlockHashMembershipWitness
|
|
272
|
+
// eslint-disable-next-line camelcase
|
|
273
|
+
async aztec_utl_getBlockHashMembershipWitnessV2(
|
|
274
|
+
[anchorBlockHash]: ACVMField[],
|
|
275
|
+
[blockHash]: ACVMField[],
|
|
276
|
+
): Promise<(ACVMField | ACVMField[])[]> {
|
|
277
|
+
const parsedAnchorBlockHash = BlockHash.fromString(anchorBlockHash);
|
|
278
|
+
const parsedBlockHash = BlockHash.fromString(blockHash);
|
|
279
|
+
|
|
280
|
+
const witness = await this.handlerAsUtility().getBlockHashMembershipWitness(parsedAnchorBlockHash, parsedBlockHash);
|
|
281
|
+
const effective = witness ?? MembershipWitness.empty(ARCHIVE_HEIGHT);
|
|
282
|
+
return [toACVMField(witness !== undefined ? 1 : 0), ...effective.toNoirRepresentation()];
|
|
283
|
+
}
|
|
284
|
+
|
|
257
285
|
// eslint-disable-next-line camelcase
|
|
258
286
|
async aztec_utl_getNullifierMembershipWitness(
|
|
259
287
|
[blockHash]: ACVMField[],
|
|
@@ -490,6 +518,20 @@ export class Oracle {
|
|
|
490
518
|
return [values.map(toACVMField)];
|
|
491
519
|
}
|
|
492
520
|
|
|
521
|
+
// eslint-disable-next-line camelcase
|
|
522
|
+
async aztec_utl_callUtilityFunction(
|
|
523
|
+
[contractAddress]: ACVMField[],
|
|
524
|
+
[functionSelector]: ACVMField[],
|
|
525
|
+
args: ACVMField[],
|
|
526
|
+
): Promise<ACVMField[][]> {
|
|
527
|
+
const result = await this.handlerAsUtility().callUtilityFunction(
|
|
528
|
+
AztecAddress.fromField(Fr.fromString(contractAddress)),
|
|
529
|
+
FunctionSelector.fromField(Fr.fromString(functionSelector)),
|
|
530
|
+
args.map(Fr.fromString),
|
|
531
|
+
);
|
|
532
|
+
return [result.map(toACVMField)];
|
|
533
|
+
}
|
|
534
|
+
|
|
493
535
|
// eslint-disable-next-line camelcase
|
|
494
536
|
aztec_prv_notifyCreatedContractClassLog(
|
|
495
537
|
[contractAddress]: ACVMField[],
|
|
@@ -670,6 +712,36 @@ export class Oracle {
|
|
|
670
712
|
return [toACVMField(responseSlot)];
|
|
671
713
|
}
|
|
672
714
|
|
|
715
|
+
// eslint-disable-next-line camelcase
|
|
716
|
+
async aztec_utl_getTxEffect([txHash]: ACVMField[]): Promise<(ACVMField | ACVMField[])[]> {
|
|
717
|
+
const txEffect = await this.handlerAsUtility().getTxEffect(TxHash.fromField(Fr.fromString(txHash)));
|
|
718
|
+
// The Noir oracle returns `Option<TxEffect>`. ACVM expands this into 12 destination slots: the Option discriminant
|
|
719
|
+
// followed by the 11 leaf slots of `TxEffect` (each scalar is one slot, each top-level array is one slot, and
|
|
720
|
+
// the nested `PublicLogs { length, payload }` splits into two slots).
|
|
721
|
+
const effect = txEffect ?? TxEffect.empty();
|
|
722
|
+
const flatPublicLogs = FlatPublicLogs.fromLogs(effect.publicLogs);
|
|
723
|
+
return [
|
|
724
|
+
toACVMField(txEffect === null ? 0 : 1),
|
|
725
|
+
toACVMField(effect.revertCode.toField()),
|
|
726
|
+
toACVMField(effect.txHash.hash),
|
|
727
|
+
toACVMField(effect.transactionFee),
|
|
728
|
+
padArrayEnd(effect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX).map(toACVMField),
|
|
729
|
+
padArrayEnd(effect.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX).map(toACVMField),
|
|
730
|
+
padArrayEnd(effect.l2ToL1Msgs, Fr.ZERO, MAX_L2_TO_L1_MSGS_PER_TX).map(toACVMField),
|
|
731
|
+
padArrayEnd(effect.publicDataWrites, PublicDataWrite.empty(), MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX)
|
|
732
|
+
.flatMap(w => w.toFields())
|
|
733
|
+
.map(toACVMField),
|
|
734
|
+
padArrayEnd(effect.privateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX)
|
|
735
|
+
.flatMap(l => l.toFields())
|
|
736
|
+
.map(toACVMField),
|
|
737
|
+
toACVMField(flatPublicLogs.length),
|
|
738
|
+
flatPublicLogs.payload.map(toACVMField),
|
|
739
|
+
padArrayEnd(effect.contractClassLogs, ContractClassLog.empty(), MAX_CONTRACT_CLASS_LOGS_PER_TX)
|
|
740
|
+
.flatMap(l => [...l.fields.toFields(), new Fr(l.emittedLength), l.contractAddress.toField()])
|
|
741
|
+
.map(toACVMField),
|
|
742
|
+
];
|
|
743
|
+
}
|
|
744
|
+
|
|
673
745
|
// eslint-disable-next-line camelcase
|
|
674
746
|
aztec_utl_setCapsule(
|
|
675
747
|
[contractAddress]: ACVMField[],
|
|
@@ -2,11 +2,10 @@ import { MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS, PRIVATE_CONTEXT_INPUTS_LENGTH }
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { Timer } from '@aztec/foundation/timer';
|
|
5
|
-
import {
|
|
5
|
+
import { toACVMWitness } from '@aztec/simulator/client';
|
|
6
6
|
import {
|
|
7
7
|
type FunctionAbi,
|
|
8
8
|
type FunctionArtifact,
|
|
9
|
-
type FunctionCall,
|
|
10
9
|
FunctionSelector,
|
|
11
10
|
type NoteSelector,
|
|
12
11
|
countArgumentsSize,
|
|
@@ -41,8 +40,6 @@ export type PrivateExecutionOracleArgs = Omit<UtilityExecutionOracleArgs, 'contr
|
|
|
41
40
|
argsHash: Fr;
|
|
42
41
|
txContext: TxContext;
|
|
43
42
|
callContext: CallContext;
|
|
44
|
-
/** Needed to trigger contract synchronization before nested calls */
|
|
45
|
-
utilityExecutor: (call: FunctionCall, scopes: AztecAddress[]) => Promise<void>;
|
|
46
43
|
executionCache: HashedValuesCache;
|
|
47
44
|
noteCache: ExecutionNoteCache;
|
|
48
45
|
taggingIndexCache: ExecutionTaggingIndexCache;
|
|
@@ -50,7 +47,6 @@ export type PrivateExecutionOracleArgs = Omit<UtilityExecutionOracleArgs, 'contr
|
|
|
50
47
|
totalPublicCalldataCount?: number;
|
|
51
48
|
sideEffectCounter?: number;
|
|
52
49
|
senderForTags?: AztecAddress;
|
|
53
|
-
simulator?: CircuitSimulator;
|
|
54
50
|
};
|
|
55
51
|
|
|
56
52
|
/**
|
|
@@ -75,15 +71,16 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
75
71
|
private readonly argsHash: Fr;
|
|
76
72
|
private readonly txContext: TxContext;
|
|
77
73
|
private readonly callContext: CallContext;
|
|
78
|
-
private readonly utilityExecutor: (call: FunctionCall, scopes: AztecAddress[]) => Promise<void>;
|
|
79
74
|
private readonly executionCache: HashedValuesCache;
|
|
80
75
|
private readonly noteCache: ExecutionNoteCache;
|
|
81
76
|
private readonly taggingIndexCache: ExecutionTaggingIndexCache;
|
|
82
77
|
private readonly senderTaggingStore: SenderTaggingStore;
|
|
83
78
|
private totalPublicCalldataCount: number;
|
|
84
79
|
private readonly initialSideEffectCounter: number;
|
|
85
|
-
|
|
86
|
-
private readonly
|
|
80
|
+
/** Sender for tags passed in at oracle construction time. Returned by `getSenderForTags` unless overridden. */
|
|
81
|
+
private readonly defaultSenderForTags: AztecAddress | undefined;
|
|
82
|
+
/** Per-call sender-for-tags override, set by `setSenderForTags`. Takes precedence over `defaultSenderForTags`. */
|
|
83
|
+
private currentSenderForTags: AztecAddress | undefined;
|
|
87
84
|
|
|
88
85
|
constructor(args: PrivateExecutionOracleArgs) {
|
|
89
86
|
super({
|
|
@@ -94,15 +91,13 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
94
91
|
this.argsHash = args.argsHash;
|
|
95
92
|
this.txContext = args.txContext;
|
|
96
93
|
this.callContext = args.callContext;
|
|
97
|
-
this.utilityExecutor = args.utilityExecutor;
|
|
98
94
|
this.executionCache = args.executionCache;
|
|
99
95
|
this.noteCache = args.noteCache;
|
|
100
96
|
this.taggingIndexCache = args.taggingIndexCache;
|
|
101
97
|
this.senderTaggingStore = args.senderTaggingStore;
|
|
102
98
|
this.totalPublicCalldataCount = args.totalPublicCalldataCount ?? 0;
|
|
103
99
|
this.initialSideEffectCounter = args.sideEffectCounter ?? 0;
|
|
104
|
-
this.
|
|
105
|
-
this.simulator = args.simulator;
|
|
100
|
+
this.defaultSenderForTags = args.senderForTags;
|
|
106
101
|
}
|
|
107
102
|
|
|
108
103
|
public getPrivateContextInputs(): PrivateContextInputs {
|
|
@@ -178,11 +173,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
178
173
|
* for a tag in order to emit a log. Constrained tagging should not use this as there is no
|
|
179
174
|
* guarantee that the recipient knows about the sender, and hence about the shared secret.
|
|
180
175
|
*
|
|
181
|
-
*
|
|
182
|
-
* 'senderForTags' value (unless it is replaced).
|
|
176
|
+
* Returns `currentSenderForTags` if set (via `setSenderForTags`), otherwise `defaultSenderForTags`.
|
|
183
177
|
*/
|
|
184
178
|
public getSenderForTags(): Promise<AztecAddress | undefined> {
|
|
185
|
-
return Promise.resolve(this.
|
|
179
|
+
return Promise.resolve(this.currentSenderForTags ?? this.defaultSenderForTags);
|
|
186
180
|
}
|
|
187
181
|
|
|
188
182
|
/**
|
|
@@ -192,12 +186,14 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
192
186
|
* for a tag in order to emit a log. Constrained tagging should not use this as there is no
|
|
193
187
|
* guarantee that the recipient knows about the sender, and hence about the shared secret.
|
|
194
188
|
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* value (unless it is replaced by another call to this setter).
|
|
189
|
+
* Overrides `defaultSenderForTags` for the remainder of this call. Each oracle instance is
|
|
190
|
+
* independent, so this has no effect on any other call in the execution.
|
|
198
191
|
*/
|
|
199
192
|
public setSenderForTags(senderForTags: AztecAddress): Promise<void> {
|
|
200
|
-
this.
|
|
193
|
+
this.logger.debug(
|
|
194
|
+
`Sender for tags switched to ${senderForTags} by contract ${this.contractAddress} (default was ${this.defaultSenderForTags})`,
|
|
195
|
+
);
|
|
196
|
+
this.currentSenderForTags = senderForTags;
|
|
201
197
|
return Promise.resolve();
|
|
202
198
|
}
|
|
203
199
|
|
|
@@ -578,21 +574,25 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
578
574
|
sideEffectCounter,
|
|
579
575
|
scopes: this.scopes,
|
|
580
576
|
log: this.logger,
|
|
581
|
-
senderForTags: this.
|
|
582
|
-
simulator: this.simulator
|
|
577
|
+
senderForTags: this.defaultSenderForTags,
|
|
578
|
+
simulator: this.simulator,
|
|
579
|
+
hooks: this.hooks,
|
|
583
580
|
l2TipsStore: this.l2TipsStore,
|
|
584
581
|
});
|
|
585
582
|
|
|
586
583
|
const setupTime = simulatorSetupTimer.ms();
|
|
587
584
|
|
|
588
585
|
const childExecutionResult = await executePrivateFunction(
|
|
589
|
-
this.simulator
|
|
586
|
+
this.simulator,
|
|
590
587
|
privateExecutionOracle,
|
|
591
588
|
targetArtifact,
|
|
592
589
|
targetContractAddress,
|
|
593
590
|
functionSelector,
|
|
594
591
|
);
|
|
595
592
|
|
|
593
|
+
// Propagate the nested call's calldata count so the parent sees its increments on subsequent enqueues.
|
|
594
|
+
this.totalPublicCalldataCount = privateExecutionOracle.getTotalPublicCalldataCount();
|
|
595
|
+
|
|
596
596
|
if (isStaticCall) {
|
|
597
597
|
this.#checkValidStaticCall(childExecutionResult);
|
|
598
598
|
}
|
|
@@ -626,6 +626,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
626
626
|
return Promise.resolve();
|
|
627
627
|
}
|
|
628
628
|
|
|
629
|
+
public getTotalPublicCalldataCount(): number {
|
|
630
|
+
return this.totalPublicCalldataCount;
|
|
631
|
+
}
|
|
632
|
+
|
|
629
633
|
public notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void> {
|
|
630
634
|
return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
|
|
631
635
|
}
|