@aztec/txe 2.1.0-rc.9 → 3.0.0-devnet.2
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.js +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +5 -2
- package/dest/oracle/interfaces.d.ts +54 -0
- package/dest/oracle/interfaces.d.ts.map +1 -0
- package/dest/oracle/interfaces.js +3 -0
- package/dest/oracle/txe_oracle_public_context.d.ts +7 -7
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +29 -31
- package/dest/oracle/txe_oracle_top_level_context.d.ts +56 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_top_level_context.js +423 -0
- package/dest/{txe_service/txe_service.d.ts → rpc_translator.d.ts} +34 -28
- package/dest/rpc_translator.d.ts.map +1 -0
- package/dest/{txe_service/txe_service.js → rpc_translator.js} +143 -115
- package/dest/state_machine/archiver.d.ts +5 -1
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +8 -1
- package/dest/state_machine/dummy_p2p_client.d.ts +1 -0
- 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 +1 -14
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +3 -22
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +4 -3
- package/dest/txe_session.d.ts +34 -44
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +197 -82
- package/dest/util/encoding.d.ts +1 -1
- package/dest/util/txe_contract_data_provider.d.ts +2 -1
- package/dest/util/txe_contract_data_provider.d.ts.map +1 -1
- package/dest/util/txe_contract_data_provider.js +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/util/txe_public_contract_data_source.js +13 -11
- package/dest/utils/block_creation.d.ts +13 -0
- package/dest/utils/block_creation.d.ts.map +1 -0
- package/dest/utils/block_creation.js +24 -0
- package/dest/utils/tx_effect_creation.d.ts +5 -0
- package/dest/utils/tx_effect_creation.d.ts.map +1 -0
- package/dest/utils/tx_effect_creation.js +16 -0
- package/package.json +15 -15
- package/src/bin/index.ts +1 -1
- package/src/index.ts +5 -8
- package/src/oracle/interfaces.ts +83 -0
- package/src/oracle/txe_oracle_public_context.ts +36 -69
- package/src/oracle/txe_oracle_top_level_context.ts +658 -0
- package/src/{txe_service/txe_service.ts → rpc_translator.ts} +181 -115
- package/src/state_machine/archiver.ts +8 -2
- package/src/state_machine/dummy_p2p_client.ts +4 -0
- package/src/state_machine/global_variable_builder.ts +6 -41
- package/src/state_machine/index.ts +6 -4
- package/src/txe_session.ts +301 -90
- package/src/util/txe_contract_data_provider.ts +2 -1
- package/src/util/txe_public_contract_data_source.ts +13 -11
- package/src/utils/block_creation.ts +62 -0
- package/src/utils/tx_effect_creation.ts +37 -0
- package/dest/oracle/txe_oracle.d.ts +0 -124
- package/dest/oracle/txe_oracle.d.ts.map +0 -1
- package/dest/oracle/txe_oracle.js +0 -770
- package/dest/oracle/txe_typed_oracle.d.ts +0 -42
- package/dest/oracle/txe_typed_oracle.d.ts.map +0 -1
- package/dest/oracle/txe_typed_oracle.js +0 -83
- package/dest/txe_constants.d.ts +0 -2
- package/dest/txe_constants.d.ts.map +0 -1
- package/dest/txe_constants.js +0 -7
- package/dest/txe_service/txe_service.d.ts.map +0 -1
- package/src/oracle/txe_oracle.ts +0 -1287
- package/src/oracle/txe_typed_oracle.ts +0 -142
- package/src/txe_constants.ts +0 -9
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { Fr, Point } from '@aztec/aztec.js';
|
|
1
|
+
import { Fr, Point } from '@aztec/aztec.js/fields';
|
|
2
|
+
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX } from '@aztec/constants';
|
|
2
3
|
import { packAsRetrievedNote } from '@aztec/pxe/simulator';
|
|
3
4
|
import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
4
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
6
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
6
|
-
import { addressFromSingle, arrayOfArraysToBoundedVecOfArrays, arrayToBoundedVec, bufferToU8Array, fromArray, fromSingle, fromUintArray, fromUintBoundedVec, toArray, toForeignCallResult, toSingle } from '
|
|
7
|
-
export class
|
|
7
|
+
import { addressFromSingle, arrayOfArraysToBoundedVecOfArrays, arrayToBoundedVec, bufferToU8Array, fromArray, fromSingle, fromUintArray, fromUintBoundedVec, toArray, toForeignCallResult, toSingle } from './util/encoding.js';
|
|
8
|
+
export class UnavailableOracleError extends Error {
|
|
9
|
+
constructor(oracleName){
|
|
10
|
+
super(`${oracleName} oracles not available with the current handler`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export class RPCTranslator {
|
|
8
14
|
stateHandler;
|
|
9
15
|
oracleHandler;
|
|
10
16
|
/**
|
|
11
|
-
* Create a new instance of `
|
|
17
|
+
* Create a new instance of `RPCTranslator` that will translate all TXE RPC calls to and from the foreign
|
|
12
18
|
* (`ForeignCallSingle`, `ForeignCallResult`, etc.) and native TS types, delegating actual execution of the oracles
|
|
13
19
|
* to the different handlers.
|
|
14
20
|
* @param stateHandler The handler that will process TXE session state transitions, such as entering a private or
|
|
@@ -19,42 +25,86 @@ export class TXEService {
|
|
|
19
25
|
this.stateHandler = stateHandler;
|
|
20
26
|
this.oracleHandler = oracleHandler;
|
|
21
27
|
}
|
|
28
|
+
// Note: If you rename the following functions to not start with "handlerAs", you must also update the validation
|
|
29
|
+
// check in `TXESession.processFunction`.
|
|
30
|
+
handlerAsMisc() {
|
|
31
|
+
if (!('isMisc' in this.oracleHandler)) {
|
|
32
|
+
throw new UnavailableOracleError('Misc');
|
|
33
|
+
}
|
|
34
|
+
return this.oracleHandler;
|
|
35
|
+
}
|
|
36
|
+
handlerAsUtility() {
|
|
37
|
+
if (!('isUtility' in this.oracleHandler)) {
|
|
38
|
+
throw new UnavailableOracleError('Utility');
|
|
39
|
+
}
|
|
40
|
+
return this.oracleHandler;
|
|
41
|
+
}
|
|
42
|
+
handlerAsPrivate() {
|
|
43
|
+
if (!('isPrivate' in this.oracleHandler)) {
|
|
44
|
+
throw new UnavailableOracleError('Private');
|
|
45
|
+
}
|
|
46
|
+
return this.oracleHandler;
|
|
47
|
+
}
|
|
48
|
+
handlerAsAvm() {
|
|
49
|
+
if (!('isAvm' in this.oracleHandler)) {
|
|
50
|
+
throw new UnavailableOracleError('Avm');
|
|
51
|
+
}
|
|
52
|
+
return this.oracleHandler;
|
|
53
|
+
}
|
|
54
|
+
handlerAsTxe() {
|
|
55
|
+
if (!('isTxe' in this.oracleHandler)) {
|
|
56
|
+
throw new UnavailableOracleError('Txe');
|
|
57
|
+
}
|
|
58
|
+
return this.oracleHandler;
|
|
59
|
+
}
|
|
22
60
|
// TXE session state transition functions - these get handled by the state handler
|
|
23
61
|
async txeSetTopLevelTXEContext() {
|
|
24
|
-
await this.stateHandler.
|
|
62
|
+
await this.stateHandler.enterTopLevelState();
|
|
25
63
|
return toForeignCallResult([]);
|
|
26
64
|
}
|
|
27
|
-
async txeSetPrivateTXEContext(foreignContractAddressIsSome, foreignContractAddressValue,
|
|
65
|
+
async txeSetPrivateTXEContext(foreignContractAddressIsSome, foreignContractAddressValue, foreignAnchorBlockNumberIsSome, foreignAnchorBlockNumberValue) {
|
|
28
66
|
const contractAddress = fromSingle(foreignContractAddressIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignContractAddressValue)) : undefined;
|
|
29
|
-
const
|
|
30
|
-
const privateContextInputs = await this.stateHandler.
|
|
67
|
+
const anchorBlockNumber = fromSingle(foreignAnchorBlockNumberIsSome).toBool() ? fromSingle(foreignAnchorBlockNumberValue).toNumber() : undefined;
|
|
68
|
+
const privateContextInputs = await this.stateHandler.enterPrivateState(contractAddress, anchorBlockNumber);
|
|
31
69
|
return toForeignCallResult(privateContextInputs.toFields().map(toSingle));
|
|
32
70
|
}
|
|
33
71
|
async txeSetPublicTXEContext(foreignContractAddressIsSome, foreignContractAddressValue) {
|
|
34
72
|
const contractAddress = fromSingle(foreignContractAddressIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignContractAddressValue)) : undefined;
|
|
35
|
-
await this.stateHandler.
|
|
73
|
+
await this.stateHandler.enterPublicState(contractAddress);
|
|
36
74
|
return toForeignCallResult([]);
|
|
37
75
|
}
|
|
38
76
|
async txeSetUtilityTXEContext(foreignContractAddressIsSome, foreignContractAddressValue) {
|
|
39
77
|
const contractAddress = fromSingle(foreignContractAddressIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignContractAddressValue)) : undefined;
|
|
40
|
-
await this.stateHandler.
|
|
78
|
+
await this.stateHandler.enterUtilityState(contractAddress);
|
|
41
79
|
return toForeignCallResult([]);
|
|
42
80
|
}
|
|
43
81
|
// Other oracles - these get handled by the oracle handler
|
|
44
82
|
// TXE-specific oracles
|
|
83
|
+
async txeGetNextBlockNumber() {
|
|
84
|
+
const nextBlockNumber = await this.handlerAsTxe().txeGetNextBlockNumber();
|
|
85
|
+
return toForeignCallResult([
|
|
86
|
+
toSingle(nextBlockNumber)
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
async txeGetNextBlockTimestamp() {
|
|
90
|
+
const nextBlockTimestamp = await this.handlerAsTxe().txeGetNextBlockTimestamp();
|
|
91
|
+
return toForeignCallResult([
|
|
92
|
+
toSingle(nextBlockTimestamp)
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
45
95
|
async txeAdvanceBlocksBy(foreignBlocks) {
|
|
46
96
|
const blocks = fromSingle(foreignBlocks).toNumber();
|
|
47
|
-
await this.
|
|
97
|
+
await this.handlerAsTxe().txeAdvanceBlocksBy(blocks);
|
|
48
98
|
return toForeignCallResult([]);
|
|
49
99
|
}
|
|
50
100
|
txeAdvanceTimestampBy(foreignDuration) {
|
|
51
101
|
const duration = fromSingle(foreignDuration).toBigInt();
|
|
52
|
-
this.
|
|
102
|
+
this.handlerAsTxe().txeAdvanceTimestampBy(duration);
|
|
53
103
|
return toForeignCallResult([]);
|
|
54
104
|
}
|
|
55
105
|
async txeDeploy(artifact, instance, foreignSecret) {
|
|
56
106
|
const secret = fromSingle(foreignSecret);
|
|
57
|
-
await this.
|
|
107
|
+
await this.handlerAsTxe().txeDeploy(artifact, instance, secret);
|
|
58
108
|
return toForeignCallResult([
|
|
59
109
|
toArray([
|
|
60
110
|
instance.salt,
|
|
@@ -67,7 +117,7 @@ export class TXEService {
|
|
|
67
117
|
}
|
|
68
118
|
async txeCreateAccount(foreignSecret) {
|
|
69
119
|
const secret = fromSingle(foreignSecret);
|
|
70
|
-
const completeAddress = await this.
|
|
120
|
+
const completeAddress = await this.handlerAsTxe().txeCreateAccount(secret);
|
|
71
121
|
return toForeignCallResult([
|
|
72
122
|
toSingle(completeAddress.address),
|
|
73
123
|
...completeAddress.publicKeys.toFields().map(toSingle)
|
|
@@ -75,7 +125,7 @@ export class TXEService {
|
|
|
75
125
|
}
|
|
76
126
|
async txeAddAccount(artifact, instance, foreignSecret) {
|
|
77
127
|
const secret = fromSingle(foreignSecret);
|
|
78
|
-
const completeAddress = await this.
|
|
128
|
+
const completeAddress = await this.handlerAsTxe().txeAddAccount(artifact, instance, secret);
|
|
79
129
|
return toForeignCallResult([
|
|
80
130
|
toSingle(completeAddress.address),
|
|
81
131
|
...completeAddress.publicKeys.toFields().map(toSingle)
|
|
@@ -84,65 +134,56 @@ export class TXEService {
|
|
|
84
134
|
async txeAddAuthWitness(foreignAddress, foreignMessageHash) {
|
|
85
135
|
const address = addressFromSingle(foreignAddress);
|
|
86
136
|
const messageHash = fromSingle(foreignMessageHash);
|
|
87
|
-
await this.
|
|
137
|
+
await this.handlerAsTxe().txeAddAuthWitness(address, messageHash);
|
|
88
138
|
return toForeignCallResult([]);
|
|
89
139
|
}
|
|
90
140
|
// PXE oracles
|
|
91
141
|
utilityAssertCompatibleOracleVersion(foreignVersion) {
|
|
92
142
|
const version = fromSingle(foreignVersion).toNumber();
|
|
93
|
-
this.
|
|
143
|
+
this.handlerAsMisc().utilityAssertCompatibleOracleVersion(version);
|
|
94
144
|
return toForeignCallResult([]);
|
|
95
145
|
}
|
|
96
146
|
utilityGetRandomField() {
|
|
97
|
-
const randomField = this.
|
|
147
|
+
const randomField = this.handlerAsMisc().utilityGetRandomField();
|
|
98
148
|
return toForeignCallResult([
|
|
99
149
|
toSingle(randomField)
|
|
100
150
|
]);
|
|
101
151
|
}
|
|
102
|
-
async
|
|
103
|
-
const
|
|
104
|
-
return toForeignCallResult([
|
|
105
|
-
toSingle(contractAddress.toField())
|
|
106
|
-
]);
|
|
107
|
-
}
|
|
108
|
-
async utilityGetBlockNumber() {
|
|
109
|
-
const blockNumber = await this.oracleHandler.utilityGetBlockNumber();
|
|
110
|
-
return toForeignCallResult([
|
|
111
|
-
toSingle(new Fr(blockNumber))
|
|
112
|
-
]);
|
|
113
|
-
}
|
|
114
|
-
// seems to be used to mean the timestamp of the last mined block in txe (but that's not what is done here)
|
|
115
|
-
async utilityGetTimestamp() {
|
|
116
|
-
const timestamp = await this.oracleHandler.utilityGetTimestamp();
|
|
152
|
+
async txeGetLastBlockTimestamp() {
|
|
153
|
+
const timestamp = await this.handlerAsTxe().txeGetLastBlockTimestamp();
|
|
117
154
|
return toForeignCallResult([
|
|
118
155
|
toSingle(new Fr(timestamp))
|
|
119
156
|
]);
|
|
120
157
|
}
|
|
121
|
-
async
|
|
122
|
-
const
|
|
158
|
+
async txeGetLastTxEffects() {
|
|
159
|
+
const { txHash, noteHashes, nullifiers } = await this.handlerAsTxe().txeGetLastTxEffects();
|
|
123
160
|
return toForeignCallResult([
|
|
124
|
-
toSingle(
|
|
161
|
+
toSingle(txHash.hash),
|
|
162
|
+
...arrayToBoundedVec(toArray(noteHashes), MAX_NOTE_HASHES_PER_TX),
|
|
163
|
+
...arrayToBoundedVec(toArray(nullifiers), MAX_NULLIFIERS_PER_TX)
|
|
125
164
|
]);
|
|
126
165
|
}
|
|
127
166
|
// Since the argument is a slice, noir automatically adds a length field to oracle call.
|
|
128
167
|
privateStoreInExecutionCache(_foreignLength, foreignValues, foreignHash) {
|
|
129
168
|
const values = fromArray(foreignValues);
|
|
130
169
|
const hash = fromSingle(foreignHash);
|
|
131
|
-
this.
|
|
170
|
+
this.handlerAsPrivate().privateStoreInExecutionCache(values, hash);
|
|
132
171
|
return toForeignCallResult([]);
|
|
133
172
|
}
|
|
134
173
|
async privateLoadFromExecutionCache(foreignHash) {
|
|
135
174
|
const hash = fromSingle(foreignHash);
|
|
136
|
-
const returns = await this.
|
|
175
|
+
const returns = await this.handlerAsPrivate().privateLoadFromExecutionCache(hash);
|
|
137
176
|
return toForeignCallResult([
|
|
138
177
|
toArray(returns)
|
|
139
178
|
]);
|
|
140
179
|
}
|
|
141
|
-
//
|
|
142
|
-
|
|
180
|
+
// When the argument is a slice, noir automatically adds a length field to oracle call.
|
|
181
|
+
// When the argument is an array, we add the field length manually to the signature.
|
|
182
|
+
utilityDebugLog(foreignLevel, foreignMessage, _foreignLength, foreignFields) {
|
|
183
|
+
const level = fromSingle(foreignLevel).toNumber();
|
|
143
184
|
const message = fromArray(foreignMessage).map((field)=>String.fromCharCode(field.toNumber())).join('');
|
|
144
185
|
const fields = fromArray(foreignFields);
|
|
145
|
-
this.
|
|
186
|
+
this.handlerAsMisc().utilityDebugLog(level, message, fields);
|
|
146
187
|
return toForeignCallResult([]);
|
|
147
188
|
}
|
|
148
189
|
async utilityStorageRead(foreignContractAddress, foreignStartStorageSlot, foreignBlockNumber, foreignNumberOfElements) {
|
|
@@ -150,7 +191,7 @@ export class TXEService {
|
|
|
150
191
|
const startStorageSlot = fromSingle(foreignStartStorageSlot);
|
|
151
192
|
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
152
193
|
const numberOfElements = fromSingle(foreignNumberOfElements).toNumber();
|
|
153
|
-
const values = await this.
|
|
194
|
+
const values = await this.handlerAsUtility().utilityStorageRead(contractAddress, startStorageSlot, blockNumber, numberOfElements);
|
|
154
195
|
return toForeignCallResult([
|
|
155
196
|
toArray(values)
|
|
156
197
|
]);
|
|
@@ -158,7 +199,7 @@ export class TXEService {
|
|
|
158
199
|
async utilityGetPublicDataWitness(foreignBlockNumber, foreignLeafSlot) {
|
|
159
200
|
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
160
201
|
const leafSlot = fromSingle(foreignLeafSlot);
|
|
161
|
-
const witness = await this.
|
|
202
|
+
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(blockNumber, leafSlot);
|
|
162
203
|
if (!witness) {
|
|
163
204
|
throw new Error(`Public data witness not found for slot ${leafSlot} at block ${blockNumber}.`);
|
|
164
205
|
}
|
|
@@ -181,7 +222,7 @@ export class TXEService {
|
|
|
181
222
|
const status = fromSingle(foreignStatus).toNumber();
|
|
182
223
|
const maxNotes = fromSingle(foreignMaxNotes).toNumber();
|
|
183
224
|
const packedRetrievedNoteLength = fromSingle(foreignPackedRetrievedNoteLength).toNumber();
|
|
184
|
-
const noteDatas = await this.
|
|
225
|
+
const noteDatas = await this.handlerAsUtility().utilityGetNotes(storageSlot, numSelects, selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, limit, offset, status);
|
|
185
226
|
const returnDataAsArrayOfArrays = noteDatas.map(packAsRetrievedNote);
|
|
186
227
|
// Now we convert each sub-array to an array of ForeignCallSingles
|
|
187
228
|
const returnDataAsArrayOfForeignCallSingleArrays = returnDataAsArrayOfArrays.map((subArray)=>subArray.map(toSingle));
|
|
@@ -194,31 +235,31 @@ export class TXEService {
|
|
|
194
235
|
const note = fromArray(foreignNote);
|
|
195
236
|
const noteHash = fromSingle(foreignNoteHash);
|
|
196
237
|
const counter = fromSingle(foreignCounter).toNumber();
|
|
197
|
-
this.
|
|
238
|
+
this.handlerAsPrivate().privateNotifyCreatedNote(storageSlot, noteTypeId, note, noteHash, counter);
|
|
198
239
|
return toForeignCallResult([]);
|
|
199
240
|
}
|
|
200
241
|
async privateNotifyNullifiedNote(foreignInnerNullifier, foreignNoteHash, foreignCounter) {
|
|
201
242
|
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
202
243
|
const noteHash = fromSingle(foreignNoteHash);
|
|
203
244
|
const counter = fromSingle(foreignCounter).toNumber();
|
|
204
|
-
await this.
|
|
245
|
+
await this.handlerAsPrivate().privateNotifyNullifiedNote(innerNullifier, noteHash, counter);
|
|
205
246
|
return toForeignCallResult([]);
|
|
206
247
|
}
|
|
207
248
|
async privateNotifyCreatedNullifier(foreignInnerNullifier) {
|
|
208
249
|
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
209
|
-
await this.
|
|
250
|
+
await this.handlerAsPrivate().privateNotifyCreatedNullifier(innerNullifier);
|
|
210
251
|
return toForeignCallResult([]);
|
|
211
252
|
}
|
|
212
253
|
async utilityCheckNullifierExists(foreignInnerNullifier) {
|
|
213
254
|
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
214
|
-
const exists = await this.
|
|
255
|
+
const exists = await this.handlerAsUtility().utilityCheckNullifierExists(innerNullifier);
|
|
215
256
|
return toForeignCallResult([
|
|
216
257
|
toSingle(new Fr(exists))
|
|
217
258
|
]);
|
|
218
259
|
}
|
|
219
260
|
async utilityGetContractInstance(foreignAddress) {
|
|
220
261
|
const address = addressFromSingle(foreignAddress);
|
|
221
|
-
const instance = await this.
|
|
262
|
+
const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
|
|
222
263
|
return toForeignCallResult([
|
|
223
264
|
instance.salt,
|
|
224
265
|
instance.deployer.toField(),
|
|
@@ -229,7 +270,7 @@ export class TXEService {
|
|
|
229
270
|
}
|
|
230
271
|
async utilityGetPublicKeysAndPartialAddress(foreignAddress) {
|
|
231
272
|
const address = addressFromSingle(foreignAddress);
|
|
232
|
-
const { publicKeys, partialAddress } = await this.
|
|
273
|
+
const { publicKeys, partialAddress } = await this.handlerAsUtility().utilityGetPublicKeysAndPartialAddress(address);
|
|
233
274
|
return toForeignCallResult([
|
|
234
275
|
toArray([
|
|
235
276
|
...publicKeys.toFields(),
|
|
@@ -239,7 +280,7 @@ export class TXEService {
|
|
|
239
280
|
}
|
|
240
281
|
async utilityGetKeyValidationRequest(foreignPkMHash) {
|
|
241
282
|
const pkMHash = fromSingle(foreignPkMHash);
|
|
242
|
-
const keyValidationRequest = await this.
|
|
283
|
+
const keyValidationRequest = await this.handlerAsUtility().utilityGetKeyValidationRequest(pkMHash);
|
|
243
284
|
return toForeignCallResult(keyValidationRequest.toFields().map(toSingle));
|
|
244
285
|
}
|
|
245
286
|
privateCallPrivateFunction(_foreignTargetContractAddress, _foreignFunctionSelector, _foreignArgsHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
|
|
@@ -248,7 +289,7 @@ export class TXEService {
|
|
|
248
289
|
async utilityGetNullifierMembershipWitness(foreignBlockNumber, foreignNullifier) {
|
|
249
290
|
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
250
291
|
const nullifier = fromSingle(foreignNullifier);
|
|
251
|
-
const witness = await this.
|
|
292
|
+
const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(blockNumber, nullifier);
|
|
252
293
|
if (!witness) {
|
|
253
294
|
throw new Error(`Nullifier membership witness not found at block ${blockNumber}.`);
|
|
254
295
|
}
|
|
@@ -256,7 +297,7 @@ export class TXEService {
|
|
|
256
297
|
}
|
|
257
298
|
async utilityGetAuthWitness(foreignMessageHash) {
|
|
258
299
|
const messageHash = fromSingle(foreignMessageHash);
|
|
259
|
-
const authWitness = await this.
|
|
300
|
+
const authWitness = await this.handlerAsUtility().utilityGetAuthWitness(messageHash);
|
|
260
301
|
if (!authWitness) {
|
|
261
302
|
throw new Error(`Auth witness not found for message hash ${messageHash}.`);
|
|
262
303
|
}
|
|
@@ -273,21 +314,13 @@ export class TXEService {
|
|
|
273
314
|
privateNotifySetMinRevertibleSideEffectCounter(_foreignMinRevertibleSideEffectCounter) {
|
|
274
315
|
throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
|
|
275
316
|
}
|
|
276
|
-
async
|
|
277
|
-
const
|
|
278
|
-
return toForeignCallResult(
|
|
279
|
-
toSingle(chainId)
|
|
280
|
-
]);
|
|
281
|
-
}
|
|
282
|
-
async utilityGetVersion() {
|
|
283
|
-
const version = await this.oracleHandler.utilityGetVersion();
|
|
284
|
-
return toForeignCallResult([
|
|
285
|
-
toSingle(version)
|
|
286
|
-
]);
|
|
317
|
+
async utilityGetUtilityContext() {
|
|
318
|
+
const context = await this.handlerAsUtility().utilityGetUtilityContext();
|
|
319
|
+
return toForeignCallResult(context.toNoirRepresentation());
|
|
287
320
|
}
|
|
288
321
|
async utilityGetBlockHeader(foreignBlockNumber) {
|
|
289
322
|
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
290
|
-
const header = await this.
|
|
323
|
+
const header = await this.handlerAsUtility().utilityGetBlockHeader(blockNumber);
|
|
291
324
|
if (!header) {
|
|
292
325
|
throw new Error(`Block header not found for block ${blockNumber}.`);
|
|
293
326
|
}
|
|
@@ -297,7 +330,7 @@ export class TXEService {
|
|
|
297
330
|
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
298
331
|
const treeId = fromSingle(foreignTreeId).toNumber();
|
|
299
332
|
const leafValue = fromSingle(foreignLeafValue);
|
|
300
|
-
const witness = await this.
|
|
333
|
+
const witness = await this.handlerAsUtility().utilityGetMembershipWitness(blockNumber, treeId, leafValue);
|
|
301
334
|
if (!witness) {
|
|
302
335
|
throw new Error(`Membership witness in tree ${MerkleTreeId[treeId]} not found for value ${leafValue} at block ${blockNumber}.`);
|
|
303
336
|
}
|
|
@@ -309,49 +342,43 @@ export class TXEService {
|
|
|
309
342
|
async utilityGetLowNullifierMembershipWitness(foreignBlockNumber, foreignNullifier) {
|
|
310
343
|
const blockNumber = fromSingle(foreignBlockNumber).toNumber();
|
|
311
344
|
const nullifier = fromSingle(foreignNullifier);
|
|
312
|
-
const witness = await this.
|
|
345
|
+
const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(blockNumber, nullifier);
|
|
313
346
|
if (!witness) {
|
|
314
347
|
throw new Error(`Low nullifier witness not found for nullifier ${nullifier} at block ${blockNumber}.`);
|
|
315
348
|
}
|
|
316
349
|
return toForeignCallResult(witness.toNoirRepresentation());
|
|
317
350
|
}
|
|
318
|
-
async utilityGetIndexedTaggingSecretAsSender(foreignSender, foreignRecipient) {
|
|
319
|
-
const sender = AztecAddress.fromField(fromSingle(foreignSender));
|
|
320
|
-
const recipient = AztecAddress.fromField(fromSingle(foreignRecipient));
|
|
321
|
-
const secret = await this.oracleHandler.utilityGetIndexedTaggingSecretAsSender(sender, recipient);
|
|
322
|
-
return toForeignCallResult(secret.toFields().map(toSingle));
|
|
323
|
-
}
|
|
324
351
|
async utilityFetchTaggedLogs(foreignPendingTaggedLogArrayBaseSlot) {
|
|
325
352
|
const pendingTaggedLogArrayBaseSlot = fromSingle(foreignPendingTaggedLogArrayBaseSlot);
|
|
326
|
-
await this.
|
|
353
|
+
await this.handlerAsUtility().utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot);
|
|
327
354
|
return toForeignCallResult([]);
|
|
328
355
|
}
|
|
329
356
|
async utilityValidateEnqueuedNotesAndEvents(foreignContractAddress, foreignNoteValidationRequestsArrayBaseSlot, foreignEventValidationRequestsArrayBaseSlot) {
|
|
330
357
|
const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
|
|
331
358
|
const noteValidationRequestsArrayBaseSlot = fromSingle(foreignNoteValidationRequestsArrayBaseSlot);
|
|
332
359
|
const eventValidationRequestsArrayBaseSlot = fromSingle(foreignEventValidationRequestsArrayBaseSlot);
|
|
333
|
-
await this.
|
|
360
|
+
await this.handlerAsUtility().utilityValidateEnqueuedNotesAndEvents(contractAddress, noteValidationRequestsArrayBaseSlot, eventValidationRequestsArrayBaseSlot);
|
|
334
361
|
return toForeignCallResult([]);
|
|
335
362
|
}
|
|
336
363
|
async utilityBulkRetrieveLogs(foreignContractAddress, foreignLogRetrievalRequestsArrayBaseSlot, foreignLogRetrievalResponsesArrayBaseSlot) {
|
|
337
364
|
const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
|
|
338
365
|
const logRetrievalRequestsArrayBaseSlot = fromSingle(foreignLogRetrievalRequestsArrayBaseSlot);
|
|
339
366
|
const logRetrievalResponsesArrayBaseSlot = fromSingle(foreignLogRetrievalResponsesArrayBaseSlot);
|
|
340
|
-
await this.
|
|
367
|
+
await this.handlerAsUtility().utilityBulkRetrieveLogs(contractAddress, logRetrievalRequestsArrayBaseSlot, logRetrievalResponsesArrayBaseSlot);
|
|
341
368
|
return toForeignCallResult([]);
|
|
342
369
|
}
|
|
343
370
|
async utilityStoreCapsule(foreignContractAddress, foreignSlot, foreignCapsule) {
|
|
344
371
|
const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
|
|
345
372
|
const slot = fromSingle(foreignSlot);
|
|
346
373
|
const capsule = fromArray(foreignCapsule);
|
|
347
|
-
await this.
|
|
374
|
+
await this.handlerAsUtility().utilityStoreCapsule(contractAddress, slot, capsule);
|
|
348
375
|
return toForeignCallResult([]);
|
|
349
376
|
}
|
|
350
377
|
async utilityLoadCapsule(foreignContractAddress, foreignSlot, foreignTSize) {
|
|
351
378
|
const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
|
|
352
379
|
const slot = fromSingle(foreignSlot);
|
|
353
380
|
const tSize = fromSingle(foreignTSize).toNumber();
|
|
354
|
-
const values = await this.
|
|
381
|
+
const values = await this.handlerAsUtility().utilityLoadCapsule(contractAddress, slot);
|
|
355
382
|
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
356
383
|
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
357
384
|
if (values === null) {
|
|
@@ -371,7 +398,7 @@ export class TXEService {
|
|
|
371
398
|
async utilityDeleteCapsule(foreignContractAddress, foreignSlot) {
|
|
372
399
|
const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
|
|
373
400
|
const slot = fromSingle(foreignSlot);
|
|
374
|
-
await this.
|
|
401
|
+
await this.handlerAsUtility().utilityDeleteCapsule(contractAddress, slot);
|
|
375
402
|
return toForeignCallResult([]);
|
|
376
403
|
}
|
|
377
404
|
async utilityCopyCapsule(foreignContractAddress, foreignSrcSlot, foreignDstSlot, foreignNumEntries) {
|
|
@@ -379,7 +406,7 @@ export class TXEService {
|
|
|
379
406
|
const srcSlot = fromSingle(foreignSrcSlot);
|
|
380
407
|
const dstSlot = fromSingle(foreignDstSlot);
|
|
381
408
|
const numEntries = fromSingle(foreignNumEntries).toNumber();
|
|
382
|
-
await this.
|
|
409
|
+
await this.handlerAsUtility().utilityCopyCapsule(contractAddress, srcSlot, dstSlot, numEntries);
|
|
383
410
|
return toForeignCallResult([]);
|
|
384
411
|
}
|
|
385
412
|
// TODO: I forgot to add a corresponding function here, when I introduced an oracle method to txe_oracle.ts.
|
|
@@ -390,7 +417,7 @@ export class TXEService {
|
|
|
390
417
|
const ciphertext = fromUintBoundedVec(foreignCiphertextBVecStorage, foreignCiphertextLength, 8);
|
|
391
418
|
const iv = fromUintArray(foreignIv, 8);
|
|
392
419
|
const symKey = fromUintArray(foreignSymKey, 8);
|
|
393
|
-
const plaintextBuffer = await this.
|
|
420
|
+
const plaintextBuffer = await this.handlerAsUtility().utilityAes128Decrypt(ciphertext, iv, symKey);
|
|
394
421
|
return toForeignCallResult(arrayToBoundedVec(bufferToU8Array(plaintextBuffer), foreignCiphertextBVecStorage.length));
|
|
395
422
|
}
|
|
396
423
|
async utilityGetSharedSecret(foreignAddress, foreignEphPKField0, foreignEphPKField1, foreignEphPKField2) {
|
|
@@ -400,7 +427,7 @@ export class TXEService {
|
|
|
400
427
|
fromSingle(foreignEphPKField1),
|
|
401
428
|
fromSingle(foreignEphPKField2)
|
|
402
429
|
]);
|
|
403
|
-
const secret = await this.
|
|
430
|
+
const secret = await this.handlerAsUtility().utilityGetSharedSecret(address, ephPK);
|
|
404
431
|
return toForeignCallResult(secret.toFields().map(toSingle));
|
|
405
432
|
}
|
|
406
433
|
emitOffchainEffect(_foreignData) {
|
|
@@ -413,7 +440,7 @@ export class TXEService {
|
|
|
413
440
|
}
|
|
414
441
|
async avmOpcodeStorageRead(foreignSlot) {
|
|
415
442
|
const slot = fromSingle(foreignSlot);
|
|
416
|
-
const value = (await this.
|
|
443
|
+
const value = (await this.handlerAsAvm().avmOpcodeStorageRead(slot)).value;
|
|
417
444
|
return toForeignCallResult([
|
|
418
445
|
toSingle(new Fr(value))
|
|
419
446
|
]);
|
|
@@ -421,12 +448,12 @@ export class TXEService {
|
|
|
421
448
|
async avmOpcodeStorageWrite(foreignSlot, foreignValue) {
|
|
422
449
|
const slot = fromSingle(foreignSlot);
|
|
423
450
|
const value = fromSingle(foreignValue);
|
|
424
|
-
await this.
|
|
451
|
+
await this.handlerAsAvm().avmOpcodeStorageWrite(slot, value);
|
|
425
452
|
return toForeignCallResult([]);
|
|
426
453
|
}
|
|
427
454
|
async avmOpcodeGetContractInstanceDeployer(foreignAddress) {
|
|
428
455
|
const address = addressFromSingle(foreignAddress);
|
|
429
|
-
const instance = await this.
|
|
456
|
+
const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
|
|
430
457
|
return toForeignCallResult([
|
|
431
458
|
toSingle(instance.deployer),
|
|
432
459
|
// AVM requires an extra boolean indicating the instance was found
|
|
@@ -435,7 +462,7 @@ export class TXEService {
|
|
|
435
462
|
}
|
|
436
463
|
async avmOpcodeGetContractInstanceClassId(foreignAddress) {
|
|
437
464
|
const address = addressFromSingle(foreignAddress);
|
|
438
|
-
const instance = await this.
|
|
465
|
+
const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
|
|
439
466
|
return toForeignCallResult([
|
|
440
467
|
toSingle(instance.currentContractClassId),
|
|
441
468
|
// AVM requires an extra boolean indicating the instance was found
|
|
@@ -444,69 +471,69 @@ export class TXEService {
|
|
|
444
471
|
}
|
|
445
472
|
async avmOpcodeGetContractInstanceInitializationHash(foreignAddress) {
|
|
446
473
|
const address = addressFromSingle(foreignAddress);
|
|
447
|
-
const instance = await this.
|
|
474
|
+
const instance = await this.handlerAsUtility().utilityGetContractInstance(address);
|
|
448
475
|
return toForeignCallResult([
|
|
449
476
|
toSingle(instance.initializationHash),
|
|
450
477
|
// AVM requires an extra boolean indicating the instance was found
|
|
451
478
|
toSingle(new Fr(1))
|
|
452
479
|
]);
|
|
453
480
|
}
|
|
454
|
-
avmOpcodeSender() {
|
|
455
|
-
const sender = this.
|
|
481
|
+
async avmOpcodeSender() {
|
|
482
|
+
const sender = await this.handlerAsAvm().avmOpcodeSender();
|
|
456
483
|
return toForeignCallResult([
|
|
457
484
|
toSingle(sender)
|
|
458
485
|
]);
|
|
459
486
|
}
|
|
460
487
|
async avmOpcodeEmitNullifier(foreignNullifier) {
|
|
461
488
|
const nullifier = fromSingle(foreignNullifier);
|
|
462
|
-
await this.
|
|
489
|
+
await this.handlerAsAvm().avmOpcodeEmitNullifier(nullifier);
|
|
463
490
|
return toForeignCallResult([]);
|
|
464
491
|
}
|
|
465
492
|
async avmOpcodeEmitNoteHash(foreignNoteHash) {
|
|
466
493
|
const noteHash = fromSingle(foreignNoteHash);
|
|
467
|
-
await this.
|
|
494
|
+
await this.handlerAsAvm().avmOpcodeEmitNoteHash(noteHash);
|
|
468
495
|
return toForeignCallResult([]);
|
|
469
496
|
}
|
|
470
497
|
async avmOpcodeNullifierExists(foreignInnerNullifier, foreignTargetAddress) {
|
|
471
498
|
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
472
499
|
const targetAddress = AztecAddress.fromField(fromSingle(foreignTargetAddress));
|
|
473
|
-
const exists = await this.
|
|
500
|
+
const exists = await this.handlerAsAvm().avmOpcodeNullifierExists(innerNullifier, targetAddress);
|
|
474
501
|
return toForeignCallResult([
|
|
475
502
|
toSingle(new Fr(exists))
|
|
476
503
|
]);
|
|
477
504
|
}
|
|
478
505
|
async avmOpcodeAddress() {
|
|
479
|
-
const contractAddress = await this.
|
|
506
|
+
const contractAddress = await this.handlerAsAvm().avmOpcodeAddress();
|
|
480
507
|
return toForeignCallResult([
|
|
481
508
|
toSingle(contractAddress.toField())
|
|
482
509
|
]);
|
|
483
510
|
}
|
|
484
511
|
async avmOpcodeBlockNumber() {
|
|
485
|
-
const blockNumber = await this.
|
|
512
|
+
const blockNumber = await this.handlerAsAvm().avmOpcodeBlockNumber();
|
|
486
513
|
return toForeignCallResult([
|
|
487
514
|
toSingle(new Fr(blockNumber))
|
|
488
515
|
]);
|
|
489
516
|
}
|
|
490
517
|
async avmOpcodeTimestamp() {
|
|
491
|
-
const timestamp = await this.
|
|
518
|
+
const timestamp = await this.handlerAsAvm().avmOpcodeTimestamp();
|
|
492
519
|
return toForeignCallResult([
|
|
493
520
|
toSingle(new Fr(timestamp))
|
|
494
521
|
]);
|
|
495
522
|
}
|
|
496
523
|
async avmOpcodeIsStaticCall() {
|
|
497
|
-
const isStaticCall = await this.
|
|
524
|
+
const isStaticCall = await this.handlerAsAvm().avmOpcodeIsStaticCall();
|
|
498
525
|
return toForeignCallResult([
|
|
499
526
|
toSingle(new Fr(isStaticCall ? 1 : 0))
|
|
500
527
|
]);
|
|
501
528
|
}
|
|
502
529
|
async avmOpcodeChainId() {
|
|
503
|
-
const chainId = await this.
|
|
530
|
+
const chainId = await this.handlerAsAvm().avmOpcodeChainId();
|
|
504
531
|
return toForeignCallResult([
|
|
505
532
|
toSingle(chainId)
|
|
506
533
|
]);
|
|
507
534
|
}
|
|
508
535
|
async avmOpcodeVersion() {
|
|
509
|
-
const version = await this.
|
|
536
|
+
const version = await this.handlerAsAvm().avmOpcodeVersion();
|
|
510
537
|
return toForeignCallResult([
|
|
511
538
|
toSingle(version)
|
|
512
539
|
]);
|
|
@@ -533,22 +560,18 @@ export class TXEService {
|
|
|
533
560
|
const args = fromArray(foreignArgs);
|
|
534
561
|
const argsHash = fromSingle(foreignArgsHash);
|
|
535
562
|
const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
|
|
536
|
-
const
|
|
563
|
+
const returnValues = await this.handlerAsTxe().txePrivateCallNewFlow(from, targetContractAddress, functionSelector, args, argsHash, isStaticCall);
|
|
537
564
|
return toForeignCallResult([
|
|
538
|
-
toArray(
|
|
539
|
-
result.endSideEffectCounter,
|
|
540
|
-
result.returnsHash,
|
|
541
|
-
result.txHash.hash
|
|
542
|
-
])
|
|
565
|
+
toArray(returnValues)
|
|
543
566
|
]);
|
|
544
567
|
}
|
|
545
|
-
async
|
|
568
|
+
async txeSimulateUtilityFunction(foreignTargetContractAddress, foreignFunctionSelector, _foreignArgsLength, foreignArgs) {
|
|
546
569
|
const targetContractAddress = addressFromSingle(foreignTargetContractAddress);
|
|
547
570
|
const functionSelector = FunctionSelector.fromField(fromSingle(foreignFunctionSelector));
|
|
548
|
-
const
|
|
549
|
-
const
|
|
571
|
+
const args = fromArray(foreignArgs);
|
|
572
|
+
const returnValues = await this.handlerAsTxe().txeSimulateUtilityFunction(targetContractAddress, functionSelector, args);
|
|
550
573
|
return toForeignCallResult([
|
|
551
|
-
|
|
574
|
+
toArray(returnValues)
|
|
552
575
|
]);
|
|
553
576
|
}
|
|
554
577
|
async txePublicCallNewFlow(foreignFrom, foreignAddress, _foreignLength, foreignCalldata, foreignIsStaticCall) {
|
|
@@ -556,16 +579,13 @@ export class TXEService {
|
|
|
556
579
|
const address = addressFromSingle(foreignAddress);
|
|
557
580
|
const calldata = fromArray(foreignCalldata);
|
|
558
581
|
const isStaticCall = fromSingle(foreignIsStaticCall).toBool();
|
|
559
|
-
const
|
|
582
|
+
const returnValues = await this.handlerAsTxe().txePublicCallNewFlow(from, address, calldata, isStaticCall);
|
|
560
583
|
return toForeignCallResult([
|
|
561
|
-
toArray(
|
|
562
|
-
result.returnsHash,
|
|
563
|
-
result.txHash.hash
|
|
564
|
-
])
|
|
584
|
+
toArray(returnValues)
|
|
565
585
|
]);
|
|
566
586
|
}
|
|
567
587
|
async privateGetSenderForTags() {
|
|
568
|
-
const sender = await this.
|
|
588
|
+
const sender = await this.handlerAsPrivate().privateGetSenderForTags();
|
|
569
589
|
// Return a Noir Option struct with `some` and `value` fields
|
|
570
590
|
if (sender === undefined) {
|
|
571
591
|
// No sender found, return Option with some=0 and value=0
|
|
@@ -583,7 +603,15 @@ export class TXEService {
|
|
|
583
603
|
}
|
|
584
604
|
async privateSetSenderForTags(foreignSenderForTags) {
|
|
585
605
|
const senderForTags = AztecAddress.fromField(fromSingle(foreignSenderForTags));
|
|
586
|
-
await this.
|
|
606
|
+
await this.handlerAsPrivate().privateSetSenderForTags(senderForTags);
|
|
587
607
|
return toForeignCallResult([]);
|
|
588
608
|
}
|
|
609
|
+
async privateGetNextAppTagAsSender(foreignSender, foreignRecipient) {
|
|
610
|
+
const sender = AztecAddress.fromField(fromSingle(foreignSender));
|
|
611
|
+
const recipient = AztecAddress.fromField(fromSingle(foreignRecipient));
|
|
612
|
+
const nextAppTag = await this.handlerAsPrivate().privateGetNextAppTagAsSender(sender, recipient);
|
|
613
|
+
return toForeignCallResult([
|
|
614
|
+
toSingle(nextAppTag.value)
|
|
615
|
+
]);
|
|
616
|
+
}
|
|
589
617
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ArchiverStoreHelper, type PublishedL2Block } from '@aztec/archiver';
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
4
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
6
|
import type { L2Block, L2BlockSource, L2Tips, ValidateBlockResult } from '@aztec/stdlib/block';
|
|
@@ -31,7 +32,7 @@ export declare class TXEArchiver extends ArchiverStoreHelper implements L2BlockS
|
|
|
31
32
|
* @param number - The block number to return (inclusive).
|
|
32
33
|
* @returns The requested L2 block.
|
|
33
34
|
*/
|
|
34
|
-
getBlock(number: number): Promise<L2Block | undefined>;
|
|
35
|
+
getBlock(number: number | 'latest'): Promise<L2Block | undefined>;
|
|
35
36
|
/**
|
|
36
37
|
* Gets an l2 block header.
|
|
37
38
|
* @param number - The block number to return or 'latest' for the most recent one.
|
|
@@ -46,6 +47,9 @@ export declare class TXEArchiver extends ArchiverStoreHelper implements L2BlockS
|
|
|
46
47
|
isEpochComplete(_epochNumber: bigint): Promise<boolean>;
|
|
47
48
|
getL2Tips(): Promise<L2Tips>;
|
|
48
49
|
getL1Constants(): Promise<L1RollupConstants>;
|
|
50
|
+
getGenesisValues(): Promise<{
|
|
51
|
+
genesisArchiveRoot: Fr;
|
|
52
|
+
}>;
|
|
49
53
|
syncImmediate(): Promise<void>;
|
|
50
54
|
getContract(_address: AztecAddress, _timestamp?: UInt64): Promise<ContractInstanceWithAddress | undefined>;
|
|
51
55
|
getRollupAddress(): Promise<EthAddress>;
|