@arcium-hq/client 0.6.6 → 0.7.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/build/index.cjs CHANGED
@@ -1809,7 +1809,7 @@ function createPacker(fields, typeName = 'Packer') {
1809
1809
  var address = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
1810
1810
  var metadata = {
1811
1811
  name: "arcium",
1812
- version: "0.6.6",
1812
+ version: "0.7.0",
1813
1813
  spec: "0.1.0",
1814
1814
  description: "The Arcium program"
1815
1815
  };
@@ -6271,6 +6271,10 @@ var instructions = [
6271
6271
  {
6272
6272
  name: "key_recovery_init_offset",
6273
6273
  type: "u64"
6274
+ },
6275
+ {
6276
+ name: "recent_offset",
6277
+ type: "u64"
6274
6278
  }
6275
6279
  ]
6276
6280
  },
@@ -6575,91 +6579,6 @@ var instructions = [
6575
6579
  }
6576
6580
  ]
6577
6581
  },
6578
- {
6579
- name: "leave_mxe",
6580
- discriminator: [
6581
- 225,
6582
- 222,
6583
- 68,
6584
- 9,
6585
- 96,
6586
- 160,
6587
- 126,
6588
- 211
6589
- ],
6590
- accounts: [
6591
- {
6592
- name: "authority",
6593
- writable: true,
6594
- signer: true
6595
- },
6596
- {
6597
- name: "cluster_acc",
6598
- writable: true,
6599
- pda: {
6600
- seeds: [
6601
- {
6602
- kind: "const",
6603
- value: [
6604
- 67,
6605
- 108,
6606
- 117,
6607
- 115,
6608
- 116,
6609
- 101,
6610
- 114
6611
- ]
6612
- },
6613
- {
6614
- kind: "arg",
6615
- path: "_id"
6616
- }
6617
- ]
6618
- }
6619
- },
6620
- {
6621
- name: "mxe",
6622
- writable: true,
6623
- pda: {
6624
- seeds: [
6625
- {
6626
- kind: "const",
6627
- value: [
6628
- 77,
6629
- 88,
6630
- 69,
6631
- 65,
6632
- 99,
6633
- 99,
6634
- 111,
6635
- 117,
6636
- 110,
6637
- 116
6638
- ]
6639
- },
6640
- {
6641
- kind: "arg",
6642
- path: "_mxe_program"
6643
- }
6644
- ]
6645
- }
6646
- },
6647
- {
6648
- name: "system_program",
6649
- address: "11111111111111111111111111111111"
6650
- }
6651
- ],
6652
- args: [
6653
- {
6654
- name: "cluster_offset",
6655
- type: "u32"
6656
- },
6657
- {
6658
- name: "mxe_program",
6659
- type: "pubkey"
6660
- }
6661
- ]
6662
- },
6663
6582
  {
6664
6583
  name: "propose_fee",
6665
6584
  discriminator: [
@@ -6964,8 +6883,9 @@ var instructions = [
6964
6883
  ]
6965
6884
  },
6966
6885
  {
6967
- kind: "arg",
6968
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
6886
+ kind: "account",
6887
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
6888
+ account: "MXEAccount"
6969
6889
  },
6970
6890
  {
6971
6891
  kind: "arg",
@@ -7019,8 +6939,9 @@ var instructions = [
7019
6939
  ]
7020
6940
  },
7021
6941
  {
7022
- kind: "arg",
7023
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
6942
+ kind: "account",
6943
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
6944
+ account: "MXEAccount"
7024
6945
  }
7025
6946
  ]
7026
6947
  }
@@ -7043,8 +6964,9 @@ var instructions = [
7043
6964
  ]
7044
6965
  },
7045
6966
  {
7046
- kind: "arg",
7047
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
6967
+ kind: "account",
6968
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
6969
+ account: "MXEAccount"
7048
6970
  }
7049
6971
  ]
7050
6972
  }
@@ -7115,8 +7037,9 @@ var instructions = [
7115
7037
  ]
7116
7038
  },
7117
7039
  {
7118
- kind: "arg",
7119
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
7040
+ kind: "account",
7041
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
7042
+ account: "MXEAccount"
7120
7043
  }
7121
7044
  ]
7122
7045
  }
@@ -7180,12 +7103,6 @@ var instructions = [
7180
7103
  name: "computation_definition_offset",
7181
7104
  type: "u32"
7182
7105
  },
7183
- {
7184
- name: "cluster_index",
7185
- type: {
7186
- option: "u16"
7187
- }
7188
- },
7189
7106
  {
7190
7107
  name: "args",
7191
7108
  type: {
@@ -11016,20 +10933,6 @@ var types = [
11016
10933
  }
11017
10934
  }
11018
10935
  },
