@lodestar/state-transition 1.50.0-dev.fd4f342a40 → 1.50.0-dev.fe4e7408b4
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.map +1 -1
- package/lib/block/index.js +1 -1
- package/lib/block/index.js.map +1 -1
- package/lib/block/indexedBuilderState.d.ts +19 -0
- package/lib/block/indexedBuilderState.d.ts.map +1 -0
- package/lib/block/indexedBuilderState.js +60 -0
- package/lib/block/indexedBuilderState.js.map +1 -0
- package/lib/block/processBuilderDepositRequest.d.ts +2 -2
- package/lib/block/processBuilderDepositRequest.d.ts.map +1 -1
- package/lib/block/processBuilderDepositRequest.js +5 -4
- package/lib/block/processBuilderDepositRequest.js.map +1 -1
- package/lib/block/processBuilderExitRequest.d.ts +2 -2
- package/lib/block/processBuilderExitRequest.d.ts.map +1 -1
- package/lib/block/processBuilderExitRequest.js +4 -3
- package/lib/block/processBuilderExitRequest.js.map +1 -1
- package/lib/block/processDeposit.d.ts +2 -2
- package/lib/block/processDeposit.d.ts.map +1 -1
- package/lib/block/processDeposit.js.map +1 -1
- package/lib/block/processEth1Data.d.ts +3 -3
- package/lib/block/processEth1Data.d.ts.map +1 -1
- package/lib/block/processEth1Data.js.map +1 -1
- package/lib/block/processOperations.d.ts.map +1 -1
- package/lib/block/processOperations.js +8 -6
- package/lib/block/processOperations.js.map +1 -1
- package/lib/block/processParentExecutionPayload.d.ts.map +1 -1
- package/lib/block/processParentExecutionPayload.js +23 -18
- package/lib/block/processParentExecutionPayload.js.map +1 -1
- package/lib/block/processProposerSlashing.d.ts.map +1 -1
- package/lib/block/processProposerSlashing.js +0 -23
- package/lib/block/processProposerSlashing.js.map +1 -1
- package/lib/block/slashValidator.d.ts.map +1 -1
- package/lib/block/slashValidator.js +11 -0
- package/lib/block/slashValidator.js.map +1 -1
- package/lib/cache/stateCache.d.ts +2 -1
- package/lib/cache/stateCache.d.ts.map +1 -1
- package/lib/cache/stateCache.js.map +1 -1
- package/lib/cache/types.d.ts +2 -1
- package/lib/cache/types.d.ts.map +1 -1
- package/lib/epoch/index.d.ts.map +1 -1
- package/lib/epoch/index.js +3 -1
- package/lib/epoch/index.js.map +1 -1
- package/lib/epoch/processEth1DataReset.d.ts +2 -2
- package/lib/epoch/processEth1DataReset.d.ts.map +1 -1
- package/lib/epoch/processEth1DataReset.js.map +1 -1
- package/lib/epoch/processPendingDeposits.d.ts.map +1 -1
- package/lib/epoch/processPendingDeposits.js +8 -4
- package/lib/epoch/processPendingDeposits.js.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/rewards/attestationsRewards.d.ts.map +1 -1
- package/lib/rewards/attestationsRewards.js +8 -1
- package/lib/rewards/attestationsRewards.js.map +1 -1
- package/lib/signatureSets/index.d.ts.map +1 -1
- package/lib/signatureSets/index.js +2 -2
- package/lib/signatureSets/index.js.map +1 -1
- package/lib/signatureSets/voluntaryExits.d.ts +2 -6
- package/lib/signatureSets/voluntaryExits.d.ts.map +1 -1
- package/lib/signatureSets/voluntaryExits.js +2 -32
- package/lib/signatureSets/voluntaryExits.js.map +1 -1
- package/lib/slot/upgradeStateToHeze.d.ts.map +1 -1
- package/lib/slot/upgradeStateToHeze.js +4 -4
- package/lib/slot/upgradeStateToHeze.js.map +1 -1
- package/lib/stateView/beaconStateView.d.ts +22 -21
- package/lib/stateView/beaconStateView.d.ts.map +1 -1
- package/lib/stateView/beaconStateView.js +74 -71
- package/lib/stateView/beaconStateView.js.map +1 -1
- package/lib/stateView/interface.d.ts +34 -21
- package/lib/stateView/interface.d.ts.map +1 -1
- package/lib/stateView/interface.js.map +1 -1
- package/lib/stateView/nativeBeaconStateView.d.ts +92 -100
- package/lib/stateView/nativeBeaconStateView.d.ts.map +1 -1
- package/lib/stateView/nativeBeaconStateView.js +343 -368
- package/lib/stateView/nativeBeaconStateView.js.map +1 -1
- package/lib/stateView/stateViewFactory.d.ts +6 -5
- package/lib/stateView/stateViewFactory.d.ts.map +1 -1
- package/lib/stateView/stateViewFactory.js +12 -8
- package/lib/stateView/stateViewFactory.js.map +1 -1
- package/lib/types.d.ts +2 -2
- package/lib/types.d.ts.map +1 -1
- package/lib/util/blindedBlock.d.ts +1 -1
- package/lib/util/blindedBlock.d.ts.map +1 -1
- package/lib/util/blindedBlock.js +5 -2
- package/lib/util/blindedBlock.js.map +1 -1
- package/lib/util/deposit.d.ts +2 -2
- package/lib/util/deposit.d.ts.map +1 -1
- package/lib/util/deposit.js.map +1 -1
- package/lib/util/genesis.d.ts.map +1 -1
- package/lib/util/genesis.js +46 -23
- package/lib/util/genesis.js.map +1 -1
- package/lib/util/gloas.d.ts +11 -14
- package/lib/util/gloas.d.ts.map +1 -1
- package/lib/util/gloas.js +2 -42
- package/lib/util/gloas.js.map +1 -1
- package/package.json +8 -8
- package/src/block/index.ts +4 -3
- package/src/block/indexedBuilderState.ts +65 -0
- package/src/block/processBuilderDepositRequest.ts +6 -17
- package/src/block/processBuilderExitRequest.ts +5 -9
- package/src/block/processDeposit.ts +7 -2
- package/src/block/processEth1Data.ts +3 -3
- package/src/block/processOperations.ts +14 -11
- package/src/block/processParentExecutionPayload.ts +27 -23
- package/src/block/processProposerSlashing.ts +2 -28
- package/src/block/slashValidator.ts +13 -2
- package/src/cache/stateCache.ts +2 -0
- package/src/cache/types.ts +2 -1
- package/src/epoch/index.ts +4 -1
- package/src/epoch/processEth1DataReset.ts +2 -2
- package/src/epoch/processPendingDeposits.ts +14 -3
- package/src/index.ts +6 -1
- package/src/rewards/attestationsRewards.ts +8 -1
- package/src/signatureSets/index.ts +4 -2
- package/src/signatureSets/voluntaryExits.ts +3 -55
- package/src/slot/upgradeStateToHeze.ts +6 -4
- package/src/stateView/beaconStateView.ts +80 -77
- package/src/stateView/interface.ts +61 -21
- package/src/stateView/nativeBeaconStateView.ts +357 -375
- package/src/stateView/stateViewFactory.ts +21 -12
- package/src/types.ts +2 -0
- package/src/util/blindedBlock.ts +8 -3
- package/src/util/deposit.ts +2 -2
- package/src/util/genesis.ts +56 -30
- package/src/util/gloas.ts +2 -53
package/lib/util/gloas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gloas.js","sourceRoot":"","sources":["../../src/util/gloas.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,qCAAqC,EACrC,mCAAmC,EACnC,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,EAC3B,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAA6C,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAEhF,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,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,sCAAsC,EAAE,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,yBAAyB,EAAC,MAAM,gBAAgB,CAAC;AAEzD,MAAM,UAAU,6BAA6B,CAAC,qBAAiC;IAC7E,OAAO,qBAAqB,CAAC,CAAC,CAAC,KAAK,yBAAyB,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,gCAAgC,CAAC,KAA6B;IAC5E,8GAA8G;IAC9G,MAAM,cAAc,GAClB,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,4BAA4B,CAAC,GAAG,MAAM,CAAC,2BAA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EAAE,qBAAqB,EAAE,MAAM,EAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,aAAa,CAAC,sBAAsB,EAAE,MAAM,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;IAC7F,MAAM,WAAW,GAAG,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IAC1F,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,sCAAsC,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IACpG,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;AACH,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.50.0-dev.
|
|
14
|
+
"version": "1.50.0-dev.fe4e7408b4",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -68,15 +68,15 @@
|
|
|
68
68
|
"@chainsafe/as-sha256": "^1.2.5",
|
|
69
69
|
"@chainsafe/lodestar-z": "catalog:",
|
|
70
70
|
"@chainsafe/persistent-merkle-tree": "^1.3.1",
|
|
71
|
-
"@chainsafe/ssz": "^1.8.
|
|
72
|
-
"@lodestar/config": "^1.50.0-dev.
|
|
73
|
-
"@lodestar/params": "^1.50.0-dev.
|
|
74
|
-
"@lodestar/types": "^1.50.0-dev.
|
|
75
|
-
"@lodestar/utils": "^1.50.0-dev.
|
|
71
|
+
"@chainsafe/ssz": "^1.8.1",
|
|
72
|
+
"@lodestar/config": "^1.50.0-dev.fe4e7408b4",
|
|
73
|
+
"@lodestar/params": "^1.50.0-dev.fe4e7408b4",
|
|
74
|
+
"@lodestar/types": "^1.50.0-dev.fe4e7408b4",
|
|
75
|
+
"@lodestar/utils": "^1.50.0-dev.fe4e7408b4",
|
|
76
76
|
"@vekexasia/bigint-buffer2": "^1.1.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@lodestar/test-utils": "^1.50.0-dev.
|
|
79
|
+
"@lodestar/test-utils": "^1.50.0-dev.fe4e7408b4"
|
|
80
80
|
},
|
|
81
81
|
"keywords": [
|
|
82
82
|
"ethereum",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"beacon",
|
|
85
85
|
"blockchain"
|
|
86
86
|
],
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "d419de313d96a2ffe17669d0ce36b874cbd61d13"
|
|
88
88
|
}
|
package/src/block/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {ForkPostGloas, ForkSeq} from "@lodestar/params";
|
|
1
|
+
import {ForkPostGloas, ForkPreHeze, ForkSeq} from "@lodestar/params";
|
|
2
2
|
import {BeaconBlock, BlindedBeaconBlock, Slot, altair, capella} from "@lodestar/types";
|
|
3
3
|
import {BeaconStateTransitionMetrics} from "../metrics.js";
|
|
4
4
|
import {
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
CachedBeaconStateBellatrix,
|
|
7
7
|
CachedBeaconStateCapella,
|
|
8
8
|
CachedBeaconStateGloas,
|
|
9
|
+
CachedBeaconStatePreHeze,
|
|
9
10
|
} from "../types.js";
|
|
10
11
|
import {getFullOrBlindedPayload, isExecutionEnabled} from "../util/execution.js";
|
|
11
12
|
import {BlockExternalData, DataAvailabilityStatus} from "./externalData.js";
|
|
@@ -117,9 +118,9 @@ export function processBlock(
|
|
|
117
118
|
timer?.();
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
{
|
|
121
|
+
if (fork < ForkSeq.heze) {
|
|
121
122
|
const timer = metrics?.processBlockStepTime.startTimer({step: BlockProcessStep.processEth1Data});
|
|
122
|
-
processEth1Data(state, block.body.eth1Data);
|
|
123
|
+
processEth1Data(state as CachedBeaconStatePreHeze, (block as BeaconBlock<ForkPreHeze>).body.eth1Data);
|
|
123
124
|
timer?.();
|
|
124
125
|
}
|
|
125
126
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {BuilderIndex, Epoch, PubkeyHex} from "@lodestar/types";
|
|
2
|
+
import {Builder} from "@lodestar/types/gloas";
|
|
3
|
+
import {toPubkeyHex} from "@lodestar/utils";
|
|
4
|
+
import {CachedBeaconStateGloas} from "../types.js";
|
|
5
|
+
import {computeEpochAtSlot} from "../util/epoch.js";
|
|
6
|
+
import {createBuilderView} from "../util/gloas.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Block-scoped pubkey -> index map and ascending reuse candidates for `state.builders`, built in one pass.
|
|
10
|
+
* Only valid while builder pubkeys change exclusively via `addBuilderToRegistry()` and no builder becomes
|
|
11
|
+
* newly reusable (candidates are re-checked lazily, never added). Do not use across blocks/slots.
|
|
12
|
+
*/
|
|
13
|
+
export class IndexedBuilderState {
|
|
14
|
+
private readonly currentEpoch: Epoch;
|
|
15
|
+
private readonly indexByPubkey = new Map<PubkeyHex, BuilderIndex>();
|
|
16
|
+
private readonly reusableIndexCandidates: BuilderIndex[] = [];
|
|
17
|
+
private candidateCursor = 0;
|
|
18
|
+
|
|
19
|
+
constructor(readonly state: CachedBeaconStateGloas) {
|
|
20
|
+
state.builders.commit();
|
|
21
|
+
const builders = state.builders.getAllReadonlyValues();
|
|
22
|
+
this.currentEpoch = computeEpochAtSlot(state.slot);
|
|
23
|
+
for (const [index, builder] of builders.entries()) {
|
|
24
|
+
const pubkeyHex = toPubkeyHex(builder.pubkey);
|
|
25
|
+
this.indexByPubkey.set(pubkeyHex, index);
|
|
26
|
+
if (canReuseBuilder(builder, this.currentEpoch)) {
|
|
27
|
+
this.reusableIndexCandidates.push(index);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
findBuilderIndexByPubkey(pubkey: Uint8Array): BuilderIndex | null {
|
|
33
|
+
return this.indexByPubkey.get(toPubkeyHex(pubkey)) ?? null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
addBuilderToRegistry(pubkey: Uint8Array, version: number, executionAddress: Uint8Array, amount: number): void {
|
|
37
|
+
const builder = createBuilderView(pubkey, version, executionAddress, amount, this.currentEpoch);
|
|
38
|
+
const reusableIndex = this.findReusableBuilderIndex();
|
|
39
|
+
const index = reusableIndex ?? this.state.builders.length;
|
|
40
|
+
if (reusableIndex !== null) {
|
|
41
|
+
const oldBuilder = this.state.builders.getReadonly(index);
|
|
42
|
+
this.indexByPubkey.delete(toPubkeyHex(oldBuilder.pubkey));
|
|
43
|
+
this.state.builders.set(index, builder);
|
|
44
|
+
} else {
|
|
45
|
+
this.state.builders.push(builder);
|
|
46
|
+
}
|
|
47
|
+
this.indexByPubkey.set(toPubkeyHex(pubkey), index);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private findReusableBuilderIndex(): BuilderIndex | null {
|
|
51
|
+
while (this.candidateCursor < this.reusableIndexCandidates.length) {
|
|
52
|
+
const index = this.reusableIndexCandidates[this.candidateCursor++];
|
|
53
|
+
const builder = this.state.builders.getReadonly(index);
|
|
54
|
+
// Top-ups can invalidate initial candidates
|
|
55
|
+
if (canReuseBuilder(builder, this.currentEpoch)) {
|
|
56
|
+
return index;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function canReuseBuilder(builder: Builder, currentEpoch: Epoch): boolean {
|
|
64
|
+
return builder.withdrawableEpoch <= currentEpoch && builder.balance === 0;
|
|
65
|
+
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import {FAR_FUTURE_EPOCH, PAYLOAD_BUILDER_VERSION} from "@lodestar/params";
|
|
2
2
|
import {gloas} from "@lodestar/types";
|
|
3
|
-
import {CachedBeaconStateGloas} from "../types.js";
|
|
4
3
|
import {computeEpochAtSlot} from "../util/epoch.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
findBuilderIndexByPubkey,
|
|
8
|
-
isBuilderWithdrawalCredential,
|
|
9
|
-
isValidBuilderDepositSignature,
|
|
10
|
-
} from "../util/gloas.js";
|
|
4
|
+
import {isBuilderWithdrawalCredential, isValidBuilderDepositSignature} from "../util/gloas.js";
|
|
5
|
+
import {IndexedBuilderState} from "./indexedBuilderState.js";
|
|
11
6
|
|
|
12
7
|
/**
|
|
13
8
|
* Process a builder deposit request from the execution layer: register a new builder
|
|
@@ -16,9 +11,10 @@ import {
|
|
|
16
11
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.11/specs/gloas/beacon-chain.md#new-process_builder_deposit_request
|
|
17
12
|
*/
|
|
18
13
|
export function processBuilderDepositRequest(
|
|
19
|
-
|
|
14
|
+
indexedState: IndexedBuilderState,
|
|
20
15
|
request: gloas.BuilderDepositRequest
|
|
21
16
|
): void {
|
|
17
|
+
const {state} = indexedState;
|
|
22
18
|
const {pubkey, withdrawalCredentials, amount, signature} = request;
|
|
23
19
|
|
|
24
20
|
// Ignore deposits with unexpected withdrawal credential prefixes.
|
|
@@ -26,18 +22,11 @@ export function processBuilderDepositRequest(
|
|
|
26
22
|
return;
|
|
27
23
|
}
|
|
28
24
|
|
|
29
|
-
const builderIndex = findBuilderIndexByPubkey(
|
|
25
|
+
const builderIndex = indexedState.findBuilderIndexByPubkey(pubkey);
|
|
30
26
|
|
|
31
27
|
if (builderIndex === null) {
|
|
32
28
|
if (isValidBuilderDepositSignature(state.config, pubkey, withdrawalCredentials, amount, signature)) {
|
|
33
|
-
addBuilderToRegistry(
|
|
34
|
-
state,
|
|
35
|
-
pubkey,
|
|
36
|
-
PAYLOAD_BUILDER_VERSION,
|
|
37
|
-
withdrawalCredentials.subarray(12),
|
|
38
|
-
amount,
|
|
39
|
-
state.slot
|
|
40
|
-
);
|
|
29
|
+
indexedState.addBuilderToRegistry(pubkey, PAYLOAD_BUILDER_VERSION, withdrawalCredentials.subarray(12), amount);
|
|
41
30
|
}
|
|
42
31
|
return;
|
|
43
32
|
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import {gloas} from "@lodestar/types";
|
|
2
2
|
import {byteArrayEquals} from "@lodestar/utils";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
findBuilderIndexByPubkey,
|
|
6
|
-
getPendingBalanceToWithdrawForBuilder,
|
|
7
|
-
initiateBuilderExit,
|
|
8
|
-
isActiveBuilder,
|
|
9
|
-
} from "../util/gloas.js";
|
|
3
|
+
import {getPendingBalanceToWithdrawForBuilder, initiateBuilderExit, isActiveBuilder} from "../util/gloas.js";
|
|
4
|
+
import {IndexedBuilderState} from "./indexedBuilderState.js";
|
|
10
5
|
|
|
11
6
|
/**
|
|
12
7
|
* Apply a builder exit request. Authorizes the exit via `source_address` (the builder's
|
|
@@ -17,8 +12,9 @@ import {
|
|
|
17
12
|
*
|
|
18
13
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.11/specs/gloas/beacon-chain.md#new-process_builder_exit_request
|
|
19
14
|
*/
|
|
20
|
-
export function processBuilderExitRequest(
|
|
21
|
-
const
|
|
15
|
+
export function processBuilderExitRequest(indexedState: IndexedBuilderState, request: gloas.BuilderExitRequest): void {
|
|
16
|
+
const {state} = indexedState;
|
|
17
|
+
const builderIndex = indexedState.findBuilderIndexByPubkey(request.pubkey);
|
|
22
18
|
if (builderIndex === null) {
|
|
23
19
|
return;
|
|
24
20
|
}
|
|
@@ -17,7 +17,12 @@ import {
|
|
|
17
17
|
import {BLSPubkey, Bytes32, UintNum64, electra, phase0, ssz} from "@lodestar/types";
|
|
18
18
|
import {verifyMerkleBranch} from "@lodestar/utils";
|
|
19
19
|
import {ZERO_HASH} from "../constants/index.js";
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
CachedBeaconStateAllForks,
|
|
22
|
+
CachedBeaconStateAltair,
|
|
23
|
+
CachedBeaconStateElectra,
|
|
24
|
+
CachedBeaconStatePreHeze,
|
|
25
|
+
} from "../types.js";
|
|
21
26
|
import {
|
|
22
27
|
computeDomain,
|
|
23
28
|
computeSigningRoot,
|
|
@@ -33,7 +38,7 @@ import {
|
|
|
33
38
|
*
|
|
34
39
|
* PERF: Work depends on number of Deposit per block. On regular networks the average is 0 / block.
|
|
35
40
|
*/
|
|
36
|
-
export function processDeposit(fork: ForkSeq, state:
|
|
41
|
+
export function processDeposit(fork: ForkSeq, state: CachedBeaconStatePreHeze, deposit: phase0.Deposit): void {
|
|
37
42
|
// verify the merkle branch
|
|
38
43
|
if (
|
|
39
44
|
!verifyMerkleBranch(
|
|
@@ -2,7 +2,7 @@ import {Node} from "@chainsafe/persistent-merkle-tree";
|
|
|
2
2
|
import {CompositeViewDU} from "@chainsafe/ssz";
|
|
3
3
|
import {EPOCHS_PER_ETH1_VOTING_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
4
4
|
import {phase0, ssz} from "@lodestar/types";
|
|
5
|
-
import {
|
|
5
|
+
import {BeaconStatePreHeze, CachedBeaconStatePreHeze} from "../types.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Store vote counts for every eth-execution block that has votes; if any eth-execution block wins majority support within a 1024-slot
|
|
@@ -12,7 +12,7 @@ import {BeaconStateAllForks, CachedBeaconStateAllForks} from "../types.js";
|
|
|
12
12
|
* - Best case: Vote is already decided, zero work. See becomesNewEth1Data conditions
|
|
13
13
|
* - Worst case: 1023 votes and no majority vote yet.
|
|
14
14
|
*/
|
|
15
|
-
export function processEth1Data(state:
|
|
15
|
+
export function processEth1Data(state: CachedBeaconStatePreHeze, eth1Data: phase0.Eth1Data): void {
|
|
16
16
|
// Convert to view first to hash once and compare hashes
|
|
17
17
|
const eth1DataView = ssz.phase0.Eth1Data.toViewDU(eth1Data);
|
|
18
18
|
|
|
@@ -28,7 +28,7 @@ export function processEth1Data(state: CachedBeaconStateAllForks, eth1Data: phas
|
|
|
28
28
|
* result in a change to `state.eth1Data`.
|
|
29
29
|
*/
|
|
30
30
|
export function becomesNewEth1Data(
|
|
31
|
-
state:
|
|
31
|
+
state: BeaconStatePreHeze,
|
|
32
32
|
newEth1Data: CompositeViewDU<typeof ssz.phase0.Eth1Data>
|
|
33
33
|
): boolean {
|
|
34
34
|
const SLOTS_PER_ETH1_VOTING_PERIOD = EPOCHS_PER_ETH1_VOTING_PERIOD * SLOTS_PER_EPOCH;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {ForkSeq} from "@lodestar/params";
|
|
1
|
+
import {ForkPreHeze, ForkSeq} from "@lodestar/params";
|
|
2
2
|
import {BeaconBlockBody, Slot, capella, electra, gloas} from "@lodestar/types";
|
|
3
3
|
import {BeaconStateTransitionMetrics} from "../metrics.js";
|
|
4
4
|
import {
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
CachedBeaconStateCapella,
|
|
7
7
|
CachedBeaconStateElectra,
|
|
8
8
|
CachedBeaconStateGloas,
|
|
9
|
+
CachedBeaconStatePreHeze,
|
|
9
10
|
} from "../types.js";
|
|
10
11
|
import {getEth1DepositCount} from "../util/deposit.js";
|
|
11
12
|
import {processAttestations} from "./processAttestations.js";
|
|
@@ -40,13 +41,15 @@ export function processOperations(
|
|
|
40
41
|
opts: ProcessBlockOpts = {verifySignatures: true},
|
|
41
42
|
metrics?: BeaconStateTransitionMetrics | null
|
|
42
43
|
): void {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
if (fork < ForkSeq.heze) {
|
|
45
|
+
// From Fulu the eth1 bridge deposit mechanism was removed, so blocks must not contain any deposits.
|
|
46
|
+
const deposits = (body as BeaconBlockBody<ForkPreHeze>).deposits;
|
|
47
|
+
const maxDeposits = fork >= ForkSeq.fulu ? 0 : getEth1DepositCount(state as CachedBeaconStatePreHeze);
|
|
48
|
+
if (deposits.length !== maxDeposits) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`Block contains incorrect number of deposits: depositCount=${deposits.length} expected=${maxDeposits}`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
{
|
|
@@ -71,10 +74,10 @@ export function processOperations(
|
|
|
71
74
|
timer?.();
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
{
|
|
77
|
+
if (fork < ForkSeq.heze) {
|
|
75
78
|
const timer = metrics?.processOperationsStepTime.startTimer({step: ProcessOperationsStep.processDeposit});
|
|
76
|
-
for (const deposit of body.deposits) {
|
|
77
|
-
processDeposit(fork, state, deposit);
|
|
79
|
+
for (const deposit of (body as BeaconBlockBody<ForkPreHeze>).deposits) {
|
|
80
|
+
processDeposit(fork, state as CachedBeaconStatePreHeze, deposit);
|
|
78
81
|
}
|
|
79
82
|
timer?.();
|
|
80
83
|
}
|
|
@@ -3,6 +3,7 @@ import {BeaconBlock, gloas, ssz} from "@lodestar/types";
|
|
|
3
3
|
import {byteArrayEquals, toRootHex} from "@lodestar/utils";
|
|
4
4
|
import {CachedBeaconStateGloas} from "../types.js";
|
|
5
5
|
import {computeEpochAtSlot} from "../util/epoch.js";
|
|
6
|
+
import {IndexedBuilderState} from "./indexedBuilderState.js";
|
|
6
7
|
import {processBuilderDepositRequest} from "./processBuilderDepositRequest.js";
|
|
7
8
|
import {processBuilderExitRequest} from "./processBuilderExitRequest.js";
|
|
8
9
|
import {processConsolidationRequest} from "./processConsolidationRequest.js";
|
|
@@ -53,29 +54,8 @@ export function applyParentExecutionPayload(state: CachedBeaconStateGloas, reque
|
|
|
53
54
|
const parentEpoch = computeEpochAtSlot(parentSlot);
|
|
54
55
|
const currentEpoch = computeEpochAtSlot(state.slot);
|
|
55
56
|
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
for (const deposit of requests.deposits) {
|
|
59
|
-
processDepositRequest(fork, state, deposit);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
for (const withdrawal of requests.withdrawals) {
|
|
63
|
-
processWithdrawalRequest(fork, state, withdrawal);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
for (const consolidation of requests.consolidations) {
|
|
67
|
-
processConsolidationRequest(state, consolidation);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
for (const builderDeposit of requests.builderDeposits) {
|
|
71
|
-
processBuilderDepositRequest(state, builderDeposit);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
for (const builderExit of requests.builderExits) {
|
|
75
|
-
processBuilderExitRequest(state, builderExit);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Settle the builder payment
|
|
57
|
+
// Settle the builder payment before the requests so that a builder exit request
|
|
58
|
+
// is rejected while the payment is pending
|
|
79
59
|
if (parentEpoch === currentEpoch) {
|
|
80
60
|
settleBuilderPayment(state, SLOTS_PER_EPOCH + (parentSlot % SLOTS_PER_EPOCH));
|
|
81
61
|
} else if (parentEpoch === currentEpoch - 1) {
|
|
@@ -92,6 +72,30 @@ export function applyParentExecutionPayload(state: CachedBeaconStateGloas, reque
|
|
|
92
72
|
);
|
|
93
73
|
}
|
|
94
74
|
|
|
75
|
+
// Process execution requests from parent's payload. The execution
|
|
76
|
+
// requests are processed at state.slot (child's slot), not the parent's slot.
|
|
77
|
+
for (const deposit of requests.deposits) {
|
|
78
|
+
processDepositRequest(fork, state, deposit);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
for (const withdrawal of requests.withdrawals) {
|
|
82
|
+
processWithdrawalRequest(fork, state, withdrawal);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
for (const consolidation of requests.consolidations) {
|
|
86
|
+
processConsolidationRequest(state, consolidation);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (requests.builderDeposits.length > 0 || requests.builderExits.length > 0) {
|
|
90
|
+
const indexedState = new IndexedBuilderState(state);
|
|
91
|
+
for (const builderDeposit of requests.builderDeposits) {
|
|
92
|
+
processBuilderDepositRequest(indexedState, builderDeposit);
|
|
93
|
+
}
|
|
94
|
+
for (const builderExit of requests.builderExits) {
|
|
95
|
+
processBuilderExitRequest(indexedState, builderExit);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
95
99
|
// Update parent payload availability and latest block hash
|
|
96
100
|
state.executionPayloadAvailability.set(parentSlot % SLOTS_PER_HISTORICAL_ROOT, true);
|
|
97
101
|
state.latestBlockHash = parentBid.blockHash;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
-
import {ForkSeq
|
|
2
|
+
import {ForkSeq} from "@lodestar/params";
|
|
3
3
|
import {Slot, phase0, ssz} from "@lodestar/types";
|
|
4
4
|
import {Validator} from "@lodestar/types/phase0";
|
|
5
5
|
import {getProposerSlashingSignatureSets} from "../signatureSets/index.js";
|
|
6
|
-
import {CachedBeaconStateAllForks
|
|
6
|
+
import {CachedBeaconStateAllForks} from "../types.js";
|
|
7
7
|
import {computeEpochAtSlot, isSlashableValidator} from "../util/index.js";
|
|
8
8
|
import {verifySignatureSet} from "../util/signatureSets.js";
|
|
9
9
|
import {slashValidator} from "./slashValidator.js";
|
|
@@ -23,32 +23,6 @@ export function processProposerSlashing(
|
|
|
23
23
|
const proposer = state.validators.getReadonly(proposerSlashing.signedHeader1.message.proposerIndex);
|
|
24
24
|
assertValidProposerSlashing(state.config, state.slot, proposerSlashing, proposer, verifySignatures);
|
|
25
25
|
|
|
26
|
-
if (fork >= ForkSeq.gloas) {
|
|
27
|
-
// Remove the BuilderPendingPayment corresponding to this proposal if it is still in the
|
|
28
|
-
// 2-epoch window. Only clear it when the slashed validator is the proposer associated with
|
|
29
|
-
// the payment; otherwise an unrelated same-slot equivocation could grief an honest proposer's
|
|
30
|
-
// payment.
|
|
31
|
-
const slot = Number(proposerSlashing.signedHeader1.message.slot);
|
|
32
|
-
const proposalEpoch = computeEpochAtSlot(slot);
|
|
33
|
-
const currentEpoch = state.epochCtx.epoch;
|
|
34
|
-
const previousEpoch = currentEpoch - 1;
|
|
35
|
-
|
|
36
|
-
const paymentIndex =
|
|
37
|
-
proposalEpoch === currentEpoch
|
|
38
|
-
? SLOTS_PER_EPOCH + (slot % SLOTS_PER_EPOCH)
|
|
39
|
-
: proposalEpoch === previousEpoch
|
|
40
|
-
? slot % SLOTS_PER_EPOCH
|
|
41
|
-
: undefined;
|
|
42
|
-
|
|
43
|
-
if (paymentIndex !== undefined) {
|
|
44
|
-
const builderPendingPayments = (state as CachedBeaconStateGloas).builderPendingPayments;
|
|
45
|
-
const payment = builderPendingPayments.get(paymentIndex);
|
|
46
|
-
if (payment.proposerIndex === proposerSlashing.signedHeader1.message.proposerIndex) {
|
|
47
|
-
builderPendingPayments.set(paymentIndex, ssz.gloas.BuilderPendingPayment.defaultViewDU());
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
26
|
slashValidator(fork, state, proposerSlashing.signedHeader1.message.proposerIndex);
|
|
53
27
|
}
|
|
54
28
|
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
WHISTLEBLOWER_REWARD_QUOTIENT,
|
|
14
14
|
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA,
|
|
15
15
|
} from "@lodestar/params";
|
|
16
|
-
import {ValidatorIndex} from "@lodestar/types";
|
|
17
|
-
import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../types.js";
|
|
16
|
+
import {ValidatorIndex, ssz} from "@lodestar/types";
|
|
17
|
+
import {CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStateGloas} from "../types.js";
|
|
18
18
|
import {decreaseBalance, increaseBalance} from "../util/index.js";
|
|
19
19
|
import {initiateValidatorExit} from "./initiateValidatorExit.js";
|
|
20
20
|
|
|
@@ -95,4 +95,15 @@ export function slashValidator(
|
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
|
|
99
|
+
if (fork >= ForkSeq.gloas) {
|
|
100
|
+
// Cleared on every slashing, not only proposer slashings: a proposer slashed via an attester slashing
|
|
101
|
+
// first would otherwise keep the builder paying for a block it equivocated on
|
|
102
|
+
const {builderPendingPayments} = state as CachedBeaconStateGloas;
|
|
103
|
+
for (let i = 0; i < builderPendingPayments.length; i++) {
|
|
104
|
+
if (builderPendingPayments.getReadonly(i).proposerIndex === slashedIndex) {
|
|
105
|
+
builderPendingPayments.set(i, ssz.gloas.BuilderPendingPayment.defaultViewDU());
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
98
109
|
}
|
package/src/cache/stateCache.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
BeaconStateGloas,
|
|
16
16
|
BeaconStateHeze,
|
|
17
17
|
BeaconStatePhase0,
|
|
18
|
+
BeaconStatePreHeze,
|
|
18
19
|
} from "./types.js";
|
|
19
20
|
|
|
20
21
|
export type BeaconStateCache = {
|
|
@@ -142,6 +143,7 @@ export type CachedBeaconStateHeze = CachedBeaconState<BeaconStateHeze>;
|
|
|
142
143
|
|
|
143
144
|
export type CachedBeaconStateAllForks = CachedBeaconState<BeaconStateAllForks>;
|
|
144
145
|
export type CachedBeaconStateExecutions = CachedBeaconState<BeaconStateExecutions>;
|
|
146
|
+
export type CachedBeaconStatePreHeze = CachedBeaconState<BeaconStatePreHeze>;
|
|
145
147
|
/**
|
|
146
148
|
* Create CachedBeaconState computing a new EpochCache instance
|
|
147
149
|
* TODO ELECTRA: rename this to createFinalizedCachedBeaconState() as it's intended for finalized state only
|
package/src/cache/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {CompositeViewDU} from "@chainsafe/ssz";
|
|
2
|
-
import {ForkAll, ForkName, ForkPostBellatrix, ForkPreGloas} from "@lodestar/params";
|
|
2
|
+
import {ForkAll, ForkName, ForkPostBellatrix, ForkPreGloas, ForkPreHeze} from "@lodestar/params";
|
|
3
3
|
import {Epoch, RootHex, SSZTypesFor} from "@lodestar/types";
|
|
4
4
|
import {EpochShuffling} from "../util/epochShuffling.js";
|
|
5
5
|
|
|
@@ -15,5 +15,6 @@ export type BeaconStateHeze = CompositeViewDU<SSZTypesFor<ForkName.heze, "Beacon
|
|
|
15
15
|
|
|
16
16
|
export type BeaconStateAllForks = CompositeViewDU<SSZTypesFor<ForkAll, "BeaconState">>;
|
|
17
17
|
export type BeaconStateExecutions = CompositeViewDU<SSZTypesFor<ForkPostBellatrix & ForkPreGloas, "BeaconState">>;
|
|
18
|
+
export type BeaconStatePreHeze = CompositeViewDU<SSZTypesFor<ForkPreHeze, "BeaconState">>;
|
|
18
19
|
|
|
19
20
|
export type ShufflingGetter = (shufflingEpoch: Epoch, dependentRoot: RootHex) => EpochShuffling | null;
|
package/src/epoch/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
CachedBeaconStateFulu,
|
|
15
15
|
CachedBeaconStateGloas,
|
|
16
16
|
CachedBeaconStatePhase0,
|
|
17
|
+
CachedBeaconStatePreHeze,
|
|
17
18
|
EpochTransitionCache,
|
|
18
19
|
} from "../types.js";
|
|
19
20
|
import {processBuilderPendingPayments} from "./processBuilderPendingPayments.js";
|
|
@@ -140,7 +141,9 @@ export function processEpoch(
|
|
|
140
141
|
timer?.();
|
|
141
142
|
}
|
|
142
143
|
|
|
143
|
-
|
|
144
|
+
if (fork < ForkSeq.heze) {
|
|
145
|
+
processEth1DataReset(state as CachedBeaconStatePreHeze, cache);
|
|
146
|
+
}
|
|
144
147
|
|
|
145
148
|
if (fork >= ForkSeq.electra) {
|
|
146
149
|
const stateElectra = state as CachedBeaconStateElectra;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {EPOCHS_PER_ETH1_VOTING_PERIOD} from "@lodestar/params";
|
|
2
2
|
import {ssz} from "@lodestar/types";
|
|
3
|
-
import {
|
|
3
|
+
import {CachedBeaconStatePreHeze, EpochTransitionCache} from "../types.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Reset eth1DataVotes tree every `EPOCHS_PER_ETH1_VOTING_PERIOD`.
|
|
7
7
|
*
|
|
8
8
|
* PERF: Almost no (constant) cost
|
|
9
9
|
*/
|
|
10
|
-
export function processEth1DataReset(state:
|
|
10
|
+
export function processEth1DataReset(state: CachedBeaconStatePreHeze, cache: EpochTransitionCache): void {
|
|
11
11
|
const nextEpoch = cache.currentEpoch + 1;
|
|
12
12
|
|
|
13
13
|
// reset eth1 data votes
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BLS_WITHDRAWAL_PREFIX,
|
|
3
|
+
FAR_FUTURE_EPOCH,
|
|
4
|
+
ForkSeq,
|
|
5
|
+
GENESIS_SLOT,
|
|
6
|
+
MAX_PENDING_DEPOSITS_PER_EPOCH,
|
|
7
|
+
} from "@lodestar/params";
|
|
2
8
|
import {electra} from "@lodestar/types";
|
|
3
9
|
import {addValidatorToRegistry, isValidDepositSignature} from "../block/processDeposit.js";
|
|
4
10
|
import {CachedBeaconStateElectra, EpochTransitionCache} from "../types.js";
|
|
@@ -71,7 +77,7 @@ export function processPendingDeposits(state: CachedBeaconStateElectra, cache: E
|
|
|
71
77
|
|
|
72
78
|
if (isValidatorWithdrawn) {
|
|
73
79
|
// Deposited balance will never become active. Increase balance but do not consume churn
|
|
74
|
-
applyPendingDeposit(state, deposit, cache);
|
|
80
|
+
applyPendingDeposit(fork, state, deposit, cache);
|
|
75
81
|
} else if (isValidatorExited) {
|
|
76
82
|
// Validator is exiting, postpone the deposit until after withdrawable epoch
|
|
77
83
|
depositsToPostpone.push(deposit);
|
|
@@ -83,7 +89,7 @@ export function processPendingDeposits(state: CachedBeaconStateElectra, cache: E
|
|
|
83
89
|
}
|
|
84
90
|
// Consume churn and apply deposit.
|
|
85
91
|
processedAmount += deposit.amount;
|
|
86
|
-
applyPendingDeposit(state, deposit, cache);
|
|
92
|
+
applyPendingDeposit(fork, state, deposit, cache);
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
// Regardless of how the deposit was handled, we move on in the queue.
|
|
@@ -110,6 +116,7 @@ export function processPendingDeposits(state: CachedBeaconStateElectra, cache: E
|
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
function applyPendingDeposit(
|
|
119
|
+
fork: ForkSeq,
|
|
113
120
|
state: CachedBeaconStateElectra,
|
|
114
121
|
deposit: electra.PendingDeposit,
|
|
115
122
|
cache: EpochTransitionCache
|
|
@@ -119,6 +126,10 @@ function applyPendingDeposit(
|
|
|
119
126
|
const cachedBalances = cache.balances;
|
|
120
127
|
|
|
121
128
|
if (!isValidatorKnown(state, validatorIndex)) {
|
|
129
|
+
// Do not create validators with BLS withdrawal credentials, the deposit is skipped without a refund
|
|
130
|
+
if (fork >= ForkSeq.heze && withdrawalCredentials[0] === BLS_WITHDRAWAL_PREFIX) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
122
133
|
// Verify the deposit signature (proof of possession) which is not checked by the deposit contract
|
|
123
134
|
if (isValidDepositSignature(state.config, pubkey, withdrawalCredentials, amount, signature)) {
|
|
124
135
|
addValidatorToRegistry(ForkSeq.electra, state, pubkey, withdrawalCredentials, amount);
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export {type BlockExternalData, DataAvailabilityStatus, ExecutionPayloadStatus} from "./block/externalData.js";
|
|
2
|
+
export {IndexedBuilderState} from "./block/indexedBuilderState.js";
|
|
2
3
|
export {getAttestationParticipationStatus, processAttestationsAltair} from "./block/processAttestationsAltair.js";
|
|
3
4
|
export {assertValidAttesterSlashing} from "./block/processAttesterSlashing.js";
|
|
4
5
|
export {isValidBlsToExecutionChange} from "./block/processBlsToExecutionChange.js";
|
|
@@ -43,7 +44,7 @@ export * from "./signatureSets/index.js";
|
|
|
43
44
|
export * from "./stateTransition.js";
|
|
44
45
|
export {BeaconStateView} from "./stateView/beaconStateView.js";
|
|
45
46
|
export {
|
|
46
|
-
type
|
|
47
|
+
type BlockSTFInput,
|
|
47
48
|
type ComputeNewStateRootResult,
|
|
48
49
|
type IBeaconStateView,
|
|
49
50
|
type IBeaconStateViewAltair,
|
|
@@ -54,6 +55,7 @@ export {
|
|
|
54
55
|
type IBeaconStateViewFulu,
|
|
55
56
|
type IBeaconStateViewGloas,
|
|
56
57
|
type IBeaconStateViewHeze,
|
|
58
|
+
type IBeaconStateViewNative,
|
|
57
59
|
isStatePostAltair,
|
|
58
60
|
isStatePostBellatrix,
|
|
59
61
|
isStatePostCapella,
|
|
@@ -63,6 +65,7 @@ export {
|
|
|
63
65
|
isStatePostGloas,
|
|
64
66
|
isStatePostHeze,
|
|
65
67
|
} from "./stateView/interface.js";
|
|
68
|
+
export {NativeBeaconStateView} from "./stateView/nativeBeaconStateView.js";
|
|
66
69
|
export {createBeaconStateView, createBeaconStateViewForHistoricalRegen} from "./stateView/stateViewFactory.js";
|
|
67
70
|
export type {
|
|
68
71
|
BeaconStateAllForks,
|
|
@@ -77,6 +80,7 @@ export type {
|
|
|
77
80
|
BeaconStateHeze,
|
|
78
81
|
// Non-cached states
|
|
79
82
|
BeaconStatePhase0,
|
|
83
|
+
BeaconStatePreHeze,
|
|
80
84
|
CachedBeaconStateAllForks,
|
|
81
85
|
CachedBeaconStateAltair,
|
|
82
86
|
CachedBeaconStateBellatrix,
|
|
@@ -88,5 +92,6 @@ export type {
|
|
|
88
92
|
CachedBeaconStateGloas,
|
|
89
93
|
CachedBeaconStateHeze,
|
|
90
94
|
CachedBeaconStatePhase0,
|
|
95
|
+
CachedBeaconStatePreHeze,
|
|
91
96
|
} from "./types.js";
|
|
92
97
|
export * from "./util/index.js";
|