@aztec/txe 0.0.1-commit.ec5f612 → 0.0.1-commit.ef17749e1
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/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +8 -6
- package/dest/oracle/interfaces.d.ts +28 -28
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +13 -13
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +12 -12
- package/dest/oracle/txe_oracle_top_level_context.d.ts +19 -19
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +24 -24
- package/dest/rpc_translator.d.ts +82 -82
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +228 -147
- package/dest/txe_session.js +3 -3
- package/package.json +15 -15
- package/src/index.ts +8 -5
- package/src/oracle/interfaces.ts +27 -31
- package/src/oracle/txe_oracle_public_context.ts +12 -12
- package/src/oracle/txe_oracle_top_level_context.ts +24 -24
- package/src/rpc_translator.ts +238 -155
- package/src/txe_session.ts +3 -3
package/dest/txe_session.js
CHANGED
|
@@ -98,7 +98,7 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
|
|
|
98
98
|
const chainId = new Fr(await stateMachine.node.getChainId());
|
|
99
99
|
const initialJobId = jobCoordinator.beginJob();
|
|
100
100
|
const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, nextBlockTimestamp, version, chainId, new Map());
|
|
101
|
-
await topLevelOracleHandler.
|
|
101
|
+
await topLevelOracleHandler.advanceBlocksBy(1);
|
|
102
102
|
return new TXESession(createLogger('txe:session'), stateMachine, topLevelOracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, initialJobId, version, chainId, nextBlockTimestamp);
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
@@ -276,8 +276,8 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
|
|
|
276
276
|
}
|
|
277
277
|
// Note that while all public and private contexts do is build a single block that we then process when exiting
|
|
278
278
|
// those, the top level context performs a large number of actions not captured in the following 'close' call. Among
|
|
279
|
-
// others, it will create empty blocks (via `
|
|
280
|
-
// `
|
|
279
|
+
// others, it will create empty blocks (via `advanceBlocksBy` and `deploy`), create blocks with transactions via
|
|
280
|
+
// `privateCallNewFlow` and `publicCallNewFlow`, add accounts to PXE via `addAccount`, etc. This is a
|
|
281
281
|
// slight inconsistency in the working model of this class, but is not too bad.
|
|
282
282
|
// TODO: it's quite unfortunate that we need to capture the authwits created to later pass them again when the top
|
|
283
283
|
// level context is re-created. This is because authwits create a temporary utility context that'd otherwise reset
|
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.ef17749e1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"bin": "./dest/bin/index.js",
|
|
@@ -61,20 +61,20 @@
|
|
|
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.ef17749e1",
|
|
65
|
+
"@aztec/archiver": "0.0.1-commit.ef17749e1",
|
|
66
|
+
"@aztec/aztec-node": "0.0.1-commit.ef17749e1",
|
|
67
|
+
"@aztec/aztec.js": "0.0.1-commit.ef17749e1",
|
|
68
|
+
"@aztec/bb-prover": "0.0.1-commit.ef17749e1",
|
|
69
|
+
"@aztec/constants": "0.0.1-commit.ef17749e1",
|
|
70
|
+
"@aztec/foundation": "0.0.1-commit.ef17749e1",
|
|
71
|
+
"@aztec/key-store": "0.0.1-commit.ef17749e1",
|
|
72
|
+
"@aztec/kv-store": "0.0.1-commit.ef17749e1",
|
|
73
|
+
"@aztec/protocol-contracts": "0.0.1-commit.ef17749e1",
|
|
74
|
+
"@aztec/pxe": "0.0.1-commit.ef17749e1",
|
|
75
|
+
"@aztec/simulator": "0.0.1-commit.ef17749e1",
|
|
76
|
+
"@aztec/stdlib": "0.0.1-commit.ef17749e1",
|
|
77
|
+
"@aztec/world-state": "0.0.1-commit.ef17749e1",
|
|
78
78
|
"zod": "^3.23.8"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
type ForeignCallResult,
|
|
33
33
|
ForeignCallResultSchema,
|
|
34
34
|
type ForeignCallSingle,
|
|
35
|
+
addressFromSingle,
|
|
35
36
|
fromArray,
|
|
36
37
|
fromSingle,
|
|
37
38
|
toSingle,
|
|
@@ -105,6 +106,8 @@ class TXEDispatcher {
|
|
|
105
106
|
|
|
106
107
|
const decodedArgs = fromArray(inputs[3] as ForeignCallArray);
|
|
107
108
|
const secret = fromSingle(inputs[4] as ForeignCallSingle);
|
|
109
|
+
const salt = fromSingle(inputs[5] as ForeignCallSingle);
|
|
110
|
+
const deployer = addressFromSingle(inputs[6] as ForeignCallSingle);
|
|
108
111
|
const publicKeys = secret.equals(Fr.ZERO) ? PublicKeys.default() : (await deriveKeys(secret)).publicKeys;
|
|
109
112
|
const publicKeysHash = await publicKeys.hash();
|
|
110
113
|
|
|
@@ -135,7 +138,7 @@ class TXEDispatcher {
|
|
|
135
138
|
|
|
136
139
|
const cacheKey = `${contractDirectory ?? ''}-${contractFilename}-${initializer}-${decodedArgs
|
|
137
140
|
.map(arg => arg.toString())
|
|
138
|
-
.join('-')}-${publicKeysHash}-${fileHash}`;
|
|
141
|
+
.join('-')}-${publicKeysHash}-${salt}-${deployer}-${fileHash}`;
|
|
139
142
|
|
|
140
143
|
let instance;
|
|
141
144
|
let artifact: ContractArtifactWithHash;
|
|
@@ -161,10 +164,10 @@ class TXEDispatcher {
|
|
|
161
164
|
const computedInstance = await getContractInstanceFromInstantiationParams(computedArtifact, {
|
|
162
165
|
constructorArgs: decodedArgs,
|
|
163
166
|
skipArgsDecoding: true,
|
|
164
|
-
salt
|
|
167
|
+
salt,
|
|
165
168
|
publicKeys,
|
|
166
169
|
constructorArtifact: initializer ? initializer : undefined,
|
|
167
|
-
deployer
|
|
170
|
+
deployer,
|
|
168
171
|
});
|
|
169
172
|
const result = { artifact: computedArtifact, instance: computedInstance };
|
|
170
173
|
TXEArtifactsCache.set(cacheKey, result);
|
|
@@ -247,11 +250,11 @@ class TXEDispatcher {
|
|
|
247
250
|
}
|
|
248
251
|
|
|
249
252
|
switch (functionName) {
|
|
250
|
-
case '
|
|
253
|
+
case 'aztec_txe_deploy': {
|
|
251
254
|
await this.#processDeployInputs(callData);
|
|
252
255
|
break;
|
|
253
256
|
}
|
|
254
|
-
case '
|
|
257
|
+
case 'aztec_txe_addAccount': {
|
|
255
258
|
await this.#processAddAccountInputs(callData);
|
|
256
259
|
break;
|
|
257
260
|
}
|
package/src/oracle/interfaces.ts
CHANGED
|
@@ -24,18 +24,18 @@ import type { UInt64 } from '@aztec/stdlib/types';
|
|
|
24
24
|
export interface IAvmExecutionOracle {
|
|
25
25
|
isAvm: true;
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
address(): Promise<AztecAddress>;
|
|
28
|
+
sender(): Promise<AztecAddress>;
|
|
29
|
+
blockNumber(): Promise<BlockNumber>;
|
|
30
|
+
timestamp(): Promise<bigint>;
|
|
31
|
+
isStaticCall(): Promise<boolean>;
|
|
32
|
+
chainId(): Promise<Fr>;
|
|
33
|
+
version(): Promise<Fr>;
|
|
34
|
+
emitNullifier(nullifier: Fr): Promise<void>;
|
|
35
|
+
emitNoteHash(noteHash: Fr): Promise<void>;
|
|
36
|
+
nullifierExists(siloedNullifier: Fr): Promise<boolean>;
|
|
37
|
+
storageWrite(slot: Fr, value: Fr): Promise<void>;
|
|
38
|
+
storageRead(slot: Fr, contractAddress: AztecAddress): Promise<Fr>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -44,27 +44,23 @@ export interface IAvmExecutionOracle {
|
|
|
44
44
|
export interface ITxeExecutionOracle {
|
|
45
45
|
isTxe: true;
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
): Promise<CompleteAddress>;
|
|
59
|
-
txeAddAuthWitness(address: AztecAddress, messageHash: Fr): Promise<void>;
|
|
60
|
-
txeGetLastBlockTimestamp(): Promise<bigint>;
|
|
61
|
-
txeGetLastTxEffects(): Promise<{
|
|
47
|
+
getDefaultAddress(): AztecAddress;
|
|
48
|
+
getNextBlockNumber(): Promise<BlockNumber>;
|
|
49
|
+
getNextBlockTimestamp(): Promise<UInt64>;
|
|
50
|
+
advanceBlocksBy(blocks: number): Promise<void>;
|
|
51
|
+
advanceTimestampBy(duration: UInt64): void;
|
|
52
|
+
deploy(artifact: ContractArtifact, instance: ContractInstanceWithAddress, foreignSecret: Fr): Promise<void>;
|
|
53
|
+
createAccount(secret: Fr): Promise<CompleteAddress>;
|
|
54
|
+
addAccount(artifact: ContractArtifact, instance: ContractInstanceWithAddress, secret: Fr): Promise<CompleteAddress>;
|
|
55
|
+
addAuthWitness(address: AztecAddress, messageHash: Fr): Promise<void>;
|
|
56
|
+
getLastBlockTimestamp(): Promise<bigint>;
|
|
57
|
+
getLastTxEffects(): Promise<{
|
|
62
58
|
txHash: TxHash;
|
|
63
59
|
noteHashes: Fr[];
|
|
64
60
|
nullifiers: Fr[];
|
|
65
61
|
}>;
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
getPrivateEvents(selector: EventSelector, contractAddress: AztecAddress, scope: AztecAddress): Promise<Fr[][]>;
|
|
63
|
+
privateCallNewFlow(
|
|
68
64
|
from: AztecAddress,
|
|
69
65
|
targetContractAddress: AztecAddress,
|
|
70
66
|
functionSelector: FunctionSelector,
|
|
@@ -73,13 +69,13 @@ export interface ITxeExecutionOracle {
|
|
|
73
69
|
isStaticCall: boolean,
|
|
74
70
|
jobId: string,
|
|
75
71
|
): Promise<Fr[]>;
|
|
76
|
-
|
|
72
|
+
executeUtilityFunction(
|
|
77
73
|
targetContractAddress: AztecAddress,
|
|
78
74
|
functionSelector: FunctionSelector,
|
|
79
75
|
args: Fr[],
|
|
80
76
|
jobId: string,
|
|
81
77
|
): Promise<Fr[]>;
|
|
82
|
-
|
|
78
|
+
publicCallNewFlow(
|
|
83
79
|
from: AztecAddress,
|
|
84
80
|
targetContractAddress: AztecAddress,
|
|
85
81
|
calldata: Fr[],
|
|
@@ -39,46 +39,46 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
address(): Promise<AztecAddress> {
|
|
43
43
|
return Promise.resolve(this.contractAddress);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
sender(): Promise<AztecAddress> {
|
|
47
47
|
return Promise.resolve(AztecAddress.ZERO); // todo: change?
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
blockNumber(): Promise<BlockNumber> {
|
|
51
51
|
return Promise.resolve(this.globalVariables.blockNumber);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
timestamp(): Promise<bigint> {
|
|
55
55
|
return Promise.resolve(this.globalVariables.timestamp);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
isStaticCall(): Promise<boolean> {
|
|
59
59
|
return Promise.resolve(false);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
chainId(): Promise<Fr> {
|
|
63
63
|
return Promise.resolve(this.globalVariables.chainId);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
version(): Promise<Fr> {
|
|
67
67
|
return Promise.resolve(this.globalVariables.version);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
async
|
|
70
|
+
async emitNullifier(nullifier: Fr) {
|
|
71
71
|
const siloedNullifier = await siloNullifier(this.contractAddress, nullifier);
|
|
72
72
|
this.transientSiloedNullifiers.push(siloedNullifier);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
async
|
|
75
|
+
async emitNoteHash(noteHash: Fr) {
|
|
76
76
|
const siloedNoteHash = await siloNoteHash(this.contractAddress, noteHash);
|
|
77
77
|
// TODO: make the note hash unique - they are only siloed right now
|
|
78
78
|
this.transientUniqueNoteHashes.push(siloedNoteHash);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
async
|
|
81
|
+
async nullifierExists(siloedNullifier: Fr): Promise<boolean> {
|
|
82
82
|
const treeIndex = (
|
|
83
83
|
await this.forkedWorldTrees.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, [siloedNullifier.toBuffer()])
|
|
84
84
|
)[0];
|
|
@@ -87,7 +87,7 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
|
|
|
87
87
|
return treeIndex !== undefined || transientIndex !== undefined;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
async
|
|
90
|
+
async storageWrite(slot: Fr, value: Fr) {
|
|
91
91
|
this.logger.debug('AVM storage write', { slot, value });
|
|
92
92
|
|
|
93
93
|
const dataWrite = new PublicDataWrite(await computePublicDataTreeLeafSlot(this.contractAddress, slot), value);
|
|
@@ -99,7 +99,7 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
|
|
|
99
99
|
]);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
async
|
|
102
|
+
async storageRead(slot: Fr, contractAddress: AztecAddress): Promise<Fr> {
|
|
103
103
|
const leafSlot = await computePublicDataTreeLeafSlot(contractAddress, slot);
|
|
104
104
|
|
|
105
105
|
const lowLeafResult = await this.forkedWorldTrees.getPreviousValueIndex(
|
|
@@ -116,7 +116,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
116
116
|
this.logger.debug('Entering Top Level Context');
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
assertCompatibleOracleVersion(version: number): void {
|
|
120
120
|
if (version !== ORACLE_VERSION) {
|
|
121
121
|
throw new Error(
|
|
122
122
|
`Incompatible oracle version. TXE is using version '${ORACLE_VERSION}', but got a request for '${version}'.`,
|
|
@@ -126,12 +126,12 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
126
126
|
|
|
127
127
|
// This is typically only invoked in private contexts, but it is convenient to also have it in top-level for testing
|
|
128
128
|
// setup.
|
|
129
|
-
|
|
129
|
+
getRandomField(): Fr {
|
|
130
130
|
return Fr.random();
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
// We instruct users to debug contracts via this oracle, so it makes sense that they'd expect it to also work in tests
|
|
134
|
-
|
|
134
|
+
log(level: number, message: string, fields: Fr[]): Promise<void> {
|
|
135
135
|
if (!LogLevels[level]) {
|
|
136
136
|
throw new Error(`Invalid log level: ${level}`);
|
|
137
137
|
}
|
|
@@ -141,23 +141,23 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
141
141
|
return Promise.resolve();
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
getDefaultAddress(): AztecAddress {
|
|
145
145
|
return DEFAULT_ADDRESS;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
async
|
|
148
|
+
async getNextBlockNumber(): Promise<BlockNumber> {
|
|
149
149
|
return BlockNumber((await this.getLastBlockNumber()) + 1);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
getNextBlockTimestamp(): Promise<bigint> {
|
|
153
153
|
return Promise.resolve(this.nextBlockTimestamp);
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
async
|
|
156
|
+
async getLastBlockTimestamp() {
|
|
157
157
|
return (await this.stateMachine.node.getBlockHeader('latest'))!.globalVariables.timestamp;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
async
|
|
160
|
+
async getLastTxEffects() {
|
|
161
161
|
const latestBlockNumber = await this.stateMachine.archiver.getBlockNumber();
|
|
162
162
|
const block = await this.stateMachine.archiver.getBlock(latestBlockNumber);
|
|
163
163
|
|
|
@@ -173,7 +173,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
173
173
|
|
|
174
174
|
async syncContractNonOracleMethod(contractAddress: AztecAddress, scope: AztecAddress, jobId: string) {
|
|
175
175
|
if (contractAddress.equals(DEFAULT_ADDRESS)) {
|
|
176
|
-
this.logger.debug(`Skipping sync in
|
|
176
|
+
this.logger.debug(`Skipping sync in getPrivateEvents because the events correspond to the default address.`);
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -190,7 +190,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
190
190
|
);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
async
|
|
193
|
+
async getPrivateEvents(selector: EventSelector, contractAddress: AztecAddress, scope: AztecAddress) {
|
|
194
194
|
return (
|
|
195
195
|
await this.privateEventStore.getPrivateEvents(selector, {
|
|
196
196
|
contractAddress,
|
|
@@ -201,7 +201,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
201
201
|
).map(e => e.packedEvent);
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
async
|
|
204
|
+
async advanceBlocksBy(blocks: number) {
|
|
205
205
|
this.logger.debug(`time traveling ${blocks} blocks`);
|
|
206
206
|
|
|
207
207
|
for (let i = 0; i < blocks; i++) {
|
|
@@ -209,12 +209,12 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
advanceTimestampBy(duration: UInt64) {
|
|
213
213
|
this.logger.debug(`time traveling ${duration} seconds`);
|
|
214
214
|
this.nextBlockTimestamp += duration;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
async
|
|
217
|
+
async deploy(artifact: ContractArtifact, instance: ContractInstanceWithAddress, secret: Fr) {
|
|
218
218
|
// Emit deployment nullifier
|
|
219
219
|
await this.mineBlock({
|
|
220
220
|
nullifiers: [
|
|
@@ -226,7 +226,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
226
226
|
});
|
|
227
227
|
|
|
228
228
|
if (!secret.equals(Fr.ZERO)) {
|
|
229
|
-
await this.
|
|
229
|
+
await this.addAccount(artifact, instance, secret);
|
|
230
230
|
} else {
|
|
231
231
|
await this.contractStore.addContractInstance(instance);
|
|
232
232
|
await this.contractStore.addContractArtifact(artifact);
|
|
@@ -234,7 +234,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
async
|
|
237
|
+
async addAccount(artifact: ContractArtifact, instance: ContractInstanceWithAddress, secret: Fr) {
|
|
238
238
|
const partialAddress = await computePartialAddress(instance);
|
|
239
239
|
|
|
240
240
|
this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
|
|
@@ -249,7 +249,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
249
249
|
return completeAddress;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
async
|
|
252
|
+
async createAccount(secret: Fr) {
|
|
253
253
|
// This is a foot gun !
|
|
254
254
|
const completeAddress = await this.keyStore.addAccount(secret, secret);
|
|
255
255
|
await this.accountStore.setAccount(completeAddress.address, completeAddress);
|
|
@@ -259,7 +259,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
259
259
|
return completeAddress;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
async
|
|
262
|
+
async addAuthWitness(address: AztecAddress, messageHash: Fr) {
|
|
263
263
|
const account = await this.accountStore.getAccount(address);
|
|
264
264
|
const privateKey = await this.keyStore.getMasterSecretKey(account.publicKeys.masterIncomingViewingPublicKey);
|
|
265
265
|
|
|
@@ -272,7 +272,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
async mineBlock(options: { nullifiers?: Fr[] } = {}) {
|
|
275
|
-
const blockNumber = await this.
|
|
275
|
+
const blockNumber = await this.getNextBlockNumber();
|
|
276
276
|
|
|
277
277
|
const txEffect = TxEffect.empty();
|
|
278
278
|
txEffect.nullifiers = [getSingleTxBlockRequestHash(blockNumber), ...(options.nullifiers ?? [])];
|
|
@@ -296,7 +296,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
296
296
|
await this.stateMachine.handleL2Block(block);
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
async
|
|
299
|
+
async privateCallNewFlow(
|
|
300
300
|
from: AztecAddress,
|
|
301
301
|
targetContractAddress: AztecAddress = AztecAddress.zero(),
|
|
302
302
|
functionSelector: FunctionSelector = FunctionSelector.empty(),
|
|
@@ -336,7 +336,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
336
336
|
effectiveScopes,
|
|
337
337
|
);
|
|
338
338
|
|
|
339
|
-
const blockNumber = await this.
|
|
339
|
+
const blockNumber = await this.getNextBlockNumber();
|
|
340
340
|
|
|
341
341
|
const callContext = new CallContext(from, targetContractAddress, functionSelector, isStaticCall);
|
|
342
342
|
|
|
@@ -409,7 +409,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
409
409
|
);
|
|
410
410
|
const publicFunctionsCalldata = await Promise.all(
|
|
411
411
|
publicCallRequests.map(async r => {
|
|
412
|
-
const calldata = await privateExecutionOracle.
|
|
412
|
+
const calldata = await privateExecutionOracle.loadFromExecutionCache(r.calldataHash);
|
|
413
413
|
return new HashedValues(calldata, r.calldataHash);
|
|
414
414
|
}),
|
|
415
415
|
);
|
|
@@ -523,7 +523,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
523
523
|
return executionResult.returnValues ?? [];
|
|
524
524
|
}
|
|
525
525
|
|
|
526
|
-
async
|
|
526
|
+
async publicCallNewFlow(
|
|
527
527
|
from: AztecAddress,
|
|
528
528
|
targetContractAddress: AztecAddress,
|
|
529
529
|
calldata: Fr[],
|
|
@@ -533,7 +533,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
533
533
|
`Executing public function ${await this.contractStore.getDebugFunctionName(targetContractAddress, FunctionSelector.fromField(calldata[0]))}@${targetContractAddress} isStaticCall=${isStaticCall}`,
|
|
534
534
|
);
|
|
535
535
|
|
|
536
|
-
const blockNumber = await this.
|
|
536
|
+
const blockNumber = await this.getNextBlockNumber();
|
|
537
537
|
|
|
538
538
|
const gasLimits = new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
|
|
539
539
|
|
|
@@ -678,7 +678,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
678
678
|
return returnValues ?? [];
|
|
679
679
|
}
|
|
680
680
|
|
|
681
|
-
async
|
|
681
|
+
async executeUtilityFunction(
|
|
682
682
|
targetContractAddress: AztecAddress,
|
|
683
683
|
functionSelector: FunctionSelector,
|
|
684
684
|
args: Fr[],
|