@obolnetwork/obol-sdk 2.2.3 → 2.2.4
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/cjs/package.json +1 -1
- package/dist/cjs/src/verification/common.js +5 -10
- package/dist/cjs/src/verification/v1.10.0.js +4 -0
- package/dist/cjs/src/verification/v1.8.0.js +1 -1
- package/dist/cjs/test/fixtures.js +140 -295
- package/dist/cjs/test/methods.test.js +4 -0
- package/dist/esm/package.json +1 -1
- package/dist/esm/src/verification/common.js +5 -10
- package/dist/esm/src/verification/v1.10.0.js +5 -1
- package/dist/esm/src/verification/v1.8.0.js +1 -1
- package/dist/esm/test/fixtures.js +139 -294
- package/dist/esm/test/methods.test.js +5 -1
- package/dist/types/src/types.d.ts +2 -0
- package/dist/types/src/verification/common.d.ts +1 -1
- package/dist/types/src/verification/v1.10.0.d.ts +2 -1
- package/dist/types/test/fixtures.d.ts +55 -0
- package/package.json +1 -1
- package/src/types.ts +3 -0
- package/src/verification/common.ts +8 -12
- package/src/verification/v1.10.0.ts +7 -0
- package/src/verification/v1.8.0.ts +1 -0
package/dist/cjs/package.json
CHANGED
|
@@ -239,18 +239,13 @@ const computeDomain = (domainType, lockForkVersion, genesisValidatorsRoot = (0,
|
|
|
239
239
|
* @param {string} withdrawalAddress - withdrawal address in definition file.
|
|
240
240
|
* @returns {boolean} - return if deposit data is valid.
|
|
241
241
|
*/
|
|
242
|
-
const verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, forkVersion) => {
|
|
242
|
+
const verifyDepositData = (distributedPublicKey, depositData, withdrawalAddress, forkVersion, compounding) => {
|
|
243
243
|
const depositDomain = computeDomain((0, ssz_1.fromHexString)(constants_js_1.DOMAIN_DEPOSIT), forkVersion);
|
|
244
|
-
const
|
|
245
|
-
const
|
|
246
|
-
if (eth1AddressWithdrawalPrefix +
|
|
244
|
+
const withdrawalPrefix = compounding ? '0x02' : '0x01';
|
|
245
|
+
const expectedWithdrawalCredentials = withdrawalPrefix +
|
|
247
246
|
'0'.repeat(22) +
|
|
248
|
-
withdrawalAddress.toLowerCase().slice(2)
|
|
249
|
-
|
|
250
|
-
compoundingWithdrawalPrefix +
|
|
251
|
-
'0'.repeat(22) +
|
|
252
|
-
withdrawalAddress.toLowerCase().slice(2) !==
|
|
253
|
-
depositData.withdrawal_credentials) {
|
|
247
|
+
withdrawalAddress.toLowerCase().slice(2);
|
|
248
|
+
if (expectedWithdrawalCredentials !== depositData.withdrawal_credentials) {
|
|
254
249
|
return { isValidDepositData: false, depositDataMsg: new Uint8Array(0) };
|
|
255
250
|
}
|
|
256
251
|
if (distributedPublicKey !== depositData.pubkey) {
|
|
@@ -27,6 +27,7 @@ const clusterDefinitionContainerTypeV1X10 = (configOnly) => {
|
|
|
27
27
|
deposit_amounts: new ssz_1.ListBasicType(new uint_1.UintNumberType(8), 256),
|
|
28
28
|
consensus_protocol: new ssz_1.ByteListType(256),
|
|
29
29
|
target_gas_limit: new uint_1.UintNumberType(8),
|
|
30
|
+
compounding: new ssz_1.BooleanType(),
|
|
30
31
|
};
|
|
31
32
|
if (!configOnly) {
|
|
32
33
|
returnedContainerType = Object.assign(Object.assign({}, returnedContainerType), { config_hash: new ssz_1.ByteVectorType(32) });
|
|
@@ -79,6 +80,9 @@ const hashClusterDefinitionV1X10 = (cluster, configOnly) => {
|
|
|
79
80
|
if (cluster.target_gas_limit) {
|
|
80
81
|
val.target_gas_limit = cluster.target_gas_limit;
|
|
81
82
|
}
|
|
83
|
+
if (cluster.compounding) {
|
|
84
|
+
val.compounding = cluster.compounding;
|
|
85
|
+
}
|
|
82
86
|
if (!configOnly) {
|
|
83
87
|
val.config_hash = (0, ssz_1.fromHexString)(cluster.config_hash);
|
|
84
88
|
}
|
|
@@ -150,7 +150,7 @@ const verifyDVV1X8 = (clusterLock) => {
|
|
|
150
150
|
// Deposit Data Verification
|
|
151
151
|
for (const element of validator.partial_deposit_data) {
|
|
152
152
|
const depositData = element;
|
|
153
|
-
const { isValidDepositData, depositDataMsg } = (0, common_1.verifyDepositData)(distributedPublicKey, depositData, clusterLock.cluster_definition.validators[i].withdrawal_address, clusterLock.cluster_definition.fork_version);
|
|
153
|
+
const { isValidDepositData, depositDataMsg } = (0, common_1.verifyDepositData)(distributedPublicKey, depositData, clusterLock.cluster_definition.validators[i].withdrawal_address, clusterLock.cluster_definition.fork_version, clusterLock.cluster_definition.compounding);
|
|
154
154
|
if (!isValidDepositData) {
|
|
155
155
|
return false;
|
|
156
156
|
}
|