ox 0.14.38 → 0.14.39

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/_cjs/tempo/MultisigConfig.js +71 -15
  3. package/_cjs/tempo/MultisigConfig.js.map +1 -1
  4. package/_cjs/tempo/MultisigOperation.js +42 -36
  5. package/_cjs/tempo/MultisigOperation.js.map +1 -1
  6. package/_cjs/tempo/SignatureEnvelope.js +71 -108
  7. package/_cjs/tempo/SignatureEnvelope.js.map +1 -1
  8. package/_cjs/version.js +1 -1
  9. package/_esm/tempo/MultisigConfig.js +140 -71
  10. package/_esm/tempo/MultisigConfig.js.map +1 -1
  11. package/_esm/tempo/MultisigOperation.js +42 -37
  12. package/_esm/tempo/MultisigOperation.js.map +1 -1
  13. package/_esm/tempo/SignatureEnvelope.js +84 -143
  14. package/_esm/tempo/SignatureEnvelope.js.map +1 -1
  15. package/_esm/version.js +1 -1
  16. package/_types/tempo/KeyAuthorization.d.ts +1 -1
  17. package/_types/tempo/KeyAuthorization.d.ts.map +1 -1
  18. package/_types/tempo/MultisigConfig.d.ts +137 -73
  19. package/_types/tempo/MultisigConfig.d.ts.map +1 -1
  20. package/_types/tempo/MultisigOperation.d.ts +1 -1
  21. package/_types/tempo/MultisigOperation.d.ts.map +1 -1
  22. package/_types/tempo/SignatureEnvelope.d.ts +81 -75
  23. package/_types/tempo/SignatureEnvelope.d.ts.map +1 -1
  24. package/_types/version.d.ts +1 -1
  25. package/package.json +6 -1
  26. package/tempo/KeyAuthorization.test-d.ts +12 -0
  27. package/tempo/KeyAuthorization.test.ts +54 -0
  28. package/tempo/KeyAuthorization.ts +1 -1
  29. package/tempo/MultisigConfig.test-d/package.json +6 -0
  30. package/tempo/MultisigConfig.test-d.ts +52 -0
  31. package/tempo/MultisigConfig.test.ts +291 -263
  32. package/tempo/MultisigConfig.ts +250 -95
  33. package/tempo/MultisigOperation.test-d.ts +6 -0
  34. package/tempo/MultisigOperation.test.ts +113 -72
  35. package/tempo/MultisigOperation.ts +41 -35
  36. package/tempo/SignatureEnvelope.test-d.ts +57 -40
  37. package/tempo/SignatureEnvelope.test.ts +523 -480
  38. package/tempo/SignatureEnvelope.ts +250 -257
  39. package/tempo/multisig.e2e.test.ts +113 -86
  40. package/version.ts +1 -1
@@ -36,6 +36,7 @@ const config = MultisigConfig.from({
36
36
  ],
37
37
  threshold: 2,
38
38
  })
39
+ const initializedConfig = MultisigConfig.from({ ...config, version: 1n })
39
40
  const account = MultisigConfig.getAddress(config)
40
41
  const ownerSignature_1 = owners[0]!.signature
41
42
  const approval_1 = SignatureEnvelope.serialize(ownerSignature_1)