11019
- {
11020
- name: "cluster_index",
11021
- docs: [
11022
- "The MXE's cluster to be used for execution.",
11023
- "",
11024
- "# Notes",
11025
- "",
11026
- "- [None] represents the default cluster,",
11027
- "- [Some] specifies the index of the fallback cluster."
11028
- ],
11029
- type: {
11030
- option: "u16"
11031
- }
11032
- },
11033
10936
  {
11034
10937
  name: "arguments",
11035
10938
  type: {
@@ -11360,6 +11263,16 @@ var types = [
11360
11263
  }
11361
11264
  }
11362
11265
  ]
11266
+ },
11267
+ {
11268
+ name: "KeyRecoveryFailure",
11269
+ fields: [
11270
+ {
11271
+ defined: {
11272
+ name: "KeyRecoveryFailureReason"
11273
+ }
11274
+ }
11275
+ ]
11363
11276
  }
11364
11277
  ]
11365
11278
  }
@@ -11537,6 +11450,38 @@ var types = [
11537
11450
  ]
11538
11451
  }
11539
11452
  },
11453
+ {
11454
+ name: "KeyRecoveryFailureReason",
11455
+ type: {
11456
+ kind: "enum",
11457
+ variants: [
11458
+ {
11459
+ name: "KeysDigestMismatch"
11460
+ },
11461
+ {
11462
+ name: "X25519PubkeyMismatch"
11463
+ },
11464
+ {
11465
+ name: "Ed25519VerifyingKeyMismatch"
11466
+ },
11467
+ {
11468
+ name: "ElGamalPubkeyMismatch"
11469
+ },
11470
+ {
11471
+ name: "TooManyCorruptPeers"
11472
+ },
11473
+ {
11474
+ name: "Serialization"
11475
+ },
11476
+ {
11477
+ name: "NoPubkeysSet"
11478
+ },
11479
+ {
11480
+ name: "AccountNotFound"
11481
+ }
11482
+ ]
11483
+ }
11484
+ },
11540
11485
  {
11541
11486
  name: "LargeExecPool",
11542
11487
  serialization: "bytemuckunsafe",
@@ -11810,24 +11755,8 @@ var types = [
11810
11755
  }
11811
11756
  },
11812
11757
  {
11813
- name: "fallback_clusters",
11814
- docs: [
11815
- "Fallback clusters that can execute this MXE as an alternative to the",
11816
- "[MXEAccount::cluster]. There can be a maximum of [MAX_FALLBACK_CLUSTERS]",
11817
- "fallback clusters."
11818
- ],
11819
- type: {
11820
- vec: "u32"
11821
- }
11822
- },
11823
- {
11824
- name: "rejected_clusters",
11825
- docs: [
11826
- "The clusters that have rejected this MXE."
11827
- ],
11828
- type: {
11829
- vec: "u32"
11830
- }
11758
+ name: "lut_offset_slot",
11759
+ type: "u64"
11831
11760
  },
