@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
|
@@ -98,7 +98,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
98
98
|
// package.json
|
|
99
99
|
var package_default = {
|
|
100
100
|
name: "@obolnetwork/obol-sdk",
|
|
101
|
-
version: "2.
|
|
101
|
+
version: "2.13.0",
|
|
102
102
|
description: "A package for creating Distributed Validators using the Obol API.",
|
|
103
103
|
bugs: {
|
|
104
104
|
url: "https://github.com/obolnetwork/obol-sdk/issues"
|
|
@@ -396,7 +396,7 @@ var signEnrPayload = (payload, chainId) => {
|
|
|
396
396
|
};
|
|
397
397
|
};
|
|
398
398
|
var DKG_ALGORITHM = "default";
|
|
399
|
-
var CONFIG_VERSION = "v1.
|
|
399
|
+
var CONFIG_VERSION = "v1.11.0";
|
|
400
400
|
var SDK_VERSION = package_default.version;
|
|
401
401
|
var DOMAIN_APPLICATION_BUILDER = "00000001";
|
|
402
402
|
var DOMAIN_DEPOSIT = "03000000";
|
|
@@ -632,7 +632,7 @@ var Base = class {
|
|
|
632
632
|
};
|
|
633
633
|
|
|
634
634
|
// src/verification/common.ts
|
|
635
|
-
import { fromHexString as
|
|
635
|
+
import { fromHexString as fromHexString7 } from "@chainsafe/ssz";
|
|
636
636
|
import elliptic from "elliptic";
|
|
637
637
|
import * as semver from "semver";
|
|
638
638
|
|
|
@@ -688,6 +688,7 @@ import {
|
|
|
688
688
|
ByteListType,
|
|
689
689
|
ByteVectorType,
|
|
690
690
|
ContainerType,
|
|
691
|
+
ListCompositeType,
|
|
691
692
|
UintNumberType
|
|
692
693
|
} from "@chainsafe/ssz";
|
|
693
694
|
var operatorAddressWrapperType = new ContainerType({
|
|
@@ -703,10 +704,25 @@ var operatorContainerType = new ContainerType({
|
|
|
703
704
|
config_signature: new ByteVectorType(65),
|
|
704
705
|
enr_signature: new ByteVectorType(65)
|
|
705
706
|
});
|
|
707
|
+
var k1SignatureListType = new ListCompositeType(
|
|
708
|
+
new ByteVectorType(65),
|
|
709
|
+
32
|
|
710
|
+
);
|
|
711
|
+
var operatorContainerTypeV1X11 = new ContainerType({
|
|
712
|
+
address: new ByteVectorType(20),
|
|
713
|
+
enr: new ByteListType(1024),
|
|
714
|
+
// This needs to be dynamic, since ENRs do not have a fixed length.
|
|
715
|
+
config_signature: k1SignatureListType,
|
|
716
|
+
enr_signature: k1SignatureListType
|
|
717
|
+
});
|
|
706
718
|
var creatorContainerType = new ContainerType({
|
|
707
719
|
address: new ByteVectorType(20),
|
|
708
720
|
config_signature: new ByteVectorType(65)
|
|
709
721
|
});
|
|
722
|
+
var creatorContainerTypeV1X11 = new ContainerType({
|
|
723
|
+
address: new ByteVectorType(20),
|
|
724
|
+
config_signature: k1SignatureListType
|
|
725
|
+
});
|
|
710
726
|
var validatorsContainerType = new ContainerType({
|
|
711
727
|
fee_recipient_address: new ByteVectorType(20),
|
|
712
728
|
withdrawal_address: new ByteVectorType(20)
|
|
@@ -714,9 +730,15 @@ var validatorsContainerType = new ContainerType({
|
|
|
714
730
|
var newCreatorContainerType = (configOnly) => {
|
|
715
731
|
return configOnly ? creatorAddressWrapperType : creatorContainerType;
|
|
716
732
|
};
|
|
733
|
+
var newCreatorContainerTypeV1X11 = (configOnly) => {
|
|
734
|
+
return configOnly ? creatorAddressWrapperType : creatorContainerTypeV1X11;
|
|
735
|
+
};
|
|
717
736
|
var newOperatorContainerType = (configOnly) => {
|
|
718
737
|
return configOnly ? operatorAddressWrapperType : operatorContainerType;
|
|
719
738
|
};
|
|
739
|
+
var newOperatorContainerTypeV1X11 = (configOnly) => {
|
|
740
|
+
return configOnly ? operatorAddressWrapperType : operatorContainerTypeV1X11;
|
|
741
|
+
};
|
|
720
742
|
var depositDataContainer = new ContainerType({
|
|
721
743
|
pubkey: new ByteVectorType(48),
|
|
722
744
|
withdrawal_credentials: new ByteVectorType(32),
|
|
@@ -758,7 +780,7 @@ import {
|
|
|
758
780
|
ByteListType as ByteListType2,
|
|
759
781
|
ByteVectorType as ByteVectorType2,
|
|
760
782
|
ContainerType as ContainerType2,
|
|
761
|
-
ListCompositeType,
|
|
783
|
+
ListCompositeType as ListCompositeType2,
|
|
762
784
|
fromHexString as fromHexString2
|
|
763
785
|
} from "@chainsafe/ssz";
|
|
764
786
|
|
|
@@ -5626,9 +5648,9 @@ var clusterDefinitionContainerTypeV1X6 = (configOnly) => {
|
|
|
5626
5648
|
threshold: new UintNumberType2(8),
|
|
5627
5649
|
dkg_algorithm: new ByteListType2(32),
|
|
5628
5650
|
fork_version: new ByteVectorType2(4),
|
|
5629
|
-
operators: new
|
|
5651
|
+
operators: new ListCompositeType2(newOperatorContainerType(configOnly), 256),
|
|
5630
5652
|
creator: newCreatorContainerType(configOnly),
|
|
5631
|
-
validators: new
|
|
5653
|
+
validators: new ListCompositeType2(validatorsContainerType, 65536)
|
|
5632
5654
|
};
|
|
5633
5655
|
if (!configOnly) {
|
|
5634
5656
|
returnedContainerType = __spreadProps(__spreadValues({}, returnedContainerType), {
|
|
@@ -5675,7 +5697,7 @@ var hashClusterDefinitionV1X6 = (cluster, configOnly) => {
|
|
|
5675
5697
|
};
|
|
5676
5698
|
var dvContainerTypeV1X6 = new ContainerType2({
|
|
5677
5699
|
distributed_public_key: new ByteVectorType2(48),
|
|
5678
|
-
public_shares: new
|
|
5700
|
+
public_shares: new ListCompositeType2(new ByteVectorType2(48), 256),
|
|
5679
5701
|
pubkey: new ByteVectorType2(48),
|
|
5680
5702
|
withdrawal_credentials: new ByteVectorType2(32),
|
|
5681
5703
|
amount: new UintNumberType2(8),
|
|
@@ -5684,7 +5706,7 @@ var dvContainerTypeV1X6 = new ContainerType2({
|
|
|
5684
5706
|
var clusterLockContainerTypeV1X6 = () => {
|
|
5685
5707
|
return new ContainerType2({
|
|
5686
5708
|
cluster_definition: clusterDefinitionContainerTypeV1X6(false),
|
|
5687
|
-
distributed_validators: new
|
|
5709
|
+
distributed_validators: new ListCompositeType2(dvContainerTypeV1X6, 65536)
|
|
5688
5710
|
});
|
|
5689
5711
|
};
|
|
5690
5712
|
var hashClusterLockV1X6 = (cluster) => {
|
|
@@ -5782,7 +5804,7 @@ import {
|
|
|
5782
5804
|
ByteListType as ByteListType3,
|
|
5783
5805
|
ByteVectorType as ByteVectorType3,
|
|
5784
5806
|
ContainerType as ContainerType3,
|
|
5785
|
-
ListCompositeType as
|
|
5807
|
+
ListCompositeType as ListCompositeType3,
|
|
5786
5808
|
fromHexString as fromHexString3
|
|
5787
5809
|
} from "@chainsafe/ssz";
|
|
5788
5810
|
var clusterDefinitionContainerTypeV1X7 = (configOnly) => {
|
|
@@ -5795,9 +5817,9 @@ var clusterDefinitionContainerTypeV1X7 = (configOnly) => {
|
|
|
5795
5817
|
threshold: new UintNumberType3(8),
|
|
5796
5818
|
dkg_algorithm: new ByteListType3(32),
|
|
5797
5819
|
fork_version: new ByteVectorType3(4),
|
|
5798
|
-
operators: new
|
|
5820
|
+
operators: new ListCompositeType3(newOperatorContainerType(configOnly), 256),
|
|
5799
5821
|
creator: newCreatorContainerType(configOnly),
|
|
5800
|
-
validators: new
|
|
5822
|
+
validators: new ListCompositeType3(validatorsContainerType, 65536)
|
|
5801
5823
|
};
|
|
5802
5824
|
if (!configOnly) {
|
|
5803
5825
|
returnedContainerType = __spreadProps(__spreadValues({}, returnedContainerType), {
|
|
@@ -5844,14 +5866,14 @@ var hashClusterDefinitionV1X7 = (cluster, configOnly) => {
|
|
|
5844
5866
|
};
|
|
5845
5867
|
var dvContainerTypeV1X7 = new ContainerType3({
|
|
5846
5868
|
distributed_public_key: new ByteVectorType3(48),
|
|
5847
|
-
public_shares: new
|
|
5869
|
+
public_shares: new ListCompositeType3(new ByteVectorType3(48), 256),
|
|
5848
5870
|
deposit_data: depositDataContainer,
|
|
5849
5871
|
builder_registration: builderRegistrationContainer
|
|
5850
5872
|
});
|
|
5851
5873
|
var clusterLockContainerTypeV1X7 = () => {
|
|
5852
5874
|
return new ContainerType3({
|
|
5853
5875
|
cluster_definition: clusterDefinitionContainerTypeV1X7(false),
|
|
5854
|
-
distributed_validators: new
|
|
5876
|
+
distributed_validators: new ListCompositeType3(dvContainerTypeV1X7, 65536)
|
|
5855
5877
|
});
|
|
5856
5878
|
};
|
|
5857
5879
|
var hashClusterLockV1X7 = (cluster) => {
|
|
@@ -15431,7 +15453,7 @@ import {
|
|
|
15431
15453
|
ByteVectorType as ByteVectorType4,
|
|
15432
15454
|
ContainerType as ContainerType4,
|
|
15433
15455
|
ListBasicType,
|
|
15434
|
-
ListCompositeType as
|
|
15456
|
+
ListCompositeType as ListCompositeType4,
|
|
15435
15457
|
fromHexString as fromHexString4
|
|
15436
15458
|
} from "@chainsafe/ssz";
|
|
15437
15459
|
var clusterDefinitionContainerTypeV1X8 = (configOnly) => {
|
|
@@ -15444,9 +15466,9 @@ var clusterDefinitionContainerTypeV1X8 = (configOnly) => {
|
|
|
15444
15466
|
threshold: new UintNumberType4(8),
|
|
15445
15467
|
dkg_algorithm: new ByteListType4(32),
|
|
15446
15468
|
fork_version: new ByteVectorType4(4),
|
|
15447
|
-
operators: new
|
|
15469
|
+
operators: new ListCompositeType4(newOperatorContainerType(configOnly), 256),
|
|
15448
15470
|
creator: newCreatorContainerType(configOnly),
|
|
15449
|
-
validators: new
|
|
15471
|
+
validators: new ListCompositeType4(validatorsContainerType, 65536),
|
|
15450
15472
|
deposit_amounts: new ListBasicType(
|
|
15451
15473
|
new UintNumberType4(8),
|
|
15452
15474
|
256
|
|
@@ -15502,14 +15524,14 @@ var hashClusterDefinitionV1X8 = (cluster, configOnly) => {
|
|
|
15502
15524
|
};
|
|
15503
15525
|
var dvContainerTypeV1X8 = new ContainerType4({
|
|
15504
15526
|
distributed_public_key: new ByteVectorType4(48),
|
|
15505
|
-
public_shares: new
|
|
15506
|
-
partial_deposit_data: new
|
|
15527
|
+
public_shares: new ListCompositeType4(new ByteVectorType4(48), 256),
|
|
15528
|
+
partial_deposit_data: new ListCompositeType4(depositDataContainer, 256),
|
|
15507
15529
|
builder_registration: builderRegistrationContainer
|
|
15508
15530
|
});
|
|
15509
15531
|
var clusterLockContainerTypeV1X8 = () => {
|
|
15510
15532
|
return new ContainerType4({
|
|
15511
15533
|
cluster_definition: clusterDefinitionContainerTypeV1X8(false),
|
|
15512
|
-
distributed_validators: new
|
|
15534
|
+
distributed_validators: new ListCompositeType4(dvContainerTypeV1X8, 65536)
|
|
15513
15535
|
});
|
|
15514
15536
|
};
|
|
15515
15537
|
var hashClusterLockV1X8 = (cluster) => {
|
|
@@ -15730,7 +15752,7 @@ import {
|
|
|
15730
15752
|
ByteVectorType as ByteVectorType5,
|
|
15731
15753
|
ContainerType as ContainerType5,
|
|
15732
15754
|
ListBasicType as ListBasicType2,
|
|
15733
|
-
ListCompositeType as
|
|
15755
|
+
ListCompositeType as ListCompositeType5,
|
|
15734
15756
|
fromHexString as fromHexString5,
|
|
15735
15757
|
BooleanType
|
|
15736
15758
|
} from "@chainsafe/ssz";
|
|
@@ -15744,9 +15766,9 @@ var clusterDefinitionContainerTypeV1X10 = (configOnly) => {
|
|
|
15744
15766
|
threshold: new UintNumberType5(8),
|
|
15745
15767
|
dkg_algorithm: new ByteListType5(32),
|
|
15746
15768
|
fork_version: new ByteVectorType5(4),
|
|
15747
|
-
operators: new
|
|
15769
|
+
operators: new ListCompositeType5(newOperatorContainerType(configOnly), 256),
|
|
15748
15770
|
creator: newCreatorContainerType(configOnly),
|
|
15749
|
-
validators: new
|
|
15771
|
+
validators: new ListCompositeType5(validatorsContainerType, 65536),
|
|
15750
15772
|
deposit_amounts: new ListBasicType2(
|
|
15751
15773
|
new UintNumberType5(8),
|
|
15752
15774
|
256
|
|
@@ -15814,14 +15836,14 @@ var hashClusterDefinitionV1X10 = (cluster, configOnly) => {
|
|
|
15814
15836
|
};
|
|
15815
15837
|
var dvContainerTypeV1X10 = new ContainerType5({
|
|
15816
15838
|
distributed_public_key: new ByteVectorType5(48),
|
|
15817
|
-
public_shares: new
|
|
15818
|
-
partial_deposit_data: new
|
|
15839
|
+
public_shares: new ListCompositeType5(new ByteVectorType5(48), 256),
|
|
15840
|
+
partial_deposit_data: new ListCompositeType5(depositDataContainer, 256),
|
|
15819
15841
|
builder_registration: builderRegistrationContainer
|
|
15820
15842
|
});
|
|
15821
15843
|
var clusterLockContainerTypeV1X10 = () => {
|
|
15822
15844
|
return new ContainerType5({
|
|
15823
15845
|
cluster_definition: clusterDefinitionContainerTypeV1X10(false),
|
|
15824
|
-
distributed_validators: new
|
|
15846
|
+
distributed_validators: new ListCompositeType5(dvContainerTypeV1X10, 65536)
|
|
15825
15847
|
});
|
|
15826
15848
|
};
|
|
15827
15849
|
var hashClusterLockV1X10 = (cluster) => {
|
|
@@ -15874,6 +15896,175 @@ var hashClusterLockV1X10 = (cluster) => {
|
|
|
15874
15896
|
};
|
|
15875
15897
|
var verifyDVV1X10 = verifyDVV1X8;
|
|
15876
15898
|
|
|
15899
|
+
// src/verification/v1.11.0.ts
|
|
15900
|
+
import {
|
|
15901
|
+
UintNumberType as UintNumberType6
|
|
15902
|
+
} from "@chainsafe/ssz/lib/type/uint.js";
|
|
15903
|
+
import {
|
|
15904
|
+
ByteListType as ByteListType6,
|
|
15905
|
+
ByteVectorType as ByteVectorType6,
|
|
15906
|
+
ContainerType as ContainerType6,
|
|
15907
|
+
ListBasicType as ListBasicType3,
|
|
15908
|
+
ListCompositeType as ListCompositeType6,
|
|
15909
|
+
fromHexString as fromHexString6,
|
|
15910
|
+
BooleanType as BooleanType2
|
|
15911
|
+
} from "@chainsafe/ssz";
|
|
15912
|
+
var splitK1SignatureList = (signature) => {
|
|
15913
|
+
const bytes = fromHexString6(signature);
|
|
15914
|
+
if (bytes.length === 0) return [];
|
|
15915
|
+
if (bytes.length % 65 !== 0) {
|
|
15916
|
+
throw new Error("Signature length must be a multiple of 65 bytes");
|
|
15917
|
+
}
|
|
15918
|
+
const chunks = [];
|
|
15919
|
+
for (let i = 0; i < bytes.length; i += 65) {
|
|
15920
|
+
chunks.push(bytes.slice(i, i + 65));
|
|
15921
|
+
}
|
|
15922
|
+
return chunks;
|
|
15923
|
+
};
|
|
15924
|
+
var clusterDefinitionContainerTypeV1X11 = (configOnly) => {
|
|
15925
|
+
let returnedContainerType = {
|
|
15926
|
+
uuid: new ByteListType6(64),
|
|
15927
|
+
name: new ByteListType6(256),
|
|
15928
|
+
version: new ByteListType6(16),
|
|
15929
|
+
timestamp: new ByteListType6(32),
|
|
15930
|
+
num_validators: new UintNumberType6(8),
|
|
15931
|
+
threshold: new UintNumberType6(8),
|
|
15932
|
+
dkg_algorithm: new ByteListType6(32),
|
|
15933
|
+
fork_version: new ByteVectorType6(4),
|
|
15934
|
+
operators: new ListCompositeType6(
|
|
15935
|
+
newOperatorContainerTypeV1X11(configOnly),
|
|
15936
|
+
256
|
|
15937
|
+
),
|
|
15938
|
+
creator: newCreatorContainerTypeV1X11(configOnly),
|
|
15939
|
+
validators: new ListCompositeType6(validatorsContainerType, 65536),
|
|
15940
|
+
deposit_amounts: new ListBasicType3(
|
|
15941
|
+
new UintNumberType6(8),
|
|
15942
|
+
256
|
|
15943
|
+
),
|
|
15944
|
+
consensus_protocol: new ByteListType6(256),
|
|
15945
|
+
target_gas_limit: new UintNumberType6(8),
|
|
15946
|
+
compounding: new BooleanType2()
|
|
15947
|
+
};
|
|
15948
|
+
if (!configOnly) {
|
|
15949
|
+
returnedContainerType = __spreadProps(__spreadValues({}, returnedContainerType), {
|
|
15950
|
+
config_hash: new ByteVectorType6(32)
|
|
15951
|
+
});
|
|
15952
|
+
}
|
|
15953
|
+
return new ContainerType6(returnedContainerType);
|
|
15954
|
+
};
|
|
15955
|
+
var hashClusterDefinitionV1X11 = (cluster, configOnly) => {
|
|
15956
|
+
const definitionType = clusterDefinitionContainerTypeV1X11(configOnly);
|
|
15957
|
+
const val = definitionType.defaultValue();
|
|
15958
|
+
val.uuid = strToUint8Array(cluster.uuid);
|
|
15959
|
+
val.name = strToUint8Array(cluster.name);
|
|
15960
|
+
val.version = strToUint8Array(cluster.version);
|
|
15961
|
+
val.timestamp = strToUint8Array(cluster.timestamp);
|
|
15962
|
+
val.num_validators = cluster.num_validators;
|
|
15963
|
+
val.threshold = cluster.threshold;
|
|
15964
|
+
val.dkg_algorithm = strToUint8Array(cluster.dkg_algorithm);
|
|
15965
|
+
val.fork_version = fromHexString6(cluster.fork_version);
|
|
15966
|
+
val.operators = cluster.operators.map((operator) => {
|
|
15967
|
+
return configOnly ? { address: fromHexString6(operator.address) } : {
|
|
15968
|
+
address: fromHexString6(operator.address),
|
|
15969
|
+
enr: strToUint8Array(operator.enr),
|
|
15970
|
+
config_signature: splitK1SignatureList(
|
|
15971
|
+
operator.config_signature
|
|
15972
|
+
),
|
|
15973
|
+
enr_signature: splitK1SignatureList(operator.enr_signature)
|
|
15974
|
+
};
|
|
15975
|
+
});
|
|
15976
|
+
val.creator = configOnly ? { address: fromHexString6(cluster.creator.address) } : {
|
|
15977
|
+
address: fromHexString6(cluster.creator.address),
|
|
15978
|
+
config_signature: splitK1SignatureList(
|
|
15979
|
+
cluster.creator.config_signature
|
|
15980
|
+
)
|
|
15981
|
+
};
|
|
15982
|
+
val.validators = cluster.validators.map((validator) => {
|
|
15983
|
+
return {
|
|
15984
|
+
fee_recipient_address: fromHexString6(validator.fee_recipient_address),
|
|
15985
|
+
withdrawal_address: fromHexString6(validator.withdrawal_address)
|
|
15986
|
+
};
|
|
15987
|
+
});
|
|
15988
|
+
if (cluster.deposit_amounts) {
|
|
15989
|
+
val.deposit_amounts = cluster.deposit_amounts.map((amount) => {
|
|
15990
|
+
return parseInt(amount);
|
|
15991
|
+
});
|
|
15992
|
+
}
|
|
15993
|
+
if (cluster.consensus_protocol) {
|
|
15994
|
+
val.consensus_protocol = strToUint8Array(cluster.consensus_protocol);
|
|
15995
|
+
}
|
|
15996
|
+
if (cluster.target_gas_limit) {
|
|
15997
|
+
val.target_gas_limit = cluster.target_gas_limit;
|
|
15998
|
+
}
|
|
15999
|
+
if (cluster.compounding) {
|
|
16000
|
+
val.compounding = cluster.compounding;
|
|
16001
|
+
}
|
|
16002
|
+
if (!configOnly) {
|
|
16003
|
+
val.config_hash = fromHexString6(cluster.config_hash);
|
|
16004
|
+
}
|
|
16005
|
+
return val;
|
|
16006
|
+
};
|
|
16007
|
+
var dvContainerTypeV1X11 = new ContainerType6({
|
|
16008
|
+
distributed_public_key: new ByteVectorType6(48),
|
|
16009
|
+
public_shares: new ListCompositeType6(new ByteVectorType6(48), 256),
|
|
16010
|
+
partial_deposit_data: new ListCompositeType6(depositDataContainer, 256),
|
|
16011
|
+
builder_registration: builderRegistrationContainer
|
|
16012
|
+
});
|
|
16013
|
+
var clusterLockContainerTypeV1X11 = () => {
|
|
16014
|
+
return new ContainerType6({
|
|
16015
|
+
cluster_definition: clusterDefinitionContainerTypeV1X11(false),
|
|
16016
|
+
distributed_validators: new ListCompositeType6(dvContainerTypeV1X11, 65536)
|
|
16017
|
+
});
|
|
16018
|
+
};
|
|
16019
|
+
var hashClusterLockV1X11 = (cluster) => {
|
|
16020
|
+
const lockType = clusterLockContainerTypeV1X11();
|
|
16021
|
+
const val = lockType.defaultValue();
|
|
16022
|
+
val.cluster_definition = hashClusterDefinitionV1X11(
|
|
16023
|
+
cluster.cluster_definition,
|
|
16024
|
+
false
|
|
16025
|
+
);
|
|
16026
|
+
val.distributed_validators = cluster.distributed_validators.map(
|
|
16027
|
+
(dValidator) => {
|
|
16028
|
+
var _a6, _b2, _c, _d, _e;
|
|
16029
|
+
return {
|
|
16030
|
+
distributed_public_key: fromHexString6(
|
|
16031
|
+
dValidator.distributed_public_key
|
|
16032
|
+
),
|
|
16033
|
+
public_shares: dValidator.public_shares.map(
|
|
16034
|
+
(publicShare) => fromHexString6(publicShare)
|
|
16035
|
+
),
|
|
16036
|
+
partial_deposit_data: dValidator.partial_deposit_data.map((depositData) => {
|
|
16037
|
+
return {
|
|
16038
|
+
pubkey: fromHexString6(depositData.pubkey),
|
|
16039
|
+
withdrawal_credentials: fromHexString6(
|
|
16040
|
+
depositData.withdrawal_credentials
|
|
16041
|
+
),
|
|
16042
|
+
amount: parseInt(depositData.amount),
|
|
16043
|
+
signature: fromHexString6(depositData.signature)
|
|
16044
|
+
};
|
|
16045
|
+
}),
|
|
16046
|
+
builder_registration: {
|
|
16047
|
+
message: {
|
|
16048
|
+
fee_recipient: fromHexString6(
|
|
16049
|
+
(_a6 = dValidator.builder_registration) == null ? void 0 : _a6.message.fee_recipient
|
|
16050
|
+
),
|
|
16051
|
+
gas_limit: (_b2 = dValidator.builder_registration) == null ? void 0 : _b2.message.gas_limit,
|
|
16052
|
+
timestamp: (_c = dValidator.builder_registration) == null ? void 0 : _c.message.timestamp,
|
|
16053
|
+
pubkey: fromHexString6(
|
|
16054
|
+
(_d = dValidator.builder_registration) == null ? void 0 : _d.message.pubkey
|
|
16055
|
+
)
|
|
16056
|
+
},
|
|
16057
|
+
signature: fromHexString6(
|
|
16058
|
+
(_e = dValidator.builder_registration) == null ? void 0 : _e.signature
|
|
16059
|
+
)
|
|
16060
|
+
}
|
|
16061
|
+
};
|
|
16062
|
+
}
|
|
16063
|
+
);
|
|
16064
|
+
return "0x" + Buffer.from(lockType.hashTreeRoot(val).buffer).toString("hex");
|
|
16065
|
+
};
|
|
16066
|
+
var verifyDVV1X11 = verifyDVV1X8;
|
|
16067
|
+
|
|
15877
16068
|
// src/verification/common.ts
|
|
15878
16069
|
var clusterConfigOrDefinitionHash = (cluster, configOnly) => {
|
|
15879
16070
|
let definitionType, val;
|
|
@@ -15898,6 +16089,11 @@ var clusterConfigOrDefinitionHash = (cluster, configOnly) => {
|
|
|
15898
16089
|
const x = "0x" + Buffer.from(definitionType.hashTreeRoot(val).buffer).toString("hex");
|
|
15899
16090
|
return x;
|
|
15900
16091
|
}
|
|
16092
|
+
if (semver.eq(cluster.version, "v1.11.0")) {
|
|
16093
|
+
definitionType = clusterDefinitionContainerTypeV1X11(configOnly);
|
|
16094
|
+
val = hashClusterDefinitionV1X11(cluster, configOnly);
|
|
16095
|
+
return "0x" + Buffer.from(definitionType.hashTreeRoot(val).buffer).toString("hex");
|
|
16096
|
+
}
|
|
15901
16097
|
throw new Error("unsupported version");
|
|
15902
16098
|
};
|
|
15903
16099
|
var clusterLockHash = (clusterLock) => {
|
|
@@ -15923,6 +16119,9 @@ var clusterLockHash = (clusterLock) => {
|
|
|
15923
16119
|
if (semver.eq(clusterLock.cluster_definition.version, "v1.10.0")) {
|
|
15924
16120
|
return hashClusterLockV1X10(clusterLock);
|
|
15925
16121
|
}
|
|
16122
|
+
if (semver.eq(clusterLock.cluster_definition.version, "v1.11.0")) {
|
|
16123
|
+
return hashClusterLockV1X11(clusterLock);
|
|
16124
|
+
}
|
|
15926
16125
|
throw new Error("unsupported version");
|
|
15927
16126
|
};
|
|
15928
16127
|
var validatePOSTConfigHashSigner = (address, signature, configHash, chainId, safeRpcUrl) => __async(null, null, function* () {
|
|
@@ -16022,8 +16221,8 @@ var computeSigningRoot = (sszObjectRoot, domain) => {
|
|
|
16022
16221
|
};
|
|
16023
16222
|
var computeDepositMsgRoot = (msg) => {
|
|
16024
16223
|
const depositMsgVal = depositMessageType.defaultValue();
|
|
16025
|
-
depositMsgVal.pubkey =
|
|
16026
|
-
depositMsgVal.withdrawal_credentials =
|
|
16224
|
+
depositMsgVal.pubkey = fromHexString7(msg.pubkey);
|
|
16225
|
+
depositMsgVal.withdrawal_credentials = fromHexString7(
|
|
16027
16226
|
msg.withdrawal_credentials
|
|
16028
16227
|
);
|
|
16029
16228
|
depositMsgVal.amount = parseInt(msg.amount);
|
|
@@ -16037,16 +16236,16 @@ var computeForkDataRoot = (currentVersion, genesisValidatorsRoot) => {
|
|
|
16037
16236
|
};
|
|
16038
16237
|
var computebuilderRegistrationMsgRoot = (msg) => {
|
|
16039
16238
|
const builderRegistrationMsgVal = builderRegistrationMessageType.defaultValue();
|
|
16040
|
-
builderRegistrationMsgVal.fee_recipient =
|
|
16239
|
+
builderRegistrationMsgVal.fee_recipient = fromHexString7(msg.fee_recipient);
|
|
16041
16240
|
builderRegistrationMsgVal.gas_limit = msg.gas_limit;
|
|
16042
16241
|
builderRegistrationMsgVal.timestamp = msg.timestamp;
|
|
16043
|
-
builderRegistrationMsgVal.pubkey =
|
|
16242
|
+
builderRegistrationMsgVal.pubkey = fromHexString7(msg.pubkey);
|
|
16044
16243
|
return Buffer.from(
|
|
16045
16244
|
builderRegistrationMessageType.hashTreeRoot(builderRegistrationMsgVal).buffer
|
|
16046
16245
|
);
|
|
16047
16246
|
};
|
|
16048
|
-
var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot =
|
|
16049
|
-
const forkVersion =
|
|
16247
|
+
var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = fromHexString7(GENESIS_VALIDATOR_ROOT)) => {
|
|
16248
|
+
const forkVersion = fromHexString7(
|
|
16050
16249
|
lockForkVersion.substring(2, lockForkVersion.length)
|
|
16051
16250
|
);
|
|
16052
16251
|
const forkDataRoot = computeForkDataRoot(forkVersion, genesisValidatorsRoot);
|
|
@@ -16055,10 +16254,10 @@ var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = fromHe
|
|
|
16055
16254
|
domain.set(forkDataRoot.subarray(0, 28), 4);
|
|
16056
16255
|
return domain;
|
|
16057
16256
|
};
|
|
16058
|
-
var depositDomainForFork = (forkVersion) => computeDomain(
|
|
16059
|
-
var builderDomainForFork = (forkVersion) => computeDomain(
|
|
16257
|
+
var depositDomainForFork = (forkVersion) => computeDomain(fromHexString7(DOMAIN_DEPOSIT), forkVersion);
|
|
16258
|
+
var builderDomainForFork = (forkVersion) => computeDomain(fromHexString7(DOMAIN_APPLICATION_BUILDER), forkVersion);
|
|
16060
16259
|
var validateDepositDataStructure = (distributedPublicKey, depositData, withdrawalAddress, forkVersion, compounding, precomputedDepositDomain) => {
|
|
16061
|
-
const depositDomain = precomputedDepositDomain != null ? precomputedDepositDomain : computeDomain(
|
|
16260
|
+
const depositDomain = precomputedDepositDomain != null ? precomputedDepositDomain : computeDomain(fromHexString7(DOMAIN_DEPOSIT), forkVersion);
|
|
16062
16261
|
const withdrawalPrefix = compounding ? "0x02" : "0x01";
|
|
16063
16262
|
const expectedWithdrawalCredentials = withdrawalPrefix + "0".repeat(22) + withdrawalAddress.toLowerCase().slice(2);
|
|
16064
16263
|
if (expectedWithdrawalCredentials !== depositData.withdrawal_credentials) {
|
|
@@ -16085,9 +16284,9 @@ var depositBlsCheck = (distributedPublicKey, depositData, withdrawalAddress, for
|
|
|
16085
16284
|
);
|
|
16086
16285
|
if (!valid || !depositData.signature || !depositData.pubkey) return null;
|
|
16087
16286
|
return {
|
|
16088
|
-
pubkey:
|
|
16287
|
+
pubkey: fromHexString7(depositData.pubkey),
|
|
16089
16288
|
message: message2,
|
|
16090
|
-
signature:
|
|
16289
|
+
signature: fromHexString7(depositData.signature)
|
|
16091
16290
|
};
|
|
16092
16291
|
};
|
|
16093
16292
|
var verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, forkVersion, compounding) => {
|
|
@@ -16102,15 +16301,15 @@ var verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, f
|
|
|
16102
16301
|
return { isValidDepositData: false, depositDataMsg: message2 };
|
|
16103
16302
|
}
|
|
16104
16303
|
const isValidDepositData = blsVerify(
|
|
16105
|
-
|
|
16304
|
+
fromHexString7(depositData.pubkey),
|
|
16106
16305
|
message2,
|
|
16107
|
-
|
|
16306
|
+
fromHexString7(depositData.signature)
|
|
16108
16307
|
);
|
|
16109
16308
|
return { isValidDepositData, depositDataMsg: message2 };
|
|
16110
16309
|
};
|
|
16111
16310
|
var verifyBuilderRegistration = (validator, feeRecipientAddress, forkVersion, precomputedBuilderDomain) => {
|
|
16112
16311
|
var _a6;
|
|
16113
|
-
const builderDomain = precomputedBuilderDomain != null ? precomputedBuilderDomain : computeDomain(
|
|
16312
|
+
const builderDomain = precomputedBuilderDomain != null ? precomputedBuilderDomain : computeDomain(fromHexString7(DOMAIN_APPLICATION_BUILDER), forkVersion);
|
|
16114
16313
|
if (validator.distributed_public_key !== ((_a6 = validator.builder_registration) == null ? void 0 : _a6.message.pubkey)) {
|
|
16115
16314
|
return {
|
|
16116
16315
|
isValidBuilderRegistration: false,
|
|
@@ -16146,9 +16345,9 @@ var builderBlsCheck = (validator, feeRecipientAddress, forkVersion, precomputedB
|
|
|
16146
16345
|
const sig = (_a6 = validator.builder_registration) == null ? void 0 : _a6.signature;
|
|
16147
16346
|
if (!isValidBuilderRegistration || !sig) return null;
|
|
16148
16347
|
return {
|
|
16149
|
-
pubkey:
|
|
16348
|
+
pubkey: fromHexString7(validator.distributed_public_key),
|
|
16150
16349
|
message: builderRegistrationMsg,
|
|
16151
|
-
signature:
|
|
16350
|
+
signature: fromHexString7(sig)
|
|
16152
16351
|
};
|
|
16153
16352
|
};
|
|
16154
16353
|
var verifyNodeSignatures = (clusterLock) => {
|
|
@@ -16190,6 +16389,9 @@ var verifyLockData = (clusterLock) => __async(null, null, function* () {
|
|
|
16190
16389
|
if (semver.eq(clusterLock.cluster_definition.version, "v1.10.0")) {
|
|
16191
16390
|
return yield verifyDVV1X10(clusterLock);
|
|
16192
16391
|
}
|
|
16392
|
+
if (semver.eq(clusterLock.cluster_definition.version, "v1.11.0")) {
|
|
16393
|
+
return yield verifyDVV1X11(clusterLock);
|
|
16394
|
+
}
|
|
16193
16395
|
return false;
|
|
16194
16396
|
});
|
|
16195
16397
|
var hasUniqueDistributedKeys = (clusterLock) => {
|
|
@@ -19896,11 +20098,11 @@ var Incentives = class {
|
|
|
19896
20098
|
// src/exits/exit.ts
|
|
19897
20099
|
import * as elliptic2 from "elliptic";
|
|
19898
20100
|
import {
|
|
19899
|
-
ByteVectorType as
|
|
19900
|
-
ContainerType as
|
|
19901
|
-
fromHexString as
|
|
19902
|
-
ListCompositeType as
|
|
19903
|
-
UintNumberType as
|
|
20101
|
+
ByteVectorType as ByteVectorType8,
|
|
20102
|
+
ContainerType as ContainerType8,
|
|
20103
|
+
fromHexString as fromHexString9,
|
|
20104
|
+
ListCompositeType as ListCompositeType7,
|
|
20105
|
+
UintNumberType as UintNumberType7
|
|
19904
20106
|
} from "@chainsafe/ssz";
|
|
19905
20107
|
|
|
19906
20108
|
// src/exits/ethUtils.ts
|
|
@@ -19938,15 +20140,15 @@ function getGenesisValidatorsRoot(beaconNodeApiUrl) {
|
|
|
19938
20140
|
}
|
|
19939
20141
|
|
|
19940
20142
|
// src/exits/verificationHelpers.ts
|
|
19941
|
-
import { ContainerType as
|
|
20143
|
+
import { ContainerType as ContainerType7, ByteVectorType as ByteVectorType7, fromHexString as fromHexString8 } from "@chainsafe/ssz";
|
|
19942
20144
|
var GENESIS_VALIDATOR_ROOT_HEX_STRING = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
19943
|
-
var ForkDataType = new
|
|
19944
|
-
currentVersion: new
|
|
19945
|
-
genesisValidatorsRoot: new
|
|
20145
|
+
var ForkDataType = new ContainerType7({
|
|
20146
|
+
currentVersion: new ByteVectorType7(4),
|
|
20147
|
+
genesisValidatorsRoot: new ByteVectorType7(32)
|
|
19946
20148
|
});
|
|
19947
|
-
var SigningRootType = new
|
|
19948
|
-
objectRoot: new
|
|
19949
|
-
domain: new
|
|
20149
|
+
var SigningRootType = new ContainerType7({
|
|
20150
|
+
objectRoot: new ByteVectorType7(32),
|
|
20151
|
+
domain: new ByteVectorType7(32)
|
|
19950
20152
|
});
|
|
19951
20153
|
function computeForkDataRoot2(currentVersion, genesisValidatorsRoot) {
|
|
19952
20154
|
const forkDataVal = ForkDataType.defaultValue();
|
|
@@ -19955,7 +20157,7 @@ function computeForkDataRoot2(currentVersion, genesisValidatorsRoot) {
|
|
|
19955
20157
|
return Buffer.from(ForkDataType.hashTreeRoot(forkDataVal).buffer);
|
|
19956
20158
|
}
|
|
19957
20159
|
function computeDomain2(domainType, forkVersionString, genesisValidatorsRootOverride) {
|
|
19958
|
-
const forkVersionBytes =
|
|
20160
|
+
const forkVersionBytes = fromHexString8(
|
|
19959
20161
|
forkVersionString.substring(2, forkVersionString.length)
|
|
19960
20162
|
);
|
|
19961
20163
|
if (forkVersionBytes.length !== 4) {
|
|
@@ -19964,7 +20166,7 @@ function computeDomain2(domainType, forkVersionString, genesisValidatorsRootOver
|
|
|
19964
20166
|
if (domainType.length !== 4) {
|
|
19965
20167
|
throw new Error("Domain type must be 4 bytes");
|
|
19966
20168
|
}
|
|
19967
|
-
const actualGenesisValidatorsRoot = genesisValidatorsRootOverride != null ? genesisValidatorsRootOverride :
|
|
20169
|
+
const actualGenesisValidatorsRoot = genesisValidatorsRootOverride != null ? genesisValidatorsRootOverride : fromHexString8(GENESIS_VALIDATOR_ROOT_HEX_STRING.substring(2));
|
|
19968
20170
|
if (actualGenesisValidatorsRoot.length !== 32) {
|
|
19969
20171
|
throw new Error("genesisValidatorsRoot must be 32 bytes");
|
|
19970
20172
|
}
|
|
@@ -19996,25 +20198,25 @@ function signingRoot2(domain, messageBuffer) {
|
|
|
19996
20198
|
|
|
19997
20199
|
// src/exits/exit.ts
|
|
19998
20200
|
var DOMAIN_VOLUNTARY_EXIT = "0x04000000";
|
|
19999
|
-
var SSZExitMessageType = new
|
|
20000
|
-
epoch: new
|
|
20001
|
-
validator_index: new
|
|
20201
|
+
var SSZExitMessageType = new ContainerType8({
|
|
20202
|
+
epoch: new UintNumberType7(8),
|
|
20203
|
+
validator_index: new UintNumberType7(8)
|
|
20002
20204
|
});
|
|
20003
|
-
var SSZPartialExitsPayloadType = new
|
|
20004
|
-
partial_exits: new
|
|
20005
|
-
new
|
|
20006
|
-
public_key: new
|
|
20007
|
-
signed_exit_message: new
|
|
20008
|
-
message: new
|
|
20009
|
-
epoch: new
|
|
20010
|
-
validator_index: new
|
|
20205
|
+
var SSZPartialExitsPayloadType = new ContainerType8({
|
|
20206
|
+
partial_exits: new ListCompositeType7(
|
|
20207
|
+
new ContainerType8({
|
|
20208
|
+
public_key: new ByteVectorType8(48),
|
|
20209
|
+
signed_exit_message: new ContainerType8({
|
|
20210
|
+
message: new ContainerType8({
|
|
20211
|
+
epoch: new UintNumberType7(8),
|
|
20212
|
+
validator_index: new UintNumberType7(8)
|
|
20011
20213
|
}),
|
|
20012
|
-
signature: new
|
|
20214
|
+
signature: new ByteVectorType8(96)
|
|
20013
20215
|
})
|
|
20014
20216
|
}),
|
|
20015
20217
|
65536
|
|
20016
20218
|
),
|
|
20017
|
-
share_idx: new
|
|
20219
|
+
share_idx: new UintNumberType7(8)
|
|
20018
20220
|
});
|
|
20019
20221
|
var Exit = class _Exit {
|
|
20020
20222
|
/**
|
|
@@ -20057,7 +20259,7 @@ var Exit = class _Exit {
|
|
|
20057
20259
|
static computeExitPayloadRoot(exits) {
|
|
20058
20260
|
const sszValue = SSZPartialExitsPayloadType.defaultValue();
|
|
20059
20261
|
sszValue.partial_exits = exits.partial_exits.map((pe) => ({
|
|
20060
|
-
public_key:
|
|
20262
|
+
public_key: fromHexString9(pe.public_key),
|
|
20061
20263
|
signed_exit_message: {
|
|
20062
20264
|
message: {
|
|
20063
20265
|
epoch: _Exit.safeParseInt(pe.signed_exit_message.message.epoch),
|
|
@@ -20065,7 +20267,7 @@ var Exit = class _Exit {
|
|
|
20065
20267
|
pe.signed_exit_message.message.validator_index
|
|
20066
20268
|
)
|
|
20067
20269
|
},
|
|
20068
|
-
signature:
|
|
20270
|
+
signature: fromHexString9(pe.signed_exit_message.signature)
|
|
20069
20271
|
}
|
|
20070
20272
|
}));
|
|
20071
20273
|
sszValue.share_idx = exits.share_idx;
|
|
@@ -20115,18 +20317,18 @@ var Exit = class _Exit {
|
|
|
20115
20317
|
signedExitMessage.message
|
|
20116
20318
|
);
|
|
20117
20319
|
const exitDomain = computeDomain2(
|
|
20118
|
-
|
|
20320
|
+
fromHexString9(DOMAIN_VOLUNTARY_EXIT),
|
|
20119
20321
|
capellaForkVersionString,
|
|
20120
|
-
|
|
20322
|
+
fromHexString9(genesisValidatorsRootString)
|
|
20121
20323
|
);
|
|
20122
20324
|
const messageSigningRoot = signingRoot2(
|
|
20123
20325
|
exitDomain,
|
|
20124
20326
|
partialExitMessageBuffer
|
|
20125
20327
|
);
|
|
20126
20328
|
return blsVerify(
|
|
20127
|
-
|
|
20329
|
+
fromHexString9(publicShareKey),
|
|
20128
20330
|
messageSigningRoot,
|
|
20129
|
-
|
|
20331
|
+
fromHexString9(signedExitMessage.signature)
|
|
20130
20332
|
);
|
|
20131
20333
|
});
|
|
20132
20334
|
}
|
|
@@ -20429,7 +20631,7 @@ var Exit = class _Exit {
|
|
|
20429
20631
|
);
|
|
20430
20632
|
}
|
|
20431
20633
|
try {
|
|
20432
|
-
const sigBytes =
|
|
20634
|
+
const sigBytes = fromHexString9(cleanSigStr);
|
|
20433
20635
|
const sigIdx = parseInt(sigIdxStr, 10);
|
|
20434
20636
|
signaturesByIndex.set(sigIdx + 1, sigBytes);
|
|
20435
20637
|
} catch (err) {
|
|
@@ -21663,7 +21865,7 @@ var Client = class extends Base {
|
|
|
21663
21865
|
* @example
|
|
21664
21866
|
* ```typescript
|
|
21665
21867
|
* const updatedDef = await client.acceptClusterDefinition(
|
|
21666
|
-
* { enr: "enr:-LK4Q...", version: "v1.
|
|
21868
|
+
* { enr: "enr:-LK4Q...", version: "v1.11.0" },
|
|
21667
21869
|
* configHash,
|
|
21668
21870
|
* );
|
|
21669
21871
|
* ```
|