@obolnetwork/obol-sdk 2.12.5 → 2.13.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.
@@ -186,7 +186,7 @@ var import_uuid = require("uuid");
186
186
  // package.json
187
187
  var package_default = {
188
188
  name: "@obolnetwork/obol-sdk",
189
- version: "2.12.5",
189
+ version: "2.13.0",
190
190
  description: "A package for creating Distributed Validators using the Obol API.",
191
191
  bugs: {
192
192
  url: "https://github.com/obolnetwork/obol-sdk/issues"
@@ -247,7 +247,8 @@ var package_default = {
247
247
  "@typescript-eslint/* stays at ^6.x \u2014 eslint-config-standard-with-typescript@43 requires plugin ^6; v8 causes peer conflict.",
248
248
  "uuid stays at ^9.x \u2014 v11+ sets type:module (ESM-only).",
249
249
  "viem override pins a single resolved version to prevent duplicates across @safe-global/protocol-kit.",
250
- "@noble/curves replaces @chainsafe/bls \u2014 pure-JS CJS+ESM, no native addon, same ETH2 BLS12-381 spec. See CHAINSAFE_MIGRATION_PLAN.md."
250
+ "@noble/curves replaces @chainsafe/bls \u2014 pure-JS CJS+ESM, no native addon, same ETH2 BLS12-381 spec. See CHAINSAFE_MIGRATION_PLAN.md.",
251
+ "@noble/curves is in devDependencies (not dependencies) because tsup bundles it inline via noExternal. Keeping it in dependencies caused consumers to install @noble/hashes@2.2.0 (major-version 2) which shadowed @noble/hashes@1.x used by ethereum-cryptography, @coinbase/wallet-sdk, etc., breaking their @noble/curves initialisation with 'anumber is not a function'."
251
252
  ],
252
253
  resolutions: {},
253
254
  overrides: {
@@ -255,7 +256,6 @@ var package_default = {
255
256
  },
256
257
  dependencies: {
257
258
  "@chainsafe/enr": "6.0.1",
258
- "@noble/curves": "2.2.0",
259
259
  "@chainsafe/ssz": "0.14.3",
260
260
  "@metamask/eth-sig-util": "8.2.0",
261
261
  "@safe-global/protocol-kit": "7.1.0",
@@ -270,6 +270,7 @@ var package_default = {
270
270
  uuid: "9.0.1"
271
271
  },
272
272
  devDependencies: {
273
+ "@noble/curves": "2.2.0",
273
274
  "@release-it/conventional-changelog": "11.0.0",
274
275
  "@types/elliptic": "6.4.18",
275
276
  "@types/jest": "29.5.14",
@@ -483,7 +484,7 @@ var signEnrPayload = (payload, chainId) => {
483
484
  };
484
485
  };
485
486
  var DKG_ALGORITHM = "default";
486
- var CONFIG_VERSION = "v1.10.0";
487
+ var CONFIG_VERSION = "v1.11.0";
487
488
  var SDK_VERSION = package_default.version;
488
489
  var DOMAIN_APPLICATION_BUILDER = "00000001";
489
490
  var DOMAIN_DEPOSIT = "03000000";
@@ -719,7 +720,7 @@ var Base = class {
719
720
  };
720
721
 
721
722
  // src/verification/common.ts
722
- var import_ssz7 = require("@chainsafe/ssz");
723
+ var import_ssz8 = require("@chainsafe/ssz");
723
724
  var import_elliptic = __toESM(require("elliptic"));
724
725
  var semver = __toESM(require("semver"));
725
726
 
@@ -783,10 +784,25 @@ var operatorContainerType = new import_ssz.ContainerType({
783
784
  config_signature: new import_ssz.ByteVectorType(65),
784
785
  enr_signature: new import_ssz.ByteVectorType(65)
785
786
  });
787
+ var k1SignatureListType = new import_ssz.ListCompositeType(
788
+ new import_ssz.ByteVectorType(65),
789
+ 32
790
+ );
791
+ var operatorContainerTypeV1X11 = new import_ssz.ContainerType({
792
+ address: new import_ssz.ByteVectorType(20),
793
+ enr: new import_ssz.ByteListType(1024),
794
+ // This needs to be dynamic, since ENRs do not have a fixed length.
795
+ config_signature: k1SignatureListType,
796
+ enr_signature: k1SignatureListType
797
+ });
786
798
  var creatorContainerType = new import_ssz.ContainerType({
787
799
  address: new import_ssz.ByteVectorType(20),
788
800
  config_signature: new import_ssz.ByteVectorType(65)
789
801
  });
802
+ var creatorContainerTypeV1X11 = new import_ssz.ContainerType({
803
+ address: new import_ssz.ByteVectorType(20),
804
+ config_signature: k1SignatureListType
805
+ });
790
806
  var validatorsContainerType = new import_ssz.ContainerType({
791
807
  fee_recipient_address: new import_ssz.ByteVectorType(20),
792
808
  withdrawal_address: new import_ssz.ByteVectorType(20)
@@ -794,9 +810,15 @@ var validatorsContainerType = new import_ssz.ContainerType({
794
810
  var newCreatorContainerType = (configOnly) => {
795
811
  return configOnly ? creatorAddressWrapperType : creatorContainerType;
796
812
  };
813
+ var newCreatorContainerTypeV1X11 = (configOnly) => {
814
+ return configOnly ? creatorAddressWrapperType : creatorContainerTypeV1X11;
815
+ };
797
816
  var newOperatorContainerType = (configOnly) => {
798
817
  return configOnly ? operatorAddressWrapperType : operatorContainerType;
799
818
  };
819
+ var newOperatorContainerTypeV1X11 = (configOnly) => {
820
+ return configOnly ? operatorAddressWrapperType : operatorContainerTypeV1X11;
821
+ };
800
822
  var depositDataContainer = new import_ssz.ContainerType({
801
823
  pubkey: new import_ssz.ByteVectorType(48),
802
824
  withdrawal_credentials: new import_ssz.ByteVectorType(32),
@@ -14612,6 +14634,165 @@ var hashClusterLockV1X10 = (cluster) => {
14612
14634
  };
14613
14635
  var verifyDVV1X10 = verifyDVV1X8;
14614
14636
 
14637
+ // src/verification/v1.11.0.ts
14638
+ var import_uint5 = require("@chainsafe/ssz/lib/type/uint.js");
14639
+ var import_ssz7 = require("@chainsafe/ssz");
14640
+ var splitK1SignatureList = (signature) => {
14641
+ const bytes = (0, import_ssz7.fromHexString)(signature);
14642
+ if (bytes.length === 0) return [];
14643
+ if (bytes.length % 65 !== 0) {
14644
+ throw new Error("Signature length must be a multiple of 65 bytes");
14645
+ }
14646
+ const chunks = [];
14647
+ for (let i = 0; i < bytes.length; i += 65) {
14648
+ chunks.push(bytes.slice(i, i + 65));
14649
+ }
14650
+ return chunks;
14651
+ };
14652
+ var clusterDefinitionContainerTypeV1X11 = (configOnly) => {
14653
+ let returnedContainerType = {
14654
+ uuid: new import_ssz7.ByteListType(64),
14655
+ name: new import_ssz7.ByteListType(256),
14656
+ version: new import_ssz7.ByteListType(16),
14657
+ timestamp: new import_ssz7.ByteListType(32),
14658
+ num_validators: new import_uint5.UintNumberType(8),
14659
+ threshold: new import_uint5.UintNumberType(8),
14660
+ dkg_algorithm: new import_ssz7.ByteListType(32),
14661
+ fork_version: new import_ssz7.ByteVectorType(4),
14662
+ operators: new import_ssz7.ListCompositeType(
14663
+ newOperatorContainerTypeV1X11(configOnly),
14664
+ 256
14665
+ ),
14666
+ creator: newCreatorContainerTypeV1X11(configOnly),
14667
+ validators: new import_ssz7.ListCompositeType(validatorsContainerType, 65536),
14668
+ deposit_amounts: new import_ssz7.ListBasicType(
14669
+ new import_uint5.UintNumberType(8),
14670
+ 256
14671
+ ),
14672
+ consensus_protocol: new import_ssz7.ByteListType(256),
14673
+ target_gas_limit: new import_uint5.UintNumberType(8),
14674
+ compounding: new import_ssz7.BooleanType()
14675
+ };
14676
+ if (!configOnly) {
14677
+ returnedContainerType = __spreadProps(__spreadValues({}, returnedContainerType), {
14678
+ config_hash: new import_ssz7.ByteVectorType(32)
14679
+ });
14680
+ }
14681
+ return new import_ssz7.ContainerType(returnedContainerType);
14682
+ };
14683
+ var hashClusterDefinitionV1X11 = (cluster, configOnly) => {
14684
+ const definitionType = clusterDefinitionContainerTypeV1X11(configOnly);
14685
+ const val = definitionType.defaultValue();
14686
+ val.uuid = strToUint8Array(cluster.uuid);
14687
+ val.name = strToUint8Array(cluster.name);
14688
+ val.version = strToUint8Array(cluster.version);
14689
+ val.timestamp = strToUint8Array(cluster.timestamp);
14690
+ val.num_validators = cluster.num_validators;
14691
+ val.threshold = cluster.threshold;
14692
+ val.dkg_algorithm = strToUint8Array(cluster.dkg_algorithm);
14693
+ val.fork_version = (0, import_ssz7.fromHexString)(cluster.fork_version);
14694
+ val.operators = cluster.operators.map((operator) => {
14695
+ return configOnly ? { address: (0, import_ssz7.fromHexString)(operator.address) } : {
14696
+ address: (0, import_ssz7.fromHexString)(operator.address),
14697
+ enr: strToUint8Array(operator.enr),
14698
+ config_signature: splitK1SignatureList(
14699
+ operator.config_signature
14700
+ ),
14701
+ enr_signature: splitK1SignatureList(operator.enr_signature)
14702
+ };
14703
+ });
14704
+ val.creator = configOnly ? { address: (0, import_ssz7.fromHexString)(cluster.creator.address) } : {
14705
+ address: (0, import_ssz7.fromHexString)(cluster.creator.address),
14706
+ config_signature: splitK1SignatureList(
14707
+ cluster.creator.config_signature
14708
+ )
14709
+ };
14710
+ val.validators = cluster.validators.map((validator) => {
14711
+ return {
14712
+ fee_recipient_address: (0, import_ssz7.fromHexString)(validator.fee_recipient_address),
14713
+ withdrawal_address: (0, import_ssz7.fromHexString)(validator.withdrawal_address)
14714
+ };
14715
+ });
14716
+ if (cluster.deposit_amounts) {
14717
+ val.deposit_amounts = cluster.deposit_amounts.map((amount) => {
14718
+ return parseInt(amount);
14719
+ });
14720
+ }
14721
+ if (cluster.consensus_protocol) {
14722
+ val.consensus_protocol = strToUint8Array(cluster.consensus_protocol);
14723
+ }
14724
+ if (cluster.target_gas_limit) {
14725
+ val.target_gas_limit = cluster.target_gas_limit;
14726
+ }
14727
+ if (cluster.compounding) {
14728
+ val.compounding = cluster.compounding;
14729
+ }
14730
+ if (!configOnly) {
14731
+ val.config_hash = (0, import_ssz7.fromHexString)(cluster.config_hash);
14732
+ }
14733
+ return val;
14734
+ };
14735
+ var dvContainerTypeV1X11 = new import_ssz7.ContainerType({
14736
+ distributed_public_key: new import_ssz7.ByteVectorType(48),
14737
+ public_shares: new import_ssz7.ListCompositeType(new import_ssz7.ByteVectorType(48), 256),
14738
+ partial_deposit_data: new import_ssz7.ListCompositeType(depositDataContainer, 256),
14739
+ builder_registration: builderRegistrationContainer
14740
+ });
14741
+ var clusterLockContainerTypeV1X11 = () => {
14742
+ return new import_ssz7.ContainerType({
14743
+ cluster_definition: clusterDefinitionContainerTypeV1X11(false),
14744
+ distributed_validators: new import_ssz7.ListCompositeType(dvContainerTypeV1X11, 65536)
14745
+ });
14746
+ };
14747
+ var hashClusterLockV1X11 = (cluster) => {
14748
+ const lockType = clusterLockContainerTypeV1X11();
14749
+ const val = lockType.defaultValue();
14750
+ val.cluster_definition = hashClusterDefinitionV1X11(
14751
+ cluster.cluster_definition,
14752
+ false
14753
+ );
14754
+ val.distributed_validators = cluster.distributed_validators.map(
14755
+ (dValidator) => {
14756
+ var _a6, _b2, _c, _d, _e;
14757
+ return {
14758
+ distributed_public_key: (0, import_ssz7.fromHexString)(
14759
+ dValidator.distributed_public_key
14760
+ ),
14761
+ public_shares: dValidator.public_shares.map(
14762
+ (publicShare) => (0, import_ssz7.fromHexString)(publicShare)
14763
+ ),
14764
+ partial_deposit_data: dValidator.partial_deposit_data.map((depositData) => {
14765
+ return {
14766
+ pubkey: (0, import_ssz7.fromHexString)(depositData.pubkey),
14767
+ withdrawal_credentials: (0, import_ssz7.fromHexString)(
14768
+ depositData.withdrawal_credentials
14769
+ ),
14770
+ amount: parseInt(depositData.amount),
14771
+ signature: (0, import_ssz7.fromHexString)(depositData.signature)
14772
+ };
14773
+ }),
14774
+ builder_registration: {
14775
+ message: {
14776
+ fee_recipient: (0, import_ssz7.fromHexString)(
14777
+ (_a6 = dValidator.builder_registration) == null ? void 0 : _a6.message.fee_recipient
14778
+ ),
14779
+ gas_limit: (_b2 = dValidator.builder_registration) == null ? void 0 : _b2.message.gas_limit,
14780
+ timestamp: (_c = dValidator.builder_registration) == null ? void 0 : _c.message.timestamp,
14781
+ pubkey: (0, import_ssz7.fromHexString)(
14782
+ (_d = dValidator.builder_registration) == null ? void 0 : _d.message.pubkey
14783
+ )
14784
+ },
14785
+ signature: (0, import_ssz7.fromHexString)(
14786
+ (_e = dValidator.builder_registration) == null ? void 0 : _e.signature
14787
+ )
14788
+ }
14789
+ };
14790
+ }
14791
+ );
14792
+ return "0x" + Buffer.from(lockType.hashTreeRoot(val).buffer).toString("hex");
14793
+ };
14794
+ var verifyDVV1X11 = verifyDVV1X8;
14795
+
14615
14796
  // src/verification/common.ts
14616
14797
  var clusterConfigOrDefinitionHash = (cluster, configOnly) => {
14617
14798
  let definitionType, val;
@@ -14636,6 +14817,11 @@ var clusterConfigOrDefinitionHash = (cluster, configOnly) => {
14636
14817
  const x = "0x" + Buffer.from(definitionType.hashTreeRoot(val).buffer).toString("hex");
14637
14818
  return x;
14638
14819
  }
14820
+ if (semver.eq(cluster.version, "v1.11.0")) {
14821
+ definitionType = clusterDefinitionContainerTypeV1X11(configOnly);
14822
+ val = hashClusterDefinitionV1X11(cluster, configOnly);
14823
+ return "0x" + Buffer.from(definitionType.hashTreeRoot(val).buffer).toString("hex");
14824
+ }
14639
14825
  throw new Error("unsupported version");
14640
14826
  };
14641
14827
  var clusterLockHash = (clusterLock) => {
@@ -14661,6 +14847,9 @@ var clusterLockHash = (clusterLock) => {
14661
14847
  if (semver.eq(clusterLock.cluster_definition.version, "v1.10.0")) {
14662
14848
  return hashClusterLockV1X10(clusterLock);
14663
14849
  }
14850
+ if (semver.eq(clusterLock.cluster_definition.version, "v1.11.0")) {
14851
+ return hashClusterLockV1X11(clusterLock);
14852
+ }
14664
14853
  throw new Error("unsupported version");
14665
14854
  };
14666
14855
  var validatePOSTConfigHashSigner = (address, signature, configHash, chainId, safeRpcUrl) => __async(null, null, function* () {
@@ -14760,8 +14949,8 @@ var computeSigningRoot = (sszObjectRoot, domain) => {
14760
14949
  };
14761
14950
  var computeDepositMsgRoot = (msg) => {
14762
14951
  const depositMsgVal = depositMessageType.defaultValue();
14763
- depositMsgVal.pubkey = (0, import_ssz7.fromHexString)(msg.pubkey);
14764
- depositMsgVal.withdrawal_credentials = (0, import_ssz7.fromHexString)(
14952
+ depositMsgVal.pubkey = (0, import_ssz8.fromHexString)(msg.pubkey);
14953
+ depositMsgVal.withdrawal_credentials = (0, import_ssz8.fromHexString)(
14765
14954
  msg.withdrawal_credentials
14766
14955
  );
14767
14956
  depositMsgVal.amount = parseInt(msg.amount);
@@ -14775,16 +14964,16 @@ var computeForkDataRoot = (currentVersion, genesisValidatorsRoot) => {
14775
14964
  };
14776
14965
  var computebuilderRegistrationMsgRoot = (msg) => {
14777
14966
  const builderRegistrationMsgVal = builderRegistrationMessageType.defaultValue();
14778
- builderRegistrationMsgVal.fee_recipient = (0, import_ssz7.fromHexString)(msg.fee_recipient);
14967
+ builderRegistrationMsgVal.fee_recipient = (0, import_ssz8.fromHexString)(msg.fee_recipient);
14779
14968
  builderRegistrationMsgVal.gas_limit = msg.gas_limit;
14780
14969
  builderRegistrationMsgVal.timestamp = msg.timestamp;
14781
- builderRegistrationMsgVal.pubkey = (0, import_ssz7.fromHexString)(msg.pubkey);
14970
+ builderRegistrationMsgVal.pubkey = (0, import_ssz8.fromHexString)(msg.pubkey);
14782
14971
  return Buffer.from(
14783
14972
  builderRegistrationMessageType.hashTreeRoot(builderRegistrationMsgVal).buffer
14784
14973
  );
14785
14974
  };
14786
- var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = (0, import_ssz7.fromHexString)(GENESIS_VALIDATOR_ROOT)) => {
14787
- const forkVersion = (0, import_ssz7.fromHexString)(
14975
+ var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = (0, import_ssz8.fromHexString)(GENESIS_VALIDATOR_ROOT)) => {
14976
+ const forkVersion = (0, import_ssz8.fromHexString)(
14788
14977
  lockForkVersion.substring(2, lockForkVersion.length)
14789
14978
  );
14790
14979
  const forkDataRoot = computeForkDataRoot(forkVersion, genesisValidatorsRoot);
@@ -14793,10 +14982,10 @@ var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = (0, im
14793
14982
  domain.set(forkDataRoot.subarray(0, 28), 4);
14794
14983
  return domain;
14795
14984
  };
14796
- var depositDomainForFork = (forkVersion) => computeDomain((0, import_ssz7.fromHexString)(DOMAIN_DEPOSIT), forkVersion);
14797
- var builderDomainForFork = (forkVersion) => computeDomain((0, import_ssz7.fromHexString)(DOMAIN_APPLICATION_BUILDER), forkVersion);
14985
+ var depositDomainForFork = (forkVersion) => computeDomain((0, import_ssz8.fromHexString)(DOMAIN_DEPOSIT), forkVersion);
14986
+ var builderDomainForFork = (forkVersion) => computeDomain((0, import_ssz8.fromHexString)(DOMAIN_APPLICATION_BUILDER), forkVersion);
14798
14987
  var validateDepositDataStructure = (distributedPublicKey, depositData, withdrawalAddress, forkVersion, compounding, precomputedDepositDomain) => {
14799
- const depositDomain = precomputedDepositDomain != null ? precomputedDepositDomain : computeDomain((0, import_ssz7.fromHexString)(DOMAIN_DEPOSIT), forkVersion);
14988
+ const depositDomain = precomputedDepositDomain != null ? precomputedDepositDomain : computeDomain((0, import_ssz8.fromHexString)(DOMAIN_DEPOSIT), forkVersion);
14800
14989
  const withdrawalPrefix = compounding ? "0x02" : "0x01";
14801
14990
  const expectedWithdrawalCredentials = withdrawalPrefix + "0".repeat(22) + withdrawalAddress.toLowerCase().slice(2);
14802
14991
  if (expectedWithdrawalCredentials !== depositData.withdrawal_credentials) {
@@ -14823,9 +15012,9 @@ var depositBlsCheck = (distributedPublicKey, depositData, withdrawalAddress, for
14823
15012
  );
14824
15013
  if (!valid || !depositData.signature || !depositData.pubkey) return null;
14825
15014
  return {
14826
- pubkey: (0, import_ssz7.fromHexString)(depositData.pubkey),
15015
+ pubkey: (0, import_ssz8.fromHexString)(depositData.pubkey),
14827
15016
  message: message2,
14828
- signature: (0, import_ssz7.fromHexString)(depositData.signature)
15017
+ signature: (0, import_ssz8.fromHexString)(depositData.signature)
14829
15018
  };
14830
15019
  };
14831
15020
  var verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, forkVersion, compounding) => {
@@ -14840,15 +15029,15 @@ var verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, f
14840
15029
  return { isValidDepositData: false, depositDataMsg: message2 };
14841
15030
  }
14842
15031
  const isValidDepositData = blsVerify(
14843
- (0, import_ssz7.fromHexString)(depositData.pubkey),
15032
+ (0, import_ssz8.fromHexString)(depositData.pubkey),
14844
15033
  message2,
14845
- (0, import_ssz7.fromHexString)(depositData.signature)
15034
+ (0, import_ssz8.fromHexString)(depositData.signature)
14846
15035
  );
14847
15036
  return { isValidDepositData, depositDataMsg: message2 };
14848
15037
  };
14849
15038
  var verifyBuilderRegistration = (validator, feeRecipientAddress, forkVersion, precomputedBuilderDomain) => {
14850
15039
  var _a6;
14851
- const builderDomain = precomputedBuilderDomain != null ? precomputedBuilderDomain : computeDomain((0, import_ssz7.fromHexString)(DOMAIN_APPLICATION_BUILDER), forkVersion);
15040
+ const builderDomain = precomputedBuilderDomain != null ? precomputedBuilderDomain : computeDomain((0, import_ssz8.fromHexString)(DOMAIN_APPLICATION_BUILDER), forkVersion);
14852
15041
  if (validator.distributed_public_key !== ((_a6 = validator.builder_registration) == null ? void 0 : _a6.message.pubkey)) {
14853
15042
  return {
14854
15043
  isValidBuilderRegistration: false,
@@ -14884,9 +15073,9 @@ var builderBlsCheck = (validator, feeRecipientAddress, forkVersion, precomputedB
14884
15073
  const sig = (_a6 = validator.builder_registration) == null ? void 0 : _a6.signature;
14885
15074
  if (!isValidBuilderRegistration || !sig) return null;
14886
15075
  return {
14887
- pubkey: (0, import_ssz7.fromHexString)(validator.distributed_public_key),
15076
+ pubkey: (0, import_ssz8.fromHexString)(validator.distributed_public_key),
14888
15077
  message: builderRegistrationMsg,
14889
- signature: (0, import_ssz7.fromHexString)(sig)
15078
+ signature: (0, import_ssz8.fromHexString)(sig)
14890
15079
  };
14891
15080
  };
14892
15081
  var verifyNodeSignatures = (clusterLock) => {
@@ -14928,6 +15117,9 @@ var verifyLockData = (clusterLock) => __async(null, null, function* () {
14928
15117
  if (semver.eq(clusterLock.cluster_definition.version, "v1.10.0")) {
14929
15118
  return yield verifyDVV1X10(clusterLock);
14930
15119
  }
15120
+ if (semver.eq(clusterLock.cluster_definition.version, "v1.11.0")) {
15121
+ return yield verifyDVV1X11(clusterLock);
15122
+ }
14931
15123
  return false;
14932
15124
  });
14933
15125
  var hasUniqueDistributedKeys = (clusterLock) => {
@@ -18627,7 +18819,7 @@ var Incentives = class {
18627
18819
 
18628
18820
  // src/exits/exit.ts
18629
18821
  var elliptic2 = __toESM(require("elliptic"));
18630
- var import_ssz9 = require("@chainsafe/ssz");
18822
+ var import_ssz10 = require("@chainsafe/ssz");
18631
18823
 
18632
18824
  // src/exits/ethUtils.ts
18633
18825
  function getCapellaFork(fork_version) {
@@ -18664,15 +18856,15 @@ function getGenesisValidatorsRoot(beaconNodeApiUrl) {
18664
18856
  }
18665
18857
 
18666
18858
  // src/exits/verificationHelpers.ts
18667
- var import_ssz8 = require("@chainsafe/ssz");
18859
+ var import_ssz9 = require("@chainsafe/ssz");
18668
18860
  var GENESIS_VALIDATOR_ROOT_HEX_STRING = "0x0000000000000000000000000000000000000000000000000000000000000000";
18669
- var ForkDataType = new import_ssz8.ContainerType({
18670
- currentVersion: new import_ssz8.ByteVectorType(4),
18671
- genesisValidatorsRoot: new import_ssz8.ByteVectorType(32)
18861
+ var ForkDataType = new import_ssz9.ContainerType({
18862
+ currentVersion: new import_ssz9.ByteVectorType(4),
18863
+ genesisValidatorsRoot: new import_ssz9.ByteVectorType(32)
18672
18864
  });
18673
- var SigningRootType = new import_ssz8.ContainerType({
18674
- objectRoot: new import_ssz8.ByteVectorType(32),
18675
- domain: new import_ssz8.ByteVectorType(32)
18865
+ var SigningRootType = new import_ssz9.ContainerType({
18866
+ objectRoot: new import_ssz9.ByteVectorType(32),
18867
+ domain: new import_ssz9.ByteVectorType(32)
18676
18868
  });
18677
18869
  function computeForkDataRoot2(currentVersion, genesisValidatorsRoot) {
18678
18870
  const forkDataVal = ForkDataType.defaultValue();
@@ -18681,7 +18873,7 @@ function computeForkDataRoot2(currentVersion, genesisValidatorsRoot) {
18681
18873
  return Buffer.from(ForkDataType.hashTreeRoot(forkDataVal).buffer);
18682
18874
  }
18683
18875
  function computeDomain2(domainType, forkVersionString, genesisValidatorsRootOverride) {
18684
- const forkVersionBytes = (0, import_ssz8.fromHexString)(
18876
+ const forkVersionBytes = (0, import_ssz9.fromHexString)(
18685
18877
  forkVersionString.substring(2, forkVersionString.length)
18686
18878
  );
18687
18879
  if (forkVersionBytes.length !== 4) {
@@ -18690,7 +18882,7 @@ function computeDomain2(domainType, forkVersionString, genesisValidatorsRootOver
18690
18882
  if (domainType.length !== 4) {
18691
18883
  throw new Error("Domain type must be 4 bytes");
18692
18884
  }
18693
- const actualGenesisValidatorsRoot = genesisValidatorsRootOverride != null ? genesisValidatorsRootOverride : (0, import_ssz8.fromHexString)(GENESIS_VALIDATOR_ROOT_HEX_STRING.substring(2));
18885
+ const actualGenesisValidatorsRoot = genesisValidatorsRootOverride != null ? genesisValidatorsRootOverride : (0, import_ssz9.fromHexString)(GENESIS_VALIDATOR_ROOT_HEX_STRING.substring(2));
18694
18886
  if (actualGenesisValidatorsRoot.length !== 32) {
18695
18887
  throw new Error("genesisValidatorsRoot must be 32 bytes");
18696
18888
  }
@@ -18722,25 +18914,25 @@ function signingRoot2(domain, messageBuffer) {
18722
18914
 
18723
18915
  // src/exits/exit.ts
18724
18916
  var DOMAIN_VOLUNTARY_EXIT = "0x04000000";
18725
- var SSZExitMessageType = new import_ssz9.ContainerType({
18726
- epoch: new import_ssz9.UintNumberType(8),
18727
- validator_index: new import_ssz9.UintNumberType(8)
18917
+ var SSZExitMessageType = new import_ssz10.ContainerType({
18918
+ epoch: new import_ssz10.UintNumberType(8),
18919
+ validator_index: new import_ssz10.UintNumberType(8)
18728
18920
  });
18729
- var SSZPartialExitsPayloadType = new import_ssz9.ContainerType({
18730
- partial_exits: new import_ssz9.ListCompositeType(
18731
- new import_ssz9.ContainerType({
18732
- public_key: new import_ssz9.ByteVectorType(48),
18733
- signed_exit_message: new import_ssz9.ContainerType({
18734
- message: new import_ssz9.ContainerType({
18735
- epoch: new import_ssz9.UintNumberType(8),
18736
- validator_index: new import_ssz9.UintNumberType(8)
18921
+ var SSZPartialExitsPayloadType = new import_ssz10.ContainerType({
18922
+ partial_exits: new import_ssz10.ListCompositeType(
18923
+ new import_ssz10.ContainerType({
18924
+ public_key: new import_ssz10.ByteVectorType(48),
18925
+ signed_exit_message: new import_ssz10.ContainerType({
18926
+ message: new import_ssz10.ContainerType({
18927
+ epoch: new import_ssz10.UintNumberType(8),
18928
+ validator_index: new import_ssz10.UintNumberType(8)
18737
18929
  }),
18738
- signature: new import_ssz9.ByteVectorType(96)
18930
+ signature: new import_ssz10.ByteVectorType(96)
18739
18931
  })
18740
18932
  }),
18741
18933
  65536
18742
18934
  ),
18743
- share_idx: new import_ssz9.UintNumberType(8)
18935
+ share_idx: new import_ssz10.UintNumberType(8)
18744
18936
  });
18745
18937
  var Exit = class _Exit {
18746
18938
  /**
@@ -18783,7 +18975,7 @@ var Exit = class _Exit {
18783
18975
  static computeExitPayloadRoot(exits) {
18784
18976
  const sszValue = SSZPartialExitsPayloadType.defaultValue();
18785
18977
  sszValue.partial_exits = exits.partial_exits.map((pe) => ({
18786
- public_key: (0, import_ssz9.fromHexString)(pe.public_key),
18978
+ public_key: (0, import_ssz10.fromHexString)(pe.public_key),
18787
18979
  signed_exit_message: {
18788
18980
  message: {
18789
18981
  epoch: _Exit.safeParseInt(pe.signed_exit_message.message.epoch),
@@ -18791,7 +18983,7 @@ var Exit = class _Exit {
18791
18983
  pe.signed_exit_message.message.validator_index
18792
18984
  )
18793
18985
  },
18794
- signature: (0, import_ssz9.fromHexString)(pe.signed_exit_message.signature)
18986
+ signature: (0, import_ssz10.fromHexString)(pe.signed_exit_message.signature)
18795
18987
  }
18796
18988
  }));
18797
18989
  sszValue.share_idx = exits.share_idx;
@@ -18841,18 +19033,18 @@ var Exit = class _Exit {
18841
19033
  signedExitMessage.message
18842
19034
  );
18843
19035
  const exitDomain = computeDomain2(
18844
- (0, import_ssz9.fromHexString)(DOMAIN_VOLUNTARY_EXIT),
19036
+ (0, import_ssz10.fromHexString)(DOMAIN_VOLUNTARY_EXIT),
18845
19037
  capellaForkVersionString,
18846
- (0, import_ssz9.fromHexString)(genesisValidatorsRootString)
19038
+ (0, import_ssz10.fromHexString)(genesisValidatorsRootString)
18847
19039
  );
18848
19040
  const messageSigningRoot = signingRoot2(
18849
19041
  exitDomain,
18850
19042
  partialExitMessageBuffer
18851
19043
  );
18852
19044
  return blsVerify(
18853
- (0, import_ssz9.fromHexString)(publicShareKey),
19045
+ (0, import_ssz10.fromHexString)(publicShareKey),
18854
19046
  messageSigningRoot,
18855
- (0, import_ssz9.fromHexString)(signedExitMessage.signature)
19047
+ (0, import_ssz10.fromHexString)(signedExitMessage.signature)
18856
19048
  );
18857
19049
  });
18858
19050
  }
@@ -19155,7 +19347,7 @@ var Exit = class _Exit {
19155
19347
  );
19156
19348
  }
19157
19349
  try {
19158
- const sigBytes = (0, import_ssz9.fromHexString)(cleanSigStr);
19350
+ const sigBytes = (0, import_ssz10.fromHexString)(cleanSigStr);
19159
19351
  const sigIdx = parseInt(sigIdxStr, 10);
19160
19352
  signaturesByIndex.set(sigIdx + 1, sigBytes);
19161
19353
  } catch (err) {
@@ -20389,7 +20581,7 @@ var Client = class extends Base {
20389
20581
  * @example
20390
20582
  * ```typescript
20391
20583
  * const updatedDef = await client.acceptClusterDefinition(
20392
- * { enr: "enr:-LK4Q...", version: "v1.10.0" },
20584
+ * { enr: "enr:-LK4Q...", version: "v1.11.0" },
20393
20585
  * configHash,
20394
20586
  * );
20395
20587
  * ```