11832
11761
  {
11833
11762
  name: "computation_definitions",
@@ -13296,12 +13225,12 @@ function getRawCircuitAccAddress(compDefPubkey, rawCircuitIndex) {
13296
13225
  /**
13297
13226
  * Derives the address lookup table address for an MXE program.
13298
13227
  * @param mxeProgramId - The public key of the MXE program.
13299
- * @param lutIndex - The index of the lookup table (defaults to 0).
13228
+ * @param lutOffset - The index of the lookup table, to be fetched from the mxe account.
13300
13229
  * @returns The derived address lookup table public key.
13301
13230
  */
13302
- function getLookupTableAddress(mxeProgramId, lutIndex = 0) {
13231
+ function getLookupTableAddress(mxeProgramId, lutOffset) {
13303
13232
  const mxeAccount = getMXEAccAddress(mxeProgramId);
13304
- const lutIndexBuffer = new anchor__namespace.BN(lutIndex).toArrayLike(Buffer, 'le', 8);
13233
+ const lutIndexBuffer = lutOffset.toArrayLike(Buffer, 'le', 8);
13305
13234
  const seeds = [mxeAccount.toBuffer(), lutIndexBuffer];
13306
13235
  return web3_js.PublicKey.findProgramAddressSync(seeds, web3_js.AddressLookupTableProgram.programId)[0];
13307
13236
  }
@@ -13871,22 +13800,22 @@ async function submitKeyRecoveryShare(provider, originalMxeProgramId, backupMxeP
13871
13800
  }
13872
13801
  /**
13873
13802
  * Finalizes key recovery execution after the submission threshold is met.
13874
- * This queues the key_recovery_final MPC computation on the backup cluster.
13803
+ * This queues the key_recovery_finalize MPC computation on the backup cluster.
13875
13804
  * @param provider - The Anchor provider to use for transactions.
13876
13805
  * @param originalMxeProgramId - The public key of the original MXE program being recovered.
13877
13806
  * @param backupMxeProgramId - The public key of the backup MXE program.
13878
13807
  * @param clusterOffset - The cluster offset where the backup MXE is deployed.
13879
- * @param keyRecoveryFinalOffset - The computation offset for the key_recovery_final computation.
13808
+ * @param keyRecoveryFinalizeOffset - The computation offset for the key_recovery_finalize computation.
13880
13809
  * @returns The transaction signature.
13881
13810
  */
13882
- async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, clusterOffset, keyRecoveryFinalOffset) {
13811
+ async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, clusterOffset, keyRecoveryFinalizeOffset) {
13883
13812
  const program = getArciumProgram(provider);
13884
13813
  const tx = await program.methods
13885
13814
  .finalizeKeyRecoveryExecution(originalMxeProgramId, backupMxeProgramId, clusterOffset)
13886
13815
  .accountsPartial({
13887
13816
  authority: provider.publicKey,
13888
13817
  payer: provider.publicKey,
13889
- keyRecoveryFinalizeComputation: getComputationAccAddress(clusterOffset, keyRecoveryFinalOffset),
13818
+ keyRecoveryFinalizeComputation: getComputationAccAddress(clusterOffset, keyRecoveryFinalizeOffset),
13890
13819
  executingPool: getExecutingPoolAccAddress(clusterOffset),
13891
13820
  mempool: getMempoolAccAddress(clusterOffset),
13892
13821
  originalMxeProgram: originalMxeProgramId,
@@ -13927,7 +13856,7 @@ async function initMxePart1(provider, mxeProgramId) {
13927
13856
  * @param mxeAuthority - Optional authority for the MXE (defaults to provider.publicKey).
13928
13857
  * @returns The transaction signature.
13929
13858
  */
13930
- async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers, keygenOffset, keyRecoveryInitOffset, mxeAuthority) {
13859
+ async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers, keygenOffset, keyRecoveryInitOffset, lutOffset, mxeAuthority) {
13931
13860
  const program = getArciumProgram(provider);
13932
13861
  // Ensure recoveryPeers has exactly 100 elements
13933
13862
  const paddedRecoveryPeers = [...recoveryPeers];
@@ -13938,13 +13867,13 @@ async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers
13938
13867
  throw new Error('recoveryPeers must have at most 100 elements');
13939
13868
  }
13940
13869
  const tx = await program.methods
13941
- .initMxePart2(clusterOffset, mxeProgramId, paddedRecoveryPeers, keygenOffset, keyRecoveryInitOffset)
13870
+ .initMxePart2(clusterOffset, mxeProgramId, paddedRecoveryPeers, keygenOffset, keyRecoveryInitOffset, lutOffset)
13942
13871
  .accountsPartial({
13943
13872
  signer: provider.publicKey,
13944
13873
  mxeProgram: mxeProgramId,
13945
13874
  poolAccount: getFeePoolAccAddress(),
13946
13875
  mxeAuthority: mxeAuthority ?? provider.publicKey,
13947
- addressLookupTable: getLookupTableAddress(mxeProgramId),
13876
+ addressLookupTable: getLookupTableAddress(mxeProgramId, lutOffset),
13948
13877
  })
13949
13878
  .transaction();
13950
13879
  return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
package/build/index.d.ts CHANGED
@@ -456,7 +456,7 @@ type Arcium = {
456
456
  "address": "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
457
457
  "metadata": {
458
458
  "name": "arcium";
459
- "version": "0.6.6";
459
+ "version": "0.7.0";
460
460
  "spec": "0.1.0";
461
461
  "description": "The Arcium program";
462
462
  };
@@ -4916,6 +4916,10 @@ type Arcium = {
4916
4916
  {
4917
4917
  "name": "keyRecoveryInitOffset";
4918
4918
  "type": "u64";
4919
+ },
4920
+ {
4921
+ "name": "recentOffset";
4922
+ "type": "u64";
4919
4923
  }
4920
4924
  ];
4921
4925
  },
@@ -5220,91 +5224,6 @@ type Arcium = {
5220
5224
  }
5221
5225
  ];
5222
5226
  },
5223
- {
5224
- "name": "leaveMxe";
5225
- "discriminator": [
5226
- 225,
5227
- 222,
5228
- 68,
5229
- 9,
5230
- 96,
5231
- 160,
5232
- 126,
5233
- 211
5234
- ];
5235
- "accounts": [
5236
- {
5237
- "name": "authority";
5238
- "writable": true;
5239
- "signer": true;
5240
- },
5241
- {
5242
- "name": "clusterAcc";
5243
- "writable": true;
5244
- "pda": {
5245
- "seeds": [
5246
- {
5247
- "kind": "const";
5248
- "value": [
5249
- 67,
5250
- 108,
5251
- 117,
5252
- 115,
5253
- 116,
5254
- 101,
5255
- 114
5256
- ];
5257
- },
5258
- {
5259
- "kind": "arg";
5260
- "path": "id";
5261
- }
5262
- ];
5263
- };
5264
- },
5265
- {
5266
- "name": "mxe";
5267
- "writable": true;
5268
- "pda": {
5269
- "seeds": [
5270
- {
5271
- "kind": "const";
5272
- "value": [
5273
- 77,
5274
- 88,
5275
- 69,
5276
- 65,
5277
- 99,
5278
- 99,
5279
- 111,
5280
- 117,
5281
- 110,
5282
- 116
5283
- ];
5284
- },
5285
- {
5286
- "kind": "arg";
5287
- "path": "mxeProgram";
5288
- }
5289
- ];
5290
- };
5291
- },
5292
- {
5293
- "name": "systemProgram";
5294
- "address": "11111111111111111111111111111111";
5295
- }
5296
- ];
5297
- "args": [
5298
- {
5299
- "name": "clusterOffset";
5300
- "type": "u32";
5301
- },
5302
- {
5303
- "name": "mxeProgram";
5304
- "type": "pubkey";
5305
- }
5306
- ];
5307
- },
5308
5227
  {
5309
5228
  "name": "proposeFee";
5310
5229
  "discriminator": [
@@ -5609,8 +5528,9 @@ type Arcium = {
5609
5528
  ];
5610
5529
  },
5611
5530
  {
5612
- "kind": "arg";
5613
- "path": "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])";
5531
+ "kind": "account";
5532
+ "path": "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ";
5533
+ "account": "mxeAccount";
5614
5534
  },
5615
5535
  {
5616
5536
  "kind": "arg";
@@ -5664,8 +5584,9 @@ type Arcium = {
5664
5584
  ];
5665
5585
  },
5666
5586
  {
5667
- "kind": "arg";
5668
- "path": "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])";
5587
+ "kind": "account";
5588
+ "path": "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ";
5589
+ "account": "mxeAccount";
5669
5590
  }
5670
5591
  ];
5671
5592
  };
@@ -5688,8 +5609,9 @@ type Arcium = {
5688
5609
  ];
5689
5610
  },
5690
5611
  {
5691
- "kind": "arg";
5692
- "path": "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])";
5612
+ "kind": "account";
5613
+ "path": "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ";
5614
+ "account": "mxeAccount";
5693
5615
  }
5694
5616
  ];
