@aztec/entrypoints 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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/account_entrypoint.d.ts +46 -4
- package/dest/account_entrypoint.d.ts.map +1 -1
- package/dest/account_entrypoint.js +46 -103
- package/dest/constants.d.ts +1 -1
- package/dest/default_entrypoint.d.ts +5 -5
- package/dest/default_entrypoint.d.ts.map +1 -1
- package/dest/default_entrypoint.js +2 -5
- package/dest/default_multi_call_entrypoint.d.ts +5 -4
- package/dest/default_multi_call_entrypoint.d.ts.map +1 -1
- package/dest/default_multi_call_entrypoint.js +16 -17
- package/dest/encoding.d.ts +8 -48
- package/dest/encoding.d.ts.map +1 -1
- package/dest/encoding.js +16 -64
- package/dest/index.d.ts +1 -1
- package/dest/interfaces.d.ts +27 -60
- package/dest/interfaces.d.ts.map +1 -1
- package/dest/interfaces.js +8 -2
- package/package.json +11 -9
- package/src/account_entrypoint.ts +62 -76
- package/src/default_entrypoint.ts +5 -12
- package/src/default_multi_call_entrypoint.ts +14 -20
- package/src/encoding.ts +12 -98
- package/src/interfaces.ts +22 -65
- package/dest/payload.d.ts +0 -32
- package/dest/payload.d.ts.map +0 -1
- package/dest/payload.js +0 -27
- package/src/payload.ts +0 -35
package/src/encoding.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { GeneratorIndex } from '@aztec/constants';
|
|
2
2
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
|
-
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
|
|
4
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
+
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
4
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
6
6
|
import { FunctionCall, FunctionType } from '@aztec/stdlib/abi';
|
|
7
7
|
import { HashedValues } from '@aztec/stdlib/tx';
|
|
8
8
|
|
|
9
9
|
// These must match the values defined in:
|
|
10
10
|
// - noir-projects/aztec-nr/aztec/src/entrypoint/app.nr
|
|
11
|
-
const APP_MAX_CALLS =
|
|
12
|
-
// - and noir-projects/aztec-nr/aztec/src/entrypoint/fee.nr
|
|
13
|
-
const FEE_MAX_CALLS = 2;
|
|
11
|
+
const APP_MAX_CALLS = 5;
|
|
14
12
|
|
|
15
13
|
/** Encoded function call for an Aztec entrypoint */
|
|
16
14
|
export type EncodedFunctionCall = {
|
|
@@ -23,6 +21,8 @@ export type EncodedFunctionCall = {
|
|
|
23
21
|
target_address: Fr;
|
|
24
22
|
/** Whether the function is public or private */
|
|
25
23
|
is_public: boolean;
|
|
24
|
+
/** Only applicable for enqueued public function calls. Whether the msg_sender will be set to "null". */
|
|
25
|
+
hide_msg_sender: boolean;
|
|
26
26
|
/** Whether the function can alter state */
|
|
27
27
|
is_static: boolean;
|
|
28
28
|
};
|
|
@@ -40,7 +40,7 @@ export type EncodedCalls = {
|
|
|
40
40
|
* This utility class helps in creating the payload for the entrypoint by taking into
|
|
41
41
|
* account how the calls are encoded and hashed.
|
|
42
42
|
* */
|
|
43
|
-
export
|
|
43
|
+
export class EncodedAppEntrypointCalls implements EncodedCalls {
|
|
44
44
|
constructor(
|
|
45
45
|
/** Function calls in the expected format (Noir's convention) */
|
|
46
46
|
public encodedFunctionCalls: EncodedFunctionCall[],
|
|
@@ -71,7 +71,9 @@ export abstract class EncodedCallsForEntrypoint implements EncodedCalls {
|
|
|
71
71
|
* Serializes the payload to an array of fields
|
|
72
72
|
* @returns The fields of the payload
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
toFields(): Fr[] {
|
|
75
|
+
return [...this.functionCallsToFields(), this.tx_nonce];
|
|
76
|
+
}
|
|
75
77
|
|
|
76
78
|
/**
|
|
77
79
|
* Hashes the payload
|
|
@@ -88,20 +90,11 @@ export abstract class EncodedCallsForEntrypoint implements EncodedCalls {
|
|
|
88
90
|
call.function_selector,
|
|
89
91
|
call.target_address,
|
|
90
92
|
new Fr(call.is_public),
|
|
93
|
+
new Fr(call.hide_msg_sender),
|
|
91
94
|
new Fr(call.is_static),
|
|
92
95
|
]);
|
|
93
96
|
}
|
|
94
97
|
|
|
95
|
-
/**
|
|
96
|
-
* Encodes a set of function calls for a dapp entrypoint
|
|
97
|
-
* @param functionCalls - The function calls to execute
|
|
98
|
-
* @returns The encoded calls
|
|
99
|
-
*/
|
|
100
|
-
static async fromFunctionCalls(functionCalls: FunctionCall[]) {
|
|
101
|
-
const encoded = await encode(functionCalls);
|
|
102
|
-
return new EncodedAppEntrypointCalls(encoded.encodedFunctionCalls, encoded.hashedArguments, 0, Fr.random());
|
|
103
|
-
}
|
|
104
|
-
|
|
105
98
|
/**
|
|
106
99
|
* Encodes the functions for the app-portion of a transaction from a set of function calls and a nonce
|
|
107
100
|
* @param functionCalls - The function calls to execute
|
|
@@ -109,7 +102,7 @@ export abstract class EncodedCallsForEntrypoint implements EncodedCalls {
|
|
|
109
102
|
* nonce can be replaced by submitting a new one with a higher fee.
|
|
110
103
|
* @returns The encoded calls
|
|
111
104
|
*/
|
|
112
|
-
static async
|
|
105
|
+
static async create(
|
|
113
106
|
functionCalls: FunctionCall[] | Tuple<FunctionCall, typeof APP_MAX_CALLS>,
|
|
114
107
|
txNonce = Fr.random(),
|
|
115
108
|
) {
|
|
@@ -125,86 +118,6 @@ export abstract class EncodedCallsForEntrypoint implements EncodedCalls {
|
|
|
125
118
|
txNonce,
|
|
126
119
|
);
|
|
127
120
|
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Creates an encoded set of functions to pay the fee for a transaction
|
|
131
|
-
* @param functionCalls - The calls generated by the payment method
|
|
132
|
-
* @param isFeePayer - Whether the sender should be appointed as fee payer
|
|
133
|
-
* @returns The encoded calls
|
|
134
|
-
*/
|
|
135
|
-
static async fromFeeCalls(
|
|
136
|
-
functionCalls: FunctionCall[] | Tuple<FunctionCall, typeof FEE_MAX_CALLS>,
|
|
137
|
-
isFeePayer: boolean,
|
|
138
|
-
) {
|
|
139
|
-
const paddedCalls = padArrayEnd(functionCalls, FunctionCall.empty(), FEE_MAX_CALLS);
|
|
140
|
-
const encoded = await encode(paddedCalls);
|
|
141
|
-
return new EncodedFeeEntrypointCalls(
|
|
142
|
-
encoded.encodedFunctionCalls,
|
|
143
|
-
encoded.hashedArguments,
|
|
144
|
-
GeneratorIndex.FEE_PAYLOAD,
|
|
145
|
-
Fr.random(),
|
|
146
|
-
isFeePayer,
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/** Encoded calls for app phase execution. */
|
|
152
|
-
export class EncodedAppEntrypointCalls extends EncodedCallsForEntrypoint {
|
|
153
|
-
constructor(
|
|
154
|
-
encodedFunctionCalls: EncodedFunctionCall[],
|
|
155
|
-
hashedArguments: HashedValues[],
|
|
156
|
-
generatorIndex: number,
|
|
157
|
-
txNonce: Fr,
|
|
158
|
-
) {
|
|
159
|
-
super(encodedFunctionCalls, hashedArguments, generatorIndex, txNonce);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
override toFields(): Fr[] {
|
|
163
|
-
return [...this.functionCallsToFields(), this.tx_nonce];
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/** Encoded calls for fee payment */
|
|
168
|
-
export class EncodedFeeEntrypointCalls extends EncodedCallsForEntrypoint {
|
|
169
|
-
#isFeePayer: boolean;
|
|
170
|
-
|
|
171
|
-
constructor(
|
|
172
|
-
encodedFunctionCalls: EncodedFunctionCall[],
|
|
173
|
-
hashedArguments: HashedValues[],
|
|
174
|
-
generatorIndex: number,
|
|
175
|
-
txNonce: Fr,
|
|
176
|
-
isFeePayer: boolean,
|
|
177
|
-
) {
|
|
178
|
-
super(encodedFunctionCalls, hashedArguments, generatorIndex, txNonce);
|
|
179
|
-
this.#isFeePayer = isFeePayer;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
override toFields(): Fr[] {
|
|
183
|
-
return [...this.functionCallsToFields(), this.tx_nonce, new Fr(this.#isFeePayer)];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/* eslint-disable camelcase */
|
|
187
|
-
/** Whether the sender should be appointed as fee payer. */
|
|
188
|
-
get is_fee_payer() {
|
|
189
|
-
return this.#isFeePayer;
|
|
190
|
-
}
|
|
191
|
-
/* eslint-enable camelcase */
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Computes a hash of a combined set of app and fee calls.
|
|
196
|
-
* @param appCalls - A set of app calls.
|
|
197
|
-
* @param feeCalls - A set of calls used to pay fees.
|
|
198
|
-
* @returns A hash of a combined call set.
|
|
199
|
-
*/
|
|
200
|
-
export async function computeCombinedPayloadHash(
|
|
201
|
-
appPayload: EncodedAppEntrypointCalls,
|
|
202
|
-
feePayload: EncodedFeeEntrypointCalls,
|
|
203
|
-
): Promise<Fr> {
|
|
204
|
-
return poseidon2HashWithSeparator(
|
|
205
|
-
[await appPayload.hash(), await feePayload.hash()],
|
|
206
|
-
GeneratorIndex.COMBINED_PAYLOAD,
|
|
207
|
-
);
|
|
208
121
|
}
|
|
209
122
|
|
|
210
123
|
/** Encodes FunctionCalls for execution, following Noir's convention */
|
|
@@ -224,6 +137,7 @@ export async function encode(calls: FunctionCall[]): Promise<EncodedCalls> {
|
|
|
224
137
|
function_selector: call.selector.toField(),
|
|
225
138
|
target_address: call.to.toField(),
|
|
226
139
|
is_public: call.type == FunctionType.PUBLIC,
|
|
140
|
+
hide_msg_sender: call.hideMsgSender,
|
|
227
141
|
is_static: call.isStatic,
|
|
228
142
|
}));
|
|
229
143
|
|
package/src/interfaces.ts
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
2
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
3
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
6
|
-
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
4
|
+
import type { ExecutionPayload, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
7
5
|
|
|
8
|
-
import
|
|
6
|
+
import { z } from 'zod';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
|
-
*
|
|
9
|
+
* Information on the connected chain. Used by wallets when constructing transactions to protect against replay
|
|
10
|
+
* attacks.
|
|
12
11
|
*/
|
|
13
|
-
export type
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
* used to compute a nullifier that allows cancelling this transaction by submitting a new one with the same nonce
|
|
19
|
-
* but higher fee. The nullifier ensures only one transaction can succeed.
|
|
20
|
-
*/
|
|
21
|
-
txNonce?: Fr;
|
|
12
|
+
export type ChainInfo = {
|
|
13
|
+
/** The L1 chain id */
|
|
14
|
+
chainId: Fr;
|
|
15
|
+
/** The version of the rollup */
|
|
16
|
+
version: Fr;
|
|
22
17
|
};
|
|
23
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Zod schema for ChainInfo
|
|
21
|
+
*/
|
|
22
|
+
export const ChainInfoSchema = z.object({
|
|
23
|
+
chainId: Fr.schema,
|
|
24
|
+
version: Fr.schema,
|
|
25
|
+
});
|
|
26
|
+
|
|
24
27
|
/**
|
|
25
28
|
* Creates transaction execution requests out of a set of function calls, a fee payment method and
|
|
26
29
|
* general options for the transaction
|
|
@@ -29,14 +32,14 @@ export interface EntrypointInterface {
|
|
|
29
32
|
/**
|
|
30
33
|
* Generates an execution request out of set of function calls.
|
|
31
34
|
* @param exec - The execution intents to be run.
|
|
32
|
-
* @param
|
|
33
|
-
* @param options -
|
|
35
|
+
* @param gasSettings - The gas settings for the transaction.
|
|
36
|
+
* @param options - Miscellaneous tx options that enable/disable features of the entrypoint
|
|
34
37
|
* @returns The authenticated transaction execution request.
|
|
35
38
|
*/
|
|
36
39
|
createTxExecutionRequest(
|
|
37
40
|
exec: ExecutionPayload,
|
|
38
|
-
|
|
39
|
-
options
|
|
41
|
+
gasSettings: GasSettings,
|
|
42
|
+
options?: any,
|
|
40
43
|
): Promise<TxExecutionRequest>;
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -49,49 +52,3 @@ export interface AuthWitnessProvider {
|
|
|
49
52
|
*/
|
|
50
53
|
createAuthWit(messageHash: Fr | Buffer): Promise<AuthWitness>;
|
|
51
54
|
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Holds information about how the fee for a transaction is to be paid.
|
|
55
|
-
*/
|
|
56
|
-
export interface FeePaymentMethod {
|
|
57
|
-
/** The asset used to pay the fee. */
|
|
58
|
-
getAsset(): Promise<AztecAddress>;
|
|
59
|
-
/**
|
|
60
|
-
* Returns the data to be added to the final execution request
|
|
61
|
-
* to pay the fee in the given asset
|
|
62
|
-
* @param gasSettings - The gas limits and max fees.
|
|
63
|
-
* @returns The function calls to pay the fee.
|
|
64
|
-
*/
|
|
65
|
-
getExecutionPayload(gasSettings: GasSettings): Promise<ExecutionPayload>;
|
|
66
|
-
/**
|
|
67
|
-
* The expected fee payer for this tx.
|
|
68
|
-
* @param gasSettings - The gas limits and max fees.
|
|
69
|
-
*/
|
|
70
|
-
getFeePayer(gasSettings: GasSettings): Promise<AztecAddress>;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Fee payment options for a transaction.
|
|
75
|
-
*/
|
|
76
|
-
export type FeeOptions = {
|
|
77
|
-
/** The fee payment method to use */
|
|
78
|
-
paymentMethod: FeePaymentMethod;
|
|
79
|
-
/** The gas settings */
|
|
80
|
-
gasSettings: GasSettings;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// docs:start:user_fee_options
|
|
84
|
-
/** Fee options as set by a user. */
|
|
85
|
-
export type UserFeeOptions = {
|
|
86
|
-
/** The fee payment method to use */
|
|
87
|
-
paymentMethod?: FeePaymentMethod;
|
|
88
|
-
/** The gas settings */
|
|
89
|
-
gasSettings?: Partial<FieldsOf<GasSettings>>;
|
|
90
|
-
/** Percentage to pad the base fee by, if empty, defaults to 0.5 */
|
|
91
|
-
baseFeePadding?: number;
|
|
92
|
-
/** Whether to run an initial simulation of the tx with high gas limit to figure out actual gas settings. */
|
|
93
|
-
estimateGas?: boolean;
|
|
94
|
-
/** Percentage to pad the estimated gas limits by, if empty, defaults to 0.1. Only relevant if estimateGas is set. */
|
|
95
|
-
estimatedGasPadding?: number;
|
|
96
|
-
};
|
|
97
|
-
// docs:end:user_fee_options
|
package/dest/payload.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FunctionCall } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
|
-
import { Capsule, HashedValues } from '@aztec/stdlib/tx';
|
|
4
|
-
/**
|
|
5
|
-
* Represents data necessary to perform an action in the network successfully.
|
|
6
|
-
* This class can be considered Aztec's "minimal execution unit".
|
|
7
|
-
* */
|
|
8
|
-
export declare class ExecutionPayload {
|
|
9
|
-
/** The function calls to be executed. */
|
|
10
|
-
calls: FunctionCall[];
|
|
11
|
-
/** Any transient auth witnesses needed for this execution */
|
|
12
|
-
authWitnesses: AuthWitness[];
|
|
13
|
-
/** Data passed through an oracle for this execution. */
|
|
14
|
-
capsules: Capsule[];
|
|
15
|
-
/** Extra hashed values to be injected in the execution cache */
|
|
16
|
-
extraHashedArgs: HashedValues[];
|
|
17
|
-
constructor(
|
|
18
|
-
/** The function calls to be executed. */
|
|
19
|
-
calls: FunctionCall[],
|
|
20
|
-
/** Any transient auth witnesses needed for this execution */
|
|
21
|
-
authWitnesses: AuthWitness[],
|
|
22
|
-
/** Data passed through an oracle for this execution. */
|
|
23
|
-
capsules: Capsule[],
|
|
24
|
-
/** Extra hashed values to be injected in the execution cache */
|
|
25
|
-
extraHashedArgs?: HashedValues[]);
|
|
26
|
-
static empty(): ExecutionPayload;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Merges an array ExecutionPayloads combining their calls, authWitnesses, capsules and extraArgHashes.
|
|
30
|
-
*/
|
|
31
|
-
export declare function mergeExecutionPayloads(requests: ExecutionPayload[]): ExecutionPayload;
|
|
32
|
-
//# sourceMappingURL=payload.d.ts.map
|
package/dest/payload.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../src/payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;KAGK;AACL,qBAAa,gBAAgB;IAEzB,yCAAyC;IAClC,KAAK,EAAE,YAAY,EAAE;IAC5B,6DAA6D;IACtD,aAAa,EAAE,WAAW,EAAE;IACnC,wDAAwD;IACjD,QAAQ,EAAE,OAAO,EAAE;IAC1B,gEAAgE;IACzD,eAAe,EAAE,YAAY,EAAE;;IAPtC,yCAAyC;IAClC,KAAK,EAAE,YAAY,EAAE;IAC5B,6DAA6D;IACtD,aAAa,EAAE,WAAW,EAAE;IACnC,wDAAwD;IACjD,QAAQ,EAAE,OAAO,EAAE;IAC1B,gEAAgE;IACzD,eAAe,GAAE,YAAY,EAAO;IAG7C,MAAM,CAAC,KAAK;CAGb;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,CAMrF"}
|
package/dest/payload.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents data necessary to perform an action in the network successfully.
|
|
3
|
-
* This class can be considered Aztec's "minimal execution unit".
|
|
4
|
-
* */ export class ExecutionPayload {
|
|
5
|
-
calls;
|
|
6
|
-
authWitnesses;
|
|
7
|
-
capsules;
|
|
8
|
-
extraHashedArgs;
|
|
9
|
-
constructor(/** The function calls to be executed. */ calls, /** Any transient auth witnesses needed for this execution */ authWitnesses, /** Data passed through an oracle for this execution. */ capsules, /** Extra hashed values to be injected in the execution cache */ extraHashedArgs = []){
|
|
10
|
-
this.calls = calls;
|
|
11
|
-
this.authWitnesses = authWitnesses;
|
|
12
|
-
this.capsules = capsules;
|
|
13
|
-
this.extraHashedArgs = extraHashedArgs;
|
|
14
|
-
}
|
|
15
|
-
static empty() {
|
|
16
|
-
return new ExecutionPayload([], [], []);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Merges an array ExecutionPayloads combining their calls, authWitnesses, capsules and extraArgHashes.
|
|
21
|
-
*/ export function mergeExecutionPayloads(requests) {
|
|
22
|
-
const calls = requests.map((r)=>r.calls).flat();
|
|
23
|
-
const combinedAuthWitnesses = requests.map((r)=>r.authWitnesses ?? []).flat();
|
|
24
|
-
const combinedCapsules = requests.map((r)=>r.capsules ?? []).flat();
|
|
25
|
-
const combinedextraHashedArgs = requests.map((r)=>r.extraHashedArgs ?? []).flat();
|
|
26
|
-
return new ExecutionPayload(calls, combinedAuthWitnesses, combinedCapsules, combinedextraHashedArgs);
|
|
27
|
-
}
|
package/src/payload.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { FunctionCall } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
|
-
import { Capsule, HashedValues } from '@aztec/stdlib/tx';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Represents data necessary to perform an action in the network successfully.
|
|
7
|
-
* This class can be considered Aztec's "minimal execution unit".
|
|
8
|
-
* */
|
|
9
|
-
export class ExecutionPayload {
|
|
10
|
-
public constructor(
|
|
11
|
-
/** The function calls to be executed. */
|
|
12
|
-
public calls: FunctionCall[],
|
|
13
|
-
/** Any transient auth witnesses needed for this execution */
|
|
14
|
-
public authWitnesses: AuthWitness[],
|
|
15
|
-
/** Data passed through an oracle for this execution. */
|
|
16
|
-
public capsules: Capsule[],
|
|
17
|
-
/** Extra hashed values to be injected in the execution cache */
|
|
18
|
-
public extraHashedArgs: HashedValues[] = [],
|
|
19
|
-
) {}
|
|
20
|
-
|
|
21
|
-
static empty() {
|
|
22
|
-
return new ExecutionPayload([], [], []);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Merges an array ExecutionPayloads combining their calls, authWitnesses, capsules and extraArgHashes.
|
|
28
|
-
*/
|
|
29
|
-
export function mergeExecutionPayloads(requests: ExecutionPayload[]): ExecutionPayload {
|
|
30
|
-
const calls = requests.map(r => r.calls).flat();
|
|
31
|
-
const combinedAuthWitnesses = requests.map(r => r.authWitnesses ?? []).flat();
|
|
32
|
-
const combinedCapsules = requests.map(r => r.capsules ?? []).flat();
|
|
33
|
-
const combinedextraHashedArgs = requests.map(r => r.extraHashedArgs ?? []).flat();
|
|
34
|
-
return new ExecutionPayload(calls, combinedAuthWitnesses, combinedCapsules, combinedextraHashedArgs);
|
|
35
|
-
}
|