@aztec/pxe 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/database/deferred_note_dao.d.ts +4 -0
- package/dest/database/deferred_note_dao.d.ts.map +1 -1
- package/dest/database/deferred_note_dao.js +6 -3
- package/dest/database/note_dao.d.ts +4 -0
- package/dest/database/note_dao.d.ts.map +1 -1
- package/dest/database/note_dao.js +7 -2
- package/dest/database/pxe_database_test_suite.js +2 -2
- package/dest/kernel_prover/kernel_prover.js +9 -9
- package/dest/kernel_prover/proof_creator.d.ts +10 -10
- package/dest/kernel_prover/proof_creator.d.ts.map +1 -1
- package/dest/kernel_prover/proof_creator.js +4 -4
- package/dest/note_processor/note_processor.d.ts.map +1 -1
- package/dest/note_processor/note_processor.js +4 -4
- package/dest/note_processor/produce_note_dao.d.ts.map +1 -1
- package/dest/note_processor/produce_note_dao.js +4 -4
- package/dest/pxe_service/create_pxe_service.d.ts.map +1 -1
- package/dest/pxe_service/create_pxe_service.js +8 -4
- package/dest/pxe_service/pxe_service.d.ts.map +1 -1
- package/dest/pxe_service/pxe_service.js +5 -5
- package/package.json +13 -12
- package/src/bin/index.ts +42 -0
- package/src/config/index.ts +40 -0
- package/src/contract_data_oracle/index.ts +185 -0
- package/src/contract_data_oracle/private_functions_tree.ts +127 -0
- package/src/contract_database/index.ts +1 -0
- package/src/contract_database/memory_contract_database.ts +58 -0
- package/src/database/contracts/contract_artifact_db.ts +19 -0
- package/src/database/contracts/contract_instance_db.ts +18 -0
- package/src/database/deferred_note_dao.ts +55 -0
- package/src/database/index.ts +1 -0
- package/src/database/kv_pxe_database.ts +409 -0
- package/src/database/note_dao.ts +97 -0
- package/src/database/pxe_database.ts +162 -0
- package/src/database/pxe_database_test_suite.ts +258 -0
- package/src/index.ts +11 -0
- package/src/kernel_oracle/index.ts +61 -0
- package/src/kernel_prover/index.ts +2 -0
- package/src/kernel_prover/kernel_prover.ts +388 -0
- package/src/kernel_prover/proof_creator.ts +157 -0
- package/src/kernel_prover/proving_data_oracle.ts +76 -0
- package/src/note_processor/index.ts +1 -0
- package/src/note_processor/note_processor.ts +282 -0
- package/src/note_processor/produce_note_dao.ts +132 -0
- package/src/pxe_http/index.ts +1 -0
- package/src/pxe_http/pxe_http_server.ts +73 -0
- package/src/pxe_service/create_pxe_service.ts +52 -0
- package/src/pxe_service/index.ts +3 -0
- package/src/pxe_service/pxe_service.ts +756 -0
- package/src/pxe_service/test/pxe_test_suite.ts +138 -0
- package/src/simulator/index.ts +24 -0
- package/src/simulator_oracle/index.ts +210 -0
- package/src/synchronizer/index.ts +1 -0
- package/src/synchronizer/synchronizer.ts +427 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DeployedContract,
|
|
3
|
+
INITIAL_L2_BLOCK_NUM,
|
|
4
|
+
PXE,
|
|
5
|
+
TxExecutionRequest,
|
|
6
|
+
randomDeployedContract,
|
|
7
|
+
} from '@aztec/circuit-types';
|
|
8
|
+
import { AztecAddress, CompleteAddress, Fr, FunctionData, Point, TxContext } from '@aztec/circuits.js';
|
|
9
|
+
import { Grumpkin } from '@aztec/circuits.js/barretenberg';
|
|
10
|
+
import { ConstantKeyPair } from '@aztec/key-store';
|
|
11
|
+
|
|
12
|
+
export const pxeTestSuite = (testName: string, pxeSetup: () => Promise<PXE>) => {
|
|
13
|
+
describe(testName, () => {
|
|
14
|
+
let pxe: PXE;
|
|
15
|
+
|
|
16
|
+
beforeAll(async () => {
|
|
17
|
+
pxe = await pxeSetup();
|
|
18
|
+
}, 120_000);
|
|
19
|
+
|
|
20
|
+
it('registers an account and returns it as an account only and not as a recipient', async () => {
|
|
21
|
+
const keyPair = ConstantKeyPair.random(new Grumpkin());
|
|
22
|
+
const completeAddress = CompleteAddress.fromPrivateKeyAndPartialAddress(keyPair.getPrivateKey(), Fr.random());
|
|
23
|
+
|
|
24
|
+
await pxe.registerAccount(keyPair.getPrivateKey(), completeAddress.partialAddress);
|
|
25
|
+
|
|
26
|
+
// Check that the account is correctly registered using the getAccounts and getRecipients methods
|
|
27
|
+
const accounts = await pxe.getRegisteredAccounts();
|
|
28
|
+
const recipients = await pxe.getRecipients();
|
|
29
|
+
expect(accounts).toContainEqual(completeAddress);
|
|
30
|
+
expect(recipients).not.toContainEqual(completeAddress);
|
|
31
|
+
|
|
32
|
+
// Check that the account is correctly registered using the getAccount and getRecipient methods
|
|
33
|
+
const account = await pxe.getRegisteredAccount(completeAddress.address);
|
|
34
|
+
const recipient = await pxe.getRecipient(completeAddress.address);
|
|
35
|
+
expect(account).toEqual(completeAddress);
|
|
36
|
+
expect(recipient).toBeUndefined();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('registers a recipient and returns it as a recipient only and not as an account', async () => {
|
|
40
|
+
const completeAddress = CompleteAddress.random();
|
|
41
|
+
|
|
42
|
+
await pxe.registerRecipient(completeAddress);
|
|
43
|
+
|
|
44
|
+
// Check that the recipient is correctly registered using the getAccounts and getRecipients methods
|
|
45
|
+
const accounts = await pxe.getRegisteredAccounts();
|
|
46
|
+
const recipients = await pxe.getRecipients();
|
|
47
|
+
expect(accounts).not.toContainEqual(completeAddress);
|
|
48
|
+
expect(recipients).toContainEqual(completeAddress);
|
|
49
|
+
|
|
50
|
+
// Check that the recipient is correctly registered using the getAccount and getRecipient methods
|
|
51
|
+
const account = await pxe.getRegisteredAccount(completeAddress.address);
|
|
52
|
+
const recipient = await pxe.getRecipient(completeAddress.address);
|
|
53
|
+
expect(account).toBeUndefined();
|
|
54
|
+
expect(recipient).toEqual(completeAddress);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('does not throw when registering the same account twice (just ignores the second attempt)', async () => {
|
|
58
|
+
const keyPair = ConstantKeyPair.random(new Grumpkin());
|
|
59
|
+
const completeAddress = CompleteAddress.fromPrivateKeyAndPartialAddress(keyPair.getPrivateKey(), Fr.random());
|
|
60
|
+
|
|
61
|
+
await pxe.registerAccount(keyPair.getPrivateKey(), completeAddress.partialAddress);
|
|
62
|
+
await pxe.registerAccount(keyPair.getPrivateKey(), completeAddress.partialAddress);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('cannot register a recipient with the same aztec address but different pub key or partial address', async () => {
|
|
66
|
+
const recipient1 = CompleteAddress.random();
|
|
67
|
+
const recipient2 = new CompleteAddress(recipient1.address, Point.random(), Fr.random());
|
|
68
|
+
|
|
69
|
+
await pxe.registerRecipient(recipient1);
|
|
70
|
+
await expect(() => pxe.registerRecipient(recipient2)).rejects.toThrow(
|
|
71
|
+
`Complete address with aztec address ${recipient1.address}`,
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('does not throw when registering the same recipient twice (just ignores the second attempt)', async () => {
|
|
76
|
+
const completeAddress = CompleteAddress.random();
|
|
77
|
+
|
|
78
|
+
await pxe.registerRecipient(completeAddress);
|
|
79
|
+
await pxe.registerRecipient(completeAddress);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('successfully adds a contract', async () => {
|
|
83
|
+
const contracts: DeployedContract[] = [randomDeployedContract(), randomDeployedContract()];
|
|
84
|
+
await pxe.addContracts(contracts);
|
|
85
|
+
|
|
86
|
+
const expectedContractAddresses = contracts.map(contract => contract.instance.address);
|
|
87
|
+
const contractAddresses = await pxe.getContracts();
|
|
88
|
+
|
|
89
|
+
// check if all the contracts were returned
|
|
90
|
+
expect(contractAddresses).toEqual(expect.arrayContaining(expectedContractAddresses));
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('throws when simulating a tx targeting public entrypoint', async () => {
|
|
94
|
+
const functionData = FunctionData.empty();
|
|
95
|
+
functionData.isPrivate = false;
|
|
96
|
+
const txExecutionRequest = TxExecutionRequest.from({
|
|
97
|
+
origin: AztecAddress.random(),
|
|
98
|
+
argsHash: new Fr(0),
|
|
99
|
+
functionData,
|
|
100
|
+
txContext: TxContext.empty(),
|
|
101
|
+
packedArguments: [],
|
|
102
|
+
authWitnesses: [],
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
await expect(async () => await pxe.simulateTx(txExecutionRequest, false)).rejects.toThrow(
|
|
106
|
+
'Public entrypoints are not allowed',
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Note: Not testing a successful run of `simulateTx`, `sendTx`, `getTxReceipt` and `viewTx` here as it requires
|
|
111
|
+
// a larger setup and it's sufficiently tested in the e2e tests.
|
|
112
|
+
|
|
113
|
+
it('throws when getting public storage for non-existent contract', async () => {
|
|
114
|
+
const contract = AztecAddress.random();
|
|
115
|
+
await expect(async () => await pxe.getPublicStorageAt(contract, new Fr(0n))).rejects.toThrow(
|
|
116
|
+
`Contract ${contract.toString()} is not deployed`,
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Note: Not testing `getExtendedContractData`, `getContractData` and `getUnencryptedLogs` here as these
|
|
121
|
+
// functions only call AztecNode and these methods are frequently used by the e2e tests.
|
|
122
|
+
|
|
123
|
+
it('successfully gets a block number', async () => {
|
|
124
|
+
const blockNum = await pxe.getBlockNumber();
|
|
125
|
+
expect(blockNum).toBeGreaterThanOrEqual(INITIAL_L2_BLOCK_NUM);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('successfully gets node info', async () => {
|
|
129
|
+
const nodeInfo = await pxe.getNodeInfo();
|
|
130
|
+
expect(typeof nodeInfo.protocolVersion).toEqual('number');
|
|
131
|
+
expect(typeof nodeInfo.chainId).toEqual('number');
|
|
132
|
+
expect(nodeInfo.l1ContractAddresses.rollupAddress.toString()).toMatch(/0x[a-fA-F0-9]+/);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Note: Not testing `isGlobalStateSynchronized`, `isAccountStateSynchronized` and `getSyncStatus` as these methods
|
|
136
|
+
// only call synchronizer.
|
|
137
|
+
});
|
|
138
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AztecNode, KeyStore } from '@aztec/circuit-types';
|
|
2
|
+
import { AcirSimulator } from '@aztec/simulator';
|
|
3
|
+
|
|
4
|
+
import { ContractDataOracle } from '../contract_data_oracle/index.js';
|
|
5
|
+
import { PxeDatabase } from '../database/pxe_database.js';
|
|
6
|
+
import { SimulatorOracle } from '../simulator_oracle/index.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Helper method to create an instance of the acir simulator.
|
|
10
|
+
*/
|
|
11
|
+
export function getAcirSimulator(
|
|
12
|
+
db: PxeDatabase,
|
|
13
|
+
aztecNode: AztecNode,
|
|
14
|
+
keyStore: KeyStore,
|
|
15
|
+
contractDataOracle?: ContractDataOracle,
|
|
16
|
+
) {
|
|
17
|
+
const simulatorOracle = new SimulatorOracle(
|
|
18
|
+
contractDataOracle ?? new ContractDataOracle(db),
|
|
19
|
+
db,
|
|
20
|
+
keyStore,
|
|
21
|
+
aztecNode,
|
|
22
|
+
);
|
|
23
|
+
return new AcirSimulator(simulatorOracle, aztecNode);
|
|
24
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AztecNode,
|
|
3
|
+
KeyStore,
|
|
4
|
+
L2Block,
|
|
5
|
+
MerkleTreeId,
|
|
6
|
+
NoteStatus,
|
|
7
|
+
NullifierMembershipWitness,
|
|
8
|
+
PublicDataWitness,
|
|
9
|
+
} from '@aztec/circuit-types';
|
|
10
|
+
import {
|
|
11
|
+
AztecAddress,
|
|
12
|
+
CompleteAddress,
|
|
13
|
+
EthAddress,
|
|
14
|
+
Fr,
|
|
15
|
+
FunctionSelector,
|
|
16
|
+
Header,
|
|
17
|
+
L1_TO_L2_MSG_TREE_HEIGHT,
|
|
18
|
+
} from '@aztec/circuits.js';
|
|
19
|
+
import { FunctionArtifactWithDebugMetadata } from '@aztec/foundation/abi';
|
|
20
|
+
import { createDebugLogger } from '@aztec/foundation/log';
|
|
21
|
+
import { DBOracle, KeyPair, MessageLoadOracleInputs } from '@aztec/simulator';
|
|
22
|
+
|
|
23
|
+
import { ContractDataOracle } from '../contract_data_oracle/index.js';
|
|
24
|
+
import { PxeDatabase } from '../database/index.js';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A data oracle that provides information needed for simulating a transaction.
|
|
28
|
+
*/
|
|
29
|
+
export class SimulatorOracle implements DBOracle {
|
|
30
|
+
constructor(
|
|
31
|
+
private contractDataOracle: ContractDataOracle,
|
|
32
|
+
private db: PxeDatabase,
|
|
33
|
+
private keyStore: KeyStore,
|
|
34
|
+
private aztecNode: AztecNode,
|
|
35
|
+
private log = createDebugLogger('aztec:pxe:simulator_oracle'),
|
|
36
|
+
) {}
|
|
37
|
+
|
|
38
|
+
async getNullifierKeyPair(accountAddress: AztecAddress, contractAddress: AztecAddress): Promise<KeyPair> {
|
|
39
|
+
const accountPublicKey = (await this.db.getCompleteAddress(accountAddress))!.publicKey;
|
|
40
|
+
const publicKey = await this.keyStore.getNullifierPublicKey(accountPublicKey);
|
|
41
|
+
const secretKey = await this.keyStore.getSiloedNullifierSecretKey(accountPublicKey, contractAddress);
|
|
42
|
+
return { publicKey, secretKey };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async getCompleteAddress(address: AztecAddress): Promise<CompleteAddress> {
|
|
46
|
+
const completeAddress = await this.db.getCompleteAddress(address);
|
|
47
|
+
if (!completeAddress) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
`No public key registered for address ${address.toString()}. Register it by calling pxe.registerRecipient(...) or pxe.registerAccount(...).\nSee docs for context: https://docs.aztec.network/developers/debugging/aztecnr-errors#simulation-error-No-public-key-registered-for-address-0x0-Register-it-by-calling-pxeregisterRecipient-or-pxeregisterAccount`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return completeAddress;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async getAuthWitness(messageHash: Fr): Promise<Fr[]> {
|
|
56
|
+
const witness = await this.db.getAuthWitness(messageHash);
|
|
57
|
+
if (!witness) {
|
|
58
|
+
throw new Error(`Unknown auth witness for message hash ${messageHash.toString()}`);
|
|
59
|
+
}
|
|
60
|
+
return witness;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async popCapsule(): Promise<Fr[]> {
|
|
64
|
+
const capsule = await this.db.popCapsule();
|
|
65
|
+
if (!capsule) {
|
|
66
|
+
throw new Error(`No capsules available`);
|
|
67
|
+
}
|
|
68
|
+
return capsule;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async getNotes(contractAddress: AztecAddress, storageSlot: Fr, status: NoteStatus) {
|
|
72
|
+
const noteDaos = await this.db.getNotes({
|
|
73
|
+
contractAddress,
|
|
74
|
+
storageSlot,
|
|
75
|
+
status,
|
|
76
|
+
});
|
|
77
|
+
return noteDaos.map(({ contractAddress, storageSlot, nonce, note, innerNoteHash, siloedNullifier, index }) => ({
|
|
78
|
+
contractAddress,
|
|
79
|
+
storageSlot,
|
|
80
|
+
nonce,
|
|
81
|
+
note,
|
|
82
|
+
innerNoteHash,
|
|
83
|
+
siloedNullifier,
|
|
84
|
+
// PXE can use this index to get full MembershipWitness
|
|
85
|
+
index,
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async getFunctionArtifact(
|
|
90
|
+
contractAddress: AztecAddress,
|
|
91
|
+
selector: FunctionSelector,
|
|
92
|
+
): Promise<FunctionArtifactWithDebugMetadata> {
|
|
93
|
+
const artifact = await this.contractDataOracle.getFunctionArtifact(contractAddress, selector);
|
|
94
|
+
const debug = await this.contractDataOracle.getFunctionDebugMetadata(contractAddress, selector);
|
|
95
|
+
return {
|
|
96
|
+
...artifact,
|
|
97
|
+
debug,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async getFunctionArtifactByName(
|
|
102
|
+
contractAddress: AztecAddress,
|
|
103
|
+
functionName: string,
|
|
104
|
+
): Promise<FunctionArtifactWithDebugMetadata | undefined> {
|
|
105
|
+
const artifact = await this.contractDataOracle.getFunctionArtifactByName(contractAddress, functionName);
|
|
106
|
+
if (!artifact) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const debug = await this.contractDataOracle.getFunctionDebugMetadata(contractAddress, artifact.selector);
|
|
111
|
+
return {
|
|
112
|
+
...artifact,
|
|
113
|
+
debug,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async getPortalContractAddress(contractAddress: AztecAddress): Promise<EthAddress> {
|
|
118
|
+
return await this.contractDataOracle.getPortalContractAddress(contractAddress);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Retrieves the L1ToL2Message associated with a specific message key
|
|
123
|
+
* Throws an error if the message key is not found
|
|
124
|
+
*
|
|
125
|
+
* @param msgKey - The key of the message to be retrieved
|
|
126
|
+
* @returns A promise that resolves to the message data, a sibling path and the
|
|
127
|
+
* index of the message in the l1ToL2MessageTree
|
|
128
|
+
*/
|
|
129
|
+
async getL1ToL2Message(msgKey: Fr): Promise<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>> {
|
|
130
|
+
const messageAndIndex = await this.aztecNode.getL1ToL2MessageAndIndex(msgKey);
|
|
131
|
+
const message = messageAndIndex.message;
|
|
132
|
+
const index = messageAndIndex.index;
|
|
133
|
+
const siblingPath = await this.aztecNode.getL1ToL2MessageSiblingPath('latest', index);
|
|
134
|
+
return new MessageLoadOracleInputs(message, index, siblingPath);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Gets the index of a commitment in the note hash tree.
|
|
139
|
+
* @param commitment - The commitment.
|
|
140
|
+
* @returns - The index of the commitment. Undefined if it does not exist in the tree.
|
|
141
|
+
*/
|
|
142
|
+
async getCommitmentIndex(commitment: Fr) {
|
|
143
|
+
return await this.aztecNode.findLeafIndex('latest', MerkleTreeId.NOTE_HASH_TREE, commitment);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async getNullifierIndex(nullifier: Fr) {
|
|
147
|
+
return await this.aztecNode.findLeafIndex('latest', MerkleTreeId.NULLIFIER_TREE, nullifier);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public async findLeafIndex(blockNumber: number, treeId: MerkleTreeId, leafValue: Fr): Promise<bigint | undefined> {
|
|
151
|
+
return await this.aztecNode.findLeafIndex(blockNumber, treeId, leafValue);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
public async getSiblingPath(blockNumber: number, treeId: MerkleTreeId, leafIndex: bigint): Promise<Fr[]> {
|
|
155
|
+
switch (treeId) {
|
|
156
|
+
case MerkleTreeId.CONTRACT_TREE:
|
|
157
|
+
return (await this.aztecNode.getContractSiblingPath(blockNumber, leafIndex)).toFields();
|
|
158
|
+
case MerkleTreeId.NULLIFIER_TREE:
|
|
159
|
+
return (await this.aztecNode.getNullifierSiblingPath(blockNumber, leafIndex)).toFields();
|
|
160
|
+
case MerkleTreeId.NOTE_HASH_TREE:
|
|
161
|
+
return (await this.aztecNode.getNoteHashSiblingPath(blockNumber, leafIndex)).toFields();
|
|
162
|
+
case MerkleTreeId.PUBLIC_DATA_TREE:
|
|
163
|
+
return (await this.aztecNode.getPublicDataSiblingPath(blockNumber, leafIndex)).toFields();
|
|
164
|
+
case MerkleTreeId.ARCHIVE:
|
|
165
|
+
return (await this.aztecNode.getArchiveSiblingPath(blockNumber, leafIndex)).toFields();
|
|
166
|
+
default:
|
|
167
|
+
throw new Error('Not implemented');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
public getNullifierMembershipWitness(
|
|
172
|
+
blockNumber: number,
|
|
173
|
+
nullifier: Fr,
|
|
174
|
+
): Promise<NullifierMembershipWitness | undefined> {
|
|
175
|
+
return this.aztecNode.getNullifierMembershipWitness(blockNumber, nullifier);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
public getLowNullifierMembershipWitness(
|
|
179
|
+
blockNumber: number,
|
|
180
|
+
nullifier: Fr,
|
|
181
|
+
): Promise<NullifierMembershipWitness | undefined> {
|
|
182
|
+
return this.aztecNode.getLowNullifierMembershipWitness(blockNumber, nullifier);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
public async getBlock(blockNumber: number): Promise<L2Block | undefined> {
|
|
186
|
+
return await this.aztecNode.getBlock(blockNumber);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
public async getPublicDataTreeWitness(blockNumber: number, leafSlot: Fr): Promise<PublicDataWitness | undefined> {
|
|
190
|
+
return await this.aztecNode.getPublicDataTreeWitness(blockNumber, leafSlot);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Retrieve the databases view of the Block Header object.
|
|
195
|
+
* This structure is fed into the circuits simulator and is used to prove against certain historical roots.
|
|
196
|
+
*
|
|
197
|
+
* @returns A Promise that resolves to a Header object.
|
|
198
|
+
*/
|
|
199
|
+
getHeader(): Promise<Header> {
|
|
200
|
+
return Promise.resolve(this.db.getHeader());
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Fetches the current block number.
|
|
205
|
+
* @returns The block number.
|
|
206
|
+
*/
|
|
207
|
+
public async getBlockNumber(): Promise<number> {
|
|
208
|
+
return await this.aztecNode.getBlockNumber();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './synchronizer.js';
|