5695
5617
  };
@@ -5760,8 +5682,9 @@ type Arcium = {
5760
5682
  ];
5761
5683
  },
5762
5684
  {
5763
- "kind": "arg";
5764
- "path": "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])";
5685
+ "kind": "account";
5686
+ "path": "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ";
5687
+ "account": "mxeAccount";
5765
5688
  }
5766
5689
  ];
5767
5690
  };
@@ -5825,12 +5748,6 @@ type Arcium = {
5825
5748
  "name": "computationDefinitionOffset";
5826
5749
  "type": "u32";
5827
5750
  },
5828
- {
5829
- "name": "clusterIndex";
5830
- "type": {
5831
- "option": "u16";
5832
- };
5833
- },
5834
5751
  {
5835
5752
  "name": "args";
5836
5753
  "type": {
@@ -9660,20 +9577,6 @@ type Arcium = {
9660
9577
  };
9661
9578
  };
9662
9579
  },
9663
- {
9664
- "name": "clusterIndex";
9665
- "docs": [
9666
- "The MXE's cluster to be used for execution.",
9667
- "",
9668
- "# Notes",
9669
- "",
9670
- "- [None] represents the default cluster,",
9671
- "- [Some] specifies the index of the fallback cluster."
9672
- ];
9673
- "type": {
9674
- "option": "u16";
9675
- };
9676
- },
9677
9580
  {
9678
9581
  "name": "arguments";
9679
9582
  "type": {
@@ -10004,6 +9907,16 @@ type Arcium = {
10004
9907
  };
10005
9908
  }
10006
9909
  ];
9910
+ },
9911
+ {
9912
+ "name": "keyRecoveryFailure";
9913
+ "fields": [
9914
+ {
9915
+ "defined": {
9916
+ "name": "keyRecoveryFailureReason";
9917
+ };
9918
+ }
9919
+ ];
10007
9920
  }
10008
9921
  ];
10009
9922
  };
@@ -10181,6 +10094,38 @@ type Arcium = {
10181
10094
  ];
10182
10095
  };
10183
10096
  },
