@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.
- package/dist/browser/src/index.js +281 -78
- package/dist/browser/src/index.js.map +1 -1
- package/dist/cjs/src/index.js +244 -52
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/verification/clusterLockValidationWorker.js +210 -18
- package/dist/cjs/src/verification/clusterLockValidationWorker.js.map +1 -1
- package/dist/esm/src/{chunk-L2GZF5CQ.js → chunk-EITEAAK3.js} +247 -44
- 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 +4 -3
- package/dist/esm/src/chunk-L2GZF5CQ.js.map +0 -1
|
@@ -40,7 +40,7 @@ var FORK_NAMES = {
|
|
|
40
40
|
// package.json
|
|
41
41
|
var package_default = {
|
|
42
42
|
name: "@obolnetwork/obol-sdk",
|
|
43
|
-
version: "2.
|
|
43
|
+
version: "2.13.0",
|
|
44
44
|
description: "A package for creating Distributed Validators using the Obol API.",
|
|
45
45
|
bugs: {
|
|
46
46
|
url: "https://github.com/obolnetwork/obol-sdk/issues"
|
|
@@ -101,7 +101,8 @@ var package_default = {
|
|
|
101
101
|
"@typescript-eslint/* stays at ^6.x \u2014 eslint-config-standard-with-typescript@43 requires plugin ^6; v8 causes peer conflict.",
|
|
102
102
|
"uuid stays at ^9.x \u2014 v11+ sets type:module (ESM-only).",
|
|
103
103
|
"viem override pins a single resolved version to prevent duplicates across @safe-global/protocol-kit.",
|
|
104
|
-
"@noble/curves replaces @chainsafe/bls \u2014 pure-JS CJS+ESM, no native addon, same ETH2 BLS12-381 spec. See CHAINSAFE_MIGRATION_PLAN.md."
|
|
104
|
+
"@noble/curves replaces @chainsafe/bls \u2014 pure-JS CJS+ESM, no native addon, same ETH2 BLS12-381 spec. See CHAINSAFE_MIGRATION_PLAN.md.",
|
|
105
|
+
"@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'."
|
|
105
106
|
],
|
|
106
107
|
resolutions: {},
|
|
107
108
|
overrides: {
|
|
@@ -109,7 +110,6 @@ var package_default = {
|
|
|
109
110
|
},
|
|
110
111
|
dependencies: {
|
|
111
112
|
"@chainsafe/enr": "6.0.1",
|
|
112
|
-
"@noble/curves": "2.2.0",
|
|
113
113
|
"@chainsafe/ssz": "0.14.3",
|
|
114
114
|
"@metamask/eth-sig-util": "8.2.0",
|
|
115
115
|
"@safe-global/protocol-kit": "7.1.0",
|
|
@@ -124,6 +124,7 @@ var package_default = {
|
|
|
124
124
|
uuid: "9.0.1"
|
|
125
125
|
},
|
|
126
126
|
devDependencies: {
|
|
127
|
+
"@noble/curves": "2.2.0",
|
|
127
128
|
"@release-it/conventional-changelog": "11.0.0",
|
|
128
129
|
"@types/elliptic": "6.4.18",
|
|
129
130
|
"@types/jest": "29.5.14",
|
|
@@ -322,7 +323,7 @@ var signEnrPayload = (payload, chainId) => {
|
|
|
322
323
|
};
|
|
323
324
|
};
|
|
324
325
|
var DKG_ALGORITHM = "default";
|
|
325
|
-
var CONFIG_VERSION = "v1.
|
|
326
|
+
var CONFIG_VERSION = "v1.11.0";
|
|
326
327
|
var SDK_VERSION = package_default.version;
|
|
327
328
|
var DOMAIN_APPLICATION_BUILDER = "00000001";
|
|
328
329
|
var DOMAIN_DEPOSIT = "03000000";
|
|
@@ -8986,7 +8987,7 @@ var validateSmartContractSignature = (_0) => __async(null, [_0], function* ({
|
|
|
8986
8987
|
});
|
|
8987
8988
|
|
|
8988
8989
|
// src/verification/common.ts
|
|
8989
|
-
import { fromHexString as
|
|
8990
|
+
import { fromHexString as fromHexString6 } from "@chainsafe/ssz";
|
|
8990
8991
|
import elliptic from "elliptic";
|
|
8991
8992
|
import * as semver from "semver";
|
|
8992
8993
|
|
|
@@ -9000,6 +9001,7 @@ import {
|
|
|
9000
9001
|
ByteListType,
|
|
9001
9002
|
ByteVectorType,
|
|
9002
9003
|
ContainerType,
|
|
9004
|
+
ListCompositeType,
|
|
9003
9005
|
UintNumberType
|
|
9004
9006
|
} from "@chainsafe/ssz";
|
|
9005
9007
|
var operatorAddressWrapperType = new ContainerType({
|
|
@@ -9015,10 +9017,25 @@ var operatorContainerType = new ContainerType({
|
|
|
9015
9017
|
config_signature: new ByteVectorType(65),
|
|
9016
9018
|
enr_signature: new ByteVectorType(65)
|
|
9017
9019
|
});
|
|
9020
|
+
var k1SignatureListType = new ListCompositeType(
|
|
9021
|
+
new ByteVectorType(65),
|
|
9022
|
+
32
|
|
9023
|
+
);
|
|
9024
|
+
var operatorContainerTypeV1X11 = new ContainerType({
|
|
9025
|
+
address: new ByteVectorType(20),
|
|
9026
|
+
enr: new ByteListType(1024),
|
|
9027
|
+
// This needs to be dynamic, since ENRs do not have a fixed length.
|
|
9028
|
+
config_signature: k1SignatureListType,
|
|
9029
|
+
enr_signature: k1SignatureListType
|
|
9030
|
+
});
|
|
9018
9031
|
var creatorContainerType = new ContainerType({
|
|
9019
9032
|
address: new ByteVectorType(20),
|
|
9020
9033
|
config_signature: new ByteVectorType(65)
|
|
9021
9034
|
});
|
|
9035
|
+
var creatorContainerTypeV1X11 = new ContainerType({
|
|
9036
|
+
address: new ByteVectorType(20),
|
|
9037
|
+
config_signature: k1SignatureListType
|
|
9038
|
+
});
|
|
9022
9039
|
var validatorsContainerType = new ContainerType({
|
|
9023
9040
|
fee_recipient_address: new ByteVectorType(20),
|
|
9024
9041
|
withdrawal_address: new ByteVectorType(20)
|
|
@@ -9026,9 +9043,15 @@ var validatorsContainerType = new ContainerType({
|
|
|
9026
9043
|
var newCreatorContainerType = (configOnly) => {
|
|
9027
9044
|
return configOnly ? creatorAddressWrapperType : creatorContainerType;
|
|
9028
9045
|
};
|
|
9046
|
+
var newCreatorContainerTypeV1X11 = (configOnly) => {
|
|
9047
|
+
return configOnly ? creatorAddressWrapperType : creatorContainerTypeV1X11;
|
|
9048
|
+
};
|
|
9029
9049
|
var newOperatorContainerType = (configOnly) => {
|
|
9030
9050
|
return configOnly ? operatorAddressWrapperType : operatorContainerType;
|
|
9031
9051
|
};
|
|
9052
|
+
var newOperatorContainerTypeV1X11 = (configOnly) => {
|
|
9053
|
+
return configOnly ? operatorAddressWrapperType : operatorContainerTypeV1X11;
|
|
9054
|
+
};
|
|
9032
9055
|
var depositDataContainer = new ContainerType({
|
|
9033
9056
|
pubkey: new ByteVectorType(48),
|
|
9034
9057
|
withdrawal_credentials: new ByteVectorType(32),
|
|
@@ -9070,7 +9093,7 @@ import {
|
|
|
9070
9093
|
ByteListType as ByteListType2,
|
|
9071
9094
|
ByteVectorType as ByteVectorType2,
|
|
9072
9095
|
ContainerType as ContainerType2,
|
|
9073
|
-
ListCompositeType,
|
|
9096
|
+
ListCompositeType as ListCompositeType2,
|
|
9074
9097
|
fromHexString
|
|
9075
9098
|
} from "@chainsafe/ssz";
|
|
9076
9099
|
var clusterDefinitionContainerTypeV1X6 = (configOnly) => {
|
|
@@ -9083,9 +9106,9 @@ var clusterDefinitionContainerTypeV1X6 = (configOnly) => {
|
|
|
9083
9106
|
threshold: new UintNumberType2(8),
|
|
9084
9107
|
dkg_algorithm: new ByteListType2(32),
|
|
9085
9108
|
fork_version: new ByteVectorType2(4),
|
|
9086
|
-
operators: new
|
|
9109
|
+
operators: new ListCompositeType2(newOperatorContainerType(configOnly), 256),
|
|
9087
9110
|
creator: newCreatorContainerType(configOnly),
|
|
9088
|
-
validators: new
|
|
9111
|
+
validators: new ListCompositeType2(validatorsContainerType, 65536)
|
|
9089
9112
|
};
|
|
9090
9113
|
if (!configOnly) {
|
|
9091
9114
|
returnedContainerType = __spreadProps(__spreadValues({}, returnedContainerType), {
|
|
@@ -9132,7 +9155,7 @@ var hashClusterDefinitionV1X6 = (cluster, configOnly) => {
|
|
|
9132
9155
|
};
|
|
9133
9156
|
var dvContainerTypeV1X6 = new ContainerType2({
|
|
9134
9157
|
distributed_public_key: new ByteVectorType2(48),
|
|
9135
|
-
public_shares: new
|
|
9158
|
+
public_shares: new ListCompositeType2(new ByteVectorType2(48), 256),
|
|
9136
9159
|
pubkey: new ByteVectorType2(48),
|
|
9137
9160
|
withdrawal_credentials: new ByteVectorType2(32),
|
|
9138
9161
|
amount: new UintNumberType2(8),
|
|
@@ -9141,7 +9164,7 @@ var dvContainerTypeV1X6 = new ContainerType2({
|
|
|
9141
9164
|
var clusterLockContainerTypeV1X6 = () => {
|
|
9142
9165
|
return new ContainerType2({
|
|
9143
9166
|
cluster_definition: clusterDefinitionContainerTypeV1X6(false),
|
|
9144
|
-
distributed_validators: new
|
|
9167
|
+
distributed_validators: new ListCompositeType2(dvContainerTypeV1X6, 65536)
|
|
9145
9168
|
});
|
|
9146
9169
|
};
|
|
9147
9170
|
var hashClusterLockV1X6 = (cluster) => {
|
|
@@ -9239,7 +9262,7 @@ import {
|
|
|
9239
9262
|
ByteListType as ByteListType3,
|
|
9240
9263
|
ByteVectorType as ByteVectorType3,
|
|
9241
9264
|
ContainerType as ContainerType3,
|
|
9242
|
-
ListCompositeType as
|
|
9265
|
+
ListCompositeType as ListCompositeType3,
|
|
9243
9266
|
fromHexString as fromHexString2
|
|
9244
9267
|
} from "@chainsafe/ssz";
|
|
9245
9268
|
var clusterDefinitionContainerTypeV1X7 = (configOnly) => {
|
|
@@ -9252,9 +9275,9 @@ var clusterDefinitionContainerTypeV1X7 = (configOnly) => {
|
|
|
9252
9275
|
threshold: new UintNumberType3(8),
|
|
9253
9276
|
dkg_algorithm: new ByteListType3(32),
|
|
9254
9277
|
fork_version: new ByteVectorType3(4),
|
|
9255
|
-
operators: new
|
|
9278
|
+
operators: new ListCompositeType3(newOperatorContainerType(configOnly), 256),
|
|
9256
9279
|
creator: newCreatorContainerType(configOnly),
|
|
9257
|
-
validators: new
|
|
9280
|
+
validators: new ListCompositeType3(validatorsContainerType, 65536)
|
|
9258
9281
|
};
|
|
9259
9282
|
if (!configOnly) {
|
|
9260
9283
|
returnedContainerType = __spreadProps(__spreadValues({}, returnedContainerType), {
|
|
@@ -9301,14 +9324,14 @@ var hashClusterDefinitionV1X7 = (cluster, configOnly) => {
|
|
|
9301
9324
|
};
|
|
9302
9325
|
var dvContainerTypeV1X7 = new ContainerType3({
|
|
9303
9326
|
distributed_public_key: new ByteVectorType3(48),
|
|
9304
|
-
public_shares: new
|
|
9327
|
+
public_shares: new ListCompositeType3(new ByteVectorType3(48), 256),
|
|
9305
9328
|
deposit_data: depositDataContainer,
|
|
9306
9329
|
builder_registration: builderRegistrationContainer
|
|
9307
9330
|
});
|
|
9308
9331
|
var clusterLockContainerTypeV1X7 = () => {
|
|
9309
9332
|
return new ContainerType3({
|
|
9310
9333
|
cluster_definition: clusterDefinitionContainerTypeV1X7(false),
|
|
9311
|
-
distributed_validators: new
|
|
9334
|
+
distributed_validators: new ListCompositeType3(dvContainerTypeV1X7, 65536)
|
|
9312
9335
|
});
|
|
9313
9336
|
};
|
|
9314
9337
|
var hashClusterLockV1X7 = (cluster) => {
|
|
@@ -9436,7 +9459,7 @@ import {
|
|
|
9436
9459
|
ByteVectorType as ByteVectorType4,
|
|
9437
9460
|
ContainerType as ContainerType4,
|
|
9438
9461
|
ListBasicType,
|
|
9439
|
-
ListCompositeType as
|
|
9462
|
+
ListCompositeType as ListCompositeType4,
|
|
9440
9463
|
fromHexString as fromHexString3
|
|
9441
9464
|
} from "@chainsafe/ssz";
|
|
9442
9465
|
var clusterDefinitionContainerTypeV1X8 = (configOnly) => {
|
|
@@ -9449,9 +9472,9 @@ var clusterDefinitionContainerTypeV1X8 = (configOnly) => {
|
|
|
9449
9472
|
threshold: new UintNumberType4(8),
|
|
9450
9473
|
dkg_algorithm: new ByteListType4(32),
|
|
9451
9474
|
fork_version: new ByteVectorType4(4),
|
|
9452
|
-
operators: new
|
|
9475
|
+
operators: new ListCompositeType4(newOperatorContainerType(configOnly), 256),
|
|
9453
9476
|
creator: newCreatorContainerType(configOnly),
|
|
9454
|
-
validators: new
|
|
9477
|
+
validators: new ListCompositeType4(validatorsContainerType, 65536),
|
|
9455
9478
|
deposit_amounts: new ListBasicType(
|
|
9456
9479
|
new UintNumberType4(8),
|
|
9457
9480
|
256
|
|
@@ -9507,14 +9530,14 @@ var hashClusterDefinitionV1X8 = (cluster, configOnly) => {
|
|
|
9507
9530
|
};
|
|
9508
9531
|
var dvContainerTypeV1X8 = new ContainerType4({
|
|
9509
9532
|
distributed_public_key: new ByteVectorType4(48),
|
|
9510
|
-
public_shares: new
|
|
9511
|
-
partial_deposit_data: new
|
|
9533
|
+
public_shares: new ListCompositeType4(new ByteVectorType4(48), 256),
|
|
9534
|
+
partial_deposit_data: new ListCompositeType4(depositDataContainer, 256),
|
|
9512
9535
|
builder_registration: builderRegistrationContainer
|
|
9513
9536
|
});
|
|
9514
9537
|
var clusterLockContainerTypeV1X8 = () => {
|
|
9515
9538
|
return new ContainerType4({
|
|
9516
9539
|
cluster_definition: clusterDefinitionContainerTypeV1X8(false),
|
|
9517
|
-
distributed_validators: new
|
|
9540
|
+
distributed_validators: new ListCompositeType4(dvContainerTypeV1X8, 65536)
|
|
9518
9541
|
});
|
|
9519
9542
|
};
|
|
9520
9543
|
var hashClusterLockV1X8 = (cluster) => {
|
|
@@ -9660,7 +9683,7 @@ import {
|
|
|
9660
9683
|
ByteVectorType as ByteVectorType5,
|
|
9661
9684
|
ContainerType as ContainerType5,
|
|
9662
9685
|
ListBasicType as ListBasicType2,
|
|
9663
|
-
ListCompositeType as
|
|
9686
|
+
ListCompositeType as ListCompositeType5,
|
|
9664
9687
|
fromHexString as fromHexString4,
|
|
9665
9688
|
BooleanType
|
|
9666
9689
|
} from "@chainsafe/ssz";
|
|
@@ -9674,9 +9697,9 @@ var clusterDefinitionContainerTypeV1X10 = (configOnly) => {
|
|
|
9674
9697
|
threshold: new UintNumberType5(8),
|
|
9675
9698
|
dkg_algorithm: new ByteListType5(32),
|
|
9676
9699
|
fork_version: new ByteVectorType5(4),
|
|
9677
|
-
operators: new
|
|
9700
|
+
operators: new ListCompositeType5(newOperatorContainerType(configOnly), 256),
|
|
9678
9701
|
creator: newCreatorContainerType(configOnly),
|
|
9679
|
-
validators: new
|
|
9702
|
+
validators: new ListCompositeType5(validatorsContainerType, 65536),
|
|
9680
9703
|
deposit_amounts: new ListBasicType2(
|
|
9681
9704
|
new UintNumberType5(8),
|
|
9682
9705
|
256
|
|
@@ -9744,14 +9767,14 @@ var hashClusterDefinitionV1X10 = (cluster, configOnly) => {
|
|
|
9744
9767
|
};
|
|
9745
9768
|
var dvContainerTypeV1X10 = new ContainerType5({
|
|
9746
9769
|
distributed_public_key: new ByteVectorType5(48),
|
|
9747
|
-
public_shares: new
|
|
9748
|
-
partial_deposit_data: new
|
|
9770
|
+
public_shares: new ListCompositeType5(new ByteVectorType5(48), 256),
|
|
9771
|
+
partial_deposit_data: new ListCompositeType5(depositDataContainer, 256),
|
|
9749
9772
|
builder_registration: builderRegistrationContainer
|
|
9750
9773
|
});
|
|
9751
9774
|
var clusterLockContainerTypeV1X10 = () => {
|
|
9752
9775
|
return new ContainerType5({
|
|
9753
9776
|
cluster_definition: clusterDefinitionContainerTypeV1X10(false),
|
|
9754
|
-
distributed_validators: new
|
|
9777
|
+
distributed_validators: new ListCompositeType5(dvContainerTypeV1X10, 65536)
|
|
9755
9778
|
});
|
|
9756
9779
|
};
|
|
9757
9780
|
var hashClusterLockV1X10 = (cluster) => {
|
|
@@ -9804,6 +9827,175 @@ var hashClusterLockV1X10 = (cluster) => {
|
|
|
9804
9827
|
};
|
|
9805
9828
|
var verifyDVV1X10 = verifyDVV1X8;
|
|
9806
9829
|
|
|
9830
|
+
// src/verification/v1.11.0.ts
|
|
9831
|
+
import {
|
|
9832
|
+
UintNumberType as UintNumberType6
|
|
9833
|
+
} from "@chainsafe/ssz/lib/type/uint.js";
|
|
9834
|
+
import {
|
|
9835
|
+
ByteListType as ByteListType6,
|
|
9836
|
+
ByteVectorType as ByteVectorType6,
|
|
9837
|
+
ContainerType as ContainerType6,
|
|
9838
|
+
ListBasicType as ListBasicType3,
|
|
9839
|
+
ListCompositeType as ListCompositeType6,
|
|
9840
|
+
fromHexString as fromHexString5,
|
|
9841
|
+
BooleanType as BooleanType2
|
|
9842
|
+
} from "@chainsafe/ssz";
|
|
9843
|
+
var splitK1SignatureList = (signature) => {
|
|
9844
|
+
const bytes = fromHexString5(signature);
|
|
9845
|
+
if (bytes.length === 0) return [];
|
|
9846
|
+
if (bytes.length % 65 !== 0) {
|
|
9847
|
+
throw new Error("Signature length must be a multiple of 65 bytes");
|
|
9848
|
+
}
|
|
9849
|
+
const chunks = [];
|
|
9850
|
+
for (let i = 0; i < bytes.length; i += 65) {
|
|
9851
|
+
chunks.push(bytes.slice(i, i + 65));
|
|
9852
|
+
}
|
|
9853
|
+
return chunks;
|
|
9854
|
+
};
|
|
9855
|
+
var clusterDefinitionContainerTypeV1X11 = (configOnly) => {
|
|
9856
|
+
let returnedContainerType = {
|
|
9857
|
+
uuid: new ByteListType6(64),
|
|
9858
|
+
name: new ByteListType6(256),
|
|
9859
|
+
version: new ByteListType6(16),
|
|
9860
|
+
timestamp: new ByteListType6(32),
|
|
9861
|
+
num_validators: new UintNumberType6(8),
|
|
9862
|
+
threshold: new UintNumberType6(8),
|
|
9863
|
+
dkg_algorithm: new ByteListType6(32),
|
|
9864
|
+
fork_version: new ByteVectorType6(4),
|
|
9865
|
+
operators: new ListCompositeType6(
|
|
9866
|
+
newOperatorContainerTypeV1X11(configOnly),
|
|
9867
|
+
256
|
|
9868
|
+
),
|
|
9869
|
+
creator: newCreatorContainerTypeV1X11(configOnly),
|
|
9870
|
+
validators: new ListCompositeType6(validatorsContainerType, 65536),
|
|
9871
|
+
deposit_amounts: new ListBasicType3(
|
|
9872
|
+
new UintNumberType6(8),
|
|
9873
|
+
256
|
|
9874
|
+
),
|
|
9875
|
+
consensus_protocol: new ByteListType6(256),
|
|
9876
|
+
target_gas_limit: new UintNumberType6(8),
|
|
9877
|
+
compounding: new BooleanType2()
|
|
9878
|
+
};
|
|
9879
|
+
if (!configOnly) {
|
|
9880
|
+
returnedContainerType = __spreadProps(__spreadValues({}, returnedContainerType), {
|
|
9881
|
+
config_hash: new ByteVectorType6(32)
|
|
9882
|
+
});
|
|
9883
|
+
}
|
|
9884
|
+
return new ContainerType6(returnedContainerType);
|
|
9885
|
+
};
|
|
9886
|
+
var hashClusterDefinitionV1X11 = (cluster, configOnly) => {
|
|
9887
|
+
const definitionType = clusterDefinitionContainerTypeV1X11(configOnly);
|
|
9888
|
+
const val = definitionType.defaultValue();
|
|
9889
|
+
val.uuid = strToUint8Array(cluster.uuid);
|
|
9890
|
+
val.name = strToUint8Array(cluster.name);
|
|
9891
|
+
val.version = strToUint8Array(cluster.version);
|
|
9892
|
+
val.timestamp = strToUint8Array(cluster.timestamp);
|
|
9893
|
+
val.num_validators = cluster.num_validators;
|
|
9894
|
+
val.threshold = cluster.threshold;
|
|
9895
|
+
val.dkg_algorithm = strToUint8Array(cluster.dkg_algorithm);
|
|
9896
|
+
val.fork_version = fromHexString5(cluster.fork_version);
|
|
9897
|
+
val.operators = cluster.operators.map((operator) => {
|
|
9898
|
+
return configOnly ? { address: fromHexString5(operator.address) } : {
|
|
9899
|
+
address: fromHexString5(operator.address),
|
|
9900
|
+
enr: strToUint8Array(operator.enr),
|
|
9901
|
+
config_signature: splitK1SignatureList(
|
|
9902
|
+
operator.config_signature
|
|
9903
|
+
),
|
|
9904
|
+
enr_signature: splitK1SignatureList(operator.enr_signature)
|
|
9905
|
+
};
|
|
9906
|
+
});
|
|
9907
|
+
val.creator = configOnly ? { address: fromHexString5(cluster.creator.address) } : {
|
|
9908
|
+
address: fromHexString5(cluster.creator.address),
|
|
9909
|
+
config_signature: splitK1SignatureList(
|
|
9910
|
+
cluster.creator.config_signature
|
|
9911
|
+
)
|
|
9912
|
+
};
|
|
9913
|
+
val.validators = cluster.validators.map((validator) => {
|
|
9914
|
+
return {
|
|
9915
|
+
fee_recipient_address: fromHexString5(validator.fee_recipient_address),
|
|
9916
|
+
withdrawal_address: fromHexString5(validator.withdrawal_address)
|
|
9917
|
+
};
|
|
9918
|
+
});
|
|
9919
|
+
if (cluster.deposit_amounts) {
|
|
9920
|
+
val.deposit_amounts = cluster.deposit_amounts.map((amount) => {
|
|
9921
|
+
return parseInt(amount);
|
|
9922
|
+
});
|
|
9923
|
+
}
|
|
9924
|
+
if (cluster.consensus_protocol) {
|
|
9925
|
+
val.consensus_protocol = strToUint8Array(cluster.consensus_protocol);
|
|
9926
|
+
}
|
|
9927
|
+
if (cluster.target_gas_limit) {
|
|
9928
|
+
val.target_gas_limit = cluster.target_gas_limit;
|
|
9929
|
+
}
|
|
9930
|
+
if (cluster.compounding) {
|
|
9931
|
+
val.compounding = cluster.compounding;
|
|
9932
|
+
}
|
|
9933
|
+
if (!configOnly) {
|
|
9934
|
+
val.config_hash = fromHexString5(cluster.config_hash);
|
|
9935
|
+
}
|
|
9936
|
+
return val;
|
|
9937
|
+
};
|
|
9938
|
+
var dvContainerTypeV1X11 = new ContainerType6({
|
|
9939
|
+
distributed_public_key: new ByteVectorType6(48),
|
|
9940
|
+
public_shares: new ListCompositeType6(new ByteVectorType6(48), 256),
|
|
9941
|
+
partial_deposit_data: new ListCompositeType6(depositDataContainer, 256),
|
|
9942
|
+
builder_registration: builderRegistrationContainer
|
|
9943
|
+
});
|
|
9944
|
+
var clusterLockContainerTypeV1X11 = () => {
|
|
9945
|
+
return new ContainerType6({
|
|
9946
|
+
cluster_definition: clusterDefinitionContainerTypeV1X11(false),
|
|
9947
|
+
distributed_validators: new ListCompositeType6(dvContainerTypeV1X11, 65536)
|
|
9948
|
+
});
|
|
9949
|
+
};
|
|
9950
|
+
var hashClusterLockV1X11 = (cluster) => {
|
|
9951
|
+
const lockType = clusterLockContainerTypeV1X11();
|
|
9952
|
+
const val = lockType.defaultValue();
|
|
9953
|
+
val.cluster_definition = hashClusterDefinitionV1X11(
|
|
9954
|
+
cluster.cluster_definition,
|
|
9955
|
+
false
|
|
9956
|
+
);
|
|
9957
|
+
val.distributed_validators = cluster.distributed_validators.map(
|
|
9958
|
+
(dValidator) => {
|
|
9959
|
+
var _a6, _b2, _c, _d, _e;
|
|
9960
|
+
return {
|
|
9961
|
+
distributed_public_key: fromHexString5(
|
|
9962
|
+
dValidator.distributed_public_key
|
|
9963
|
+
),
|
|
9964
|
+
public_shares: dValidator.public_shares.map(
|
|
9965
|
+
(publicShare) => fromHexString5(publicShare)
|
|
9966
|
+
),
|
|
9967
|
+
partial_deposit_data: dValidator.partial_deposit_data.map((depositData) => {
|
|
9968
|
+
return {
|
|
9969
|
+
pubkey: fromHexString5(depositData.pubkey),
|
|
9970
|
+
withdrawal_credentials: fromHexString5(
|
|
9971
|
+
depositData.withdrawal_credentials
|
|
9972
|
+
),
|
|
9973
|
+
amount: parseInt(depositData.amount),
|
|
9974
|
+
signature: fromHexString5(depositData.signature)
|
|
9975
|
+
};
|
|
9976
|
+
}),
|
|
9977
|
+
builder_registration: {
|
|
9978
|
+
message: {
|
|
9979
|
+
fee_recipient: fromHexString5(
|
|
9980
|
+
(_a6 = dValidator.builder_registration) == null ? void 0 : _a6.message.fee_recipient
|
|
9981
|
+
),
|
|
9982
|
+
gas_limit: (_b2 = dValidator.builder_registration) == null ? void 0 : _b2.message.gas_limit,
|
|
9983
|
+
timestamp: (_c = dValidator.builder_registration) == null ? void 0 : _c.message.timestamp,
|
|
9984
|
+
pubkey: fromHexString5(
|
|
9985
|
+
(_d = dValidator.builder_registration) == null ? void 0 : _d.message.pubkey
|
|
9986
|
+
)
|
|
9987
|
+
},
|
|
9988
|
+
signature: fromHexString5(
|
|
9989
|
+
(_e = dValidator.builder_registration) == null ? void 0 : _e.signature
|
|
9990
|
+
)
|
|
9991
|
+
}
|
|
9992
|
+
};
|
|
9993
|
+
}
|
|
9994
|
+
);
|
|
9995
|
+
return "0x" + Buffer.from(lockType.hashTreeRoot(val).buffer).toString("hex");
|
|
9996
|
+
};
|
|
9997
|
+
var verifyDVV1X11 = verifyDVV1X8;
|
|
9998
|
+
|
|
9807
9999
|
// src/verification/common.ts
|
|
9808
10000
|
var clusterConfigOrDefinitionHash = (cluster, configOnly) => {
|
|
9809
10001
|
let definitionType, val;
|
|
@@ -9828,6 +10020,11 @@ var clusterConfigOrDefinitionHash = (cluster, configOnly) => {
|
|
|
9828
10020
|
const x = "0x" + Buffer.from(definitionType.hashTreeRoot(val).buffer).toString("hex");
|
|
9829
10021
|
return x;
|
|
9830
10022
|
}
|
|
10023
|
+
if (semver.eq(cluster.version, "v1.11.0")) {
|
|
10024
|
+
definitionType = clusterDefinitionContainerTypeV1X11(configOnly);
|
|
10025
|
+
val = hashClusterDefinitionV1X11(cluster, configOnly);
|
|
10026
|
+
return "0x" + Buffer.from(definitionType.hashTreeRoot(val).buffer).toString("hex");
|
|
10027
|
+
}
|
|
9831
10028
|
throw new Error("unsupported version");
|
|
9832
10029
|
};
|
|
9833
10030
|
var clusterLockHash = (clusterLock) => {
|
|
@@ -9853,6 +10050,9 @@ var clusterLockHash = (clusterLock) => {
|
|
|
9853
10050
|
if (semver.eq(clusterLock.cluster_definition.version, "v1.10.0")) {
|
|
9854
10051
|
return hashClusterLockV1X10(clusterLock);
|
|
9855
10052
|
}
|
|
10053
|
+
if (semver.eq(clusterLock.cluster_definition.version, "v1.11.0")) {
|
|
10054
|
+
return hashClusterLockV1X11(clusterLock);
|
|
10055
|
+
}
|
|
9856
10056
|
throw new Error("unsupported version");
|
|
9857
10057
|
};
|
|
9858
10058
|
var validatePOSTConfigHashSigner = (address, signature, configHash, chainId, safeRpcUrl) => __async(null, null, function* () {
|
|
@@ -9952,8 +10152,8 @@ var computeSigningRoot = (sszObjectRoot, domain) => {
|
|
|
9952
10152
|
};
|
|
9953
10153
|
var computeDepositMsgRoot = (msg) => {
|
|
9954
10154
|
const depositMsgVal = depositMessageType.defaultValue();
|
|
9955
|
-
depositMsgVal.pubkey =
|
|
9956
|
-
depositMsgVal.withdrawal_credentials =
|
|
10155
|
+
depositMsgVal.pubkey = fromHexString6(msg.pubkey);
|
|
10156
|
+
depositMsgVal.withdrawal_credentials = fromHexString6(
|
|
9957
10157
|
msg.withdrawal_credentials
|
|
9958
10158
|
);
|
|
9959
10159
|
depositMsgVal.amount = parseInt(msg.amount);
|
|
@@ -9967,16 +10167,16 @@ var computeForkDataRoot = (currentVersion, genesisValidatorsRoot) => {
|
|
|
9967
10167
|
};
|
|
9968
10168
|
var computebuilderRegistrationMsgRoot = (msg) => {
|
|
9969
10169
|
const builderRegistrationMsgVal = builderRegistrationMessageType.defaultValue();
|
|
9970
|
-
builderRegistrationMsgVal.fee_recipient =
|
|
10170
|
+
builderRegistrationMsgVal.fee_recipient = fromHexString6(msg.fee_recipient);
|
|
9971
10171
|
builderRegistrationMsgVal.gas_limit = msg.gas_limit;
|
|
9972
10172
|
builderRegistrationMsgVal.timestamp = msg.timestamp;
|
|
9973
|
-
builderRegistrationMsgVal.pubkey =
|
|
10173
|
+
builderRegistrationMsgVal.pubkey = fromHexString6(msg.pubkey);
|
|
9974
10174
|
return Buffer.from(
|
|
9975
10175
|
builderRegistrationMessageType.hashTreeRoot(builderRegistrationMsgVal).buffer
|
|
9976
10176
|
);
|
|
9977
10177
|
};
|
|
9978
|
-
var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot =
|
|
9979
|
-
const forkVersion =
|
|
10178
|
+
var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = fromHexString6(GENESIS_VALIDATOR_ROOT)) => {
|
|
10179
|
+
const forkVersion = fromHexString6(
|
|
9980
10180
|
lockForkVersion.substring(2, lockForkVersion.length)
|
|
9981
10181
|
);
|
|
9982
10182
|
const forkDataRoot = computeForkDataRoot(forkVersion, genesisValidatorsRoot);
|
|
@@ -9985,10 +10185,10 @@ var computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = fromHe
|
|
|
9985
10185
|
domain.set(forkDataRoot.subarray(0, 28), 4);
|
|
9986
10186
|
return domain;
|
|
9987
10187
|
};
|
|
9988
|
-
var depositDomainForFork = (forkVersion) => computeDomain(
|
|
9989
|
-
var builderDomainForFork = (forkVersion) => computeDomain(
|
|
10188
|
+
var depositDomainForFork = (forkVersion) => computeDomain(fromHexString6(DOMAIN_DEPOSIT), forkVersion);
|
|
10189
|
+
var builderDomainForFork = (forkVersion) => computeDomain(fromHexString6(DOMAIN_APPLICATION_BUILDER), forkVersion);
|
|
9990
10190
|
var validateDepositDataStructure = (distributedPublicKey, depositData, withdrawalAddress, forkVersion, compounding, precomputedDepositDomain) => {
|
|
9991
|
-
const depositDomain = precomputedDepositDomain != null ? precomputedDepositDomain : computeDomain(
|
|
10191
|
+
const depositDomain = precomputedDepositDomain != null ? precomputedDepositDomain : computeDomain(fromHexString6(DOMAIN_DEPOSIT), forkVersion);
|
|
9992
10192
|
const withdrawalPrefix = compounding ? "0x02" : "0x01";
|
|
9993
10193
|
const expectedWithdrawalCredentials = withdrawalPrefix + "0".repeat(22) + withdrawalAddress.toLowerCase().slice(2);
|
|
9994
10194
|
if (expectedWithdrawalCredentials !== depositData.withdrawal_credentials) {
|
|
@@ -10015,9 +10215,9 @@ var depositBlsCheck = (distributedPublicKey, depositData, withdrawalAddress, for
|
|
|
10015
10215
|
);
|
|
10016
10216
|
if (!valid || !depositData.signature || !depositData.pubkey) return null;
|
|
10017
10217
|
return {
|
|
10018
|
-
pubkey:
|
|
10218
|
+
pubkey: fromHexString6(depositData.pubkey),
|
|
10019
10219
|
message: message2,
|
|
10020
|
-
signature:
|
|
10220
|
+
signature: fromHexString6(depositData.signature)
|
|
10021
10221
|
};
|
|
10022
10222
|
};
|
|
10023
10223
|
var verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, forkVersion, compounding) => {
|
|
@@ -10032,15 +10232,15 @@ var verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, f
|
|
|
10032
10232
|
return { isValidDepositData: false, depositDataMsg: message2 };
|
|
10033
10233
|
}
|
|
10034
10234
|
const isValidDepositData = blsVerify(
|
|
10035
|
-
|
|
10235
|
+
fromHexString6(depositData.pubkey),
|
|
10036
10236
|
message2,
|
|
10037
|
-
|
|
10237
|
+
fromHexString6(depositData.signature)
|
|
10038
10238
|
);
|
|
10039
10239
|
return { isValidDepositData, depositDataMsg: message2 };
|
|
10040
10240
|
};
|
|
10041
10241
|
var verifyBuilderRegistration = (validator, feeRecipientAddress, forkVersion, precomputedBuilderDomain) => {
|
|
10042
10242
|
var _a6;
|
|
10043
|
-
const builderDomain = precomputedBuilderDomain != null ? precomputedBuilderDomain : computeDomain(
|
|
10243
|
+
const builderDomain = precomputedBuilderDomain != null ? precomputedBuilderDomain : computeDomain(fromHexString6(DOMAIN_APPLICATION_BUILDER), forkVersion);
|
|
10044
10244
|
if (validator.distributed_public_key !== ((_a6 = validator.builder_registration) == null ? void 0 : _a6.message.pubkey)) {
|
|
10045
10245
|
return {
|
|
10046
10246
|
isValidBuilderRegistration: false,
|
|
@@ -10076,9 +10276,9 @@ var builderBlsCheck = (validator, feeRecipientAddress, forkVersion, precomputedB
|
|
|
10076
10276
|
const sig = (_a6 = validator.builder_registration) == null ? void 0 : _a6.signature;
|
|
10077
10277
|
if (!isValidBuilderRegistration || !sig) return null;
|
|
10078
10278
|
return {
|
|
10079
|
-
pubkey:
|
|
10279
|
+
pubkey: fromHexString6(validator.distributed_public_key),
|
|
10080
10280
|
message: builderRegistrationMsg,
|
|
10081
|
-
signature:
|
|
10281
|
+
signature: fromHexString6(sig)
|
|
10082
10282
|
};
|
|
10083
10283
|
};
|
|
10084
10284
|
var verifyNodeSignatures = (clusterLock) => {
|
|
@@ -10120,6 +10320,9 @@ var verifyLockData = (clusterLock) => __async(null, null, function* () {
|
|
|
10120
10320
|
if (semver.eq(clusterLock.cluster_definition.version, "v1.10.0")) {
|
|
10121
10321
|
return yield verifyDVV1X10(clusterLock);
|
|
10122
10322
|
}
|
|
10323
|
+
if (semver.eq(clusterLock.cluster_definition.version, "v1.11.0")) {
|
|
10324
|
+
return yield verifyDVV1X11(clusterLock);
|
|
10325
|
+
}
|
|
10123
10326
|
return false;
|
|
10124
10327
|
});
|
|
10125
10328
|
var hasUniqueDistributedKeys = (clusterLock) => {
|
|
@@ -10241,4 +10444,4 @@ export {
|
|
|
10241
10444
|
@scure/base/index.js:
|
|
10242
10445
|
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
10243
10446
|
*/
|
|
10244
|
-
//# sourceMappingURL=chunk-
|
|
10447
|
+
//# sourceMappingURL=chunk-EITEAAK3.js.map
|