@@ -62,23 +63,23 @@ const keyAuthorization = KeyAuthorization.serialize(
62
63
 
63
64
  const transactionHash_ = MultisigConfig.getSignPayload({
64
65
  account,
66
+ config: initializedConfig,
65
67
  payload: TxEnvelopeTempo.getSignPayload(
66
68
  TxEnvelopeTempo.deserialize(transaction),
67
69
  ),
68
- version: 1n,
69
70
  })
70
71
  const keyAuthorizationHash = MultisigConfig.getSignPayload({
71
72
  account,
73
+ config: initializedConfig,
72
74
  payload: KeyAuthorization.getSignPayload(
73
75
  KeyAuthorization.deserialize(keyAuthorization),
74
76
  ),
75
- version: 1n,
76
77
  })
77
78
 
78
79
  const base = {
79
80
  account,
80
81
  approvals: [approval_1],
81
- config,
82
+ config: initializedConfig,
82
83
  configVersion: 1n,
83
84
  createdAt: 1,
84
85
  init: false,
@@ -249,8 +250,8 @@ describe('selectApprovals', () => {
249
250
  })
250
251
  const childHash = MultisigConfig.getSignPayload({
251
252
  account: child,
253
+ config: { version: 2n },
252
254
  payload: hash,
253
- version: 2n,
254
255
  })
255
256
  const childApprovals = [
256
257
  signApproval(owners[1]!, childHash),
@@ -269,6 +270,7 @@ describe('selectApprovals', () => {
269
270
  rootApproval,
270
271
  SignatureEnvelope.serialize({
271
272
  account: child,
273
+ config: MultisigConfig.from({ ...childConfig, version: 2n }),
272
274
  signatures: [SignatureEnvelope.deserialize(childApprovals[0]!)],
273
275
  type: 'multisig',
274
276
  }),
@@ -283,6 +285,7 @@ describe('selectApprovals', () => {
283
285
  rootApproval,
284
286
  SignatureEnvelope.serialize({
285
287
  account: child,
288
+ config: MultisigConfig.from({ ...childConfig, version: 2n }),
286
289
  signatures: childApprovals.map((approval) =>
287
290
  SignatureEnvelope.deserialize(approval),
288
291
  ),
@@ -389,8 +392,8 @@ describe('selectApprovals', () => {
389
392
  })
390
393
  const childHash = MultisigConfig.getSignPayload({
391
394
  account: child,
395
+ config: { version: 1n },
392
396
  payload: hash,
393
- version: 1n,
394
397
  })
395
398
 
396
399
  await expect(
@@ -399,6 +402,7 @@ describe('selectApprovals', () => {
399
402
  approvals: [
400
403
  SignatureEnvelope.serialize({
401
404
  account: child,
405
+ config: MultisigConfig.from({ ...childConfig, version: 1n }),
402
406
  signatures: [
403
407
  SignatureEnvelope.deserialize(
404
408
  signApproval(owners[1]!, childHash),
@@ -415,7 +419,7 @@ describe('selectApprovals', () => {
415
419
  )
416
420
  })
417
421
 
418
- test('rejects keychain and bootstrap nested approvals', async () => {
422
+ test('rejects keychain and accepts initial nested approvals', async () => {
419
423
  const childConfig = MultisigConfig.from({
420
424
  owners: [{ owner: owners[1]!.address, weight: 1 }],
421
425
  threshold: 1,
@@ -437,8 +441,8 @@ describe('selectApprovals', () => {
437
441
  })
438
442
  const childHash = MultisigConfig.getSignPayload({
439
443
  account: child,
444
+ config: childConfig,
440
445
  payload: hash,
441
- version: 0n,
442
446
  })
443
447
 
444
448
  await expect(
@@ -459,31 +463,36 @@ describe('selectApprovals', () => {
459
463
  ).rejects.toThrowErrorMatchingInlineSnapshot(
460
464
  `[MultisigOperation.InvalidApprovalError: Invalid multisig approval: keychain signatures cannot approve a multisig operation.]`,
461
465
  )
462
- await expect(
463
- MultisigOperation.selectApprovals({
464
- account,
465
- approvals: [
466
- SignatureEnvelope.serialize({
467
- account: child,
468
- init: childConfig,
469
- signatures: [
470
- SignatureEnvelope.deserialize(
471
- signApproval(owners[1]!, childHash),
472
- ),
473
- ],
474
- type: 'multisig',
475
- }),
476
- ],
477
- config,
478
- hash,
479
- resolveConfig: () => ({ config: childConfig, version: 0n }),
480
- }),
481
- ).rejects.toThrowErrorMatchingInlineSnapshot(
482
- `[MultisigOperation.InvalidApprovalError: Invalid multisig approval: nested multisig owner 0x7888d60e9cc26c8569d394fce435c248f1e49c3b cannot carry init.]`,
483
- )
466
+ const selection = await MultisigOperation.selectApprovals({
467
+ account,
468
+ approvals: [
469
+ SignatureEnvelope.serialize({
470
+ account: child,
471
+ config: childConfig,
472
+ signatures: [
473
+ SignatureEnvelope.deserialize(signApproval(owners[1]!, childHash)),
474
+ ],
475
+ type: 'multisig',
476
+ }),
477
+ ],
478
+ config,
479
+ hash,
480
+ resolveConfig: () => ({ config: childConfig, version: 0n }),
481
+ })
482
+ expect({
483
+ signatureCount: selection.signatureCount,
484
+ threshold: selection.threshold,
485
+ weight: selection.weight,
486
+ }).toMatchInlineSnapshot(`
487
+ {
488
+ "signatureCount": 1,
489
+ "threshold": 1,
490
+ "weight": 1,
491
+ }
492
+ `)
484
493
  })
485
494
 
486
- test('rejects nested account cycles', async () => {
495
+ test('rejects nested account cycles while serializing', () => {
487
496
  const config = MultisigConfig.from({
488
497
  owners: [{ owner: account, weight: 1 }],
489
498
  threshold: 1,
@@ -496,30 +505,21 @@ describe('selectApprovals', () => {
496
505
  })
497
506
  const nestedHash = MultisigConfig.getSignPayload({
498
507
  account,
508
+ config: { version: 2n },
499
509
  payload: hash,
500
- version: 2n,
501
510
  })
502
511
 
503
- await expect(
504
- MultisigOperation.selectApprovals({
512
+ expect(() =>
513
+ SignatureEnvelope.serialize({
505
514
  account,
506
- approvals: [
507
- SignatureEnvelope.serialize({
508
- account,
509
- signatures: [
510
- SignatureEnvelope.deserialize(
511
- signApproval(owners[0]!, nestedHash),
512
- ),
513
- ],
514
- type: 'multisig',
515
- }),
515
+ config: MultisigConfig.from({ ...config, version: 2n }),
516
+ signatures: [
517
+ SignatureEnvelope.deserialize(signApproval(owners[0]!, nestedHash)),
516
518
  ],
517
- config,
518
- hash,
519
- resolveConfig: () => ({ config, version: 2n }),
519
+ type: 'multisig',
520
520
  }),
521
- ).rejects.toThrowErrorMatchingInlineSnapshot(
522
- `[MultisigOperation.InvalidApprovalError: Invalid multisig approval: nested multisig owner 0xf81b7763d3a6876195d780865bd783dbd97dd36e is invalid.]`,
521
+ ).toThrowErrorMatchingInlineSnapshot(
522
+ `[SignatureEnvelope.InvalidMultisigApprovalError: Invalid native multisig owner approval: multisig account cannot be an owner.]`,
523
523
  )
524
524
  })
525
525
 
@@ -547,13 +547,13 @@ describe('selectApprovals', () => {
547
547
  })
548
548
  const childHash = MultisigConfig.getSignPayload({
549
549
  account: child,
550
+ config: { version: 1n },
550
551
  payload: hash,
551
- version: 1n,
552
552
  })
553
553
  const grandchildHash = MultisigConfig.getSignPayload({
554
554
  account: grandchild,
555
+ config: { version: 1n },
555
556
  payload: childHash,
556
- version: 1n,
557
557
  })
558
558
 
559
559
  await expect(
@@ -562,9 +562,14 @@ describe('selectApprovals', () => {
562
562
  approvals: [
563
563
  SignatureEnvelope.serialize({
564
564
  account: child,
565
+ config: MultisigConfig.from({ ...childConfig, version: 1n }),
565
566
  signatures: [
566
567
  {
567
568
  account: grandchild,
569
+ config: MultisigConfig.from({
570
+ ...grandchildConfig,
571
+ version: 1n,
572
+ }),
568
573
  signatures: [
569
574
  SignatureEnvelope.deserialize(
570
575
  signApproval(owners[2]!, grandchildHash),
@@ -632,8 +637,11 @@ describe('serializeTransaction', () => {
632
637
  const value = TxEnvelopeTempo.deserialize(serialized)
633
638
  results.push({
634
639
  account: value.signature?.account,
640
+ configVersion:
641
+ value.signature?.type === 'multisig'
642
+ ? value.signature.config.version
643
+ : undefined,
635
644
  hash: Hash.keccak256(serialized),
636
- init: value.signature?.type === 'multisig' && !!value.signature.init,
637
645
  signatureCount:
638
646
  value.signature?.type === 'multisig'
639
647
  ? value.signature.signatures.length
@@ -646,15 +654,15 @@ describe('serializeTransaction', () => {
646
654
  [
647
655
  {
648
656
  "account": "0xf81b7763d3a6876195d780865bd783dbd97dd36e",
649
- "hash": "0x704768725a4e798e2656f0f355f99507522c97b2947f551a5ee696216a2ba6fe",
650
- "init": false,
657
+ "configVersion": 1n,
658
+ "hash": "0x8309740edaf304284186f7bcfe4527745cd4eb48e7441795ebdd970798091f8f",
651
659
  "signatureCount": 2,
652
660
  "type": "0x76",
653
661
  },
654
662
  {
655
663
  "account": "0xf81b7763d3a6876195d780865bd783dbd97dd36e",
656
- "hash": "0x08131922349c385f9112fefc617fa6f6258a71df1125ec243bb3ee7cff59b700",
657
- "init": true,
664
+ "configVersion": 0n,
665
+ "hash": "0x636af84d8445d87cbcd33039d5a3a2274a5911036b1b7ceb740ac41e2f638611",
658
666
  "signatureCount": 2,
659
667
  "type": "0x76",
660
668
  },
@@ -833,6 +841,7 @@ describe('from', () => {
833
841
  ],
834
842
  "salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
835
843
  "threshold": 2,
844
+ "version": 1n,
836
845
  },
837
846
  "configVersion": 1n,
838
847
  "createdAt": 1,
@@ -865,6 +874,7 @@ describe('from', () => {
865
874
  ],
866
875
  "salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
867
876
  "threshold": 2,
877
+ "version": 1n,
868
878
  },
869
879
  "configVersion": 1n,
870
880
  "createdAt": 1,
@@ -899,6 +909,7 @@ describe('from', () => {
899
909
  ],
900
910
  "salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
901
911
  "threshold": 2,
912
+ "version": 1n,
902
913
  },
903
914
  "configVersion": 1n,
904
915
  "createdAt": 1,
@@ -929,10 +940,10 @@ describe('from', () => {
929
940
  ...transactionPending,
930
941
  hash: MultisigConfig.getSignPayload({
931
942
  account,
943
+ config: initializedConfig,
932
944
  payload: TxEnvelopeTempo.getSignPayload(
933
945
  TxEnvelopeTempo.deserialize(transaction),
934
946
  ),
935
- version: 1n,
936
947
  }),
937
948
  transaction,
938
949
  })
@@ -961,6 +972,7 @@ describe('from', () => {
961
972
  ],
962
973
  "salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
963
974
  "threshold": 2,
975
+ "version": 1n,
964
976
  },
965
977
  "configVersion": 1n,
966
978
  "createdAt": 1,
@@ -991,10 +1003,10 @@ describe('from', () => {
991
1003
  ...transactionPending,
992
1004
  hash: MultisigConfig.getSignPayload({
993
1005
  account,
1006
+ config: initializedConfig,
994
1007
  payload: TxEnvelopeTempo.getSignPayload(
995
1008
  TxEnvelopeTempo.deserialize(transaction),
996
1009
  ),
997
- version: 1n,
998
1010
  }),
999
1011
  transaction,
1000
1012
  })
@@ -1008,10 +1020,10 @@ describe('from', () => {
1008
1020
  configVersion: 0n,
1009
1021
  hash: MultisigConfig.getSignPayload({
1010
1022
  account,
1023
+ config,
1011
1024
  payload: TxEnvelopeTempo.getSignPayload(
1012
1025
  TxEnvelopeTempo.deserialize(transaction),
1013
1026
  ),
1014
- version: 0n,
1015
1027
  }),
1016
1028
  init: true,
1017
1029
  })
@@ -1040,6 +1052,7 @@ describe('from', () => {
1040
1052
  ],
1041
1053
  "salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
1042
1054
  "threshold": 2,
1055
+ "version": 0n,
1043
1056
  },
1044
1057
  "configVersion": 0n,
1045
1058
  "createdAt": 1,
@@ -1063,10 +1076,10 @@ describe('from', () => {
1063
1076
  configVersion: 0n,
1064
1077
  hash: MultisigConfig.getSignPayload({
1065
1078
  account,
1079
+ config,
1066
1080
  payload: TxEnvelopeTempo.getSignPayload(
1067
1081
  TxEnvelopeTempo.deserialize(transaction),
1068
1082
  ),
1069
- version: 0n,
1070
1083
  }),
1071
1084
  })
1072
1085
 
@@ -1091,6 +1104,7 @@ describe('from', () => {
1091
1104
  KeyAuthorization.from(authorization, {
1092
1105
  signature: {
1093
1106
  account,
1107
+ config: initializedConfig,
1094
1108
  signatures: [
1095
1109
  SignatureEnvelope.deserialize(approval_1),
1096
1110
  SignatureEnvelope.deserialize(approval_2),
@@ -1124,6 +1138,7 @@ describe('from', () => {
1124
1138
  ],
1125
1139
  "salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
1126
1140
  "threshold": 2,
1141
+ "version": 1n,
1127
1142
  },
1128
1143
  "configVersion": 1n,
1129
1144
  "createdAt": 1,
@@ -1156,12 +1171,13 @@ describe('from', () => {
1156
1171
  ],
1157
1172
  "salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
1158
1173
  "threshold": 2,
1174
+ "version": 1n,
1159
1175
  },
1160
1176
  "configVersion": 1n,
1161
1177
  "createdAt": 1,
1162
1178
  "hash": "0xf6995eb69c12c03d3d13b357abf7cac22b4effe52fba8ff02e5aef26161f77a0",
1163
1179
  "init": false,
1164
- "keyAuthorization": "0xf9015ff782107980943333333333333333333333333333333333333333846b49d2008080808094f81b7763d3a6876195d780865bd783dbd97dd36eb9012405f9012094f81b7763d3a6876195d780865bd783dbd97dd36ef90108b88201000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200b88201000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000047cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc4766997807775510db8ed040293d9ac69f7430dbba7dade63ce982299e04b79d227873d100",
1180
+ "keyAuthorization": "0xf901b3f782107980943333333333333333333333333333333333333333846b49d2008080808094f81b7763d3a6876195d780865bd783dbd97dd36eb9017805f9017494f81b7763d3a6876195d780865bd783dbd97dd36ef852a000000000000000000000000000000000000000000000000000000000000000000102eed69407e1ed8ea0e9601e5546b0a03aed683df360140701d694288f0cd85005f34168f731a468aef268c2f9456f01f90108b88201000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000065ecbe4d1a6330a44c8f7ef951d4bf165e6c6b721efada985fb41661bc6e7fd6c8734640c4998ff7e374b06ce1a64a2ecd82ab036384fb83d9a79b127a27d503200b88201000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000047cf27b188d034f7e8a52380304b51ac3c08969e277f21b35a60b48fc4766997807775510db8ed040293d9ac69f7430dbba7dade63ce982299e04b79d227873d100",
1165
1181
  "signatureCount": 2,
1166
1182
  "status": "success",
1167
1183
  "threshold": 2,
@@ -1179,7 +1195,7 @@ describe('from', () => {
1179
1195
  KeyAuthorization.from(authorization, {
1180
1196
  signature: {
1181
1197
  account,
1182
- init: config,
1198
+ config,
1183
1199
  signatures: [
1184
1200
  SignatureEnvelope.deserialize(approval_1),
1185
1201
  SignatureEnvelope.deserialize(approval_2),
@@ -1194,8 +1210,8 @@ describe('from', () => {
1194
1210
  configVersion: 0n,
1195
1211
  hash: MultisigConfig.getSignPayload({
1196
1212
  account,
1213
+ config,
1197
1214
  payload: KeyAuthorization.getSignPayload(authorization),
1198
- version: 0n,
1199
1215
  }),
1200
1216
  init: true,
1201
1217
  keyAuthorization: keyAuthorization_,
@@ -1229,6 +1245,7 @@ describe('from', () => {
1229
1245
  ],
1230
1246
  "salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
1231
1247
  "threshold": 2,
1248
+ "version": 0n,
1232
1249
  },
1233
1250
  "configVersion": 0n,
1234
1251
  "createdAt": 1,
@@ -1252,6 +1269,9 @@ describe('RPC conversion', () => {
1252
1269
  const transactionRpc = MultisigOperation.toRpc(transactionPending)
1253
1270
  const keyAuthorizationRpc = MultisigOperation.toRpc(keyAuthorizationPending)
1254
1271
 
1272
+ expect(() =>
1273
+ JSON.stringify({ keyAuthorizationRpc, transactionRpc }),
1274
+ ).not.toThrow()
1255
1275
  expect({ keyAuthorizationRpc, transactionRpc }).toMatchInlineSnapshot(`
1256
1276
  {
1257
1277
  "keyAuthorizationRpc": {
@@ -1272,6 +1292,7 @@ describe('RPC conversion', () => {
1272
1292
  ],
1273
1293
  "salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
1274
1294
  "threshold": 2,
1295
+ "version": "0x1",
1275
1296
  },
1276
1297
  "configVersion": "0x1",
1277
1298
  "createdAt": 1,
@@ -1303,6 +1324,7 @@ describe('RPC conversion', () => {
1303
1324
  ],
1304
1325
  "salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
1305
1326
  "threshold": 2,
1327
+ "version": "0x1",
1306
1328
  },
1307
1329
  "configVersion": "0x1",
1308
1330
  "createdAt": 1,
@@ -1440,10 +1462,10 @@ describe('validation', () => {
1440
1462
  account: '0x0000000000000000000000000000000000000000',
1441
1463
  hash: MultisigConfig.getSignPayload({
1442
1464
  account: '0x0000000000000000000000000000000000000000',
1465
+ config: initializedConfig,
1443
1466
  payload: TxEnvelopeTempo.getSignPayload(
1444
1467
  TxEnvelopeTempo.deserialize(transaction),
1445
1468
  ),
1446
- version: 1n,
1447
1469
  }),
1448
1470
  },
1449
1471
  },
@@ -1513,7 +1535,7 @@ describe('validation', () => {
1513
1535
  approvals: [
1514
1536
  SignatureEnvelope.serialize({
1515
1537
  account,
1516
- init: config,
1538
+ config,
1517
1539
  signatures: [ownerSignature_1],
1518
1540
  type: 'multisig',
1519
1541
  }),
@@ -1550,6 +1572,7 @@ describe('validation', () => {
1550
1572
  KeyAuthorization.from(authorization, {
1551
1573
  signature: {
1552
1574
  account,
1575
+ config: initializedConfig,
1553
1576
  signatures: [
1554
1577
  SignatureEnvelope.deserialize(approval_1),
1555
1578
  SignatureEnvelope.deserialize(approval_3),
@@ -1573,12 +1596,12 @@ describe('validation', () => {
1573
1596
  const signatures = [
1574
1597
  ...SignatureEnvelope.sortMultisigApprovals({
1575
1598
  account,
1599
+ config: initializedConfig,
1576
1600
  payload: KeyAuthorization.getSignPayload(authorization),
1577
1601
  signatures: [
1578
1602
  SignatureEnvelope.deserialize(approval_1),
1579
1603
  SignatureEnvelope.deserialize(approval_2),
1580
1604
  ],
1581
- version: 1n,
1582
1605
  }),
1583
1606
  ].reverse()
1584
1607
  const operation = {
@@ -1586,7 +1609,12 @@ describe('validation', () => {
1586
1609
  approvals: [approval_1, approval_2],
1587
1610
  keyAuthorization: KeyAuthorization.serialize(
1588
1611
  KeyAuthorization.from(authorization, {
1589
- signature: { account, signatures, type: 'multisig' },
1612
+ signature: {
1613
+ account,
1614
+ config: initializedConfig,
1615
+ signatures,
1616
+ type: 'multisig',
1617
+ },
1590
1618
  }),
1591
1619
  ),
1592
1620
  signatureCount: 2,
@@ -1608,6 +1636,7 @@ describe('validation', () => {
1608
1636
  KeyAuthorization.from(authorization, {
1609
1637
  signature: {
1610
1638
  account,
1639
+ config: initializedConfig,
1611
1640
  signatures: [
1612
1641
  SignatureEnvelope.deserialize(approval_1),
1613
1642
  SignatureEnvelope.deserialize(approval_1),
@@ -1628,37 +1657,49 @@ describe('validation', () => {
1628
1657
 
1629
1658
  test('rejects reordered nested key authorization approvals', () => {
1630
1659
  const authorization = KeyAuthorization.deserialize(keyAuthorization)
1660
+ const nestedConfig = MultisigConfig.from({
1661
+ owners: [{ owner: owner_2, weight: 1 }],
1662
+ threshold: 1,
1663
+ version: 1n,
1664
+ })
1631
1665
  const childSignatures = SignatureEnvelope.sortMultisigApprovals({
1632
1666
  account: owner_1,
1667
+ config: nestedConfig,
1633
1668
  payload: keyAuthorizationHash,
1634
1669
  signatures: [
1635
1670
  SignatureEnvelope.deserialize(approval_1),
1636
1671
  SignatureEnvelope.deserialize(approval_2),
1637
1672
  ],
1638
- version: 1n,
1639
1673
  })
1640
1674
  const retainedNested = SignatureEnvelope.from({
1641
1675
  account: owner_1,
1676
+ config: nestedConfig,
1642
1677
  signatures: childSignatures,
1643
1678
  type: 'multisig',
1644
1679
  })
1645
1680
  const selectedNested = SignatureEnvelope.from({
1646
1681
  account: owner_1,
1682
+ config: nestedConfig,
1647
1683
  signatures: [...childSignatures].reverse(),
1648
1684
  type: 'multisig',
1649
1685
  })
1650
1686
  const selected = SignatureEnvelope.sortMultisigApprovals({
1651
1687
  account,
1688
+ config: initializedConfig,
1652
1689
  payload: KeyAuthorization.getSignPayload(authorization),
1653
1690
  signatures: [selectedNested, SignatureEnvelope.deserialize(approval_2)],
1654
- version: 1n,
1655
1691
  })
1656
1692
  const operation = {
1657
1693
  ...keyAuthorizationPending,
1658
1694
  approvals: [SignatureEnvelope.serialize(retainedNested), approval_2],
1659
1695
  keyAuthorization: KeyAuthorization.serialize(
1660
1696
  KeyAuthorization.from(authorization, {
1661
- signature: { account, signatures: selected, type: 'multisig' },
1697
+ signature: {
1698
+ account,
1699
+ config: initializedConfig,
1700
+ signatures: selected,
1701
+ type: 'multisig',
1702
+ },
1662
1703
  }),
1663
1704
  ),
1664
1705
  signatureCount: 2,
@@ -1697,12 +1738,12 @@ describe('validation', () => {
1697
1738
  })
1698
1739
  const signatures = SignatureEnvelope.sortMultisigApprovals({
1699
1740
  account,
1741
+ config,
1700
1742
  payload: KeyAuthorization.getSignPayload(authorization),
1701
1743
  signatures: [
1702
1744
  SignatureEnvelope.deserialize(approval_1),
1703
1745
  SignatureEnvelope.deserialize(approval_2),
1704
1746
  ],
1705
- version: 0n,
1706
1747
  })
1707
1748
  const approvals = signatures.map((signature) =>
1708
1749
  SignatureEnvelope.serialize(signature),
@@ -1716,15 +1757,15 @@ describe('validation', () => {
1716
1757
  createdAt: 1,
1717
1758
  hash: MultisigConfig.getSignPayload({
1718
1759
  account,
1760
+ config,
1719
1761
  payload: KeyAuthorization.getSignPayload(authorization),
1720
- version: 0n,
1721
1762
  }),
1722
1763
  init: true,
1723
1764
  keyAuthorization: KeyAuthorization.serialize(
1724
1765
  KeyAuthorization.from(authorization, {
1725
1766
  signature: {
1726
1767
  account,
1727
- init: config,
1768
+ config,
1728
1769
  signatures,
1729
1770
  type: 'multisig',
1730
1771
  },