10097
+ {
10098
+ "name": "keyRecoveryFailureReason";
10099
+ "type": {
10100
+ "kind": "enum";
10101
+ "variants": [
10102
+ {
10103
+ "name": "keysDigestMismatch";
10104
+ },
10105
+ {
10106
+ "name": "x25519PubkeyMismatch";
10107
+ },
10108
+ {
10109
+ "name": "ed25519VerifyingKeyMismatch";
10110
+ },
10111
+ {
10112
+ "name": "elGamalPubkeyMismatch";
10113
+ },
10114
+ {
10115
+ "name": "tooManyCorruptPeers";
10116
+ },
10117
+ {
10118
+ "name": "serialization";
10119
+ },
10120
+ {
10121
+ "name": "noPubkeysSet";
10122
+ },
10123
+ {
10124
+ "name": "accountNotFound";
10125
+ }
10126
+ ];
10127
+ };
10128
+ },
10184
10129
  {
10185
10130
  "name": "largeExecPool";
10186
10131
  "serialization": "bytemuckunsafe";
@@ -10454,24 +10399,8 @@ type Arcium = {
10454
10399
  };
10455
10400
  },
10456
10401
  {
10457
- "name": "fallbackClusters";
10458
- "docs": [
10459
- "Fallback clusters that can execute this MXE as an alternative to the",
10460
- "[MXEAccount::cluster]. There can be a maximum of [MAX_FALLBACK_CLUSTERS]",
10461
- "fallback clusters."
10462
- ];
10463
- "type": {
10464
- "vec": "u32";
10465
- };
10466
- },
10467
- {
10468
- "name": "rejectedClusters";
10469
- "docs": [
10470
- "The clusters that have rejected this MXE."
10471
- ];
10472
- "type": {
10473
- "vec": "u32";
10474
- };
10402
+ "name": "lutOffsetSlot";
10403
+ "type": "u64";
10475
10404
  },
10476
10405
  {
10477
10406
  "name": "computationDefinitions";
@@ -11862,15 +11791,15 @@ declare function initKeyRecoveryExecution(provider: AnchorProvider, originalMxeP
11862
11791
  declare function submitKeyRecoveryShare(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey, nodeOffset: number, peerIndex: number, share: number[][] | Uint8Array[]): Promise<string>;
11863
11792
  /**
11864
11793
  * Finalizes key recovery execution after the submission threshold is met.
11865
- * This queues the key_recovery_final MPC computation on the backup cluster.
11794
+ * This queues the key_recovery_finalize MPC computation on the backup cluster.
11866
11795
  * @param provider - The Anchor provider to use for transactions.
11867
11796
  * @param originalMxeProgramId - The public key of the original MXE program being recovered.
11868
11797
  * @param backupMxeProgramId - The public key of the backup MXE program.
11869
11798
  * @param clusterOffset - The cluster offset where the backup MXE is deployed.
11870
- * @param keyRecoveryFinalOffset - The computation offset for the key_recovery_final computation.
11799
+ * @param keyRecoveryFinalizeOffset - The computation offset for the key_recovery_finalize computation.
11871
11800
  * @returns The transaction signature.
11872
11801
  */
11873
- declare function finalizeKeyRecoveryExecution(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey, clusterOffset: number, keyRecoveryFinalOffset: anchor.BN): Promise<string>;
11802
+ declare function finalizeKeyRecoveryExecution(provider: AnchorProvider, originalMxeProgramId: anchor.web3.PublicKey, backupMxeProgramId: anchor.web3.PublicKey, clusterOffset: number, keyRecoveryFinalizeOffset: anchor.BN): Promise<string>;
11874
11803
  /**
11875
11804
  * Initializes an MXE (part 1). Due to Solana's 10KB per-instruction allocation limit,
11876
11805
  * this only partially allocates recovery_cluster_acc.
@@ -11893,7 +11822,7 @@ declare function initMxePart1(provider: AnchorProvider, mxeProgramId: anchor.web
11893
11822
  * @param mxeAuthority - Optional authority for the MXE (defaults to provider.publicKey).
11894
11823
  * @returns The transaction signature.
11895
11824
  */
11896
- declare function initMxePart2(provider: AnchorProvider, clusterOffset: number, mxeProgramId: anchor.web3.PublicKey, recoveryPeers: number[], keygenOffset: anchor.BN, keyRecoveryInitOffset: anchor.BN, mxeAuthority?: anchor.web3.PublicKey): Promise<string>;
11825
+ declare function initMxePart2(provider: AnchorProvider, clusterOffset: number, mxeProgramId: anchor.web3.PublicKey, recoveryPeers: number[], keygenOffset: anchor.BN, keyRecoveryInitOffset: anchor.BN, lutOffset: anchor.BN, mxeAuthority?: anchor.web3.PublicKey): Promise<string>;
11897
11826
 
11898
11827
  /**
11899
11828
  * Structure representing the local Arcium environment variables required for local development or testing.
@@ -12006,10 +11935,10 @@ declare function getRawCircuitAccAddress(compDefPubkey: PublicKey, rawCircuitInd
12006
11935
  /**
12007
11936
  * Derives the address lookup table address for an MXE program.
12008
11937
  * @param mxeProgramId - The public key of the MXE program.
12009
- * @param lutIndex - The index of the lookup table (defaults to 0).
11938
+ * @param lutOffset - The index of the lookup table, to be fetched from the mxe account.
12010
11939
  * @returns The derived address lookup table public key.
12011
11940
  */
12012
- declare function getLookupTableAddress(mxeProgramId: PublicKey, lutIndex?: number): PublicKey;
11941
+ declare function getLookupTableAddress(mxeProgramId: PublicKey, lutOffset: anchor.BN): PublicKey;
12013
11942
 
12014
11943
  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, createPacker, deserializeLE, finalizeKeyRecoveryExecution, 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, initKeyRecoveryExecution, initMxePart1, initMxePart2, isNullRef, positiveModulo, queueKeyRecoveryInit, randMatrix, recoverMxe, serializeLE, sha256, submitKeyRecoveryShare, toVec, uploadCircuit };
12015
11944
  export type { Arcium as ArciumIdlType, ArciumLocalEnv, CircuitSource, CircuitState, ComputationErrorType, ComputationReference, ExecutingPoolAccount, FieldInfo, FpField, MempoolAccount, MempoolPriorityFeeStats, Packer };
package/build/index.mjs CHANGED
@@ -1790,7 +1790,7 @@ function createPacker(fields, typeName = 'Packer') {
1790
1790
  var address = "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ";
1791
1791
  var metadata = {
1792
1792
  name: "arcium",
1793
- version: "0.6.6",
1793
+ version: "0.7.0",
1794
1794
  spec: "0.1.0",
1795
1795
  description: "The Arcium program"
1796
1796
  };
@@ -6252,6 +6252,10 @@ var instructions = [
6252
6252
  {
6253
6253
  name: "key_recovery_init_offset",
6254
6254
  type: "u64"
6255
+ },
6256
+ {
6257
+ name: "recent_offset",
6258
+ type: "u64"
6255
6259
  }
6256
6260
  ]
6257
6261
  },
@@ -6556,91 +6560,6 @@ var instructions = [
6556
6560
  }
6557
6561
  ]
