@lodestar/state-transition 1.43.0-dev.4358217e12 → 1.43.0-dev.4451fec75a
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/lib/block/processConsolidationRequest.d.ts.map +1 -1
- package/lib/block/processConsolidationRequest.js +2 -1
- package/lib/block/processConsolidationRequest.js.map +1 -1
- package/lib/block/processParentExecutionPayload.d.ts +2 -2
- package/lib/block/processParentExecutionPayload.js +3 -3
- package/lib/block/processWithdrawals.d.ts.map +1 -1
- package/lib/block/processWithdrawals.js +2 -4
- package/lib/block/processWithdrawals.js.map +1 -1
- package/lib/cache/epochCache.js +3 -3
- package/lib/cache/epochCache.js.map +1 -1
- package/lib/epoch/processPendingDeposits.d.ts.map +1 -1
- package/lib/epoch/processPendingDeposits.js +4 -2
- package/lib/epoch/processPendingDeposits.js.map +1 -1
- package/lib/lightClient/spec/index.d.ts +22 -0
- package/lib/lightClient/spec/index.d.ts.map +1 -0
- package/lib/lightClient/spec/index.js +58 -0
- package/lib/lightClient/spec/index.js.map +1 -0
- package/lib/lightClient/spec/isBetterUpdate.d.ts +23 -0
- package/lib/lightClient/spec/isBetterUpdate.d.ts.map +1 -0
- package/lib/lightClient/spec/isBetterUpdate.js +66 -0
- package/lib/lightClient/spec/isBetterUpdate.js.map +1 -0
- package/lib/lightClient/spec/processLightClientUpdate.d.ts +12 -0
- package/lib/lightClient/spec/processLightClientUpdate.d.ts.map +1 -0
- package/lib/lightClient/spec/processLightClientUpdate.js +80 -0
- package/lib/lightClient/spec/processLightClientUpdate.js.map +1 -0
- package/lib/lightClient/spec/store.d.ts +45 -0
- package/lib/lightClient/spec/store.d.ts.map +1 -0
- package/lib/lightClient/spec/store.js +56 -0
- package/lib/lightClient/spec/store.js.map +1 -0
- package/lib/lightClient/spec/utils.d.ts +47 -0
- package/lib/lightClient/spec/utils.d.ts.map +1 -0
- package/lib/lightClient/spec/utils.js +197 -0
- package/lib/lightClient/spec/utils.js.map +1 -0
- package/lib/lightClient/spec/validateLightClientBootstrap.d.ts +4 -0
- package/lib/lightClient/spec/validateLightClientBootstrap.d.ts.map +1 -0
- package/lib/lightClient/spec/validateLightClientBootstrap.js +22 -0
- package/lib/lightClient/spec/validateLightClientBootstrap.js.map +1 -0
- package/lib/lightClient/spec/validateLightClientUpdate.d.ts +5 -0
- package/lib/lightClient/spec/validateLightClientUpdate.d.ts.map +1 -0
- package/lib/lightClient/spec/validateLightClientUpdate.js +88 -0
- package/lib/lightClient/spec/validateLightClientUpdate.js.map +1 -0
- package/lib/slot/upgradeStateToElectra.d.ts.map +1 -1
- package/lib/slot/upgradeStateToElectra.js +2 -2
- package/lib/slot/upgradeStateToElectra.js.map +1 -1
- package/lib/stateView/beaconStateView.d.ts +14 -5
- package/lib/stateView/beaconStateView.d.ts.map +1 -1
- package/lib/stateView/beaconStateView.js +40 -11
- package/lib/stateView/beaconStateView.js.map +1 -1
- package/lib/stateView/interface.d.ts +7 -5
- package/lib/stateView/interface.d.ts.map +1 -1
- package/lib/stateView/interface.js.map +1 -1
- package/lib/util/epoch.d.ts.map +1 -1
- package/lib/util/epoch.js +6 -4
- package/lib/util/epoch.js.map +1 -1
- package/lib/util/loadState/loadState.js +4 -4
- package/lib/util/loadState/loadState.js.map +1 -1
- package/lib/util/validator.d.ts +14 -2
- package/lib/util/validator.d.ts.map +1 -1
- package/lib/util/validator.js +24 -2
- package/lib/util/validator.js.map +1 -1
- package/package.json +13 -8
- package/src/block/processConsolidationRequest.ts +2 -1
- package/src/block/processParentExecutionPayload.ts +3 -3
- package/src/block/processWithdrawals.ts +2 -4
- package/src/cache/epochCache.ts +3 -3
- package/src/epoch/processPendingDeposits.ts +5 -2
- package/src/lightClient/spec/index.ts +101 -0
- package/src/lightClient/spec/isBetterUpdate.ts +94 -0
- package/src/lightClient/spec/processLightClientUpdate.ts +119 -0
- package/src/lightClient/spec/store.ts +106 -0
- package/src/lightClient/spec/utils.ts +317 -0
- package/src/lightClient/spec/validateLightClientBootstrap.ts +39 -0
- package/src/lightClient/spec/validateLightClientUpdate.ts +145 -0
- package/src/slot/upgradeStateToElectra.ts +4 -2
- package/src/stateView/beaconStateView.ts +43 -12
- package/src/stateView/interface.ts +7 -5
- package/src/util/epoch.ts +13 -4
- package/src/util/loadState/loadState.ts +4 -4
- package/src/util/validator.ts +42 -2
|
@@ -110,8 +110,8 @@ function loadInactivityScores(
|
|
|
110
110
|
seedState: BeaconStateAltair,
|
|
111
111
|
inactivityScoresBytes: Uint8Array
|
|
112
112
|
): void {
|
|
113
|
-
//
|
|
114
|
-
migratedState.inactivityScores = seedState.inactivityScores.clone();
|
|
113
|
+
// true = do not transfer cache
|
|
114
|
+
migratedState.inactivityScores = seedState.inactivityScores.clone(true);
|
|
115
115
|
const oldValidator = migratedState.inactivityScores.length;
|
|
116
116
|
// UintNum64 = 8 bytes
|
|
117
117
|
const newValidator = inactivityScoresBytes.length / 8;
|
|
@@ -187,8 +187,8 @@ function loadValidators(
|
|
|
187
187
|
const newValidatorCount = Math.floor(newValidatorsBytes.length / VALIDATOR_BYTES_SIZE);
|
|
188
188
|
const isMoreValidator = newValidatorCount >= seedValidatorCount;
|
|
189
189
|
const minValidatorCount = Math.min(seedValidatorCount, newValidatorCount);
|
|
190
|
-
//
|
|
191
|
-
migratedState.validators = seedState.validators.clone();
|
|
190
|
+
// true = do not transfer cache
|
|
191
|
+
migratedState.validators = seedState.validators.clone(true);
|
|
192
192
|
// 80% of validators serialization time comes from memory allocation
|
|
193
193
|
// seedStateValidatorsBytes is an optimization at beacon-node side to avoid memory allocation here
|
|
194
194
|
const seedValidatorsBytes = seedStateValidatorsBytes ?? seedState.validators.serialize();
|
package/src/util/validator.ts
CHANGED
|
@@ -44,7 +44,12 @@ export function getActiveValidatorIndices(state: BeaconStateAllForks, epoch: Epo
|
|
|
44
44
|
return new Uint32Array(indices);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
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
|
-
|
|
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
|
|