@lodestar/state-transition 1.43.0-dev.9c8becae00 → 1.43.0-dev.9f5db5b9c7
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/index.d.ts +2 -2
- package/lib/block/index.d.ts.map +1 -1
- package/lib/block/index.js +11 -4
- package/lib/block/index.js.map +1 -1
- 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 +20 -0
- package/lib/block/processParentExecutionPayload.d.ts.map +1 -0
- package/lib/block/processParentExecutionPayload.js +100 -0
- package/lib/block/processParentExecutionPayload.js.map +1 -0
- package/lib/block/processWithdrawals.d.ts.map +1 -1
- package/lib/block/processWithdrawals.js +10 -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/signatureSets/executionPayloadEnvelope.js +1 -1
- package/lib/signatureSets/executionPayloadEnvelope.js.map +1 -1
- package/lib/signatureSets/index.d.ts +1 -0
- package/lib/signatureSets/index.d.ts.map +1 -1
- package/lib/signatureSets/index.js +1 -0
- package/lib/signatureSets/index.js.map +1 -1
- package/lib/signatureSets/proposerPreferences.d.ts +4 -0
- package/lib/signatureSets/proposerPreferences.d.ts.map +1 -0
- package/lib/signatureSets/proposerPreferences.js +8 -0
- package/lib/signatureSets/proposerPreferences.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/slot/upgradeStateToGloas.d.ts.map +1 -1
- package/lib/slot/upgradeStateToGloas.js +1 -0
- package/lib/slot/upgradeStateToGloas.js.map +1 -1
- package/lib/stateView/beaconStateView.d.ts +12 -4
- package/lib/stateView/beaconStateView.d.ts.map +1 -1
- package/lib/stateView/beaconStateView.js +37 -12
- package/lib/stateView/beaconStateView.js.map +1 -1
- package/lib/stateView/interface.d.ts +13 -3
- package/lib/stateView/interface.d.ts.map +1 -1
- package/lib/stateView/interface.js.map +1 -1
- package/lib/util/computeAnchorCheckpoint.d.ts +1 -1
- package/lib/util/computeAnchorCheckpoint.d.ts.map +1 -1
- package/lib/util/computeAnchorCheckpoint.js +6 -19
- package/lib/util/computeAnchorCheckpoint.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/gloas.d.ts +0 -1
- package/lib/util/gloas.d.ts.map +1 -1
- package/lib/util/gloas.js +0 -3
- package/lib/util/gloas.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 +7 -7
- package/src/block/index.ts +12 -4
- package/src/block/processConsolidationRequest.ts +2 -1
- package/src/block/processParentExecutionPayload.ts +116 -0
- package/src/block/processWithdrawals.ts +12 -4
- package/src/cache/epochCache.ts +3 -3
- package/src/epoch/processPendingDeposits.ts +5 -2
- package/src/signatureSets/executionPayloadEnvelope.ts +1 -1
- package/src/signatureSets/index.ts +1 -0
- package/src/signatureSets/proposerPreferences.ts +12 -0
- package/src/slot/upgradeStateToElectra.ts +4 -2
- package/src/slot/upgradeStateToGloas.ts +3 -0
- package/src/stateView/beaconStateView.ts +45 -21
- package/src/stateView/interface.ts +15 -6
- package/src/util/computeAnchorCheckpoint.ts +6 -19
- package/src/util/epoch.ts +13 -4
- package/src/util/gloas.ts +0 -4
- package/src/util/validator.ts +42 -2
- package/lib/block/processExecutionPayloadEnvelope.d.ts +0 -9
- package/lib/block/processExecutionPayloadEnvelope.d.ts.map +0 -1
- package/lib/block/processExecutionPayloadEnvelope.js +0 -106
- package/lib/block/processExecutionPayloadEnvelope.js.map +0 -1
- package/src/block/processExecutionPayloadEnvelope.ts +0 -175
package/lib/util/gloas.d.ts
CHANGED
|
@@ -48,7 +48,6 @@ export declare function initiateBuilderExit(state: CachedBeaconStateGloas, build
|
|
|
48
48
|
export declare function findBuilderIndexByPubkey(state: CachedBeaconStateGloas, pubkey: Uint8Array): BuilderIndex | null;
|
|
49
49
|
export declare function isAttestationSameSlot(state: CachedBeaconStateGloas, data: AttestationData): boolean;
|
|
50
50
|
export declare function isAttestationSameSlotRootCache(rootCache: RootCache, data: AttestationData): boolean;
|
|
51
|
-
export declare function isParentBlockFull(state: CachedBeaconStateGloas): boolean;
|
|
52
51
|
export declare function initializePtcWindow(state: CachedBeaconStateFulu): Uint32Array[];
|
|
53
52
|
export declare function getPtcWindowEpochCacheData(state: CachedBeaconStateGloas): {
|
|
54
53
|
previousPayloadTimelinessCommittees: Uint32Array[];
|
package/lib/util/gloas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gloas.d.ts","sourceRoot":"","sources":["../../src/util/gloas.ts"],"names":[],"mappings":"AAYA,OAAO,EAAC,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAC,qBAAqB,EAAE,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAI1E,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAIzC,wBAAgB,6BAA6B,CAAC,qBAAqB,EAAE,UAAU,GAAG,OAAO,CAExF;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAMtF;AAOD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAG9D;AAED;;;GAG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B,CAAC,KAAK,EAAE,sBAAsB,GAAG;IACzE,mCAAmC,EAAE,WAAW,EAAE,CAAC;IACnD,2BAA2B,EAAE,WAAW,EAAE,CAAC;IAC3C,+BAA+B,EAAE,WAAW,EAAE,CAAC;CAChD,CAaA"}
|
package/lib/util/gloas.js
CHANGED
|
@@ -125,9 +125,6 @@ export function isAttestationSameSlotRootCache(rootCache, data) {
|
|
|
125
125
|
const isCurrentBlockRoot = !byteArrayEquals(data.beaconBlockRoot, rootCache.getBlockRootAtSlot(data.slot - 1));
|
|
126
126
|
return isMatchingBlockRoot && isCurrentBlockRoot;
|
|
127
127
|
}
|
|
128
|
-
export function isParentBlockFull(state) {
|
|
129
|
-
return byteArrayEquals(state.latestExecutionPayloadBid.blockHash, state.latestBlockHash);
|
|
130
|
-
}
|
|
131
128
|
export function initializePtcWindow(state) {
|
|
132
129
|
const ptcWindow = Array.from({ length: SLOTS_PER_EPOCH }, () => new Uint32Array(PTC_SIZE));
|
|
133
130
|
const currentEpoch = state.epochCtx.epoch;
|
package/lib/util/gloas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gloas.js","sourceRoot":"","sources":["../../src/util/gloas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,qCAAqC,EACrC,mCAAmC,EACnC,yBAAyB,EACzB,2BAA2B,EAC3B,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAC,0CAA0C,EAAC,MAAM,WAAW,CAAC;AACrE,OAAO,EAAC,yBAAyB,EAA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,KAA6B,EAItE;IACA,MAAM,cAAc,GAAG,CAAC,KAA4D,EAAE,EAAE,CACtF,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAEjD,MAAM,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;IACjF,MAAM,gBAAgB,GAAG,KAAK,CAAC,SAAS,CAAC,kBAAkB,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;IAC9F,MAAM,aAAa,GAAG,KAAK,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,GAAG,eAAe,EAAE,eAAe,CAAC,CAAC;IAE/F,OAAO;QACL,mCAAmC,EAAE,cAAc,CAAC,iBAAiB,CAAC;QACtE,2BAA2B,EAAE,cAAc,CAAC,gBAAgB,CAAC;QAC7D,+BAA+B,EAAE,cAAc,CAAC,aAAa,CAAC;KAC/D,CAAC;AAAA,CACH"}
|
package/lib/util/validator.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare function isSlashableValidator(validator: phase0.Validator, epoch:
|
|
|
16
16
|
* NAIVE - SLOW CODE 🐢
|
|
17
17
|
*/
|
|
18
18
|
export declare function getActiveValidatorIndices(state: BeaconStateAllForks, epoch: Epoch): Uint32Array;
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function getValidatorActivationChurnLimit(config: ChainForkConfig, fork: ForkSeq, activeValidatorCount: number): number;
|
|
20
20
|
export declare function getChurnLimit(config: ChainForkConfig, activeValidatorCount: number): number;
|
|
21
21
|
/**
|
|
22
22
|
* Get combined churn limit of activation-exit and consolidation
|
|
@@ -24,7 +24,19 @@ export declare function getChurnLimit(config: ChainForkConfig, activeValidatorCo
|
|
|
24
24
|
export declare function getBalanceChurnLimit(totalActiveBalanceIncrements: number, churnLimitQuotient: number, minPerEpochChurnLimit: number): number;
|
|
25
25
|
export declare function getBalanceChurnLimitFromCache(epochCtx: EpochCache): number;
|
|
26
26
|
export declare function getActivationExitChurnLimit(epochCtx: EpochCache): number;
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-get_activation_churn_limit
|
|
29
|
+
*/
|
|
30
|
+
export declare function getActivationChurnLimit(epochCtx: EpochCache): number;
|
|
31
|
+
/**
|
|
32
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-get_exit_churn_limit
|
|
33
|
+
*/
|
|
34
|
+
export declare function getExitChurnLimit(epochCtx: EpochCache): number;
|
|
35
|
+
/**
|
|
36
|
+
* Spec (electra): get_consolidation_churn_limit (uses combined balance churn minus activation+exit churn)
|
|
37
|
+
* Spec (gloas): get_consolidation_churn_limit (independent quotient, no MIN floor)
|
|
38
|
+
*/
|
|
39
|
+
export declare function getConsolidationChurnLimit(fork: ForkSeq, epochCtx: EpochCache): number;
|
|
28
40
|
export declare function getMaxEffectiveBalance(withdrawalCredentials: Uint8Array): number;
|
|
29
41
|
/**
|
|
30
42
|
* Check if validator is partially withdrawable.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/util/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAEL,OAAO,EAIR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EAAC,mBAAmB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AAI9G;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,OA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,GAC5B,MAAM,CAQR;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAM1E;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAExE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAOpE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAM9D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,GAAG,MAAM,CAUtF;AAED,wBAAgB,sBAAsB,CAAC,qBAAqB,EAAE,UAAU,GAAG,MAAM,CAMhF;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAsBrH;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,wBAAwB,GAAG,sBAAsB,EACxD,cAAc,EAAE,cAAc,GAC7B,MAAM,CASR"}
|
package/lib/util/validator.js
CHANGED
|
@@ -29,7 +29,8 @@ export function getActiveValidatorIndices(state, epoch) {
|
|
|
29
29
|
}
|
|
30
30
|
return new Uint32Array(indices);
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
// Deneb fork upgrade only
|
|
33
|
+
export function getValidatorActivationChurnLimit(config, fork, activeValidatorCount) {
|
|
33
34
|
if (fork >= ForkSeq.deneb) {
|
|
34
35
|
return Math.min(config.MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT, getChurnLimit(config, activeValidatorCount));
|
|
35
36
|
}
|
|
@@ -52,7 +53,28 @@ export function getBalanceChurnLimitFromCache(epochCtx) {
|
|
|
52
53
|
export function getActivationExitChurnLimit(epochCtx) {
|
|
53
54
|
return Math.min(epochCtx.config.MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT, getBalanceChurnLimitFromCache(epochCtx));
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
+
/**
|
|
57
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-get_activation_churn_limit
|
|
58
|
+
*/
|
|
59
|
+
export function getActivationChurnLimit(epochCtx) {
|
|
60
|
+
const churn = getBalanceChurnLimit(epochCtx.totalActiveBalanceIncrements, epochCtx.config.CHURN_LIMIT_QUOTIENT_GLOAS, epochCtx.config.MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA);
|
|
61
|
+
return Math.min(epochCtx.config.MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT_GLOAS, churn);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-get_exit_churn_limit
|
|
65
|
+
*/
|
|
66
|
+
export function getExitChurnLimit(epochCtx) {
|
|
67
|
+
return getBalanceChurnLimit(epochCtx.totalActiveBalanceIncrements, epochCtx.config.CHURN_LIMIT_QUOTIENT_GLOAS, epochCtx.config.MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Spec (electra): get_consolidation_churn_limit (uses combined balance churn minus activation+exit churn)
|
|
71
|
+
* Spec (gloas): get_consolidation_churn_limit (independent quotient, no MIN floor)
|
|
72
|
+
*/
|
|
73
|
+
export function getConsolidationChurnLimit(fork, epochCtx) {
|
|
74
|
+
if (fork >= ForkSeq.gloas) {
|
|
75
|
+
// No MIN floor — pass 0 so getBalanceChurnLimit's max(churn, min) is a no-op.
|
|
76
|
+
return getBalanceChurnLimit(epochCtx.totalActiveBalanceIncrements, epochCtx.config.CONSOLIDATION_CHURN_LIMIT_QUOTIENT, 0);
|
|
77
|
+
}
|
|
56
78
|
return getBalanceChurnLimitFromCache(epochCtx) - getActivationExitChurnLimit(epochCtx);
|
|
57
79
|
}
|
|
58
80
|
export function getMaxEffectiveBalance(withdrawalCredentials) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/util/validator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,OAAO,EACP,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAC,2BAA2B,EAAC,MAAM,cAAc,CAAC;AACzD,OAAO,EAAC,kCAAkC,EAAE,gCAAgC,EAAC,MAAM,cAAc,CAAC;AAElG;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAA2B,EAAE,KAAY,EAAW;IACpF,OAAO,SAAS,CAAC,eAAe,IAAI,KAAK,IAAI,KAAK,GAAG,SAAS,CAAC,SAAS,CAAC;AAAA,CAC1E;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAA2B,EAAE,KAAY,EAAW;IACvF,OAAO,CAAC,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC,eAAe,IAAI,KAAK,IAAI,KAAK,GAAG,SAAS,CAAC,iBAAiB,CAAC;AAAA,CACxG;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAA0B,EAAE,KAAY,EAAe;IAC/F,MAAM,OAAO,GAAqB,EAAE,CAAC;IAErC,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC;IAC9D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,IAAI,iBAAiB,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;YAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC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OAAe,EAAW;IACrH,MAAM,aAAa,GAAG,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IAE9C,+BAA+B;IAC/B,MAAM,0BAA0B,GAAG,aAAa;QAC9C,CAAC,CAAC,gCAAgC,CAAC,SAAS,CAAC,qBAAqB,CAAC;QACnE,CAAC,CAAC,2BAA2B,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;IAEjE,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0CAA0C;IAC1C,MAAM,mBAAmB,GAAG,aAAa;QACvC,CAAC,CAAC,sBAAsB,CAAC,SAAS,CAAC,qBAAqB,CAAC;QACzD,CAAC,CAAC,qBAAqB,CAAC;IAE1B,2DAA2D;IAC3D,MAAM,sBAAsB,GAAG,SAAS,CAAC,gBAAgB,KAAK,mBAAmB,CAAC;IAClF,MAAM,gBAAgB,GAAG,OAAO,GAAG,mBAAmB,CAAC;IAEvD,OAAO,sBAAsB,IAAI,gBAAgB,CAAC;AAAA,CACnD;AAED,MAAM,UAAU,2BAA2B,CACzC,KAAwD,EACxD,cAA8B,EACtB;IACR,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,yBAAyB,CAAC,cAAc,EAAE,EAAE,CAAC;QACpE,IAAI,IAAI,CAAC,cAAc,KAAK,cAAc,EAAE,CAAC;YAC3C,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AAAA,CACd"}
|
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.43.0-dev.
|
|
14
|
+
"version": "1.43.0-dev.9f5db5b9c7",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -67,14 +67,14 @@
|
|
|
67
67
|
"@chainsafe/pubkey-index-map": "^3.0.0",
|
|
68
68
|
"@chainsafe/ssz": "^1.4.0",
|
|
69
69
|
"@chainsafe/swap-or-not-shuffle": "^1.2.1",
|
|
70
|
-
"@lodestar/config": "^1.43.0-dev.
|
|
71
|
-
"@lodestar/params": "^1.43.0-dev.
|
|
72
|
-
"@lodestar/types": "^1.43.0-dev.
|
|
73
|
-
"@lodestar/utils": "^1.43.0-dev.
|
|
70
|
+
"@lodestar/config": "^1.43.0-dev.9f5db5b9c7",
|
|
71
|
+
"@lodestar/params": "^1.43.0-dev.9f5db5b9c7",
|
|
72
|
+
"@lodestar/types": "^1.43.0-dev.9f5db5b9c7",
|
|
73
|
+
"@lodestar/utils": "^1.43.0-dev.9f5db5b9c7",
|
|
74
74
|
"@vekexasia/bigint-buffer2": "^1.1.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@lodestar/api": "^1.43.0-dev.
|
|
77
|
+
"@lodestar/api": "^1.43.0-dev.9f5db5b9c7"
|
|
78
78
|
},
|
|
79
79
|
"keywords": [
|
|
80
80
|
"ethereum",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"beacon",
|
|
83
83
|
"blockchain"
|
|
84
84
|
],
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "cc0d564edd6cd4291493b96f758a240c236d8209"
|
|
86
86
|
}
|
package/src/block/index.ts
CHANGED
|
@@ -14,8 +14,8 @@ import {processBlockHeader} from "./processBlockHeader.js";
|
|
|
14
14
|
import {processEth1Data} from "./processEth1Data.js";
|
|
15
15
|
import {processExecutionPayload} from "./processExecutionPayload.js";
|
|
16
16
|
import {processExecutionPayloadBid} from "./processExecutionPayloadBid.js";
|
|
17
|
-
import {processExecutionPayloadEnvelope} from "./processExecutionPayloadEnvelope.js";
|
|
18
17
|
import {processOperations} from "./processOperations.js";
|
|
18
|
+
import {processParentExecutionPayload} from "./processParentExecutionPayload.js";
|
|
19
19
|
import {processPayloadAttestation} from "./processPayloadAttestation.js";
|
|
20
20
|
import {processRandao} from "./processRandao.js";
|
|
21
21
|
import {processSyncAggregate} from "./processSyncCommittee.js";
|
|
@@ -32,7 +32,7 @@ export {
|
|
|
32
32
|
processWithdrawals,
|
|
33
33
|
processExecutionPayloadBid,
|
|
34
34
|
processPayloadAttestation,
|
|
35
|
-
|
|
35
|
+
processParentExecutionPayload,
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export * from "./externalData.js";
|
|
@@ -51,10 +51,16 @@ export function processBlock(
|
|
|
51
51
|
): void {
|
|
52
52
|
const {verifySignatures = true} = opts ?? {};
|
|
53
53
|
|
|
54
|
+
// Apply the parent's deferred payload effects before everything else. Must run before
|
|
55
|
+
// processBlockHeader and processExecutionPayloadBid so subsequent steps see the updated state.
|
|
56
|
+
if (fork >= ForkSeq.gloas) {
|
|
57
|
+
processParentExecutionPayload(state as CachedBeaconStateGloas, block as BeaconBlock<ForkPostGloas>);
|
|
58
|
+
}
|
|
59
|
+
|
|
54
60
|
processBlockHeader(state, block);
|
|
55
61
|
|
|
56
62
|
if (fork >= ForkSeq.gloas) {
|
|
57
|
-
//
|
|
63
|
+
// Parent payload's execution requests were already applied by processParentExecutionPayload above
|
|
58
64
|
processWithdrawals(fork, state as CachedBeaconStateGloas);
|
|
59
65
|
} else if (fork >= ForkSeq.capella) {
|
|
60
66
|
const fullOrBlindedPayload = getFullOrBlindedPayload(block);
|
|
@@ -67,7 +73,9 @@ export function processBlock(
|
|
|
67
73
|
|
|
68
74
|
// The call to the process_execution_payload must happen before the call to the process_randao as the former depends
|
|
69
75
|
// on the randao_mix computed with the reveal of the previous block.
|
|
70
|
-
//
|
|
76
|
+
// Post-gloas: process_execution_payload is not part of block processing. The parent's payload
|
|
77
|
+
// effects are applied earlier via processParentExecutionPayload, and each execution payload is
|
|
78
|
+
// verified out-of-band via verifyExecutionPayloadEnvelope when it arrives.
|
|
71
79
|
if (
|
|
72
80
|
fork < ForkSeq.gloas &&
|
|
73
81
|
fork >= ForkSeq.bellatrix &&
|
|
@@ -46,7 +46,8 @@ export function processConsolidationRequest(
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// If there is too little available consolidation churn limit, consolidation requests are ignored
|
|
49
|
-
|
|
49
|
+
const fork = state.config.getForkSeq(state.slot);
|
|
50
|
+
if (getConsolidationChurnLimit(fork, state.epochCtx) <= MIN_ACTIVATION_BALANCE) {
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {ForkPostGloas, SLOTS_PER_EPOCH, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
|
|
2
|
+
import {BeaconBlock, electra, ssz} from "@lodestar/types";
|
|
3
|
+
import {byteArrayEquals, toRootHex} from "@lodestar/utils";
|
|
4
|
+
import {CachedBeaconStateGloas} from "../types.js";
|
|
5
|
+
import {computeEpochAtSlot} from "../util/epoch.js";
|
|
6
|
+
import {processConsolidationRequest} from "./processConsolidationRequest.js";
|
|
7
|
+
import {getPendingValidatorPubkeys, processDepositRequest} from "./processDepositRequest.js";
|
|
8
|
+
import {processWithdrawalRequest} from "./processWithdrawalRequest.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Process parent execution payload effects as the first step of processBlock.
|
|
12
|
+
*
|
|
13
|
+
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-process_parent_execution_payload
|
|
14
|
+
*/
|
|
15
|
+
export function processParentExecutionPayload(state: CachedBeaconStateGloas, block: BeaconBlock<ForkPostGloas>): void {
|
|
16
|
+
const bid = block.body.signedExecutionPayloadBid.message;
|
|
17
|
+
const parentBid = state.latestExecutionPayloadBid;
|
|
18
|
+
const requests = block.body.parentExecutionRequests;
|
|
19
|
+
|
|
20
|
+
const isParentBlockFull = byteArrayEquals(bid.parentBlockHash, parentBid.blockHash);
|
|
21
|
+
if (!isParentBlockFull) {
|
|
22
|
+
// Parent was EMPTY -- no execution requests expected
|
|
23
|
+
assertEmptyExecutionRequests(requests);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Parent was FULL -- verify the bid commitment and apply the payload
|
|
28
|
+
const requestsRoot = ssz.electra.ExecutionRequests.hashTreeRoot(requests);
|
|
29
|
+
if (!byteArrayEquals(requestsRoot, parentBid.executionRequestsRoot)) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`Parent execution requests root mismatch actual=${toRootHex(requestsRoot)} expected=${toRootHex(parentBid.executionRequestsRoot)}`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
applyParentExecutionPayload(state, requests);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Process the parent's execution requests, queue the builder payment, update payload availability,
|
|
40
|
+
* and update the latest block hash.
|
|
41
|
+
*
|
|
42
|
+
* Called from processParentExecutionPayload during block processing, and from the validator during
|
|
43
|
+
* block production before computing withdrawals.
|
|
44
|
+
*
|
|
45
|
+
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-apply_parent_execution_payload
|
|
46
|
+
*/
|
|
47
|
+
export function applyParentExecutionPayload(state: CachedBeaconStateGloas, requests: electra.ExecutionRequests): void {
|
|
48
|
+
const fork = state.config.getForkSeq(state.slot);
|
|
49
|
+
const parentBid = state.latestExecutionPayloadBid;
|
|
50
|
+
const parentSlot = parentBid.slot;
|
|
51
|
+
const parentEpoch = computeEpochAtSlot(parentSlot);
|
|
52
|
+
const currentEpoch = computeEpochAtSlot(state.slot);
|
|
53
|
+
|
|
54
|
+
// Process execution requests from parent's payload. The execution
|
|
55
|
+
// requests are processed at state.slot (child's slot), not the parent's slot.
|
|
56
|
+
if (requests.deposits.length > 0) {
|
|
57
|
+
const pendingValidatorPubkeys = getPendingValidatorPubkeys(state.config, state);
|
|
58
|
+
for (const deposit of requests.deposits) {
|
|
59
|
+
processDepositRequest(fork, state, deposit, pendingValidatorPubkeys);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
for (const withdrawal of requests.withdrawals) {
|
|
64
|
+
processWithdrawalRequest(fork, state, withdrawal);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
for (const consolidation of requests.consolidations) {
|
|
68
|
+
processConsolidationRequest(state, consolidation);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Settle the builder payment
|
|
72
|
+
if (parentEpoch === currentEpoch) {
|
|
73
|
+
settleBuilderPayment(state, SLOTS_PER_EPOCH + (parentSlot % SLOTS_PER_EPOCH));
|
|
74
|
+
} else if (parentEpoch === currentEpoch - 1) {
|
|
75
|
+
settleBuilderPayment(state, parentSlot % SLOTS_PER_EPOCH);
|
|
76
|
+
} else if (parentBid.value > 0) {
|
|
77
|
+
// Parent is older than the previous epoch, its payment entry has been evicted from
|
|
78
|
+
// builder_pending_payments. Append the withdrawal directly.
|
|
79
|
+
state.builderPendingWithdrawals.push(
|
|
80
|
+
ssz.gloas.BuilderPendingWithdrawal.toViewDU({
|
|
81
|
+
feeRecipient: parentBid.feeRecipient,
|
|
82
|
+
amount: parentBid.value,
|
|
83
|
+
builderIndex: parentBid.builderIndex,
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Update parent payload availability and latest block hash
|
|
89
|
+
state.executionPayloadAvailability.set(parentSlot % SLOTS_PER_HISTORICAL_ROOT, true);
|
|
90
|
+
state.latestBlockHash = parentBid.blockHash;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Settle a builder payment at the given index: move its withdrawal (if any) to the
|
|
95
|
+
* pending withdrawals list and clear the payment slot.
|
|
96
|
+
*
|
|
97
|
+
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.6/specs/gloas/beacon-chain.md#new-settle_builder_payment
|
|
98
|
+
*/
|
|
99
|
+
function settleBuilderPayment(state: CachedBeaconStateGloas, paymentIndex: number): void {
|
|
100
|
+
if (paymentIndex >= state.builderPendingPayments.length) {
|
|
101
|
+
throw new Error(
|
|
102
|
+
`Invalid builder payment index paymentIndex=${paymentIndex} limit=${state.builderPendingPayments.length}`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
const payment = state.builderPendingPayments.get(paymentIndex).clone();
|
|
106
|
+
if (payment.withdrawal.amount > 0) {
|
|
107
|
+
state.builderPendingWithdrawals.push(payment.withdrawal);
|
|
108
|
+
}
|
|
109
|
+
state.builderPendingPayments.set(paymentIndex, ssz.gloas.BuilderPendingPayment.defaultViewDU());
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function assertEmptyExecutionRequests(requests: electra.ExecutionRequests): void {
|
|
113
|
+
if (requests.deposits.length !== 0 || requests.withdrawals.length !== 0 || requests.consolidations.length !== 0) {
|
|
114
|
+
throw new Error("Parent execution requests must be empty when parent block is EMPTY");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
convertBuilderIndexToValidatorIndex,
|
|
16
16
|
convertValidatorIndexToBuilderIndex,
|
|
17
17
|
isBuilderIndex,
|
|
18
|
-
isParentBlockFull,
|
|
19
18
|
} from "../util/gloas.js";
|
|
20
19
|
import {
|
|
21
20
|
decreaseBalance,
|
|
@@ -32,8 +31,15 @@ export function processWithdrawals(
|
|
|
32
31
|
payload?: capella.FullOrBlindedExecutionPayload
|
|
33
32
|
): void {
|
|
34
33
|
// Return early if the parent block is empty
|
|
35
|
-
if (fork >= ForkSeq.gloas
|
|
36
|
-
|
|
34
|
+
if (fork >= ForkSeq.gloas) {
|
|
35
|
+
const stateGloas = state as CachedBeaconStateGloas;
|
|
36
|
+
const isParentBlockEmpty = !byteArrayEquals(
|
|
37
|
+
stateGloas.latestBlockHash,
|
|
38
|
+
stateGloas.latestExecutionPayloadBid.blockHash
|
|
39
|
+
);
|
|
40
|
+
if (isParentBlockEmpty) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
// processedBuilderWithdrawalsCount is withdrawals coming from builder payment since gloas (EIP-7732)
|
|
@@ -48,7 +54,9 @@ export function processWithdrawals(
|
|
|
48
54
|
} = getExpectedWithdrawals(fork, state);
|
|
49
55
|
const numWithdrawals = expectedWithdrawals.length;
|
|
50
56
|
|
|
51
|
-
//
|
|
57
|
+
// Pre-gloas verifies the payload's withdrawals against expectedWithdrawals here.
|
|
58
|
+
// Post-gloas, the payload arrives later as an envelope and that consistency check
|
|
59
|
+
// happens in verifyExecutionPayloadEnvelope against state.payloadExpectedWithdrawals.
|
|
52
60
|
if (fork < ForkSeq.gloas) {
|
|
53
61
|
if (payload === undefined) {
|
|
54
62
|
throw Error("payload is required for pre-gloas processWithdrawals");
|
package/src/cache/epochCache.ts
CHANGED
|
@@ -38,9 +38,9 @@ import {
|
|
|
38
38
|
computeEpochAtSlot,
|
|
39
39
|
computeProposers,
|
|
40
40
|
computeSyncPeriodAtEpoch,
|
|
41
|
-
getActivationChurnLimit,
|
|
42
41
|
getChurnLimit,
|
|
43
42
|
getSeed,
|
|
43
|
+
getValidatorActivationChurnLimit,
|
|
44
44
|
isActiveValidator,
|
|
45
45
|
isAggregatorFromCommitteeLength,
|
|
46
46
|
} from "../util/index.js";
|
|
@@ -478,7 +478,7 @@ export class EpochCache {
|
|
|
478
478
|
// the first block of the epoch process_block() call. So churnLimit must be computed at the end of the before epoch
|
|
479
479
|
// transition and the result is valid until the end of the next epoch transition
|
|
480
480
|
const churnLimit = getChurnLimit(config, currentShuffling.activeIndices.length);
|
|
481
|
-
const activationChurnLimit =
|
|
481
|
+
const activationChurnLimit = getValidatorActivationChurnLimit(
|
|
482
482
|
config,
|
|
483
483
|
config.getForkSeq(state.slot),
|
|
484
484
|
currentShuffling.activeIndices.length
|
|
@@ -652,7 +652,7 @@ export class EpochCache {
|
|
|
652
652
|
// the first block of the epoch process_block() call. So churnLimit must be computed at the end of the before epoch
|
|
653
653
|
// transition and the result is valid until the end of the next epoch transition
|
|
654
654
|
this.churnLimit = getChurnLimit(this.config, this.currentShuffling.activeIndices.length);
|
|
655
|
-
this.activationChurnLimit =
|
|
655
|
+
this.activationChurnLimit = getValidatorActivationChurnLimit(
|
|
656
656
|
this.config,
|
|
657
657
|
this.config.getForkSeq(state.slot),
|
|
658
658
|
this.currentShuffling.activeIndices.length
|
|
@@ -5,7 +5,7 @@ import {CachedBeaconStateElectra, EpochTransitionCache} from "../types.js";
|
|
|
5
5
|
import {increaseBalance} from "../util/balance.js";
|
|
6
6
|
import {hasCompoundingWithdrawalCredential, isValidatorKnown} from "../util/electra.js";
|
|
7
7
|
import {computeStartSlotAtEpoch} from "../util/epoch.js";
|
|
8
|
-
import {getActivationExitChurnLimit} from "../util/validator.js";
|
|
8
|
+
import {getActivationChurnLimit, getActivationExitChurnLimit} from "../util/validator.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Starting from Electra:
|
|
@@ -17,8 +17,11 @@ import {getActivationExitChurnLimit} from "../util/validator.js";
|
|
|
17
17
|
* TODO Electra: Update ssz library to support batch push to `pendingDeposits`
|
|
18
18
|
*/
|
|
19
19
|
export function processPendingDeposits(state: CachedBeaconStateElectra, cache: EpochTransitionCache): void {
|
|
20
|
+
const fork = state.config.getForkSeq(state.slot);
|
|
20
21
|
const nextEpoch = state.epochCtx.epoch + 1;
|
|
21
|
-
const
|
|
22
|
+
const churnLimit =
|
|
23
|
+
fork >= ForkSeq.gloas ? getActivationChurnLimit(state.epochCtx) : getActivationExitChurnLimit(state.epochCtx);
|
|
24
|
+
const availableForProcessing = state.depositBalanceToConsume + BigInt(churnLimit);
|
|
22
25
|
let processedAmount = 0;
|
|
23
26
|
let nextDepositIndex = 0;
|
|
24
27
|
const depositsToPostpone = [];
|
|
@@ -11,7 +11,7 @@ export function getExecutionPayloadEnvelopeSigningRoot(
|
|
|
11
11
|
config: BeaconConfig,
|
|
12
12
|
envelope: gloas.ExecutionPayloadEnvelope
|
|
13
13
|
): Uint8Array {
|
|
14
|
-
const domain = config.getDomain(envelope.
|
|
14
|
+
const domain = config.getDomain(envelope.payload.slotNumber, DOMAIN_BEACON_BUILDER);
|
|
15
15
|
|
|
16
16
|
return computeSigningRoot(ssz.gloas.ExecutionPayloadEnvelope, envelope, domain);
|
|
17
17
|
}
|
|
@@ -20,6 +20,7 @@ export * from "./executionPayloadEnvelope.js";
|
|
|
20
20
|
export * from "./indexedAttestation.js";
|
|
21
21
|
export * from "./indexedPayloadAttestation.js";
|
|
22
22
|
export * from "./proposer.js";
|
|
23
|
+
export * from "./proposerPreferences.js";
|
|
23
24
|
export * from "./proposerSlashings.js";
|
|
24
25
|
export * from "./randao.js";
|
|
25
26
|
export * from "./voluntaryExits.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
+
import {DOMAIN_PROPOSER_PREFERENCES} from "@lodestar/params";
|
|
3
|
+
import {gloas, ssz} from "@lodestar/types";
|
|
4
|
+
import {computeSigningRoot} from "../util/index.js";
|
|
5
|
+
|
|
6
|
+
export function getProposerPreferencesSigningRoot(
|
|
7
|
+
config: BeaconConfig,
|
|
8
|
+
preferences: gloas.ProposerPreferences
|
|
9
|
+
): Uint8Array {
|
|
10
|
+
const domain = config.getDomain(preferences.proposalSlot, DOMAIN_PROPOSER_PREFERENCES);
|
|
11
|
+
return computeSigningRoot(ssz.gloas.ProposerPreferences, preferences, domain);
|
|
12
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {FAR_FUTURE_EPOCH, GENESIS_SLOT, UNSET_DEPOSIT_REQUESTS_START_INDEX} from "@lodestar/params";
|
|
1
|
+
import {FAR_FUTURE_EPOCH, ForkSeq, GENESIS_SLOT, UNSET_DEPOSIT_REQUESTS_START_INDEX} from "@lodestar/params";
|
|
2
2
|
import {ValidatorIndex, ssz} from "@lodestar/types";
|
|
3
3
|
import {CachedBeaconStateElectra, getCachedBeaconState} from "../cache/stateCache.js";
|
|
4
4
|
import {G2_POINT_AT_INFINITY} from "../constants/constants.js";
|
|
@@ -78,7 +78,9 @@ export function upgradeStateToElectra(stateDeneb: CachedBeaconStateDeneb): Cache
|
|
|
78
78
|
stateElectraView.commit();
|
|
79
79
|
const tmpElectraState = getCachedBeaconState(stateElectraView, stateDeneb);
|
|
80
80
|
stateElectraView.exitBalanceToConsume = BigInt(getActivationExitChurnLimit(tmpElectraState.epochCtx));
|
|
81
|
-
stateElectraView.consolidationBalanceToConsume = BigInt(
|
|
81
|
+
stateElectraView.consolidationBalanceToConsume = BigInt(
|
|
82
|
+
getConsolidationChurnLimit(ForkSeq.electra, tmpElectraState.epochCtx)
|
|
83
|
+
);
|
|
82
84
|
|
|
83
85
|
preActivation.sort((i0, i1) => {
|
|
84
86
|
const res = validatorsArr[i0].activationEligibilityEpoch - validatorsArr[i1].activationEligibilityEpoch;
|
|
@@ -48,6 +48,9 @@ export function upgradeStateToGloas(stateFulu: CachedBeaconStateFulu): CachedBea
|
|
|
48
48
|
stateGloasView.currentSyncCommittee = stateGloasCloned.currentSyncCommittee;
|
|
49
49
|
stateGloasView.nextSyncCommittee = stateGloasCloned.nextSyncCommittee;
|
|
50
50
|
stateGloasView.latestExecutionPayloadBid.blockHash = stateFulu.latestExecutionPayloadHeader.blockHash;
|
|
51
|
+
stateGloasView.latestExecutionPayloadBid.executionRequestsRoot = ssz.electra.ExecutionRequests.hashTreeRoot(
|
|
52
|
+
ssz.electra.ExecutionRequests.defaultValue()
|
|
53
|
+
);
|
|
51
54
|
stateGloasView.nextWithdrawalIndex = stateGloasCloned.nextWithdrawalIndex;
|
|
52
55
|
stateGloasView.nextWithdrawalValidatorIndex = stateGloasCloned.nextWithdrawalValidatorIndex;
|
|
53
56
|
stateGloasView.historicalSummaries = stateGloasCloned.historicalSummaries;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {CompactMultiProof, ProofType, Tree, createProof} from "@chainsafe/persistent-merkle-tree";
|
|
2
2
|
import {BitArray, ByteViews} from "@chainsafe/ssz";
|
|
3
3
|
import {BeaconConfig} from "@lodestar/config";
|
|
4
|
-
import {ForkName, ForkSeq, SLOTS_PER_HISTORICAL_ROOT
|
|
4
|
+
import {ForkName, ForkSeq, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
|
|
5
5
|
import {
|
|
6
6
|
BeaconBlock,
|
|
7
7
|
BeaconState,
|
|
@@ -28,8 +28,7 @@ import {
|
|
|
28
28
|
rewards,
|
|
29
29
|
} from "@lodestar/types";
|
|
30
30
|
import {Checkpoint, Fork} from "@lodestar/types/phase0";
|
|
31
|
-
import {
|
|
32
|
-
import {ProcessExecutionPayloadEnvelopeOpts} from "../block/processExecutionPayloadEnvelope.js";
|
|
31
|
+
import {applyParentExecutionPayload} from "../block/processParentExecutionPayload.js";
|
|
33
32
|
import {VoluntaryExitValidity, getVoluntaryExitValidity} from "../block/processVoluntaryExit.js";
|
|
34
33
|
import {getExpectedWithdrawals} from "../block/processWithdrawals.js";
|
|
35
34
|
import {EffectiveBalanceIncrements} from "../cache/effectiveBalanceIncrements.js";
|
|
@@ -69,7 +68,7 @@ import {canBuilderCoverBid} from "../util/gloas.js";
|
|
|
69
68
|
import {loadState} from "../util/loadState/loadState.js";
|
|
70
69
|
import {getRandaoMix} from "../util/seed.js";
|
|
71
70
|
import {getLatestWeakSubjectivityCheckpointEpoch} from "../util/weakSubjectivity.js";
|
|
72
|
-
import {IBeaconStateView, IBeaconStateViewLatestFork} from "./interface.js";
|
|
71
|
+
import {IBeaconStateView, IBeaconStateViewGloas, IBeaconStateViewLatestFork, isStatePostGloas} from "./interface.js";
|
|
73
72
|
|
|
74
73
|
export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
75
74
|
private readonly config: BeaconConfig;
|
|
@@ -406,6 +405,23 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
406
405
|
return canBuilderCoverBid(this.cachedState as CachedBeaconStateGloas, builderIndex, bidAmount);
|
|
407
406
|
}
|
|
408
407
|
|
|
408
|
+
/**
|
|
409
|
+
* Return the PTCs for an epoch
|
|
410
|
+
*/
|
|
411
|
+
getEpochPTCs(epoch: Epoch): Uint32Array[] {
|
|
412
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.gloas) {
|
|
413
|
+
throw new Error("PTC committees are not supported before Gloas");
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const epochCtx = (this.cachedState as CachedBeaconStateGloas).epochCtx;
|
|
417
|
+
if (epoch === epochCtx.epoch) {
|
|
418
|
+
return epochCtx.payloadTimelinessCommittees;
|
|
419
|
+
}
|
|
420
|
+
if (epoch === epochCtx.nextEpoch) {
|
|
421
|
+
return epochCtx.nextPayloadTimelinessCommittees;
|
|
422
|
+
}
|
|
423
|
+
throw new Error(`PTC committees are not available for epoch=${epoch}`);
|
|
424
|
+
}
|
|
409
425
|
/**
|
|
410
426
|
* Return the index of the validator in the PTC committee for the given slot.
|
|
411
427
|
* return -1 if validator is not in the PTC committee for the given slot.
|
|
@@ -704,7 +720,11 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
704
720
|
|
|
705
721
|
// Serialization
|
|
706
722
|
|
|
707
|
-
loadOtherState(
|
|
723
|
+
loadOtherState(
|
|
724
|
+
stateBytes: Uint8Array,
|
|
725
|
+
seedValidatorsBytes?: Uint8Array,
|
|
726
|
+
opts?: {preloadValidatorsAndBalances?: boolean}
|
|
727
|
+
): IBeaconStateView {
|
|
708
728
|
const {state} = loadState(this.config, this.cachedState, stateBytes, seedValidatorsBytes);
|
|
709
729
|
|
|
710
730
|
const cachedState = createCachedBeaconState(
|
|
@@ -719,9 +739,10 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
719
739
|
}
|
|
720
740
|
);
|
|
721
741
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
742
|
+
if (opts?.preloadValidatorsAndBalances) {
|
|
743
|
+
cachedState.validators.getAllReadonlyValues();
|
|
744
|
+
cachedState.balances.getAll();
|
|
745
|
+
}
|
|
725
746
|
|
|
726
747
|
return new BeaconStateView(cachedState);
|
|
727
748
|
}
|
|
@@ -779,19 +800,22 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
779
800
|
return new BeaconStateView(newState);
|
|
780
801
|
}
|
|
781
802
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
):
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
throw Error(`processExecutionPayloadEnvelope is only available for gloas+ forks, got fork=${fork}`);
|
|
803
|
+
/**
|
|
804
|
+
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.5/specs/gloas/validator.md#executionpayload
|
|
805
|
+
*/
|
|
806
|
+
withParentPayloadApplied(executionRequests: electra.ExecutionRequests): IBeaconStateViewGloas {
|
|
807
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.gloas) {
|
|
808
|
+
throw new Error("withParentPayloadApplied is not available before Gloas");
|
|
789
809
|
}
|
|
790
|
-
const
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
);
|
|
795
|
-
|
|
810
|
+
const stateCopy = this.cachedState.clone(true) as CachedBeaconStateGloas;
|
|
811
|
+
|
|
812
|
+
applyParentExecutionPayload(stateCopy, executionRequests);
|
|
813
|
+
|
|
814
|
+
const stateView = new BeaconStateView(stateCopy);
|
|
815
|
+
if (!isStatePostGloas(stateView)) {
|
|
816
|
+
throw new Error("Expected gloas state after clone");
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
return stateView;
|
|
796
820
|
}
|
|
797
821
|
}
|