6558
6562
  },
6559
- {
6560
- name: "leave_mxe",
6561
- discriminator: [
6562
- 225,
6563
- 222,
6564
- 68,
6565
- 9,
6566
- 96,
6567
- 160,
6568
- 126,
6569
- 211
6570
- ],
6571
- accounts: [
6572
- {
6573
- name: "authority",
6574
- writable: true,
6575
- signer: true
6576
- },
6577
- {
6578
- name: "cluster_acc",
6579
- writable: true,
6580
- pda: {
6581
- seeds: [
6582
- {
6583
- kind: "const",
6584
- value: [
6585
- 67,
6586
- 108,
6587
- 117,
6588
- 115,
6589
- 116,
6590
- 101,
6591
- 114
6592
- ]
6593
- },
6594
- {
6595
- kind: "arg",
6596
- path: "_id"
6597
- }
6598
- ]
6599
- }
6600
- },
6601
- {
6602
- name: "mxe",
6603
- writable: true,
6604
- pda: {
6605
- seeds: [
6606
- {
6607
- kind: "const",
6608
- value: [
6609
- 77,
6610
- 88,
6611
- 69,
6612
- 65,
6613
- 99,
6614
- 99,
6615
- 111,
6616
- 117,
6617
- 110,
6618
- 116
6619
- ]
6620
- },
6621
- {
6622
- kind: "arg",
6623
- path: "_mxe_program"
6624
- }
6625
- ]
6626
- }
6627
- },
6628
- {
6629
- name: "system_program",
6630
- address: "11111111111111111111111111111111"
6631
- }
6632
- ],
6633
- args: [
6634
- {
6635
- name: "cluster_offset",
6636
- type: "u32"
6637
- },
6638
- {
6639
- name: "mxe_program",
6640
- type: "pubkey"
6641
- }
6642
- ]
6643
- },
6644
6563
  {
6645
6564
  name: "propose_fee",
6646
6565
  discriminator: [
@@ -6945,8 +6864,9 @@ var instructions = [
6945
6864
  ]
6946
6865
  },
6947
6866
  {
6948
- kind: "arg",
6949
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
6867
+ kind: "account",
6868
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
6869
+ account: "MXEAccount"
6950
6870
  },
6951
6871
  {
6952
6872
  kind: "arg",
@@ -7000,8 +6920,9 @@ var instructions = [
7000
6920
  ]
7001
6921
  },
7002
6922
  {
7003
- kind: "arg",
7004
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
6923
+ kind: "account",
6924
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
6925
+ account: "MXEAccount"
7005
6926
  }
7006
6927
  ]
7007
6928
  }
@@ -7024,8 +6945,9 @@ var instructions = [
7024
6945
  ]
7025
6946
  },
7026
6947
  {
7027
- kind: "arg",
7028
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
6948
+ kind: "account",
6949
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
6950
+ account: "MXEAccount"
7029
6951
  }
7030
6952
  ]
7031
6953
  }
