@obolnetwork/obol-sdk 2.12.6 → 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.
- package/dist/browser/src/index.js +278 -76
- package/dist/browser/src/index.js.map +1 -1
- package/dist/cjs/src/index.js +241 -50
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/verification/clusterLockValidationWorker.js +207 -16
- package/dist/cjs/src/verification/clusterLockValidationWorker.js.map +1 -1
- package/dist/esm/src/{chunk-GLSVKGK3.js → chunk-EITEAAK3.js} +244 -42
- package/dist/esm/src/chunk-EITEAAK3.js.map +1 -0
- package/dist/esm/src/index.js +2 -2
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/verification/clusterLockValidationWorker.js +1 -1
- package/dist/types/src/constants.d.ts +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/verification/sszTypes.d.ts +14 -1
- package/dist/types/src/verification/v1.11.0.d.ts +29 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/esm/src/chunk-GLSVKGK3.js.map +0 -1
package/dist/cjs/src/index.js
CHANGED
|
@@ -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.
|
|
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"
|
|
@@ -484,7 +484,7 @@ var signEnrPayload = (payload, chainId) => {
|
|
|
484
484
|
};
|
|
485
485
|
};
|
|
486
486
|
var DKG_ALGORITHM = "default";
|
|
487
|
-
var CONFIG_VERSION = "v1.
|
|
487
|
+
var CONFIG_VERSION = "v1.11.0";
|
|
488
488
|
var SDK_VERSION = package_default.version;
|
|
489
489
|
var DOMAIN_APPLICATION_BUILDER = "00000001";
|
|
490
490
|
var DOMAIN_DEPOSIT = "03000000";
|
|
@@ -720,7 +720,7 @@ var Base = class {
|
|
|
720
720
|
};
|
|
721
721
|
|
|
722
722
|
// src/verification/common.ts
|
|
723
|
-
var
|
|
723
|
+
var import_ssz8 = require("@chainsafe/ssz");
|
|
724
724
|
var import_elliptic = __toESM(require("elliptic"));
|
|
725
725
|
var semver = __toESM(require("semver"));
|
|
726
726
|
|
|
@@ -784,10 +784,25 @@ var operatorContainerType = new import_ssz.ContainerType({
|
|
|
784
784
|
config_signature: new import_ssz.ByteVectorType(65),
|
|
785
785
|
enr_signature: new import_ssz.ByteVectorType(65)
|
|
786
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
|
+
});
|
|
787
798
|
var creatorContainerType = new import_ssz.ContainerType({
|
|
788
799
|
address: new import_ssz.ByteVectorType(20),
|
|
789
800
|
config_signature: new import_ssz.ByteVectorType(65)
|
|
790
801
|
});
|
|
802
|
+
var creatorContainerTypeV1X11 = new import_ssz.ContainerType({
|
|
803
|
+
address: new import_ssz.ByteVectorType(20),
|
|
804
|
+
config_signature: k1SignatureListType
|
|
805
|
+
});
|
|
791
806
|
var validatorsContainerType = new import_ssz.ContainerType({
|
|
792
807
|
fee_recipient_address: new import_ssz.ByteVectorType(20),
|
|
793
808
|
withdrawal_address: new import_ssz.ByteVectorType(20)
|
|
@@ -795,9 +810,15 @@ var validatorsContainerType = new import_ssz.ContainerType({
|
|
|
795
810
|
var newCreatorContainerType = (configOnly) => {
|
|
796
811
|
return configOnly ? creatorAddressWrapperType : creatorContainerType;
|
|
797
812
|
};
|
|
813
|
+
var newCreatorContainerTypeV1X11 = (configOnly) => {
|
|
814
|
+
return configOnly ? creatorAddressWrapperType : creatorContainerTypeV1X11;
|
|
815
|
+
};
|
|
798
816
|
var newOperatorContainerType = (configOnly) => {
|
|
799
817
|
return configOnly ? operatorAddressWrapperType : operatorContainerType;
|
|
800
818
|
};
|
|
819
|
+
var newOperatorContainerTypeV1X11 = (configOnly) => {
|
|
820
|
+
return configOnly ? operatorAddressWrapperType : operatorContainerTypeV1X11;
|
|
821
|
+
};
|
|
801
822
|
var depositDataContainer = new import_ssz.ContainerType({
|
|
802
823
|
pubkey: new import_ssz.ByteVectorType(48),
|
|
803
824
|
withdrawal_credentials: new import_ssz.ByteVectorType(32),
|
|
@@ -14613,6 +14634,165 @@ var hashClusterLockV1X10 = (cluster) => {
|
|
|
14613
14634
|
};
|
|
14614
14635
|
var verifyDVV1X10 = verifyDVV1X8;
|
|
14615
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
|
+
|
|
14616
14796
|
// src/verification/common.ts
|
|
14617
14797
|
var clusterConfigOrDefinitionHash = (cluster, configOnly) => {
|
|
14618
14798
|
let definitionType, val;
|
|
@@ -14637,6 +14817,11 @@ var clusterConfigOrDefinitionHash = (cluster, configOnly) => {
|
|
|
14637
14817
|
const x = "0x" + Buffer.from(definitionType.hashTreeRoot(val).buffer).toString("hex");
|
|
14638
14818
|
return x;
|
|
14639
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
|
+
}
|
|
14640
14825
|
throw new Error("unsupported version");
|
|
14641
14826
|
};
|
|
14642
14827
|
var clusterLockHash = (clusterLock) => {
|
|
@@ -14662,6 +14847,9 @@ var clusterLockHash = (clusterLock) => {
|
|
|
14662
14847
|
if (semver.eq(clusterLock.cluster_definition.version, "v1.10.0")) {
|
|
14663
14848
|
return hashClusterLockV1X10(clusterLock);
|
|
14664
14849
|
}
|
|
14850
|
+
if (semver.eq(clusterLock.cluster_definition.version, "v1.11.0")) {
|
|
14851
|
+
return hashClusterLockV1X11(clusterLock);
|
|
14852
|
+
}
|
|
14665
14853
|
throw new Error("unsupported version");
|
|
14666
14854
|
};
|
|
14667
14855
|
var validatePOSTConfigHashSigner = (address, signature, configHash, chainId, safeRpcUrl) => __async(null, null, function* () {
|
|
@@ -14761,8 +14949,8 @@ var computeSigningRoot = (sszObjectRoot, domain) => {
|
|
|
14761
14949
|
};
|
|
14762
14950
|
var computeDepositMsgRoot = (msg) => {
|
|
14763
14951
|
const depositMsgVal = depositMessageType.defaultValue();
|
|
14764
|
-
depositMsgVal.pubkey = (0,
|
|
14765
|
-
depositMsgVal.withdrawal_credentials = (0,
|
|
14952
|
+
depositMsgVal.pubkey = (0, import_ssz8.fromHexString)(msg.pubkey);
|
|
14953
|
+
depositMsgVal.withdrawal_credentials = (0, import_ssz8.fromHexString)(
|
|
14766
14954
|
msg.withdrawal_credentials
|
|
14767
14955
|
);
|
|
14768
14956
|
depositMsgVal.amount = parseInt(msg.amount);
|
|
@@ -14776,16 +14964,16 @@ var computeForkDataRoot = (currentVersion, genesisValidatorsRoot) => {
|
|
|
14776
14964
|
};
|
|
14777
14965
|
var computebuilderRegistrationMsgRoot = (msg) => {
|
|
14778
14966
|
const builderRegistrationMsgVal = builderRegistrationMessageType.defaultValue();
|
|
14779
|
-
builderRegistrationMsgVal.fee_recipient = (0,
|
|
14967
|
+
builderRegistrationMsgVal.fee_recipient = (0, import_ssz8.fromHexString)(msg.fee_recipient);
|
|
14780
14968
|
builderRegistrationMsgVal.gas_limit = msg.gas_limit;
|
|
14781
14969
|
builderRegistrationMsgVal.timestamp = msg.timestamp;
|
|
14782
|
-
builderRegistrationMsgVal.pubkey = (0,
|
|
14970
|
+
builderRegistrationMsgVal.pubkey = (0, import_ssz8.fromHexString)(msg.pubkey);
|
|
14783
14971
|
return Buffer.from(
|
|
14784
14972
|
builderRegistrationMessageType.hashTreeRoot(builderRegistrationMsgVal).buffer
|
|
14785
14973
|
);
|
|
14786
14974
|
};
|
|
14787
|
-
var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = (0,
|
|
14788
|
-
const forkVersion = (0,
|
|
14975
|
+
var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = (0, import_ssz8.fromHexString)(GENESIS_VALIDATOR_ROOT)) => {
|
|
14976
|
+
const forkVersion = (0, import_ssz8.fromHexString)(
|
|
14789
14977
|
lockForkVersion.substring(2, lockForkVersion.length)
|
|
14790
14978
|
);
|
|
14791
14979
|
const forkDataRoot = computeForkDataRoot(forkVersion, genesisValidatorsRoot);
|
|
@@ -14794,10 +14982,10 @@ var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = (0, im
|
|
|
14794
14982
|
domain.set(forkDataRoot.subarray(0, 28), 4);
|
|
14795
14983
|
return domain;
|
|
14796
14984
|
};
|
|
14797
|
-
var depositDomainForFork = (forkVersion) => computeDomain((0,
|
|
14798
|
-
var builderDomainForFork = (forkVersion) => computeDomain((0,
|
|
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);
|
|
14799
14987
|
var validateDepositDataStructure = (distributedPublicKey, depositData, withdrawalAddress, forkVersion, compounding, precomputedDepositDomain) => {
|
|
14800
|
-
const depositDomain = precomputedDepositDomain != null ? precomputedDepositDomain : computeDomain((0,
|
|
14988
|
+
const depositDomain = precomputedDepositDomain != null ? precomputedDepositDomain : computeDomain((0, import_ssz8.fromHexString)(DOMAIN_DEPOSIT), forkVersion);
|
|
14801
14989
|
const withdrawalPrefix = compounding ? "0x02" : "0x01";
|
|
14802
14990
|
const expectedWithdrawalCredentials = withdrawalPrefix + "0".repeat(22) + withdrawalAddress.toLowerCase().slice(2);
|
|
14803
14991
|
if (expectedWithdrawalCredentials !== depositData.withdrawal_credentials) {
|
|
@@ -14824,9 +15012,9 @@ var depositBlsCheck = (distributedPublicKey, depositData, withdrawalAddress, for
|
|
|
14824
15012
|
);
|
|
14825
15013
|
if (!valid || !depositData.signature || !depositData.pubkey) return null;
|
|
14826
15014
|
return {
|
|
14827
|
-
pubkey: (0,
|
|
15015
|
+
pubkey: (0, import_ssz8.fromHexString)(depositData.pubkey),
|
|
14828
15016
|
message: message2,
|
|
14829
|
-
signature: (0,
|
|
15017
|
+
signature: (0, import_ssz8.fromHexString)(depositData.signature)
|
|
14830
15018
|
};
|
|
14831
15019
|
};
|
|
14832
15020
|
var verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, forkVersion, compounding) => {
|
|
@@ -14841,15 +15029,15 @@ var verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, f
|
|
|
14841
15029
|
return { isValidDepositData: false, depositDataMsg: message2 };
|
|
14842
15030
|
}
|
|
14843
15031
|
const isValidDepositData = blsVerify(
|
|
14844
|
-
(0,
|
|
15032
|
+
(0, import_ssz8.fromHexString)(depositData.pubkey),
|
|
14845
15033
|
message2,
|
|
14846
|
-
(0,
|
|
15034
|
+
(0, import_ssz8.fromHexString)(depositData.signature)
|
|
14847
15035
|
);
|
|
14848
15036
|
return { isValidDepositData, depositDataMsg: message2 };
|
|
14849
15037
|
};
|
|
14850
15038
|
var verifyBuilderRegistration = (validator, feeRecipientAddress, forkVersion, precomputedBuilderDomain) => {
|
|
14851
15039
|
var _a6;
|
|
14852
|
-
const builderDomain = precomputedBuilderDomain != null ? precomputedBuilderDomain : computeDomain((0,
|
|
15040
|
+
const builderDomain = precomputedBuilderDomain != null ? precomputedBuilderDomain : computeDomain((0, import_ssz8.fromHexString)(DOMAIN_APPLICATION_BUILDER), forkVersion);
|
|
14853
15041
|
if (validator.distributed_public_key !== ((_a6 = validator.builder_registration) == null ? void 0 : _a6.message.pubkey)) {
|
|
14854
15042
|
return {
|
|
14855
15043
|
isValidBuilderRegistration: false,
|
|
@@ -14885,9 +15073,9 @@ var builderBlsCheck = (validator, feeRecipientAddress, forkVersion, precomputedB
|
|
|
14885
15073
|
const sig = (_a6 = validator.builder_registration) == null ? void 0 : _a6.signature;
|
|
14886
15074
|
if (!isValidBuilderRegistration || !sig) return null;
|
|
14887
15075
|
return {
|
|
14888
|
-
pubkey: (0,
|
|
15076
|
+
pubkey: (0, import_ssz8.fromHexString)(validator.distributed_public_key),
|
|
14889
15077
|
message: builderRegistrationMsg,
|
|
14890
|
-
signature: (0,
|
|
15078
|
+
signature: (0, import_ssz8.fromHexString)(sig)
|
|
14891
15079
|
};
|
|
14892
15080
|
};
|
|
14893
15081
|
var verifyNodeSignatures = (clusterLock) => {
|
|
@@ -14929,6 +15117,9 @@ var verifyLockData = (clusterLock) => __async(null, null, function* () {
|
|
|
14929
15117
|
if (semver.eq(clusterLock.cluster_definition.version, "v1.10.0")) {
|
|
14930
15118
|
return yield verifyDVV1X10(clusterLock);
|
|
14931
15119
|
}
|
|
15120
|
+
if (semver.eq(clusterLock.cluster_definition.version, "v1.11.0")) {
|
|
15121
|
+
return yield verifyDVV1X11(clusterLock);
|
|
15122
|
+
}
|
|
14932
15123
|
return false;
|
|
14933
15124
|
});
|
|
14934
15125
|
var hasUniqueDistributedKeys = (clusterLock) => {
|
|
@@ -18628,7 +18819,7 @@ var Incentives = class {
|
|
|
18628
18819
|
|
|
18629
18820
|
// src/exits/exit.ts
|
|
18630
18821
|
var elliptic2 = __toESM(require("elliptic"));
|
|
18631
|
-
var
|
|
18822
|
+
var import_ssz10 = require("@chainsafe/ssz");
|
|
18632
18823
|
|
|
18633
18824
|
// src/exits/ethUtils.ts
|
|
18634
18825
|
function getCapellaFork(fork_version) {
|
|
@@ -18665,15 +18856,15 @@ function getGenesisValidatorsRoot(beaconNodeApiUrl) {
|
|
|
18665
18856
|
}
|
|
18666
18857
|
|
|
18667
18858
|
// src/exits/verificationHelpers.ts
|
|
18668
|
-
var
|
|
18859
|
+
var import_ssz9 = require("@chainsafe/ssz");
|
|
18669
18860
|
var GENESIS_VALIDATOR_ROOT_HEX_STRING = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
18670
|
-
var ForkDataType = new
|
|
18671
|
-
currentVersion: new
|
|
18672
|
-
genesisValidatorsRoot: new
|
|
18861
|
+
var ForkDataType = new import_ssz9.ContainerType({
|
|
18862
|
+
currentVersion: new import_ssz9.ByteVectorType(4),
|
|
18863
|
+
genesisValidatorsRoot: new import_ssz9.ByteVectorType(32)
|
|
18673
18864
|
});
|
|
18674
|
-
var SigningRootType = new
|
|
18675
|
-
objectRoot: new
|
|
18676
|
-
domain: new
|
|
18865
|
+
var SigningRootType = new import_ssz9.ContainerType({
|
|
18866
|
+
objectRoot: new import_ssz9.ByteVectorType(32),
|
|
18867
|
+
domain: new import_ssz9.ByteVectorType(32)
|
|
18677
18868
|
});
|
|
18678
18869
|
function computeForkDataRoot2(currentVersion, genesisValidatorsRoot) {
|
|
18679
18870
|
const forkDataVal = ForkDataType.defaultValue();
|
|
@@ -18682,7 +18873,7 @@ function computeForkDataRoot2(currentVersion, genesisValidatorsRoot) {
|
|
|
18682
18873
|
return Buffer.from(ForkDataType.hashTreeRoot(forkDataVal).buffer);
|
|
18683
18874
|
}
|
|
18684
18875
|
function computeDomain2(domainType, forkVersionString, genesisValidatorsRootOverride) {
|
|
18685
|
-
const forkVersionBytes = (0,
|
|
18876
|
+
const forkVersionBytes = (0, import_ssz9.fromHexString)(
|
|
18686
18877
|
forkVersionString.substring(2, forkVersionString.length)
|
|
18687
18878
|
);
|
|
18688
18879
|
if (forkVersionBytes.length !== 4) {
|
|
@@ -18691,7 +18882,7 @@ function computeDomain2(domainType, forkVersionString, genesisValidatorsRootOver
|
|
|
18691
18882
|
if (domainType.length !== 4) {
|
|
18692
18883
|
throw new Error("Domain type must be 4 bytes");
|
|
18693
18884
|
}
|
|
18694
|
-
const actualGenesisValidatorsRoot = genesisValidatorsRootOverride != null ? genesisValidatorsRootOverride : (0,
|
|
18885
|
+
const actualGenesisValidatorsRoot = genesisValidatorsRootOverride != null ? genesisValidatorsRootOverride : (0, import_ssz9.fromHexString)(GENESIS_VALIDATOR_ROOT_HEX_STRING.substring(2));
|
|
18695
18886
|
if (actualGenesisValidatorsRoot.length !== 32) {
|
|
18696
18887
|
throw new Error("genesisValidatorsRoot must be 32 bytes");
|
|
18697
18888
|
}
|
|
@@ -18723,25 +18914,25 @@ function signingRoot2(domain, messageBuffer) {
|
|
|
18723
18914
|
|
|
18724
18915
|
// src/exits/exit.ts
|
|
18725
18916
|
var DOMAIN_VOLUNTARY_EXIT = "0x04000000";
|
|
18726
|
-
var SSZExitMessageType = new
|
|
18727
|
-
epoch: new
|
|
18728
|
-
validator_index: new
|
|
18917
|
+
var SSZExitMessageType = new import_ssz10.ContainerType({
|
|
18918
|
+
epoch: new import_ssz10.UintNumberType(8),
|
|
18919
|
+
validator_index: new import_ssz10.UintNumberType(8)
|
|
18729
18920
|
});
|
|
18730
|
-
var SSZPartialExitsPayloadType = new
|
|
18731
|
-
partial_exits: new
|
|
18732
|
-
new
|
|
18733
|
-
public_key: new
|
|
18734
|
-
signed_exit_message: new
|
|
18735
|
-
message: new
|
|
18736
|
-
epoch: new
|
|
18737
|
-
validator_index: new
|
|
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)
|
|
18738
18929
|
}),
|
|
18739
|
-
signature: new
|
|
18930
|
+
signature: new import_ssz10.ByteVectorType(96)
|
|
18740
18931
|
})
|
|
18741
18932
|
}),
|
|
18742
18933
|
65536
|
|
18743
18934
|
),
|
|
18744
|
-
share_idx: new
|
|
18935
|
+
share_idx: new import_ssz10.UintNumberType(8)
|
|
18745
18936
|
});
|
|
18746
18937
|
var Exit = class _Exit {
|
|
18747
18938
|
/**
|
|
@@ -18784,7 +18975,7 @@ var Exit = class _Exit {
|
|
|
18784
18975
|
static computeExitPayloadRoot(exits) {
|
|
18785
18976
|
const sszValue = SSZPartialExitsPayloadType.defaultValue();
|
|
18786
18977
|
sszValue.partial_exits = exits.partial_exits.map((pe) => ({
|
|
18787
|
-
public_key: (0,
|
|
18978
|
+
public_key: (0, import_ssz10.fromHexString)(pe.public_key),
|
|
18788
18979
|
signed_exit_message: {
|
|
18789
18980
|
message: {
|
|
18790
18981
|
epoch: _Exit.safeParseInt(pe.signed_exit_message.message.epoch),
|
|
@@ -18792,7 +18983,7 @@ var Exit = class _Exit {
|
|
|
18792
18983
|
pe.signed_exit_message.message.validator_index
|
|
18793
18984
|
)
|
|
18794
18985
|
},
|
|
18795
|
-
signature: (0,
|
|
18986
|
+
signature: (0, import_ssz10.fromHexString)(pe.signed_exit_message.signature)
|
|
18796
18987
|
}
|
|
18797
18988
|
}));
|
|
18798
18989
|
sszValue.share_idx = exits.share_idx;
|
|
@@ -18842,18 +19033,18 @@ var Exit = class _Exit {
|
|
|
18842
19033
|
signedExitMessage.message
|
|
18843
19034
|
);
|
|
18844
19035
|
const exitDomain = computeDomain2(
|
|
18845
|
-
(0,
|
|
19036
|
+
(0, import_ssz10.fromHexString)(DOMAIN_VOLUNTARY_EXIT),
|
|
18846
19037
|
capellaForkVersionString,
|
|
18847
|
-
(0,
|
|
19038
|
+
(0, import_ssz10.fromHexString)(genesisValidatorsRootString)
|
|
18848
19039
|
);
|
|
18849
19040
|
const messageSigningRoot = signingRoot2(
|
|
18850
19041
|
exitDomain,
|
|
18851
19042
|
partialExitMessageBuffer
|
|
18852
19043
|
);
|
|
18853
19044
|
return blsVerify(
|
|
18854
|
-
(0,
|
|
19045
|
+
(0, import_ssz10.fromHexString)(publicShareKey),
|
|
18855
19046
|
messageSigningRoot,
|
|
18856
|
-
(0,
|
|
19047
|
+
(0, import_ssz10.fromHexString)(signedExitMessage.signature)
|
|
18857
19048
|
);
|
|
18858
19049
|
});
|
|
18859
19050
|
}
|
|
@@ -19156,7 +19347,7 @@ var Exit = class _Exit {
|
|
|
19156
19347
|
);
|
|
19157
19348
|
}
|
|
19158
19349
|
try {
|
|
19159
|
-
const sigBytes = (0,
|
|
19350
|
+
const sigBytes = (0, import_ssz10.fromHexString)(cleanSigStr);
|
|
19160
19351
|
const sigIdx = parseInt(sigIdxStr, 10);
|
|
19161
19352
|
signaturesByIndex.set(sigIdx + 1, sigBytes);
|
|
19162
19353
|
} catch (err) {
|
|
@@ -20390,7 +20581,7 @@ var Client = class extends Base {
|
|
|
20390
20581
|
* @example
|
|
20391
20582
|
* ```typescript
|
|
20392
20583
|
* const updatedDef = await client.acceptClusterDefinition(
|
|
20393
|
-
* { enr: "enr:-LK4Q...", version: "v1.
|
|
20584
|
+
* { enr: "enr:-LK4Q...", version: "v1.11.0" },
|
|
20394
20585
|
* configHash,
|
|
20395
20586
|
* );
|
|
20396
20587
|
* ```
|