@aztec/txe 0.0.1-commit.b655e406 → 0.0.1-commit.d3ec352c
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/index.d.ts +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/oracle/interfaces.d.ts +5 -4
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +3 -3
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.d.ts +3 -2
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +26 -17
- package/dest/rpc_translator.d.ts +10 -7
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +26 -16
- package/dest/state_machine/archiver.d.ts +14 -8
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +16 -3
- package/dest/state_machine/dummy_p2p_client.d.ts +4 -2
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +3 -0
- package/dest/state_machine/global_variable_builder.d.ts +3 -2
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/index.d.ts +1 -1
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +1 -1
- package/dest/state_machine/mock_epoch_cache.d.ts +6 -5
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +8 -7
- package/dest/state_machine/synchronizer.d.ts +5 -4
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +5 -4
- package/dest/txe_session.d.ts +4 -4
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +8 -5
- package/dest/util/encoding.d.ts +15 -15
- package/dest/util/expected_failure_error.d.ts +1 -1
- package/dest/util/expected_failure_error.d.ts.map +1 -1
- package/dest/util/txe_account_data_provider.d.ts +1 -1
- package/dest/util/txe_account_data_provider.d.ts.map +1 -1
- package/dest/util/txe_contract_data_provider.d.ts +1 -1
- package/dest/util/txe_contract_data_provider.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.d.ts +4 -3
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/utils/block_creation.d.ts +3 -2
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +1 -1
- package/dest/utils/tx_effect_creation.d.ts +3 -2
- package/dest/utils/tx_effect_creation.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.js +5 -5
- package/package.json +18 -17
- package/src/oracle/interfaces.ts +4 -3
- package/src/oracle/txe_oracle_public_context.ts +2 -2
- package/src/oracle/txe_oracle_top_level_context.ts +27 -18
- package/src/rpc_translator.ts +31 -17
- package/src/state_machine/archiver.ts +28 -10
- package/src/state_machine/dummy_p2p_client.ts +6 -1
- package/src/state_machine/global_variable_builder.ts +3 -2
- package/src/state_machine/index.ts +1 -1
- package/src/state_machine/mock_epoch_cache.ts +12 -11
- package/src/state_machine/synchronizer.ts +8 -6
- package/src/txe_session.ts +11 -9
- package/src/util/txe_public_contract_data_source.ts +3 -2
- package/src/utils/block_creation.ts +3 -1
- package/src/utils/tx_effect_creation.ts +7 -6
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { L2BlockHeader } from '@aztec/stdlib/block';
|
|
3
4
|
import { type MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
@@ -7,7 +8,7 @@ import { GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
|
|
|
7
8
|
* @param blockNumber The number for the block in which there is a single transaction.
|
|
8
9
|
* @returns The transaction request hash.
|
|
9
10
|
*/
|
|
10
|
-
export declare function getSingleTxBlockRequestHash(blockNumber:
|
|
11
|
+
export declare function getSingleTxBlockRequestHash(blockNumber: BlockNumber): Fr;
|
|
11
12
|
export declare function insertTxEffectIntoWorldTrees(txEffect: TxEffect, worldTrees: MerkleTreeWriteOperations): Promise<void>;
|
|
12
13
|
export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables): Promise<L2BlockHeader>;
|
|
13
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfY3JlYXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9ibG9ja19jcmVhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFOUQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQzlDLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUVwRCxPQUFPLEVBQXdDLEtBQUsseUJBQXlCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUMzRyxPQUFPLEVBQUUsZUFBZSxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRTdEOzs7O0dBSUc7QUFDSCx3QkFBZ0IsMkJBQTJCLENBQUMsV0FBVyxFQUFFLFdBQVcsR0FBRyxFQUFFLENBRXhFO0FBRUQsd0JBQXNCLDRCQUE0QixDQUNoRCxRQUFRLEVBQUUsUUFBUSxFQUNsQixVQUFVLEVBQUUseUJBQXlCLEdBQ3BDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FrQmY7QUFFRCx3QkFBc0Isa0JBQWtCLENBQ3RDLFVBQVUsRUFBRSx5QkFBeUIsRUFDckMsZUFBZSxFQUFFLGVBQWUsR0FDL0IsT0FBTyxDQUFDLGFBQWEsQ0FBQyxDQWN4QiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_creation.d.ts","sourceRoot":"","sources":["../../src/utils/block_creation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"block_creation.d.ts","sourceRoot":"","sources":["../../src/utils/block_creation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAwC,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,EAAE,CAExE;AAED,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,yBAAyB,GACpC,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,aAAa,CAAC,CAcxB"}
|
|
@@ -20,5 +20,5 @@ export async function insertTxEffectIntoWorldTrees(txEffect, worldTrees) {
|
|
|
20
20
|
export async function makeTXEBlockHeader(worldTrees, globalVariables) {
|
|
21
21
|
const stateReference = await worldTrees.getStateReference();
|
|
22
22
|
const archiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
23
|
-
return new L2BlockHeader(new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)), makeContentCommitment(), stateReference, globalVariables, Fr.ZERO, Fr.ZERO, Fr.ZERO);
|
|
23
|
+
return new L2BlockHeader(new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)), makeContentCommitment(), stateReference, globalVariables, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO);
|
|
24
24
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import type { ExecutionNoteCache } from '@aztec/pxe/simulator';
|
|
3
4
|
import { TxEffect } from '@aztec/stdlib/tx';
|
|
4
|
-
export declare function makeTxEffect(noteCache: ExecutionNoteCache,
|
|
5
|
-
//# sourceMappingURL=
|
|
5
|
+
export declare function makeTxEffect(noteCache: ExecutionNoteCache, protocolNullifier: Fr, txBlockNumber: BlockNumber): Promise<TxEffect>;
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfZWZmZWN0X2NyZWF0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvdHhfZWZmZWN0X2NyZWF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUM5RCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDOUMsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUUvRCxPQUFPLEVBQUUsUUFBUSxFQUFVLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQsd0JBQXNCLFlBQVksQ0FDaEMsU0FBUyxFQUFFLGtCQUFrQixFQUM3QixpQkFBaUIsRUFBRSxFQUFFLEVBQ3JCLGFBQWEsRUFBRSxXQUFXLEdBQ3pCLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0EyQm5CIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_effect_creation.d.ts","sourceRoot":"","sources":["../../src/utils/tx_effect_creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAEpD,wBAAsB,YAAY,CAChC,SAAS,EAAE,kBAAkB,EAC7B,
|
|
1
|
+
{"version":3,"file":"tx_effect_creation.d.ts","sourceRoot":"","sources":["../../src/utils/tx_effect_creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAEpD,wBAAsB,YAAY,CAChC,SAAS,EAAE,kBAAkB,EAC7B,iBAAiB,EAAE,EAAE,EACrB,aAAa,EAAE,WAAW,GACzB,OAAO,CAAC,QAAQ,CAAC,CA2BnB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash } from '@aztec/stdlib/hash';
|
|
3
3
|
import { TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
4
|
-
export async function makeTxEffect(noteCache,
|
|
4
|
+
export async function makeTxEffect(noteCache, protocolNullifier, txBlockNumber) {
|
|
5
5
|
const txEffect = TxEffect.empty();
|
|
6
|
-
const {
|
|
7
|
-
const nonceGenerator =
|
|
6
|
+
const { usedProtocolNullifierForNonces } = noteCache.finish();
|
|
7
|
+
const nonceGenerator = usedProtocolNullifierForNonces ? protocolNullifier : noteCache.getAllNullifiers()[0];
|
|
8
8
|
txEffect.noteHashes = await Promise.all(noteCache.getAllNotes().map(async (pendingNote, i)=>computeUniqueNoteHash(await computeNoteHashNonce(nonceGenerator, i), await siloNoteHash(pendingNote.note.contractAddress, pendingNote.noteHashForConsumption))));
|
|
9
9
|
// Nullifiers are already siloed
|
|
10
10
|
txEffect.nullifiers = noteCache.getAllNullifiers();
|
|
11
|
-
if (
|
|
12
|
-
txEffect.nullifiers.unshift(
|
|
11
|
+
if (usedProtocolNullifierForNonces) {
|
|
12
|
+
txEffect.nullifiers.unshift(protocolNullifier);
|
|
13
13
|
}
|
|
14
14
|
txEffect.txHash = new TxHash(new Fr(txBlockNumber));
|
|
15
15
|
return txEffect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/txe",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.d3ec352c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"bin": "./dest/bin/index.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"tsconfig": "./tsconfig.json"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "yarn clean && tsc
|
|
16
|
-
"build:dev": "tsc
|
|
15
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
16
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
17
17
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
18
18
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
|
|
19
19
|
"dev": "LOG_LEVEL=\"debug; trace: simulator:state_manager; info: json-rpc:proxy\" node ./dest/bin/index.js",
|
|
@@ -61,26 +61,27 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
65
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
66
|
-
"@aztec/aztec-node": "0.0.1-commit.
|
|
67
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
68
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
69
|
-
"@aztec/constants": "0.0.1-commit.
|
|
70
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
71
|
-
"@aztec/key-store": "0.0.1-commit.
|
|
72
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
73
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
74
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
75
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
76
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
77
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
64
|
+
"@aztec/accounts": "0.0.1-commit.d3ec352c",
|
|
65
|
+
"@aztec/archiver": "0.0.1-commit.d3ec352c",
|
|
66
|
+
"@aztec/aztec-node": "0.0.1-commit.d3ec352c",
|
|
67
|
+
"@aztec/aztec.js": "0.0.1-commit.d3ec352c",
|
|
68
|
+
"@aztec/bb-prover": "0.0.1-commit.d3ec352c",
|
|
69
|
+
"@aztec/constants": "0.0.1-commit.d3ec352c",
|
|
70
|
+
"@aztec/foundation": "0.0.1-commit.d3ec352c",
|
|
71
|
+
"@aztec/key-store": "0.0.1-commit.d3ec352c",
|
|
72
|
+
"@aztec/kv-store": "0.0.1-commit.d3ec352c",
|
|
73
|
+
"@aztec/protocol-contracts": "0.0.1-commit.d3ec352c",
|
|
74
|
+
"@aztec/pxe": "0.0.1-commit.d3ec352c",
|
|
75
|
+
"@aztec/simulator": "0.0.1-commit.d3ec352c",
|
|
76
|
+
"@aztec/stdlib": "0.0.1-commit.d3ec352c",
|
|
77
|
+
"@aztec/world-state": "0.0.1-commit.d3ec352c",
|
|
78
78
|
"zod": "^3.23.8"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@jest/globals": "^30.0.0",
|
|
82
82
|
"@types/jest": "^30.0.0",
|
|
83
83
|
"@types/node": "^22.15.17",
|
|
84
|
+
"@typescript/native-preview": "7.0.0-dev.20251126.1",
|
|
84
85
|
"jest": "^30.0.0",
|
|
85
86
|
"jest-mock-extended": "^4.0.0",
|
|
86
87
|
"ts-node": "^10.9.1",
|
package/src/oracle/interfaces.ts
CHANGED
|
@@ -2,10 +2,11 @@ import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
|
2
2
|
import { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
3
|
import type { ContractInstanceWithAddress } from '@aztec/aztec.js/contracts';
|
|
4
4
|
import { TxHash } from '@aztec/aztec.js/tx';
|
|
5
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
5
6
|
import type { Fr } from '@aztec/foundation/fields';
|
|
6
7
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
7
8
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import type {
|
|
9
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
9
10
|
|
|
10
11
|
// These interfaces complement the ones defined in PXE, and combined with those contain the full list of oracles used by
|
|
11
12
|
// aztec-nr. In particular, these include the ones needed to run Brillig code associated to #[external("public")] functions that has
|
|
@@ -25,7 +26,7 @@ export interface IAvmExecutionOracle {
|
|
|
25
26
|
|
|
26
27
|
avmOpcodeAddress(): Promise<AztecAddress>;
|
|
27
28
|
avmOpcodeSender(): Promise<AztecAddress>;
|
|
28
|
-
avmOpcodeBlockNumber(): Promise<
|
|
29
|
+
avmOpcodeBlockNumber(): Promise<BlockNumber>;
|
|
29
30
|
avmOpcodeTimestamp(): Promise<bigint>;
|
|
30
31
|
avmOpcodeIsStaticCall(): Promise<boolean>;
|
|
31
32
|
avmOpcodeChainId(): Promise<Fr>;
|
|
@@ -43,7 +44,7 @@ export interface IAvmExecutionOracle {
|
|
|
43
44
|
export interface ITxeExecutionOracle {
|
|
44
45
|
isTxe: true;
|
|
45
46
|
|
|
46
|
-
txeGetNextBlockNumber(): Promise<
|
|
47
|
+
txeGetNextBlockNumber(): Promise<BlockNumber>;
|
|
47
48
|
txeGetNextBlockTimestamp(): Promise<UInt64>;
|
|
48
49
|
txeAdvanceBlocksBy(blocks: number): Promise<void>;
|
|
49
50
|
txeAdvanceTimestampBy(duration: UInt64): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
@@ -12,7 +13,6 @@ import {
|
|
|
12
13
|
PublicDataTreeLeafPreimage,
|
|
13
14
|
} from '@aztec/stdlib/trees';
|
|
14
15
|
import { GlobalVariables, TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
15
|
-
import type { UInt32 } from '@aztec/stdlib/types';
|
|
16
16
|
|
|
17
17
|
import { insertTxEffectIntoWorldTrees, makeTXEBlockHeader } from '../utils/block_creation.js';
|
|
18
18
|
import type { IAvmExecutionOracle } from './interfaces.js';
|
|
@@ -48,7 +48,7 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
|
|
|
48
48
|
return Promise.resolve(AztecAddress.ZERO); // todo: change?
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
avmOpcodeBlockNumber(): Promise<
|
|
51
|
+
avmOpcodeBlockNumber(): Promise<BlockNumber> {
|
|
52
52
|
return Promise.resolve(this.globalVariables.blockNumber);
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
DEFAULT_TEARDOWN_L2_GAS_LIMIT,
|
|
7
7
|
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
|
|
8
8
|
} from '@aztec/constants';
|
|
9
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
9
10
|
import { Schnorr } from '@aztec/foundation/crypto';
|
|
10
11
|
import { Fr } from '@aztec/foundation/fields';
|
|
11
12
|
import { LogLevels, type Logger, applyStringFormatting, createLogger } from '@aztec/foundation/log';
|
|
@@ -38,18 +39,19 @@ import {
|
|
|
38
39
|
witnessMapToFields,
|
|
39
40
|
} from '@aztec/simulator/client';
|
|
40
41
|
import {
|
|
42
|
+
CppPublicTxSimulator,
|
|
41
43
|
GuardedMerkleTreeOperations,
|
|
42
44
|
PublicContractsDB,
|
|
43
45
|
PublicProcessor,
|
|
44
|
-
PublicTxSimulator,
|
|
45
46
|
} from '@aztec/simulator/server';
|
|
46
47
|
import { type ContractArtifact, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
47
48
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
49
|
+
import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
48
50
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
49
51
|
import { Body, L2Block } from '@aztec/stdlib/block';
|
|
50
52
|
import { type ContractInstanceWithAddress, computePartialAddress } from '@aztec/stdlib/contract';
|
|
51
53
|
import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
52
|
-
import { computeCalldataHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
54
|
+
import { computeCalldataHash, computeProtocolNullifier, siloNullifier } from '@aztec/stdlib/hash';
|
|
53
55
|
import {
|
|
54
56
|
PartialPrivateTailPublicInputsForPublic,
|
|
55
57
|
PrivateKernelTailCircuitPublicInputs,
|
|
@@ -131,8 +133,8 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
131
133
|
this.logger[levelName](`${applyStringFormatting(message, fields)}`, { module: `${this.logger.module}:debug_log` });
|
|
132
134
|
}
|
|
133
135
|
|
|
134
|
-
async txeGetNextBlockNumber(): Promise<
|
|
135
|
-
return (await this.getLastBlockNumber()) + 1;
|
|
136
|
+
async txeGetNextBlockNumber(): Promise<BlockNumber> {
|
|
137
|
+
return BlockNumber((await this.getLastBlockNumber()) + 1);
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
txeGetNextBlockTimestamp(): Promise<bigint> {
|
|
@@ -291,8 +293,8 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
291
293
|
|
|
292
294
|
const blockHeader = await this.pxeOracleInterface.getAnchorBlockHeader();
|
|
293
295
|
|
|
294
|
-
const
|
|
295
|
-
const noteCache = new ExecutionNoteCache(
|
|
296
|
+
const protocolNullifier = await computeProtocolNullifier(getSingleTxBlockRequestHash(blockNumber));
|
|
297
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
296
298
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
297
299
|
|
|
298
300
|
const simulator = new WASMSimulator();
|
|
@@ -359,7 +361,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
359
361
|
// According to the protocol rules, the nonce generator for the note hashes
|
|
360
362
|
// can either be the first nullifier in the tx or the hash of the initial tx request
|
|
361
363
|
// if there are none.
|
|
362
|
-
const nonceGenerator = result.firstNullifier.equals(Fr.ZERO) ?
|
|
364
|
+
const nonceGenerator = result.firstNullifier.equals(Fr.ZERO) ? protocolNullifier : result.firstNullifier;
|
|
363
365
|
const { publicInputs } = await generateSimulatedProvingResult(result, nonceGenerator, this.contractDataProvider);
|
|
364
366
|
|
|
365
367
|
const globals = makeGlobalVariables();
|
|
@@ -373,14 +375,18 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
373
375
|
|
|
374
376
|
const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.contractDataProvider));
|
|
375
377
|
const guardedMerkleTrees = new GuardedMerkleTreeOperations(forkedWorldTrees);
|
|
378
|
+
const config = PublicSimulatorConfig.from({
|
|
379
|
+
skipFeeEnforcement: true,
|
|
380
|
+
collectDebugLogs: true,
|
|
381
|
+
collectHints: false,
|
|
382
|
+
collectStatistics: false,
|
|
383
|
+
collectCallMetadata: true,
|
|
384
|
+
});
|
|
376
385
|
const processor = new PublicProcessor(
|
|
377
386
|
globals,
|
|
378
387
|
guardedMerkleTrees,
|
|
379
388
|
contractsDB,
|
|
380
|
-
new
|
|
381
|
-
doMerkleOperations: true,
|
|
382
|
-
skipFeeEnforcement: true,
|
|
383
|
-
}),
|
|
389
|
+
new CppPublicTxSimulator(guardedMerkleTrees, contractsDB, globals, config),
|
|
384
390
|
new TestDateProvider(),
|
|
385
391
|
);
|
|
386
392
|
|
|
@@ -486,10 +492,14 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
486
492
|
|
|
487
493
|
const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.contractDataProvider));
|
|
488
494
|
const guardedMerkleTrees = new GuardedMerkleTreeOperations(forkedWorldTrees);
|
|
489
|
-
const
|
|
490
|
-
doMerkleOperations: true,
|
|
495
|
+
const config = PublicSimulatorConfig.from({
|
|
491
496
|
skipFeeEnforcement: true,
|
|
497
|
+
collectDebugLogs: true,
|
|
498
|
+
collectHints: false,
|
|
499
|
+
collectStatistics: false,
|
|
500
|
+
collectCallMetadata: true,
|
|
492
501
|
});
|
|
502
|
+
const simulator = new CppPublicTxSimulator(guardedMerkleTrees, contractsDB, globals, config);
|
|
493
503
|
const processor = new PublicProcessor(globals, guardedMerkleTrees, contractsDB, simulator, new TestDateProvider());
|
|
494
504
|
|
|
495
505
|
// We're simulating a scenario in which private execution immediately enqueues a public call and halts. The private
|
|
@@ -497,9 +507,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
497
507
|
// side-effect, which the AVM then expects to exist in order to use it as the nonce generator when siloing notes as
|
|
498
508
|
// unique.
|
|
499
509
|
const nonRevertibleAccumulatedData = PrivateToPublicAccumulatedData.empty();
|
|
500
|
-
|
|
501
|
-
nonRevertibleAccumulatedData.nullifiers[0] = getSingleTxBlockRequestHash(blockNumber);
|
|
502
|
-
}
|
|
510
|
+
nonRevertibleAccumulatedData.nullifiers[0] = getSingleTxBlockRequestHash(blockNumber);
|
|
503
511
|
|
|
504
512
|
// The enqueued public call itself we make be revertible so that the public execution is itself revertible, as tests
|
|
505
513
|
// may require producing reverts.
|
|
@@ -652,7 +660,8 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
652
660
|
return [this.nextBlockTimestamp, this.authwits];
|
|
653
661
|
}
|
|
654
662
|
|
|
655
|
-
private async getLastBlockNumber(): Promise<
|
|
656
|
-
|
|
663
|
+
private async getLastBlockNumber(): Promise<BlockNumber> {
|
|
664
|
+
const header = await this.stateMachine.node.getBlockHeader('latest');
|
|
665
|
+
return header ? header.globalVariables.blockNumber : BlockNumber.ZERO;
|
|
657
666
|
}
|
|
658
667
|
}
|
package/src/rpc_translator.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ContractInstanceWithAddress } from '@aztec/aztec.js/contracts';
|
|
2
2
|
import { Fr, Point } from '@aztec/aztec.js/fields';
|
|
3
3
|
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX } from '@aztec/constants';
|
|
4
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
4
5
|
import {
|
|
5
6
|
type IMiscOracle,
|
|
6
7
|
type IPrivateExecutionOracle,
|
|
@@ -117,7 +118,7 @@ export class RPCTranslator {
|
|
|
117
118
|
: undefined;
|
|
118
119
|
|
|
119
120
|
const anchorBlockNumber = fromSingle(foreignAnchorBlockNumberIsSome).toBool()
|
|
120
|
-
? fromSingle(foreignAnchorBlockNumberValue).toNumber()
|
|
121
|
+
? BlockNumber(fromSingle(foreignAnchorBlockNumberValue).toNumber())
|
|
121
122
|
: undefined;
|
|
122
123
|
|
|
123
124
|
const privateContextInputs = await this.stateHandler.enterPrivateState(contractAddress, anchorBlockNumber);
|
|
@@ -266,12 +267,7 @@ export class RPCTranslator {
|
|
|
266
267
|
]);
|
|
267
268
|
}
|
|
268
269
|
|
|
269
|
-
|
|
270
|
-
privateStoreInExecutionCache(
|
|
271
|
-
_foreignLength: ForeignCallSingle,
|
|
272
|
-
foreignValues: ForeignCallArray,
|
|
273
|
-
foreignHash: ForeignCallSingle,
|
|
274
|
-
) {
|
|
270
|
+
privateStoreInExecutionCache(foreignValues: ForeignCallArray, foreignHash: ForeignCallSingle) {
|
|
275
271
|
const values = fromArray(foreignValues);
|
|
276
272
|
const hash = fromSingle(foreignHash);
|
|
277
273
|
|
|
@@ -315,7 +311,7 @@ export class RPCTranslator {
|
|
|
315
311
|
) {
|
|
316
312
|
const contractAddress = addressFromSingle(foreignContractAddress);
|
|
317
313
|
const startStorageSlot = fromSingle(foreignStartStorageSlot);
|
|
318
|
-
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
314
|
+
const blockNumber = BlockNumber(fromSingle(foreignBlockNumber).toNumber());
|
|
319
315
|
const numberOfElements = fromSingle(foreignNumberOfElements).toNumber();
|
|
320
316
|
|
|
321
317
|
const values = await this.handlerAsUtility().utilityStorageRead(
|
|
@@ -329,7 +325,7 @@ export class RPCTranslator {
|
|
|
329
325
|
}
|
|
330
326
|
|
|
331
327
|
async utilityGetPublicDataWitness(foreignBlockNumber: ForeignCallSingle, foreignLeafSlot: ForeignCallSingle) {
|
|
332
|
-
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
328
|
+
const blockNumber = BlockNumber(fromSingle(foreignBlockNumber).toNumber());
|
|
333
329
|
const leafSlot = fromSingle(foreignLeafSlot);
|
|
334
330
|
|
|
335
331
|
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(blockNumber, leafSlot);
|
|
@@ -341,6 +337,7 @@ export class RPCTranslator {
|
|
|
341
337
|
}
|
|
342
338
|
|
|
343
339
|
async utilityGetNotes(
|
|
340
|
+
foreignOwner: ForeignCallSingle,
|
|
344
341
|
foreignStorageSlot: ForeignCallSingle,
|
|
345
342
|
foreignNumSelects: ForeignCallSingle,
|
|
346
343
|
foreignSelectByIndexes: ForeignCallArray,
|
|
@@ -358,6 +355,7 @@ export class RPCTranslator {
|
|
|
358
355
|
foreignMaxNotes: ForeignCallSingle,
|
|
359
356
|
foreignPackedRetrievedNoteLength: ForeignCallSingle,
|
|
360
357
|
) {
|
|
358
|
+
const owner = addressFromSingle(foreignOwner);
|
|
361
359
|
const storageSlot = fromSingle(foreignStorageSlot);
|
|
362
360
|
const numSelects = fromSingle(foreignNumSelects).toNumber();
|
|
363
361
|
const selectByIndexes = fromArray(foreignSelectByIndexes).map(fr => fr.toNumber());
|
|
@@ -376,6 +374,7 @@ export class RPCTranslator {
|
|
|
376
374
|
const packedRetrievedNoteLength = fromSingle(foreignPackedRetrievedNoteLength).toNumber();
|
|
377
375
|
|
|
378
376
|
const noteDatas = await this.handlerAsUtility().utilityGetNotes(
|
|
377
|
+
owner,
|
|
379
378
|
storageSlot,
|
|
380
379
|
numSelects,
|
|
381
380
|
selectByIndexes,
|
|
@@ -410,19 +409,31 @@ export class RPCTranslator {
|
|
|
410
409
|
}
|
|
411
410
|
|
|
412
411
|
privateNotifyCreatedNote(
|
|
412
|
+
foreignOwner: ForeignCallSingle,
|
|
413
413
|
foreignStorageSlot: ForeignCallSingle,
|
|
414
|
+
foreignRandomness: ForeignCallSingle,
|
|
414
415
|
foreignNoteTypeId: ForeignCallSingle,
|
|
415
416
|
foreignNote: ForeignCallArray,
|
|
416
417
|
foreignNoteHash: ForeignCallSingle,
|
|
417
418
|
foreignCounter: ForeignCallSingle,
|
|
418
419
|
) {
|
|
420
|
+
const owner = addressFromSingle(foreignOwner);
|
|
419
421
|
const storageSlot = fromSingle(foreignStorageSlot);
|
|
422
|
+
const randomness = fromSingle(foreignRandomness);
|
|
420
423
|
const noteTypeId = NoteSelector.fromField(fromSingle(foreignNoteTypeId));
|
|
421
424
|
const note = fromArray(foreignNote);
|
|
422
425
|
const noteHash = fromSingle(foreignNoteHash);
|
|
423
426
|
const counter = fromSingle(foreignCounter).toNumber();
|
|
424
427
|
|
|
425
|
-
this.handlerAsPrivate().privateNotifyCreatedNote(
|
|
428
|
+
this.handlerAsPrivate().privateNotifyCreatedNote(
|
|
429
|
+
owner,
|
|
430
|
+
storageSlot,
|
|
431
|
+
randomness,
|
|
432
|
+
noteTypeId,
|
|
433
|
+
note,
|
|
434
|
+
noteHash,
|
|
435
|
+
counter,
|
|
436
|
+
);
|
|
426
437
|
|
|
427
438
|
return toForeignCallResult([]);
|
|
428
439
|
}
|
|
@@ -505,7 +516,7 @@ export class RPCTranslator {
|
|
|
505
516
|
foreignBlockNumber: ForeignCallSingle,
|
|
506
517
|
foreignNullifier: ForeignCallSingle,
|
|
507
518
|
) {
|
|
508
|
-
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
519
|
+
const blockNumber = BlockNumber(fromSingle(foreignBlockNumber).toNumber());
|
|
509
520
|
const nullifier = fromSingle(foreignNullifier);
|
|
510
521
|
|
|
511
522
|
const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(blockNumber, nullifier);
|
|
@@ -549,6 +560,12 @@ export class RPCTranslator {
|
|
|
549
560
|
throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
|
|
550
561
|
}
|
|
551
562
|
|
|
563
|
+
public async privateIsSideEffectCounterRevertible(foreignSideEffectCounter: ForeignCallSingle) {
|
|
564
|
+
const sideEffectCounter = fromSingle(foreignSideEffectCounter).toNumber();
|
|
565
|
+
const isRevertible = await this.handlerAsPrivate().privateIsSideEffectCounterRevertible(sideEffectCounter);
|
|
566
|
+
return toForeignCallResult([toSingle(new Fr(isRevertible))]);
|
|
567
|
+
}
|
|
568
|
+
|
|
552
569
|
async utilityGetUtilityContext() {
|
|
553
570
|
const context = await this.handlerAsUtility().utilityGetUtilityContext();
|
|
554
571
|
|
|
@@ -556,7 +573,7 @@ export class RPCTranslator {
|
|
|
556
573
|
}
|
|
557
574
|
|
|
558
575
|
async utilityGetBlockHeader(foreignBlockNumber: ForeignCallSingle) {
|
|
559
|
-
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
576
|
+
const blockNumber = BlockNumber(fromSingle(foreignBlockNumber).toNumber());
|
|
560
577
|
|
|
561
578
|
const header = await this.handlerAsUtility().utilityGetBlockHeader(blockNumber);
|
|
562
579
|
|
|
@@ -571,7 +588,7 @@ export class RPCTranslator {
|
|
|
571
588
|
foreignTreeId: ForeignCallSingle,
|
|
572
589
|
foreignLeafValue: ForeignCallSingle,
|
|
573
590
|
) {
|
|
574
|
-
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
591
|
+
const blockNumber = BlockNumber(fromSingle(foreignBlockNumber).toNumber());
|
|
575
592
|
const treeId = fromSingle(foreignTreeId).toNumber();
|
|
576
593
|
const leafValue = fromSingle(foreignLeafValue);
|
|
577
594
|
|
|
@@ -589,7 +606,7 @@ export class RPCTranslator {
|
|
|
589
606
|
foreignBlockNumber: ForeignCallSingle,
|
|
590
607
|
foreignNullifier: ForeignCallSingle,
|
|
591
608
|
) {
|
|
592
|
-
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
609
|
+
const blockNumber = BlockNumber(fromSingle(foreignBlockNumber).toNumber());
|
|
593
610
|
const nullifier = fromSingle(foreignNullifier);
|
|
594
611
|
|
|
595
612
|
const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(blockNumber, nullifier);
|
|
@@ -921,7 +938,6 @@ export class RPCTranslator {
|
|
|
921
938
|
foreignFrom: ForeignCallSingle,
|
|
922
939
|
foreignTargetContractAddress: ForeignCallSingle,
|
|
923
940
|
foreignFunctionSelector: ForeignCallSingle,
|
|
924
|
-
_foreignArgsLength: ForeignCallSingle,
|
|
925
941
|
foreignArgs: ForeignCallArray,
|
|
926
942
|
foreignArgsHash: ForeignCallSingle,
|
|
927
943
|
foreignIsStaticCall: ForeignCallSingle,
|
|
@@ -948,7 +964,6 @@ export class RPCTranslator {
|
|
|
948
964
|
async txeSimulateUtilityFunction(
|
|
949
965
|
foreignTargetContractAddress: ForeignCallSingle,
|
|
950
966
|
foreignFunctionSelector: ForeignCallSingle,
|
|
951
|
-
_foreignArgsLength: ForeignCallSingle,
|
|
952
967
|
foreignArgs: ForeignCallArray,
|
|
953
968
|
) {
|
|
954
969
|
const targetContractAddress = addressFromSingle(foreignTargetContractAddress);
|
|
@@ -967,7 +982,6 @@ export class RPCTranslator {
|
|
|
967
982
|
async txePublicCallNewFlow(
|
|
968
983
|
foreignFrom: ForeignCallSingle,
|
|
969
984
|
foreignAddress: ForeignCallSingle,
|
|
970
|
-
_foreignLength: ForeignCallSingle,
|
|
971
985
|
foreignCalldata: ForeignCallArray,
|
|
972
986
|
foreignIsStaticCall: ForeignCallSingle,
|
|
973
987
|
) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ArchiverStoreHelper, KVArchiverDataStore, type PublishedL2Block } from '@aztec/archiver';
|
|
2
2
|
import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
|
|
3
|
+
import { BlockNumber, CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
4
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
5
|
import { Fr } from '@aztec/foundation/fields';
|
|
5
6
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
6
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
8
|
import type { L2Block, L2BlockSource, L2Tips, ValidateBlockResult } from '@aztec/stdlib/block';
|
|
9
|
+
import type { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
8
10
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
9
11
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
10
12
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
@@ -31,7 +33,7 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
|
|
|
31
33
|
* Gets the number of the latest L2 block processed by the block source implementation.
|
|
32
34
|
* @returns The number of the latest L2 block processed by the block source implementation.
|
|
33
35
|
*/
|
|
34
|
-
public getBlockNumber(): Promise<
|
|
36
|
+
public getBlockNumber(): Promise<BlockNumber> {
|
|
35
37
|
return this.store.getSynchedL2BlockNumber();
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -39,7 +41,7 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
|
|
|
39
41
|
* Gets the number of the latest L2 block proven seen by the block source implementation.
|
|
40
42
|
* @returns The number of the latest L2 block proven seen by the block source implementation.
|
|
41
43
|
*/
|
|
42
|
-
public getProvenBlockNumber(): Promise<
|
|
44
|
+
public getProvenBlockNumber(): Promise<BlockNumber> {
|
|
43
45
|
return this.store.getSynchedL2BlockNumber();
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -56,7 +58,7 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
|
|
|
56
58
|
if (number == 0) {
|
|
57
59
|
return undefined;
|
|
58
60
|
}
|
|
59
|
-
const blocks = await this.store.getPublishedBlocks(number, 1);
|
|
61
|
+
const blocks = await this.store.getPublishedBlocks(BlockNumber(number), 1);
|
|
60
62
|
return blocks.length === 0 ? undefined : blocks[0];
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -81,31 +83,47 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
|
|
|
81
83
|
if (number === 0) {
|
|
82
84
|
return undefined;
|
|
83
85
|
}
|
|
84
|
-
const headers = await this.store.getBlockHeaders(number, 1);
|
|
86
|
+
const headers = await this.store.getBlockHeaders(BlockNumber(number), 1);
|
|
85
87
|
return headers.length === 0 ? undefined : headers[0];
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
public getBlocks(from: number, limit: number, _proven?: boolean): Promise<L2Block[]> {
|
|
89
|
-
return this.getPublishedBlocks(from, limit).then(blocks => blocks.map(b => b.block));
|
|
91
|
+
return this.getPublishedBlocks(BlockNumber(from), limit).then(blocks => blocks.map(b => b.block));
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
public
|
|
94
|
+
public getPublishedCheckpoints(_from: CheckpointNumber, _limit: number): Promise<PublishedCheckpoint[]> {
|
|
95
|
+
throw new Error('TXE Archiver does not implement "getPublishedCheckpoints"');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public getCheckpointByArchive(_archive: Fr): Promise<Checkpoint | undefined> {
|
|
99
|
+
throw new Error('TXE Archiver does not implement "getCheckpointByArchive"');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
public getL2SlotNumber(): Promise<SlotNumber | undefined> {
|
|
93
103
|
throw new Error('TXE Archiver does not implement "getL2SlotNumber"');
|
|
94
104
|
}
|
|
95
105
|
|
|
96
|
-
public getL2EpochNumber(): Promise<
|
|
106
|
+
public getL2EpochNumber(): Promise<EpochNumber> {
|
|
97
107
|
throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
|
|
98
108
|
}
|
|
99
109
|
|
|
100
|
-
public
|
|
110
|
+
public getCheckpointsForEpoch(_epochNumber: EpochNumber): Promise<Checkpoint[]> {
|
|
111
|
+
throw new Error('TXE Archiver does not implement "getCheckpointsForEpoch"');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public getBlocksForEpoch(_epochNumber: EpochNumber): Promise<L2Block[]> {
|
|
101
115
|
throw new Error('TXE Archiver does not implement "getBlocksForEpoch"');
|
|
102
116
|
}
|
|
103
117
|
|
|
104
|
-
public getBlockHeadersForEpoch(_epochNumber:
|
|
118
|
+
public getBlockHeadersForEpoch(_epochNumber: EpochNumber): Promise<BlockHeader[]> {
|
|
105
119
|
throw new Error('TXE Archiver does not implement "getBlockHeadersForEpoch"');
|
|
106
120
|
}
|
|
107
121
|
|
|
108
|
-
public
|
|
122
|
+
public getL1ToL2MessagesForCheckpoint(_checkpointNumber: CheckpointNumber): Promise<Fr[]> {
|
|
123
|
+
throw new Error('TXE Archiver does not implement "getL1ToL2MessagesForCheckpoint"');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public isEpochComplete(_epochNumber: EpochNumber): Promise<boolean> {
|
|
109
127
|
throw new Error('TXE Archiver does not implement "isEpochComplete"');
|
|
110
128
|
}
|
|
111
129
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type {
|
|
2
3
|
AuthRequest,
|
|
3
4
|
ENR,
|
|
@@ -17,6 +18,10 @@ import type { BlockAttestation, BlockProposal } from '@aztec/stdlib/p2p';
|
|
|
17
18
|
import type { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
18
19
|
|
|
19
20
|
export class DummyP2P implements P2P {
|
|
21
|
+
public broadcastAttestations(_attestations: BlockAttestation[]): Promise<void> {
|
|
22
|
+
return Promise.resolve();
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
public validate(_txs: Tx[]): Promise<void> {
|
|
21
26
|
return Promise.resolve();
|
|
22
27
|
}
|
|
@@ -113,7 +118,7 @@ export class DummyP2P implements P2P {
|
|
|
113
118
|
throw new Error('DummyP2P does not implement "getTxsByHash"');
|
|
114
119
|
}
|
|
115
120
|
|
|
116
|
-
public getAttestationsForSlot(_slot:
|
|
121
|
+
public getAttestationsForSlot(_slot: SlotNumber, _proposalId?: string): Promise<BlockAttestation[]> {
|
|
117
122
|
throw new Error('DummyP2P does not implement "getAttestationForSlot"');
|
|
118
123
|
}
|
|
119
124
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockNumber, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
4
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
@@ -10,10 +11,10 @@ export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
public buildGlobalVariables(
|
|
13
|
-
_blockNumber:
|
|
14
|
+
_blockNumber: BlockNumber,
|
|
14
15
|
_coinbase: EthAddress,
|
|
15
16
|
_feeRecipient: AztecAddress,
|
|
16
|
-
_slotNumber?:
|
|
17
|
+
_slotNumber?: SlotNumber,
|
|
17
18
|
): Promise<GlobalVariables> {
|
|
18
19
|
return Promise.resolve(makeGlobalVariables());
|
|
19
20
|
}
|
|
@@ -59,7 +59,7 @@ export class TXEStateMachine {
|
|
|
59
59
|
|
|
60
60
|
public async handleL2Block(block: L2Block) {
|
|
61
61
|
await Promise.all([
|
|
62
|
-
this.synchronizer.handleL2Block(block),
|
|
62
|
+
this.synchronizer.handleL2Block(block.toL2Block()),
|
|
63
63
|
this.archiver.addBlocks([
|
|
64
64
|
PublishedL2Block.fromFields({
|
|
65
65
|
block,
|