@@ -7096,8 +7018,9 @@ var instructions = [
7096
7018
  ]
7097
7019
  },
7098
7020
  {
7099
- kind: "arg",
7100
- path: "cluster_index.map_or(mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? , | i |\nmxe.fallback_clusters [i as usize])"
7021
+ kind: "account",
7022
+ path: "mxe.cluster.ok_or(ArciumError :: ClusterNotSet) ? ",
7023
+ account: "MXEAccount"
7101
7024
  }
7102
7025
  ]
7103
7026
  }
@@ -7161,12 +7084,6 @@ var instructions = [
7161
7084
  name: "computation_definition_offset",
7162
7085
  type: "u32"
7163
7086
  },
7164
- {
7165
- name: "cluster_index",
7166
- type: {
7167
- option: "u16"
7168
- }
7169
- },
7170
7087
  {
7171
7088
  name: "args",
7172
7089
  type: {
@@ -10997,20 +10914,6 @@ var types = [
10997
10914
  }
10998
10915
  }
10999
10916
  },
11000
- {
11001
- name: "cluster_index",
11002
- docs: [
11003
- "The MXE's cluster to be used for execution.",
11004
- "",
11005
- "# Notes",
11006
- "",
11007
- "- [None] represents the default cluster,",
11008
- "- [Some] specifies the index of the fallback cluster."
11009
- ],
11010
- type: {
11011
- option: "u16"
11012
- }
11013
- },
11014
10917
  {
11015
10918
  name: "arguments",
11016
10919
  type: {
@@ -11341,6 +11244,16 @@ var types = [
11341
11244
  }
11342
11245
  }
11343
11246
  ]
11247
+ },
11248
+ {
11249
+ name: "KeyRecoveryFailure",
11250
+ fields: [
11251
+ {
11252
+ defined: {
11253
+ name: "KeyRecoveryFailureReason"
11254
+ }
11255
+ }
11256
+ ]
11344
11257
  }
11345
11258
  ]
11346
11259
  }
@@ -11518,6 +11431,38 @@ var types = [
11518
11431
  ]
11519
11432
  }
11520
11433
  },
11434
+ {
11435
+ name: "KeyRecoveryFailureReason",
11436
+ type: {
11437
+ kind: "enum",
11438
+ variants: [
11439
+ {
11440
+ name: "KeysDigestMismatch"
11441
+ },
11442
+ {
11443
+ name: "X25519PubkeyMismatch"
11444
+ },
11445
+ {
11446
+ name: "Ed25519VerifyingKeyMismatch"
11447
+ },
11448
+ {
11449
+ name: "ElGamalPubkeyMismatch"
11450
+ },
11451
+ {
11452
+ name: "TooManyCorruptPeers"
11453
+ },
11454
+ {
11455
+ name: "Serialization"
11456
+ },
11457
+ {
11458
+ name: "NoPubkeysSet"
11459
+ },
11460
+ {
11461
+ name: "AccountNotFound"
11462
+ }
11463
+ ]
11464
+ }
11465
+ },
11521
11466
  {
11522
11467
  name: "LargeExecPool",
11523
11468
  serialization: "bytemuckunsafe",
@@ -11791,24 +11736,8 @@ var types = [
11791
11736
  }
11792
11737
  },
11793
11738
  {
11794
- name: "fallback_clusters",
11795
- docs: [
11796
- "Fallback clusters that can execute this MXE as an alternative to the",
11797
- "[MXEAccount::cluster]. There can be a maximum of [MAX_FALLBACK_CLUSTERS]",
11798
- "fallback clusters."
11799
- ],
11800
- type: {
11801
- vec: "u32"
11802
- }
11803
- },
11804
- {
11805
- name: "rejected_clusters",
11806
- docs: [
11807
- "The clusters that have rejected this MXE."
11808
- ],
11809
- type: {
11810
- vec: "u32"
11811
- }
11739
+ name: "lut_offset_slot",
11740
+ type: "u64"
11812
11741
  },
