@obolnetwork/obol-sdk 2.11.2 → 2.11.3
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/v1.8.0.js +5 -12
- package/dist/cjs/test/eoa/eoa.spec.js +3 -3
- package/dist/esm/package.json +1 -1
- package/dist/esm/src/verification/v1.8.0.js +5 -12
- package/dist/esm/test/eoa/eoa.spec.js +3 -3
- package/package.json +1 -1
- package/src/verification/v1.8.0.ts +7 -14
package/dist/cjs/package.json
CHANGED
|
@@ -149,19 +149,12 @@ const verifyDVV1X8 = (clusterLock) => {
|
|
|
149
149
|
}
|
|
150
150
|
// Check deposit amounts match exactly if they are defined
|
|
151
151
|
const depositAmounts = clusterLock.cluster_definition.deposit_amounts;
|
|
152
|
-
if (depositAmounts !== null) {
|
|
152
|
+
if (!!depositAmounts && depositAmounts !== null) {
|
|
153
153
|
const partialDepositAmounts = validator.partial_deposit_data.map(d => d.amount);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const sortedDepositAmounts = [...depositAmounts]
|
|
159
|
-
.map(Number)
|
|
160
|
-
.sort((a, b) => a - b);
|
|
161
|
-
const sortedPartialAmounts = [...partialDepositAmounts]
|
|
162
|
-
.map(Number)
|
|
163
|
-
.sort((a, b) => a - b);
|
|
164
|
-
if (!sortedDepositAmounts.every((amount, index) => amount === sortedPartialAmounts[index])) {
|
|
154
|
+
// Check that partialDepositAmounts includes all unique elements of depositAmounts
|
|
155
|
+
const uniqueDepositAmounts = [...new Set(depositAmounts.map(Number))];
|
|
156
|
+
const partialAmountsSet = new Set(partialDepositAmounts.map(Number));
|
|
157
|
+
if (!uniqueDepositAmounts.every(amount => partialAmountsSet.has(amount))) {
|
|
165
158
|
return false;
|
|
166
159
|
}
|
|
167
160
|
}
|
|
@@ -101,7 +101,7 @@ describe('EOA', () => {
|
|
|
101
101
|
{
|
|
102
102
|
pubkey: '0x123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456',
|
|
103
103
|
withdrawal_credentials: '0x1234567890123456789012345678901234567890123456789012345678901234',
|
|
104
|
-
deposit_data_root:
|
|
104
|
+
deposit_data_root: '0x7f7f280756b8d5fe06ae922e5a20afb708c0f00d8954caede4c262795d956c01',
|
|
105
105
|
signature: '0x121234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012000000000000000000',
|
|
106
106
|
amount: '32000000000000000000', // 32 ETH in wei
|
|
107
107
|
},
|
|
@@ -143,14 +143,14 @@ describe('EOA', () => {
|
|
|
143
143
|
{
|
|
144
144
|
pubkey: '0x123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456',
|
|
145
145
|
withdrawal_credentials: '0x1234567890123456789012345678901234567890123456789012345678901234',
|
|
146
|
-
deposit_data_root:
|
|
146
|
+
deposit_data_root: '0x7f7f280756b8d5fe06ae922e5a20afb708c0f00d8954caede4c262795d956c01',
|
|
147
147
|
signature: '0x121234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012000000000000000000',
|
|
148
148
|
amount: '32000000000000000000',
|
|
149
149
|
},
|
|
150
150
|
{
|
|
151
151
|
pubkey: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdcd',
|
|
152
152
|
withdrawal_credentials: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd',
|
|
153
|
-
deposit_data_root:
|
|
153
|
+
deposit_data_root: '0x7f7f280756b8d5fe06ae922e5a20afb708c0f00d8954caede4c262795d956c01',
|
|
154
154
|
signature: '0x121234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012000000000000000000',
|
|
155
155
|
amount: '16000000000000000000',
|
|
156
156
|
},
|
package/dist/esm/package.json
CHANGED
|
@@ -143,19 +143,12 @@ export const verifyDVV1X8 = (clusterLock) => {
|
|
|
143
143
|
}
|
|
144
144
|
// Check deposit amounts match exactly if they are defined
|
|
145
145
|
const depositAmounts = clusterLock.cluster_definition.deposit_amounts;
|
|
146
|
-
if (depositAmounts !== null) {
|
|
146
|
+
if (!!depositAmounts && depositAmounts !== null) {
|
|
147
147
|
const partialDepositAmounts = validator.partial_deposit_data.map(d => d.amount);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const sortedDepositAmounts = [...depositAmounts]
|
|
153
|
-
.map(Number)
|
|
154
|
-
.sort((a, b) => a - b);
|
|
155
|
-
const sortedPartialAmounts = [...partialDepositAmounts]
|
|
156
|
-
.map(Number)
|
|
157
|
-
.sort((a, b) => a - b);
|
|
158
|
-
if (!sortedDepositAmounts.every((amount, index) => amount === sortedPartialAmounts[index])) {
|
|
148
|
+
// Check that partialDepositAmounts includes all unique elements of depositAmounts
|
|
149
|
+
const uniqueDepositAmounts = [...new Set(depositAmounts.map(Number))];
|
|
150
|
+
const partialAmountsSet = new Set(partialDepositAmounts.map(Number));
|
|
151
|
+
if (!uniqueDepositAmounts.every(amount => partialAmountsSet.has(amount))) {
|
|
159
152
|
return false;
|
|
160
153
|
}
|
|
161
154
|
}
|
|
@@ -99,7 +99,7 @@ describe('EOA', () => {
|
|
|
99
99
|
{
|
|
100
100
|
pubkey: '0x123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456',
|
|
101
101
|
withdrawal_credentials: '0x1234567890123456789012345678901234567890123456789012345678901234',
|
|
102
|
-
deposit_data_root:
|
|
102
|
+
deposit_data_root: '0x7f7f280756b8d5fe06ae922e5a20afb708c0f00d8954caede4c262795d956c01',
|
|
103
103
|
signature: '0x121234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012000000000000000000',
|
|
104
104
|
amount: '32000000000000000000', // 32 ETH in wei
|
|
105
105
|
},
|
|
@@ -141,14 +141,14 @@ describe('EOA', () => {
|
|
|
141
141
|
{
|
|
142
142
|
pubkey: '0x123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456',
|
|
143
143
|
withdrawal_credentials: '0x1234567890123456789012345678901234567890123456789012345678901234',
|
|
144
|
-
deposit_data_root:
|
|
144
|
+
deposit_data_root: '0x7f7f280756b8d5fe06ae922e5a20afb708c0f00d8954caede4c262795d956c01',
|
|
145
145
|
signature: '0x121234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012000000000000000000',
|
|
146
146
|
amount: '32000000000000000000',
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
pubkey: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdcd',
|
|
150
150
|
withdrawal_credentials: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcd',
|
|
151
|
-
deposit_data_root:
|
|
151
|
+
deposit_data_root: '0x7f7f280756b8d5fe06ae922e5a20afb708c0f00d8954caede4c262795d956c01',
|
|
152
152
|
signature: '0x121234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012000000000000000000',
|
|
153
153
|
amount: '16000000000000000000',
|
|
154
154
|
},
|
package/package.json
CHANGED
|
@@ -253,24 +253,17 @@ export const verifyDVV1X8 = (clusterLock: ClusterLock): boolean => {
|
|
|
253
253
|
|
|
254
254
|
// Check deposit amounts match exactly if they are defined
|
|
255
255
|
const depositAmounts = clusterLock.cluster_definition.deposit_amounts;
|
|
256
|
-
if (depositAmounts !== null) {
|
|
256
|
+
if (!!depositAmounts && depositAmounts !== null) {
|
|
257
257
|
const partialDepositAmounts = (
|
|
258
258
|
validator.partial_deposit_data as DepositData[]
|
|
259
259
|
).map(d => d.amount);
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
.map(Number)
|
|
266
|
-
.sort((a, b) => a - b);
|
|
267
|
-
const sortedPartialAmounts = [...partialDepositAmounts]
|
|
268
|
-
.map(Number)
|
|
269
|
-
.sort((a, b) => a - b);
|
|
260
|
+
|
|
261
|
+
// Check that partialDepositAmounts includes all unique elements of depositAmounts
|
|
262
|
+
const uniqueDepositAmounts = [...new Set(depositAmounts.map(Number))];
|
|
263
|
+
const partialAmountsSet = new Set(partialDepositAmounts.map(Number));
|
|
264
|
+
|
|
270
265
|
if (
|
|
271
|
-
!
|
|
272
|
-
(amount, index) => amount === sortedPartialAmounts[index],
|
|
273
|
-
)
|
|
266
|
+
!uniqueDepositAmounts.every(amount => partialAmountsSet.has(amount))
|
|
274
267
|
) {
|
|
275
268
|
return false;
|
|
276
269
|
}
|