@arcium-hq/client 0.4.0 → 0.5.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/README.md +15 -9
- package/build/index.cjs +1523 -1064
- package/build/index.d.ts +1060 -1933
- package/build/index.mjs +1520 -1061
- package/package.json +3 -6
package/build/index.cjs
CHANGED
|
@@ -100,6 +100,92 @@ function sha256(byteArrays) {
|
|
|
100
100
|
return hash.digest();
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Seed for ClockAccount PDA
|
|
105
|
+
* @constant {string}
|
|
106
|
+
*/
|
|
107
|
+
const CLOCK_ACC_SEED = 'ClockAccount';
|
|
108
|
+
/**
|
|
109
|
+
* Seed for FeePool PDA
|
|
110
|
+
* @constant {string}
|
|
111
|
+
*/
|
|
112
|
+
const POOL_ACC_SEED = 'FeePool';
|
|
113
|
+
/**
|
|
114
|
+
* Seed for ComputationAccount PDA
|
|
115
|
+
* @constant {string}
|
|
116
|
+
*/
|
|
117
|
+
const COMPUTATION_ACC_SEED = 'ComputationAccount';
|
|
118
|
+
/**
|
|
119
|
+
* Seed for Mempool PDA
|
|
120
|
+
* @constant {string}
|
|
121
|
+
*/
|
|
122
|
+
const MEMPOOL_ACC_SEED = 'Mempool';
|
|
123
|
+
/**
|
|
124
|
+
* Seed for ExecutingPoolAccount PDA
|
|
125
|
+
* @constant {string}
|
|
126
|
+
*/
|
|
127
|
+
const EXEC_POOL_ACC_SEED = 'Execpool';
|
|
128
|
+
/**
|
|
129
|
+
* Seed for ClusterAccount PDA
|
|
130
|
+
* @constant {string}
|
|
131
|
+
*/
|
|
132
|
+
const CLUSTER_ACC_SEED = 'Cluster';
|
|
133
|
+
/**
|
|
134
|
+
* Seed for ArxNodeAccount PDA
|
|
135
|
+
* @constant {string}
|
|
136
|
+
*/
|
|
137
|
+
const ARX_NODE_ACC_SEED = 'ArxNode';
|
|
138
|
+
/**
|
|
139
|
+
* Seed for MXE Account PDA
|
|
140
|
+
* @constant {string}
|
|
141
|
+
*/
|
|
142
|
+
const MXE_ACCOUNT_SEED = 'MXEAccount';
|
|
143
|
+
/**
|
|
144
|
+
* Seed for CompDefAccount PDA
|
|
145
|
+
* @constant {string}
|
|
146
|
+
*/
|
|
147
|
+
const COMP_DEF_ACC_SEED = 'ComputationDefinitionAccount';
|
|
148
|
+
/**
|
|
149
|
+
* Maximum number of bytes that can be reallocated per instruction.
|
|
150
|
+
* @constant {number}
|
|
151
|
+
*/
|
|
152
|
+
const MAX_REALLOC_PER_IX = 10240;
|
|
153
|
+
/**
|
|
154
|
+
* Maximum number of bytes that can be uploaded in a single transaction with the upload instruction.
|
|
155
|
+
* @constant {number}
|
|
156
|
+
*/
|
|
157
|
+
const MAX_UPLOAD_PER_TX_BYTES = 814;
|
|
158
|
+
/**
|
|
159
|
+
* Maximum size of an account in bytes (10MB = 10 * 1024 * 1024).
|
|
160
|
+
* @constant {number}
|
|
161
|
+
*/
|
|
162
|
+
const MAX_ACCOUNT_SIZE = 10485760;
|
|
163
|
+
/**
|
|
164
|
+
* Maximum number of arcium embiggen instructions allowed in a single transaction (due to compute unit limits).
|
|
165
|
+
* @constant {number}
|
|
166
|
+
*/
|
|
167
|
+
const MAX_EMBIGGEN_IX_PER_TX = 18;
|
|
168
|
+
/**
|
|
169
|
+
* Size of account discriminator in bytes.
|
|
170
|
+
* @constant {number}
|
|
171
|
+
*/
|
|
172
|
+
const DISCRIMINATOR_SIZE = 8;
|
|
173
|
+
/**
|
|
174
|
+
* Size of offset buffer in bytes (u32).
|
|
175
|
+
* @constant {number}
|
|
176
|
+
*/
|
|
177
|
+
const OFFSET_BUFFER_SIZE = 4;
|
|
178
|
+
/**
|
|
179
|
+
* Size of computation definition offset slice in bytes.
|
|
180
|
+
* @constant {number}
|
|
181
|
+
*/
|
|
182
|
+
const COMP_DEF_OFFSET_SIZE = 4;
|
|
183
|
+
/**
|
|
184
|
+
* Size of a uint128 in bytes.
|
|
185
|
+
* @constant {number}
|
|
186
|
+
*/
|
|
187
|
+
const UINT128_BYTE_SIZE = 16;
|
|
188
|
+
|
|
103
189
|
/**
|
|
104
190
|
* Converts a bigint to an array of bits (least significant to most significant, in 2's complement representation).
|
|
105
191
|
* @param x - The bigint to convert.
|
|
@@ -217,17 +303,32 @@ function verifyBinSize(x, binSize) {
|
|
|
217
303
|
return bin === '0' || bin === '-1';
|
|
218
304
|
}
|
|
219
305
|
|
|
306
|
+
/**
|
|
307
|
+
* Checks if code is running in a browser environment.
|
|
308
|
+
* @returns true if window object exists, false otherwise
|
|
309
|
+
*/
|
|
220
310
|
function isBrowser() {
|
|
221
311
|
return (
|
|
222
312
|
// eslint-disable-next-line no-prototype-builtins
|
|
223
313
|
typeof window !== 'undefined' && !window.process?.hasOwnProperty('type'));
|
|
224
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Conditionally logs a message if logging is enabled.
|
|
317
|
+
* @param log - Whether to output the log
|
|
318
|
+
* @param args - Arguments to pass to console.log
|
|
319
|
+
*/
|
|
225
320
|
function optionalLog(log, ...args) {
|
|
226
321
|
if (log) {
|
|
227
322
|
// eslint-disable-next-line no-console
|
|
228
323
|
console.log(...args);
|
|
229
324
|
}
|
|
230
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Calculates the minimum number of bits needed to represent a value.
|
|
328
|
+
* Formula: floor(log2(max)) + 1 for unsigned, +1 for signed, +1 for diff of two negatives.
|
|
329
|
+
* @param max - The bigint value to measure
|
|
330
|
+
* @returns Number of bits required
|
|
331
|
+
*/
|
|
231
332
|
function getBinSize(max) {
|
|
232
333
|
// floor(log2(max)) + 1 to represent unsigned elements, a +1 for signed elements
|
|
233
334
|
// and another +1 to account for the diff of two negative elements
|
|
@@ -243,12 +344,12 @@ function getBinSize(max) {
|
|
|
243
344
|
* @throws Error if the input length is not a multiple of 16.
|
|
244
345
|
*/
|
|
245
346
|
function compressUint128(bytes) {
|
|
246
|
-
if (bytes.length %
|
|
247
|
-
throw Error(`bytes.length must be a multiple of
|
|
347
|
+
if (bytes.length % UINT128_BYTE_SIZE !== 0) {
|
|
348
|
+
throw Error(`bytes.length must be a multiple of ${UINT128_BYTE_SIZE} (found ${bytes.length})`);
|
|
248
349
|
}
|
|
249
350
|
const res = [];
|
|
250
|
-
for (let n = 0; n < bytes.length /
|
|
251
|
-
res.push(deserializeLE(bytes.slice(n *
|
|
351
|
+
for (let n = 0; n < bytes.length / UINT128_BYTE_SIZE; ++n) {
|
|
352
|
+
res.push(deserializeLE(bytes.slice(n * UINT128_BYTE_SIZE, (n + 1) * UINT128_BYTE_SIZE)));
|
|
252
353
|
}
|
|
253
354
|
return res;
|
|
254
355
|
}
|
|
@@ -269,10 +370,20 @@ function decompressUint128(compressed) {
|
|
|
269
370
|
});
|
|
270
371
|
const res = [];
|
|
271
372
|
for (let n = 0; n < compressed.length; ++n) {
|
|
272
|
-
res.push(...serializeLE(compressed[n],
|
|
373
|
+
res.push(...serializeLE(compressed[n], UINT128_BYTE_SIZE));
|
|
273
374
|
}
|
|
274
375
|
return new Uint8Array(res);
|
|
275
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* Checks if a computation reference is null (all zeros).
|
|
379
|
+
* @param ref - The computation reference to check
|
|
380
|
+
* @returns true if the reference is null, false otherwise
|
|
381
|
+
*/
|
|
382
|
+
function isNullRef(ref) {
|
|
383
|
+
const bigZero = new anchor__namespace.BN(0);
|
|
384
|
+
return (ref.computationOffset === bigZero
|
|
385
|
+
&& ref.priorityFee === bigZero);
|
|
386
|
+
}
|
|
276
387
|
|
|
277
388
|
/**
|
|
278
389
|
* Matrix class over FpField. Data is row-major.
|
|
@@ -460,8 +571,10 @@ function randMatrix(field, nrows, ncols) {
|
|
|
460
571
|
* Curve25519 base field as an IField instance.
|
|
461
572
|
*/
|
|
462
573
|
const CURVE25519_BASE_FIELD = ed25519.ed25519.CURVE.Fp;
|
|
463
|
-
//
|
|
464
|
-
const
|
|
574
|
+
// Security level for the block cipher.
|
|
575
|
+
const SECURITY_LEVEL_BLOCK_CIPHER = 128;
|
|
576
|
+
// Security level for the hash function.
|
|
577
|
+
const SECURITY_LEVEL_HASH_FUNCTION = 256;
|
|
465
578
|
// We refer to https://tosc.iacr.org/index.php/ToSC/article/view/8695/8287 for more details.
|
|
466
579
|
/**
|
|
467
580
|
* Description and parameters for the Rescue cipher or hash function, including round constants, MDS matrix, and key schedule.
|
|
@@ -584,7 +697,7 @@ class RescueDesc {
|
|
|
584
697
|
return roundConstants;
|
|
585
698
|
}
|
|
586
699
|
case 'hash': {
|
|
587
|
-
hasher.update(`Rescue-XLIX(${this.field.ORDER},${m},${this.mode.capacity},${
|
|
700
|
+
hasher.update(`Rescue-XLIX(${this.field.ORDER},${m},${this.mode.capacity},${SECURITY_LEVEL_HASH_FUNCTION})`);
|
|
588
701
|
// this.permute requires an odd number of round keys
|
|
589
702
|
// prepending a 0 matrix makes it equivalent to Algorithm 3 from https://eprint.iacr.org/2020/1143.pdf
|
|
590
703
|
const zeros = [];
|
|
@@ -628,6 +741,13 @@ class RescueDesc {
|
|
|
628
741
|
return rescuePermutationInverse(this.mode, this.alpha, this.alphaInverse, this.mdsMatInverse, this.roundKeys, state)[2 * this.nRounds];
|
|
629
742
|
}
|
|
630
743
|
}
|
|
744
|
+
/**
|
|
745
|
+
* Finds the smallest prime alpha that does not divide p-1, and computes its inverse modulo p-1.
|
|
746
|
+
* The alpha parameter is used in the Rescue permutation for exponentiation operations.
|
|
747
|
+
* @param p - The field modulus (prime number)
|
|
748
|
+
* @returns A tuple [alpha, alphaInverse] where alpha is the prime and alphaInverse is its modular inverse
|
|
749
|
+
* @throws Error if no suitable prime alpha is found
|
|
750
|
+
*/
|
|
631
751
|
function getAlphaAndInverse(p) {
|
|
632
752
|
const pMinusOne = p - 1n;
|
|
633
753
|
let alpha = 0n;
|
|
@@ -643,6 +763,16 @@ function getAlphaAndInverse(p) {
|
|
|
643
763
|
const alphaInverse = modular.invert(alpha, pMinusOne);
|
|
644
764
|
return [alpha, alphaInverse];
|
|
645
765
|
}
|
|
766
|
+
/**
|
|
767
|
+
* Calculates the number of rounds required for the Rescue permutation based on security analysis.
|
|
768
|
+
* The number of rounds is determined by analyzing resistance to differential and algebraic attacks.
|
|
769
|
+
* See: https://tosc.iacr.org/index.php/ToSC/article/view/8695/8287 for the security analysis.
|
|
770
|
+
* @param p - The field modulus
|
|
771
|
+
* @param mode - The Rescue mode (cipher or hash)
|
|
772
|
+
* @param alpha - The prime alpha parameter
|
|
773
|
+
* @param m - The state size (block size for cipher, total size for hash)
|
|
774
|
+
* @returns The number of rounds (will be doubled for the full permutation)
|
|
775
|
+
*/
|
|
646
776
|
function getNRounds(p, mode, alpha, m) {
|
|
647
777
|
function dcon(n) {
|
|
648
778
|
return Math.floor(0.5 * (Number(alpha) - 1) * m * (n - 1) + 2.0);
|
|
@@ -661,20 +791,20 @@ function getNRounds(p, mode, alpha, m) {
|
|
|
661
791
|
}
|
|
662
792
|
switch (mode.kind) {
|
|
663
793
|
case 'cipher': {
|
|
664
|
-
const l0 = Math.ceil((2 *
|
|
794
|
+
const l0 = Math.ceil((2 * SECURITY_LEVEL_BLOCK_CIPHER) / ((m + 1) * (Math.log2(Number(p)) - Math.log2(Number(alpha) - 1))));
|
|
665
795
|
let l1 = 0;
|
|
666
796
|
if (alpha === 3n) {
|
|
667
|
-
l1 = Math.ceil((
|
|
797
|
+
l1 = Math.ceil((SECURITY_LEVEL_BLOCK_CIPHER + 2) / (4 * m));
|
|
668
798
|
}
|
|
669
799
|
else {
|
|
670
|
-
l1 = Math.ceil((
|
|
800
|
+
l1 = Math.ceil((SECURITY_LEVEL_BLOCK_CIPHER + 3) / (5.5 * m));
|
|
671
801
|
}
|
|
672
802
|
return 2 * Math.max(l0, l1, 5);
|
|
673
803
|
}
|
|
674
804
|
case 'hash': {
|
|
675
805
|
// get number of rounds for Groebner basis attack
|
|
676
806
|
const rate = m - mode.capacity;
|
|
677
|
-
const target = 1n << BigInt(
|
|
807
|
+
const target = 1n << BigInt(SECURITY_LEVEL_HASH_FUNCTION);
|
|
678
808
|
let l1 = 1;
|
|
679
809
|
let tmp = binomial(v(l1, rate) + dcon(l1), v(l1, rate));
|
|
680
810
|
while (tmp * tmp <= target && l1 <= 23) {
|
|
@@ -687,6 +817,14 @@ function getNRounds(p, mode, alpha, m) {
|
|
|
687
817
|
default: return 0;
|
|
688
818
|
}
|
|
689
819
|
}
|
|
820
|
+
/**
|
|
821
|
+
* Builds a Cauchy matrix for use as an MDS (Maximum Distance Separable) matrix.
|
|
822
|
+
* A Cauchy matrix is guaranteed to be invertible and provides optimal diffusion properties.
|
|
823
|
+
* The matrix is constructed using the formula: M[i][j] = 1/(i + j) for i, j in [1, size].
|
|
824
|
+
* @param field - The finite field over which to construct the matrix
|
|
825
|
+
* @param size - The size of the square matrix
|
|
826
|
+
* @returns A Cauchy matrix of the specified size
|
|
827
|
+
*/
|
|
690
828
|
function buildCauchy(field, size) {
|
|
691
829
|
const data = [];
|
|
692
830
|
for (let i = 1n; i <= size; ++i) {
|
|
@@ -698,6 +836,13 @@ function buildCauchy(field, size) {
|
|
|
698
836
|
}
|
|
699
837
|
return new Matrix(field, data);
|
|
700
838
|
}
|
|
839
|
+
/**
|
|
840
|
+
* Builds the inverse of a Cauchy matrix for use as the inverse MDS matrix.
|
|
841
|
+
* The inverse is computed using a closed-form formula for Cauchy matrix inversion.
|
|
842
|
+
* @param field - The finite field over which to construct the matrix
|
|
843
|
+
* @param size - The size of the square matrix
|
|
844
|
+
* @returns The inverse of the Cauchy matrix
|
|
845
|
+
*/
|
|
701
846
|
function buildInverseCauchy(field, size) {
|
|
702
847
|
function product(arr) {
|
|
703
848
|
return arr.reduce((acc, curr) => field.mul(acc, field.create(curr)), field.ONE);
|
|
@@ -751,6 +896,19 @@ function exponentForOdd(mode, alpha, alphaInverse) {
|
|
|
751
896
|
default: return 0n;
|
|
752
897
|
}
|
|
753
898
|
}
|
|
899
|
+
/**
|
|
900
|
+
* Core Rescue permutation function implementing the cryptographic primitive.
|
|
901
|
+
* Applies alternating rounds of exponentiation and MDS matrix multiplication with round keys.
|
|
902
|
+
* The permutation alternates between using alpha and alphaInverse as exponents based on round parity.
|
|
903
|
+
* This is the fundamental building block for both Rescue cipher and Rescue-Prime hash.
|
|
904
|
+
* @param mode - The Rescue mode (cipher or hash) determining exponent selection
|
|
905
|
+
* @param alpha - The prime exponent for even rounds
|
|
906
|
+
* @param alphaInverse - The inverse exponent for odd rounds
|
|
907
|
+
* @param mdsMat - The Maximum Distance Separable matrix for diffusion
|
|
908
|
+
* @param subkeys - Array of round key matrices
|
|
909
|
+
* @param state - The initial state matrix to permute
|
|
910
|
+
* @returns Array of all intermediate states during the permutation
|
|
911
|
+
*/
|
|
754
912
|
function rescuePermutation(mode, alpha, alphaInverse, mdsMat, subkeys, state) {
|
|
755
913
|
const exponentEven = exponentForEven(mode, alpha, alphaInverse);
|
|
756
914
|
const exponentOdd = exponentForOdd(mode, alpha, alphaInverse);
|
|
@@ -796,41 +954,49 @@ function toVec(data) {
|
|
|
796
954
|
}
|
|
797
955
|
|
|
798
956
|
/**
|
|
799
|
-
* The Rescue-Prime hash function, as described in https://eprint.iacr.org/2020/1143.pdf
|
|
800
|
-
*
|
|
801
|
-
*
|
|
957
|
+
* The Rescue-Prime hash function, as described in https://eprint.iacr.org/2020/1143.pdf, offering 256 bits
|
|
958
|
+
* of security against collision, preimage and second-preimage attacks for any field of size at least 102 bits.
|
|
959
|
+
* We use the sponge construction with fixed rate = 7 and capacity = 5 (i.e., m = 12), and truncate the
|
|
960
|
+
* output to 5 field elements.
|
|
802
961
|
*/
|
|
803
962
|
class RescuePrimeHash {
|
|
804
963
|
desc;
|
|
805
964
|
rate;
|
|
965
|
+
digestLength;
|
|
806
966
|
/**
|
|
807
|
-
* Constructs a RescuePrimeHash instance with
|
|
967
|
+
* Constructs a RescuePrimeHash instance with rate = 7 and capacity = 5.
|
|
808
968
|
*/
|
|
809
969
|
constructor() {
|
|
810
|
-
this.desc = new RescueDesc(CURVE25519_BASE_FIELD, { kind: 'hash', m:
|
|
811
|
-
this.rate =
|
|
970
|
+
this.desc = new RescueDesc(CURVE25519_BASE_FIELD, { kind: 'hash', m: 12, capacity: 5 });
|
|
971
|
+
this.rate = 7;
|
|
972
|
+
this.digestLength = 5;
|
|
812
973
|
}
|
|
813
974
|
// This is Algorithm 1 from https://eprint.iacr.org/2020/1143.pdf, though with the padding (see Algorithm 2).
|
|
814
|
-
// The hash
|
|
975
|
+
// The hash is truncated to digestLength elements.
|
|
976
|
+
// According to Section 2.2, this offers min(log2(CURVE25519_BASE_FIELD.ORDER) / 2 * min(digestLength, capacity), s)
|
|
977
|
+
// bits of security against collision, preimage and second-preimage attacks.
|
|
978
|
+
// The security level is thus of the order of 256 bits for any field of size at least 102 bits.
|
|
979
|
+
// The rate and capacity are chosen to achieve minimal number of rounds 8.
|
|
815
980
|
/**
|
|
816
981
|
* Computes the Rescue-Prime hash of a message, with padding as described in Algorithm 2 of the paper.
|
|
817
982
|
* @param message - The input message as an array of bigints.
|
|
818
|
-
* @returns The hash output as an array of bigints (length =
|
|
983
|
+
* @returns The hash output as an array of bigints (length = digestLength).
|
|
819
984
|
*/
|
|
820
985
|
digest(message) {
|
|
821
|
-
message
|
|
822
|
-
|
|
823
|
-
|
|
986
|
+
// Create a copy and pad message to avoid mutating input parameter
|
|
987
|
+
const paddedMessage = [...message, 1n];
|
|
988
|
+
while (paddedMessage.length % this.rate !== 0) {
|
|
989
|
+
paddedMessage.push(0n);
|
|
824
990
|
}
|
|
825
991
|
const zeros = [];
|
|
826
992
|
for (let i = 0; i < this.desc.m; ++i) {
|
|
827
993
|
zeros.push([0n]);
|
|
828
994
|
}
|
|
829
995
|
let state = new Matrix(this.desc.field, zeros);
|
|
830
|
-
for (let r = 0; r <
|
|
996
|
+
for (let r = 0; r < paddedMessage.length / this.rate; ++r) {
|
|
831
997
|
const data = [];
|
|
832
998
|
for (let i = 0; i < this.rate; ++i) {
|
|
833
|
-
data[i] = [
|
|
999
|
+
data[i] = [paddedMessage[r * this.rate + i]];
|
|
834
1000
|
}
|
|
835
1001
|
for (let i = this.rate; i < this.desc.m; ++i) {
|
|
836
1002
|
data[i] = [0n];
|
|
@@ -839,7 +1005,7 @@ class RescuePrimeHash {
|
|
|
839
1005
|
state = this.desc.permute(state.add(s, true));
|
|
840
1006
|
}
|
|
841
1007
|
const res = [];
|
|
842
|
-
for (let i = 0; i < this.
|
|
1008
|
+
for (let i = 0; i < this.digestLength; ++i) {
|
|
843
1009
|
res.push(state.data[i][0]);
|
|
844
1010
|
}
|
|
845
1011
|
return res;
|
|
@@ -847,101 +1013,10 @@ class RescuePrimeHash {
|
|
|
847
1013
|
}
|
|
848
1014
|
|
|
849
1015
|
/**
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
*/
|
|
853
|
-
class HMACRescuePrime {
|
|
854
|
-
hasher;
|
|
855
|
-
/**
|
|
856
|
-
* Constructs a new HMACRescuePrime instance.
|
|
857
|
-
*/
|
|
858
|
-
constructor() {
|
|
859
|
-
this.hasher = new RescuePrimeHash();
|
|
860
|
-
}
|
|
861
|
-
/**
|
|
862
|
-
* Computes the HMAC digest of a message with a given key using Rescue-Prime.
|
|
863
|
-
* @param key - The key as an array of bigints.
|
|
864
|
-
* @param message - The message as an array of bigints.
|
|
865
|
-
* @returns The HMAC digest as an array of bigints.
|
|
866
|
-
* @throws Error if the key is longer than the hash function's rate.
|
|
867
|
-
*/
|
|
868
|
-
digest(key, message) {
|
|
869
|
-
// We follow https://datatracker.ietf.org/doc/html/rfc2104, though since Rescue-Prime is not based
|
|
870
|
-
// on the Merkle-Damgard construction we cannot have an exact anology between the
|
|
871
|
-
// parameters. For our purpose, we set B = L = hasher.rate.
|
|
872
|
-
if (key.length > this.hasher.rate) {
|
|
873
|
-
throw Error(`length of key is supposed to be at most the hash function's rate (found ${key.length} and ${this.hasher.rate})`);
|
|
874
|
-
}
|
|
875
|
-
const ipad = deserializeLE(new Uint8Array(32).fill(0x36));
|
|
876
|
-
const opad = deserializeLE(new Uint8Array(32).fill(0x5c));
|
|
877
|
-
// the key is first extended to length B
|
|
878
|
-
for (let i = 0; i < this.hasher.rate - key.length; ++i) {
|
|
879
|
-
key.push(0n);
|
|
880
|
-
}
|
|
881
|
-
// inner padding
|
|
882
|
-
const keyPlusIpad = key.map((k) => k + ipad);
|
|
883
|
-
keyPlusIpad.push(...message);
|
|
884
|
-
const innerDigest = this.hasher.digest(keyPlusIpad);
|
|
885
|
-
// outer padding
|
|
886
|
-
const keyPlusOpad = key.map((k) => k + opad);
|
|
887
|
-
keyPlusOpad.push(...innerDigest);
|
|
888
|
-
return this.hasher.digest(keyPlusOpad);
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* HKDF (HMAC-based Extract-and-Expand Key Derivation Function) using the Rescue-Prime hash function.
|
|
894
|
-
* Follows RFC 5869. Only supports L = HashLen.
|
|
1016
|
+
* Block size m for Rescue cipher operations.
|
|
1017
|
+
* Rescue operates on 5-element blocks of field elements.
|
|
895
1018
|
*/
|
|
896
|
-
|
|
897
|
-
hmac;
|
|
898
|
-
/**
|
|
899
|
-
* Constructs a new HKDFRescuePrime instance.
|
|
900
|
-
*/
|
|
901
|
-
constructor() {
|
|
902
|
-
this.hmac = new HMACRescuePrime();
|
|
903
|
-
}
|
|
904
|
-
/**
|
|
905
|
-
* HKDF-Extract step: derives a pseudorandom key (PRK) from the input keying material (IKM) and salt.
|
|
906
|
-
* @param salt - The salt value as an array of bigints.
|
|
907
|
-
* @param ikm - The input keying material as an array of bigints.
|
|
908
|
-
* @returns The pseudorandom key (PRK) as an array of bigints.
|
|
909
|
-
*/
|
|
910
|
-
extract(salt, ikm) {
|
|
911
|
-
if (salt.length === 0) {
|
|
912
|
-
// HashLen = hasher.rate for Rescue-Prime
|
|
913
|
-
for (let i = 0; i < this.hmac.hasher.rate; ++i) {
|
|
914
|
-
salt.push(0n);
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
return this.hmac.digest(salt, ikm);
|
|
918
|
-
}
|
|
919
|
-
/**
|
|
920
|
-
* HKDF-Expand step: expands the pseudorandom key (PRK) with info to produce output keying material (OKM).
|
|
921
|
-
* Only supports L = HashLen = 5, i.e. N = 1.
|
|
922
|
-
* @param prk - The pseudorandom key as an array of bigints.
|
|
923
|
-
* @param info - The context and application specific information as an array of bigints.
|
|
924
|
-
* @returns The output keying material (OKM) as an array of bigints.
|
|
925
|
-
*/
|
|
926
|
-
expand(prk, info) {
|
|
927
|
-
// we only support L = HashLen = 5, i.e. N = 1
|
|
928
|
-
// message = empty string | info | 0x01
|
|
929
|
-
info.push(1n);
|
|
930
|
-
return this.hmac.digest(prk, info);
|
|
931
|
-
}
|
|
932
|
-
/**
|
|
933
|
-
* Performs the full HKDF (extract and expand) to derive output keying material (OKM).
|
|
934
|
-
* @param salt - The salt value as an array of bigints.
|
|
935
|
-
* @param ikm - The input keying material as an array of bigints.
|
|
936
|
-
* @param info - The context and application specific information as an array of bigints.
|
|
937
|
-
* @returns The output keying material (OKM) as an array of bigints.
|
|
938
|
-
*/
|
|
939
|
-
okm(salt, ikm, info) {
|
|
940
|
-
const prk = this.extract(salt, ikm);
|
|
941
|
-
return this.expand(prk, info);
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
|
|
1019
|
+
const RESCUE_CIPHER_BLOCK_SIZE = 5;
|
|
945
1020
|
/**
|
|
946
1021
|
* The Rescue cipher in Counter (CTR) mode, with a fixed block size m = 5.
|
|
947
1022
|
* See: https://tosc.iacr.org/index.php/ToSC/article/view/8695/8287
|
|
@@ -950,12 +1025,21 @@ class RescueCipher {
|
|
|
950
1025
|
desc;
|
|
951
1026
|
/**
|
|
952
1027
|
* Constructs a RescueCipher instance using a shared secret.
|
|
953
|
-
* The key is derived using
|
|
1028
|
+
* The key is derived using RescuePrimeHash and used to initialize the RescueDesc.
|
|
954
1029
|
* @param sharedSecret - The shared secret to derive the cipher key from.
|
|
955
1030
|
*/
|
|
956
1031
|
constructor(sharedSecret) {
|
|
957
|
-
const
|
|
958
|
-
|
|
1032
|
+
const hasher = new RescuePrimeHash();
|
|
1033
|
+
// We follow [Section 4, Option 1.](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Cr2.pdf).
|
|
1034
|
+
// For our choice of hash function, we have:
|
|
1035
|
+
// - H_outputBits = hasher.digestLength = RESCUE_CIPHER_BLOCK_SIZE
|
|
1036
|
+
// - max_H_inputBits = arbitrarily long, as the Rescue-Prime hash function is built upon the
|
|
1037
|
+
// sponge construction
|
|
1038
|
+
// - L = RESCUE_CIPHER_BLOCK_SIZE.
|
|
1039
|
+
// Build the vector `counter || Z || FixedInfo` (we only have i = 1, since reps = 1).
|
|
1040
|
+
// For the FixedInfo we simply take L.
|
|
1041
|
+
const counter = [1n, deserializeLE(sharedSecret), BigInt(RESCUE_CIPHER_BLOCK_SIZE)];
|
|
1042
|
+
const rescueKey = hasher.digest(counter);
|
|
959
1043
|
this.desc = new RescueDesc(CURVE25519_BASE_FIELD, { kind: 'cipher', key: rescueKey });
|
|
960
1044
|
}
|
|
961
1045
|
/**
|
|
@@ -971,8 +1055,8 @@ class RescueCipher {
|
|
|
971
1055
|
}
|
|
972
1056
|
const binSize = getBinSize(this.desc.field.ORDER - 1n);
|
|
973
1057
|
function encryptBatch(desc, ptxt, cntr) {
|
|
974
|
-
if (cntr.length !==
|
|
975
|
-
throw Error(`counter must be of length
|
|
1058
|
+
if (cntr.length !== RESCUE_CIPHER_BLOCK_SIZE) {
|
|
1059
|
+
throw Error(`counter must be of length ${RESCUE_CIPHER_BLOCK_SIZE} (found ${cntr.length})`);
|
|
976
1060
|
}
|
|
977
1061
|
const encryptedCounter = desc.permute(new Matrix(desc.field, toVec(cntr)));
|
|
978
1062
|
const ciphertext = [];
|
|
@@ -985,12 +1069,12 @@ class RescueCipher {
|
|
|
985
1069
|
}
|
|
986
1070
|
return ciphertext;
|
|
987
1071
|
}
|
|
988
|
-
const nBlocks = Math.ceil(plaintext.length /
|
|
1072
|
+
const nBlocks = Math.ceil(plaintext.length / RESCUE_CIPHER_BLOCK_SIZE);
|
|
989
1073
|
const counter = getCounter(deserializeLE(nonce), nBlocks);
|
|
990
1074
|
const ciphertext = [];
|
|
991
1075
|
for (let i = 0; i < nBlocks; ++i) {
|
|
992
|
-
const cnt =
|
|
993
|
-
const newCiphertext = encryptBatch(this.desc, plaintext.slice(cnt, Math.min(cnt +
|
|
1076
|
+
const cnt = RESCUE_CIPHER_BLOCK_SIZE * i;
|
|
1077
|
+
const newCiphertext = encryptBatch(this.desc, plaintext.slice(cnt, Math.min(cnt + RESCUE_CIPHER_BLOCK_SIZE, plaintext.length)), counter.slice(cnt, cnt + RESCUE_CIPHER_BLOCK_SIZE));
|
|
994
1078
|
for (let j = 0; j < newCiphertext.length; ++j) {
|
|
995
1079
|
ciphertext.push(newCiphertext[j]);
|
|
996
1080
|
}
|
|
@@ -1019,8 +1103,8 @@ class RescueCipher {
|
|
|
1019
1103
|
}
|
|
1020
1104
|
const binSize = getBinSize(this.desc.field.ORDER - 1n);
|
|
1021
1105
|
function decryptBatch(desc, ctxt, cntr) {
|
|
1022
|
-
if (cntr.length !==
|
|
1023
|
-
throw Error(`counter must be of length
|
|
1106
|
+
if (cntr.length !== RESCUE_CIPHER_BLOCK_SIZE) {
|
|
1107
|
+
throw Error(`counter must be of length ${RESCUE_CIPHER_BLOCK_SIZE} (found ${cntr.length})`);
|
|
1024
1108
|
}
|
|
1025
1109
|
const encryptedCounter = desc.permute(new Matrix(desc.field, toVec(cntr)));
|
|
1026
1110
|
const decrypted = [];
|
|
@@ -1030,12 +1114,12 @@ class RescueCipher {
|
|
|
1030
1114
|
}
|
|
1031
1115
|
return decrypted;
|
|
1032
1116
|
}
|
|
1033
|
-
const nBlocks = Math.ceil(ciphertext.length /
|
|
1117
|
+
const nBlocks = Math.ceil(ciphertext.length / RESCUE_CIPHER_BLOCK_SIZE);
|
|
1034
1118
|
const counter = getCounter(deserializeLE(nonce), nBlocks);
|
|
1035
1119
|
const decrypted = [];
|
|
1036
1120
|
for (let i = 0; i < nBlocks; ++i) {
|
|
1037
|
-
const cnt =
|
|
1038
|
-
const newDecrypted = decryptBatch(this.desc, ciphertext.slice(cnt, Math.min(cnt +
|
|
1121
|
+
const cnt = RESCUE_CIPHER_BLOCK_SIZE * i;
|
|
1122
|
+
const newDecrypted = decryptBatch(this.desc, ciphertext.slice(cnt, Math.min(cnt + RESCUE_CIPHER_BLOCK_SIZE, ciphertext.length)), counter.slice(cnt, cnt + RESCUE_CIPHER_BLOCK_SIZE));
|
|
1039
1123
|
for (let j = 0; j < newDecrypted.length; ++j) {
|
|
1040
1124
|
decrypted.push(newDecrypted[j]);
|
|
1041
1125
|
}
|
|
@@ -1068,9 +1152,10 @@ function getCounter(nonce, nBlocks) {
|
|
|
1068
1152
|
for (let i = 0n; i < nBlocks; ++i) {
|
|
1069
1153
|
counter.push(nonce);
|
|
1070
1154
|
counter.push(i);
|
|
1071
|
-
counter
|
|
1072
|
-
|
|
1073
|
-
|
|
1155
|
+
// Pad to RESCUE_CIPHER_BLOCK_SIZE elements per counter block
|
|
1156
|
+
for (let j = 2; j < RESCUE_CIPHER_BLOCK_SIZE; ++j) {
|
|
1157
|
+
counter.push(0n);
|
|
1158
|
+
}
|
|
1074
1159
|
}
|
|
1075
1160
|
return counter;
|
|
1076
1161
|
}
|
|
@@ -1161,19 +1246,43 @@ function uvRatio(u, v) {
|
|
|
1161
1246
|
}
|
|
1162
1247
|
|
|
1163
1248
|
/**
|
|
1164
|
-
*
|
|
1249
|
+
* Mapping from key bits to key byte length.
|
|
1250
|
+
*/
|
|
1251
|
+
const KEY_BYTES = { 128: 16, 192: 24, 256: 32 };
|
|
1252
|
+
/**
|
|
1253
|
+
* Generic AES cipher in Counter (CTR) mode, using SHA3-256 to derive the key from a shared secret.
|
|
1165
1254
|
* See: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf (Section 6.5) for details on CTR mode.
|
|
1166
1255
|
*/
|
|
1167
|
-
class
|
|
1256
|
+
class AesCtrCipher {
|
|
1168
1257
|
key;
|
|
1258
|
+
keyBits;
|
|
1169
1259
|
/**
|
|
1170
|
-
* Constructs an AES
|
|
1171
|
-
* The key is derived using
|
|
1260
|
+
* Constructs an AES cipher instance using a shared secret.
|
|
1261
|
+
* The key is derived using SHA3-256.
|
|
1172
1262
|
* @param sharedSecret - The shared secret to derive the AES key from.
|
|
1263
|
+
* @param keyBits - The AES key size in bits (128, 192, or 256).
|
|
1173
1264
|
*/
|
|
1174
|
-
constructor(sharedSecret) {
|
|
1175
|
-
|
|
1176
|
-
|
|
1265
|
+
constructor(sharedSecret, keyBits) {
|
|
1266
|
+
this.keyBits = keyBits;
|
|
1267
|
+
const hasher = crypto.createHash('sha3-256');
|
|
1268
|
+
// We follow [Section 4, Option 1.](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Cr2.pdf).
|
|
1269
|
+
// For our choice of hash function, we have:
|
|
1270
|
+
// - H_outputBits = 256
|
|
1271
|
+
// - max_H_inputBits = arbitrarily long, as SHA3 is built upon the sponge
|
|
1272
|
+
// construction
|
|
1273
|
+
// - L = keyBits (128, 192, or 256).
|
|
1274
|
+
// Build the vector `counter || Z || FixedInfo` (we only have i = 1, since reps = 1).
|
|
1275
|
+
// the counter is a big-endian 4-byte unsigned integer
|
|
1276
|
+
const counter = [0, 0, 0, 1];
|
|
1277
|
+
for (let i = 0; i < sharedSecret.length; ++i) {
|
|
1278
|
+
counter.push(sharedSecret[i]);
|
|
1279
|
+
}
|
|
1280
|
+
// For the FixedInfo we simply take L. We represent L as a big-endian 2-byte
|
|
1281
|
+
// unsigned integer.
|
|
1282
|
+
counter.push(Math.floor(keyBits / 256));
|
|
1283
|
+
counter.push(keyBits % 256);
|
|
1284
|
+
hasher.update(new Uint8Array(counter));
|
|
1285
|
+
this.key = new Uint8Array(hasher.digest()).slice(0, KEY_BYTES[keyBits]);
|
|
1177
1286
|
}
|
|
1178
1287
|
/**
|
|
1179
1288
|
* Encrypts the plaintext array in Counter (CTR) mode.
|
|
@@ -1187,7 +1296,7 @@ class Aes128Cipher {
|
|
|
1187
1296
|
throw Error(`nonce must be of length 8 (found ${nonce.length})`);
|
|
1188
1297
|
}
|
|
1189
1298
|
const paddedNonce = Buffer.concat([nonce, Buffer.alloc(16 - nonce.length, 0)]);
|
|
1190
|
-
const cipher = crypto.createCipheriv(
|
|
1299
|
+
const cipher = crypto.createCipheriv(`aes-${this.keyBits}-ctr`, this.key, paddedNonce);
|
|
1191
1300
|
const ciphertext = Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
1192
1301
|
return new Uint8Array(ciphertext);
|
|
1193
1302
|
}
|
|
@@ -1203,114 +1312,61 @@ class Aes128Cipher {
|
|
|
1203
1312
|
throw Error(`nonce must be of length 8 (found ${nonce.length})`);
|
|
1204
1313
|
}
|
|
1205
1314
|
const paddedNonce = Buffer.concat([nonce, Buffer.alloc(16 - nonce.length, 0)]);
|
|
1206
|
-
const cipher = crypto.createDecipheriv(
|
|
1315
|
+
const cipher = crypto.createDecipheriv(`aes-${this.keyBits}-ctr`, this.key, paddedNonce);
|
|
1207
1316
|
const decrypted = Buffer.concat([cipher.update(ciphertext), cipher.final()]);
|
|
1208
1317
|
return new Uint8Array(decrypted);
|
|
1209
1318
|
}
|
|
1210
1319
|
}
|
|
1211
1320
|
|
|
1212
1321
|
/**
|
|
1213
|
-
* AES-
|
|
1322
|
+
* AES-128 cipher in Counter (CTR) mode, using SHA3-256 to derive the key from a shared secret.
|
|
1214
1323
|
* See: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf (Section 6.5) for details on CTR mode.
|
|
1215
1324
|
*/
|
|
1216
|
-
class
|
|
1217
|
-
key;
|
|
1325
|
+
class Aes128Cipher extends AesCtrCipher {
|
|
1218
1326
|
/**
|
|
1219
|
-
* Constructs an AES-
|
|
1220
|
-
* The key is derived using
|
|
1327
|
+
* Constructs an AES-128 cipher instance using a shared secret.
|
|
1328
|
+
* The key is derived using SHA3-256.
|
|
1221
1329
|
* @param sharedSecret - The shared secret to derive the AES key from.
|
|
1222
1330
|
*/
|
|
1223
1331
|
constructor(sharedSecret) {
|
|
1224
|
-
|
|
1225
|
-
this.key = new Uint8Array(aesKey);
|
|
1226
|
-
}
|
|
1227
|
-
/**
|
|
1228
|
-
* Encrypts the plaintext array in Counter (CTR) mode.
|
|
1229
|
-
* @param plaintext - The data to encrypt.
|
|
1230
|
-
* @param nonce - An 8-byte nonce for CTR mode.
|
|
1231
|
-
* @returns The encrypted ciphertext as a Uint8Array.
|
|
1232
|
-
* @throws Error if the nonce is not 8 bytes long.
|
|
1233
|
-
*/
|
|
1234
|
-
encrypt(plaintext, nonce) {
|
|
1235
|
-
if (nonce.length !== 8) {
|
|
1236
|
-
throw Error(`nonce must be of length 8 (found ${nonce.length})`);
|
|
1237
|
-
}
|
|
1238
|
-
const paddedNonce = Buffer.concat([nonce, Buffer.alloc(16 - nonce.length, 0)]);
|
|
1239
|
-
const cipher = crypto.createCipheriv('aes-192-ctr', this.key, paddedNonce);
|
|
1240
|
-
const ciphertext = Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
1241
|
-
return new Uint8Array(ciphertext);
|
|
1332
|
+
super(sharedSecret, 128);
|
|
1242
1333
|
}
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* AES-192 cipher in Counter (CTR) mode, using SHA3-256 to derive the key from a shared secret.
|
|
1338
|
+
* See: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf (Section 6.5) for details on CTR mode.
|
|
1339
|
+
*/
|
|
1340
|
+
class Aes192Cipher extends AesCtrCipher {
|
|
1243
1341
|
/**
|
|
1244
|
-
*
|
|
1245
|
-
*
|
|
1246
|
-
* @param
|
|
1247
|
-
* @returns The decrypted plaintext as a Uint8Array.
|
|
1248
|
-
* @throws Error if the nonce is not 8 bytes long.
|
|
1342
|
+
* Constructs an AES-192 cipher instance using a shared secret.
|
|
1343
|
+
* The key is derived using SHA3-256.
|
|
1344
|
+
* @param sharedSecret - The shared secret to derive the AES key from.
|
|
1249
1345
|
*/
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
throw Error(`nonce must be of length 8 (found ${nonce.length})`);
|
|
1253
|
-
}
|
|
1254
|
-
const paddedNonce = Buffer.concat([nonce, Buffer.alloc(16 - nonce.length, 0)]);
|
|
1255
|
-
const cipher = crypto.createDecipheriv('aes-192-ctr', this.key, paddedNonce);
|
|
1256
|
-
const decrypted = Buffer.concat([cipher.update(ciphertext), cipher.final()]);
|
|
1257
|
-
return new Uint8Array(decrypted);
|
|
1346
|
+
constructor(sharedSecret) {
|
|
1347
|
+
super(sharedSecret, 192);
|
|
1258
1348
|
}
|
|
1259
1349
|
}
|
|
1260
1350
|
|
|
1261
1351
|
/**
|
|
1262
|
-
* AES-256 cipher in Counter (CTR) mode, using
|
|
1352
|
+
* AES-256 cipher in Counter (CTR) mode, using SHA3-256 to derive the key from a shared secret.
|
|
1263
1353
|
* See: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf (Section 6.5) for details on CTR mode.
|
|
1264
1354
|
*/
|
|
1265
|
-
class Aes256Cipher {
|
|
1266
|
-
key;
|
|
1355
|
+
class Aes256Cipher extends AesCtrCipher {
|
|
1267
1356
|
/**
|
|
1268
1357
|
* Constructs an AES-256 cipher instance using a shared secret.
|
|
1269
|
-
* The key is derived using
|
|
1358
|
+
* The key is derived using SHA3-256.
|
|
1270
1359
|
* @param sharedSecret - The shared secret to derive the AES key from.
|
|
1271
1360
|
*/
|
|
1272
1361
|
constructor(sharedSecret) {
|
|
1273
|
-
|
|
1274
|
-
this.key = new Uint8Array(aesKey);
|
|
1275
|
-
}
|
|
1276
|
-
/**
|
|
1277
|
-
* Encrypts the plaintext array in Counter (CTR) mode.
|
|
1278
|
-
* @param plaintext - The data to encrypt.
|
|
1279
|
-
* @param nonce - An 8-byte nonce for CTR mode.
|
|
1280
|
-
* @returns The encrypted ciphertext as a Uint8Array.
|
|
1281
|
-
* @throws Error if the nonce is not 8 bytes long.
|
|
1282
|
-
*/
|
|
1283
|
-
encrypt(plaintext, nonce) {
|
|
1284
|
-
if (nonce.length !== 8) {
|
|
1285
|
-
throw Error(`nonce must be of length 8 (found ${nonce.length})`);
|
|
1286
|
-
}
|
|
1287
|
-
const paddedNonce = Buffer.concat([nonce, Buffer.alloc(16 - nonce.length, 0)]);
|
|
1288
|
-
const cipher = crypto.createCipheriv('aes-256-ctr', this.key, paddedNonce);
|
|
1289
|
-
const ciphertext = Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
1290
|
-
return new Uint8Array(ciphertext);
|
|
1291
|
-
}
|
|
1292
|
-
/**
|
|
1293
|
-
* Decrypts the ciphertext array in Counter (CTR) mode.
|
|
1294
|
-
* @param ciphertext - The data to decrypt.
|
|
1295
|
-
* @param nonce - An 8-byte nonce for CTR mode.
|
|
1296
|
-
* @returns The decrypted plaintext as a Uint8Array.
|
|
1297
|
-
* @throws Error if the nonce is not 8 bytes long.
|
|
1298
|
-
*/
|
|
1299
|
-
decrypt(ciphertext, nonce) {
|
|
1300
|
-
if (nonce.length !== 8) {
|
|
1301
|
-
throw Error(`nonce must be of length 8 (found ${nonce.length})`);
|
|
1302
|
-
}
|
|
1303
|
-
const paddedNonce = Buffer.concat([nonce, Buffer.alloc(16 - nonce.length, 0)]);
|
|
1304
|
-
const cipher = crypto.createDecipheriv('aes-256-ctr', this.key, paddedNonce);
|
|
1305
|
-
const decrypted = Buffer.concat([cipher.update(ciphertext), cipher.final()]);
|
|
1306
|
-
return new Uint8Array(decrypted);
|
|
1362
|
+
super(sharedSecret, 256);
|
|
1307
1363
|
}
|
|
1308
1364
|
}
|
|
1309
1365
|
|
|
1310
1366
|
var address = "Bv3Fb9VjzjWGfX18QTUcVycAfeLoQ5zZN6vv2g3cTZxp";
|
|
1311
1367
|
var metadata = {
|
|
1312
1368
|
name: "arcium",
|
|
1313
|
-
version: "0.
|
|
1369
|
+
version: "0.5.0",
|
|
1314
1370
|
spec: "0.1.0",
|
|
1315
1371
|
description: "The Arcium program"
|
|
1316
1372
|
};
|
|
@@ -1663,8 +1719,9 @@ var instructions = [
|
|
|
1663
1719
|
]
|
|
1664
1720
|
},
|
|
1665
1721
|
{
|
|
1666
|
-
kind: "
|
|
1667
|
-
path: "
|
|
1722
|
+
kind: "account",
|
|
1723
|
+
path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
|
|
1724
|
+
account: "MXEAccount"
|
|
1668
1725
|
},
|
|
1669
1726
|
{
|
|
1670
1727
|
kind: "arg",
|
|
@@ -1691,8 +1748,9 @@ var instructions = [
|
|
|
1691
1748
|
]
|
|
1692
1749
|
},
|
|
1693
1750
|
{
|
|
1694
|
-
kind: "
|
|
1695
|
-
path: "
|
|
1751
|
+
kind: "account",
|
|
1752
|
+
path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
|
|
1753
|
+
account: "MXEAccount"
|
|
1696
1754
|
}
|
|
1697
1755
|
]
|
|
1698
1756
|
}
|
|
@@ -1716,8 +1774,9 @@ var instructions = [
|
|
|
1716
1774
|
]
|
|
1717
1775
|
},
|
|
1718
1776
|
{
|
|
1719
|
-
kind: "
|
|
1720
|
-
path: "
|
|
1777
|
+
kind: "account",
|
|
1778
|
+
path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
|
|
1779
|
+
account: "MXEAccount"
|
|
1721
1780
|
}
|
|
1722
1781
|
]
|
|
1723
1782
|
}
|
|
@@ -1811,16 +1870,16 @@ var instructions = [
|
|
|
1811
1870
|
]
|
|
1812
1871
|
},
|
|
1813
1872
|
{
|
|
1814
|
-
name: "
|
|
1873
|
+
name: "claim_computation_rent",
|
|
1815
1874
|
discriminator: [
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1875
|
+
215,
|
|
1876
|
+
218,
|
|
1877
|
+
1,
|
|
1878
|
+
166,
|
|
1879
|
+
81,
|
|
1880
|
+
218,
|
|
1881
|
+
16,
|
|
1882
|
+
151
|
|
1824
1883
|
],
|
|
1825
1884
|
accounts: [
|
|
1826
1885
|
{
|
|
@@ -1829,38 +1888,111 @@ var instructions = [
|
|
|
1829
1888
|
signer: true
|
|
1830
1889
|
},
|
|
1831
1890
|
{
|
|
1832
|
-
name: "
|
|
1891
|
+
name: "comp",
|
|
1833
1892
|
writable: true,
|
|
1834
1893
|
pda: {
|
|
1835
1894
|
seeds: [
|
|
1836
1895
|
{
|
|
1837
1896
|
kind: "const",
|
|
1838
1897
|
value: [
|
|
1839
|
-
70,
|
|
1840
|
-
97,
|
|
1841
|
-
105,
|
|
1842
|
-
108,
|
|
1843
|
-
117,
|
|
1844
|
-
114,
|
|
1845
|
-
101,
|
|
1846
1898
|
67,
|
|
1847
|
-
|
|
1899
|
+
111,
|
|
1900
|
+
109,
|
|
1901
|
+
112,
|
|
1902
|
+
117,
|
|
1903
|
+
116,
|
|
1848
1904
|
97,
|
|
1905
|
+
116,
|
|
1849
1906
|
105,
|
|
1850
|
-
|
|
1907
|
+
111,
|
|
1908
|
+
110,
|
|
1851
1909
|
65,
|
|
1852
1910
|
99,
|
|
1853
1911
|
99,
|
|
1854
1912
|
111,
|
|
1855
1913
|
117,
|
|
1856
1914
|
110,
|
|
1857
|
-
116
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1915
|
+
116
|
|
1916
|
+
]
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
kind: "arg",
|
|
1920
|
+
path: "_cluster_offset"
|
|
1921
|
+
},
|
|
1922
|
+
{
|
|
1923
|
+
kind: "arg",
|
|
1924
|
+
path: "_comp_offset"
|
|
1925
|
+
}
|
|
1926
|
+
]
|
|
1927
|
+
}
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
name: "system_program",
|
|
1931
|
+
address: "11111111111111111111111111111111"
|
|
1932
|
+
}
|
|
1933
|
+
],
|
|
1934
|
+
args: [
|
|
1935
|
+
{
|
|
1936
|
+
name: "comp_offset",
|
|
1937
|
+
type: "u64"
|
|
1938
|
+
},
|
|
1939
|
+
{
|
|
1940
|
+
name: "cluster_offset",
|
|
1941
|
+
type: "u32"
|
|
1942
|
+
}
|
|
1943
|
+
]
|
|
1944
|
+
},
|
|
1945
|
+
{
|
|
1946
|
+
name: "claim_failure_append",
|
|
1947
|
+
discriminator: [
|
|
1948
|
+
92,
|
|
1949
|
+
52,
|
|
1950
|
+
184,
|
|
1951
|
+
203,
|
|
1952
|
+
76,
|
|
1953
|
+
221,
|
|
1954
|
+
128,
|
|
1955
|
+
69
|
|
1956
|
+
],
|
|
1957
|
+
accounts: [
|
|
1958
|
+
{
|
|
1959
|
+
name: "signer",
|
|
1960
|
+
writable: true,
|
|
1961
|
+
signer: true
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
name: "failure_acc",
|
|
1965
|
+
writable: true,
|
|
1966
|
+
pda: {
|
|
1967
|
+
seeds: [
|
|
1968
|
+
{
|
|
1969
|
+
kind: "const",
|
|
1970
|
+
value: [
|
|
1971
|
+
70,
|
|
1972
|
+
97,
|
|
1973
|
+
105,
|
|
1974
|
+
108,
|
|
1975
|
+
117,
|
|
1976
|
+
114,
|
|
1977
|
+
101,
|
|
1978
|
+
67,
|
|
1979
|
+
108,
|
|
1980
|
+
97,
|
|
1981
|
+
105,
|
|
1982
|
+
109,
|
|
1983
|
+
65,
|
|
1984
|
+
99,
|
|
1985
|
+
99,
|
|
1986
|
+
111,
|
|
1987
|
+
117,
|
|
1988
|
+
110,
|
|
1989
|
+
116,
|
|
1990
|
+
72,
|
|
1991
|
+
101,
|
|
1992
|
+
97,
|
|
1993
|
+
100,
|
|
1994
|
+
101,
|
|
1995
|
+
114
|
|
1864
1996
|
]
|
|
1865
1997
|
},
|
|
1866
1998
|
{
|
|
@@ -1984,8 +2116,9 @@ var instructions = [
|
|
|
1984
2116
|
]
|
|
1985
2117
|
},
|
|
1986
2118
|
{
|
|
1987
|
-
kind: "
|
|
1988
|
-
path: "
|
|
2119
|
+
kind: "account",
|
|
2120
|
+
path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
|
|
2121
|
+
account: "MXEAccount"
|
|
1989
2122
|
}
|
|
1990
2123
|
]
|
|
1991
2124
|
}
|
|
@@ -2008,8 +2141,9 @@ var instructions = [
|
|
|
2008
2141
|
]
|
|
2009
2142
|
},
|
|
2010
2143
|
{
|
|
2011
|
-
kind: "
|
|
2012
|
-
path: "
|
|
2144
|
+
kind: "account",
|
|
2145
|
+
path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
|
|
2146
|
+
account: "MXEAccount"
|
|
2013
2147
|
}
|
|
2014
2148
|
]
|
|
2015
2149
|
}
|
|
@@ -2043,8 +2177,9 @@ var instructions = [
|
|
|
2043
2177
|
]
|
|
2044
2178
|
},
|
|
2045
2179
|
{
|
|
2046
|
-
kind: "
|
|
2047
|
-
path: "
|
|
2180
|
+
kind: "account",
|
|
2181
|
+
path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
|
|
2182
|
+
account: "MXEAccount"
|
|
2048
2183
|
},
|
|
2049
2184
|
{
|
|
2050
2185
|
kind: "arg",
|
|
@@ -2240,8 +2375,9 @@ var instructions = [
|
|
|
2240
2375
|
]
|
|
2241
2376
|
},
|
|
2242
2377
|
{
|
|
2243
|
-
kind: "
|
|
2244
|
-
path: "
|
|
2378
|
+
kind: "account",
|
|
2379
|
+
path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
|
|
2380
|
+
account: "MXEAccount"
|
|
2245
2381
|
},
|
|
2246
2382
|
{
|
|
2247
2383
|
kind: "arg",
|
|
@@ -2432,7 +2568,7 @@ var instructions = [
|
|
|
2432
2568
|
}
|
|
2433
2569
|
},
|
|
2434
2570
|
{
|
|
2435
|
-
name: "
|
|
2571
|
+
name: "cluster_acc",
|
|
2436
2572
|
optional: true,
|
|
2437
2573
|
pda: {
|
|
2438
2574
|
seeds: [
|
|
@@ -2450,15 +2586,40 @@ var instructions = [
|
|
|
2450
2586
|
},
|
|
2451
2587
|
{
|
|
2452
2588
|
kind: "account",
|
|
2453
|
-
path: "arx_node_acc
|
|
2454
|
-
account: "ArxNode"
|
|
2589
|
+
path: "arx_node_acc"
|
|
2455
2590
|
}
|
|
2456
2591
|
]
|
|
2457
2592
|
}
|
|
2593
|
+
}
|
|
2594
|
+
],
|
|
2595
|
+
args: [
|
|
2596
|
+
{
|
|
2597
|
+
name: "node_offset",
|
|
2598
|
+
type: "u32"
|
|
2599
|
+
}
|
|
2600
|
+
]
|
|
2601
|
+
},
|
|
2602
|
+
{
|
|
2603
|
+
name: "deactivate_cluster",
|
|
2604
|
+
discriminator: [
|
|
2605
|
+
13,
|
|
2606
|
+
42,
|
|
2607
|
+
182,
|
|
2608
|
+
159,
|
|
2609
|
+
184,
|
|
2610
|
+
10,
|
|
2611
|
+
212,
|
|
2612
|
+
178
|
|
2613
|
+
],
|
|
2614
|
+
accounts: [
|
|
2615
|
+
{
|
|
2616
|
+
name: "authority",
|
|
2617
|
+
writable: true,
|
|
2618
|
+
signer: true
|
|
2458
2619
|
},
|
|
2459
2620
|
{
|
|
2460
|
-
name: "
|
|
2461
|
-
|
|
2621
|
+
name: "cluster_acc",
|
|
2622
|
+
writable: true,
|
|
2462
2623
|
pda: {
|
|
2463
2624
|
seeds: [
|
|
2464
2625
|
{
|
|
@@ -2474,16 +2635,14 @@ var instructions = [
|
|
|
2474
2635
|
]
|
|
2475
2636
|
},
|
|
2476
2637
|
{
|
|
2477
|
-
kind: "
|
|
2478
|
-
path: "
|
|
2479
|
-
account: "ArxNode"
|
|
2638
|
+
kind: "arg",
|
|
2639
|
+
path: "_id"
|
|
2480
2640
|
}
|
|
2481
2641
|
]
|
|
2482
2642
|
}
|
|
2483
2643
|
},
|
|
2484
2644
|
{
|
|
2485
|
-
name: "
|
|
2486
|
-
optional: true,
|
|
2645
|
+
name: "clock",
|
|
2487
2646
|
pda: {
|
|
2488
2647
|
seeds: [
|
|
2489
2648
|
{
|
|
@@ -2491,355 +2650,106 @@ var instructions = [
|
|
|
2491
2650
|
value: [
|
|
2492
2651
|
67,
|
|
2493
2652
|
108,
|
|
2653
|
+
111,
|
|
2654
|
+
99,
|
|
2655
|
+
107,
|
|
2656
|
+
65,
|
|
2657
|
+
99,
|
|
2658
|
+
99,
|
|
2659
|
+
111,
|
|
2494
2660
|
117,
|
|
2495
|
-
|
|
2496
|
-
116
|
|
2497
|
-
101,
|
|
2498
|
-
114
|
|
2661
|
+
110,
|
|
2662
|
+
116
|
|
2499
2663
|
]
|
|
2500
|
-
},
|
|
2501
|
-
{
|
|
2502
|
-
kind: "account",
|
|
2503
|
-
path: "arx_node_acc.cluster_memberships.get(2).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
|
|
2504
|
-
account: "ArxNode"
|
|
2505
2664
|
}
|
|
2506
2665
|
]
|
|
2507
2666
|
}
|
|
2508
2667
|
},
|
|
2509
2668
|
{
|
|
2510
|
-
name: "
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
},
|
|
2526
|
-
{
|
|
2527
|
-
kind: "account",
|
|
2528
|
-
path: "arx_node_acc.cluster_memberships.get(3).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
|
|
2529
|
-
account: "ArxNode"
|
|
2530
|
-
}
|
|
2531
|
-
]
|
|
2669
|
+
name: "system_program",
|
|
2670
|
+
address: "11111111111111111111111111111111"
|
|
2671
|
+
}
|
|
2672
|
+
],
|
|
2673
|
+
args: [
|
|
2674
|
+
{
|
|
2675
|
+
name: "cluster_id",
|
|
2676
|
+
type: "u32"
|
|
2677
|
+
},
|
|
2678
|
+
{
|
|
2679
|
+
name: "deactivation_epoch",
|
|
2680
|
+
type: {
|
|
2681
|
+
defined: {
|
|
2682
|
+
name: "Epoch"
|
|
2683
|
+
}
|
|
2532
2684
|
}
|
|
2685
|
+
}
|
|
2686
|
+
]
|
|
2687
|
+
},
|
|
2688
|
+
{
|
|
2689
|
+
name: "dummy_instruction",
|
|
2690
|
+
docs: [
|
|
2691
|
+
"Only present so the mempool and execpool accounts are actually included in the idl, since we",
|
|
2692
|
+
"don't explicitly declare them in the accounts section of the other instructions."
|
|
2693
|
+
],
|
|
2694
|
+
discriminator: [
|
|
2695
|
+
57,
|
|
2696
|
+
4,
|
|
2697
|
+
200,
|
|
2698
|
+
151,
|
|
2699
|
+
58,
|
|
2700
|
+
19,
|
|
2701
|
+
120,
|
|
2702
|
+
9
|
|
2703
|
+
],
|
|
2704
|
+
accounts: [
|
|
2705
|
+
{
|
|
2706
|
+
name: "tiny_mempool"
|
|
2533
2707
|
},
|
|
2534
2708
|
{
|
|
2535
|
-
name: "
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
account: "ArxNode"
|
|
2580
|
-
}
|
|
2581
|
-
]
|
|
2582
|
-
}
|
|
2583
|
-
},
|
|
2584
|
-
{
|
|
2585
|
-
name: "cluster_acc_6",
|
|
2586
|
-
optional: true,
|
|
2587
|
-
pda: {
|
|
2588
|
-
seeds: [
|
|
2589
|
-
{
|
|
2590
|
-
kind: "const",
|
|
2591
|
-
value: [
|
|
2592
|
-
67,
|
|
2593
|
-
108,
|
|
2594
|
-
117,
|
|
2595
|
-
115,
|
|
2596
|
-
116,
|
|
2597
|
-
101,
|
|
2598
|
-
114
|
|
2599
|
-
]
|
|
2600
|
-
},
|
|
2601
|
-
{
|
|
2602
|
-
kind: "account",
|
|
2603
|
-
path: "arx_node_acc.cluster_memberships.get(6).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
|
|
2604
|
-
account: "ArxNode"
|
|
2605
|
-
}
|
|
2606
|
-
]
|
|
2607
|
-
}
|
|
2608
|
-
},
|
|
2609
|
-
{
|
|
2610
|
-
name: "cluster_acc_7",
|
|
2611
|
-
optional: true,
|
|
2612
|
-
pda: {
|
|
2613
|
-
seeds: [
|
|
2614
|
-
{
|
|
2615
|
-
kind: "const",
|
|
2616
|
-
value: [
|
|
2617
|
-
67,
|
|
2618
|
-
108,
|
|
2619
|
-
117,
|
|
2620
|
-
115,
|
|
2621
|
-
116,
|
|
2622
|
-
101,
|
|
2623
|
-
114
|
|
2624
|
-
]
|
|
2625
|
-
},
|
|
2626
|
-
{
|
|
2627
|
-
kind: "account",
|
|
2628
|
-
path: "arx_node_acc.cluster_memberships.get(7).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
|
|
2629
|
-
account: "ArxNode"
|
|
2630
|
-
}
|
|
2631
|
-
]
|
|
2632
|
-
}
|
|
2633
|
-
},
|
|
2634
|
-
{
|
|
2635
|
-
name: "cluster_acc_8",
|
|
2636
|
-
optional: true,
|
|
2637
|
-
pda: {
|
|
2638
|
-
seeds: [
|
|
2639
|
-
{
|
|
2640
|
-
kind: "const",
|
|
2641
|
-
value: [
|
|
2642
|
-
67,
|
|
2643
|
-
108,
|
|
2644
|
-
117,
|
|
2645
|
-
115,
|
|
2646
|
-
116,
|
|
2647
|
-
101,
|
|
2648
|
-
114
|
|
2649
|
-
]
|
|
2650
|
-
},
|
|
2651
|
-
{
|
|
2652
|
-
kind: "account",
|
|
2653
|
-
path: "arx_node_acc.cluster_memberships.get(8).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
|
|
2654
|
-
account: "ArxNode"
|
|
2655
|
-
}
|
|
2656
|
-
]
|
|
2657
|
-
}
|
|
2658
|
-
},
|
|
2659
|
-
{
|
|
2660
|
-
name: "cluster_acc_9",
|
|
2661
|
-
optional: true,
|
|
2662
|
-
pda: {
|
|
2663
|
-
seeds: [
|
|
2664
|
-
{
|
|
2665
|
-
kind: "const",
|
|
2666
|
-
value: [
|
|
2667
|
-
67,
|
|
2668
|
-
108,
|
|
2669
|
-
117,
|
|
2670
|
-
115,
|
|
2671
|
-
116,
|
|
2672
|
-
101,
|
|
2673
|
-
114
|
|
2674
|
-
]
|
|
2675
|
-
},
|
|
2676
|
-
{
|
|
2677
|
-
kind: "account",
|
|
2678
|
-
path: "arx_node_acc.cluster_memberships.get(9).ok_or(ArciumError ::\nInvalidClusterMembership) ? ",
|
|
2679
|
-
account: "ArxNode"
|
|
2680
|
-
}
|
|
2681
|
-
]
|
|
2682
|
-
}
|
|
2683
|
-
}
|
|
2684
|
-
],
|
|
2685
|
-
args: [
|
|
2686
|
-
{
|
|
2687
|
-
name: "node_offset",
|
|
2688
|
-
type: "u32"
|
|
2689
|
-
}
|
|
2690
|
-
]
|
|
2691
|
-
},
|
|
2692
|
-
{
|
|
2693
|
-
name: "deactivate_cluster",
|
|
2694
|
-
discriminator: [
|
|
2695
|
-
13,
|
|
2696
|
-
42,
|
|
2697
|
-
182,
|
|
2698
|
-
159,
|
|
2699
|
-
184,
|
|
2700
|
-
10,
|
|
2701
|
-
212,
|
|
2702
|
-
178
|
|
2703
|
-
],
|
|
2704
|
-
accounts: [
|
|
2705
|
-
{
|
|
2706
|
-
name: "authority",
|
|
2707
|
-
writable: true,
|
|
2708
|
-
signer: true
|
|
2709
|
-
},
|
|
2710
|
-
{
|
|
2711
|
-
name: "cluster_acc",
|
|
2712
|
-
writable: true,
|
|
2713
|
-
pda: {
|
|
2714
|
-
seeds: [
|
|
2715
|
-
{
|
|
2716
|
-
kind: "const",
|
|
2717
|
-
value: [
|
|
2718
|
-
67,
|
|
2719
|
-
108,
|
|
2720
|
-
117,
|
|
2721
|
-
115,
|
|
2722
|
-
116,
|
|
2723
|
-
101,
|
|
2724
|
-
114
|
|
2725
|
-
]
|
|
2726
|
-
},
|
|
2727
|
-
{
|
|
2728
|
-
kind: "arg",
|
|
2729
|
-
path: "_id"
|
|
2730
|
-
}
|
|
2731
|
-
]
|
|
2732
|
-
}
|
|
2733
|
-
},
|
|
2734
|
-
{
|
|
2735
|
-
name: "clock",
|
|
2736
|
-
pda: {
|
|
2737
|
-
seeds: [
|
|
2738
|
-
{
|
|
2739
|
-
kind: "const",
|
|
2740
|
-
value: [
|
|
2741
|
-
67,
|
|
2742
|
-
108,
|
|
2743
|
-
111,
|
|
2744
|
-
99,
|
|
2745
|
-
107,
|
|
2746
|
-
65,
|
|
2747
|
-
99,
|
|
2748
|
-
99,
|
|
2749
|
-
111,
|
|
2750
|
-
117,
|
|
2751
|
-
110,
|
|
2752
|
-
116
|
|
2753
|
-
]
|
|
2754
|
-
}
|
|
2755
|
-
]
|
|
2756
|
-
}
|
|
2757
|
-
},
|
|
2758
|
-
{
|
|
2759
|
-
name: "system_program",
|
|
2760
|
-
address: "11111111111111111111111111111111"
|
|
2761
|
-
}
|
|
2762
|
-
],
|
|
2763
|
-
args: [
|
|
2764
|
-
{
|
|
2765
|
-
name: "cluster_id",
|
|
2766
|
-
type: "u32"
|
|
2767
|
-
},
|
|
2768
|
-
{
|
|
2769
|
-
name: "deactivation_epoch",
|
|
2770
|
-
type: {
|
|
2771
|
-
defined: {
|
|
2772
|
-
name: "Epoch"
|
|
2773
|
-
}
|
|
2774
|
-
}
|
|
2775
|
-
}
|
|
2776
|
-
]
|
|
2777
|
-
},
|
|
2778
|
-
{
|
|
2779
|
-
name: "dummy_instruction",
|
|
2780
|
-
docs: [
|
|
2781
|
-
"Only present so the mempool and execpool accounts are actually included in the idl, since we",
|
|
2782
|
-
"don't explicitly declare them in the accounts section of the other instructions."
|
|
2783
|
-
],
|
|
2784
|
-
discriminator: [
|
|
2785
|
-
57,
|
|
2786
|
-
4,
|
|
2787
|
-
200,
|
|
2788
|
-
151,
|
|
2789
|
-
58,
|
|
2790
|
-
19,
|
|
2791
|
-
120,
|
|
2792
|
-
9
|
|
2793
|
-
],
|
|
2794
|
-
accounts: [
|
|
2795
|
-
{
|
|
2796
|
-
name: "tiny_mempool"
|
|
2797
|
-
},
|
|
2798
|
-
{
|
|
2799
|
-
name: "tiny_execpool"
|
|
2800
|
-
},
|
|
2801
|
-
{
|
|
2802
|
-
name: "small_mempool"
|
|
2803
|
-
},
|
|
2804
|
-
{
|
|
2805
|
-
name: "small_execpool"
|
|
2806
|
-
},
|
|
2807
|
-
{
|
|
2808
|
-
name: "medium_mempool"
|
|
2809
|
-
},
|
|
2810
|
-
{
|
|
2811
|
-
name: "medium_execpool"
|
|
2812
|
-
},
|
|
2813
|
-
{
|
|
2814
|
-
name: "large_mempool"
|
|
2815
|
-
},
|
|
2816
|
-
{
|
|
2817
|
-
name: "large_execpool"
|
|
2818
|
-
}
|
|
2819
|
-
],
|
|
2820
|
-
args: [
|
|
2821
|
-
]
|
|
2822
|
-
},
|
|
2823
|
-
{
|
|
2824
|
-
name: "embiggen_raw_circuit_acc",
|
|
2825
|
-
discriminator: [
|
|
2826
|
-
92,
|
|
2827
|
-
195,
|
|
2828
|
-
192,
|
|
2829
|
-
21,
|
|
2830
|
-
193,
|
|
2831
|
-
242,
|
|
2832
|
-
135,
|
|
2833
|
-
194
|
|
2834
|
-
],
|
|
2835
|
-
accounts: [
|
|
2836
|
-
{
|
|
2837
|
-
name: "signer",
|
|
2838
|
-
writable: true,
|
|
2839
|
-
signer: true
|
|
2840
|
-
},
|
|
2841
|
-
{
|
|
2842
|
-
name: "comp_def_acc",
|
|
2709
|
+
name: "tiny_execpool"
|
|
2710
|
+
},
|
|
2711
|
+
{
|
|
2712
|
+
name: "small_mempool"
|
|
2713
|
+
},
|
|
2714
|
+
{
|
|
2715
|
+
name: "small_execpool"
|
|
2716
|
+
},
|
|
2717
|
+
{
|
|
2718
|
+
name: "medium_mempool"
|
|
2719
|
+
},
|
|
2720
|
+
{
|
|
2721
|
+
name: "medium_execpool"
|
|
2722
|
+
},
|
|
2723
|
+
{
|
|
2724
|
+
name: "large_mempool"
|
|
2725
|
+
},
|
|
2726
|
+
{
|
|
2727
|
+
name: "large_execpool"
|
|
2728
|
+
}
|
|
2729
|
+
],
|
|
2730
|
+
args: [
|
|
2731
|
+
]
|
|
2732
|
+
},
|
|
2733
|
+
{
|
|
2734
|
+
name: "embiggen_raw_circuit_acc",
|
|
2735
|
+
discriminator: [
|
|
2736
|
+
92,
|
|
2737
|
+
195,
|
|
2738
|
+
192,
|
|
2739
|
+
21,
|
|
2740
|
+
193,
|
|
2741
|
+
242,
|
|
2742
|
+
135,
|
|
2743
|
+
194
|
|
2744
|
+
],
|
|
2745
|
+
accounts: [
|
|
2746
|
+
{
|
|
2747
|
+
name: "signer",
|
|
2748
|
+
writable: true,
|
|
2749
|
+
signer: true
|
|
2750
|
+
},
|
|
2751
|
+
{
|
|
2752
|
+
name: "comp_def_acc",
|
|
2843
2753
|
pda: {
|
|
2844
2754
|
seeds: [
|
|
2845
2755
|
{
|
|
@@ -3148,21 +3058,22 @@ var instructions = [
|
|
|
3148
3058
|
]
|
|
3149
3059
|
},
|
|
3150
3060
|
{
|
|
3151
|
-
kind: "
|
|
3152
|
-
path: "
|
|
3061
|
+
kind: "arg",
|
|
3062
|
+
path: "_cluster_offset"
|
|
3153
3063
|
}
|
|
3154
3064
|
]
|
|
3155
3065
|
}
|
|
3156
3066
|
},
|
|
3157
|
-
{
|
|
3158
|
-
name: "mxe_program"
|
|
3159
|
-
},
|
|
3160
3067
|
{
|
|
3161
3068
|
name: "system_program",
|
|
3162
3069
|
address: "11111111111111111111111111111111"
|
|
3163
3070
|
}
|
|
3164
3071
|
],
|
|
3165
3072
|
args: [
|
|
3073
|
+
{
|
|
3074
|
+
name: "cluster_offset",
|
|
3075
|
+
type: "u32"
|
|
3076
|
+
}
|
|
3166
3077
|
]
|
|
3167
3078
|
},
|
|
3168
3079
|
{
|
|
@@ -3357,6 +3268,14 @@ var instructions = [
|
|
|
3357
3268
|
name: "cu_capacity_claim",
|
|
3358
3269
|
type: "u64"
|
|
3359
3270
|
},
|
|
3271
|
+
{
|
|
3272
|
+
name: "bls_pubkey",
|
|
3273
|
+
type: {
|
|
3274
|
+
defined: {
|
|
3275
|
+
name: "BN254G2BLSPublicKey"
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
},
|
|
3360
3279
|
{
|
|
3361
3280
|
name: "metadata",
|
|
3362
3281
|
type: {
|
|
@@ -3386,20 +3305,75 @@ var instructions = [
|
|
|
3386
3305
|
signer: true
|
|
3387
3306
|
},
|
|
3388
3307
|
{
|
|
3389
|
-
name: "cluster_acc",
|
|
3308
|
+
name: "cluster_acc",
|
|
3309
|
+
writable: true,
|
|
3310
|
+
pda: {
|
|
3311
|
+
seeds: [
|
|
3312
|
+
{
|
|
3313
|
+
kind: "const",
|
|
3314
|
+
value: [
|
|
3315
|
+
67,
|
|
3316
|
+
108,
|
|
3317
|
+
117,
|
|
3318
|
+
115,
|
|
3319
|
+
116,
|
|
3320
|
+
101,
|
|
3321
|
+
114
|
|
3322
|
+
]
|
|
3323
|
+
},
|
|
3324
|
+
{
|
|
3325
|
+
kind: "arg",
|
|
3326
|
+
path: "_id"
|
|
3327
|
+
}
|
|
3328
|
+
]
|
|
3329
|
+
}
|
|
3330
|
+
},
|
|
3331
|
+
{
|
|
3332
|
+
name: "authority"
|
|
3333
|
+
},
|
|
3334
|
+
{
|
|
3335
|
+
name: "mempool",
|
|
3336
|
+
docs: [
|
|
3337
|
+
"function"
|
|
3338
|
+
],
|
|
3339
|
+
writable: true,
|
|
3340
|
+
pda: {
|
|
3341
|
+
seeds: [
|
|
3342
|
+
{
|
|
3343
|
+
kind: "const",
|
|
3344
|
+
value: [
|
|
3345
|
+
77,
|
|
3346
|
+
101,
|
|
3347
|
+
109,
|
|
3348
|
+
112,
|
|
3349
|
+
111,
|
|
3350
|
+
111,
|
|
3351
|
+
108
|
|
3352
|
+
]
|
|
3353
|
+
},
|
|
3354
|
+
{
|
|
3355
|
+
kind: "arg",
|
|
3356
|
+
path: "_id"
|
|
3357
|
+
}
|
|
3358
|
+
]
|
|
3359
|
+
}
|
|
3360
|
+
},
|
|
3361
|
+
{
|
|
3362
|
+
name: "execpool",
|
|
3390
3363
|
writable: true,
|
|
3391
3364
|
pda: {
|
|
3392
3365
|
seeds: [
|
|
3393
3366
|
{
|
|
3394
3367
|
kind: "const",
|
|
3395
3368
|
value: [
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
117,
|
|
3399
|
-
115,
|
|
3400
|
-
116,
|
|
3369
|
+
69,
|
|
3370
|
+
120,
|
|
3401
3371
|
101,
|
|
3402
|
-
|
|
3372
|
+
99,
|
|
3373
|
+
112,
|
|
3374
|
+
111,
|
|
3375
|
+
111,
|
|
3376
|
+
108
|
|
3403
3377
|
]
|
|
3404
3378
|
},
|
|
3405
3379
|
{
|
|
@@ -3409,9 +3383,6 @@ var instructions = [
|
|
|
3409
3383
|
]
|
|
3410
3384
|
}
|
|
3411
3385
|
},
|
|
3412
|
-
{
|
|
3413
|
-
name: "authority"
|
|
3414
|
-
},
|
|
3415
3386
|
{
|
|
3416
3387
|
name: "pool_account",
|
|
3417
3388
|
pda: {
|
|
@@ -3465,6 +3436,14 @@ var instructions = [
|
|
|
3465
3436
|
name: "cluster_id",
|
|
3466
3437
|
type: "u32"
|
|
3467
3438
|
},
|
|
3439
|
+
{
|
|
3440
|
+
name: "mempool_size",
|
|
3441
|
+
type: {
|
|
3442
|
+
defined: {
|
|
3443
|
+
name: "MempoolSize"
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3446
|
+
},
|
|
3468
3447
|
{
|
|
3469
3448
|
name: "max_size",
|
|
3470
3449
|
type: "u32"
|
|
@@ -3677,19 +3656,17 @@ var instructions = [
|
|
|
3677
3656
|
}
|
|
3678
3657
|
},
|
|
3679
3658
|
{
|
|
3680
|
-
name: "
|
|
3681
|
-
docs: [
|
|
3682
|
-
"function"
|
|
3683
|
-
],
|
|
3659
|
+
name: "executing_pool",
|
|
3684
3660
|
writable: true,
|
|
3685
3661
|
pda: {
|
|
3686
3662
|
seeds: [
|
|
3687
3663
|
{
|
|
3688
3664
|
kind: "const",
|
|
3689
3665
|
value: [
|
|
3690
|
-
|
|
3666
|
+
69,
|
|
3667
|
+
120,
|
|
3691
3668
|
101,
|
|
3692
|
-
|
|
3669
|
+
99,
|
|
3693
3670
|
112,
|
|
3694
3671
|
111,
|
|
3695
3672
|
111,
|
|
@@ -3697,24 +3674,23 @@ var instructions = [
|
|
|
3697
3674
|
]
|
|
3698
3675
|
},
|
|
3699
3676
|
{
|
|
3700
|
-
kind: "
|
|
3701
|
-
path: "
|
|
3677
|
+
kind: "arg",
|
|
3678
|
+
path: "cluster_offset"
|
|
3702
3679
|
}
|
|
3703
3680
|
]
|
|
3704
3681
|
}
|
|
3705
3682
|
},
|
|
3706
3683
|
{
|
|
3707
|
-
name: "
|
|
3684
|
+
name: "mempool",
|
|
3708
3685
|
writable: true,
|
|
3709
3686
|
pda: {
|
|
3710
3687
|
seeds: [
|
|
3711
3688
|
{
|
|
3712
3689
|
kind: "const",
|
|
3713
3690
|
value: [
|
|
3714
|
-
|
|
3715
|
-
120,
|
|
3691
|
+
77,
|
|
3716
3692
|
101,
|
|
3717
|
-
|
|
3693
|
+
109,
|
|
3718
3694
|
112,
|
|
3719
3695
|
111,
|
|
3720
3696
|
111,
|
|
@@ -3722,8 +3698,8 @@ var instructions = [
|
|
|
3722
3698
|
]
|
|
3723
3699
|
},
|
|
3724
3700
|
{
|
|
3725
|
-
kind: "
|
|
3726
|
-
path: "
|
|
3701
|
+
kind: "arg",
|
|
3702
|
+
path: "cluster_offset"
|
|
3727
3703
|
}
|
|
3728
3704
|
]
|
|
3729
3705
|
}
|
|
@@ -3733,7 +3709,6 @@ var instructions = [
|
|
|
3733
3709
|
docs: [
|
|
3734
3710
|
"Cluster to add to the MXE."
|
|
3735
3711
|
],
|
|
3736
|
-
writable: true,
|
|
3737
3712
|
pda: {
|
|
3738
3713
|
seeds: [
|
|
3739
3714
|
{
|
|
@@ -3838,8 +3813,8 @@ var instructions = [
|
|
|
3838
3813
|
]
|
|
3839
3814
|
},
|
|
3840
3815
|
{
|
|
3841
|
-
kind: "
|
|
3842
|
-
path: "
|
|
3816
|
+
kind: "arg",
|
|
3817
|
+
path: "cluster_offset"
|
|
3843
3818
|
},
|
|
3844
3819
|
{
|
|
3845
3820
|
kind: "const",
|
|
@@ -3867,6 +3842,26 @@ var instructions = [
|
|
|
3867
3842
|
"constraint in tests because setting it would require us to deploy a program each time."
|
|
3868
3843
|
]
|
|
3869
3844
|
},
|
|
3845
|
+
{
|
|
3846
|
+
name: "pool_account",
|
|
3847
|
+
writable: true,
|
|
3848
|
+
pda: {
|
|
3849
|
+
seeds: [
|
|
3850
|
+
{
|
|
3851
|
+
kind: "const",
|
|
3852
|
+
value: [
|
|
3853
|
+
70,
|
|
3854
|
+
101,
|
|
3855
|
+
101,
|
|
3856
|
+
80,
|
|
3857
|
+
111,
|
|
3858
|
+
111,
|
|
3859
|
+
108
|
|
3860
|
+
]
|
|
3861
|
+
}
|
|
3862
|
+
]
|
|
3863
|
+
}
|
|
3864
|
+
},
|
|
3870
3865
|
{
|
|
3871
3866
|
name: "system_program",
|
|
3872
3867
|
docs: [
|
|
@@ -3879,14 +3874,6 @@ var instructions = [
|
|
|
3879
3874
|
{
|
|
3880
3875
|
name: "cluster_offset",
|
|
3881
3876
|
type: "u32"
|
|
3882
|
-
},
|
|
3883
|
-
{
|
|
3884
|
-
name: "mempool_size",
|
|
3885
|
-
type: {
|
|
3886
|
-
defined: {
|
|
3887
|
-
name: "MempoolSize"
|
|
3888
|
-
}
|
|
3889
|
-
}
|
|
3890
3877
|
}
|
|
3891
3878
|
]
|
|
3892
3879
|
},
|
|
@@ -4526,7 +4513,7 @@ var instructions = [
|
|
|
4526
4513
|
},
|
|
4527
4514
|
{
|
|
4528
4515
|
kind: "arg",
|
|
4529
|
-
path: "
|
|
4516
|
+
path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
|
|
4530
4517
|
},
|
|
4531
4518
|
{
|
|
4532
4519
|
kind: "arg",
|
|
@@ -4581,7 +4568,7 @@ var instructions = [
|
|
|
4581
4568
|
},
|
|
4582
4569
|
{
|
|
4583
4570
|
kind: "arg",
|
|
4584
|
-
path: "
|
|
4571
|
+
path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
|
|
4585
4572
|
}
|
|
4586
4573
|
]
|
|
4587
4574
|
}
|
|
@@ -4605,7 +4592,7 @@ var instructions = [
|
|
|
4605
4592
|
},
|
|
4606
4593
|
{
|
|
4607
4594
|
kind: "arg",
|
|
4608
|
-
path: "
|
|
4595
|
+
path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
|
|
4609
4596
|
}
|
|
4610
4597
|
]
|
|
4611
4598
|
}
|
|
@@ -4749,10 +4736,8 @@ var instructions = [
|
|
|
4749
4736
|
{
|
|
4750
4737
|
name: "args",
|
|
4751
4738
|
type: {
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
name: "Argument"
|
|
4755
|
-
}
|
|
4739
|
+
defined: {
|
|
4740
|
+
name: "ArgumentList"
|
|
4756
4741
|
}
|
|
4757
4742
|
}
|
|
4758
4743
|
},
|
|
@@ -4785,92 +4770,295 @@ var instructions = [
|
|
|
4785
4770
|
type: "u64"
|
|
4786
4771
|
},
|
|
4787
4772
|
{
|
|
4788
|
-
name: "cu_price_micro",
|
|
4789
|
-
type: "u64"
|
|
4790
|
-
}
|
|
4791
|
-
]
|
|
4792
|
-
},
|
|
4793
|
-
{
|
|
4794
|
-
name: "reclaim_failure_rent",
|
|
4795
|
-
discriminator: [
|
|
4796
|
-
159,
|
|
4797
|
-
99,
|
|
4798
|
-
116,
|
|
4799
|
-
180,
|
|
4800
|
-
42,
|
|
4801
|
-
9,
|
|
4802
|
-
202,
|
|
4803
|
-
219
|
|
4804
|
-
],
|
|
4805
|
-
accounts: [
|
|
4806
|
-
{
|
|
4807
|
-
name: "signer",
|
|
4773
|
+
name: "cu_price_micro",
|
|
4774
|
+
type: "u64"
|
|
4775
|
+
}
|
|
4776
|
+
]
|
|
4777
|
+
},
|
|
4778
|
+
{
|
|
4779
|
+
name: "reclaim_failure_rent",
|
|
4780
|
+
discriminator: [
|
|
4781
|
+
159,
|
|
4782
|
+
99,
|
|
4783
|
+
116,
|
|
4784
|
+
180,
|
|
4785
|
+
42,
|
|
4786
|
+
9,
|
|
4787
|
+
202,
|
|
4788
|
+
219
|
|
4789
|
+
],
|
|
4790
|
+
accounts: [
|
|
4791
|
+
{
|
|
4792
|
+
name: "signer",
|
|
4793
|
+
writable: true,
|
|
4794
|
+
signer: true
|
|
4795
|
+
},
|
|
4796
|
+
{
|
|
4797
|
+
name: "failure_acc",
|
|
4798
|
+
writable: true,
|
|
4799
|
+
pda: {
|
|
4800
|
+
seeds: [
|
|
4801
|
+
{
|
|
4802
|
+
kind: "const",
|
|
4803
|
+
value: [
|
|
4804
|
+
70,
|
|
4805
|
+
97,
|
|
4806
|
+
105,
|
|
4807
|
+
108,
|
|
4808
|
+
117,
|
|
4809
|
+
114,
|
|
4810
|
+
101,
|
|
4811
|
+
67,
|
|
4812
|
+
108,
|
|
4813
|
+
97,
|
|
4814
|
+
105,
|
|
4815
|
+
109,
|
|
4816
|
+
65,
|
|
4817
|
+
99,
|
|
4818
|
+
99,
|
|
4819
|
+
111,
|
|
4820
|
+
117,
|
|
4821
|
+
110,
|
|
4822
|
+
116,
|
|
4823
|
+
72,
|
|
4824
|
+
101,
|
|
4825
|
+
97,
|
|
4826
|
+
100,
|
|
4827
|
+
101,
|
|
4828
|
+
114
|
|
4829
|
+
]
|
|
4830
|
+
},
|
|
4831
|
+
{
|
|
4832
|
+
kind: "arg",
|
|
4833
|
+
path: "mxe_program"
|
|
4834
|
+
},
|
|
4835
|
+
{
|
|
4836
|
+
kind: "arg",
|
|
4837
|
+
path: "comp_offset"
|
|
4838
|
+
}
|
|
4839
|
+
]
|
|
4840
|
+
}
|
|
4841
|
+
},
|
|
4842
|
+
{
|
|
4843
|
+
name: "clock",
|
|
4844
|
+
address: "SysvarC1ock11111111111111111111111111111111"
|
|
4845
|
+
}
|
|
4846
|
+
],
|
|
4847
|
+
args: [
|
|
4848
|
+
{
|
|
4849
|
+
name: "comp_offset",
|
|
4850
|
+
type: "u64"
|
|
4851
|
+
},
|
|
4852
|
+
{
|
|
4853
|
+
name: "node_offset",
|
|
4854
|
+
type: "u32"
|
|
4855
|
+
},
|
|
4856
|
+
{
|
|
4857
|
+
name: "mxe_program",
|
|
4858
|
+
type: "pubkey"
|
|
4859
|
+
}
|
|
4860
|
+
]
|
|
4861
|
+
},
|
|
4862
|
+
{
|
|
4863
|
+
name: "requeue_mxe_keygen",
|
|
4864
|
+
docs: [
|
|
4865
|
+
"Re-queues the MXE keygen computation if it has expired from the mempool.",
|
|
4866
|
+
"This allows retrying the keygen if it wasn't processed in time."
|
|
4867
|
+
],
|
|
4868
|
+
discriminator: [
|
|
4869
|
+
90,
|
|
4870
|
+
98,
|
|
4871
|
+
117,
|
|
4872
|
+
181,
|
|
4873
|
+
88,
|
|
4874
|
+
71,
|
|
4875
|
+
135,
|
|
4876
|
+
30
|
|
4877
|
+
],
|
|
4878
|
+
accounts: [
|
|
4879
|
+
{
|
|
4880
|
+
name: "signer",
|
|
4881
|
+
writable: true,
|
|
4882
|
+
signer: true
|
|
4883
|
+
},
|
|
4884
|
+
{
|
|
4885
|
+
name: "mxe",
|
|
4886
|
+
pda: {
|
|
4887
|
+
seeds: [
|
|
4888
|
+
{
|
|
4889
|
+
kind: "const",
|
|
4890
|
+
value: [
|
|
4891
|
+
77,
|
|
4892
|
+
88,
|
|
4893
|
+
69,
|
|
4894
|
+
65,
|
|
4895
|
+
99,
|
|
4896
|
+
99,
|
|
4897
|
+
111,
|
|
4898
|
+
117,
|
|
4899
|
+
110,
|
|
4900
|
+
116
|
|
4901
|
+
]
|
|
4902
|
+
},
|
|
4903
|
+
{
|
|
4904
|
+
kind: "account",
|
|
4905
|
+
path: "mxe_program"
|
|
4906
|
+
}
|
|
4907
|
+
]
|
|
4908
|
+
}
|
|
4909
|
+
},
|
|
4910
|
+
{
|
|
4911
|
+
name: "executing_pool",
|
|
4912
|
+
writable: true,
|
|
4913
|
+
pda: {
|
|
4914
|
+
seeds: [
|
|
4915
|
+
{
|
|
4916
|
+
kind: "const",
|
|
4917
|
+
value: [
|
|
4918
|
+
69,
|
|
4919
|
+
120,
|
|
4920
|
+
101,
|
|
4921
|
+
99,
|
|
4922
|
+
112,
|
|
4923
|
+
111,
|
|
4924
|
+
111,
|
|
4925
|
+
108
|
|
4926
|
+
]
|
|
4927
|
+
},
|
|
4928
|
+
{
|
|
4929
|
+
kind: "arg",
|
|
4930
|
+
path: "cluster_offset"
|
|
4931
|
+
}
|
|
4932
|
+
]
|
|
4933
|
+
}
|
|
4934
|
+
},
|
|
4935
|
+
{
|
|
4936
|
+
name: "mempool",
|
|
4808
4937
|
writable: true,
|
|
4809
|
-
|
|
4938
|
+
pda: {
|
|
4939
|
+
seeds: [
|
|
4940
|
+
{
|
|
4941
|
+
kind: "const",
|
|
4942
|
+
value: [
|
|
4943
|
+
77,
|
|
4944
|
+
101,
|
|
4945
|
+
109,
|
|
4946
|
+
112,
|
|
4947
|
+
111,
|
|
4948
|
+
111,
|
|
4949
|
+
108
|
|
4950
|
+
]
|
|
4951
|
+
},
|
|
4952
|
+
{
|
|
4953
|
+
kind: "arg",
|
|
4954
|
+
path: "cluster_offset"
|
|
4955
|
+
}
|
|
4956
|
+
]
|
|
4957
|
+
}
|
|
4810
4958
|
},
|
|
4811
4959
|
{
|
|
4812
|
-
name: "
|
|
4813
|
-
writable: true,
|
|
4960
|
+
name: "cluster",
|
|
4814
4961
|
pda: {
|
|
4815
4962
|
seeds: [
|
|
4816
4963
|
{
|
|
4817
4964
|
kind: "const",
|
|
4818
4965
|
value: [
|
|
4819
|
-
|
|
4820
|
-
97,
|
|
4821
|
-
105,
|
|
4966
|
+
67,
|
|
4822
4967
|
108,
|
|
4823
4968
|
117,
|
|
4824
|
-
|
|
4969
|
+
115,
|
|
4970
|
+
116,
|
|
4825
4971
|
101,
|
|
4972
|
+
114
|
|
4973
|
+
]
|
|
4974
|
+
},
|
|
4975
|
+
{
|
|
4976
|
+
kind: "arg",
|
|
4977
|
+
path: "cluster_offset"
|
|
4978
|
+
}
|
|
4979
|
+
]
|
|
4980
|
+
}
|
|
4981
|
+
},
|
|
4982
|
+
{
|
|
4983
|
+
name: "mxe_keygen_computation",
|
|
4984
|
+
writable: true,
|
|
4985
|
+
pda: {
|
|
4986
|
+
seeds: [
|
|
4987
|
+
{
|
|
4988
|
+
kind: "const",
|
|
4989
|
+
value: [
|
|
4826
4990
|
67,
|
|
4827
|
-
|
|
4991
|
+
111,
|
|
4992
|
+
109,
|
|
4993
|
+
112,
|
|
4994
|
+
117,
|
|
4995
|
+
116,
|
|
4828
4996
|
97,
|
|
4997
|
+
116,
|
|
4829
4998
|
105,
|
|
4830
|
-
|
|
4999
|
+
111,
|
|
5000
|
+
110,
|
|
4831
5001
|
65,
|
|
4832
5002
|
99,
|
|
4833
5003
|
99,
|
|
4834
5004
|
111,
|
|
4835
5005
|
117,
|
|
4836
5006
|
110,
|
|
4837
|
-
116
|
|
4838
|
-
72,
|
|
4839
|
-
101,
|
|
4840
|
-
97,
|
|
4841
|
-
100,
|
|
4842
|
-
101,
|
|
4843
|
-
114
|
|
5007
|
+
116
|
|
4844
5008
|
]
|
|
4845
5009
|
},
|
|
4846
5010
|
{
|
|
4847
5011
|
kind: "arg",
|
|
4848
|
-
path: "
|
|
5012
|
+
path: "cluster_offset"
|
|
4849
5013
|
},
|
|
4850
5014
|
{
|
|
4851
|
-
kind: "
|
|
4852
|
-
|
|
5015
|
+
kind: "const",
|
|
5016
|
+
value: [
|
|
5017
|
+
1,
|
|
5018
|
+
0,
|
|
5019
|
+
0,
|
|
5020
|
+
0,
|
|
5021
|
+
0,
|
|
5022
|
+
0,
|
|
5023
|
+
0,
|
|
5024
|
+
0
|
|
5025
|
+
]
|
|
4853
5026
|
}
|
|
4854
5027
|
]
|
|
4855
5028
|
}
|
|
4856
5029
|
},
|
|
4857
5030
|
{
|
|
4858
|
-
name: "
|
|
4859
|
-
|
|
5031
|
+
name: "pool_account",
|
|
5032
|
+
writable: true,
|
|
5033
|
+
pda: {
|
|
5034
|
+
seeds: [
|
|
5035
|
+
{
|
|
5036
|
+
kind: "const",
|
|
5037
|
+
value: [
|
|
5038
|
+
70,
|
|
5039
|
+
101,
|
|
5040
|
+
101,
|
|
5041
|
+
80,
|
|
5042
|
+
111,
|
|
5043
|
+
111,
|
|
5044
|
+
108
|
|
5045
|
+
]
|
|
5046
|
+
}
|
|
5047
|
+
]
|
|
5048
|
+
}
|
|
5049
|
+
},
|
|
5050
|
+
{
|
|
5051
|
+
name: "mxe_program"
|
|
5052
|
+
},
|
|
5053
|
+
{
|
|
5054
|
+
name: "system_program",
|
|
5055
|
+
address: "11111111111111111111111111111111"
|
|
4860
5056
|
}
|
|
4861
5057
|
],
|
|
4862
5058
|
args: [
|
|
4863
5059
|
{
|
|
4864
|
-
name: "
|
|
4865
|
-
type: "u64"
|
|
4866
|
-
},
|
|
4867
|
-
{
|
|
4868
|
-
name: "node_offset",
|
|
5060
|
+
name: "cluster_offset",
|
|
4869
5061
|
type: "u32"
|
|
4870
|
-
},
|
|
4871
|
-
{
|
|
4872
|
-
name: "mxe_program",
|
|
4873
|
-
type: "pubkey"
|
|
4874
5062
|
}
|
|
4875
5063
|
]
|
|
4876
5064
|
},
|
|
@@ -5020,7 +5208,6 @@ var instructions = [
|
|
|
5020
5208
|
docs: [
|
|
5021
5209
|
"MXE account to set the cluster for."
|
|
5022
5210
|
],
|
|
5023
|
-
writable: true,
|
|
5024
5211
|
pda: {
|
|
5025
5212
|
seeds: [
|
|
5026
5213
|
{
|
|
@@ -5050,7 +5237,6 @@ var instructions = [
|
|
|
5050
5237
|
docs: [
|
|
5051
5238
|
"Cluster to set for the MXE."
|
|
5052
5239
|
],
|
|
5053
|
-
writable: true,
|
|
5054
5240
|
pda: {
|
|
5055
5241
|
seeds: [
|
|
5056
5242
|
{
|
|
@@ -5250,47 +5436,136 @@ var instructions = [
|
|
|
5250
5436
|
],
|
|
5251
5437
|
args: [
|
|
5252
5438
|
{
|
|
5253
|
-
name: "node_offset",
|
|
5439
|
+
name: "node_offset",
|
|
5440
|
+
type: "u32"
|
|
5441
|
+
},
|
|
5442
|
+
{
|
|
5443
|
+
name: "_mxe_program",
|
|
5444
|
+
type: "pubkey"
|
|
5445
|
+
},
|
|
5446
|
+
{
|
|
5447
|
+
name: "mxe_x25519_pubkey",
|
|
5448
|
+
type: {
|
|
5449
|
+
array: [
|
|
5450
|
+
"u8",
|
|
5451
|
+
32
|
|
5452
|
+
]
|
|
5453
|
+
}
|
|
5454
|
+
},
|
|
5455
|
+
{
|
|
5456
|
+
name: "mxe_ed25519_verifying_key",
|
|
5457
|
+
type: {
|
|
5458
|
+
array: [
|
|
5459
|
+
"u8",
|
|
5460
|
+
32
|
|
5461
|
+
]
|
|
5462
|
+
}
|
|
5463
|
+
},
|
|
5464
|
+
{
|
|
5465
|
+
name: "mxe_elgamal_pubkey",
|
|
5466
|
+
type: {
|
|
5467
|
+
array: [
|
|
5468
|
+
"u8",
|
|
5469
|
+
32
|
|
5470
|
+
]
|
|
5471
|
+
}
|
|
5472
|
+
},
|
|
5473
|
+
{
|
|
5474
|
+
name: "mxe_pubkey_validity_proof",
|
|
5475
|
+
type: {
|
|
5476
|
+
array: [
|
|
5477
|
+
"u8",
|
|
5478
|
+
64
|
|
5479
|
+
]
|
|
5480
|
+
}
|
|
5481
|
+
}
|
|
5482
|
+
]
|
|
5483
|
+
},
|
|
5484
|
+
{
|
|
5485
|
+
name: "submit_aggregated_bls_pubkey",
|
|
5486
|
+
discriminator: [
|
|
5487
|
+
192,
|
|
5488
|
+
135,
|
|
5489
|
+
47,
|
|
5490
|
+
120,
|
|
5491
|
+
63,
|
|
5492
|
+
18,
|
|
5493
|
+
232,
|
|
5494
|
+
164
|
|
5495
|
+
],
|
|
5496
|
+
accounts: [
|
|
5497
|
+
{
|
|
5498
|
+
name: "node_authority",
|
|
5499
|
+
writable: true,
|
|
5500
|
+
signer: true
|
|
5501
|
+
},
|
|
5502
|
+
{
|
|
5503
|
+
name: "cluster_acc",
|
|
5504
|
+
writable: true,
|
|
5505
|
+
pda: {
|
|
5506
|
+
seeds: [
|
|
5507
|
+
{
|
|
5508
|
+
kind: "const",
|
|
5509
|
+
value: [
|
|
5510
|
+
67,
|
|
5511
|
+
108,
|
|
5512
|
+
117,
|
|
5513
|
+
115,
|
|
5514
|
+
116,
|
|
5515
|
+
101,
|
|
5516
|
+
114
|
|
5517
|
+
]
|
|
5518
|
+
},
|
|
5519
|
+
{
|
|
5520
|
+
kind: "arg",
|
|
5521
|
+
path: "cluster_offset"
|
|
5522
|
+
}
|
|
5523
|
+
]
|
|
5524
|
+
}
|
|
5525
|
+
},
|
|
5526
|
+
{
|
|
5527
|
+
name: "arx_node_acc",
|
|
5528
|
+
pda: {
|
|
5529
|
+
seeds: [
|
|
5530
|
+
{
|
|
5531
|
+
kind: "const",
|
|
5532
|
+
value: [
|
|
5533
|
+
65,
|
|
5534
|
+
114,
|
|
5535
|
+
120,
|
|
5536
|
+
78,
|
|
5537
|
+
111,
|
|
5538
|
+
100,
|
|
5539
|
+
101
|
|
5540
|
+
]
|
|
5541
|
+
},
|
|
5542
|
+
{
|
|
5543
|
+
kind: "arg",
|
|
5544
|
+
path: "node_offset"
|
|
5545
|
+
}
|
|
5546
|
+
]
|
|
5547
|
+
}
|
|
5548
|
+
},
|
|
5549
|
+
{
|
|
5550
|
+
name: "system_program",
|
|
5551
|
+
address: "11111111111111111111111111111111"
|
|
5552
|
+
}
|
|
5553
|
+
],
|
|
5554
|
+
args: [
|
|
5555
|
+
{
|
|
5556
|
+
name: "cluster_id",
|
|
5254
5557
|
type: "u32"
|
|
5255
5558
|
},
|
|
5256
5559
|
{
|
|
5257
|
-
name: "
|
|
5258
|
-
type: "
|
|
5259
|
-
},
|
|
5260
|
-
{
|
|
5261
|
-
name: "mxe_x25519_pubkey",
|
|
5262
|
-
type: {
|
|
5263
|
-
array: [
|
|
5264
|
-
"u8",
|
|
5265
|
-
32
|
|
5266
|
-
]
|
|
5267
|
-
}
|
|
5268
|
-
},
|
|
5269
|
-
{
|
|
5270
|
-
name: "mxe_ed25519_verifying_key",
|
|
5271
|
-
type: {
|
|
5272
|
-
array: [
|
|
5273
|
-
"u8",
|
|
5274
|
-
32
|
|
5275
|
-
]
|
|
5276
|
-
}
|
|
5277
|
-
},
|
|
5278
|
-
{
|
|
5279
|
-
name: "mxe_elgamal_pubkey",
|
|
5280
|
-
type: {
|
|
5281
|
-
array: [
|
|
5282
|
-
"u8",
|
|
5283
|
-
32
|
|
5284
|
-
]
|
|
5285
|
-
}
|
|
5560
|
+
name: "node_bump",
|
|
5561
|
+
type: "u32"
|
|
5286
5562
|
},
|
|
5287
5563
|
{
|
|
5288
|
-
name: "
|
|
5564
|
+
name: "aggregated_bls_pubkey",
|
|
5289
5565
|
type: {
|
|
5290
|
-
|
|
5291
|
-
"
|
|
5292
|
-
|
|
5293
|
-
]
|
|
5566
|
+
defined: {
|
|
5567
|
+
name: "BN254G2BLSPublicKey"
|
|
5568
|
+
}
|
|
5294
5569
|
}
|
|
5295
5570
|
}
|
|
5296
5571
|
]
|
|
@@ -5995,6 +6270,11 @@ var errors = [
|
|
|
5995
6270
|
name: "InvalidCallbackInstructions",
|
|
5996
6271
|
msg: "Callback instructions are invalid"
|
|
5997
6272
|
},
|
|
6273
|
+
{
|
|
6274
|
+
code: 6210,
|
|
6275
|
+
name: "ComputationNotExpired",
|
|
6276
|
+
msg: "Computation has not expired from mempool yet"
|
|
6277
|
+
},
|
|
5998
6278
|
{
|
|
5999
6279
|
code: 6300,
|
|
6000
6280
|
name: "ComputationDefinitionNotCompleted",
|
|
@@ -6015,6 +6295,11 @@ var errors = [
|
|
|
6015
6295
|
name: "ComputationDefinitionAlreadyCompleted",
|
|
6016
6296
|
msg: "Computation definition already completed"
|
|
6017
6297
|
},
|
|
6298
|
+
{
|
|
6299
|
+
code: 6304,
|
|
6300
|
+
name: "InvalidCUAmount",
|
|
6301
|
+
msg: "CU amount exceeds maximum limit"
|
|
6302
|
+
},
|
|
6018
6303
|
{
|
|
6019
6304
|
code: 6400,
|
|
6020
6305
|
name: "InvalidNode",
|
|
@@ -6060,6 +6345,11 @@ var errors = [
|
|
|
6060
6345
|
name: "InvalidNodeConfig",
|
|
6061
6346
|
msg: "Node config is invalid"
|
|
6062
6347
|
},
|
|
6348
|
+
{
|
|
6349
|
+
code: 6409,
|
|
6350
|
+
name: "UnauthorizedNodeCreation",
|
|
6351
|
+
msg: "Unauthorized to create node on mainnet"
|
|
6352
|
+
},
|
|
6063
6353
|
{
|
|
6064
6354
|
code: 6500,
|
|
6065
6355
|
name: "ClusterFull",
|
|
@@ -6134,6 +6424,41 @@ var errors = [
|
|
|
6134
6424
|
code: 6607,
|
|
6135
6425
|
name: "EpochOverflow",
|
|
6136
6426
|
msg: "Epoch overflowed"
|
|
6427
|
+
},
|
|
6428
|
+
{
|
|
6429
|
+
code: 6608,
|
|
6430
|
+
name: "InvalidLighthouseProgramID",
|
|
6431
|
+
msg: "Lighthouse program ID is invalid"
|
|
6432
|
+
},
|
|
6433
|
+
{
|
|
6434
|
+
code: 6609,
|
|
6435
|
+
name: "ExtraInstructionFound",
|
|
6436
|
+
msg: "Extra instruction found in transaction"
|
|
6437
|
+
},
|
|
6438
|
+
{
|
|
6439
|
+
code: 6610,
|
|
6440
|
+
name: "InvalidLighthouseInstructionCount",
|
|
6441
|
+
msg: "Invalid number of Lighthouse program instructions"
|
|
6442
|
+
},
|
|
6443
|
+
{
|
|
6444
|
+
code: 6611,
|
|
6445
|
+
name: "InvalidSignature",
|
|
6446
|
+
msg: "Invalid BLS signature"
|
|
6447
|
+
},
|
|
6448
|
+
{
|
|
6449
|
+
code: 6612,
|
|
6450
|
+
name: "ValueAlreadySet",
|
|
6451
|
+
msg: "Value already set"
|
|
6452
|
+
},
|
|
6453
|
+
{
|
|
6454
|
+
code: 6613,
|
|
6455
|
+
name: "InvalidValueSetterIndex",
|
|
6456
|
+
msg: "Invalid value setter index"
|
|
6457
|
+
},
|
|
6458
|
+
{
|
|
6459
|
+
code: 6614,
|
|
6460
|
+
name: "NotAllNodesVotedForBlsPublicKey",
|
|
6461
|
+
msg: "Not all nodes have voted for the BLS public key"
|
|
6137
6462
|
}
|
|
6138
6463
|
];
|
|
6139
6464
|
var types = [
|
|
@@ -6209,6 +6534,26 @@ var types = [
|
|
|
6209
6534
|
]
|
|
6210
6535
|
}
|
|
6211
6536
|
},
|
|
6537
|
+
{
|
|
6538
|
+
name: "AccountArgument",
|
|
6539
|
+
type: {
|
|
6540
|
+
kind: "struct",
|
|
6541
|
+
fields: [
|
|
6542
|
+
{
|
|
6543
|
+
name: "pubkey",
|
|
6544
|
+
type: "pubkey"
|
|
6545
|
+
},
|
|
6546
|
+
{
|
|
6547
|
+
name: "offset",
|
|
6548
|
+
type: "u32"
|
|
6549
|
+
},
|
|
6550
|
+
{
|
|
6551
|
+
name: "length",
|
|
6552
|
+
type: "u32"
|
|
6553
|
+
}
|
|
6554
|
+
]
|
|
6555
|
+
}
|
|
6556
|
+
},
|
|
6212
6557
|
{
|
|
6213
6558
|
name: "Activation",
|
|
6214
6559
|
type: {
|
|
@@ -6240,10 +6585,64 @@ var types = [
|
|
|
6240
6585
|
}
|
|
6241
6586
|
},
|
|
6242
6587
|
{
|
|
6243
|
-
name: "
|
|
6588
|
+
name: "ArgumentList",
|
|
6589
|
+
docs: [
|
|
6590
|
+
"Container for arguments that separates small inline values from large indexed data"
|
|
6591
|
+
],
|
|
6592
|
+
type: {
|
|
6593
|
+
kind: "struct",
|
|
6594
|
+
fields: [
|
|
6595
|
+
{
|
|
6596
|
+
name: "args",
|
|
6597
|
+
type: {
|
|
6598
|
+
vec: {
|
|
6599
|
+
defined: {
|
|
6600
|
+
name: "ArgumentRef"
|
|
6601
|
+
}
|
|
6602
|
+
}
|
|
6603
|
+
}
|
|
6604
|
+
},
|
|
6605
|
+
{
|
|
6606
|
+
name: "byte_arrays",
|
|
6607
|
+
type: {
|
|
6608
|
+
vec: {
|
|
6609
|
+
array: [
|
|
6610
|
+
"u8",
|
|
6611
|
+
32
|
|
6612
|
+
]
|
|
6613
|
+
}
|
|
6614
|
+
}
|
|
6615
|
+
},
|
|
6616
|
+
{
|
|
6617
|
+
name: "plaintext_numbers",
|
|
6618
|
+
type: {
|
|
6619
|
+
vec: "u64"
|
|
6620
|
+
}
|
|
6621
|
+
},
|
|
6622
|
+
{
|
|
6623
|
+
name: "values_128_bit",
|
|
6624
|
+
type: {
|
|
6625
|
+
vec: "u128"
|
|
6626
|
+
}
|
|
6627
|
+
},
|
|
6628
|
+
{
|
|
6629
|
+
name: "accounts",
|
|
6630
|
+
type: {
|
|
6631
|
+
vec: {
|
|
6632
|
+
defined: {
|
|
6633
|
+
name: "AccountArgument"
|
|
6634
|
+
}
|
|
6635
|
+
}
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
]
|
|
6639
|
+
}
|
|
6640
|
+
},
|
|
6641
|
+
{
|
|
6642
|
+
name: "ArgumentRef",
|
|
6244
6643
|
docs: [
|
|
6245
|
-
"
|
|
6246
|
-
"
|
|
6644
|
+
"A reference to an argument - stores small values that don't affect alignment inline and large",
|
|
6645
|
+
"values as indices."
|
|
6247
6646
|
],
|
|
6248
6647
|
type: {
|
|
6249
6648
|
kind: "enum",
|
|
@@ -6260,153 +6659,160 @@ var types = [
|
|
|
6260
6659
|
"u8"
|
|
6261
6660
|
]
|
|
6262
6661
|
},
|
|
6662
|
+
{
|
|
6663
|
+
name: "PlaintextI8",
|
|
6664
|
+
fields: [
|
|
6665
|
+
"i8"
|
|
6666
|
+
]
|
|
6667
|
+
},
|
|
6263
6668
|
{
|
|
6264
6669
|
name: "PlaintextU16",
|
|
6265
6670
|
fields: [
|
|
6266
|
-
"
|
|
6671
|
+
"u8"
|
|
6267
6672
|
]
|
|
6268
6673
|
},
|
|
6269
6674
|
{
|
|
6270
6675
|
name: "PlaintextU32",
|
|
6271
6676
|
fields: [
|
|
6272
|
-
"
|
|
6677
|
+
"u8"
|
|
6273
6678
|
]
|
|
6274
6679
|
},
|
|
6275
6680
|
{
|
|
6276
6681
|
name: "PlaintextU64",
|
|
6277
6682
|
fields: [
|
|
6278
|
-
"
|
|
6683
|
+
"u8"
|
|
6279
6684
|
]
|
|
6280
6685
|
},
|
|
6281
6686
|
{
|
|
6282
6687
|
name: "PlaintextU128",
|
|
6283
6688
|
fields: [
|
|
6284
|
-
"
|
|
6689
|
+
"u8"
|
|
6285
6690
|
]
|
|
6286
6691
|
},
|
|
6287
6692
|
{
|
|
6288
6693
|
name: "PlaintextFloat",
|
|
6289
6694
|
fields: [
|
|
6290
|
-
"
|
|
6695
|
+
"u8"
|
|
6291
6696
|
]
|
|
6292
6697
|
},
|
|
6293
6698
|
{
|
|
6294
6699
|
name: "EncryptedBool",
|
|
6295
6700
|
fields: [
|
|
6296
|
-
|
|
6297
|
-
array: [
|
|
6298
|
-
"u8",
|
|
6299
|
-
32
|
|
6300
|
-
]
|
|
6301
|
-
}
|
|
6701
|
+
"u8"
|
|
6302
6702
|
]
|
|
6303
6703
|
},
|
|
6304
6704
|
{
|
|
6305
6705
|
name: "EncryptedU8",
|
|
6306
6706
|
fields: [
|
|
6307
|
-
|
|
6308
|
-
array: [
|
|
6309
|
-
"u8",
|
|
6310
|
-
32
|
|
6311
|
-
]
|
|
6312
|
-
}
|
|
6707
|
+
"u8"
|
|
6313
6708
|
]
|
|
6314
6709
|
},
|
|
6315
6710
|
{
|
|
6316
6711
|
name: "EncryptedU16",
|
|
6317
6712
|
fields: [
|
|
6318
|
-
|
|
6319
|
-
array: [
|
|
6320
|
-
"u8",
|
|
6321
|
-
32
|
|
6322
|
-
]
|
|
6323
|
-
}
|
|
6713
|
+
"u8"
|
|
6324
6714
|
]
|
|
6325
6715
|
},
|
|
6326
6716
|
{
|
|
6327
6717
|
name: "EncryptedU32",
|
|
6328
6718
|
fields: [
|
|
6329
|
-
|
|
6330
|
-
array: [
|
|
6331
|
-
"u8",
|
|
6332
|
-
32
|
|
6333
|
-
]
|
|
6334
|
-
}
|
|
6719
|
+
"u8"
|
|
6335
6720
|
]
|
|
6336
6721
|
},
|
|
6337
6722
|
{
|
|
6338
6723
|
name: "EncryptedU64",
|
|
6339
6724
|
fields: [
|
|
6340
|
-
|
|
6341
|
-
array: [
|
|
6342
|
-
"u8",
|
|
6343
|
-
32
|
|
6344
|
-
]
|
|
6345
|
-
}
|
|
6725
|
+
"u8"
|
|
6346
6726
|
]
|
|
6347
6727
|
},
|
|
6348
6728
|
{
|
|
6349
6729
|
name: "EncryptedU128",
|
|
6350
6730
|
fields: [
|
|
6351
|
-
|
|
6352
|
-
array: [
|
|
6353
|
-
"u8",
|
|
6354
|
-
32
|
|
6355
|
-
]
|
|
6356
|
-
}
|
|
6731
|
+
"u8"
|
|
6357
6732
|
]
|
|
6358
6733
|
},
|
|
6359
6734
|
{
|
|
6360
6735
|
name: "EncryptedFloat",
|
|
6361
6736
|
fields: [
|
|
6362
|
-
|
|
6363
|
-
array: [
|
|
6364
|
-
"u8",
|
|
6365
|
-
32
|
|
6366
|
-
]
|
|
6367
|
-
}
|
|
6737
|
+
"u8"
|
|
6368
6738
|
]
|
|
6369
6739
|
},
|
|
6370
6740
|
{
|
|
6371
|
-
name: "
|
|
6741
|
+
name: "X25519Pubkey",
|
|
6372
6742
|
fields: [
|
|
6373
|
-
|
|
6374
|
-
array: [
|
|
6375
|
-
"u8",
|
|
6376
|
-
32
|
|
6377
|
-
]
|
|
6378
|
-
}
|
|
6743
|
+
"u8"
|
|
6379
6744
|
]
|
|
6380
6745
|
},
|
|
6381
6746
|
{
|
|
6382
|
-
name: "
|
|
6747
|
+
name: "ArcisEd25519Signature",
|
|
6383
6748
|
fields: [
|
|
6384
|
-
|
|
6385
|
-
array: [
|
|
6386
|
-
"u8",
|
|
6387
|
-
64
|
|
6388
|
-
]
|
|
6389
|
-
}
|
|
6749
|
+
"u8"
|
|
6390
6750
|
]
|
|
6391
6751
|
},
|
|
6392
6752
|
{
|
|
6393
6753
|
name: "Account",
|
|
6394
6754
|
fields: [
|
|
6395
|
-
"
|
|
6396
|
-
|
|
6397
|
-
|
|
6755
|
+
"u8"
|
|
6756
|
+
]
|
|
6757
|
+
},
|
|
6758
|
+
{
|
|
6759
|
+
name: "PlaintextI16",
|
|
6760
|
+
fields: [
|
|
6761
|
+
"u8"
|
|
6762
|
+
]
|
|
6763
|
+
},
|
|
6764
|
+
{
|
|
6765
|
+
name: "PlaintextI32",
|
|
6766
|
+
fields: [
|
|
6767
|
+
"u8"
|
|
6768
|
+
]
|
|
6769
|
+
},
|
|
6770
|
+
{
|
|
6771
|
+
name: "PlaintextI64",
|
|
6772
|
+
fields: [
|
|
6773
|
+
"u8"
|
|
6774
|
+
]
|
|
6775
|
+
},
|
|
6776
|
+
{
|
|
6777
|
+
name: "PlaintextI128",
|
|
6778
|
+
fields: [
|
|
6779
|
+
"u8"
|
|
6780
|
+
]
|
|
6781
|
+
},
|
|
6782
|
+
{
|
|
6783
|
+
name: "EncryptedI8",
|
|
6784
|
+
fields: [
|
|
6785
|
+
"u8"
|
|
6786
|
+
]
|
|
6787
|
+
},
|
|
6788
|
+
{
|
|
6789
|
+
name: "EncryptedI16",
|
|
6790
|
+
fields: [
|
|
6791
|
+
"u8"
|
|
6792
|
+
]
|
|
6793
|
+
},
|
|
6794
|
+
{
|
|
6795
|
+
name: "EncryptedI32",
|
|
6796
|
+
fields: [
|
|
6797
|
+
"u8"
|
|
6798
|
+
]
|
|
6799
|
+
},
|
|
6800
|
+
{
|
|
6801
|
+
name: "EncryptedI64",
|
|
6802
|
+
fields: [
|
|
6803
|
+
"u8"
|
|
6398
6804
|
]
|
|
6399
6805
|
},
|
|
6400
6806
|
{
|
|
6401
|
-
name: "
|
|
6807
|
+
name: "EncryptedI128",
|
|
6402
6808
|
fields: [
|
|
6403
|
-
"
|
|
6809
|
+
"u8"
|
|
6404
6810
|
]
|
|
6405
6811
|
},
|
|
6406
6812
|
{
|
|
6407
|
-
name: "
|
|
6813
|
+
name: "PlaintextPoint",
|
|
6408
6814
|
fields: [
|
|
6409
|
-
"
|
|
6815
|
+
"u8"
|
|
6410
6816
|
]
|
|
6411
6817
|
}
|
|
6412
6818
|
]
|
|
@@ -6438,21 +6844,14 @@ var types = [
|
|
|
6438
6844
|
}
|
|
6439
6845
|
},
|
|
6440
6846
|
{
|
|
6441
|
-
name: "
|
|
6847
|
+
name: "cluster_membership",
|
|
6442
6848
|
docs: [
|
|
6443
6849
|
"The offsets of the cluster the node is a member of."
|
|
6444
6850
|
],
|
|
6445
6851
|
type: {
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
{
|
|
6450
|
-
name: "proposed_cluster_memberships",
|
|
6451
|
-
docs: [
|
|
6452
|
-
"The offsets of the clusters the node has been proposed to be a member of."
|
|
6453
|
-
],
|
|
6454
|
-
type: {
|
|
6455
|
-
vec: "u32"
|
|
6852
|
+
defined: {
|
|
6853
|
+
name: "ClusterMembership"
|
|
6854
|
+
}
|
|
6456
6855
|
}
|
|
6457
6856
|
},
|
|
6458
6857
|
{
|
|
@@ -6464,12 +6863,14 @@ var types = [
|
|
|
6464
6863
|
type: "bool"
|
|
6465
6864
|
},
|
|
6466
6865
|
{
|
|
6467
|
-
name: "
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6866
|
+
name: "bls_pubkey",
|
|
6867
|
+
docs: [
|
|
6868
|
+
"BLS public key for this node (64 bytes compressed G2 point for alt-bn128)"
|
|
6869
|
+
],
|
|
6870
|
+
type: {
|
|
6871
|
+
defined: {
|
|
6872
|
+
name: "BN254G2BLSPublicKey"
|
|
6873
|
+
}
|
|
6473
6874
|
}
|
|
6474
6875
|
},
|
|
6475
6876
|
{
|
|
@@ -6484,10 +6885,6 @@ var types = [
|
|
|
6484
6885
|
type: {
|
|
6485
6886
|
kind: "struct",
|
|
6486
6887
|
fields: [
|
|
6487
|
-
{
|
|
6488
|
-
name: "max_cluster_memberships",
|
|
6489
|
-
type: "u32"
|
|
6490
|
-
},
|
|
6491
6888
|
{
|
|
6492
6889
|
name: "authority",
|
|
6493
6890
|
docs: [
|
|
@@ -6505,6 +6902,20 @@ var types = [
|
|
|
6505
6902
|
]
|
|
6506
6903
|
}
|
|
6507
6904
|
},
|
|
6905
|
+
{
|
|
6906
|
+
name: "BN254G2BLSPublicKey",
|
|
6907
|
+
type: {
|
|
6908
|
+
kind: "struct",
|
|
6909
|
+
fields: [
|
|
6910
|
+
{
|
|
6911
|
+
array: [
|
|
6912
|
+
"u8",
|
|
6913
|
+
64
|
|
6914
|
+
]
|
|
6915
|
+
}
|
|
6916
|
+
]
|
|
6917
|
+
}
|
|
6918
|
+
},
|
|
6508
6919
|
{
|
|
6509
6920
|
name: "CallbackAccount",
|
|
6510
6921
|
docs: [
|
|
@@ -6722,15 +7133,6 @@ var types = [
|
|
|
6722
7133
|
}
|
|
6723
7134
|
}
|
|
6724
7135
|
},
|
|
6725
|
-
{
|
|
6726
|
-
name: "mxes",
|
|
6727
|
-
docs: [
|
|
6728
|
-
"The MXE's that this cluster is assigned to. Referred to by the MXE's program id."
|
|
6729
|
-
],
|
|
6730
|
-
type: {
|
|
6731
|
-
vec: "pubkey"
|
|
6732
|
-
}
|
|
6733
|
-
},
|
|
6734
7136
|
{
|
|
6735
7137
|
name: "nodes",
|
|
6736
7138
|
type: {
|
|
@@ -6751,6 +7153,28 @@ var types = [
|
|
|
6751
7153
|
}
|
|
6752
7154
|
}
|
|
6753
7155
|
},
|
|
7156
|
+
{
|
|
7157
|
+
name: "bls_public_key",
|
|
7158
|
+
docs: [
|
|
7159
|
+
"BLS public key for the cluster (64 bytes compressed G2 point for alt-bn128)",
|
|
7160
|
+
"Set only when all nodes have submitted and agreed on the aggregated pubkey"
|
|
7161
|
+
],
|
|
7162
|
+
type: {
|
|
7163
|
+
defined: {
|
|
7164
|
+
name: "SetUnset",
|
|
7165
|
+
generics: [
|
|
7166
|
+
{
|
|
7167
|
+
kind: "type",
|
|
7168
|
+
type: {
|
|
7169
|
+
defined: {
|
|
7170
|
+
name: "BN254G2BLSPublicKey"
|
|
7171
|
+
}
|
|
7172
|
+
}
|
|
7173
|
+
}
|
|
7174
|
+
]
|
|
7175
|
+
}
|
|
7176
|
+
}
|
|
7177
|
+
},
|
|
6754
7178
|
{
|
|
6755
7179
|
name: "bump",
|
|
6756
7180
|
type: "u8"
|
|
@@ -6758,6 +7182,29 @@ var types = [
|
|
|
6758
7182
|
]
|
|
6759
7183
|
}
|
|
6760
7184
|
},
|
|
7185
|
+
{
|
|
7186
|
+
name: "ClusterMembership",
|
|
7187
|
+
type: {
|
|
7188
|
+
kind: "enum",
|
|
7189
|
+
variants: [
|
|
7190
|
+
{
|
|
7191
|
+
name: "Inactive"
|
|
7192
|
+
},
|
|
7193
|
+
{
|
|
7194
|
+
name: "Active",
|
|
7195
|
+
fields: [
|
|
7196
|
+
"u32"
|
|
7197
|
+
]
|
|
7198
|
+
},
|
|
7199
|
+
{
|
|
7200
|
+
name: "Proposed",
|
|
7201
|
+
fields: [
|
|
7202
|
+
"u32"
|
|
7203
|
+
]
|
|
7204
|
+
}
|
|
7205
|
+
]
|
|
7206
|
+
}
|
|
7207
|
+
},
|
|
6761
7208
|
{
|
|
6762
7209
|
name: "ComputationAccount",
|
|
6763
7210
|
docs: [
|
|
@@ -6771,18 +7218,11 @@ var types = [
|
|
|
6771
7218
|
type: "pubkey"
|
|
6772
7219
|
},
|
|
6773
7220
|
{
|
|
6774
|
-
name: "
|
|
7221
|
+
name: "mxe_program_id",
|
|
6775
7222
|
docs: [
|
|
6776
|
-
"The MXE
|
|
6777
|
-
"",
|
|
6778
|
-
"# Notes",
|
|
6779
|
-
"",
|
|
6780
|
-
"- [None] represents the default cluster,",
|
|
6781
|
-
"- [Some] specifies the index of the fallback cluster."
|
|
7223
|
+
"The program ID of the MXE that this computation is associated with."
|
|
6782
7224
|
],
|
|
6783
|
-
type:
|
|
6784
|
-
option: "u16"
|
|
6785
|
-
}
|
|
7225
|
+
type: "pubkey"
|
|
6786
7226
|
},
|
|
6787
7227
|
{
|
|
6788
7228
|
name: "computation_definition_offset",
|
|
@@ -6819,16 +7259,24 @@ var types = [
|
|
|
6819
7259
|
}
|
|
6820
7260
|
},
|
|
6821
7261
|
{
|
|
6822
|
-
name: "
|
|
7262
|
+
name: "cluster_index",
|
|
6823
7263
|
docs: [
|
|
6824
|
-
"The
|
|
6825
|
-
"
|
|
7264
|
+
"The MXE's cluster to be used for execution.",
|
|
7265
|
+
"",
|
|
7266
|
+
"# Notes",
|
|
7267
|
+
"",
|
|
7268
|
+
"- [None] represents the default cluster,",
|
|
7269
|
+
"- [Some] specifies the index of the fallback cluster."
|
|
6826
7270
|
],
|
|
6827
7271
|
type: {
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
7272
|
+
option: "u16"
|
|
7273
|
+
}
|
|
7274
|
+
},
|
|
7275
|
+
{
|
|
7276
|
+
name: "arguments",
|
|
7277
|
+
type: {
|
|
7278
|
+
defined: {
|
|
7279
|
+
name: "ArgumentList"
|
|
6832
7280
|
}
|
|
6833
7281
|
}
|
|
6834
7282
|
},
|
|
@@ -6984,10 +7432,6 @@ var types = [
|
|
|
6984
7432
|
name: "priority_fee",
|
|
6985
7433
|
type: "u64"
|
|
6986
7434
|
},
|
|
6987
|
-
{
|
|
6988
|
-
name: "computation_definition_offset",
|
|
6989
|
-
type: "u32"
|
|
6990
|
-
},
|
|
6991
7435
|
{
|
|
6992
7436
|
name: "accs",
|
|
6993
7437
|
type: {
|
|
@@ -6997,7 +7441,7 @@ var types = [
|
|
|
6997
7441
|
name: "AcccountAccessInfo"
|
|
6998
7442
|
}
|
|
6999
7443
|
},
|
|
7000
|
-
|
|
7444
|
+
12
|
|
7001
7445
|
]
|
|
7002
7446
|
}
|
|
7003
7447
|
}
|
|
@@ -7518,21 +7962,29 @@ var types = [
|
|
|
7518
7962
|
kind: "struct",
|
|
7519
7963
|
fields: [
|
|
7520
7964
|
{
|
|
7521
|
-
name: "
|
|
7965
|
+
name: "cluster",
|
|
7522
7966
|
docs: [
|
|
7523
|
-
"The
|
|
7967
|
+
"The cluster executing the MXE."
|
|
7524
7968
|
],
|
|
7525
7969
|
type: {
|
|
7526
|
-
option: "
|
|
7970
|
+
option: "u32"
|
|
7527
7971
|
}
|
|
7528
7972
|
},
|
|
7529
7973
|
{
|
|
7530
|
-
name: "
|
|
7974
|
+
name: "mxe_program_id",
|
|
7531
7975
|
docs: [
|
|
7532
|
-
"The
|
|
7976
|
+
"The program ID of the program that this MXE is associated with. Needed so that when we",
|
|
7977
|
+
"index this account offchain we can find out what program it is associated with."
|
|
7978
|
+
],
|
|
7979
|
+
type: "pubkey"
|
|
7980
|
+
},
|
|
7981
|
+
{
|
|
7982
|
+
name: "authority",
|
|
7983
|
+
docs: [
|
|
7984
|
+
"The management authority of the MXE."
|
|
7533
7985
|
],
|
|
7534
7986
|
type: {
|
|
7535
|
-
option: "
|
|
7987
|
+
option: "pubkey"
|
|
7536
7988
|
}
|
|
7537
7989
|
},
|
|
7538
7990
|
{
|
|
@@ -7992,13 +8444,28 @@ var types = [
|
|
|
7992
8444
|
name: "Ciphertext"
|
|
7993
8445
|
},
|
|
7994
8446
|
{
|
|
7995
|
-
name: "
|
|
8447
|
+
name: "ArcisX25519Pubkey"
|
|
7996
8448
|
},
|
|
7997
8449
|
{
|
|
7998
8450
|
name: "PlaintextFloat"
|
|
7999
8451
|
},
|
|
8000
8452
|
{
|
|
8001
8453
|
name: "PlaintextPoint"
|
|
8454
|
+
},
|
|
8455
|
+
{
|
|
8456
|
+
name: "PlaintextI8"
|
|
8457
|
+
},
|
|
8458
|
+
{
|
|
8459
|
+
name: "PlaintextI16"
|
|
8460
|
+
},
|
|
8461
|
+
{
|
|
8462
|
+
name: "PlaintextI32"
|
|
8463
|
+
},
|
|
8464
|
+
{
|
|
8465
|
+
name: "PlaintextI64"
|
|
8466
|
+
},
|
|
8467
|
+
{
|
|
8468
|
+
name: "PlaintextI128"
|
|
8002
8469
|
}
|
|
8003
8470
|
]
|
|
8004
8471
|
}
|
|
@@ -8037,7 +8504,7 @@ var types = [
|
|
|
8037
8504
|
name: "Ciphertext"
|
|
8038
8505
|
},
|
|
8039
8506
|
{
|
|
8040
|
-
name: "
|
|
8507
|
+
name: "ArcisX25519Pubkey"
|
|
8041
8508
|
},
|
|
8042
8509
|
{
|
|
8043
8510
|
name: "ArcisSignature"
|
|
@@ -8046,10 +8513,22 @@ var types = [
|
|
|
8046
8513
|
name: "PlaintextFloat"
|
|
8047
8514
|
},
|
|
8048
8515
|
{
|
|
8049
|
-
name: "
|
|
8516
|
+
name: "PlaintextI8"
|
|
8517
|
+
},
|
|
8518
|
+
{
|
|
8519
|
+
name: "PlaintextI16"
|
|
8050
8520
|
},
|
|
8051
8521
|
{
|
|
8052
|
-
name: "
|
|
8522
|
+
name: "PlaintextI32"
|
|
8523
|
+
},
|
|
8524
|
+
{
|
|
8525
|
+
name: "PlaintextI64"
|
|
8526
|
+
},
|
|
8527
|
+
{
|
|
8528
|
+
name: "PlaintextI128"
|
|
8529
|
+
},
|
|
8530
|
+
{
|
|
8531
|
+
name: "PlaintextPoint"
|
|
8053
8532
|
}
|
|
8054
8533
|
]
|
|
8055
8534
|
}
|
|
@@ -8072,6 +8551,11 @@ var types = [
|
|
|
8072
8551
|
},
|
|
8073
8552
|
{
|
|
8074
8553
|
name: "SetUnset",
|
|
8554
|
+
docs: [
|
|
8555
|
+
"Utility struct to store a value that needs to be set by a certain number of participants (keys",
|
|
8556
|
+
"in our case). Once all participants have set the value, the value is considered set and we only",
|
|
8557
|
+
"store it once."
|
|
8558
|
+
],
|
|
8075
8559
|
generics: [
|
|
8076
8560
|
{
|
|
8077
8561
|
kind: "type",
|
|
@@ -8530,7 +9014,7 @@ var arcium = {
|
|
|
8530
9014
|
types: types
|
|
8531
9015
|
};
|
|
8532
9016
|
|
|
8533
|
-
var
|
|
9017
|
+
var ARCIUM_IDL_MODULE = /*#__PURE__*/Object.freeze({
|
|
8534
9018
|
__proto__: null,
|
|
8535
9019
|
accounts: accounts,
|
|
8536
9020
|
address: address,
|
|
@@ -8542,110 +9026,52 @@ var ARCIUM_IDL = /*#__PURE__*/Object.freeze({
|
|
|
8542
9026
|
types: types
|
|
8543
9027
|
});
|
|
8544
9028
|
|
|
9029
|
+
// Handle both ESM (ts-node wraps as {default: ...}) and bundled (direct) imports
|
|
9030
|
+
const ARCIUM_IDL = (arcium ?? ARCIUM_IDL_MODULE);
|
|
8545
9031
|
/**
|
|
8546
9032
|
* The deployed address of the Arcium program, as specified in the IDL.
|
|
8547
9033
|
*/
|
|
8548
|
-
const ARCIUM_ADDR = address;
|
|
8549
|
-
|
|
8550
|
-
/**
|
|
8551
|
-
* Seed for ClockAccount PDA
|
|
8552
|
-
* @constant {string}
|
|
8553
|
-
*/
|
|
8554
|
-
const CLOCK_ACC_SEED = 'ClockAccount';
|
|
8555
|
-
/**
|
|
8556
|
-
* Seed for FeePool PDA
|
|
8557
|
-
* @constant {string}
|
|
8558
|
-
*/
|
|
8559
|
-
const POOL_ACC_SEED = 'FeePool';
|
|
8560
|
-
/**
|
|
8561
|
-
* Seed for ComputationAccount PDA
|
|
8562
|
-
* @constant {string}
|
|
8563
|
-
*/
|
|
8564
|
-
const COMPUTATION_ACC_SEED = 'ComputationAccount';
|
|
8565
|
-
/**
|
|
8566
|
-
* Seed for Mempool PDA
|
|
8567
|
-
* @constant {string}
|
|
8568
|
-
*/
|
|
8569
|
-
const MEMPOOL_ACC_SEED = 'Mempool';
|
|
8570
|
-
/**
|
|
8571
|
-
* Seed for ExecutingPoolAccount PDA
|
|
8572
|
-
* @constant {string}
|
|
8573
|
-
*/
|
|
8574
|
-
const EXEC_POOL_ACC_SEED = 'Execpool';
|
|
8575
|
-
/**
|
|
8576
|
-
* Seed for ClusterAccount PDA
|
|
8577
|
-
* @constant {string}
|
|
8578
|
-
*/
|
|
8579
|
-
const CLUSTER_ACC_SEED = 'Cluster';
|
|
8580
|
-
/**
|
|
8581
|
-
* Seed for ArxNodeAccount PDA
|
|
8582
|
-
* @constant {string}
|
|
8583
|
-
*/
|
|
8584
|
-
const ARX_NODE_ACC_SEED = 'ArxNode';
|
|
8585
|
-
/**
|
|
8586
|
-
* Seed for MXEAccAccount PDA
|
|
8587
|
-
* @constant {string}
|
|
8588
|
-
*/
|
|
8589
|
-
const MXE_ACC_ACC_SEED = 'MXEAccount';
|
|
8590
|
-
/**
|
|
8591
|
-
* Seed for CompDefAccount PDA
|
|
8592
|
-
* @constant {string}
|
|
8593
|
-
*/
|
|
8594
|
-
const COMP_DEF_ACC_SEED = 'ComputationDefinitionAccount';
|
|
8595
|
-
/**
|
|
8596
|
-
* Maximum number of bytes that can be reallocated per instruction.
|
|
8597
|
-
* @constant {number}
|
|
8598
|
-
*/
|
|
8599
|
-
const MAX_REALLOC_PER_IX = 10240;
|
|
8600
|
-
/**
|
|
8601
|
-
* Maximum number of bytes that can be uploaded in a single transaction with the upload instruction.
|
|
8602
|
-
* @constant {number}
|
|
8603
|
-
*/
|
|
8604
|
-
const MAX_UPLOAD_PER_TX_BYTES = 814;
|
|
8605
|
-
/**
|
|
8606
|
-
* Maximum size of an account in bytes (10MB = 10 * 1024 * 1024).
|
|
8607
|
-
* @constant {number}
|
|
8608
|
-
*/
|
|
8609
|
-
const MAX_ACCOUNT_SIZE = 10485760;
|
|
8610
|
-
/**
|
|
8611
|
-
* Maximum number of arcium embiggen instructions allowed in a single transaction (due to compute unit limits).
|
|
8612
|
-
* @constant {number}
|
|
8613
|
-
*/
|
|
8614
|
-
const MAX_EMBIGGEN_IX_PER_TX = 18;
|
|
9034
|
+
const ARCIUM_ADDR = ARCIUM_IDL.address;
|
|
8615
9035
|
|
|
8616
9036
|
/**
|
|
8617
9037
|
* Returns the public key of the deployed Arcium program on Solana.
|
|
8618
9038
|
* @returns The Arcium program's public key.
|
|
8619
9039
|
*/
|
|
8620
9040
|
function getArciumProgramId() {
|
|
8621
|
-
return new
|
|
9041
|
+
return new anchor__namespace.web3.PublicKey(ARCIUM_ADDR);
|
|
8622
9042
|
}
|
|
8623
9043
|
/**
|
|
8624
|
-
* Derives the computation account address for a given
|
|
8625
|
-
* @param
|
|
8626
|
-
* @param
|
|
9044
|
+
* Derives the computation account address for a given cluster and computation offset.
|
|
9045
|
+
* @param clusterOffset - The offset of the cluster this computation will be executed by.
|
|
9046
|
+
* @param computationOffset - The computation offset as an anchor.BN.
|
|
8627
9047
|
* @returns The derived computation account public key.
|
|
8628
9048
|
*/
|
|
8629
|
-
function getComputationAccAddress(
|
|
8630
|
-
const
|
|
9049
|
+
function getComputationAccAddress(clusterOffset, computationOffset) {
|
|
9050
|
+
const clOffsetBuffer = Buffer.alloc(OFFSET_BUFFER_SIZE);
|
|
9051
|
+
clOffsetBuffer.writeUInt32LE(clusterOffset, 0);
|
|
9052
|
+
const seeds = [Buffer.from(COMPUTATION_ACC_SEED), clOffsetBuffer, computationOffset.toArrayLike(Buffer, 'le', 8)];
|
|
8631
9053
|
return generateArciumPDAFrom(seeds)[0];
|
|
8632
9054
|
}
|
|
8633
9055
|
/**
|
|
8634
|
-
* Derives the mempool account address for a given
|
|
8635
|
-
* @param
|
|
9056
|
+
* Derives the mempool account address for a given cluster.
|
|
9057
|
+
* @param clusterOffset - The offset of the cluster.
|
|
8636
9058
|
* @returns The derived mempool account public key.
|
|
8637
9059
|
*/
|
|
8638
|
-
function getMempoolAccAddress(
|
|
8639
|
-
const
|
|
9060
|
+
function getMempoolAccAddress(clusterOffset) {
|
|
9061
|
+
const clOffsetBuffer = Buffer.alloc(OFFSET_BUFFER_SIZE);
|
|
9062
|
+
clOffsetBuffer.writeUInt32LE(clusterOffset, 0);
|
|
9063
|
+
const seeds = [Buffer.from(MEMPOOL_ACC_SEED), clOffsetBuffer];
|
|
8640
9064
|
return generateArciumPDAFrom(seeds)[0];
|
|
8641
9065
|
}
|
|
8642
9066
|
/**
|
|
8643
|
-
* Derives the executing pool account address for a given
|
|
8644
|
-
* @param
|
|
9067
|
+
* Derives the executing pool account address for a given cluster.
|
|
9068
|
+
* @param clusterOffset - The offset of the cluster.
|
|
8645
9069
|
* @returns The derived executing pool account public key.
|
|
8646
9070
|
*/
|
|
8647
|
-
function getExecutingPoolAccAddress(
|
|
8648
|
-
const
|
|
9071
|
+
function getExecutingPoolAccAddress(clusterOffset) {
|
|
9072
|
+
const clOffsetBuffer = Buffer.alloc(OFFSET_BUFFER_SIZE);
|
|
9073
|
+
clOffsetBuffer.writeUInt32LE(clusterOffset, 0);
|
|
9074
|
+
const seeds = [Buffer.from(EXEC_POOL_ACC_SEED), clOffsetBuffer];
|
|
8649
9075
|
return generateArciumPDAFrom(seeds)[0];
|
|
8650
9076
|
}
|
|
8651
9077
|
/**
|
|
@@ -8666,23 +9092,23 @@ function getClockAccAddress() {
|
|
|
8666
9092
|
}
|
|
8667
9093
|
/**
|
|
8668
9094
|
* Derives the cluster account address for a given offset.
|
|
8669
|
-
* @param
|
|
9095
|
+
* @param clusterOffset - The cluster offset as a number.
|
|
8670
9096
|
* @returns The derived cluster account public key.
|
|
8671
9097
|
*/
|
|
8672
|
-
function getClusterAccAddress(
|
|
8673
|
-
const offsetBuffer = Buffer.alloc(
|
|
8674
|
-
offsetBuffer.writeUInt32LE(
|
|
9098
|
+
function getClusterAccAddress(clusterOffset) {
|
|
9099
|
+
const offsetBuffer = Buffer.alloc(OFFSET_BUFFER_SIZE);
|
|
9100
|
+
offsetBuffer.writeUInt32LE(clusterOffset, 0);
|
|
8675
9101
|
const seeds = [Buffer.from(CLUSTER_ACC_SEED), offsetBuffer];
|
|
8676
9102
|
return generateArciumPDAFrom(seeds)[0];
|
|
8677
9103
|
}
|
|
8678
9104
|
/**
|
|
8679
9105
|
* Derives the ArxNode account address for a given offset.
|
|
8680
|
-
* @param
|
|
9106
|
+
* @param nodeOffset - The ArxNode offset as a number.
|
|
8681
9107
|
* @returns The derived ArxNode account public key.
|
|
8682
9108
|
*/
|
|
8683
|
-
function getArxNodeAccAddress(
|
|
8684
|
-
const offsetBuffer = Buffer.alloc(
|
|
8685
|
-
offsetBuffer.writeUInt32LE(
|
|
9109
|
+
function getArxNodeAccAddress(nodeOffset) {
|
|
9110
|
+
const offsetBuffer = Buffer.alloc(OFFSET_BUFFER_SIZE);
|
|
9111
|
+
offsetBuffer.writeUInt32LE(nodeOffset, 0);
|
|
8686
9112
|
const seeds = [Buffer.from(ARX_NODE_ACC_SEED), offsetBuffer];
|
|
8687
9113
|
return generateArciumPDAFrom(seeds)[0];
|
|
8688
9114
|
}
|
|
@@ -8692,18 +9118,18 @@ function getArxNodeAccAddress(offset) {
|
|
|
8692
9118
|
* @returns The derived MXE account public key.
|
|
8693
9119
|
*/
|
|
8694
9120
|
function getMXEAccAddress(mxeProgramId) {
|
|
8695
|
-
const seeds = [Buffer.from(
|
|
9121
|
+
const seeds = [Buffer.from(MXE_ACCOUNT_SEED), mxeProgramId.toBuffer()];
|
|
8696
9122
|
return generateArciumPDAFrom(seeds)[0];
|
|
8697
9123
|
}
|
|
8698
9124
|
/**
|
|
8699
9125
|
* Derives the computation definition account address for a given MXE program ID and offset.
|
|
8700
9126
|
* @param mxeProgramId - The public key of the MXE program.
|
|
8701
|
-
* @param
|
|
9127
|
+
* @param compDefOffset - The computation definition offset as a number.
|
|
8702
9128
|
* @returns The derived computation definition account public key.
|
|
8703
9129
|
*/
|
|
8704
|
-
function getCompDefAccAddress(mxeProgramId,
|
|
8705
|
-
const offsetBuffer = Buffer.alloc(
|
|
8706
|
-
offsetBuffer.writeUInt32LE(
|
|
9130
|
+
function getCompDefAccAddress(mxeProgramId, compDefOffset) {
|
|
9131
|
+
const offsetBuffer = Buffer.alloc(OFFSET_BUFFER_SIZE);
|
|
9132
|
+
offsetBuffer.writeUInt32LE(compDefOffset, 0);
|
|
8707
9133
|
const seeds = [Buffer.from(COMP_DEF_ACC_SEED), mxeProgramId.toBuffer(), offsetBuffer];
|
|
8708
9134
|
return generateArciumPDAFrom(seeds)[0];
|
|
8709
9135
|
}
|
|
@@ -8818,25 +9244,18 @@ const EXECPOOL_DISCRIMINATOR_MAP = {
|
|
|
8818
9244
|
[LARGE_EXECPOOL_DISCRIMINATOR.toString()]: LARGE_EXECPOOL_ACC_NAME,
|
|
8819
9245
|
};
|
|
8820
9246
|
/**
|
|
8821
|
-
*
|
|
8822
|
-
* @returns The Arcium program's public key.
|
|
8823
|
-
*/
|
|
8824
|
-
function getArciumProgAddress() {
|
|
8825
|
-
return new anchor__namespace.web3.PublicKey(ARCIUM_ADDR);
|
|
8826
|
-
}
|
|
8827
|
-
/**
|
|
8828
|
-
* Fetches and decodes the mempool account data for any mempool account size.
|
|
9247
|
+
* Fetches and decodes the mempool account info for any mempool account size.
|
|
8829
9248
|
* @param provider - The Anchor provider to use for fetching accounts.
|
|
8830
9249
|
* @param mempoolAccPubkey - The public key of the mempool account.
|
|
8831
|
-
* @returns The decoded mempool account
|
|
9250
|
+
* @returns The decoded mempool account info.
|
|
8832
9251
|
* @throws Error if the account cannot be fetched or the discriminator is unknown.
|
|
8833
9252
|
*/
|
|
8834
|
-
async function
|
|
9253
|
+
async function getMempoolAccInfo(provider, mempoolAccPubkey) {
|
|
8835
9254
|
const accData = await provider.connection.getAccountInfo(mempoolAccPubkey);
|
|
8836
9255
|
if (accData === null) {
|
|
8837
9256
|
throw new Error(`Failed to fetch mempool account ${mempoolAccPubkey.toBase58()}`);
|
|
8838
9257
|
}
|
|
8839
|
-
const discriminator = Array.from(accData.data.subarray(0,
|
|
9258
|
+
const discriminator = Array.from(accData.data.subarray(0, DISCRIMINATOR_SIZE)).toString();
|
|
8840
9259
|
const accName = MEMPOOL_DISCRIMINATOR_MAP[discriminator];
|
|
8841
9260
|
if (accName === undefined) {
|
|
8842
9261
|
throw new Error(`Unknown mempool account discriminator: ${discriminator}`);
|
|
@@ -8845,18 +9264,18 @@ async function getMempoolAccData(provider, mempoolAccPubkey) {
|
|
|
8845
9264
|
return program.coder.accounts.decode(accName, accData.data);
|
|
8846
9265
|
}
|
|
8847
9266
|
/**
|
|
8848
|
-
* Fetches and decodes the executing pool account
|
|
9267
|
+
* Fetches and decodes the executing pool account info for any pool size.
|
|
8849
9268
|
* @param provider - The Anchor provider to use for fetching accounts.
|
|
8850
9269
|
* @param executingPoolAccPubkey - The public key of the executing pool account.
|
|
8851
|
-
* @returns The decoded executing pool account
|
|
9270
|
+
* @returns The decoded executing pool account info.
|
|
8852
9271
|
* @throws Error if the account cannot be fetched or the discriminator is unknown.
|
|
8853
9272
|
*/
|
|
8854
|
-
async function
|
|
9273
|
+
async function getExecutingPoolAccInfo(provider, executingPoolAccPubkey) {
|
|
8855
9274
|
const accData = await provider.connection.getAccountInfo(executingPoolAccPubkey);
|
|
8856
9275
|
if (accData === null) {
|
|
8857
9276
|
throw new Error(`Failed to fetch executing pool account ${executingPoolAccPubkey.toBase58()}`);
|
|
8858
9277
|
}
|
|
8859
|
-
const discriminator = Array.from(accData.data.subarray(0,
|
|
9278
|
+
const discriminator = Array.from(accData.data.subarray(0, DISCRIMINATOR_SIZE)).toString();
|
|
8860
9279
|
const accName = EXECPOOL_DISCRIMINATOR_MAP[discriminator];
|
|
8861
9280
|
if (accName === undefined) {
|
|
8862
9281
|
throw new Error(`Unknown executing pool account discriminator: ${discriminator}`);
|
|
@@ -8865,70 +9284,129 @@ async function getExecutingPoolAccData(provider, executingPoolAccPubkey) {
|
|
|
8865
9284
|
return program.coder.accounts.decode(accName, accData.data);
|
|
8866
9285
|
}
|
|
8867
9286
|
/**
|
|
8868
|
-
*
|
|
8869
|
-
*
|
|
8870
|
-
* @param
|
|
8871
|
-
* @
|
|
9287
|
+
* Returns all computation references in the mempool for a given account.
|
|
9288
|
+
* Only non-stake computations are included.
|
|
9289
|
+
* @param arciumProgram - The Anchor program instance.
|
|
9290
|
+
* @param address - The public key of the mempool account.
|
|
9291
|
+
* @returns Array of ComputationReference objects.
|
|
8872
9292
|
*/
|
|
8873
|
-
async function
|
|
8874
|
-
const
|
|
8875
|
-
const
|
|
8876
|
-
const
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
9293
|
+
async function getComputationsInMempool(arciumProgram, address) {
|
|
9294
|
+
const mempool = await getMempoolAccInfo(arciumProgram.provider, address);
|
|
9295
|
+
const startIndex = mempool.inner.computations.startIndex;
|
|
9296
|
+
const length = mempool.inner.computations.length;
|
|
9297
|
+
const elems = mempool.inner.computations.elems;
|
|
9298
|
+
function isValid(validBits, idx) {
|
|
9299
|
+
const byte = idx >>> 3;
|
|
9300
|
+
const bit = idx & 7;
|
|
9301
|
+
if (byte >= validBits.length) {
|
|
9302
|
+
// This should never happen, so we'll want to know about it
|
|
9303
|
+
throw new Error(`isValid: byte ${byte} >= validBits.length ${validBits.length}`);
|
|
9304
|
+
}
|
|
9305
|
+
return (validBits[byte] & (1 << bit)) !== 0;
|
|
8880
9306
|
}
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
9307
|
+
// Handle circular buffer wraparound
|
|
9308
|
+
const refs = [];
|
|
9309
|
+
for (let i = 0; i < length; i++) {
|
|
9310
|
+
const idx = (startIndex + i) % elems.length;
|
|
9311
|
+
// Only save non-stake computations
|
|
9312
|
+
if (isValid(mempool.inner.computations.validBits, idx)) {
|
|
9313
|
+
refs.push(...elems[idx].entries);
|
|
8885
9314
|
}
|
|
8886
9315
|
}
|
|
8887
|
-
return
|
|
9316
|
+
return refs
|
|
9317
|
+
.flat()
|
|
9318
|
+
.filter((ref) => !isNullRef(ref));
|
|
8888
9319
|
}
|
|
8889
9320
|
/**
|
|
8890
|
-
*
|
|
9321
|
+
* Calculates priority fee statistics for computations in a mempool.
|
|
9322
|
+
* @param arciumProgram - The Anchor program instance.
|
|
9323
|
+
* @param mempoolAddress - The public key of the mempool account.
|
|
9324
|
+
* @returns Priority fee statistics (mean, median, min, max, count).
|
|
9325
|
+
*/
|
|
9326
|
+
async function getMempoolPriorityFeeStats(arciumProgram, mempoolAddress) {
|
|
9327
|
+
const refs = await getComputationsInMempool(arciumProgram, mempoolAddress);
|
|
9328
|
+
if (refs.length === 0) {
|
|
9329
|
+
const zero = new anchor__namespace.BN(0);
|
|
9330
|
+
return { mean: zero, median: zero, min: zero, max: zero, count: 0 };
|
|
9331
|
+
}
|
|
9332
|
+
const fees = refs.map(ref => ref.priorityFee).sort((a, b) => a.cmp(b));
|
|
9333
|
+
const sum = fees.reduce((acc, fee) => acc.add(fee), new anchor__namespace.BN(0));
|
|
9334
|
+
const mean = sum.div(new anchor__namespace.BN(fees.length));
|
|
9335
|
+
const mid = Math.floor(fees.length / 2);
|
|
9336
|
+
const median = fees.length % 2 === 0
|
|
9337
|
+
? fees[mid - 1].add(fees[mid]).div(new anchor__namespace.BN(2))
|
|
9338
|
+
: fees[mid];
|
|
9339
|
+
return {
|
|
9340
|
+
mean,
|
|
9341
|
+
median,
|
|
9342
|
+
min: fees[0],
|
|
9343
|
+
max: fees[fees.length - 1],
|
|
9344
|
+
count: fees.length,
|
|
9345
|
+
};
|
|
9346
|
+
}
|
|
9347
|
+
/**
|
|
9348
|
+
* Helper function to fetch a specific utility key from the MXE account.
|
|
8891
9349
|
* @param provider - The Anchor provider to use for fetching accounts.
|
|
8892
|
-
* @param
|
|
8893
|
-
* @
|
|
9350
|
+
* @param mxeProgramId - The public key of the MXE program.
|
|
9351
|
+
* @param field - The field name to extract ('x25519Pubkey' or 'ed25519VerifyingKey').
|
|
9352
|
+
* @returns The utility key as a Uint8Array, or null if not set.
|
|
8894
9353
|
*/
|
|
8895
|
-
async function
|
|
9354
|
+
async function getMXEUtilityKey(provider, mxeProgramId, field) {
|
|
8896
9355
|
const program = getArciumProgram(provider);
|
|
8897
|
-
const mxeAccAddress = getMXEAccAddress(
|
|
9356
|
+
const mxeAccAddress = getMXEAccAddress(mxeProgramId);
|
|
8898
9357
|
const mxeAccInfo = await program.account.mxeAccount.fetch(mxeAccAddress);
|
|
8899
9358
|
if ('set' in mxeAccInfo.utilityPubkeys) {
|
|
8900
9359
|
const setData = mxeAccInfo.utilityPubkeys.set;
|
|
8901
|
-
return new Uint8Array(setData[0]
|
|
9360
|
+
return new Uint8Array(setData[0][field]);
|
|
8902
9361
|
}
|
|
8903
9362
|
else if ('unset' in mxeAccInfo.utilityPubkeys) {
|
|
8904
9363
|
const unsetData = mxeAccInfo.utilityPubkeys.unset;
|
|
8905
9364
|
if (unsetData[1].every(Boolean)) {
|
|
8906
|
-
return new Uint8Array(unsetData[0]
|
|
9365
|
+
return new Uint8Array(unsetData[0][field]);
|
|
8907
9366
|
}
|
|
8908
9367
|
}
|
|
8909
9368
|
return null;
|
|
8910
9369
|
}
|
|
9370
|
+
/**
|
|
9371
|
+
* Fetches and extracts the MXE x25519 public key from the MXE account.
|
|
9372
|
+
* @param provider - The Anchor provider to use for fetching accounts.
|
|
9373
|
+
* @param mxeProgramId - The public key of the MXE program.
|
|
9374
|
+
* @returns The MXE's x25519 public key as a Uint8Array, or null if not set.
|
|
9375
|
+
*/
|
|
9376
|
+
async function getMXEPublicKey(provider, mxeProgramId) {
|
|
9377
|
+
return getMXEUtilityKey(provider, mxeProgramId, 'x25519Pubkey');
|
|
9378
|
+
}
|
|
9379
|
+
/**
|
|
9380
|
+
* Fetches and extracts the MXE arcis ed25519 verifying key from the MXE account.
|
|
9381
|
+
* @param provider - The Anchor provider to use for fetching accounts.
|
|
9382
|
+
* @param mxeProgramId - The public key of the MXE program.
|
|
9383
|
+
* @returns The MXE's arcis ed25519 verifying key as a Uint8Array, or null if not set.
|
|
9384
|
+
*/
|
|
9385
|
+
async function getMXEArcisEd25519VerifyingKey(provider, mxeProgramId) {
|
|
9386
|
+
return getMXEUtilityKey(provider, mxeProgramId, 'ed25519VerifyingKey');
|
|
9387
|
+
}
|
|
8911
9388
|
/**
|
|
8912
9389
|
* Uploads a circuit to the blockchain, splitting it into multiple accounts if necessary.
|
|
8913
9390
|
* @param provider - The Anchor provider to use for transactions.
|
|
8914
9391
|
* @param circuitName - The name of the circuit.
|
|
8915
|
-
* @param
|
|
9392
|
+
* @param mxeProgramId - The public key of the MXE program.
|
|
8916
9393
|
* @param rawCircuit - The raw circuit data as a Uint8Array.
|
|
8917
9394
|
* @param logging - Whether to log progress (default: true).
|
|
8918
9395
|
* @param chunkSize - The number of upload transactions to send in parallel (default: 500).
|
|
8919
9396
|
* @returns An array of transaction signatures for all upload and finalize transactions.
|
|
8920
9397
|
*/
|
|
8921
|
-
async function uploadCircuit(provider, circuitName,
|
|
9398
|
+
async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, logging = true, chunkSize = 500) {
|
|
9399
|
+
// 9 = 8-byte discriminator + 1-byte bump for ComputationDefinitionRaw account
|
|
8922
9400
|
const numAccs = Math.ceil(rawCircuit.length / (MAX_ACCOUNT_SIZE - 9));
|
|
8923
|
-
const compDefAccInfo = getCompDefAccInfo(circuitName,
|
|
9401
|
+
const compDefAccInfo = getCompDefAccInfo(circuitName, mxeProgramId);
|
|
8924
9402
|
const program = getArciumProgram(provider);
|
|
8925
9403
|
const sigs = [];
|
|
8926
9404
|
const uploadPromises = [];
|
|
8927
9405
|
for (let i = 0; i < numAccs; i++) {
|
|
8928
|
-
uploadPromises.push(uploadToCircuitAcc(provider, program, rawCircuit.subarray(i * (MAX_ACCOUNT_SIZE - 9), (i + 1) * (MAX_ACCOUNT_SIZE - 9)), i, compDefAccInfo,
|
|
9406
|
+
uploadPromises.push(uploadToCircuitAcc(provider, program, rawCircuit.subarray(i * (MAX_ACCOUNT_SIZE - 9), (i + 1) * (MAX_ACCOUNT_SIZE - 9)), i, compDefAccInfo, mxeProgramId, logging, chunkSize));
|
|
8929
9407
|
}
|
|
8930
9408
|
sigs.push(...(await Promise.all(uploadPromises)).flat());
|
|
8931
|
-
const finalizeCompDefTx = await buildFinalizeCompDefTx(provider, compDefAccInfo.offset,
|
|
9409
|
+
const finalizeCompDefTx = await buildFinalizeCompDefTx(provider, compDefAccInfo.offset, mxeProgramId);
|
|
8932
9410
|
sigs.push(await signAndSendWithBlockhash(provider, finalizeCompDefTx, await provider.connection.getLatestBlockhash()));
|
|
8933
9411
|
return sigs;
|
|
8934
9412
|
}
|
|
@@ -8936,24 +9414,24 @@ async function uploadCircuit(provider, circuitName, mxeProgramID, rawCircuit, lo
|
|
|
8936
9414
|
* Builds a transaction to finalize a computation definition.
|
|
8937
9415
|
* @param provider - The Anchor provider to use for transactions.
|
|
8938
9416
|
* @param compDefOffset - The offset of the computation definition.
|
|
8939
|
-
* @param
|
|
9417
|
+
* @param mxeProgramId - The public key of the MXE program.
|
|
8940
9418
|
* @returns The transaction to finalize the computation definition.
|
|
8941
9419
|
*/
|
|
8942
|
-
async function buildFinalizeCompDefTx(provider, compDefOffset,
|
|
9420
|
+
async function buildFinalizeCompDefTx(provider, compDefOffset, mxeProgramId) {
|
|
8943
9421
|
const program = getArciumProgram(provider);
|
|
8944
|
-
const compDefOffsetBuffer = Buffer.alloc(
|
|
9422
|
+
const compDefOffsetBuffer = Buffer.alloc(OFFSET_BUFFER_SIZE);
|
|
8945
9423
|
compDefOffsetBuffer.writeUInt32LE(compDefOffset, 0);
|
|
8946
9424
|
return program.methods
|
|
8947
|
-
.finalizeComputationDefinition(compDefOffset,
|
|
9425
|
+
.finalizeComputationDefinition(compDefOffset, mxeProgramId)
|
|
8948
9426
|
.accounts({
|
|
8949
9427
|
signer: provider.publicKey,
|
|
8950
9428
|
})
|
|
8951
9429
|
.transaction();
|
|
8952
9430
|
}
|
|
8953
|
-
async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitIndex, compDefAccInfo,
|
|
9431
|
+
async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitIndex, compDefAccInfo, mxeProgramId, shouldLog = true, chunkSize = 500) {
|
|
8954
9432
|
const sigs = [];
|
|
8955
9433
|
const initTx = await program.methods
|
|
8956
|
-
.initRawCircuitAcc(compDefAccInfo.offset,
|
|
9434
|
+
.initRawCircuitAcc(compDefAccInfo.offset, mxeProgramId, rawCircuitIndex)
|
|
8957
9435
|
.accounts({
|
|
8958
9436
|
signer: provider.publicKey,
|
|
8959
9437
|
})
|
|
@@ -8966,7 +9444,7 @@ async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitI
|
|
|
8966
9444
|
for (let i = 0; i < nonAsyncTxCount; i++) {
|
|
8967
9445
|
optionalLog(shouldLog, `Sending resize tx ${i} of ${nonAsyncTxCount}`);
|
|
8968
9446
|
// eslint-disable-next-line no-await-in-loop
|
|
8969
|
-
const tx = await buildResizeTx(program, provider.publicKey, compDefAccInfo,
|
|
9447
|
+
const tx = await buildResizeTx(program, provider.publicKey, compDefAccInfo, mxeProgramId, rawCircuitIndex, MAX_REALLOC_PER_IX
|
|
8970
9448
|
+ i * (MAX_REALLOC_PER_IX * MAX_EMBIGGEN_IX_PER_TX), rawCircuitPart.length);
|
|
8971
9449
|
// eslint-disable-next-line no-await-in-loop
|
|
8972
9450
|
const blockInfo = await provider.connection.getLatestBlockhash();
|
|
@@ -8989,7 +9467,7 @@ async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitI
|
|
|
8989
9467
|
for (let j = 0; j < currentChunkSize; j++) {
|
|
8990
9468
|
const offset = MAX_UPLOAD_PER_TX_BYTES * (i + j);
|
|
8991
9469
|
// eslint-disable-next-line no-await-in-loop
|
|
8992
|
-
const tx = await buildUploadCircuitTx(program, provider.publicKey, compDefAccInfo,
|
|
9470
|
+
const tx = await buildUploadCircuitTx(program, provider.publicKey, compDefAccInfo, mxeProgramId, Buffer.copyBytesFrom(rawCircuitPart, offset, MAX_UPLOAD_PER_TX_BYTES), offset, rawCircuitIndex);
|
|
8993
9471
|
chunkPromises.push(signAndSendWithBlockhash(provider, tx, blockInfo));
|
|
8994
9472
|
}
|
|
8995
9473
|
// Wait for the current chunk to complete before proceeding
|
|
@@ -9000,9 +9478,9 @@ async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitI
|
|
|
9000
9478
|
}
|
|
9001
9479
|
return sigs.concat(remainingTxs);
|
|
9002
9480
|
}
|
|
9003
|
-
async function buildResizeTx(program, signerPubkey, compDefAccInfo,
|
|
9481
|
+
async function buildResizeTx(program, signerPubkey, compDefAccInfo, mxeProgramId, rawCircuitIndex, currentSize, requiredSize) {
|
|
9004
9482
|
const ix = await program.methods
|
|
9005
|
-
.embiggenRawCircuitAcc(compDefAccInfo.offset,
|
|
9483
|
+
.embiggenRawCircuitAcc(compDefAccInfo.offset, mxeProgramId, rawCircuitIndex)
|
|
9006
9484
|
.accounts({
|
|
9007
9485
|
signer: signerPubkey,
|
|
9008
9486
|
})
|
|
@@ -9016,9 +9494,9 @@ async function buildResizeTx(program, signerPubkey, compDefAccInfo, mxeProgramID
|
|
|
9016
9494
|
}
|
|
9017
9495
|
return tx;
|
|
9018
9496
|
}
|
|
9019
|
-
async function buildUploadCircuitTx(program, signerPubkey, compDefAccInfo,
|
|
9497
|
+
async function buildUploadCircuitTx(program, signerPubkey, compDefAccInfo, mxeProgramId, bytes, circuitOffset, rawCircuitIndex) {
|
|
9020
9498
|
if (bytes.length > MAX_UPLOAD_PER_TX_BYTES) {
|
|
9021
|
-
throw new Error(
|
|
9499
|
+
throw new Error(`Upload circuit bytes must be ${MAX_UPLOAD_PER_TX_BYTES} bytes or less per tx`);
|
|
9022
9500
|
}
|
|
9023
9501
|
let bytesInner = bytes;
|
|
9024
9502
|
if (bytesInner.length < MAX_UPLOAD_PER_TX_BYTES) {
|
|
@@ -9027,7 +9505,7 @@ async function buildUploadCircuitTx(program, signerPubkey, compDefAccInfo, mxePr
|
|
|
9027
9505
|
bytesInner = paddedBytes;
|
|
9028
9506
|
}
|
|
9029
9507
|
return program.methods
|
|
9030
|
-
.uploadCircuit(compDefAccInfo.offset,
|
|
9508
|
+
.uploadCircuit(compDefAccInfo.offset, mxeProgramId, rawCircuitIndex, Array.from(bytesInner), circuitOffset)
|
|
9031
9509
|
.accounts({
|
|
9032
9510
|
signer: signerPubkey,
|
|
9033
9511
|
})
|
|
@@ -9055,7 +9533,7 @@ function getArciumAccountBaseSeed(accName) {
|
|
|
9055
9533
|
*/
|
|
9056
9534
|
function getCompDefAccOffset(circuitName) {
|
|
9057
9535
|
const hash = new Uint8Array(sha256([Buffer.from(circuitName, 'utf-8')]));
|
|
9058
|
-
return hash.slice(0,
|
|
9536
|
+
return hash.slice(0, COMP_DEF_OFFSET_SIZE);
|
|
9059
9537
|
}
|
|
9060
9538
|
/**
|
|
9061
9539
|
* Returns an Anchor program instance for the Arcium program.
|
|
@@ -9065,45 +9543,26 @@ function getCompDefAccOffset(circuitName) {
|
|
|
9065
9543
|
function getArciumProgram(provider) {
|
|
9066
9544
|
return new anchor.Program(ARCIUM_IDL, provider);
|
|
9067
9545
|
}
|
|
9068
|
-
/**
|
|
9069
|
-
* Returns a read-only Anchor program instance for the Arcium program.
|
|
9070
|
-
* @param provider - The Anchor provider to use.
|
|
9071
|
-
* @returns The Anchor program instance for Arcium.
|
|
9072
|
-
*/
|
|
9073
|
-
function getArciumProgramReadonly(provider) {
|
|
9074
|
-
return new anchor.Program(ARCIUM_IDL, provider);
|
|
9075
|
-
}
|
|
9076
|
-
/**
|
|
9077
|
-
* Returns the PDA (program-derived address) for an ArxNode account given the program ID and node offset.
|
|
9078
|
-
* @param arciumProgramID - The public key of the Arcium program.
|
|
9079
|
-
* @param nodeOffset - The offset of the node.
|
|
9080
|
-
* @returns The PDA for the ArxNode account.
|
|
9081
|
-
*/
|
|
9082
|
-
function getArxAccPDA(arciumProgramID, nodeOffset) {
|
|
9083
|
-
const nodeOffsetBuffer = Buffer.alloc(4);
|
|
9084
|
-
nodeOffsetBuffer.writeUInt32LE(nodeOffset, 0);
|
|
9085
|
-
return anchor__namespace.web3.PublicKey.findProgramAddressSync([Buffer.from('ArxNode', 'utf-8'), nodeOffsetBuffer], arciumProgramID)[0];
|
|
9086
|
-
}
|
|
9087
9546
|
/**
|
|
9088
9547
|
* Returns the public key and offset for a computation definition account, given the circuit name and MXE program ID.
|
|
9089
9548
|
* @param circuitName - The name of the circuit.
|
|
9090
|
-
* @param
|
|
9549
|
+
* @param mxeProgramId - The public key of the MXE program.
|
|
9091
9550
|
* @returns An object containing the public key and offset for the computation definition account.
|
|
9092
9551
|
*/
|
|
9093
|
-
function getCompDefAccInfo(circuitName,
|
|
9552
|
+
function getCompDefAccInfo(circuitName, mxeProgramId) {
|
|
9094
9553
|
const offset = getCompDefAccOffset(circuitName);
|
|
9095
|
-
const pda = getCompDefAccPDA(
|
|
9554
|
+
const pda = getCompDefAccPDA(getArciumProgramId(), mxeProgramId, offset);
|
|
9096
9555
|
return { pubkey: pda, offset: Buffer.from(offset).readUInt32LE(0) };
|
|
9097
9556
|
}
|
|
9098
9557
|
/**
|
|
9099
9558
|
* Returns the PDA for a computation definition account, given the program ID, MXE program ID, and offset.
|
|
9100
|
-
* @param
|
|
9101
|
-
* @param
|
|
9559
|
+
* @param arciumProgramId - The public key of the Arcium program.
|
|
9560
|
+
* @param mxeProgramId - The public key of the MXE program.
|
|
9102
9561
|
* @param offset - The offset as a Uint8Array.
|
|
9103
9562
|
* @returns The PDA for the computation definition account.
|
|
9104
9563
|
*/
|
|
9105
|
-
function getCompDefAccPDA(
|
|
9106
|
-
return anchor__namespace.web3.PublicKey.findProgramAddressSync([Buffer.from(
|
|
9564
|
+
function getCompDefAccPDA(arciumProgramId, mxeProgramId, offset) {
|
|
9565
|
+
return anchor__namespace.web3.PublicKey.findProgramAddressSync([Buffer.from(COMP_DEF_ACC_SEED, 'utf-8'), mxeProgramId.toBuffer(), offset], arciumProgramId)[0];
|
|
9107
9566
|
}
|
|
9108
9567
|
|
|
9109
9568
|
/**
|
|
@@ -9116,13 +9575,13 @@ function getArciumEnv() {
|
|
|
9116
9575
|
if (isBrowser()) {
|
|
9117
9576
|
throw new Error('Arcium local env is not available in browser.');
|
|
9118
9577
|
}
|
|
9119
|
-
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
9120
|
-
const process = require('process');
|
|
9121
9578
|
try {
|
|
9122
|
-
|
|
9123
|
-
|
|
9579
|
+
const arciumClusterOffset = Number(process.env.ARCIUM_CLUSTER_OFFSET);
|
|
9580
|
+
if (isNaN(arciumClusterOffset)) {
|
|
9581
|
+
throw new Error('ARCIUM_CLUSTER_OFFSET environment variable is not set or is invalid (NaN).');
|
|
9582
|
+
}
|
|
9124
9583
|
return {
|
|
9125
|
-
|
|
9584
|
+
arciumClusterOffset,
|
|
9126
9585
|
};
|
|
9127
9586
|
}
|
|
9128
9587
|
catch (e) {
|
|
@@ -9188,25 +9647,25 @@ exports.deserializeLE = deserializeLE;
|
|
|
9188
9647
|
exports.generateRandomFieldElem = generateRandomFieldElem;
|
|
9189
9648
|
exports.getArciumAccountBaseSeed = getArciumAccountBaseSeed;
|
|
9190
9649
|
exports.getArciumEnv = getArciumEnv;
|
|
9191
|
-
exports.getArciumProgAddress = getArciumProgAddress;
|
|
9192
9650
|
exports.getArciumProgram = getArciumProgram;
|
|
9193
9651
|
exports.getArciumProgramId = getArciumProgramId;
|
|
9194
|
-
exports.getArciumProgramReadonly = getArciumProgramReadonly;
|
|
9195
|
-
exports.getArxAccPDA = getArxAccPDA;
|
|
9196
9652
|
exports.getArxNodeAccAddress = getArxNodeAccAddress;
|
|
9197
9653
|
exports.getClockAccAddress = getClockAccAddress;
|
|
9198
9654
|
exports.getClusterAccAddress = getClusterAccAddress;
|
|
9199
9655
|
exports.getCompDefAccAddress = getCompDefAccAddress;
|
|
9200
9656
|
exports.getCompDefAccOffset = getCompDefAccOffset;
|
|
9201
9657
|
exports.getComputationAccAddress = getComputationAccAddress;
|
|
9658
|
+
exports.getComputationsInMempool = getComputationsInMempool;
|
|
9202
9659
|
exports.getExecutingPoolAccAddress = getExecutingPoolAccAddress;
|
|
9203
|
-
exports.
|
|
9660
|
+
exports.getExecutingPoolAccInfo = getExecutingPoolAccInfo;
|
|
9204
9661
|
exports.getFeePoolAccAddress = getFeePoolAccAddress;
|
|
9205
9662
|
exports.getMXEAccAddress = getMXEAccAddress;
|
|
9206
9663
|
exports.getMXEArcisEd25519VerifyingKey = getMXEArcisEd25519VerifyingKey;
|
|
9207
9664
|
exports.getMXEPublicKey = getMXEPublicKey;
|
|
9208
9665
|
exports.getMempoolAccAddress = getMempoolAccAddress;
|
|
9209
|
-
exports.
|
|
9666
|
+
exports.getMempoolAccInfo = getMempoolAccInfo;
|
|
9667
|
+
exports.getMempoolPriorityFeeStats = getMempoolPriorityFeeStats;
|
|
9668
|
+
exports.isNullRef = isNullRef;
|
|
9210
9669
|
exports.positiveModulo = positiveModulo;
|
|
9211
9670
|
exports.randMatrix = randMatrix;
|
|
9212
9671
|
exports.serializeLE = serializeLE;
|