@obolnetwork/obol-sdk 1.0.17 → 2.0.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "1.0.17",
3
+ "version": "2.0.1",
4
4
  "description": "A package for creating Distributed Validators using the Obol API.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/obolnetwork/obol-sdk/issues"
@@ -91,6 +91,7 @@
91
91
  ],
92
92
  "release-it": {
93
93
  "git": {
94
+ "changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/main/templates/changelog-compact.hbs",
94
95
  "commitMessage": "chore(release): v${version}",
95
96
  "push": true,
96
97
  "commit": true,
@@ -106,12 +107,8 @@
106
107
  "publish": false,
107
108
  "ignoreVersion": false
108
109
  },
109
- "plugins": {
110
- "@release-it/conventional-changelog": {
111
- "preset": "angular",
112
- "infile": "CHANGELOG.md",
113
- "header": "# Changelog"
114
- }
110
+ "hooks": {
111
+ "after:bump": "npx auto-changelog -p --hide-credit"
115
112
  }
116
113
  },
117
114
  "jest": {
@@ -93,6 +93,14 @@ const clusterLockHash = (clusterLock) => {
93
93
  return (0, v1_7_0_js_1.hashClusterLockV1X7)(clusterLock);
94
94
  }
95
95
  if (semver.eq(clusterLock.cluster_definition.version, 'v1.8.0')) {
96
+ if (clusterLock.cluster_definition.deposit_amounts === null &&
97
+ clusterLock.distributed_validators.some(distributedValidator => {
98
+ var _a;
99
+ return ((_a = distributedValidator.partial_deposit_data) === null || _a === void 0 ? void 0 : _a.length) !== 1 ||
100
+ distributedValidator.partial_deposit_data[0].amount !== '32000000000';
101
+ })) {
102
+ throw new Error('mismatch between deposit_amounts and partial_deposit_data fields');
103
+ }
96
104
  return (0, v1_8_0_js_1.hashClusterLockV1X8)(clusterLock);
97
105
  }
98
106
  // other versions
@@ -67,9 +67,11 @@ const hashClusterDefinitionV1X8 = (cluster, configOnly) => {
67
67
  withdrawal_address: (0, ssz_1.fromHexString)(validator.withdrawal_address),
68
68
  };
69
69
  });
