@arcium-hq/client 0.10.4 → 0.11.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 +1 -2
- package/build/index.cjs +1454 -281
- package/build/index.mjs +1453 -284
- package/build/types/constants.d.ts +55 -0
- package/build/types/constants.d.ts.map +1 -1
- package/build/types/idl/arcium.d.ts +1301 -213
- package/build/types/idl/arcium.d.ts.map +1 -1
- package/build/types/idl/arcium_staking.d.ts +4301 -1750
- package/build/types/idl/arcium_staking.d.ts.map +1 -1
- package/build/types/idlAccounts.d.ts +14 -0
- package/build/types/idlAccounts.d.ts.map +1 -0
- package/build/types/onchain.d.ts +17 -4
- package/build/types/onchain.d.ts.map +1 -1
- package/build/types/pda.d.ts +29 -1
- package/build/types/pda.d.ts.map +1 -1
- package/build/types/rawCircuit.d.ts +5 -0
- package/build/types/rawCircuit.d.ts.map +1 -0
- package/build/types/recoveryPeers.d.ts +8 -0
- package/build/types/recoveryPeers.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/constants.ts +55 -0
- package/src/idl/arcium.json +1299 -211
- package/src/idl/arcium.ts +1299 -211
- package/src/idl/arcium_staking.json +4518 -1967
- package/src/idl/arcium_staking.ts +4518 -1967
- package/src/idlAccounts.ts +79 -0
- package/src/onchain.ts +62 -177
- package/src/pda.ts +103 -64
- package/src/rawCircuit.ts +41 -0
- package/src/recoveryPeers.ts +46 -0
package/build/index.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import { randomBytes as randomBytes$1 } from '@noble/hashes/utils';
|
|
|
7
7
|
import { twistedEdwards } from '@noble/curves/abstract/edwards';
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
import * as anchor from '@anchor-lang/core';
|
|
10
|
-
import { Program } from '@anchor-lang/core';
|
|
11
|
-
import {
|
|
10
|
+
import anchor__default, { BorshCoder, convertIdlToCamelCase, Program } from '@anchor-lang/core';
|
|
11
|
+
import { AddressLookupTableProgram, PublicKey } from '@solana/web3.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Scalar field prime modulus for Curve25519: 2^252 + 27742317777372353535851937790883648493
|
|
@@ -1864,7 +1864,7 @@ function createPacker(fields, typeName = 'Packer') {
|
|
|
1864
1864
|
var address = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
|
|
1865
1865
|
var metadata = {
|
|
1866
1866
|
name: "arcium",
|
|
1867
|
-
version: "0.
|
|
1867
|
+
version: "0.11.0",
|
|
1868
1868
|
spec: "0.1.0",
|
|
1869
1869
|
description: "The Arcium program"
|
|
1870
1870
|
};
|
|
@@ -2155,6 +2155,84 @@ var instructions = [
|
|
|
2155
2155
|
}
|
|
2156
2156
|
]
|
|
2157
2157
|
},
|
|
2158
|
+
{
|
|
2159
|
+
name: "bind_recovery_peer_migration",
|
|
2160
|
+
discriminator: [
|
|
2161
|
+
30,
|
|
2162
|
+
148,
|
|
2163
|
+
4,
|
|
2164
|
+
206,
|
|
2165
|
+
139,
|
|
2166
|
+
2,
|
|
2167
|
+
55,
|
|
2168
|
+
156
|
|
2169
|
+
],
|
|
2170
|
+
accounts: [
|
|
2171
|
+
{
|
|
2172
|
+
name: "authority",
|
|
2173
|
+
docs: [
|
|
2174
|
+
"The recovery peer's `authority` — same dual role as in `MigrateArxNode`: it authorizes the",
|
|
2175
|
+
"bind and is the owner of `primary_stake_account`."
|
|
2176
|
+
],
|
|
2177
|
+
signer: true
|
|
2178
|
+
},
|
|
2179
|
+
{
|
|
2180
|
+
name: "recovery_peer_account",
|
|
2181
|
+
docs: [
|
|
2182
|
+
"Must already be layout-migrated (`migrate_recovery_peer`) so the appended",
|
|
2183
|
+
"`primary_stake_account` field exists; otherwise the zero-copy load fails on the short",
|
|
2184
|
+
"account. Bundle `migrate_recovery_peer` ahead of this instruction in the same transaction."
|
|
2185
|
+
],
|
|
2186
|
+
writable: true,
|
|
2187
|
+
pda: {
|
|
2188
|
+
seeds: [
|
|
2189
|
+
{
|
|
2190
|
+
kind: "const",
|
|
2191
|
+
value: [
|
|
2192
|
+
82,
|
|
2193
|
+
101,
|
|
2194
|
+
99,
|
|
2195
|
+
111,
|
|
2196
|
+
118,
|
|
2197
|
+
101,
|
|
2198
|
+
114,
|
|
2199
|
+
121,
|
|
2200
|
+
80,
|
|
2201
|
+
101,
|
|
2202
|
+
101,
|
|
2203
|
+
114,
|
|
2204
|
+
65,
|
|
2205
|
+
99,
|
|
2206
|
+
99,
|
|
2207
|
+
111,
|
|
2208
|
+
117,
|
|
2209
|
+
110,
|
|
2210
|
+
116
|
|
2211
|
+
]
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
kind: "arg",
|
|
2215
|
+
path: "peer_offset"
|
|
2216
|
+
}
|
|
2217
|
+
]
|
|
2218
|
+
}
|
|
2219
|
+
},
|
|
2220
|
+
{
|
|
2221
|
+
name: "primary_stake_account",
|
|
2222
|
+
writable: true
|
|
2223
|
+
},
|
|
2224
|
+
{
|
|
2225
|
+
name: "arcium_staking_program",
|
|
2226
|
+
address: "ArcStnN9zZZVB5WjgPhLHjYpY7Gb29mzb96ySsb1kxgq"
|
|
2227
|
+
}
|
|
2228
|
+
],
|
|
2229
|
+
args: [
|
|
2230
|
+
{
|
|
2231
|
+
name: "peer_offset",
|
|
2232
|
+
type: "u32"
|
|
2233
|
+
}
|
|
2234
|
+
]
|
|
2235
|
+
},
|
|
2158
2236
|
{
|
|
2159
2237
|
name: "bump_epoch_cluster",
|
|
2160
2238
|
discriminator: [
|
|
@@ -2268,6 +2346,7 @@ var instructions = [
|
|
|
2268
2346
|
},
|
|
2269
2347
|
{
|
|
2270
2348
|
name: "mxe",
|
|
2349
|
+
writable: true,
|
|
2271
2350
|
pda: {
|
|
2272
2351
|
seeds: [
|
|
2273
2352
|
{
|
|
@@ -2805,6 +2884,7 @@ var instructions = [
|
|
|
2805
2884
|
},
|
|
2806
2885
|
{
|
|
2807
2886
|
name: "mxe",
|
|
2887
|
+
writable: true,
|
|
2808
2888
|
pda: {
|
|
2809
2889
|
seeds: [
|
|
2810
2890
|
{
|
|
@@ -3134,13 +3214,88 @@ var instructions = [
|
|
|
3134
3214
|
],
|
|
3135
3215
|
accounts: [
|
|
3136
3216
|
{
|
|
3137
|
-
name: "
|
|
3217
|
+
name: "staking_pool_signer",
|
|
3218
|
+
docs: [
|
|
3219
|
+
"The `arcium_staking::state::StakingPoolAccount` PDA, signing via CPI. Also the destination",
|
|
3220
|
+
"for the settled lamports (so the staking program immediately owns them for later",
|
|
3221
|
+
"proportional distribution). The `seeds`/`bump` constraint verifies it's the canonical pool",
|
|
3222
|
+
"PDA under `ARCIUM_STAKING_ID` (so only the staking program can call this); `Signer`",
|
|
3223
|
+
"enforces it actually signed."
|
|
3224
|
+
],
|
|
3138
3225
|
writable: true,
|
|
3139
|
-
signer: true
|
|
3226
|
+
signer: true,
|
|
3227
|
+
pda: {
|
|
3228
|
+
seeds: [
|
|
3229
|
+
{
|
|
3230
|
+
kind: "const",
|
|
3231
|
+
value: [
|
|
3232
|
+
83,
|
|
3233
|
+
116,
|
|
3234
|
+
97,
|
|
3235
|
+
107,
|
|
3236
|
+
105,
|
|
3237
|
+
110,
|
|
3238
|
+
103,
|
|
3239
|
+
80,
|
|
3240
|
+
111,
|
|
3241
|
+
111,
|
|
3242
|
+
108,
|
|
3243
|
+
65,
|
|
3244
|
+
99,
|
|
3245
|
+
99,
|
|
3246
|
+
111,
|
|
3247
|
+
117,
|
|
3248
|
+
110,
|
|
3249
|
+
116
|
|
3250
|
+
]
|
|
3251
|
+
}
|
|
3252
|
+
],
|
|
3253
|
+
program: {
|
|
3254
|
+
kind: "const",
|
|
3255
|
+
value: [
|
|
3256
|
+
146,
|
|
3257
|
+
110,
|
|
3258
|
+
184,
|
|
3259
|
+
172,
|
|
3260
|
+
179,
|
|
3261
|
+
131,
|
|
3262
|
+
118,
|
|
3263
|
+
35,
|
|
3264
|
+
207,
|
|
3265
|
+
122,
|
|
3266
|
+
30,
|
|
3267
|
+
190,
|
|
3268
|
+
228,
|
|
3269
|
+
134,
|
|
3270
|
+
232,
|
|
3271
|
+
140,
|
|
3272
|
+
222,
|
|
3273
|
+
89,
|
|
3274
|
+
53,
|
|
3275
|
+
150,
|
|
3276
|
+
174,
|
|
3277
|
+
187,
|
|
3278
|
+
151,
|
|
3279
|
+
58,
|
|
3280
|
+
208,
|
|
3281
|
+
108,
|
|
3282
|
+
237,
|
|
3283
|
+
119,
|
|
3284
|
+
97,
|
|
3285
|
+
204,
|
|
3286
|
+
184,
|
|
3287
|
+
186
|
|
3288
|
+
]
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3140
3291
|
},
|
|
3141
3292
|
{
|
|
3142
|
-
name: "
|
|
3143
|
-
|
|
3293
|
+
name: "primary_stake_account",
|
|
3294
|
+
docs: [
|
|
3295
|
+
"The `PrimaryStakingAccount` bound to this node. Passed so the handler can verify",
|
|
3296
|
+
"`node.primary_staking_account == primary_stake_account.key()` — i.e. the staking account",
|
|
3297
|
+
"that's about to claim the fees is the one this node was initialized with."
|
|
3298
|
+
]
|
|
3144
3299
|
},
|
|
3145
3300
|
{
|
|
3146
3301
|
name: "cluster",
|
|
@@ -3219,7 +3374,197 @@ var instructions = [
|
|
|
3219
3374
|
name: "node_offset",
|
|
3220
3375
|
type: "u32"
|
|
3221
3376
|
}
|
|
3222
|
-
]
|
|
3377
|
+
],
|
|
3378
|
+
returns: "u64"
|
|
3379
|
+
},
|
|
3380
|
+
{
|
|
3381
|
+
name: "claim_recovery_peer_fees",
|
|
3382
|
+
discriminator: [
|
|
3383
|
+
132,
|
|
3384
|
+
120,
|
|
3385
|
+
187,
|
|
3386
|
+
164,
|
|
3387
|
+
106,
|
|
3388
|
+
57,
|
|
3389
|
+
202,
|
|
3390
|
+
8
|
|
3391
|
+
],
|
|
3392
|
+
accounts: [
|
|
3393
|
+
{
|
|
3394
|
+
name: "staking_pool_signer",
|
|
3395
|
+
docs: [
|
|
3396
|
+
"`arcium_staking::StakingPoolAccount` PDA, signing via CPI and receiving the drained",
|
|
3397
|
+
"lamports. The `seeds`/`bump` constraint verifies it's the canonical pool PDA under",
|
|
3398
|
+
"`ARCIUM_STAKING_ID`; `Signer` enforces `is_signer`."
|
|
3399
|
+
],
|
|
3400
|
+
writable: true,
|
|
3401
|
+
signer: true,
|
|
3402
|
+
pda: {
|
|
3403
|
+
seeds: [
|
|
3404
|
+
{
|
|
3405
|
+
kind: "const",
|
|
3406
|
+
value: [
|
|
3407
|
+
83,
|
|
3408
|
+
116,
|
|
3409
|
+
97,
|
|
3410
|
+
107,
|
|
3411
|
+
105,
|
|
3412
|
+
110,
|
|
3413
|
+
103,
|
|
3414
|
+
80,
|
|
3415
|
+
111,
|
|
3416
|
+
111,
|
|
3417
|
+
108,
|
|
3418
|
+
65,
|
|
3419
|
+
99,
|
|
3420
|
+
99,
|
|
3421
|
+
111,
|
|
3422
|
+
117,
|
|
3423
|
+
110,
|
|
3424
|
+
116
|
|
3425
|
+
]
|
|
3426
|
+
}
|
|
3427
|
+
],
|
|
3428
|
+
program: {
|
|
3429
|
+
kind: "const",
|
|
3430
|
+
value: [
|
|
3431
|
+
146,
|
|
3432
|
+
110,
|
|
3433
|
+
184,
|
|
3434
|
+
172,
|
|
3435
|
+
179,
|
|
3436
|
+
131,
|
|
3437
|
+
118,
|
|
3438
|
+
35,
|
|
3439
|
+
207,
|
|
3440
|
+
122,
|
|
3441
|
+
30,
|
|
3442
|
+
190,
|
|
3443
|
+
228,
|
|
3444
|
+
134,
|
|
3445
|
+
232,
|
|
3446
|
+
140,
|
|
3447
|
+
222,
|
|
3448
|
+
89,
|
|
3449
|
+
53,
|
|
3450
|
+
150,
|
|
3451
|
+
174,
|
|
3452
|
+
187,
|
|
3453
|
+
151,
|
|
3454
|
+
58,
|
|
3455
|
+
208,
|
|
3456
|
+
108,
|
|
3457
|
+
237,
|
|
3458
|
+
119,
|
|
3459
|
+
97,
|
|
3460
|
+
204,
|
|
3461
|
+
184,
|
|
3462
|
+
186
|
|
3463
|
+
]
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
},
|
|
3467
|
+
{
|
|
3468
|
+
name: "primary_stake_account",
|
|
3469
|
+
docs: [
|
|
3470
|
+
"`PrimaryStakingAccount` the claiming peer is bound to. Only the key is compared",
|
|
3471
|
+
"against `recovery_peer.primary_stake_account`; the staking program owns the struct."
|
|
3472
|
+
]
|
|
3473
|
+
},
|
|
3474
|
+
{
|
|
3475
|
+
name: "recovery_peer",
|
|
3476
|
+
pda: {
|
|
3477
|
+
seeds: [
|
|
3478
|
+
{
|
|
3479
|
+
kind: "const",
|
|
3480
|
+
value: [
|
|
3481
|
+
82,
|
|
3482
|
+
101,
|
|
3483
|
+
99,
|
|
3484
|
+
111,
|
|
3485
|
+
118,
|
|
3486
|
+
101,
|
|
3487
|
+
114,
|
|
3488
|
+
121,
|
|
3489
|
+
80,
|
|
3490
|
+
101,
|
|
3491
|
+
101,
|
|
3492
|
+
114,
|
|
3493
|
+
65,
|
|
3494
|
+
99,
|
|
3495
|
+
99,
|
|
3496
|
+
111,
|
|
3497
|
+
117,
|
|
3498
|
+
110,
|
|
3499
|
+
116
|
|
3500
|
+
]
|
|
3501
|
+
},
|
|
3502
|
+
{
|
|
3503
|
+
kind: "arg",
|
|
3504
|
+
path: "peer_offset"
|
|
3505
|
+
}
|
|
3506
|
+
]
|
|
3507
|
+
}
|
|
3508
|
+
},
|
|
3509
|
+
{
|
|
3510
|
+
name: "mxe",
|
|
3511
|
+
writable: true,
|
|
3512
|
+
pda: {
|
|
3513
|
+
seeds: [
|
|
3514
|
+
{
|
|
3515
|
+
kind: "const",
|
|
3516
|
+
value: [
|
|
3517
|
+
77,
|
|
3518
|
+
88,
|
|
3519
|
+
69,
|
|
3520
|
+
65,
|
|
3521
|
+
99,
|
|
3522
|
+
99,
|
|
3523
|
+
111,
|
|
3524
|
+
117,
|
|
3525
|
+
110,
|
|
3526
|
+
116
|
|
3527
|
+
]
|
|
3528
|
+
},
|
|
3529
|
+
{
|
|
3530
|
+
kind: "arg",
|
|
3531
|
+
path: "mxe_program"
|
|
3532
|
+
}
|
|
3533
|
+
]
|
|
3534
|
+
}
|
|
3535
|
+
},
|
|
3536
|
+
{
|
|
3537
|
+
name: "pool",
|
|
3538
|
+
writable: true,
|
|
3539
|
+
pda: {
|
|
3540
|
+
seeds: [
|
|
3541
|
+
{
|
|
3542
|
+
kind: "const",
|
|
3543
|
+
value: [
|
|
3544
|
+
70,
|
|
3545
|
+
101,
|
|
3546
|
+
101,
|
|
3547
|
+
80,
|
|
3548
|
+
111,
|
|
3549
|
+
111,
|
|
3550
|
+
108
|
|
3551
|
+
]
|
|
3552
|
+
}
|
|
3553
|
+
]
|
|
3554
|
+
}
|
|
3555
|
+
}
|
|
3556
|
+
],
|
|
3557
|
+
args: [
|
|
3558
|
+
{
|
|
3559
|
+
name: "mxe_program",
|
|
3560
|
+
type: "pubkey"
|
|
3561
|
+
},
|
|
3562
|
+
{
|
|
3563
|
+
name: "peer_offset",
|
|
3564
|
+
type: "u32"
|
|
3565
|
+
}
|
|
3566
|
+
],
|
|
3567
|
+
returns: "u64"
|
|
3223
3568
|
},
|
|
3224
3569
|
{
|
|
3225
3570
|
name: "close_computation_definition",
|
|
@@ -4524,8 +4869,16 @@ var instructions = [
|
|
|
4524
4869
|
{
|
|
4525
4870
|
name: "large_execpool"
|
|
4526
4871
|
}
|
|
4527
|
-
],
|
|
4528
|
-
args: [
|
|
4872
|
+
],
|
|
4873
|
+
args: [
|
|
4874
|
+
{
|
|
4875
|
+
name: "_selector",
|
|
4876
|
+
type: {
|
|
4877
|
+
defined: {
|
|
4878
|
+
name: "LeaderSelector"
|
|
4879
|
+
}
|
|
4880
|
+
}
|
|
4881
|
+
}
|
|
4529
4882
|
]
|
|
4530
4883
|
},
|
|
4531
4884
|
{
|
|
@@ -6137,6 +6490,31 @@ var instructions = [
|
|
|
6137
6490
|
]
|
|
6138
6491
|
}
|
|
6139
6492
|
},
|
|
6493
|
+
{
|
|
6494
|
+
name: "primary_stake_account",
|
|
6495
|
+
docs: [
|
|
6496
|
+
"The `PrimaryStakingAccount` (owned by the `arcium_staking` program) that this node will be",
|
|
6497
|
+
"bound to for the rest of its life. Reward settlement requires this linkage: fees accrued",
|
|
6498
|
+
"under this node can only be drained via a CPI signed by the staking program's pool PDA",
|
|
6499
|
+
"after matching on this key.",
|
|
6500
|
+
"the staking program's responsibility — if the staker binds garbage they lock themselves",
|
|
6501
|
+
"out of rewards, which is their own problem."
|
|
6502
|
+
],
|
|
6503
|
+
writable: true
|
|
6504
|
+
},
|
|
6505
|
+
{
|
|
6506
|
+
name: "staker",
|
|
6507
|
+
docs: [
|
|
6508
|
+
"Authority of `primary_stake_account`. Required as a second signer so we can CPI into",
|
|
6509
|
+
"`arcium_staking::bind_primary_stake` and commit the stake to this node. The staking",
|
|
6510
|
+
"program re-derives the stake PDA from this key and rejects the call if it mismatches."
|
|
6511
|
+
],
|
|
6512
|
+
signer: true
|
|
6513
|
+
},
|
|
6514
|
+
{
|
|
6515
|
+
name: "arcium_staking_program",
|
|
6516
|
+
address: "ArcStnN9zZZVB5WjgPhLHjYpY7Gb29mzb96ySsb1kxgq"
|
|
6517
|
+
},
|
|
6140
6518
|
{
|
|
6141
6519
|
name: "system_program",
|
|
6142
6520
|
address: "11111111111111111111111111111111"
|
|
@@ -7004,6 +7382,15 @@ var instructions = [
|
|
|
7004
7382
|
}
|
|
7005
7383
|
],
|
|
7006
7384
|
args: [
|
|
7385
|
+
{
|
|
7386
|
+
name: "recovery_peers",
|
|
7387
|
+
type: {
|
|
7388
|
+
array: [
|
|
7389
|
+
"u32",
|
|
7390
|
+
100
|
|
7391
|
+
]
|
|
7392
|
+
}
|
|
7393
|
+
}
|
|
7007
7394
|
]
|
|
7008
7395
|
},
|
|
7009
7396
|
{
|
|
@@ -7118,8 +7505,8 @@ var instructions = [
|
|
|
7118
7505
|
]
|
|
7119
7506
|
},
|
|
7120
7507
|
{
|
|
7121
|
-
kind: "
|
|
7122
|
-
path: "
|
|
7508
|
+
kind: "account",
|
|
7509
|
+
path: "mxe_program"
|
|
7123
7510
|
}
|
|
7124
7511
|
]
|
|
7125
7512
|
}
|
|
@@ -7419,6 +7806,17 @@ var instructions = [
|
|
|
7419
7806
|
]
|
|
7420
7807
|
}
|
|
7421
7808
|
},
|
|
7809
|
+
{
|
|
7810
|
+
name: "instructions_sysvar",
|
|
7811
|
+
docs: [
|
|
7812
|
+
"Instructions sysvar — used in the handler to verify the **next** instruction in this",
|
|
7813
|
+
"transaction is `arcium_staking::init_mxe_recovery_stake_state` with the same",
|
|
7814
|
+
"`mxe_program`. This mirrors the reverse check on the staking side and is what",
|
|
7815
|
+
"guarantees that every MXE is created alongside its recovery stake state (replacement",
|
|
7816
|
+
"for the CPI we couldn't do because of the 4KB stack limit on `try_accounts`)."
|
|
7817
|
+
],
|
|
7818
|
+
address: "Sysvar1nstructions1111111111111111111111111"
|
|
7819
|
+
},
|
|
7422
7820
|
{
|
|
7423
7821
|
name: "system_program",
|
|
7424
7822
|
address: "11111111111111111111111111111111"
|
|
@@ -7429,19 +7827,6 @@ var instructions = [
|
|
|
7429
7827
|
name: "cluster_offset",
|
|
7430
7828
|
type: "u32"
|
|
7431
7829
|
},
|
|
7432
|
-
{
|
|
7433
|
-
name: "mxe_program",
|
|
7434
|
-
type: "pubkey"
|
|
7435
|
-
},
|
|
7436
|
-
{
|
|
7437
|
-
name: "recovery_peers",
|
|
7438
|
-
type: {
|
|
7439
|
-
array: [
|
|
7440
|
-
"u32",
|
|
7441
|
-
100
|
|
7442
|
-
]
|
|
7443
|
-
}
|
|
7444
|
-
},
|
|
7445
7830
|
{
|
|
7446
7831
|
name: "keygen_offset",
|
|
7447
7832
|
type: "u64"
|
|
@@ -7899,6 +8284,31 @@ var instructions = [
|
|
|
7899
8284
|
]
|
|
7900
8285
|
}
|
|
7901
8286
|
},
|
|
8287
|
+
{
|
|
8288
|
+
name: "primary_stake_account",
|
|
8289
|
+
docs: [
|
|
8290
|
+
"The `PrimaryStakingAccount` (owned by `arcium_staking`) that the recovery peer is",
|
|
8291
|
+
"binding itself to. Mirrors the stake-first requirement on `InitArxNode`: every",
|
|
8292
|
+
"recovery peer has to point at a real staking account so we have someone to slash",
|
|
8293
|
+
"(or dock rewards from) if the peer misbehaves. Full account-structure validation",
|
|
8294
|
+
"is the staking program's job — here we just make sure the account is owned by it.",
|
|
8295
|
+
"point at any primary stake account they have authority over."
|
|
8296
|
+
],
|
|
8297
|
+
writable: true
|
|
8298
|
+
},
|
|
8299
|
+
{
|
|
8300
|
+
name: "staker",
|
|
8301
|
+
docs: [
|
|
8302
|
+
"Authority of `primary_stake_account`. Required as a second signer so we can CPI into",
|
|
8303
|
+
"`arcium_staking::bind_primary_stake` and commit the stake to this recovery peer. The",
|
|
8304
|
+
"staking program re-derives the stake PDA from this key and rejects on mismatch."
|
|
8305
|
+
],
|
|
8306
|
+
signer: true
|
|
8307
|
+
},
|
|
8308
|
+
{
|
|
8309
|
+
name: "arcium_staking_program",
|
|
8310
|
+
address: "ArcStnN9zZZVB5WjgPhLHjYpY7Gb29mzb96ySsb1kxgq"
|
|
8311
|
+
},
|
|
7902
8312
|
{
|
|
7903
8313
|
name: "system_program",
|
|
7904
8314
|
address: "11111111111111111111111111111111"
|
|
@@ -8035,6 +8445,171 @@ var instructions = [
|
|
|
8035
8445
|
}
|
|
8036
8446
|
]
|
|
8037
8447
|
},
|
|
8448
|
+
{
|
|
8449
|
+
name: "migrate_arx_node",
|
|
8450
|
+
discriminator: [
|
|
8451
|
+
26,
|
|
8452
|
+
223,
|
|
8453
|
+
103,
|
|
8454
|
+
52,
|
|
8455
|
+
241,
|
|
8456
|
+
117,
|
|
8457
|
+
229,
|
|
8458
|
+
143
|
|
8459
|
+
],
|
|
8460
|
+
accounts: [
|
|
8461
|
+
{
|
|
8462
|
+
name: "authority",
|
|
8463
|
+
docs: [
|
|
8464
|
+
"The node's `config.authority`, which both *authorizes* the bind (only the node's own admin",
|
|
8465
|
+
"may link a stake account to it — otherwise anyone could divert a node's rewards to their",
|
|
8466
|
+
"own stake) and doubles as the `staker` (owner of `primary_stake_account`) for the CPI."
|
|
8467
|
+
],
|
|
8468
|
+
signer: true
|
|
8469
|
+
},
|
|
8470
|
+
{
|
|
8471
|
+
name: "arx_node_acc",
|
|
8472
|
+
writable: true,
|
|
8473
|
+
pda: {
|
|
8474
|
+
seeds: [
|
|
8475
|
+
{
|
|
8476
|
+
kind: "const",
|
|
8477
|
+
value: [
|
|
8478
|
+
65,
|
|
8479
|
+
114,
|
|
8480
|
+
120,
|
|
8481
|
+
78,
|
|
8482
|
+
111,
|
|
8483
|
+
100,
|
|
8484
|
+
101
|
|
8485
|
+
]
|
|
8486
|
+
},
|
|
8487
|
+
{
|
|
8488
|
+
kind: "arg",
|
|
8489
|
+
path: "node_offset"
|
|
8490
|
+
}
|
|
8491
|
+
]
|
|
8492
|
+
}
|
|
8493
|
+
},
|
|
8494
|
+
{
|
|
8495
|
+
name: "primary_stake_account",
|
|
8496
|
+
docs: [
|
|
8497
|
+
"The `PrimaryStakingAccount` (created beforehand via",
|
|
8498
|
+
"`arcium_staking::add_primary_stake_to_legacy_acc`) to bind. Owner-checked here; the staking",
|
|
8499
|
+
"program re-derives `[SEED, authority]` and rejects a mismatch during the bind CPI."
|
|
8500
|
+
],
|
|
8501
|
+
writable: true
|
|
8502
|
+
},
|
|
8503
|
+
{
|
|
8504
|
+
name: "arcium_staking_program",
|
|
8505
|
+
address: "ArcStnN9zZZVB5WjgPhLHjYpY7Gb29mzb96ySsb1kxgq"
|
|
8506
|
+
}
|
|
8507
|
+
],
|
|
8508
|
+
args: [
|
|
8509
|
+
{
|
|
8510
|
+
name: "node_offset",
|
|
8511
|
+
type: "u32"
|
|
8512
|
+
}
|
|
8513
|
+
]
|
|
8514
|
+
},
|
|
8515
|
+
{
|
|
8516
|
+
name: "migrate_cluster",
|
|
8517
|
+
docs: [
|
|
8518
|
+
"One-shot layout migrations for the staking upgrade. Each grows one already-deployed",
|
|
8519
|
+
"account to the current (append-only) layout; idempotent and permissionless. See",
|
|
8520
|
+
"`instructions::migration`."
|
|
8521
|
+
],
|
|
8522
|
+
discriminator: [
|
|
8523
|
+
158,
|
|
8524
|
+
61,
|
|
8525
|
+
104,
|
|
8526
|
+
161,
|
|
8527
|
+
253,
|
|
8528
|
+
138,
|
|
8529
|
+
0,
|
|
8530
|
+
17
|
|
8531
|
+
],
|
|
8532
|
+
accounts: [
|
|
8533
|
+
{
|
|
8534
|
+
name: "payer",
|
|
8535
|
+
writable: true,
|
|
8536
|
+
signer: true
|
|
8537
|
+
},
|
|
8538
|
+
{
|
|
8539
|
+
name: "cluster",
|
|
8540
|
+
docs: [
|
|
8541
|
+
"because the new program cannot deserialize the old (short) layout via `Account<Cluster>`."
|
|
8542
|
+
],
|
|
8543
|
+
writable: true
|
|
8544
|
+
},
|
|
8545
|
+
{
|
|
8546
|
+
name: "system_program",
|
|
8547
|
+
address: "11111111111111111111111111111111"
|
|
8548
|
+
}
|
|
8549
|
+
],
|
|
8550
|
+
args: [
|
|
8551
|
+
]
|
|
8552
|
+
},
|
|
8553
|
+
{
|
|
8554
|
+
name: "migrate_mxe_account",
|
|
8555
|
+
discriminator: [
|
|
8556
|
+
96,
|
|
8557
|
+
162,
|
|
8558
|
+
117,
|
|
8559
|
+
100,
|
|
8560
|
+
242,
|
|
8561
|
+
143,
|
|
8562
|
+
16,
|
|
8563
|
+
80
|
|
8564
|
+
],
|
|
8565
|
+
accounts: [
|
|
8566
|
+
{
|
|
8567
|
+
name: "payer",
|
|
8568
|
+
writable: true,
|
|
8569
|
+
signer: true
|
|
8570
|
+
},
|
|
8571
|
+
{
|
|
8572
|
+
name: "mxe",
|
|
8573
|
+
writable: true
|
|
8574
|
+
},
|
|
8575
|
+
{
|
|
8576
|
+
name: "system_program",
|
|
8577
|
+
address: "11111111111111111111111111111111"
|
|
8578
|
+
}
|
|
8579
|
+
],
|
|
8580
|
+
args: [
|
|
8581
|
+
]
|
|
8582
|
+
},
|
|
8583
|
+
{
|
|
8584
|
+
name: "migrate_recovery_peer",
|
|
8585
|
+
discriminator: [
|
|
8586
|
+
58,
|
|
8587
|
+
226,
|
|
8588
|
+
37,
|
|
8589
|
+
60,
|
|
8590
|
+
200,
|
|
8591
|
+
31,
|
|
8592
|
+
251,
|
|
8593
|
+
245
|
|
8594
|
+
],
|
|
8595
|
+
accounts: [
|
|
8596
|
+
{
|
|
8597
|
+
name: "payer",
|
|
8598
|
+
writable: true,
|
|
8599
|
+
signer: true
|
|
8600
|
+
},
|
|
8601
|
+
{
|
|
8602
|
+
name: "recovery_peer",
|
|
8603
|
+
writable: true
|
|
8604
|
+
},
|
|
8605
|
+
{
|
|
8606
|
+
name: "system_program",
|
|
8607
|
+
address: "11111111111111111111111111111111"
|
|
8608
|
+
}
|
|
8609
|
+
],
|
|
8610
|
+
args: [
|
|
8611
|
+
]
|
|
8612
|
+
},
|
|
8038
8613
|
{
|
|
8039
8614
|
name: "propose_fee",
|
|
8040
8615
|
discriminator: [
|
|
@@ -8253,7 +8828,12 @@ var instructions = [
|
|
|
8253
8828
|
docs: [
|
|
8254
8829
|
"Queues a computation.",
|
|
8255
8830
|
"cu_price_micro: The priority price of a CU, in micro-lamports. Used",
|
|
8256
|
-
"to calculate the priority fee and rounded down."
|
|
8831
|
+
"to calculate the priority fee and rounded down.",
|
|
8832
|
+
"callback_cu_limit: The compute unit limit to request for the callback transaction(s)",
|
|
8833
|
+
"via set_compute_unit_limit. 0 means unset (the node uses the default compute budget).",
|
|
8834
|
+
"A non-zero value incurs an additional priority fee of callback_cu_limit * cu_price_micro.",
|
|
8835
|
+
"callback_cu_limit + padding together occupy the 8 bytes that previously held the",
|
|
8836
|
+
"(always-zero) output_delivery_fee: u64, so the instruction layout is unchanged."
|
|
8257
8837
|
],
|
|
8258
8838
|
discriminator: [
|
|
8259
8839
|
1,
|
|
@@ -8586,8 +9166,12 @@ var instructions = [
|
|
|
8586
9166
|
type: "u8"
|
|
8587
9167
|
},
|
|
8588
9168
|
{
|
|
8589
|
-
name: "
|
|
8590
|
-
type: "
|
|
9169
|
+
name: "callback_cu_limit",
|
|
9170
|
+
type: "u32"
|
|
9171
|
+
},
|
|
9172
|
+
{
|
|
9173
|
+
name: "padding",
|
|
9174
|
+
type: "u32"
|
|
8591
9175
|
},
|
|
8592
9176
|
{
|
|
8593
9177
|
name: "cu_price_micro",
|
|
@@ -9864,7 +10448,63 @@ var instructions = [
|
|
|
9864
10448
|
],
|
|
9865
10449
|
accounts: [
|
|
9866
10450
|
{
|
|
9867
|
-
name: "current_authority",
|
|
10451
|
+
name: "current_authority",
|
|
10452
|
+
writable: true,
|
|
10453
|
+
signer: true
|
|
10454
|
+
},
|
|
10455
|
+
{
|
|
10456
|
+
name: "cluster_acc",
|
|
10457
|
+
writable: true,
|
|
10458
|
+
pda: {
|
|
10459
|
+
seeds: [
|
|
10460
|
+
{
|
|
10461
|
+
kind: "const",
|
|
10462
|
+
value: [
|
|
10463
|
+
67,
|
|
10464
|
+
108,
|
|
10465
|
+
117,
|
|
10466
|
+
115,
|
|
10467
|
+
116,
|
|
10468
|
+
101,
|
|
10469
|
+
114
|
|
10470
|
+
]
|
|
10471
|
+
},
|
|
10472
|
+
{
|
|
10473
|
+
kind: "arg",
|
|
10474
|
+
path: "_id"
|
|
10475
|
+
}
|
|
10476
|
+
]
|
|
10477
|
+
}
|
|
10478
|
+
}
|
|
10479
|
+
],
|
|
10480
|
+
args: [
|
|
10481
|
+
{
|
|
10482
|
+
name: "cluster_id",
|
|
10483
|
+
type: "u32"
|
|
10484
|
+
},
|
|
10485
|
+
{
|
|
10486
|
+
name: "new_authority",
|
|
10487
|
+
type: {
|
|
10488
|
+
option: "pubkey"
|
|
10489
|
+
}
|
|
10490
|
+
}
|
|
10491
|
+
]
|
|
10492
|
+
},
|
|
10493
|
+
{
|
|
10494
|
+
name: "set_cluster_td_info",
|
|
10495
|
+
discriminator: [
|
|
10496
|
+
182,
|
|
10497
|
+
126,
|
|
10498
|
+
92,
|
|
10499
|
+
101,
|
|
10500
|
+
25,
|
|
10501
|
+
252,
|
|
10502
|
+
84,
|
|
10503
|
+
180
|
|
10504
|
+
],
|
|
10505
|
+
accounts: [
|
|
10506
|
+
{
|
|
10507
|
+
name: "authority",
|
|
9868
10508
|
writable: true,
|
|
9869
10509
|
signer: true
|
|
9870
10510
|
},
|
|
@@ -9899,28 +10539,32 @@ var instructions = [
|
|
|
9899
10539
|
type: "u32"
|
|
9900
10540
|
},
|
|
9901
10541
|
{
|
|
9902
|
-
name: "
|
|
10542
|
+
name: "td_info",
|
|
9903
10543
|
type: {
|
|
9904
|
-
option:
|
|
10544
|
+
option: {
|
|
10545
|
+
defined: {
|
|
10546
|
+
name: "NodeMetadata"
|
|
10547
|
+
}
|
|
10548
|
+
}
|
|
9905
10549
|
}
|
|
9906
10550
|
}
|
|
9907
10551
|
]
|
|
9908
10552
|
},
|
|
9909
10553
|
{
|
|
9910
|
-
name: "
|
|
10554
|
+
name: "set_leader_choice",
|
|
9911
10555
|
discriminator: [
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
10556
|
+
42,
|
|
10557
|
+
7,
|
|
10558
|
+
112,
|
|
10559
|
+
255,
|
|
10560
|
+
254,
|
|
10561
|
+
186,
|
|
10562
|
+
135,
|
|
10563
|
+
133
|
|
9920
10564
|
],
|
|
9921
10565
|
accounts: [
|
|
9922
10566
|
{
|
|
9923
|
-
name: "
|
|
10567
|
+
name: "node_authority",
|
|
9924
10568
|
writable: true,
|
|
9925
10569
|
signer: true
|
|
9926
10570
|
},
|
|
@@ -9943,7 +10587,53 @@ var instructions = [
|
|
|
9943
10587
|
},
|
|
9944
10588
|
{
|
|
9945
10589
|
kind: "arg",
|
|
9946
|
-
path: "
|
|
10590
|
+
path: "cluster_offset"
|
|
10591
|
+
}
|
|
10592
|
+
]
|
|
10593
|
+
}
|
|
10594
|
+
},
|
|
10595
|
+
{
|
|
10596
|
+
name: "arx_node_acc",
|
|
10597
|
+
pda: {
|
|
10598
|
+
seeds: [
|
|
10599
|
+
{
|
|
10600
|
+
kind: "const",
|
|
10601
|
+
value: [
|
|
10602
|
+
65,
|
|
10603
|
+
114,
|
|
10604
|
+
120,
|
|
10605
|
+
78,
|
|
10606
|
+
111,
|
|
10607
|
+
100,
|
|
10608
|
+
101
|
|
10609
|
+
]
|
|
10610
|
+
},
|
|
10611
|
+
{
|
|
10612
|
+
kind: "arg",
|
|
10613
|
+
path: "node_offset"
|
|
10614
|
+
}
|
|
10615
|
+
]
|
|
10616
|
+
}
|
|
10617
|
+
},
|
|
10618
|
+
{
|
|
10619
|
+
name: "mempool",
|
|
10620
|
+
pda: {
|
|
10621
|
+
seeds: [
|
|
10622
|
+
{
|
|
10623
|
+
kind: "const",
|
|
10624
|
+
value: [
|
|
10625
|
+
77,
|
|
10626
|
+
101,
|
|
10627
|
+
109,
|
|
10628
|
+
112,
|
|
10629
|
+
111,
|
|
10630
|
+
111,
|
|
10631
|
+
108
|
|
10632
|
+
]
|
|
10633
|
+
},
|
|
10634
|
+
{
|
|
10635
|
+
kind: "arg",
|
|
10636
|
+
path: "cluster_offset"
|
|
9947
10637
|
}
|
|
9948
10638
|
]
|
|
9949
10639
|
}
|
|
@@ -9951,16 +10641,18 @@ var instructions = [
|
|
|
9951
10641
|
],
|
|
9952
10642
|
args: [
|
|
9953
10643
|
{
|
|
9954
|
-
name: "
|
|
10644
|
+
name: "cluster_offset",
|
|
9955
10645
|
type: "u32"
|
|
9956
10646
|
},
|
|
9957
10647
|
{
|
|
9958
|
-
name: "
|
|
10648
|
+
name: "node_offset",
|
|
10649
|
+
type: "u32"
|
|
10650
|
+
},
|
|
10651
|
+
{
|
|
10652
|
+
name: "choice",
|
|
9959
10653
|
type: {
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
name: "NodeMetadata"
|
|
9963
|
-
}
|
|
10654
|
+
defined: {
|
|
10655
|
+
name: "LeaderChoice"
|
|
9964
10656
|
}
|
|
9965
10657
|
}
|
|
9966
10658
|
}
|
|
@@ -10292,6 +10984,156 @@ var instructions = [
|
|
|
10292
10984
|
}
|
|
10293
10985
|
]
|
|
10294
10986
|
},
|
|
10987
|
+
{
|
|
10988
|
+
name: "set_node_staking",
|
|
10989
|
+
discriminator: [
|
|
10990
|
+
158,
|
|
10991
|
+
40,
|
|
10992
|
+
109,
|
|
10993
|
+
244,
|
|
10994
|
+
217,
|
|
10995
|
+
195,
|
|
10996
|
+
35,
|
|
10997
|
+
140
|
|
10998
|
+
],
|
|
10999
|
+
accounts: [
|
|
11000
|
+
{
|
|
11001
|
+
name: "staking_pool_signer",
|
|
11002
|
+
docs: [
|
|
11003
|
+
"The `arcium_staking::state::StakingPoolAccount` PDA, signing via CPI. The `seeds`/`bump`",
|
|
11004
|
+
"constraint verifies it's the canonical pool PDA under `ARCIUM_STAKING_ID` (so only the",
|
|
11005
|
+
"staking program can call this)"
|
|
11006
|
+
],
|
|
11007
|
+
signer: true,
|
|
11008
|
+
pda: {
|
|
11009
|
+
seeds: [
|
|
11010
|
+
{
|
|
11011
|
+
kind: "const",
|
|
11012
|
+
value: [
|
|
11013
|
+
83,
|
|
11014
|
+
116,
|
|
11015
|
+
97,
|
|
11016
|
+
107,
|
|
11017
|
+
105,
|
|
11018
|
+
110,
|
|
11019
|
+
103,
|
|
11020
|
+
80,
|
|
11021
|
+
111,
|
|
11022
|
+
111,
|
|
11023
|
+
108,
|
|
11024
|
+
65,
|
|
11025
|
+
99,
|
|
11026
|
+
99,
|
|
11027
|
+
111,
|
|
11028
|
+
117,
|
|
11029
|
+
110,
|
|
11030
|
+
116
|
|
11031
|
+
]
|
|
11032
|
+
}
|
|
11033
|
+
],
|
|
11034
|
+
program: {
|
|
11035
|
+
kind: "const",
|
|
11036
|
+
value: [
|
|
11037
|
+
146,
|
|
11038
|
+
110,
|
|
11039
|
+
184,
|
|
11040
|
+
172,
|
|
11041
|
+
179,
|
|
11042
|
+
131,
|
|
11043
|
+
118,
|
|
11044
|
+
35,
|
|
11045
|
+
207,
|
|
11046
|
+
122,
|
|
11047
|
+
30,
|
|
11048
|
+
190,
|
|
11049
|
+
228,
|
|
11050
|
+
134,
|
|
11051
|
+
232,
|
|
11052
|
+
140,
|
|
11053
|
+
222,
|
|
11054
|
+
89,
|
|
11055
|
+
53,
|
|
11056
|
+
150,
|
|
11057
|
+
174,
|
|
11058
|
+
187,
|
|
11059
|
+
151,
|
|
11060
|
+
58,
|
|
11061
|
+
208,
|
|
11062
|
+
108,
|
|
11063
|
+
237,
|
|
11064
|
+
119,
|
|
11065
|
+
97,
|
|
11066
|
+
204,
|
|
11067
|
+
184,
|
|
11068
|
+
186
|
|
11069
|
+
]
|
|
11070
|
+
}
|
|
11071
|
+
}
|
|
11072
|
+
},
|
|
11073
|
+
{
|
|
11074
|
+
name: "cluster",
|
|
11075
|
+
writable: true,
|
|
11076
|
+
pda: {
|
|
11077
|
+
seeds: [
|
|
11078
|
+
{
|
|
11079
|
+
kind: "const",
|
|
11080
|
+
value: [
|
|
11081
|
+
67,
|
|
11082
|
+
108,
|
|
11083
|
+
117,
|
|
11084
|
+
115,
|
|
11085
|
+
116,
|
|
11086
|
+
101,
|
|
11087
|
+
114
|
|
11088
|
+
]
|
|
11089
|
+
},
|
|
11090
|
+
{
|
|
11091
|
+
kind: "arg",
|
|
11092
|
+
path: "cluster_offset"
|
|
11093
|
+
}
|
|
11094
|
+
]
|
|
11095
|
+
}
|
|
11096
|
+
},
|
|
11097
|
+
{
|
|
11098
|
+
name: "clock",
|
|
11099
|
+
pda: {
|
|
11100
|
+
seeds: [
|
|
11101
|
+
{
|
|
11102
|
+
kind: "const",
|
|
11103
|
+
value: [
|
|
11104
|
+
67,
|
|
11105
|
+
108,
|
|
11106
|
+
111,
|
|
11107
|
+
99,
|
|
11108
|
+
107,
|
|
11109
|
+
65,
|
|
11110
|
+
99,
|
|
11111
|
+
99,
|
|
11112
|
+
111,
|
|
11113
|
+
117,
|
|
11114
|
+
110,
|
|
11115
|
+
116
|
|
11116
|
+
]
|
|
11117
|
+
}
|
|
11118
|
+
]
|
|
11119
|
+
}
|
|
11120
|
+
}
|
|
11121
|
+
],
|
|
11122
|
+
args: [
|
|
11123
|
+
{
|
|
11124
|
+
name: "cluster_offset",
|
|
11125
|
+
type: "u32"
|
|
11126
|
+
},
|
|
11127
|
+
{
|
|
11128
|
+
name: "node_offset",
|
|
11129
|
+
type: "u32"
|
|
11130
|
+
},
|
|
11131
|
+
{
|
|
11132
|
+
name: "stake",
|
|
11133
|
+
type: "u64"
|
|
11134
|
+
}
|
|
11135
|
+
]
|
|
11136
|
+
},
|
|
10295
11137
|
{
|
|
10296
11138
|
name: "submit_aggregated_bls_pubkey",
|
|
10297
11139
|
discriminator: [
|
|
@@ -11621,6 +12463,11 @@ var errors = [
|
|
|
11621
12463
|
name: "MaxParallelismReached",
|
|
11622
12464
|
msg: "Max parallelism reached"
|
|
11623
12465
|
},
|
|
12466
|
+
{
|
|
12467
|
+
code: 6104,
|
|
12468
|
+
name: "MempoolAlreadyFullSize",
|
|
12469
|
+
msg: "Mempool is already at its full allocated size"
|
|
12470
|
+
},
|
|
11624
12471
|
{
|
|
11625
12472
|
code: 6200,
|
|
11626
12473
|
name: "InvalidComputationOffset",
|
|
@@ -11796,6 +12643,16 @@ var errors = [
|
|
|
11796
12643
|
name: "InvalidNodeOffset",
|
|
11797
12644
|
msg: "Node offset is invalid"
|
|
11798
12645
|
},
|
|
12646
|
+
{
|
|
12647
|
+
code: 6411,
|
|
12648
|
+
name: "InvalidStakingPoolSigner",
|
|
12649
|
+
msg: "The provided staking pool signer is not the staking program's StakingPoolAccount PDA"
|
|
12650
|
+
},
|
|
12651
|
+
{
|
|
12652
|
+
code: 6412,
|
|
12653
|
+
name: "InvalidStakingAccount",
|
|
12654
|
+
msg: "The provided primary stake account is not owned by the staking program or does not match the node's bound staking account"
|
|
12655
|
+
},
|
|
11799
12656
|
{
|
|
11800
12657
|
code: 6500,
|
|
11801
12658
|
name: "ClusterFull",
|
|
@@ -11854,7 +12711,7 @@ var errors = [
|
|
|
11854
12711
|
{
|
|
11855
12712
|
code: 6602,
|
|
11856
12713
|
name: "HeapFull",
|
|
11857
|
-
msg: "
|
|
12714
|
+
msg: "Mempool capacity for the current slot reached - retry next slot or reduce queue rate"
|
|
11858
12715
|
},
|
|
11859
12716
|
{
|
|
11860
12717
|
code: 6603,
|
|
@@ -11971,6 +12828,11 @@ var errors = [
|
|
|
11971
12828
|
name: "RecoveryInitAlreadyInitialized",
|
|
11972
12829
|
msg: "Recovery already initialized"
|
|
11973
12830
|
},
|
|
12831
|
+
{
|
|
12832
|
+
code: 6626,
|
|
12833
|
+
name: "InvalidSubsequentIx",
|
|
12834
|
+
msg: "Subsequent instruction in this transaction is not the expected one"
|
|
12835
|
+
},
|
|
11974
12836
|
{
|
|
11975
12837
|
code: 6700,
|
|
11976
12838
|
name: "MxeNotInMigrationState",
|
|
@@ -12095,6 +12957,11 @@ var errors = [
|
|
|
12095
12957
|
code: 6725,
|
|
12096
12958
|
name: "CannotCloseMxeDuringMigration",
|
|
12097
12959
|
msg: "MXE is in migration state, cannot close MXE"
|
|
12960
|
+
},
|
|
12961
|
+
{
|
|
12962
|
+
code: 6726,
|
|
12963
|
+
name: "InvalidMigrationAccount",
|
|
12964
|
+
msg: "Account is not a valid target for this migration (wrong owner or discriminator)"
|
|
12098
12965
|
}
|
|
12099
12966
|
];
|
|
12100
12967
|
var types = [
|
|
@@ -12895,30 +13762,71 @@ var types = [
|
|
|
12895
13762
|
}
|
|
12896
13763
|
},
|
|
12897
13764
|
{
|
|
12898
|
-
name: "bls_public_key",
|
|
13765
|
+
name: "bls_public_key",
|
|
13766
|
+
docs: [
|
|
13767
|
+
"BLS public key for the cluster (64 bytes compressed G2 point for alt-bn128)",
|
|
13768
|
+
"Set only when all nodes have submitted and agreed on the aggregated pubkey"
|
|
13769
|
+
],
|
|
13770
|
+
type: {
|
|
13771
|
+
defined: {
|
|
13772
|
+
name: "SetUnset",
|
|
13773
|
+
generics: [
|
|
13774
|
+
{
|
|
13775
|
+
kind: "type",
|
|
13776
|
+
type: {
|
|
13777
|
+
defined: {
|
|
13778
|
+
name: "BN254G2BLSPublicKey"
|
|
13779
|
+
}
|
|
13780
|
+
}
|
|
13781
|
+
}
|
|
13782
|
+
]
|
|
13783
|
+
}
|
|
13784
|
+
}
|
|
13785
|
+
},
|
|
13786
|
+
{
|
|
13787
|
+
name: "bump",
|
|
13788
|
+
docs: [
|
|
13789
|
+
"PDA bump. Declared by hand rather than via the `#[bump]` macro (which appends the bump",
|
|
13790
|
+
"as the *final* struct field) so it keeps its original offset right after",
|
|
13791
|
+
"`bls_public_key`. Everything below is appended *after* the bump, which means the byte",
|
|
13792
|
+
"layout of every field up to and including `bump` is identical to the pre-staking",
|
|
13793
|
+
"`Cluster` — old deserializers (including external user programs that read this account)",
|
|
13794
|
+
"decode the original prefix and harmlessly ignore the trailing staking fields."
|
|
13795
|
+
],
|
|
13796
|
+
type: "u8"
|
|
13797
|
+
},
|
|
13798
|
+
{
|
|
13799
|
+
name: "current_epoch_total_rewards",
|
|
13800
|
+
docs: [
|
|
13801
|
+
"Running total of computation rewards accrued during `rewards_epoch`. Drained to zero",
|
|
13802
|
+
"by `claim_node_fees` when nodes settle via `finalize_epoch_rewards`."
|
|
13803
|
+
],
|
|
13804
|
+
type: "u64"
|
|
13805
|
+
},
|
|
13806
|
+
{
|
|
13807
|
+
name: "rewards_epoch",
|
|
13808
|
+
docs: [
|
|
13809
|
+
"The epoch that `current_epoch_total_rewards` belongs to. If the clock has advanced",
|
|
13810
|
+
"past this epoch and `current_epoch_total_rewards > 0`, the rewards are stale",
|
|
13811
|
+
"(nodes didn't settle in time) — new accruals are silently skipped until nodes",
|
|
13812
|
+
"finalize, which punishes lazy operators."
|
|
13813
|
+
],
|
|
13814
|
+
type: {
|
|
13815
|
+
defined: {
|
|
13816
|
+
name: "Epoch"
|
|
13817
|
+
}
|
|
13818
|
+
}
|
|
13819
|
+
},
|
|
13820
|
+
{
|
|
13821
|
+
name: "leader_selector",
|
|
12899
13822
|
docs: [
|
|
12900
|
-
"
|
|
12901
|
-
"Set only when all nodes have submitted and agreed on the aggregated pubkey"
|
|
13823
|
+
"The selector for leader."
|
|
12902
13824
|
],
|
|
12903
13825
|
type: {
|
|
12904
13826
|
defined: {
|
|
12905
|
-
name: "
|
|
12906
|
-
generics: [
|
|
12907
|
-
{
|
|
12908
|
-
kind: "type",
|
|
12909
|
-
type: {
|
|
12910
|
-
defined: {
|
|
12911
|
-
name: "BN254G2BLSPublicKey"
|
|
12912
|
-
}
|
|
12913
|
-
}
|
|
12914
|
-
}
|
|
12915
|
-
]
|
|
13827
|
+
name: "LeaderSelector"
|
|
12916
13828
|
}
|
|
12917
13829
|
}
|
|
12918
|
-
},
|
|
12919
|
-
{
|
|
12920
|
-
name: "bump",
|
|
12921
|
-
type: "u8"
|
|
12922
13830
|
}
|
|
12923
13831
|
]
|
|
12924
13832
|
}
|
|
@@ -13452,16 +14360,28 @@ var types = [
|
|
|
13452
14360
|
{
|
|
13453
14361
|
name: "priority_fee",
|
|
13454
14362
|
docs: [
|
|
13455
|
-
"The additional fee to enforce
|
|
14363
|
+
"The additional fee to enforce prioritized execution in the mempool."
|
|
13456
14364
|
],
|
|
13457
14365
|
type: "u64"
|
|
13458
14366
|
},
|
|
13459
14367
|
{
|
|
13460
|
-
name: "
|
|
14368
|
+
name: "callback_cu_limit",
|
|
13461
14369
|
docs: [
|
|
13462
|
-
"
|
|
14370
|
+
"The compute unit limit to request for the callback transaction(s), i.e. how many CUs the",
|
|
14371
|
+
"node should request via set_compute_unit_limit. 0 means unset, in which case the node uses",
|
|
14372
|
+
"the default compute budget.",
|
|
14373
|
+
"",
|
|
14374
|
+
"This reuses the low 4 bytes of what was previously `output_delivery_fee: u64` (which was",
|
|
14375
|
+
"always 0), so the serialized layout of ExecutionFee is unchanged."
|
|
13463
14376
|
],
|
|
13464
|
-
type: "
|
|
14377
|
+
type: "u32"
|
|
14378
|
+
},
|
|
14379
|
+
{
|
|
14380
|
+
name: "padding",
|
|
14381
|
+
docs: [
|
|
14382
|
+
"Padding preserving the original 8-byte (u64) layout of the former `output_delivery_fee`."
|
|
14383
|
+
],
|
|
14384
|
+
type: "u32"
|
|
13465
14385
|
}
|
|
13466
14386
|
]
|
|
13467
14387
|
}
|
|
@@ -13827,6 +14747,113 @@ var types = [
|
|
|
13827
14747
|
]
|
|
13828
14748
|
}
|
|
13829
14749
|
},
|
|
14750
|
+
{
|
|
14751
|
+
name: "LeaderChoice",
|
|
14752
|
+
docs: [
|
|
14753
|
+
"The computation chosen by a node to be executed when the node is leader."
|
|
14754
|
+
],
|
|
14755
|
+
type: {
|
|
14756
|
+
kind: "struct",
|
|
14757
|
+
fields: [
|
|
14758
|
+
{
|
|
14759
|
+
name: "offset",
|
|
14760
|
+
docs: [
|
|
14761
|
+
"Computation_offset of the chosen computation."
|
|
14762
|
+
],
|
|
14763
|
+
type: "u64"
|
|
14764
|
+
},
|
|
14765
|
+
{
|
|
14766
|
+
name: "slot_idx",
|
|
14767
|
+
docs: [
|
|
14768
|
+
"The index of the max_heap the computation is in inside the MemPool's Circular Buffer.",
|
|
14769
|
+
"This is the physical index, not the logical one."
|
|
14770
|
+
],
|
|
14771
|
+
type: "u16"
|
|
14772
|
+
}
|
|
14773
|
+
]
|
|
14774
|
+
}
|
|
14775
|
+
},
|
|
14776
|
+
{
|
|
14777
|
+
name: "LeaderInfo",
|
|
14778
|
+
docs: [
|
|
14779
|
+
"The information about a node."
|
|
14780
|
+
],
|
|
14781
|
+
type: {
|
|
14782
|
+
kind: "struct",
|
|
14783
|
+
fields: [
|
|
14784
|
+
{
|
|
14785
|
+
name: "stake",
|
|
14786
|
+
docs: [
|
|
14787
|
+
"The node's stake."
|
|
14788
|
+
],
|
|
14789
|
+
type: "u64"
|
|
14790
|
+
},
|
|
14791
|
+
{
|
|
14792
|
+
name: "count",
|
|
14793
|
+
docs: [
|
|
14794
|
+
"The number + 1 of times the node has been chosen as leader in this cycle.",
|
|
14795
|
+
"0 if the stake is unset.",
|
|
14796
|
+
"This way works well for performance."
|
|
14797
|
+
],
|
|
14798
|
+
type: "u64"
|
|
14799
|
+
},
|
|
14800
|
+
{
|
|
14801
|
+
name: "last_counter_plus_one",
|
|
14802
|
+
docs: [
|
|
14803
|
+
"The last time the node has been chosen as leader."
|
|
14804
|
+
],
|
|
14805
|
+
type: "u64"
|
|
14806
|
+
},
|
|
14807
|
+
{
|
|
14808
|
+
name: "choice",
|
|
14809
|
+
docs: [
|
|
14810
|
+
"The choice of that node."
|
|
14811
|
+
],
|
|
14812
|
+
type: {
|
|
14813
|
+
defined: {
|
|
14814
|
+
name: "LeaderChoice"
|
|
14815
|
+
}
|
|
14816
|
+
}
|
|
14817
|
+
}
|
|
14818
|
+
]
|
|
14819
|
+
}
|
|
14820
|
+
},
|
|
14821
|
+
{
|
|
14822
|
+
name: "LeaderSelector",
|
|
14823
|
+
docs: [
|
|
14824
|
+
"To select a Leader.",
|
|
14825
|
+
"Uses the greatest divisors method: https://en.wikipedia.org/wiki/D%27Hondt_method"
|
|
14826
|
+
],
|
|
14827
|
+
type: {
|
|
14828
|
+
kind: "struct",
|
|
14829
|
+
fields: [
|
|
14830
|
+
{
|
|
14831
|
+
name: "staking_epoch",
|
|
14832
|
+
docs: [
|
|
14833
|
+
"The last epoch the staking was set."
|
|
14834
|
+
],
|
|
14835
|
+
type: {
|
|
14836
|
+
defined: {
|
|
14837
|
+
name: "Epoch"
|
|
14838
|
+
}
|
|
14839
|
+
}
|
|
14840
|
+
},
|
|
14841
|
+
{
|
|
14842
|
+
name: "info",
|
|
14843
|
+
docs: [
|
|
14844
|
+
"The information about each node."
|
|
14845
|
+
],
|
|
14846
|
+
type: {
|
|
14847
|
+
vec: {
|
|
14848
|
+
defined: {
|
|
14849
|
+
name: "LeaderInfo"
|
|
14850
|
+
}
|
|
14851
|
+
}
|
|
14852
|
+
}
|
|
14853
|
+
}
|
|
14854
|
+
]
|
|
14855
|
+
}
|
|
14856
|
+
},
|
|
13830
14857
|
{
|
|
13831
14858
|
name: "LocalCircuitSource",
|
|
13832
14859
|
type: {
|
|
@@ -13951,7 +14978,40 @@ var types = [
|
|
|
13951
14978
|
},
|
|
13952
14979
|
{
|
|
13953
14980
|
name: "bump",
|
|
14981
|
+
docs: [
|
|
14982
|
+
"PDA bump. Declared by hand rather than via the `#[bump]` macro (which appends the bump",
|
|
14983
|
+
"as the *final* struct field) so it keeps its original offset right after `status`.",
|
|
14984
|
+
"The recovery-reward fields below are appended *after* the bump, leaving the byte layout",
|
|
14985
|
+
"of every field up to and including `bump` identical to the pre-staking `MXEAccount` —",
|
|
14986
|
+
"old deserializers (including external user programs) decode the original prefix and",
|
|
14987
|
+
"harmlessly ignore the trailing fields."
|
|
14988
|
+
],
|
|
13954
14989
|
type: "u8"
|
|
14990
|
+
},
|
|
14991
|
+
{
|
|
14992
|
+
name: "current_epoch_recovery_rewards",
|
|
14993
|
+
docs: [
|
|
14994
|
+
"Running total of recovery-peer rewards accrued during `recovery_rewards_epoch`.",
|
|
14995
|
+
"Fed by the 20% slice of every computation/failure fee processed on this MXE;",
|
|
14996
|
+
"drained to zero by `claim_recovery_peer_fees` when recovery peers settle via",
|
|
14997
|
+
"`arcium_staking::finalize_recovery_epoch_rewards`. Same stale-epoch guard as",
|
|
14998
|
+
"`Cluster::current_epoch_total_rewards` — if peers don't settle before the epoch",
|
|
14999
|
+
"rolls over, new accruals are silently skipped until the pot is drained."
|
|
15000
|
+
],
|
|
15001
|
+
type: "u64"
|
|
15002
|
+
},
|
|
15003
|
+
{
|
|
15004
|
+
name: "recovery_rewards_epoch",
|
|
15005
|
+
docs: [
|
|
15006
|
+
"Epoch that `current_epoch_recovery_rewards` is attributed to. Compared against the",
|
|
15007
|
+
"executing cluster's `last_updated_epoch` (the same proxy used by cluster rewards) to",
|
|
15008
|
+
"decide whether a new accrual is for the current round or a stale one."
|
|
15009
|
+
],
|
|
15010
|
+
type: {
|
|
15011
|
+
defined: {
|
|
15012
|
+
name: "Epoch"
|
|
15013
|
+
}
|
|
15014
|
+
}
|
|
13955
15015
|
}
|
|
13956
15016
|
]
|
|
13957
15017
|
}
|
|
@@ -14286,9 +15346,7 @@ var types = [
|
|
|
14286
15346
|
name: "NodeRef",
|
|
14287
15347
|
docs: [
|
|
14288
15348
|
"A reference to a node in the cluster.",
|
|
14289
|
-
"The offset is to derive the Node Account."
|
|
14290
|
-
"The current_total_rewards is the total rewards the node has received so far in the current",
|
|
14291
|
-
"epoch."
|
|
15349
|
+
"The offset is to derive the Node Account."
|
|
14292
15350
|
],
|
|
14293
15351
|
type: {
|
|
14294
15352
|
kind: "struct",
|
|
@@ -14298,11 +15356,22 @@ var types = [
|
|
|
14298
15356
|
type: "u32"
|
|
14299
15357
|
},
|
|
14300
15358
|
{
|
|
14301
|
-
name: "
|
|
15359
|
+
name: "_padding",
|
|
14302
15360
|
docs: [
|
|
14303
|
-
"
|
|
15361
|
+
"Reserved padding occupying the 8 bytes that previously held `current_total_rewards: u64`",
|
|
15362
|
+
"(per-node reward tracking, now superseded by the cluster-level",
|
|
15363
|
+
"`current_epoch_total_rewards`). We keep these bytes rather than shrinking `NodeRef`",
|
|
15364
|
+
"because `nodes: Vec<NodeRef>` sits in the *middle* of the `Cluster` struct: removing the",
|
|
15365
|
+
"field would change the encoded element size and desync the borsh decode of every field",
|
|
15366
|
+
"after `nodes` for already-deployed accounts and external deserializers. Do not repurpose",
|
|
15367
|
+
"without a full account migration."
|
|
14304
15368
|
],
|
|
14305
|
-
type:
|
|
15369
|
+
type: {
|
|
15370
|
+
array: [
|
|
15371
|
+
"u8",
|
|
15372
|
+
8
|
|
15373
|
+
]
|
|
15374
|
+
}
|
|
14306
15375
|
},
|
|
14307
15376
|
{
|
|
14308
15377
|
name: "vote",
|
|
@@ -14740,7 +15809,27 @@ var types = [
|
|
|
14740
15809
|
},
|
|
14741
15810
|
{
|
|
14742
15811
|
name: "bump",
|
|
15812
|
+
docs: [
|
|
15813
|
+
"PDA bump. Declared by hand rather than via the `#[bump]` macro (which appends the bump",
|
|
15814
|
+
"as the *final* struct field) so it keeps its original offset (76) right after",
|
|
15815
|
+
"`peer_offset`. `primary_stake_account` is appended *after* the bump, leaving the byte",
|
|
15816
|
+
"layout of every field up to and including `bump` identical to the pre-staking",
|
|
15817
|
+
"`RecoveryPeerAccount` — old deserializers decode the original prefix and harmlessly",
|
|
15818
|
+
"ignore the trailing field."
|
|
15819
|
+
],
|
|
14743
15820
|
type: "u8"
|
|
15821
|
+
},
|
|
15822
|
+
{
|
|
15823
|
+
name: "primary_stake_account",
|
|
15824
|
+
docs: [
|
|
15825
|
+
"The `PrimaryStakingAccount` (owned by `arcium_staking`) this recovery peer is bound",
|
|
15826
|
+
"to. Enforced at init time via an owner check so every recovery peer has skin in the",
|
|
15827
|
+
"game — the same stake-first model we already apply to `ArxNode`. Stored here so",
|
|
15828
|
+
"downstream instructions (and off-chain consumers) can look up the backing stake",
|
|
15829
|
+
"without re-validating the chain of accounts. Appended after `bump` to preserve the",
|
|
15830
|
+
"legacy on-chain layout (see the `bump` field comment)."
|
|
15831
|
+
],
|
|
15832
|
+
type: "pubkey"
|
|
14744
15833
|
}
|
|
14745
15834
|
]
|
|
14746
15835
|
}
|
|
@@ -15289,6 +16378,26 @@ const MXE_RECOVERY_ACC_SEED = 'MxeRecoveryAccount';
|
|
|
15289
16378
|
* @constant {string}
|
|
15290
16379
|
*/
|
|
15291
16380
|
const RAW_CIRCUIT_ACC_SEED = 'ComputationDefinitionRaw';
|
|
16381
|
+
/**
|
|
16382
|
+
* Seed for RecoveryPeerAccount PDA.
|
|
16383
|
+
* @constant {string}
|
|
16384
|
+
*/
|
|
16385
|
+
const RECOVERY_PEER_ACC_SEED = 'RecoveryPeerAccount';
|
|
16386
|
+
/**
|
|
16387
|
+
* Seed for Operator PDA.
|
|
16388
|
+
* @constant {string}
|
|
16389
|
+
*/
|
|
16390
|
+
const OPERATOR_ACC_SEED = 'Operator';
|
|
16391
|
+
/**
|
|
16392
|
+
* Seed for FailureClaimAccountHeader PDA.
|
|
16393
|
+
* @constant {string}
|
|
16394
|
+
*/
|
|
16395
|
+
const FAILURE_CLAIM_ACC_SEED = 'FailureClaimAccountHeader';
|
|
16396
|
+
/**
|
|
16397
|
+
* Seed for ArciumSignerAccount PDA.
|
|
16398
|
+
* @constant {string}
|
|
16399
|
+
*/
|
|
16400
|
+
const ARCIUM_SIGNER_ACC_SEED = 'ArciumSignerAccount';
|
|
15292
16401
|
/**
|
|
15293
16402
|
* Maximum number of bytes that can be reallocated per instruction.
|
|
15294
16403
|
* @constant {number}
|
|
@@ -15309,11 +16418,36 @@ const MAX_ACCOUNT_SIZE = 10485760;
|
|
|
15309
16418
|
* @constant {number}
|
|
15310
16419
|
*/
|
|
15311
16420
|
const MAX_EMBIGGEN_IX_PER_TX = 18;
|
|
16421
|
+
/**
|
|
16422
|
+
* Default number of upload transactions sent in parallel.
|
|
16423
|
+
* @constant {number}
|
|
16424
|
+
*/
|
|
16425
|
+
const DEFAULT_UPLOAD_TX_BATCH_SIZE = 500;
|
|
15312
16426
|
/**
|
|
15313
16427
|
* Size of account discriminator in bytes.
|
|
15314
16428
|
* @constant {number}
|
|
15315
16429
|
*/
|
|
15316
16430
|
const DISCRIMINATOR_SIZE = 8;
|
|
16431
|
+
/**
|
|
16432
|
+
* Size of the bump field in a ComputationDefinitionRaw account.
|
|
16433
|
+
* @constant {number}
|
|
16434
|
+
*/
|
|
16435
|
+
const RAW_CIRCUIT_ACCOUNT_BUMP_SIZE = 1;
|
|
16436
|
+
/**
|
|
16437
|
+
* Size of ComputationDefinitionRaw account metadata before circuit bytes.
|
|
16438
|
+
* @constant {number}
|
|
16439
|
+
*/
|
|
16440
|
+
const RAW_CIRCUIT_ACCOUNT_HEADER_SIZE = DISCRIMINATOR_SIZE + RAW_CIRCUIT_ACCOUNT_BUMP_SIZE;
|
|
16441
|
+
/**
|
|
16442
|
+
* Maximum circuit bytes that fit in one ComputationDefinitionRaw account.
|
|
16443
|
+
* @constant {number}
|
|
16444
|
+
*/
|
|
16445
|
+
const MAX_RAW_CIRCUIT_BYTES_PER_ACC = MAX_ACCOUNT_SIZE - RAW_CIRCUIT_ACCOUNT_HEADER_SIZE;
|
|
16446
|
+
/**
|
|
16447
|
+
* Maximum number of raw circuit accounts addressable by the u8 raw circuit index.
|
|
16448
|
+
* @constant {number}
|
|
16449
|
+
*/
|
|
16450
|
+
const MAX_RAW_CIRCUIT_ACCOUNTS = 256;
|
|
15317
16451
|
/**
|
|
15318
16452
|
* Size of offset buffer in bytes (u32).
|
|
15319
16453
|
* @constant {number}
|
|
@@ -15324,7 +16458,20 @@ const OFFSET_BUFFER_SIZE = 4;
|
|
|
15324
16458
|
* @constant {number}
|
|
15325
16459
|
*/
|
|
15326
16460
|
const COMP_DEF_OFFSET_SIZE = 4;
|
|
16461
|
+
/**
|
|
16462
|
+
* Maximum recovery peer slots supported by key recovery accounts.
|
|
16463
|
+
* @constant {number}
|
|
16464
|
+
*/
|
|
16465
|
+
const MAX_RECOVERY_PEERS = 100;
|
|
16466
|
+
/**
|
|
16467
|
+
* Minimum recovery peers required for key recovery.
|
|
16468
|
+
* @constant {number}
|
|
16469
|
+
*/
|
|
16470
|
+
const MIN_RECOVERY_PEERS = 4;
|
|
15327
16471
|
|
|
16472
|
+
const U64_SEED_SIZE = 8;
|
|
16473
|
+
const MAX_U8 = 0xff;
|
|
16474
|
+
const MAX_U32$1 = 0xffffffff;
|
|
15328
16475
|
/**
|
|
15329
16476
|
* Return the public key of the deployed Arcium program on Solana.
|
|
15330
16477
|
* @returns Arcium program's public key.
|
|
@@ -15339,10 +16486,7 @@ function getArciumProgramId() {
|
|
|
15339
16486
|
* @returns Derived computation account public key.
|
|
15340
16487
|
*/
|
|
15341
16488
|
function getComputationAccAddress(clusterOffset, computationOffset) {
|
|
15342
|
-
|
|
15343
|
-
clOffsetBuffer.writeUInt32LE(clusterOffset, 0);
|
|
15344
|
-
const seeds = [Buffer.from(COMPUTATION_ACC_SEED), clOffsetBuffer, computationOffset.toArrayLike(Buffer, 'le', 8)];
|
|
15345
|
-
return generateArciumPDAFrom(seeds)[0];
|
|
16489
|
+
return findArciumPda([stringSeed(COMPUTATION_ACC_SEED), u32Seed(clusterOffset), u64Seed(computationOffset)]);
|
|
15346
16490
|
}
|
|
15347
16491
|
/**
|
|
15348
16492
|
* Derive the mempool account address for a given cluster.
|
|
@@ -15350,10 +16494,7 @@ function getComputationAccAddress(clusterOffset, computationOffset) {
|
|
|
15350
16494
|
* @returns Derived mempool account public key.
|
|
15351
16495
|
*/
|
|
15352
16496
|
function getMempoolAccAddress(clusterOffset) {
|
|
15353
|
-
|
|
15354
|
-
clOffsetBuffer.writeUInt32LE(clusterOffset, 0);
|
|
15355
|
-
const seeds = [Buffer.from(MEMPOOL_ACC_SEED), clOffsetBuffer];
|
|
15356
|
-
return generateArciumPDAFrom(seeds)[0];
|
|
16497
|
+
return findArciumPda([stringSeed(MEMPOOL_ACC_SEED), u32Seed(clusterOffset)]);
|
|
15357
16498
|
}
|
|
15358
16499
|
/**
|
|
15359
16500
|
* Derive the executing pool account address for a given cluster.
|
|
@@ -15361,26 +16502,21 @@ function getMempoolAccAddress(clusterOffset) {
|
|
|
15361
16502
|
* @returns Derived executing pool account public key.
|
|
15362
16503
|
*/
|
|
15363
16504
|
function getExecutingPoolAccAddress(clusterOffset) {
|
|
15364
|
-
|
|
15365
|
-
clOffsetBuffer.writeUInt32LE(clusterOffset, 0);
|
|
15366
|
-
const seeds = [Buffer.from(EXEC_POOL_ACC_SEED), clOffsetBuffer];
|
|
15367
|
-
return generateArciumPDAFrom(seeds)[0];
|
|
16505
|
+
return findArciumPda([stringSeed(EXEC_POOL_ACC_SEED), u32Seed(clusterOffset)]);
|
|
15368
16506
|
}
|
|
15369
16507
|
/**
|
|
15370
16508
|
* Derive the fee pool account address.
|
|
15371
16509
|
* @returns Derived fee pool account public key.
|
|
15372
16510
|
*/
|
|
15373
16511
|
function getFeePoolAccAddress() {
|
|
15374
|
-
|
|
15375
|
-
return generateArciumPDAFrom(seeds)[0];
|
|
16512
|
+
return findArciumPda([stringSeed(POOL_ACC_SEED)]);
|
|
15376
16513
|
}
|
|
15377
16514
|
/**
|
|
15378
16515
|
* Derive the clock account address.
|
|
15379
16516
|
* @returns Derived clock account public key.
|
|
15380
16517
|
*/
|
|
15381
16518
|
function getClockAccAddress() {
|
|
15382
|
-
|
|
15383
|
-
return generateArciumPDAFrom(seeds)[0];
|
|
16519
|
+
return findArciumPda([stringSeed(CLOCK_ACC_SEED)]);
|
|
15384
16520
|
}
|
|
15385
16521
|
/**
|
|
15386
16522
|
* Derive the cluster account address for a given offset.
|
|
@@ -15388,10 +16524,7 @@ function getClockAccAddress() {
|
|
|
15388
16524
|
* @returns Derived cluster account public key.
|
|
15389
16525
|
*/
|
|
15390
16526
|
function getClusterAccAddress(clusterOffset) {
|
|
15391
|
-
|
|
15392
|
-
offsetBuffer.writeUInt32LE(clusterOffset, 0);
|
|
15393
|
-
const seeds = [Buffer.from(CLUSTER_ACC_SEED), offsetBuffer];
|
|
15394
|
-
return generateArciumPDAFrom(seeds)[0];
|
|
16527
|
+
return findArciumPda([stringSeed(CLUSTER_ACC_SEED), u32Seed(clusterOffset)]);
|
|
15395
16528
|
}
|
|
15396
16529
|
/**
|
|
15397
16530
|
* Derive the ArxNode account address for a given offset.
|
|
@@ -15399,10 +16532,7 @@ function getClusterAccAddress(clusterOffset) {
|
|
|
15399
16532
|
* @returns Derived ArxNode account public key.
|
|
15400
16533
|
*/
|
|
15401
16534
|
function getArxNodeAccAddress(nodeOffset) {
|
|
15402
|
-
|
|
15403
|
-
offsetBuffer.writeUInt32LE(nodeOffset, 0);
|
|
15404
|
-
const seeds = [Buffer.from(ARX_NODE_ACC_SEED), offsetBuffer];
|
|
15405
|
-
return generateArciumPDAFrom(seeds)[0];
|
|
16535
|
+
return findArciumPda([stringSeed(ARX_NODE_ACC_SEED), u32Seed(nodeOffset)]);
|
|
15406
16536
|
}
|
|
15407
16537
|
/**
|
|
15408
16538
|
* Derive the MXE account address for a given MXE program ID.
|
|
@@ -15410,8 +16540,7 @@ function getArxNodeAccAddress(nodeOffset) {
|
|
|
15410
16540
|
* @returns Derived MXE account public key.
|
|
15411
16541
|
*/
|
|
15412
16542
|
function getMXEAccAddress(mxeProgramId) {
|
|
15413
|
-
|
|
15414
|
-
return generateArciumPDAFrom(seeds)[0];
|
|
16543
|
+
return findArciumPda([stringSeed(MXE_ACCOUNT_SEED), pubkeySeed(mxeProgramId)]);
|
|
15415
16544
|
}
|
|
15416
16545
|
/**
|
|
15417
16546
|
* Derive the computation definition account address for a given MXE program ID and offset.
|
|
@@ -15420,10 +16549,7 @@ function getMXEAccAddress(mxeProgramId) {
|
|
|
15420
16549
|
* @returns Derived computation definition account public key.
|
|
15421
16550
|
*/
|
|
15422
16551
|
function getCompDefAccAddress(mxeProgramId, compDefOffset) {
|
|
15423
|
-
|
|
15424
|
-
offsetBuffer.writeUInt32LE(compDefOffset, 0);
|
|
15425
|
-
const seeds = [Buffer.from(COMP_DEF_ACC_SEED), mxeProgramId.toBuffer(), offsetBuffer];
|
|
15426
|
-
return generateArciumPDAFrom(seeds)[0];
|
|
16552
|
+
return findArciumPda([stringSeed(COMP_DEF_ACC_SEED), pubkeySeed(mxeProgramId), u32Seed(compDefOffset)]);
|
|
15427
16553
|
}
|
|
15428
16554
|
/**
|
|
15429
16555
|
* Derive the recovery cluster account address for a given MXE program ID.
|
|
@@ -15431,8 +16557,7 @@ function getCompDefAccAddress(mxeProgramId, compDefOffset) {
|
|
|
15431
16557
|
* @returns Derived recovery cluster account public key.
|
|
15432
16558
|
*/
|
|
15433
16559
|
function getRecoveryClusterAccAddress(mxeProgramId) {
|
|
15434
|
-
|
|
15435
|
-
return generateArciumPDAFrom(seeds)[0];
|
|
16560
|
+
return findArciumPda([stringSeed(RECOVERY_CLUSTER_ACC_SEED), pubkeySeed(mxeProgramId)]);
|
|
15436
16561
|
}
|
|
15437
16562
|
/**
|
|
15438
16563
|
* Derive the MXE recovery account address for a key recovery session.
|
|
@@ -15440,22 +16565,52 @@ function getRecoveryClusterAccAddress(mxeProgramId) {
|
|
|
15440
16565
|
* @returns Derived MXE recovery account public key.
|
|
15441
16566
|
*/
|
|
15442
16567
|
function getMxeRecoveryAccAddress(originalMxeProgramId) {
|
|
15443
|
-
|
|
15444
|
-
|
|
16568
|
+
return findArciumPda([stringSeed(MXE_RECOVERY_ACC_SEED), pubkeySeed(originalMxeProgramId)]);
|
|
16569
|
+
}
|
|
16570
|
+
/**
|
|
16571
|
+
* Derive the recovery peer account address for a given recovery peer offset.
|
|
16572
|
+
* @param peerOffset - Recovery peer offset as a u32 in `[0, 2^32 - 1]`.
|
|
16573
|
+
* @returns Derived recovery peer account public key.
|
|
16574
|
+
*/
|
|
16575
|
+
function getRecoveryPeerAccAddress(peerOffset) {
|
|
16576
|
+
return findArciumPda([stringSeed(RECOVERY_PEER_ACC_SEED), u32Seed(peerOffset)]);
|
|
16577
|
+
}
|
|
16578
|
+
/**
|
|
16579
|
+
* Derive the operator account address for a given operator signer.
|
|
16580
|
+
* @param operatorSigner - Public key of the operator signer.
|
|
16581
|
+
* @returns Derived operator account public key.
|
|
16582
|
+
*/
|
|
16583
|
+
function getOperatorAccAddress(operatorSigner) {
|
|
16584
|
+
return findArciumPda([stringSeed(OPERATOR_ACC_SEED), pubkeySeed(operatorSigner)]);
|
|
16585
|
+
}
|
|
16586
|
+
/**
|
|
16587
|
+
* Derive the failure claim account address for a given MXE program and computation offset.
|
|
16588
|
+
* @param mxeProgramId - Public key of the MXE program.
|
|
16589
|
+
* @param computationOffset - Computation offset as an anchor.BN in `[0, 2^64 - 1]`.
|
|
16590
|
+
* @returns Derived failure claim account public key.
|
|
16591
|
+
*/
|
|
16592
|
+
function getFailureClaimAccAddress(mxeProgramId, computationOffset) {
|
|
16593
|
+
return findArciumPda([stringSeed(FAILURE_CLAIM_ACC_SEED), pubkeySeed(mxeProgramId), u64Seed(computationOffset)]);
|
|
16594
|
+
}
|
|
16595
|
+
/**
|
|
16596
|
+
* Derive the Arcium signer account address used by an MXE program when invoking the Arcium
|
|
16597
|
+
* program. Unlike most other helpers in this module, this PDA is derived under the MXE
|
|
16598
|
+
* program ID (the caller), not the Arcium program ID - Arcium verifies the seed via
|
|
16599
|
+
* `seeds::program = _mxe_program`.
|
|
16600
|
+
* @param mxeProgramId - Public key of the MXE program that owns the signer PDA.
|
|
16601
|
+
* @returns Derived Arcium signer account public key.
|
|
16602
|
+
*/
|
|
16603
|
+
function getArciumSignerAccAddress(mxeProgramId) {
|
|
16604
|
+
return findPda(mxeProgramId, [stringSeed(ARCIUM_SIGNER_ACC_SEED)]);
|
|
15445
16605
|
}
|
|
15446
16606
|
/**
|
|
15447
16607
|
* Derive the raw circuit account address for a given computation definition and index.
|
|
15448
16608
|
* @param compDefPubkey - Public key of the computation definition account.
|
|
15449
|
-
* @param rawCircuitIndex - Index of the raw circuit account
|
|
16609
|
+
* @param rawCircuitIndex - Index of the raw circuit account as a u8 in `[0, 255]`.
|
|
15450
16610
|
* @returns Derived raw circuit account public key.
|
|
15451
16611
|
*/
|
|
15452
16612
|
function getRawCircuitAccAddress(compDefPubkey, rawCircuitIndex) {
|
|
15453
|
-
|
|
15454
|
-
Buffer.from(RAW_CIRCUIT_ACC_SEED),
|
|
15455
|
-
compDefPubkey.toBuffer(),
|
|
15456
|
-
Buffer.from([rawCircuitIndex]),
|
|
15457
|
-
];
|
|
15458
|
-
return generateArciumPDAFrom(seeds)[0];
|
|
16613
|
+
return findArciumPda([stringSeed(RAW_CIRCUIT_ACC_SEED), pubkeySeed(compDefPubkey), u8Seed(rawCircuitIndex)]);
|
|
15459
16614
|
}
|
|
15460
16615
|
/**
|
|
15461
16616
|
* Derive the address lookup table address for an MXE program.
|
|
@@ -15465,120 +16620,149 @@ function getRawCircuitAccAddress(compDefPubkey, rawCircuitIndex) {
|
|
|
15465
16620
|
*/
|
|
15466
16621
|
function getLookupTableAddress(mxeProgramId, lutOffset) {
|
|
15467
16622
|
const mxeAccount = getMXEAccAddress(mxeProgramId);
|
|
15468
|
-
|
|
15469
|
-
const seeds = [mxeAccount.toBuffer(), lutIndexBuffer];
|
|
15470
|
-
return PublicKey.findProgramAddressSync(seeds, AddressLookupTableProgram.programId)[0];
|
|
16623
|
+
return findPda(AddressLookupTableProgram.programId, [pubkeySeed(mxeAccount), u64Seed(lutOffset)]);
|
|
15471
16624
|
}
|
|
15472
|
-
|
|
15473
|
-
|
|
15474
|
-
|
|
15475
|
-
|
|
15476
|
-
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
16625
|
+
function stringSeed(value) {
|
|
16626
|
+
return Buffer.from(value);
|
|
16627
|
+
}
|
|
16628
|
+
function u8Seed(value) {
|
|
16629
|
+
assertIntegerInRange(value, 0, MAX_U8, 'u8 seed');
|
|
16630
|
+
return Buffer.from([value]);
|
|
16631
|
+
}
|
|
16632
|
+
function u32Seed(value) {
|
|
16633
|
+
assertIntegerInRange(value, 0, MAX_U32$1, 'u32 seed');
|
|
16634
|
+
const buffer = Buffer.alloc(OFFSET_BUFFER_SIZE);
|
|
16635
|
+
buffer.writeUInt32LE(value, 0);
|
|
16636
|
+
return buffer;
|
|
16637
|
+
}
|
|
16638
|
+
function u64Seed(value) {
|
|
16639
|
+
if (value.isNeg() || value.byteLength() > U64_SEED_SIZE) {
|
|
16640
|
+
throw new RangeError(`u64 seed must be between 0 and 18446744073709551615 (got ${value.toString()})`);
|
|
16641
|
+
}
|
|
16642
|
+
return value.toArrayLike(Buffer, 'le', U64_SEED_SIZE);
|
|
16643
|
+
}
|
|
16644
|
+
function pubkeySeed(value) {
|
|
16645
|
+
return value.toBuffer();
|
|
16646
|
+
}
|
|
16647
|
+
function findArciumPda(seeds) {
|
|
16648
|
+
return findPda(getArciumProgramId(), seeds);
|
|
16649
|
+
}
|
|
16650
|
+
function findPda(programId, seeds) {
|
|
16651
|
+
return PublicKey.findProgramAddressSync(seeds, programId)[0];
|
|
16652
|
+
}
|
|
16653
|
+
function assertIntegerInRange(value, min, max, label) {
|
|
16654
|
+
if (!Number.isInteger(value) || value < min || value > max) {
|
|
16655
|
+
throw new RangeError(`${label} must be an integer between ${min} and ${max} (got ${value})`);
|
|
16656
|
+
}
|
|
15480
16657
|
}
|
|
15481
16658
|
|
|
15482
|
-
|
|
15483
|
-
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
135,
|
|
15490
|
-
110,
|
|
15491
|
-
166,
|
|
15492
|
-
];
|
|
15493
|
-
const TINY_EXECPOOL_ACC_NAME = 'tinyExecPool';
|
|
15494
|
-
const TINY_EXECPOOL_DISCRIMINATOR = [
|
|
15495
|
-
80,
|
|
15496
|
-
245,
|
|
15497
|
-
5,
|
|
15498
|
-
90,
|
|
15499
|
-
154,
|
|
15500
|
-
189,
|
|
15501
|
-
190,
|
|
15502
|
-
172,
|
|
15503
|
-
];
|
|
15504
|
-
const SMALL_MEMPOOL_ACC_NAME = 'smallMempool';
|
|
15505
|
-
const SMALL_MEMPOOL_DISCRIMINATOR = [
|
|
15506
|
-
123,
|
|
15507
|
-
153,
|
|
15508
|
-
151,
|
|
15509
|
-
118,
|
|
15510
|
-
126,
|
|
15511
|
-
71,
|
|
15512
|
-
73,
|
|
15513
|
-
92,
|
|
15514
|
-
];
|
|
15515
|
-
const SMALL_EXECPOOL_ACC_NAME = 'smallExecPool';
|
|
15516
|
-
const SMALL_EXECPOOL_DISCRIMINATOR = [
|
|
15517
|
-
37,
|
|
15518
|
-
147,
|
|
15519
|
-
249,
|
|
15520
|
-
253,
|
|
15521
|
-
217,
|
|
15522
|
-
136,
|
|
15523
|
-
3,
|
|
15524
|
-
87,
|
|
16659
|
+
// Names are validated against the IDL account-name union at compile time, so a
|
|
16660
|
+
// typo or stale tier fails `tsc` rather than only throwing at load.
|
|
16661
|
+
const MEMPOOL_DECODER_ACCOUNT_NAMES = [
|
|
16662
|
+
'tinyMempool',
|
|
16663
|
+
'smallMempool',
|
|
16664
|
+
'mediumMempool',
|
|
16665
|
+
'largeMempool',
|
|
15525
16666
|
];
|
|
15526
|
-
const
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
39,
|
|
15532
|
-
255,
|
|
15533
|
-
231,
|
|
15534
|
-
199,
|
|
15535
|
-
168,
|
|
16667
|
+
const EXECUTING_POOL_DECODER_ACCOUNT_NAMES = [
|
|
16668
|
+
'tinyExecPool',
|
|
16669
|
+
'smallExecPool',
|
|
16670
|
+
'mediumExecPool',
|
|
16671
|
+
'largeExecPool',
|
|
15536
16672
|
];
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15581
|
-
|
|
16673
|
+
function discriminatorKey(discriminator) {
|
|
16674
|
+
return Buffer.from(discriminator).toString('hex');
|
|
16675
|
+
}
|
|
16676
|
+
// Discriminator bytes are read from the IDL at load time rather than pinned, so the
|
|
16677
|
+
// decoder tracks the program's account layout as the single source of truth; a
|
|
16678
|
+
// missing or renamed tier throws here instead of silently misrouting at runtime.
|
|
16679
|
+
const accountDiscriminatorCoder = new BorshCoder(convertIdlToCamelCase(ARCIUM_IDL)).accounts;
|
|
16680
|
+
function buildPoolAccountMap(accountNames) {
|
|
16681
|
+
return new Map(accountNames.map((name) => [
|
|
16682
|
+
discriminatorKey(accountDiscriminatorCoder.accountDiscriminator(name)),
|
|
16683
|
+
name,
|
|
16684
|
+
]));
|
|
16685
|
+
}
|
|
16686
|
+
const MEMPOOL_ACCOUNT_BY_DISCRIMINATOR = buildPoolAccountMap(MEMPOOL_DECODER_ACCOUNT_NAMES);
|
|
16687
|
+
const EXECUTING_POOL_ACCOUNT_BY_DISCRIMINATOR = buildPoolAccountMap(EXECUTING_POOL_DECODER_ACCOUNT_NAMES);
|
|
16688
|
+
function getPoolAccountNameByDiscriminator(accountData, accountsByDiscriminator, kind) {
|
|
16689
|
+
if (accountData.length < DISCRIMINATOR_SIZE) {
|
|
16690
|
+
throw new Error(`${kind} account data is shorter than discriminator size`);
|
|
16691
|
+
}
|
|
16692
|
+
const key = discriminatorKey(accountData.subarray(0, DISCRIMINATOR_SIZE));
|
|
16693
|
+
const accountName = accountsByDiscriminator.get(key);
|
|
16694
|
+
if (accountName === undefined) {
|
|
16695
|
+
throw new Error(`Unknown ${kind} account discriminator: ${key}`);
|
|
16696
|
+
}
|
|
16697
|
+
return accountName;
|
|
16698
|
+
}
|
|
16699
|
+
/** @internal */
|
|
16700
|
+
function getMempoolAccountNameByDiscriminator(accountData) {
|
|
16701
|
+
return getPoolAccountNameByDiscriminator(accountData, MEMPOOL_ACCOUNT_BY_DISCRIMINATOR, 'mempool');
|
|
16702
|
+
}
|
|
16703
|
+
/** @internal */
|
|
16704
|
+
function getExecutingPoolAccountNameByDiscriminator(accountData) {
|
|
16705
|
+
return getPoolAccountNameByDiscriminator(accountData, EXECUTING_POOL_ACCOUNT_BY_DISCRIMINATOR, 'executing pool');
|
|
16706
|
+
}
|
|
16707
|
+
|
|
16708
|
+
const MAX_U32 = 0xffffffff;
|
|
16709
|
+
/**
|
|
16710
|
+
* Mirrors the on-chain `init_mxe_part2` recovery-peer bounds before building the instruction.
|
|
16711
|
+
* @internal
|
|
16712
|
+
*/
|
|
16713
|
+
function assertValidRecoveryPeers(recoveryPeers) {
|
|
16714
|
+
if (recoveryPeers.length > MAX_RECOVERY_PEERS) {
|
|
16715
|
+
throw new Error(`recoveryPeers must have at most ${MAX_RECOVERY_PEERS} elements (got ${recoveryPeers.length})`);
|
|
16716
|
+
}
|
|
16717
|
+
let nonZeroPeers = 0;
|
|
16718
|
+
for (let index = 0; index < recoveryPeers.length; index += 1) {
|
|
16719
|
+
const peer = recoveryPeers[index];
|
|
16720
|
+
if (!Number.isInteger(peer) || peer < 0 || peer > MAX_U32) {
|
|
16721
|
+
throw new RangeError(`recoveryPeers[${index}] must be an integer in [0, ${MAX_U32}] (got ${peer})`);
|
|
16722
|
+
}
|
|
16723
|
+
if (peer !== 0) {
|
|
16724
|
+
nonZeroPeers += 1;
|
|
16725
|
+
}
|
|
16726
|
+
}
|
|
16727
|
+
if (nonZeroPeers > 0 && nonZeroPeers < MIN_RECOVERY_PEERS) {
|
|
16728
|
+
throw new Error(`recoveryPeers must have 0 or at least ${MIN_RECOVERY_PEERS} non-zero offsets (found ${nonZeroPeers})`);
|
|
16729
|
+
}
|
|
16730
|
+
}
|
|
16731
|
+
/** @internal */
|
|
16732
|
+
function normalizeRecoveryPeers(recoveryPeers) {
|
|
16733
|
+
assertValidRecoveryPeers(recoveryPeers);
|
|
16734
|
+
const paddedRecoveryPeers = [...recoveryPeers];
|
|
16735
|
+
while (paddedRecoveryPeers.length < MAX_RECOVERY_PEERS) {
|
|
16736
|
+
paddedRecoveryPeers.push(0);
|
|
16737
|
+
}
|
|
16738
|
+
return paddedRecoveryPeers;
|
|
16739
|
+
}
|
|
16740
|
+
|
|
16741
|
+
/** @internal */
|
|
16742
|
+
function getRawCircuitAccountCount(rawCircuitByteLength) {
|
|
16743
|
+
if (!Number.isInteger(rawCircuitByteLength) || rawCircuitByteLength < 0) {
|
|
16744
|
+
throw new RangeError(`rawCircuit byte length must be a non-negative integer (got ${rawCircuitByteLength})`);
|
|
16745
|
+
}
|
|
16746
|
+
const accountCount = Math.ceil(rawCircuitByteLength / MAX_RAW_CIRCUIT_BYTES_PER_ACC);
|
|
16747
|
+
if (accountCount > MAX_RAW_CIRCUIT_ACCOUNTS) {
|
|
16748
|
+
throw new RangeError(`Raw circuit is too large for on-chain upload: requires ${accountCount} raw circuit accounts, maximum is ${MAX_RAW_CIRCUIT_ACCOUNTS}`);
|
|
16749
|
+
}
|
|
16750
|
+
return accountCount;
|
|
16751
|
+
}
|
|
16752
|
+
/** @internal */
|
|
16753
|
+
function assertRawCircuitUploadLength(rawCircuitByteLength, declaredCircuitByteLength, circuitName) {
|
|
16754
|
+
if (!Number.isInteger(rawCircuitByteLength) || rawCircuitByteLength < 0) {
|
|
16755
|
+
throw new RangeError(`rawCircuit byte length must be a non-negative integer (got ${rawCircuitByteLength})`);
|
|
16756
|
+
}
|
|
16757
|
+
if (!Number.isInteger(declaredCircuitByteLength) || declaredCircuitByteLength <= 0) {
|
|
16758
|
+
throw new RangeError(`Declared circuit byte length for ${circuitName} must be a positive integer (got ${declaredCircuitByteLength})`);
|
|
16759
|
+
}
|
|
16760
|
+
if (rawCircuitByteLength !== declaredCircuitByteLength) {
|
|
16761
|
+
throw new RangeError(`Raw circuit byte length for ${circuitName} must match the computation definition: got ${rawCircuitByteLength}, expected ${declaredCircuitByteLength}`);
|
|
16762
|
+
}
|
|
16763
|
+
}
|
|
16764
|
+
|
|
16765
|
+
const { BN } = anchor__default;
|
|
15582
16766
|
/**
|
|
15583
16767
|
* Fetch and decode the mempool account info for any mempool account size.
|
|
15584
16768
|
* @param provider - Anchor provider to use for fetching accounts.
|
|
@@ -15587,15 +16771,8 @@ const EXECPOOL_DISCRIMINATOR_MAP = {
|
|
|
15587
16771
|
* @throws Error if the account cannot be fetched or the discriminator is unknown.
|
|
15588
16772
|
*/
|
|
15589
16773
|
async function getMempoolAccInfo(provider, mempoolAccPubkey) {
|
|
15590
|
-
const accData = await provider.connection.getAccountInfo(mempoolAccPubkey);
|
|
15591
|
-
|
|
15592
|
-
throw new Error(`Failed to fetch mempool account ${mempoolAccPubkey.toBase58()}`);
|
|
15593
|
-
}
|
|
15594
|
-
const discriminator = Array.from(accData.data.subarray(0, DISCRIMINATOR_SIZE)).toString();
|
|
15595
|
-
const accName = MEMPOOL_DISCRIMINATOR_MAP[discriminator];
|
|
15596
|
-
if (accName === undefined) {
|
|
15597
|
-
throw new Error(`Unknown mempool account discriminator: ${discriminator}`);
|
|
15598
|
-
}
|
|
16774
|
+
const accData = requireAccountInfo(await provider.connection.getAccountInfo(mempoolAccPubkey), mempoolAccPubkey, 'mempool');
|
|
16775
|
+
const accName = getMempoolAccountNameByDiscriminator(accData.data);
|
|
15599
16776
|
const program = getArciumProgram(provider);
|
|
15600
16777
|
return program.coder.accounts.decode(accName, accData.data);
|
|
15601
16778
|
}
|
|
@@ -15607,18 +16784,17 @@ async function getMempoolAccInfo(provider, mempoolAccPubkey) {
|
|
|
15607
16784
|
* @throws Error if the account cannot be fetched or the discriminator is unknown.
|
|
15608
16785
|
*/
|
|
15609
16786
|
async function getExecutingPoolAccInfo(provider, executingPoolAccPubkey) {
|
|
15610
|
-
const accData = await provider.connection.getAccountInfo(executingPoolAccPubkey);
|
|
15611
|
-
|
|
15612
|
-
throw new Error(`Failed to fetch executing pool account ${executingPoolAccPubkey.toBase58()}`);
|
|
15613
|
-
}
|
|
15614
|
-
const discriminator = Array.from(accData.data.subarray(0, DISCRIMINATOR_SIZE)).toString();
|
|
15615
|
-
const accName = EXECPOOL_DISCRIMINATOR_MAP[discriminator];
|
|
15616
|
-
if (accName === undefined) {
|
|
15617
|
-
throw new Error(`Unknown executing pool account discriminator: ${discriminator}`);
|
|
15618
|
-
}
|
|
16787
|
+
const accData = requireAccountInfo(await provider.connection.getAccountInfo(executingPoolAccPubkey), executingPoolAccPubkey, 'executing pool');
|
|
16788
|
+
const accName = getExecutingPoolAccountNameByDiscriminator(accData.data);
|
|
15619
16789
|
const program = getArciumProgram(provider);
|
|
15620
16790
|
return program.coder.accounts.decode(accName, accData.data);
|
|
15621
16791
|
}
|
|
16792
|
+
function requireAccountInfo(accountInfo, pubkey, label) {
|
|
16793
|
+
if (accountInfo === null) {
|
|
16794
|
+
throw new Error(`Failed to fetch ${label} account ${pubkey.toBase58()}`);
|
|
16795
|
+
}
|
|
16796
|
+
return accountInfo;
|
|
16797
|
+
}
|
|
15622
16798
|
/**
|
|
15623
16799
|
* Return all computation references in the mempool for a given account.
|
|
15624
16800
|
* Only non-stake computations are included.
|
|
@@ -15662,15 +16838,15 @@ async function getComputationsInMempool(arciumProgram, address) {
|
|
|
15662
16838
|
async function getMempoolPriorityFeeStats(arciumProgram, mempoolAddress) {
|
|
15663
16839
|
const refs = await getComputationsInMempool(arciumProgram, mempoolAddress);
|
|
15664
16840
|
if (refs.length === 0) {
|
|
15665
|
-
const zero = new
|
|
16841
|
+
const zero = new BN(0);
|
|
15666
16842
|
return { mean: zero, median: zero, min: zero, max: zero, count: 0 };
|
|
15667
16843
|
}
|
|
15668
16844
|
const fees = refs.map(ref => ref.priorityFee).sort((a, b) => a.cmp(b));
|
|
15669
|
-
const sum = fees.reduce((acc, fee) => acc.add(fee), new
|
|
15670
|
-
const mean = sum.div(new
|
|
16845
|
+
const sum = fees.reduce((acc, fee) => acc.add(fee), new BN(0));
|
|
16846
|
+
const mean = sum.div(new BN(fees.length));
|
|
15671
16847
|
const mid = Math.floor(fees.length / 2);
|
|
15672
16848
|
const median = fees.length % 2 === 0
|
|
15673
|
-
? fees[mid - 1].add(fees[mid]).div(new
|
|
16849
|
+
? fees[mid - 1].add(fees[mid]).div(new BN(2))
|
|
15674
16850
|
: fees[mid];
|
|
15675
16851
|
return {
|
|
15676
16852
|
mean,
|
|
@@ -15743,11 +16919,12 @@ function getCircuitState(circuitSource) {
|
|
|
15743
16919
|
* @param mxeProgramId - Public key of the MXE program.
|
|
15744
16920
|
* @param rawCircuit - Raw circuit data as a Uint8Array.
|
|
15745
16921
|
* @param logging - Whether to log progress (default: true).
|
|
15746
|
-
* @param chunkSize - Number of upload transactions to send in parallel
|
|
16922
|
+
* @param chunkSize - Number of upload transactions to send in parallel. Defaults to
|
|
16923
|
+
* {@link DEFAULT_UPLOAD_TX_BATCH_SIZE}.
|
|
15747
16924
|
* @param confirmOptions - Transaction confirmation options.
|
|
15748
16925
|
* @returns Array of transaction signatures for all upload and finalize transactions.
|
|
15749
16926
|
*/
|
|
15750
|
-
async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, logging = true, chunkSize =
|
|
16927
|
+
async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, logging = true, chunkSize = DEFAULT_UPLOAD_TX_BATCH_SIZE, confirmOptions) {
|
|
15751
16928
|
const compDefAccInfo = getCompDefAccInfo(circuitName, mxeProgramId);
|
|
15752
16929
|
const program = getArciumProgram(provider);
|
|
15753
16930
|
const compDefAcc = await program.account.computationDefinitionAccount.fetch(compDefAccInfo.pubkey);
|
|
@@ -15757,12 +16934,12 @@ async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, lo
|
|
|
15757
16934
|
optionalLog(logging, `Circuit ${circuitName} skipped: ${state}`);
|
|
15758
16935
|
return [];
|
|
15759
16936
|
}
|
|
15760
|
-
|
|
15761
|
-
const numAccs =
|
|
16937
|
+
assertRawCircuitUploadLength(rawCircuit.length, compDefAcc.definition.circuitLen, circuitName);
|
|
16938
|
+
const numAccs = getRawCircuitAccountCount(rawCircuit.length);
|
|
15762
16939
|
const sigs = [];
|
|
15763
16940
|
const uploadPromises = [];
|
|
15764
16941
|
for (let i = 0; i < numAccs; i++) {
|
|
15765
|
-
uploadPromises.push(uploadToCircuitAcc(provider, program, rawCircuit.subarray(i *
|
|
16942
|
+
uploadPromises.push(uploadToCircuitAcc(provider, program, rawCircuit.subarray(i * MAX_RAW_CIRCUIT_BYTES_PER_ACC, (i + 1) * MAX_RAW_CIRCUIT_BYTES_PER_ACC), i, compDefAccInfo, mxeProgramId, logging, chunkSize, confirmOptions));
|
|
15766
16943
|
}
|
|
15767
16944
|
sigs.push(...(await Promise.all(uploadPromises)).flat());
|
|
15768
16945
|
const finalizeCompDefTx = await buildFinalizeCompDefTx(provider, compDefAccInfo.offset, mxeProgramId);
|
|
@@ -15778,8 +16955,6 @@ async function uploadCircuit(provider, circuitName, mxeProgramId, rawCircuit, lo
|
|
|
15778
16955
|
*/
|
|
15779
16956
|
async function buildFinalizeCompDefTx(provider, compDefOffset, mxeProgramId) {
|
|
15780
16957
|
const program = getArciumProgram(provider);
|
|
15781
|
-
const compDefOffsetBuffer = Buffer.alloc(OFFSET_BUFFER_SIZE);
|
|
15782
|
-
compDefOffsetBuffer.writeUInt32LE(compDefOffset, 0);
|
|
15783
16958
|
return program.methods
|
|
15784
16959
|
.finalizeComputationDefinition(compDefOffset, mxeProgramId)
|
|
15785
16960
|
.accounts({
|
|
@@ -15787,12 +16962,11 @@ async function buildFinalizeCompDefTx(provider, compDefOffset, mxeProgramId) {
|
|
|
15787
16962
|
})
|
|
15788
16963
|
.transaction();
|
|
15789
16964
|
}
|
|
15790
|
-
async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitIndex, compDefAccInfo, mxeProgramId, shouldLog = true, chunkSize =
|
|
16965
|
+
async function uploadToCircuitAcc(provider, program, rawCircuitPart, rawCircuitIndex, compDefAccInfo, mxeProgramId, shouldLog = true, chunkSize = DEFAULT_UPLOAD_TX_BATCH_SIZE, confirmOptions) {
|
|
15791
16966
|
const rawCircuitPda = getRawCircuitAccAddress(compDefAccInfo.pubkey, rawCircuitIndex);
|
|
15792
16967
|
const existingAcc = await provider.connection.getAccountInfo(rawCircuitPda);
|
|
15793
16968
|
// Skip entirely if account exists with correct size (pre-seeded at genesis or already uploaded)
|
|
15794
|
-
|
|
15795
|
-
const requiredAccountSize = rawCircuitPart.length + 9;
|
|
16969
|
+
const requiredAccountSize = rawCircuitPart.length + RAW_CIRCUIT_ACCOUNT_HEADER_SIZE;
|
|
15796
16970
|
if (existingAcc !== null && existingAcc.data.length >= requiredAccountSize) {
|
|
15797
16971
|
optionalLog(shouldLog, `Raw circuit acc ${rawCircuitIndex} already exists with sufficient size, skipping`);
|
|
15798
16972
|
return [];
|
|
@@ -15926,18 +17100,8 @@ function getArciumProgram(provider) {
|
|
|
15926
17100
|
*/
|
|
15927
17101
|
function getCompDefAccInfo(circuitName, mxeProgramId) {
|
|
15928
17102
|
const offset = getCompDefAccOffset(circuitName);
|
|
15929
|
-
const
|
|
15930
|
-
return { pubkey:
|
|
15931
|
-
}
|
|
15932
|
-
/**
|
|
15933
|
-
* Return the PDA for a computation definition account, given the program ID, MXE program ID, and offset.
|
|
15934
|
-
* @param arciumProgramId - Public key of the Arcium program.
|
|
15935
|
-
* @param mxeProgramId - Public key of the MXE program.
|
|
15936
|
-
* @param offset - Offset as a Uint8Array.
|
|
15937
|
-
* @returns PDA for the computation definition account.
|
|
15938
|
-
*/
|
|
15939
|
-
function getCompDefAccPDA(arciumProgramId, mxeProgramId, offset) {
|
|
15940
|
-
return anchor.web3.PublicKey.findProgramAddressSync([Buffer.from(COMP_DEF_ACC_SEED, 'utf-8'), mxeProgramId.toBuffer(), offset], arciumProgramId)[0];
|
|
17103
|
+
const offsetNumber = Buffer.from(offset).readUInt32LE(0);
|
|
17104
|
+
return { pubkey: getCompDefAccAddress(mxeProgramId, offsetNumber), offset: offsetNumber };
|
|
15941
17105
|
}
|
|
15942
17106
|
/**
|
|
15943
17107
|
* Initialize an MXE (part 1). Due to Solana's 10KB per-instruction allocation limit,
|
|
@@ -15945,13 +17109,15 @@ function getCompDefAccPDA(arciumProgramId, mxeProgramId, offset) {
|
|
|
15945
17109
|
* Call initMxePart2 afterwards to finish allocation and add keygen to mempool.
|
|
15946
17110
|
* @param provider - Anchor provider to use for transactions.
|
|
15947
17111
|
* @param mxeProgramId - Public key to use as the MXE program ID.
|
|
17112
|
+
* @param recoveryPeers - Array of 100 node offsets for recovery peers (0 for unused slots).
|
|
15948
17113
|
* @param confirmOptions - Transaction confirmation options.
|
|
15949
17114
|
* @returns Transaction signature.
|
|
15950
17115
|
*/
|
|
15951
|
-
async function initMxePart1(provider, mxeProgramId, confirmOptions) {
|
|
17116
|
+
async function initMxePart1(provider, mxeProgramId, recoveryPeers, confirmOptions) {
|
|
15952
17117
|
const program = getArciumProgram(provider);
|
|
17118
|
+
const paddedRecoveryPeers = normalizeRecoveryPeers(recoveryPeers);
|
|
15953
17119
|
const tx = await program.methods
|
|
15954
|
-
.initMxePart1()
|
|
17120
|
+
.initMxePart1(paddedRecoveryPeers)
|
|
15955
17121
|
.accountsPartial({
|
|
15956
17122
|
signer: provider.publicKey,
|
|
15957
17123
|
mxeProgram: mxeProgramId,
|
|
@@ -15966,9 +17132,12 @@ async function initMxePart1(provider, mxeProgramId, confirmOptions) {
|
|
|
15966
17132
|
* @param provider - Anchor provider to use for transactions.
|
|
15967
17133
|
* @param clusterOffset - Cluster offset to associate with the MXE.
|
|
15968
17134
|
* @param mxeProgramId - Public key to use as the MXE program ID.
|
|
15969
|
-
* @param recoveryPeers - Array of 100 node offsets for recovery peers (0 for unused slots).
|
|
15970
17135
|
* @param keygenOffset - Computation offset for the keygen computation.
|
|
15971
17136
|
* @param keyRecoveryInitOffset - Computation offset for the key_recovery_init computation.
|
|
17137
|
+
* @param recoveryPeers - Recovery peer node offsets. Slots set to 0 are treated as unused.
|
|
17138
|
+
* The non-zero count must be either 0 (recovery disabled) or at least
|
|
17139
|
+
* `MIN_RECOVERY_PEERS` (4). The array is padded with zeros up to
|
|
17140
|
+
* `MAX_RECOVERY_PEERS` (100); passing more than that throws.
|
|
15972
17141
|
* @param lutOffset - Lookup table offset for the MXE's address lookup table.
|
|
15973
17142
|
* @param mxeAuthority - Optional authority for the MXE (defaults to provider.publicKey).
|
|
15974
17143
|
* @param confirmOptions - Transaction confirmation options.
|
|
@@ -15976,16 +17145,8 @@ async function initMxePart1(provider, mxeProgramId, confirmOptions) {
|
|
|
15976
17145
|
*/
|
|
15977
17146
|
async function initMxePart2(provider, clusterOffset, mxeProgramId, keygenOffset, keyRecoveryInitOffset, recoveryPeers, lutOffset, mxeAuthority, confirmOptions) {
|
|
15978
17147
|
const program = getArciumProgram(provider);
|
|
15979
|
-
// Ensure recoveryPeers has exactly 100 elements
|
|
15980
|
-
const paddedRecoveryPeers = [...recoveryPeers];
|
|
15981
|
-
while (paddedRecoveryPeers.length < 100) {
|
|
15982
|
-
paddedRecoveryPeers.push(0);
|
|
15983
|
-
}
|
|
15984
|
-
if (paddedRecoveryPeers.length > 100) {
|
|
15985
|
-
throw new Error('recoveryPeers must have at most 100 elements');
|
|
15986
|
-
}
|
|
15987
17148
|
const tx = await program.methods
|
|
15988
|
-
.initMxePart2(clusterOffset,
|
|
17149
|
+
.initMxePart2(clusterOffset, keygenOffset, keyRecoveryInitOffset, lutOffset)
|
|
15989
17150
|
.accountsPartial({
|
|
15990
17151
|
signer: provider.publicKey,
|
|
15991
17152
|
mxeProgram: mxeProgramId,
|
|
@@ -15996,6 +17157,14 @@ async function initMxePart2(provider, clusterOffset, mxeProgramId, keygenOffset,
|
|
|
15996
17157
|
.transaction();
|
|
15997
17158
|
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
15998
17159
|
}
|
|
17160
|
+
/**
|
|
17161
|
+
* Reclaim the rent locked in a finished computation account.
|
|
17162
|
+
* @param provider - Anchor provider to use for transactions.
|
|
17163
|
+
* @param clusterOffset - Offset of the cluster that ran the computation.
|
|
17164
|
+
* @param computationOffset - Offset of the computation whose rent is being claimed.
|
|
17165
|
+
* @param confirmOptions - Transaction confirmation options.
|
|
17166
|
+
* @returns Transaction signature.
|
|
17167
|
+
*/
|
|
15999
17168
|
async function claimComputationRent(provider, clusterOffset, computationOffset, confirmOptions) {
|
|
16000
17169
|
const program = getArciumProgram(provider);
|
|
16001
17170
|
const tx = await program.methods
|
|
@@ -16112,4 +17281,4 @@ async function awaitComputationFinalization(provider, computationOffset, mxeProg
|
|
|
16112
17281
|
: new Error(timeoutMsg);
|
|
16113
17282
|
}
|
|
16114
17283
|
|
|
16115
|
-
export { ARCIUM_ADDR, ARCIUM_IDL, Aes128Cipher, Aes192Cipher, Aes256Cipher, ArcisModule, ArcisType, ArcisValueField, CSplRescueCipher, CURVE25519_BASE_FIELD, CURVE25519_SCALAR_FIELD, CURVE25519_SCALAR_FIELD_MODULUS, IntegerInfo, Matrix, RescueCipher, RescueDesc, RescuePrimeHash, arcisEd25519, awaitComputationFinalization, buildFinalizeCompDefTx, claimComputationRent, createPacker, deserializeLE, generateRandomFieldElem, getArciumAccountBaseSeed, getArciumEnv, getArciumProgram, getArciumProgramId, getArxNodeAccAddress, getCircuitState, getClockAccAddress, getClusterAccAddress, getCompDefAccAddress, getCompDefAccOffset, getComputationAccAddress, getComputationsInMempool, getExecutingPoolAccAddress, getExecutingPoolAccInfo, getFeePoolAccAddress, getLookupTableAddress, getMXEAccAddress, getMXEArcisEd25519VerifyingKey, getMXEPublicKey, getMempoolAccAddress, getMempoolAccInfo, getMempoolPriorityFeeStats, getMxeRecoveryAccAddress, getRawCircuitAccAddress, getRecoveryClusterAccAddress, initMxePart1, initMxePart2, isNullRef, positiveModulo, randMatrix, serializeLE, sha256, toVec, uploadCircuit };
|
|
17284
|
+
export { ARCIUM_ADDR, ARCIUM_IDL, Aes128Cipher, Aes192Cipher, Aes256Cipher, ArcisModule, ArcisType, ArcisValueField, CSplRescueCipher, CURVE25519_BASE_FIELD, CURVE25519_SCALAR_FIELD, CURVE25519_SCALAR_FIELD_MODULUS, IntegerInfo, Matrix, RescueCipher, RescueDesc, RescuePrimeHash, arcisEd25519, awaitComputationFinalization, buildFinalizeCompDefTx, claimComputationRent, createPacker, deserializeLE, generateRandomFieldElem, getArciumAccountBaseSeed, getArciumEnv, getArciumProgram, getArciumProgramId, getArciumSignerAccAddress, getArxNodeAccAddress, getCircuitState, getClockAccAddress, getClusterAccAddress, getCompDefAccAddress, getCompDefAccOffset, getComputationAccAddress, getComputationsInMempool, getExecutingPoolAccAddress, getExecutingPoolAccInfo, getFailureClaimAccAddress, getFeePoolAccAddress, getLookupTableAddress, getMXEAccAddress, getMXEArcisEd25519VerifyingKey, getMXEPublicKey, getMempoolAccAddress, getMempoolAccInfo, getMempoolPriorityFeeStats, getMxeRecoveryAccAddress, getOperatorAccAddress, getRawCircuitAccAddress, getRecoveryClusterAccAddress, getRecoveryPeerAccAddress, initMxePart1, initMxePart2, isNullRef, positiveModulo, randMatrix, serializeLE, sha256, toVec, uploadCircuit };
|