11813
11742
  {
11814
11743
  name: "computation_definitions",
@@ -13277,12 +13206,12 @@ function getRawCircuitAccAddress(compDefPubkey, rawCircuitIndex) {
13277
13206
  /**
13278
13207
  * Derives the address lookup table address for an MXE program.
13279
13208
  * @param mxeProgramId - The public key of the MXE program.
13280
- * @param lutIndex - The index of the lookup table (defaults to 0).
13209
+ * @param lutOffset - The index of the lookup table, to be fetched from the mxe account.
13281
13210
  * @returns The derived address lookup table public key.
13282
13211
  */
13283
- function getLookupTableAddress(mxeProgramId, lutIndex = 0) {
13212
+ function getLookupTableAddress(mxeProgramId, lutOffset) {
13284
13213
  const mxeAccount = getMXEAccAddress(mxeProgramId);
13285
- const lutIndexBuffer = new anchor.BN(lutIndex).toArrayLike(Buffer, 'le', 8);
13214
+ const lutIndexBuffer = lutOffset.toArrayLike(Buffer, 'le', 8);
13286
13215
  const seeds = [mxeAccount.toBuffer(), lutIndexBuffer];
13287
13216
  return PublicKey.findProgramAddressSync(seeds, AddressLookupTableProgram.programId)[0];
13288
13217
  }
@@ -13852,22 +13781,22 @@ async function submitKeyRecoveryShare(provider, originalMxeProgramId, backupMxeP
13852
13781
  }
13853
13782
  /**
13854
13783
  * Finalizes key recovery execution after the submission threshold is met.
13855
- * This queues the key_recovery_final MPC computation on the backup cluster.
13784
+ * This queues the key_recovery_finalize MPC computation on the backup cluster.
13856
13785
  * @param provider - The Anchor provider to use for transactions.
13857
13786
  * @param originalMxeProgramId - The public key of the original MXE program being recovered.
13858
13787
  * @param backupMxeProgramId - The public key of the backup MXE program.
13859
13788
  * @param clusterOffset - The cluster offset where the backup MXE is deployed.
13860
- * @param keyRecoveryFinalOffset - The computation offset for the key_recovery_final computation.
13789
+ * @param keyRecoveryFinalizeOffset - The computation offset for the key_recovery_finalize computation.
13861
13790
  * @returns The transaction signature.
13862
13791
  */
13863
- async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, clusterOffset, keyRecoveryFinalOffset) {
13792
+ async function finalizeKeyRecoveryExecution(provider, originalMxeProgramId, backupMxeProgramId, clusterOffset, keyRecoveryFinalizeOffset) {
13864
13793
  const program = getArciumProgram(provider);
13865
13794
  const tx = await program.methods
13866
13795
  .finalizeKeyRecoveryExecution(originalMxeProgramId, backupMxeProgramId, clusterOffset)
13867
13796
  .accountsPartial({
13868
13797
  authority: provider.publicKey,
13869
13798
  payer: provider.publicKey,
13870
- keyRecoveryFinalizeComputation: getComputationAccAddress(clusterOffset, keyRecoveryFinalOffset),
13799
+ keyRecoveryFinalizeComputation: getComputationAccAddress(clusterOffset, keyRecoveryFinalizeOffset),
13871
13800
  executingPool: getExecutingPoolAccAddress(clusterOffset),
13872
13801
  mempool: getMempoolAccAddress(clusterOffset),
13873
13802
  originalMxeProgram: originalMxeProgramId,
@@ -13908,7 +13837,7 @@ async function initMxePart1(provider, mxeProgramId) {
13908
13837
  * @param mxeAuthority - Optional authority for the MXE (defaults to provider.publicKey).
13909
13838
  * @returns The transaction signature.
13910
13839
  */
13911
- async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers, keygenOffset, keyRecoveryInitOffset, mxeAuthority) {
13840
+ async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers, keygenOffset, keyRecoveryInitOffset, lutOffset, mxeAuthority) {
13912
13841
  const program = getArciumProgram(provider);
13913
13842
  // Ensure recoveryPeers has exactly 100 elements
13914
13843
  const paddedRecoveryPeers = [...recoveryPeers];
@@ -13919,13 +13848,13 @@ async function initMxePart2(provider, clusterOffset, mxeProgramId, recoveryPeers
13919
13848
  throw new Error('recoveryPeers must have at most 100 elements');
13920
13849
  }
13921
13850
  const tx = await program.methods
13922
- .initMxePart2(clusterOffset, mxeProgramId, paddedRecoveryPeers, keygenOffset, keyRecoveryInitOffset)
13851
+ .initMxePart2(clusterOffset, mxeProgramId, paddedRecoveryPeers, keygenOffset, keyRecoveryInitOffset, lutOffset)
13923
13852
  .accountsPartial({
13924
13853
  signer: provider.publicKey,
13925
13854
  mxeProgram: mxeProgramId,
13926
13855
  poolAccount: getFeePoolAccAddress(),
13927
13856
  mxeAuthority: mxeAuthority ?? provider.publicKey,
13928
- addressLookupTable: getLookupTableAddress(mxeProgramId),
13857
+ addressLookupTable: getLookupTableAddress(mxeProgramId, lutOffset),
13929
13858
  })
13930
13859
  .transaction();
13931
13860
  return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: 'confirmed' }));
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@arcium-hq/client",
3
- "version": "0.6.6",
3
+ "version": "0.7.0",
4
4
  "description": "Client SDK for interacting with encrypted Solana programs",
5
5
  "author": "Arcium",
6
6
  "license": "GPL-3.0-only",
7
+ "sideEffects": false,
7
8
  "main": "build/index.mjs",
8
9
  "scripts": {
9
10
  "test": "mocha test/**/*.ts --exit",