70
- val.deposit_amounts = cluster.deposit_amounts.map((amount) => {
71
- return parseInt(amount);
72
- });
70
+ if (cluster.deposit_amounts) {
71
+ val.deposit_amounts = cluster.deposit_amounts.map((amount) => {
72
+ return parseInt(amount);
73
+ });
74
+ }
73
75
  if (!configOnly) {
74
76
  val.config_hash = (0, ssz_1.fromHexString)(cluster.config_hash);
75
77
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clusterLockV1X8 = exports.clusterConfigV1X8 = exports.clusterLockV1X7 = exports.clusterConfigV1X7 = exports.clusterLockV1X6 = exports.enr = void 0;
3
+ exports.nullDepositAmountsClusterLockV1X8 = exports.clusterLockV1X8 = exports.clusterConfigV1X8 = exports.clusterLockV1X7 = exports.clusterConfigV1X7 = exports.clusterLockV1X6 = exports.enr = void 0;
4
4
  exports.enr = 'enr:-HW4QLlrtMjFLGkFT1bwdGbvZQlH8hLi0M2g44JAxEYP3BZmYpcsy9Q56HPPD87fMucjvLv4-obEFacpsg0ehRilbHeAgmlkgnY0iXNlY3AyNTZrMaEDRaa5o2aSgqyFq_ERZcQTztrOij1mFtXX1bJuVI6ieak';
5
5
  // v1.6.0
6
6
  exports.clusterLockV1X6 = {
@@ -306,3 +306,120 @@ exports.clusterLockV1X8 = {
306
306
  '0x0135f307831fa58ff64f9af46e00b92e2375162646af88f6991ba6f98a8c262f2c41846af59da68eadb8ff9c94db42ee8005bd4236e5897635573db2911460aa00',
307
307
  ],
308
308
  };
309
+ exports.nullDepositAmountsClusterLockV1X8 = {
310
+ cluster_definition: {
311
+ name: 'null deposit_amounts',
312
+ creator: {
313
+ address: '',
314
+ config_signature: '',
315
+ },
316
+ operators: [
317
+ {
318
+ address: '',
319
+ enr: 'enr:-HW4QAsMPbcGWZlaTYG9NfyzIKnw6wN11MrH9OKeLq_a_mB8akJTkoqY8p_OrlMW3IWpcP2KcfaamQoAAL22gFnxAFaAgmlkgnY0iXNlY3AyNTZrMaECc8v8p8k9isB8n3q_0gs969Ec2H14tHwQ0KmyeskZ1O4',
320
+ config_signature: '',
321
+ enr_signature: '',
322
+ },
323
+ {
324
+ address: '',
325
+ enr: 'enr:-HW4QN2uvJ-A-HfrFFXk00h6_3woLkkJjduAAs4xpkp1g1pebhTFPEnTrnI0Pt2pdtH3OT5Yl6nFF4vzYW5gGJqs0cWAgmlkgnY0iXNlY3AyNTZrMaECA3fE7ero5CypBt5k_OPhXxjMVaG5U8pkcKNaZnWxhAI',
326
+ config_signature: '',
327
+ enr_signature: '',
328
+ },
329
+ {
330
+ address: '',
331
+ enr: 'enr:-HW4QKI7VF_B7JXG5w03Mm59hGM-p1odnD8bGiKFEdAXY4nqK2GP_2GQPY3LZxU6XXnuihkZJh8qo2Z2U_bBZVTII0WAgmlkgnY0iXNlY3AyNTZrMaECe9MQDo5o_v7q0eaHXn4OzgcfH4avwWM0u29cGnHDnGg',
332
+ config_signature: '',
333
+ enr_signature: '',
334
+ },
335
+ {
336
+ address: '',
337
+ enr: 'enr:-HW4QDi0E7eFnahIJd94VSbIG2_IuhkSVTAx_VOM6oQkDhA0eZTHZSQ2c00vsa8AeR8LPZjmUwDD7KvNxgebHc7UotqAgmlkgnY0iXNlY3AyNTZrMaECMBVL5rrUkm3sUq5F9t_MIoQWz5MQuo6NTr_5PhbxcjQ',
338
+ config_signature: '',
339
+ enr_signature: '',
340
+ },
341
+ ],
342
+ uuid: '23C75265-554C-83C1-4B82-A0F30159137E',
343
+ version: 'v1.8.0',
344
+ timestamp: '2024-08-06T14:51:06Z',
345
+ num_validators: 2,
346
+ threshold: 3,
347
+ validators: [
348
+ {
349
+ fee_recipient_address: '0x86B8145c98e5BD25BA722645b15eD65f024a87EC',
350
+ withdrawal_address: '0x86B8145c98e5BD25BA722645b15eD65f024a87EC',
351
+ },
352
+ {
353
+ fee_recipient_address: '0x86B8145c98e5BD25BA722645b15eD65f024a87EC',
354
+ withdrawal_address: '0x86B8145c98e5BD25BA722645b15eD65f024a87EC',
355
+ },
356
+ ],
357
+ dkg_algorithm: 'default',
358
+ fork_version: '0x00000000',
359
+ deposit_amounts: null,
360
+ config_hash: '0x2147b404cc1bbfb269e6d9fb244966221fcce33b15ab85b10652338254e4e81d',
361
+ definition_hash: '0xcb20df41459fba6adf25f49e94bcf06a7cce14289e186db256114ad8328137a8',
362
+ },
363
+ distributed_validators: [
364
+ {
365
+ distributed_public_key: '0x81bfe823b95a9f8799de07f6ae6accf1d7dc8f454be5e049f4e46d4dbd557269d3139ea7ede545c71517d099dc5da90a',
366
+ public_shares: [
367
+ '0xa52a4241e37b4e830f93bd740177d08c3308de5b7711d77641d278665c5c18961e02cb18ec394634d043b815a6a7cf31',
368
+ '0x8f1f017045e63451a3e421f3e5d1219f9e0dbee1ca312f31282ed09a67bbe2dd554d6fcb94c3d1ea37228a147ac14255',
369
+ '0x84f25caa20ac1ff695b9696b27042daec76b32c90bededc09908aed7b03198326ea63b3c7b6767395947ac76074bb688',
370
+ '0xb1718a37d0db33d5e935b1ee950fbf5ad88fe5fb558aa1cd252391f48cf69feaf2beccef1e6b7cbb5265729cb45cbf5b',
371
+ ],
372
+ builder_registration: {
373
+ message: {
374
+ fee_recipient: '0x86b8145c98e5bd25ba722645b15ed65f024a87ec',
375
+ gas_limit: 30000000,
376
+ timestamp: 1606824023,
377
+ pubkey: '0x81bfe823b95a9f8799de07f6ae6accf1d7dc8f454be5e049f4e46d4dbd557269d3139ea7ede545c71517d099dc5da90a',
378
+ },
379
+ signature: '0xb021590540f9c0a7ab1f7030a510f11dcfe701d7fca8d0811eedc898951457d28f269f6a0fecfc186136ba1522f2e93b18043313c5b76936d1ae923d736500c7283a9dafd3a59f4d80026d73aa9a3219453da62ad5721960f66119b0da624e5c',
380
+ },
381
+ partial_deposit_data: [
382
+ {
383
+ pubkey: '0x81bfe823b95a9f8799de07f6ae6accf1d7dc8f454be5e049f4e46d4dbd557269d3139ea7ede545c71517d099dc5da90a',
384
+ withdrawal_credentials: '0x01000000000000000000000086b8145c98e5bd25ba722645b15ed65f024a87ec',
385
+ amount: '32000000000',
386
+ signature: '0xb9969177a01747d320f3bd77f8010459b3e1e310e1a3b6c75bfbea1cd870fbd26a8a34131b8eadc480a8b6d0255a4501115f953617c10ac5032a12ed5002540b91e535b1b52b18d0a500c3f422039c950d29e61bf411fefc4e9d0aa568a43ca1',
387
+ },
388
+ ],
389
+ },
390
+ {
391
+ distributed_public_key: '0xb64918e0ac1d5e306c37d3ee21c9fbca3877397d9448841c779dcfdd6f4b9a949c285f72b19305b08e968b7d09974661',
392
+ public_shares: [
393
+ '0xb01cc7ecd82911092484cbb4cf211c14183f4820e037026afead639028b731ef0d7b62221fbcac0c0a48b12116063a32',
394
+ '0xacb06f314e0c116e5e33bffd2ada93832ca1215ea004c046f3d0cdee1bdc1c05787c074216dd0c99464bc471e179f981',
395
+ '0xa3bbf87357b4ebc6a479aeea73951609b9e4c4b1f28fdd2cf91350207029dc44fc28452792f6053c0f2889d9d4bbe9b0',
396
+ '0x84fc2f454d3fb023abcca1abab037d247923cd506a8ec26ef01755d10053acd2176af7baff805a0c7c2442d2ff981cf4',
397
+ ],
398
+ builder_registration: {
399
+ message: {
400
+ fee_recipient: '0x86b8145c98e5bd25ba722645b15ed65f024a87ec',
401
+ gas_limit: 30000000,
402
+ timestamp: 1606824023,
403
+ pubkey: '0xb64918e0ac1d5e306c37d3ee21c9fbca3877397d9448841c779dcfdd6f4b9a949c285f72b19305b08e968b7d09974661',
404
+ },
405
+ signature: '0xb91c5bc699018d1c0a9b68dacd60f5c85e9d2d769b4271d4c586cc576f0598e48257eafaa0db474b2d1f11fff7ed31d900d4052ae10675fc9713565c8131491588f522da114ea4f506712521683166cd729ddae1d854ca02708d0e15a4cf2155',
406
+ },
407
+ partial_deposit_data: [
408
+ {
409
+ pubkey: '0xb64918e0ac1d5e306c37d3ee21c9fbca3877397d9448841c779dcfdd6f4b9a949c285f72b19305b08e968b7d09974661',
410
+ withdrawal_credentials: '0x01000000000000000000000086b8145c98e5bd25ba722645b15ed65f024a87ec',
411
+ amount: '32000000000',
412
+ signature: '0xaaea8e3debc299b927e3930f4305dbe7a89a9ec217d0f262d01d68e64b1afc32d5f32d0d8cbfbdaf2edc2fbe97017bc4085ac76f0be189ce12d9cb80821d4b6a3ec29d3d0a78cc14e0a5117974b518860d4c5f8644126a82758dee5b944957a4',
413
+ },
414
+ ],
415
+ },
416
+ ],
417
+ signature_aggregate: '0xb0b2c13ec9c4bf39d731ad38710c67a86861945e320a51ec42c0fe1aba53c0afd9eed63d9e0b0bc503c615fe1aefd3d619292ef278463b3ca3c11741df12615e2984eeeb95750fa898c88fefbca7609da0b1dbfb225a03615bddfbf1f2d00a76',
418
+ lock_hash: '0xa79a0f71a7e0412faefd88197785cf4edeb36d4c07343e91132fdd38a649926f',
419
+ node_signatures: [
420
+ '0xe1406808f92ffff202cc627f21cf8a05ea6e5dd823fb2ce0c6b27286c09c7cfe4fa267752a3a53a276270d6d709d27cd5df292d2d5a1d442ad268126ff500c0400',
421
+ '0x7538367a0884a26df61d5514327c1791eb4cb34ab270b2c4fedba6f5954f39c445e49307a149b2ea341aaffb6213de498dd02185583b3fe04929756fe3a41c2300',
422
+ '0x971c848e4f1ec79aa954b5d6e2af7d445631f0ae082be87e9ac0332f5d693de72a52850583b52a10fbdb1ee8bdd009bafd7c1c5dbc726c623a2b22beee4e267501',
423
+ '0xdb6332a4ca9c41592511e7480c835b449fea120430e759735f3c24f1a6d496551a516151d2baae21d0cc9469b28dc1122b672af40ebb0e77045da92e0da6a03500',
424
+ ],
425
+ };
@@ -179,10 +179,22 @@ describe('Cluster Client without a signer', () => {
179
179
  { version: 'v1.6.0', clusterLock: fixtures_js_1.clusterLockV1X6 },
180
180
  { version: 'v1.7.0', clusterLock: fixtures_js_1.clusterLockV1X7 },
181
181
  { version: 'v1.8.0', clusterLock: fixtures_js_1.clusterLockV1X8 },
182
+ {
183
+ version: 'null deposit_amounts v1.8.0',
184
+ clusterLock: fixtures_js_1.nullDepositAmountsClusterLockV1X8,
185
+ },
182
186
  ])("$version: 'should return true on verified cluster lock'", ({ clusterLock }) => __awaiter(void 0, void 0, void 0, function* () {
183
187
  const isValidLock = yield (0, index_1.validateClusterLock)(clusterLock);
184
188
  expect(isValidLock).toEqual(true);
185
189
  }));
190
+ test('validateCluster should return false for cluster with null deposit_amounts and incorrect partial_deposits', () => __awaiter(void 0, void 0, void 0, function* () {
191
+ const partialDeposit = fixtures_js_1.nullDepositAmountsClusterLockV1X8.distributed_validators[0]
192
+ .partial_deposit_data[0];
193
+ const isValidLock = yield (0, index_1.validateClusterLock)(Object.assign(Object.assign({}, fixtures_js_1.nullDepositAmountsClusterLockV1X8), { distributed_validators: [
194
+ Object.assign(Object.assign({}, fixtures_js_1.nullDepositAmountsClusterLockV1X8.distributed_validators[0]), { partial_deposit_data: [partialDeposit, partialDeposit] }),
195
+ ] }));
196
+ expect(isValidLock).toEqual(false);
197
+ }));
186
198
  test('Finds the hash of the latest version of terms and conditions', () => __awaiter(void 0, void 0, void 0, function* () {
187
199
  const termsAndConditionsHash = yield (0, termsAndConditions_1.hashTermsAndConditions)();
188
200
  expect(termsAndConditionsHash).toEqual('0xd33721644e8f3afab1495a74abe3523cec12d48b8da6cb760972492ca3f1a273');
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "1.0.17",
3
+ "version": "2.0.1",
4
4
  "description": "A package for creating Distributed Validators using the Obol API.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/obolnetwork/obol-sdk/issues"
@@ -91,6 +91,7 @@
91
91
  ],
92
92
  "release-it": {
93
93
  "git": {
94
+ "changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/main/templates/changelog-compact.hbs",
94
95
  "commitMessage": "chore(release): v${version}",
95
96
  "push": true,
96
97
  "commit": true,
@@ -106,12 +107,8 @@
106
107
  "publish": false,
107
108
  "ignoreVersion": false
108
109
  },
109
- "plugins": {
110
- "@release-it/conventional-changelog": {
111
- "preset": "angular",
112
- "infile": "CHANGELOG.md",
113
- "header": "# Changelog"
114
- }
110
+ "hooks": {
111
+ "after:bump": "npx auto-changelog -p --hide-credit"
115
112
  }
116
113
  },
117
114
  "jest": {
@@ -63,6 +63,14 @@ export const clusterLockHash = (clusterLock) => {
63
63
  return hashClusterLockV1X7(clusterLock);
64
64
  }
65
65
  if (semver.eq(clusterLock.cluster_definition.version, 'v1.8.0')) {
66
+ if (clusterLock.cluster_definition.deposit_amounts === null &&
67
+ clusterLock.distributed_validators.some(distributedValidator => {
68
+ var _a;
69
+ return ((_a = distributedValidator.partial_deposit_data) === null || _a === void 0 ? void 0 : _a.length) !== 1 ||
70
+ distributedValidator.partial_deposit_data[0].amount !== '32000000000';
71
+ })) {
72
+ throw new Error('mismatch between deposit_amounts and partial_deposit_data fields');
73
+ }
66
74
  return hashClusterLockV1X8(clusterLock);
67
75
  }
68
76
  // other versions
@@ -63,9 +63,11 @@ export const hashClusterDefinitionV1X8 = (cluster, configOnly) => {
63
63
  withdrawal_address: fromHexString(validator.withdrawal_address),
64
64
  };
65
65
  });
66
- val.deposit_amounts = cluster.deposit_amounts.map((amount) => {
67
- return parseInt(amount);
68
- });
66
+ if (cluster.deposit_amounts) {
67
+ val.deposit_amounts = cluster.deposit_amounts.map((amount) => {
68
+ return parseInt(amount);
69
+ });
70
+ }
69
71
  if (!configOnly) {
70
72
  val.config_hash = fromHexString(cluster.config_hash);
71
73
  }
@@ -303,3 +303,120 @@ export const clusterLockV1X8 = {
303
303
  '0x0135f307831fa58ff64f9af46e00b92e2375162646af88f6991ba6f98a8c262f2c41846af59da68eadb8ff9c94db42ee8005bd4236e5897635573db2911460aa00',
304
304
  ],
305
305
  };
306
+ export const nullDepositAmountsClusterLockV1X8 = {
307
+ cluster_definition: {
308
+ name: 'null deposit_amounts',
309
+ creator: {
310
+ address: '',
311
+ config_signature: '',
312
+ },
313
+ operators: [
314
+ {
315
+ address: '',
316
+ enr: 'enr:-HW4QAsMPbcGWZlaTYG9NfyzIKnw6wN11MrH9OKeLq_a_mB8akJTkoqY8p_OrlMW3IWpcP2KcfaamQoAAL22gFnxAFaAgmlkgnY0iXNlY3AyNTZrMaECc8v8p8k9isB8n3q_0gs969Ec2H14tHwQ0KmyeskZ1O4',
317
+ config_signature: '',
318
+ enr_signature: '',
319
+ },
320
+ {
321
+ address: '',
322
+ enr: 'enr:-HW4QN2uvJ-A-HfrFFXk00h6_3woLkkJjduAAs4xpkp1g1pebhTFPEnTrnI0Pt2pdtH3OT5Yl6nFF4vzYW5gGJqs0cWAgmlkgnY0iXNlY3AyNTZrMaECA3fE7ero5CypBt5k_OPhXxjMVaG5U8pkcKNaZnWxhAI',
323
+ config_signature: '',
324
+ enr_signature: '',
325
+ },
326
+ {
327
+ address: '',
328
+ enr: 'enr:-HW4QKI7VF_B7JXG5w03Mm59hGM-p1odnD8bGiKFEdAXY4nqK2GP_2GQPY3LZxU6XXnuihkZJh8qo2Z2U_bBZVTII0WAgmlkgnY0iXNlY3AyNTZrMaECe9MQDo5o_v7q0eaHXn4OzgcfH4avwWM0u29cGnHDnGg',
329
+ config_signature: '',
330
+ enr_signature: '',
331
+ },
332
+ {
333
+ address: '',
334
+ enr: 'enr:-HW4QDi0E7eFnahIJd94VSbIG2_IuhkSVTAx_VOM6oQkDhA0eZTHZSQ2c00vsa8AeR8LPZjmUwDD7KvNxgebHc7UotqAgmlkgnY0iXNlY3AyNTZrMaECMBVL5rrUkm3sUq5F9t_MIoQWz5MQuo6NTr_5PhbxcjQ',
335
+ config_signature: '',
336
+ enr_signature: '',
337
+ },
338
+ ],
339
+ uuid: '23C75265-554C-83C1-4B82-A0F30159137E',
340
+ version: 'v1.8.0',
341
+ timestamp: '2024-08-06T14:51:06Z',
342
+ num_validators: 2,
343
+ threshold: 3,
344
+ validators: [
345
+ {
346
+ fee_recipient_address: '0x86B8145c98e5BD25BA722645b15eD65f024a87EC',
347
+ withdrawal_address: '0x86B8145c98e5BD25BA722645b15eD65f024a87EC',
348
+ },
349
+ {
350
+ fee_recipient_address: '0x86B8145c98e5BD25BA722645b15eD65f024a87EC',
351
+ withdrawal_address: '0x86B8145c98e5BD25BA722645b15eD65f024a87EC',
352
+ },
353
+ ],
354
+ dkg_algorithm: 'default',
355
+ fork_version: '0x00000000',
356
+ deposit_amounts: null,
357
+ config_hash: '0x2147b404cc1bbfb269e6d9fb244966221fcce33b15ab85b10652338254e4e81d',
358
+ definition_hash: '0xcb20df41459fba6adf25f49e94bcf06a7cce14289e186db256114ad8328137a8',
359
+ },
360
+ distributed_validators: [
361
+ {
362
+ distributed_public_key: '0x81bfe823b95a9f8799de07f6ae6accf1d7dc8f454be5e049f4e46d4dbd557269d3139ea7ede545c71517d099dc5da90a',
363
+ public_shares: [
364
+ '0xa52a4241e37b4e830f93bd740177d08c3308de5b7711d77641d278665c5c18961e02cb18ec394634d043b815a6a7cf31',
365
+ '0x8f1f017045e63451a3e421f3e5d1219f9e0dbee1ca312f31282ed09a67bbe2dd554d6fcb94c3d1ea37228a147ac14255',
366
+ '0x84f25caa20ac1ff695b9696b27042daec76b32c90bededc09908aed7b03198326ea63b3c7b6767395947ac76074bb688',
367
+ '0xb1718a37d0db33d5e935b1ee950fbf5ad88fe5fb558aa1cd252391f48cf69feaf2beccef1e6b7cbb5265729cb45cbf5b',
368
+ ],
369
+ builder_registration: {
370
+ message: {
371
+ fee_recipient: '0x86b8145c98e5bd25ba722645b15ed65f024a87ec',
372
+ gas_limit: 30000000,
373
+ timestamp: 1606824023,
374
+ pubkey: '0x81bfe823b95a9f8799de07f6ae6accf1d7dc8f454be5e049f4e46d4dbd557269d3139ea7ede545c71517d099dc5da90a',
375
+ },
376
+ signature: '0xb021590540f9c0a7ab1f7030a510f11dcfe701d7fca8d0811eedc898951457d28f269f6a0fecfc186136ba1522f2e93b18043313c5b76936d1ae923d736500c7283a9dafd3a59f4d80026d73aa9a3219453da62ad5721960f66119b0da624e5c',
377
+ },
378
+ partial_deposit_data: [
379
+ {
380
+ pubkey: '0x81bfe823b95a9f8799de07f6ae6accf1d7dc8f454be5e049f4e46d4dbd557269d3139ea7ede545c71517d099dc5da90a',
381
+ withdrawal_credentials: '0x01000000000000000000000086b8145c98e5bd25ba722645b15ed65f024a87ec',
382
+ amount: '32000000000',
383
+ signature: '0xb9969177a01747d320f3bd77f8010459b3e1e310e1a3b6c75bfbea1cd870fbd26a8a34131b8eadc480a8b6d0255a4501115f953617c10ac5032a12ed5002540b91e535b1b52b18d0a500c3f422039c950d29e61bf411fefc4e9d0aa568a43ca1',
384
+ },
385
+ ],
386
+ },
387
+ {
388
+ distributed_public_key: '0xb64918e0ac1d5e306c37d3ee21c9fbca3877397d9448841c779dcfdd6f4b9a949c285f72b19305b08e968b7d09974661',
389
+ public_shares: [
390
+ '0xb01cc7ecd82911092484cbb4cf211c14183f4820e037026afead639028b731ef0d7b62221fbcac0c0a48b12116063a32',
391
+ '0xacb06f314e0c116e5e33bffd2ada93832ca1215ea004c046f3d0cdee1bdc1c05787c074216dd0c99464bc471e179f981',
392
+ '0xa3bbf87357b4ebc6a479aeea73951609b9e4c4b1f28fdd2cf91350207029dc44fc28452792f6053c0f2889d9d4bbe9b0',
393
+ '0x84fc2f454d3fb023abcca1abab037d247923cd506a8ec26ef01755d10053acd2176af7baff805a0c7c2442d2ff981cf4',
394
+ ],
395
+ builder_registration: {
396
+ message: {
397
+ fee_recipient: '0x86b8145c98e5bd25ba722645b15ed65f024a87ec',
398
+ gas_limit: 30000000,
399
+ timestamp: 1606824023,
400
+ pubkey: '0xb64918e0ac1d5e306c37d3ee21c9fbca3877397d9448841c779dcfdd6f4b9a949c285f72b19305b08e968b7d09974661',
401
+ },
402
+ signature: '0xb91c5bc699018d1c0a9b68dacd60f5c85e9d2d769b4271d4c586cc576f0598e48257eafaa0db474b2d1f11fff7ed31d900d4052ae10675fc9713565c8131491588f522da114ea4f506712521683166cd729ddae1d854ca02708d0e15a4cf2155',
403
+ },
404
+ partial_deposit_data: [
405
+ {
406
+ pubkey: '0xb64918e0ac1d5e306c37d3ee21c9fbca3877397d9448841c779dcfdd6f4b9a949c285f72b19305b08e968b7d09974661',
407
+ withdrawal_credentials: '0x01000000000000000000000086b8145c98e5bd25ba722645b15ed65f024a87ec',
408
+ amount: '32000000000',
409
+ signature: '0xaaea8e3debc299b927e3930f4305dbe7a89a9ec217d0f262d01d68e64b1afc32d5f32d0d8cbfbdaf2edc2fbe97017bc4085ac76f0be189ce12d9cb80821d4b6a3ec29d3d0a78cc14e0a5117974b518860d4c5f8644126a82758dee5b944957a4',
410
+ },
411
+ ],
412
+ },
413
+ ],
414
+ signature_aggregate: '0xb0b2c13ec9c4bf39d731ad38710c67a86861945e320a51ec42c0fe1aba53c0afd9eed63d9e0b0bc503c615fe1aefd3d619292ef278463b3ca3c11741df12615e2984eeeb95750fa898c88fefbca7609da0b1dbfb225a03615bddfbf1f2d00a76',
415
+ lock_hash: '0xa79a0f71a7e0412faefd88197785cf4edeb36d4c07343e91132fdd38a649926f',
416
+ node_signatures: [
417
+ '0xe1406808f92ffff202cc627f21cf8a05ea6e5dd823fb2ce0c6b27286c09c7cfe4fa267752a3a53a276270d6d709d27cd5df292d2d5a1d442ad268126ff500c0400',
418
+ '0x7538367a0884a26df61d5514327c1791eb4cb34ab270b2c4fedba6f5954f39c445e49307a149b2ea341aaffb6213de498dd02185583b3fe04929756fe3a41c2300',
419
+ '0x971c848e4f1ec79aa954b5d6e2af7d445631f0ae082be87e9ac0332f5d693de72a52850583b52a10fbdb1ee8bdd009bafd7c1c5dbc726c623a2b22beee4e267501',
420
+ '0xdb6332a4ca9c41592511e7480c835b449fea120430e759735f3c24f1a6d496551a516151d2baae21d0cc9469b28dc1122b672af40ebb0e77045da92e0da6a03500',
421
+ ],
422
+ };
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { ethers } from 'ethers';
11
11
  import { Client, validateClusterLock } from '../src/index';
12
- import { clusterConfigV1X7, clusterConfigV1X8, clusterLockV1X6, clusterLockV1X7, clusterLockV1X8, } from './fixtures.js';
12
+ import { clusterConfigV1X7, clusterConfigV1X8, clusterLockV1X6, clusterLockV1X7, clusterLockV1X8, nullDepositAmountsClusterLockV1X8, } from './fixtures.js';
13
13
  import { SDK_VERSION } from '../src/constants';
14
14
  import { Base } from '../src/base';
15
15
  import { validatePayload } from '../src/ajv';
@@ -177,10 +177,22 @@ describe('Cluster Client without a signer', () => {
177
177
  { version: 'v1.6.0', clusterLock: clusterLockV1X6 },
178
178
  { version: 'v1.7.0', clusterLock: clusterLockV1X7 },
179
179
  { version: 'v1.8.0', clusterLock: clusterLockV1X8 },
180
+ {
181
+ version: 'null deposit_amounts v1.8.0',
182
+ clusterLock: nullDepositAmountsClusterLockV1X8,
183
+ },
180
184
  ])("$version: 'should return true on verified cluster lock'", ({ clusterLock }) => __awaiter(void 0, void 0, void 0, function* () {
181
185
  const isValidLock = yield validateClusterLock(clusterLock);
182
186
  expect(isValidLock).toEqual(true);
183
187
  }));
188
+ test('validateCluster should return false for cluster with null deposit_amounts and incorrect partial_deposits', () => __awaiter(void 0, void 0, void 0, function* () {
189
+ const partialDeposit = nullDepositAmountsClusterLockV1X8.distributed_validators[0]
190
+ .partial_deposit_data[0];
191
+ const isValidLock = yield validateClusterLock(Object.assign(Object.assign({}, nullDepositAmountsClusterLockV1X8), { distributed_validators: [
192
+ Object.assign(Object.assign({}, nullDepositAmountsClusterLockV1X8.distributed_validators[0]), { partial_deposit_data: [partialDeposit, partialDeposit] }),
193
+ ] }));
194
+ expect(isValidLock).toEqual(false);
195
+ }));
184
196
  test('Finds the hash of the latest version of terms and conditions', () => __awaiter(void 0, void 0, void 0, function* () {
185
197
  const termsAndConditionsHash = yield hashTermsAndConditions();
186
198
  expect(termsAndConditionsHash).toEqual('0xd33721644e8f3afab1495a74abe3523cec12d48b8da6cb760972492ca3f1a273');
@@ -61,7 +61,7 @@ export type ClusterPayload = {
61
61
  /** The cluster validators information. */
62
62
  validators: ClusterValidator[];
63
63
  /** The cluster partial deposits in gwei or 32000000000. */
64
- deposit_amounts?: string[];
64
+ deposit_amounts?: string[] | null;
65
65
  };
66
66
  /**
67
67
  * Cluster definition data needed for dkg
@@ -85,8 +85,6 @@ export interface ClusterDefinition extends ClusterPayload {
85
85
  threshold: number;
86
86
  /** The number of distributed validators in the cluster. */
87
87
  num_validators: number;
88
- /** The cluster partial deposits in gwei or 32000000000. */
89
- deposit_amounts?: string[];
90
88
  /** The hash of the cluster definition. */
91
89
  definition_hash?: string;
92
90
  }
@@ -161,3 +161,54 @@ export declare const clusterLockV1X8: {
161
161
  lock_hash: string;
162
162
  node_signatures: string[];
163
163
  };
164
+ export declare const nullDepositAmountsClusterLockV1X8: {
165
+ cluster_definition: {
166
+ name: string;
167
+ creator: {
168
+ address: string;
169
+ config_signature: string;
170
+ };
171
+ operators: {
172
+ address: string;
173
+ enr: string;
174
+ config_signature: string;
175
+ enr_signature: string;
176
+ }[];
177
+ uuid: string;
178
+ version: string;
179
+ timestamp: string;
180
+ num_validators: number;
181
+ threshold: number;
182
+ validators: {
183
+ fee_recipient_address: string;
184
+ withdrawal_address: string;
185
+ }[];
186
+ dkg_algorithm: string;
187
+ fork_version: string;
188
+ deposit_amounts: null;
189
+ config_hash: string;
190
+ definition_hash: string;
191
+ };
192
+ distributed_validators: {
193
+ distributed_public_key: string;
194
+ public_shares: string[];
195
+ builder_registration: {
196
+ message: {
197
+ fee_recipient: string;
198
+ gas_limit: number;
199
+ timestamp: number;
200
+ pubkey: string;
201
+ };
202
+ signature: string;
203
+ };
204
+ partial_deposit_data: {
205
+ pubkey: string;
206
+ withdrawal_credentials: string;
207
+ amount: string;
208
+ signature: string;
209
+ }[];
210
+ }[];
211
+ signature_aggregate: string;
212
+ lock_hash: string;
213
+ node_signatures: string[];
214
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "1.0.17",
3
+ "version": "2.0.1",
4
4
  "description": "A package for creating Distributed Validators using the Obol API.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/obolnetwork/obol-sdk/issues"
@@ -91,6 +91,7 @@
91
91
  ],
92
92
  "release-it": {
93
93
  "git": {
94
+ "changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/main/templates/changelog-compact.hbs",
94
95
  "commitMessage": "chore(release): v${version}",
95
96
  "push": true,
96
97
  "commit": true,
@@ -106,12 +107,8 @@
106
107
  "publish": false,
107
108
  "ignoreVersion": false
108
109
  },
109
- "plugins": {
110
- "@release-it/conventional-changelog": {
111
- "preset": "angular",
112
- "infile": "CHANGELOG.md",
113
- "header": "# Changelog"
114
- }
110
+ "hooks": {
111
+ "after:bump": "npx auto-changelog -p --hide-credit"
115
112
  }
116
113
  },
117
114
  "jest": {
@@ -133,4 +130,4 @@
133
130
  ".ts"
134
131
  ]
135
132
  }
136
- }
133
+ }
package/src/types.ts CHANGED
@@ -79,7 +79,7 @@ export type ClusterPayload = {
79
79
  validators: ClusterValidator[];
80
80
 
81
81
  /** The cluster partial deposits in gwei or 32000000000. */
82
- deposit_amounts?: string[];
82
+ deposit_amounts?: string[] | null;
83
83
  };
84
84
 
85
85
  /**
@@ -113,9 +113,6 @@ export interface ClusterDefinition extends ClusterPayload {
113
113
  /** The number of distributed validators in the cluster. */
114
114
  num_validators: number;
115
115
 
116
- /** The cluster partial deposits in gwei or 32000000000. */
117
- deposit_amounts?: string[];
118
-
119
116
  /** The hash of the cluster definition. */
120
117
  definition_hash?: string;
121
118
  }
@@ -109,6 +109,18 @@ export const clusterLockHash = (clusterLock: ClusterLock): string => {
109
109
  }
110
110
 
111
111
  if (semver.eq(clusterLock.cluster_definition.version, 'v1.8.0')) {
112
+ if (
113
+ clusterLock.cluster_definition.deposit_amounts === null &&
114
+ clusterLock.distributed_validators.some(
115
+ distributedValidator =>
116
+ distributedValidator.partial_deposit_data?.length !== 1 ||
117
+ distributedValidator.partial_deposit_data[0].amount !== '32000000000',
118
+ )
119
+ ) {
120
+ throw new Error(
121
+ 'mismatch between deposit_amounts and partial_deposit_data fields',
122
+ );
123
+ }
112
124
  return hashClusterLockV1X8(clusterLock);
113
125
  }
114
126
 
@@ -137,11 +137,11 @@ export const hashClusterDefinitionV1X8 = (
137
137
  withdrawal_address: fromHexString(validator.withdrawal_address),
138
138
  };
139
139
  });
140
- val.deposit_amounts = (cluster.deposit_amounts as string[]).map(
141
- (amount: string) => {
140
+ if (cluster.deposit_amounts) {
141
+ val.deposit_amounts = cluster.deposit_amounts.map((amount: string) => {
142
142
  return parseInt(amount);
143
- },
144
- );
143
+ });
144
+ }
145
145
 
146
146
  if (!configOnly) {
147
147
  val.config_hash = fromHexString(cluster.config_hash);