@aztec/pxe 0.57.0 → 0.59.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/contract_data_oracle/index.d.ts +1 -2
- package/dest/contract_data_oracle/index.d.ts.map +1 -1
- package/dest/contract_data_oracle/index.js +1 -1
- package/dest/contract_data_oracle/private_functions_tree.d.ts +1 -2
- package/dest/contract_data_oracle/private_functions_tree.d.ts.map +1 -1
- package/dest/contract_data_oracle/private_functions_tree.js +1 -1
- package/dest/database/contracts/contract_instance_db.d.ts +1 -2
- package/dest/database/contracts/contract_instance_db.d.ts.map +1 -1
- package/dest/database/kv_pxe_database.d.ts +1 -2
- package/dest/database/kv_pxe_database.d.ts.map +1 -1
- package/dest/database/kv_pxe_database.js +2 -3
- package/dest/database/pxe_database.d.ts +1 -2
- package/dest/database/pxe_database.d.ts.map +1 -1
- package/dest/database/pxe_database_test_suite.d.ts.map +1 -1
- package/dest/database/pxe_database_test_suite.js +2 -3
- package/dest/kernel_oracle/index.d.ts +7 -3
- package/dest/kernel_oracle/index.d.ts.map +1 -1
- package/dest/kernel_oracle/index.js +6 -5
- package/dest/kernel_prover/kernel_prover.d.ts.map +1 -1
- package/dest/kernel_prover/kernel_prover.js +12 -6
- package/dest/kernel_prover/proving_data_oracle.d.ts +2 -2
- package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -1
- package/dest/kernel_prover/test/test_circuit_prover.d.ts.map +1 -1
- package/dest/kernel_prover/test/test_circuit_prover.js +3 -3
- package/dest/note_processor/note_processor.d.ts +3 -3
- package/dest/note_processor/note_processor.d.ts.map +1 -1
- package/dest/note_processor/note_processor.js +4 -4
- package/dest/pxe_http/pxe_http_server.d.ts.map +1 -1
- package/dest/pxe_http/pxe_http_server.js +3 -2
- package/dest/pxe_service/create_pxe_service.d.ts.map +1 -1
- package/dest/pxe_service/create_pxe_service.js +2 -18
- package/dest/pxe_service/pxe_service.d.ts +1 -3
- package/dest/pxe_service/pxe_service.d.ts.map +1 -1
- package/dest/pxe_service/pxe_service.js +21 -13
- package/dest/simulator_oracle/index.d.ts +1 -2
- package/dest/simulator_oracle/index.d.ts.map +1 -1
- package/dest/simulator_oracle/index.js +1 -1
- package/dest/synchronizer/synchronizer.d.ts +2 -2
- package/dest/synchronizer/synchronizer.d.ts.map +1 -1
- package/dest/synchronizer/synchronizer.js +6 -10
- package/package.json +14 -14
- package/src/contract_data_oracle/index.ts +1 -2
- package/src/contract_data_oracle/private_functions_tree.ts +1 -1
- package/src/database/contracts/contract_instance_db.ts +1 -2
- package/src/database/kv_pxe_database.ts +7 -2
- package/src/database/pxe_database.ts +6 -2
- package/src/database/pxe_database_test_suite.ts +7 -2
- package/src/kernel_oracle/index.ts +5 -4
- package/src/kernel_prover/kernel_prover.ts +22 -4
- package/src/kernel_prover/proving_data_oracle.ts +2 -1
- package/src/kernel_prover/test/test_circuit_prover.ts +2 -1
- package/src/note_processor/note_processor.ts +6 -6
- package/src/pxe_http/pxe_http_server.ts +2 -1
- package/src/pxe_service/create_pxe_service.ts +1 -18
- package/src/pxe_service/pxe_service.ts +29 -13
- package/src/simulator_oracle/index.ts +1 -1
- package/src/synchronizer/synchronizer.ts +12 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AztecNode } from '@aztec/circuit-types';
|
|
1
|
+
import { type AztecNode, type L2BlockNumber } from '@aztec/circuit-types';
|
|
2
2
|
import {
|
|
3
3
|
type AztecAddress,
|
|
4
4
|
type Fr,
|
|
@@ -30,6 +30,7 @@ export class KernelOracle implements ProvingDataOracle {
|
|
|
30
30
|
private contractDataOracle: ContractDataOracle,
|
|
31
31
|
private keyStore: KeyStore,
|
|
32
32
|
private node: AztecNode,
|
|
33
|
+
private blockNumber: L2BlockNumber = 'latest',
|
|
33
34
|
private log = createDebugLogger('aztec:pxe:kernel_oracle'),
|
|
34
35
|
) {}
|
|
35
36
|
|
|
@@ -56,7 +57,7 @@ export class KernelOracle implements ProvingDataOracle {
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
async getNoteHashMembershipWitness(leafIndex: bigint): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>> {
|
|
59
|
-
const path = await this.node.getNoteHashSiblingPath(
|
|
60
|
+
const path = await this.node.getNoteHashSiblingPath(this.blockNumber, leafIndex);
|
|
60
61
|
return new MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT>(
|
|
61
62
|
path.pathSize,
|
|
62
63
|
leafIndex,
|
|
@@ -65,11 +66,11 @@ export class KernelOracle implements ProvingDataOracle {
|
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
getNullifierMembershipWitness(nullifier: Fr) {
|
|
68
|
-
return this.node.getNullifierMembershipWitness(
|
|
69
|
+
return this.node.getNullifierMembershipWitness(this.blockNumber, nullifier);
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
async getNoteHashTreeRoot(): Promise<Fr> {
|
|
72
|
-
const header = await this.node.getHeader();
|
|
73
|
+
const header = await this.node.getHeader(this.blockNumber);
|
|
73
74
|
return header.state.partial.noteHashTree.root;
|
|
74
75
|
}
|
|
75
76
|
|
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
getFinalMinRevertibleSideEffectCounter,
|
|
10
10
|
} from '@aztec/circuit-types';
|
|
11
11
|
import {
|
|
12
|
+
CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS,
|
|
12
13
|
Fr,
|
|
14
|
+
PROTOCOL_CONTRACT_TREE_HEIGHT,
|
|
13
15
|
PrivateCallData,
|
|
14
16
|
PrivateKernelCircuitPublicInputs,
|
|
15
17
|
PrivateKernelData,
|
|
@@ -21,10 +23,16 @@ import {
|
|
|
21
23
|
VK_TREE_HEIGHT,
|
|
22
24
|
VerificationKeyAsFields,
|
|
23
25
|
} from '@aztec/circuits.js';
|
|
26
|
+
import { makeTuple } from '@aztec/foundation/array';
|
|
24
27
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
25
28
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
26
29
|
import { pushTestData } from '@aztec/foundation/testing';
|
|
27
30
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types';
|
|
31
|
+
import {
|
|
32
|
+
getProtocolContractSiblingPath,
|
|
33
|
+
isProtocolContract,
|
|
34
|
+
protocolContractTreeRoot,
|
|
35
|
+
} from '@aztec/protocol-contracts';
|
|
28
36
|
|
|
29
37
|
import { type WitnessMap } from '@noir-lang/types';
|
|
30
38
|
|
|
@@ -33,7 +41,7 @@ import { type ProvingDataOracle } from './proving_data_oracle.js';
|
|
|
33
41
|
|
|
34
42
|
const NULL_PROVE_OUTPUT: PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs> = {
|
|
35
43
|
publicInputs: PrivateKernelCircuitPublicInputs.empty(),
|
|
36
|
-
verificationKey: VerificationKeyAsFields.makeEmpty(),
|
|
44
|
+
verificationKey: VerificationKeyAsFields.makeEmpty(CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS),
|
|
37
45
|
outputWitness: new Map(),
|
|
38
46
|
bytecode: Buffer.from([]),
|
|
39
47
|
};
|
|
@@ -119,7 +127,12 @@ export class KernelProver {
|
|
|
119
127
|
const privateCallData = await this.createPrivateCallData(currentExecution, appVk.verificationKey);
|
|
120
128
|
|
|
121
129
|
if (firstIteration) {
|
|
122
|
-
const proofInput = new PrivateKernelInitCircuitPrivateInputs(
|
|
130
|
+
const proofInput = new PrivateKernelInitCircuitPrivateInputs(
|
|
131
|
+
txRequest,
|
|
132
|
+
getVKTreeRoot(),
|
|
133
|
+
protocolContractTreeRoot,
|
|
134
|
+
privateCallData,
|
|
135
|
+
);
|
|
123
136
|
pushTestData('private-kernel-inputs-init', proofInput);
|
|
124
137
|
output = await this.proofCreator.simulateProofInit(proofInput);
|
|
125
138
|
acirs.push(output.bytecode);
|
|
@@ -195,7 +208,7 @@ export class KernelProver {
|
|
|
195
208
|
contractAddress,
|
|
196
209
|
functionData.selector,
|
|
197
210
|
);
|
|
198
|
-
const { contractClassId,
|
|
211
|
+
const { contractClassId, publicKeys, saltedInitializationHash } = await this.oracle.getContractAddressPreimage(
|
|
199
212
|
contractAddress,
|
|
200
213
|
);
|
|
201
214
|
const { artifactHash: contractClassArtifactHash, publicBytecodeCommitment: contractClassPublicBytecodeCommitment } =
|
|
@@ -205,14 +218,19 @@ export class KernelProver {
|
|
|
205
218
|
// const acirHash = keccak256(Buffer.from(bytecode, 'hex'));
|
|
206
219
|
const acirHash = Fr.fromBuffer(Buffer.alloc(32, 0));
|
|
207
220
|
|
|
221
|
+
const protocolContractSiblingPath = isProtocolContract(contractAddress)
|
|
222
|
+
? getProtocolContractSiblingPath(contractAddress)
|
|
223
|
+
: makeTuple(PROTOCOL_CONTRACT_TREE_HEIGHT, Fr.zero);
|
|
224
|
+
|
|
208
225
|
return PrivateCallData.from({
|
|
209
226
|
callStackItem,
|
|
210
227
|
vk,
|
|
211
|
-
|
|
228
|
+
publicKeys,
|
|
212
229
|
contractClassArtifactHash,
|
|
213
230
|
contractClassPublicBytecodeCommitment,
|
|
214
231
|
saltedInitializationHash,
|
|
215
232
|
functionLeafMembershipWitness,
|
|
233
|
+
protocolContractSiblingPath,
|
|
216
234
|
acirHash,
|
|
217
235
|
});
|
|
218
236
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type MembershipWitness,
|
|
8
8
|
type NOTE_HASH_TREE_HEIGHT,
|
|
9
9
|
type Point,
|
|
10
|
+
type PublicKeys,
|
|
10
11
|
type VK_TREE_HEIGHT,
|
|
11
12
|
type VerificationKeyAsFields,
|
|
12
13
|
} from '@aztec/circuits.js';
|
|
@@ -20,7 +21,7 @@ export interface ProvingDataOracle {
|
|
|
20
21
|
/** Retrieves the preimage of a contract address from the registered contract instances db. */
|
|
21
22
|
getContractAddressPreimage(
|
|
22
23
|
address: AztecAddress,
|
|
23
|
-
): Promise<{ saltedInitializationHash: Fr;
|
|
24
|
+
): Promise<{ saltedInitializationHash: Fr; publicKeys: PublicKeys; contractClassId: Fr }>;
|
|
24
25
|
|
|
25
26
|
/** Retrieves the preimage of a contract class id from the contract classes db. */
|
|
26
27
|
getContractClassIdPreimage(
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from '@aztec/circuit-types';
|
|
6
6
|
import type { CircuitSimulationStats } from '@aztec/circuit-types/stats';
|
|
7
7
|
import {
|
|
8
|
+
CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS,
|
|
8
9
|
ClientIvcProof,
|
|
9
10
|
type PrivateKernelCircuitPublicInputs,
|
|
10
11
|
type PrivateKernelInitCircuitPrivateInputs,
|
|
@@ -111,7 +112,7 @@ export class TestPrivateKernelProver implements PrivateKernelProver {
|
|
|
111
112
|
_appCircuitName?: string | undefined,
|
|
112
113
|
): Promise<AppCircuitSimulateOutput> {
|
|
113
114
|
const appCircuitProofOutput: AppCircuitSimulateOutput = {
|
|
114
|
-
verificationKey: VerificationKeyAsFields.makeEmpty(),
|
|
115
|
+
verificationKey: VerificationKeyAsFields.makeEmpty(CLIENT_IVC_VERIFICATION_KEY_LENGTH_IN_FIELDS),
|
|
115
116
|
};
|
|
116
117
|
return Promise.resolve(appCircuitProofOutput);
|
|
117
118
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AztecNode, L1NotePayload, type L2Block } from '@aztec/circuit-types';
|
|
2
2
|
import { type NoteProcessorStats } from '@aztec/circuit-types/stats';
|
|
3
|
-
import { type
|
|
3
|
+
import { type CompleteAddress, INITIAL_L2_BLOCK_NUM, MAX_NOTE_HASHES_PER_TX, type PublicKey } from '@aztec/circuits.js';
|
|
4
4
|
import { type Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import { type Logger, createDebugLogger } from '@aztec/foundation/log';
|
|
6
6
|
import { Timer } from '@aztec/foundation/timer';
|
|
@@ -47,7 +47,7 @@ export class NoteProcessor {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
private constructor(
|
|
50
|
-
public readonly account:
|
|
50
|
+
public readonly account: CompleteAddress,
|
|
51
51
|
/** The public counterpart to the secret key to be used in the decryption of incoming note logs. */
|
|
52
52
|
private readonly ivpkM: PublicKey,
|
|
53
53
|
/** The public counterpart to the secret key to be used in the decryption of outgoing note logs. */
|
|
@@ -61,7 +61,7 @@ export class NoteProcessor {
|
|
|
61
61
|
) {}
|
|
62
62
|
|
|
63
63
|
public static async create(
|
|
64
|
-
account:
|
|
64
|
+
account: CompleteAddress,
|
|
65
65
|
keyStore: KeyStore,
|
|
66
66
|
db: PxeDatabase,
|
|
67
67
|
node: AztecNode,
|
|
@@ -69,8 +69,8 @@ export class NoteProcessor {
|
|
|
69
69
|
simulator = getAcirSimulator(db, node, keyStore),
|
|
70
70
|
log = createDebugLogger('aztec:note_processor'),
|
|
71
71
|
) {
|
|
72
|
-
const ivpkM = await keyStore.getMasterIncomingViewingPublicKey(account);
|
|
73
|
-
const ovpkM = await keyStore.getMasterOutgoingViewingPublicKey(account);
|
|
72
|
+
const ivpkM = await keyStore.getMasterIncomingViewingPublicKey(account.address);
|
|
73
|
+
const ovpkM = await keyStore.getMasterOutgoingViewingPublicKey(account.address);
|
|
74
74
|
|
|
75
75
|
return new NoteProcessor(account, ivpkM, ovpkM, keyStore, db, node, startingBlock, simulator, log);
|
|
76
76
|
}
|
|
@@ -225,7 +225,7 @@ export class NoteProcessor {
|
|
|
225
225
|
const incomingNotes = blocksAndNotes.flatMap(b => b.incomingNotes);
|
|
226
226
|
const outgoingNotes = blocksAndNotes.flatMap(b => b.outgoingNotes);
|
|
227
227
|
if (incomingNotes.length || outgoingNotes.length) {
|
|
228
|
-
await this.db.addNotes(incomingNotes, outgoingNotes, this.account);
|
|
228
|
+
await this.db.addNotes(incomingNotes, outgoingNotes, this.account.address);
|
|
229
229
|
incomingNotes.forEach(noteDao => {
|
|
230
230
|
this.log.verbose(
|
|
231
231
|
`Added incoming note for contract ${noteDao.contractAddress} at slot ${
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
UnencryptedL2Log,
|
|
27
27
|
UniqueNote,
|
|
28
28
|
} from '@aztec/circuit-types';
|
|
29
|
-
import { FunctionSelector, PrivateCallStackItem } from '@aztec/circuits.js';
|
|
29
|
+
import { FunctionSelector, PrivateCallStackItem, PublicKeys } from '@aztec/circuits.js';
|
|
30
30
|
import { NoteSelector } from '@aztec/foundation/abi';
|
|
31
31
|
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
32
32
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
@@ -57,6 +57,7 @@ export function createPXERpcServer(pxeService: PXE): JsonRpcServer {
|
|
|
57
57
|
GrumpkinScalar,
|
|
58
58
|
Note,
|
|
59
59
|
ExtendedNote,
|
|
60
|
+
PublicKeys,
|
|
60
61
|
UniqueNote,
|
|
61
62
|
SiblingPath,
|
|
62
63
|
AuthWitness,
|
|
@@ -4,12 +4,6 @@ import { randomBytes } from '@aztec/foundation/crypto';
|
|
|
4
4
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { KeyStore } from '@aztec/key-store';
|
|
6
6
|
import { createStore } from '@aztec/kv-store/utils';
|
|
7
|
-
import { getCanonicalAuthRegistry } from '@aztec/protocol-contracts/auth-registry';
|
|
8
|
-
import { getCanonicalClassRegisterer } from '@aztec/protocol-contracts/class-registerer';
|
|
9
|
-
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
10
|
-
import { getCanonicalInstanceDeployer } from '@aztec/protocol-contracts/instance-deployer';
|
|
11
|
-
import { getCanonicalMultiCallEntrypointContract } from '@aztec/protocol-contracts/multi-call-entrypoint';
|
|
12
|
-
import { getCanonicalRouter } from '@aztec/protocol-contracts/router';
|
|
13
7
|
|
|
14
8
|
import { type PXEServiceConfig } from '../config/index.js';
|
|
15
9
|
import { KVPxeDatabase } from '../database/kv_pxe_database.js';
|
|
@@ -45,17 +39,6 @@ export async function createPXEService(
|
|
|
45
39
|
|
|
46
40
|
const prover = proofCreator ?? (await createProver(config, logSuffix));
|
|
47
41
|
const server = new PXEService(keyStore, aztecNode, db, prover, config, logSuffix);
|
|
48
|
-
for (const contract of [
|
|
49
|
-
getCanonicalClassRegisterer(),
|
|
50
|
-
getCanonicalInstanceDeployer(),
|
|
51
|
-
getCanonicalMultiCallEntrypointContract(),
|
|
52
|
-
getCanonicalFeeJuice(),
|
|
53
|
-
getCanonicalAuthRegistry(),
|
|
54
|
-
getCanonicalRouter(),
|
|
55
|
-
]) {
|
|
56
|
-
await server.registerContract(contract);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
42
|
await server.start();
|
|
60
43
|
return server;
|
|
61
44
|
}
|
|
@@ -71,5 +54,5 @@ function createProver(config: PXEServiceConfig, logSuffix?: string) {
|
|
|
71
54
|
}
|
|
72
55
|
const bbConfig = config as Required<Pick<PXEServiceConfig, 'bbBinaryPath' | 'bbWorkingDirectory'>> & PXEServiceConfig;
|
|
73
56
|
const log = createDebugLogger('aztec:pxe:bb-native-prover' + (logSuffix ? `:${logSuffix}` : ''));
|
|
74
|
-
return BBNativePrivateKernelProver.new(bbConfig, log);
|
|
57
|
+
return BBNativePrivateKernelProver.new({ bbSkipCleanup: false, ...bbConfig }, log);
|
|
75
58
|
}
|
|
@@ -36,7 +36,10 @@ import { type NoteProcessorStats } from '@aztec/circuit-types/stats';
|
|
|
36
36
|
import {
|
|
37
37
|
AztecAddress,
|
|
38
38
|
type CompleteAddress,
|
|
39
|
+
type ContractClassWithId,
|
|
40
|
+
type ContractInstanceWithAddress,
|
|
39
41
|
type L1_TO_L2_MSG_TREE_HEIGHT,
|
|
42
|
+
type NodeInfo,
|
|
40
43
|
PUBLIC_DISPATCH_SELECTOR,
|
|
41
44
|
type PartialAddress,
|
|
42
45
|
type PrivateKernelTailCircuitPublicInputs,
|
|
@@ -56,13 +59,12 @@ import { Fr, type Point } from '@aztec/foundation/fields';
|
|
|
56
59
|
import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
|
|
57
60
|
import { SerialQueue } from '@aztec/foundation/queue';
|
|
58
61
|
import { type KeyStore } from '@aztec/key-store';
|
|
59
|
-
import {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
import {
|
|
63
|
+
ProtocolContractAddress,
|
|
64
|
+
getCanonicalProtocolContract,
|
|
65
|
+
protocolContractNames,
|
|
66
|
+
} from '@aztec/protocol-contracts';
|
|
63
67
|
import { type AcirSimulator, resolveAssertionMessage, resolveOpcodeLocations } from '@aztec/simulator';
|
|
64
|
-
import { type ContractClassWithId, type ContractInstanceWithAddress } from '@aztec/types/contracts';
|
|
65
|
-
import { type NodeInfo } from '@aztec/types/interfaces';
|
|
66
68
|
|
|
67
69
|
import { type PXEServiceConfig, getPackageInfo } from '../config/index.js';
|
|
68
70
|
import { ContractDataOracle } from '../contract_data_oracle/index.js';
|
|
@@ -115,6 +117,7 @@ export class PXEService implements PXE {
|
|
|
115
117
|
const { l2BlockPollingIntervalMS } = this.config;
|
|
116
118
|
await this.synchronizer.start(1, l2BlockPollingIntervalMS);
|
|
117
119
|
await this.restoreNoteProcessors();
|
|
120
|
+
await this.#registerProtocolContracts();
|
|
118
121
|
const info = await this.getNodeInfo();
|
|
119
122
|
this.log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.protocolVersion}`);
|
|
120
123
|
}
|
|
@@ -133,7 +136,7 @@ export class PXEService implements PXE {
|
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
count++;
|
|
136
|
-
await this.synchronizer.addAccount(address
|
|
139
|
+
await this.synchronizer.addAccount(address, this.keyStore, this.config.l2StartingBlock);
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
if (count > 0) {
|
|
@@ -192,7 +195,7 @@ export class PXEService implements PXE {
|
|
|
192
195
|
this.log.info(`Account:\n "${accountCompleteAddress.address.toString()}"\n already registered.`);
|
|
193
196
|
return accountCompleteAddress;
|
|
194
197
|
} else {
|
|
195
|
-
await this.synchronizer.addAccount(accountCompleteAddress
|
|
198
|
+
await this.synchronizer.addAccount(accountCompleteAddress, this.keyStore, this.config.l2StartingBlock);
|
|
196
199
|
this.log.info(`Registered account ${accountCompleteAddress.address.toString()}`);
|
|
197
200
|
this.log.debug(`Registered account\n ${accountCompleteAddress.toReadableString()}`);
|
|
198
201
|
}
|
|
@@ -660,14 +663,24 @@ export class PXEService implements PXE {
|
|
|
660
663
|
return Promise.resolve({
|
|
661
664
|
pxeVersion: this.packageVersion,
|
|
662
665
|
protocolContractAddresses: {
|
|
663
|
-
classRegisterer:
|
|
664
|
-
feeJuice:
|
|
665
|
-
instanceDeployer:
|
|
666
|
-
multiCallEntrypoint:
|
|
666
|
+
classRegisterer: ProtocolContractAddress.ContractClassRegisterer,
|
|
667
|
+
feeJuice: ProtocolContractAddress.FeeJuice,
|
|
668
|
+
instanceDeployer: ProtocolContractAddress.ContractInstanceDeployer,
|
|
669
|
+
multiCallEntrypoint: ProtocolContractAddress.MultiCallEntrypoint,
|
|
667
670
|
},
|
|
668
671
|
});
|
|
669
672
|
}
|
|
670
673
|
|
|
674
|
+
async #registerProtocolContracts() {
|
|
675
|
+
for (const name of protocolContractNames) {
|
|
676
|
+
const { address, contractClass, instance, artifact } = getCanonicalProtocolContract(name);
|
|
677
|
+
await this.db.addContractArtifact(contractClass.id, artifact);
|
|
678
|
+
await this.db.addContractInstance(instance);
|
|
679
|
+
await this.synchronizer.reprocessDeferredNotesForContract(address);
|
|
680
|
+
this.log.info(`Added protocol contract ${name} at ${address.toString()}`);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
671
684
|
/**
|
|
672
685
|
* Retrieves the simulation parameters required to run an ACIR simulation.
|
|
673
686
|
* This includes the contract address, function artifact, and historical tree roots.
|
|
@@ -807,7 +820,10 @@ export class PXEService implements PXE {
|
|
|
807
820
|
proofCreator: PrivateKernelProver,
|
|
808
821
|
privateExecutionResult: PrivateExecutionResult,
|
|
809
822
|
): Promise<PrivateKernelSimulateOutput<PrivateKernelTailCircuitPublicInputs>> {
|
|
810
|
-
|
|
823
|
+
// use the block the tx was simulated against
|
|
824
|
+
const block =
|
|
825
|
+
privateExecutionResult.callStackItem.publicInputs.historicalHeader.globalVariables.blockNumber.toNumber();
|
|
826
|
+
const kernelOracle = new KernelOracle(this.contractDataOracle, this.keyStore, this.node, block);
|
|
811
827
|
const kernelProver = new KernelProver(kernelOracle, proofCreator);
|
|
812
828
|
this.log.debug(`Executing kernel prover...`);
|
|
813
829
|
return await kernelProver.prove(txExecutionRequest.toTxRequest(), privateExecutionResult);
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
type AztecAddress,
|
|
12
12
|
type CompleteAddress,
|
|
13
|
+
type ContractInstance,
|
|
13
14
|
type Fr,
|
|
14
15
|
type FunctionSelector,
|
|
15
16
|
type Header,
|
|
@@ -20,7 +21,6 @@ import { type FunctionArtifact, getFunctionArtifact } from '@aztec/foundation/ab
|
|
|
20
21
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
21
22
|
import { type KeyStore } from '@aztec/key-store';
|
|
22
23
|
import { type DBOracle, MessageLoadOracleInputs } from '@aztec/simulator';
|
|
23
|
-
import { type ContractInstance } from '@aztec/types/contracts';
|
|
24
24
|
|
|
25
25
|
import { type ContractDataOracle } from '../contract_data_oracle/index.js';
|
|
26
26
|
import { type PxeDatabase } from '../database/index.js';
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { type AztecNode, type L2Block, MerkleTreeId, type TxHash } from '@aztec/circuit-types';
|
|
2
2
|
import { type NoteProcessorCaughtUpStats } from '@aztec/circuit-types/stats';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type AztecAddress,
|
|
5
|
+
type CompleteAddress,
|
|
6
|
+
type Fr,
|
|
7
|
+
INITIAL_L2_BLOCK_NUM,
|
|
8
|
+
type PublicKey,
|
|
9
|
+
} from '@aztec/circuits.js';
|
|
4
10
|
import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
|
|
5
11
|
import { type SerialQueue } from '@aztec/foundation/queue';
|
|
6
12
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
@@ -243,7 +249,7 @@ export class Synchronizer {
|
|
|
243
249
|
* @param startingBlock - The block where to start scanning for notes for this accounts.
|
|
244
250
|
* @returns A promise that resolves once the account is added to the Synchronizer.
|
|
245
251
|
*/
|
|
246
|
-
public async addAccount(account:
|
|
252
|
+
public async addAccount(account: CompleteAddress, keyStore: KeyStore, startingBlock: number) {
|
|
247
253
|
const predicate = (x: NoteProcessor) => x.account.equals(account);
|
|
248
254
|
const processor = this.noteProcessors.find(predicate) ?? this.noteProcessorsToCatchUp.find(predicate);
|
|
249
255
|
if (processor) {
|
|
@@ -262,11 +268,7 @@ export class Synchronizer {
|
|
|
262
268
|
* @throws If checking a sync status of account which is not registered.
|
|
263
269
|
*/
|
|
264
270
|
public async isAccountStateSynchronized(account: AztecAddress) {
|
|
265
|
-
const
|
|
266
|
-
if (!completeAddress) {
|
|
267
|
-
throw new Error(`Checking if account is synched is not possible for ${account} because it is not registered.`);
|
|
268
|
-
}
|
|
269
|
-
const findByAccountAddress = (x: NoteProcessor) => x.account.equals(completeAddress.address);
|
|
271
|
+
const findByAccountAddress = (x: NoteProcessor) => x.account.address.equals(account);
|
|
270
272
|
const processor =
|
|
271
273
|
this.noteProcessors.find(findByAccountAddress) ?? this.noteProcessorsToCatchUp.find(findByAccountAddress);
|
|
272
274
|
if (!processor) {
|
|
@@ -300,7 +302,7 @@ export class Synchronizer {
|
|
|
300
302
|
const lastBlockNumber = this.getSynchedBlockNumber();
|
|
301
303
|
return {
|
|
302
304
|
blocks: lastBlockNumber,
|
|
303
|
-
notes: Object.fromEntries(this.noteProcessors.map(n => [n.account.toString(), n.status.syncedToBlock])),
|
|
305
|
+
notes: Object.fromEntries(this.noteProcessors.map(n => [n.account.address.toString(), n.status.syncedToBlock])),
|
|
304
306
|
};
|
|
305
307
|
}
|
|
306
308
|
|
|
@@ -309,7 +311,7 @@ export class Synchronizer {
|
|
|
309
311
|
* @returns The note processor stats for notes for each public key being tracked.
|
|
310
312
|
*/
|
|
311
313
|
public getSyncStats() {
|
|
312
|
-
return Object.fromEntries(this.noteProcessors.map(n => [n.account.toString(), n.stats]));
|
|
314
|
+
return Object.fromEntries(this.noteProcessors.map(n => [n.account.address.toString(), n.stats]));
|
|
313
315
|
}
|
|
314
316
|
|
|
315
317
|
/**
|
|
@@ -341,7 +343,7 @@ export class Synchronizer {
|
|
|
341
343
|
const { incomingNotes: inNotes, outgoingNotes: outNotes } = await processor.decodeDeferredNotes(deferredNotes);
|
|
342
344
|
incomingNotes.push(...inNotes);
|
|
343
345
|
|
|
344
|
-
await this.db.addNotes(inNotes, outNotes, processor.account);
|
|
346
|
+
await this.db.addNotes(inNotes, outNotes, processor.account.address);
|
|
345
347
|
|
|
346
348
|
inNotes.forEach(noteDao => {
|
|
347
349
|
this.log.debug(
|