@lodestar/state-transition 1.26.0-dev.3eef8ea470 → 1.26.0-dev.d584aed680

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.
@@ -7,5 +7,5 @@ import { CachedBeaconStateAllForks } from "../types.js";
7
7
  * PERF: Work depends on number of VoluntaryExit per block. On regular networks the average is 0 / block.
8
8
  */
9
9
  export declare function processVoluntaryExit(fork: ForkSeq, state: CachedBeaconStateAllForks, signedVoluntaryExit: phase0.SignedVoluntaryExit, verifySignature?: boolean): void;
10
- export declare function isValidVoluntaryExit(state: CachedBeaconStateAllForks, signedVoluntaryExit: phase0.SignedVoluntaryExit, verifySignature?: boolean): boolean;
10
+ export declare function isValidVoluntaryExit(fork: ForkSeq, state: CachedBeaconStateAllForks, signedVoluntaryExit: phase0.SignedVoluntaryExit, verifySignature?: boolean): boolean;
11
11
  //# sourceMappingURL=processVoluntaryExit.d.ts.map
@@ -8,16 +8,13 @@ import { initiateValidatorExit } from "./index.js";
8
8
  * PERF: Work depends on number of VoluntaryExit per block. On regular networks the average is 0 / block.
9
9
  */
10
10
  export function processVoluntaryExit(fork, state, signedVoluntaryExit, verifySignature = true) {
11
- const isValidExit = fork >= ForkSeq.electra
12
- ? isValidVoluntaryExitElectra(state, signedVoluntaryExit, verifySignature)
13
- : isValidVoluntaryExit(state, signedVoluntaryExit, verifySignature);
14
- if (!isValidExit) {
11
+ if (!isValidVoluntaryExit(fork, state, signedVoluntaryExit, verifySignature)) {
15
12
  throw Error(`Invalid voluntary exit at forkSeq=${fork}`);
16
13
  }
17
14
  const validator = state.validators.get(signedVoluntaryExit.message.validatorIndex);
18
15
  initiateValidatorExit(fork, state, validator);
19
16
  }
20
- export function isValidVoluntaryExit(state, signedVoluntaryExit, verifySignature = true) {
17
+ export function isValidVoluntaryExit(fork, state, signedVoluntaryExit, verifySignature = true) {
21
18
  const { config, epochCtx } = state;
22
19
  const voluntaryExit = signedVoluntaryExit.message;
23
20
  const validator = state.validators.get(voluntaryExit.validatorIndex);
@@ -31,14 +28,12 @@ export function isValidVoluntaryExit(state, signedVoluntaryExit, verifySignature
31
28
  currentEpoch >= voluntaryExit.epoch &&
32
29
  // verify the validator had been active long enough
33
30
  currentEpoch >= validator.activationEpoch + config.SHARD_COMMITTEE_PERIOD &&
31
+ (fork >= ForkSeq.electra
32
+ ? // only exit validator if it has no pending withdrawals in the queue
33
+ getPendingBalanceToWithdraw(state, voluntaryExit.validatorIndex) === 0
34
+ : // there are no pending withdrawals in previous forks
35
+ true) &&
34
36
  // verify signature
35
37
  (!verifySignature || verifyVoluntaryExitSignature(state, signedVoluntaryExit)));
36
38
  }
37
- function isValidVoluntaryExitElectra(state, signedVoluntaryExit, verifySignature = true) {
38
- // only exit validator if it has no pending withdrawals in the queue (post-Electra only)
39
- if (getPendingBalanceToWithdraw(state, signedVoluntaryExit.message.validatorIndex) === 0) {
40
- return isValidVoluntaryExit(state, signedVoluntaryExit, verifySignature);
41
- }
42
- return false;
43
- }
44
39
  //# sourceMappingURL=processVoluntaryExit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"processVoluntaryExit.js","sourceRoot":"","sources":["../../src/block/processVoluntaryExit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAC,4BAA4B,EAAC,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAC,2BAA2B,EAAE,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAC,qBAAqB,EAAC,MAAM,YAAY,CAAC;AAEjD;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAa,EACb,KAAgC,EAChC,mBAA+C,EAC/C,eAAe,GAAG,IAAI;IAEtB,MAAM,WAAW,GACf,IAAI,IAAI,OAAO,CAAC,OAAO;QACrB,CAAC,CAAC,2BAA2B,CAAC,KAAiC,EAAE,mBAAmB,EAAE,eAAe,CAAC;Q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Q,CAAC,KAAK,CAAC;IAEpC,OAAO;IACL,iCAAiC;IACjC,iBAAiB,CAAC,SAAS,EAAE,YAAY,CAAC;QAC1C,qCAAqC;QACrC,SAAS,CAAC,SAAS,KAAK,gBAAgB;QACxC,qFAAqF;QACrF,YAAY,IAAI,aAAa,CAAC,KAAK;QACnC,mDAAmD;QACnD,YAAY,IAAI,SAAS,CAAC,eAAe,GAAG,MAAM,CAAC,sBAAsB;QACzE,CAAC,IAAI,IAAI,OAAO,CAAC,OAAO;YACtB,CAAC,CAAC,oEAAoE;gBACpE,2BAA2B,CAAC,KAAiC,EAAE,aAAa,CAAC,cAAc,CAAC,KAAK,CAAC;YACpG,CAAC,CAAC,qDAAqD;gBACrD,IAAI,CAAC;QACT,mBAAmB;QACnB,CAAC,CAAC,eAAe,IAAI,4BAA4B,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAC/E,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/ChainSafe/lodestar/issues"
13
13
  },
14
- "version": "1.26.0-dev.3eef8ea470",
14
+ "version": "1.26.0-dev.d584aed680",
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
@@ -65,10 +65,10 @@
65
65
  "@chainsafe/pubkey-index-map": "2.0.0",
66
66
  "@chainsafe/ssz": "^0.19.1",
67
67
  "@chainsafe/swap-or-not-shuffle": "^0.0.2",
68
- "@lodestar/config": "1.26.0-dev.3eef8ea470",
69
- "@lodestar/params": "1.26.0-dev.3eef8ea470",
70
- "@lodestar/types": "1.26.0-dev.3eef8ea470",
71
- "@lodestar/utils": "1.26.0-dev.3eef8ea470",
68
+ "@lodestar/config": "1.26.0-dev.d584aed680",
69
+ "@lodestar/params": "1.26.0-dev.d584aed680",
70
+ "@lodestar/types": "1.26.0-dev.d584aed680",
71
+ "@lodestar/utils": "1.26.0-dev.d584aed680",
72
72
  "bigint-buffer": "^1.1.5"
73
73
  },
74
74
  "keywords": [
@@ -77,5 +77,5 @@
77
77
  "beacon",
78
78
  "blockchain"
79
79
  ],
80
- "gitHead": "96956722ea8eae21d4b621ae08d1c34e816da135"
80
+ "gitHead": "552604a7db9c42f4b66337f2decd69f979ab202d"
81
81
  }