@lodestar/state-transition 1.43.0-dev.549a5b8115 → 1.43.0-dev.5adb1cab7b

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.
Files changed (44) hide show
  1. package/lib/block/processConsolidationRequest.d.ts.map +1 -1
  2. package/lib/block/processConsolidationRequest.js +2 -1
  3. package/lib/block/processConsolidationRequest.js.map +1 -1
  4. package/lib/block/processParentExecutionPayload.d.ts +2 -2
  5. package/lib/block/processParentExecutionPayload.js +3 -3
  6. package/lib/block/processWithdrawals.d.ts.map +1 -1
  7. package/lib/block/processWithdrawals.js +2 -4
  8. package/lib/block/processWithdrawals.js.map +1 -1
  9. package/lib/cache/epochCache.js +3 -3
  10. package/lib/cache/epochCache.js.map +1 -1
  11. package/lib/epoch/processPendingDeposits.d.ts.map +1 -1
  12. package/lib/epoch/processPendingDeposits.js +4 -2
  13. package/lib/epoch/processPendingDeposits.js.map +1 -1
  14. package/lib/slot/upgradeStateToElectra.d.ts.map +1 -1
  15. package/lib/slot/upgradeStateToElectra.js +2 -2
  16. package/lib/slot/upgradeStateToElectra.js.map +1 -1
  17. package/lib/stateView/beaconStateView.d.ts +2 -2
  18. package/lib/stateView/beaconStateView.d.ts.map +1 -1
  19. package/lib/stateView/beaconStateView.js +9 -7
  20. package/lib/stateView/beaconStateView.js.map +1 -1
  21. package/lib/stateView/interface.d.ts +5 -4
  22. package/lib/stateView/interface.d.ts.map +1 -1
  23. package/lib/stateView/interface.js.map +1 -1
  24. package/lib/util/epoch.d.ts.map +1 -1
  25. package/lib/util/epoch.js +6 -4
  26. package/lib/util/epoch.js.map +1 -1
  27. package/lib/util/loadState/loadState.js +4 -4
  28. package/lib/util/loadState/loadState.js.map +1 -1
  29. package/lib/util/validator.d.ts +14 -2
  30. package/lib/util/validator.d.ts.map +1 -1
  31. package/lib/util/validator.js +24 -2
  32. package/lib/util/validator.js.map +1 -1
  33. package/package.json +8 -8
  34. package/src/block/processConsolidationRequest.ts +2 -1
  35. package/src/block/processParentExecutionPayload.ts +3 -3
  36. package/src/block/processWithdrawals.ts +2 -4
  37. package/src/cache/epochCache.ts +3 -3
  38. package/src/epoch/processPendingDeposits.ts +5 -2
  39. package/src/slot/upgradeStateToElectra.ts +4 -2
  40. package/src/stateView/beaconStateView.ts +11 -8
  41. package/src/stateView/interface.ts +5 -4
  42. package/src/util/epoch.ts +13 -4
  43. package/src/util/loadState/loadState.ts +4 -4
  44. package/src/util/validator.ts +42 -2
@@ -44,7 +44,12 @@ export function getActiveValidatorIndices(state: BeaconStateAllForks, epoch: Epo
44
44
  return new Uint32Array(indices);
45
45
  }
46
46
 
47
- export function getActivationChurnLimit(config: ChainForkConfig, fork: ForkSeq, activeValidatorCount: number): number {
47
+ // Deneb fork upgrade only
48
+ export function getValidatorActivationChurnLimit(
49
+ config: ChainForkConfig,
50
+ fork: ForkSeq,
51
+ activeValidatorCount: number
52
+ ): number {
48
53
  if (fork >= ForkSeq.deneb) {
49
54
  return Math.min(config.MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT, getChurnLimit(config, activeValidatorCount));
50
55
  }
@@ -84,7 +89,42 @@ export function getActivationExitChurnLimit(epochCtx: EpochCache): number {
84
89
  return Math.min(epochCtx.config.MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT, getBalanceChurnLimitFromCache(epochCtx));
85
90
  }
86
91
 
87
- export function getConsolidationChurnLimit(epochCtx: EpochCache): number {
92
+ /**
93
+ * https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-get_activation_churn_limit
94
+ */
95
+ export function getActivationChurnLimit(epochCtx: EpochCache): number {
96
+ const churn = getBalanceChurnLimit(
97
+ epochCtx.totalActiveBalanceIncrements,
98
+ epochCtx.config.CHURN_LIMIT_QUOTIENT_GLOAS,
99
+ epochCtx.config.MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA
100
+ );
101
+ return Math.min(epochCtx.config.MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT_GLOAS, churn);
102
+ }
103
+
104
+ /**
105
+ * https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-get_exit_churn_limit
106
+ */
107
+ export function getExitChurnLimit(epochCtx: EpochCache): number {
108
+ return getBalanceChurnLimit(
109
+ epochCtx.totalActiveBalanceIncrements,
110
+ epochCtx.config.CHURN_LIMIT_QUOTIENT_GLOAS,
111
+ epochCtx.config.MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA
112
+ );
113
+ }
114
+
115
+ /**
116
+ * Spec (electra): get_consolidation_churn_limit (uses combined balance churn minus activation+exit churn)
117
+ * Spec (gloas): get_consolidation_churn_limit (independent quotient, no MIN floor)
118
+ */
119
+ export function getConsolidationChurnLimit(fork: ForkSeq, epochCtx: EpochCache): number {
120
+ if (fork >= ForkSeq.gloas) {
121
+ // No MIN floor — pass 0 so getBalanceChurnLimit's max(churn, min) is a no-op.
122
+ return getBalanceChurnLimit(
123
+ epochCtx.totalActiveBalanceIncrements,
124
+ epochCtx.config.CONSOLIDATION_CHURN_LIMIT_QUOTIENT,
125
+ 0
126
+ );
127
+ }
88
128
  return getBalanceChurnLimitFromCache(epochCtx) - getActivationExitChurnLimit(epochCtx);
89
129
  }
90
130