@lodestar/beacon-node 1.50.0-dev.c04a499311 → 1.50.0-dev.c24762bc60
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/api/impl/beacon/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/index.js +13 -0
- package/lib/api/impl/beacon/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/index.js +28 -6
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +26 -18
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +32 -0
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts +5 -0
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +13 -23
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js +2 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
- package/lib/chain/beaconProposerCache.d.ts +6 -0
- package/lib/chain/beaconProposerCache.d.ts.map +1 -1
- package/lib/chain/beaconProposerCache.js +16 -0
- package/lib/chain/beaconProposerCache.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +14 -8
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +6 -6
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/chain.d.ts +5 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +73 -20
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/interface.d.ts +3 -0
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts +4 -2
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +30 -8
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/opPool.d.ts.map +1 -1
- package/lib/chain/opPools/opPool.js +1 -23
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/opPools/proposerPreferencesPool.d.ts +8 -4
- package/lib/chain/opPools/proposerPreferencesPool.d.ts.map +1 -1
- package/lib/chain/opPools/proposerPreferencesPool.js +27 -12
- package/lib/chain/opPools/proposerPreferencesPool.js.map +1 -1
- package/lib/chain/opPools/utils.d.ts +11 -0
- package/lib/chain/opPools/utils.d.ts.map +1 -1
- package/lib/chain/opPools/utils.js +22 -0
- package/lib/chain/opPools/utils.js.map +1 -1
- package/lib/chain/options.d.ts +1 -0
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +11 -3
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +8 -0
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +40 -28
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts +7 -0
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +21 -0
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- package/lib/chain/shufflingCache.d.ts +18 -8
- package/lib/chain/shufflingCache.d.ts.map +1 -1
- package/lib/chain/shufflingCache.js +72 -18
- package/lib/chain/shufflingCache.js.map +1 -1
- package/lib/db/beacon.d.ts +4 -1
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +6 -1
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/buckets.d.ts +3 -1
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +2 -0
- package/lib/db/buckets.js.map +1 -1
- package/lib/db/interface.d.ts +4 -1
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
- package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
- package/lib/db/repositories/earliestAvailableSlot.d.ts +11 -0
- package/lib/db/repositories/earliestAvailableSlot.d.ts.map +1 -0
- package/lib/db/repositories/earliestAvailableSlot.js +19 -0
- package/lib/db/repositories/earliestAvailableSlot.js.map +1 -0
- package/lib/db/repositories/index.d.ts +1 -0
- package/lib/db/repositories/index.d.ts.map +1 -1
- package/lib/db/repositories/index.js +1 -0
- package/lib/db/repositories/index.js.map +1 -1
- package/lib/db/repositories/proposerPreferences.d.ts +14 -0
- package/lib/db/repositories/proposerPreferences.d.ts.map +1 -0
- package/lib/db/repositories/proposerPreferences.js +21 -0
- package/lib/db/repositories/proposerPreferences.js.map +1 -0
- package/lib/execution/engine/blobVersionedHashes.d.ts +9 -0
- package/lib/execution/engine/blobVersionedHashes.d.ts.map +1 -0
- package/lib/execution/engine/blobVersionedHashes.js +74 -0
- package/lib/execution/engine/blobVersionedHashes.js.map +1 -0
- package/lib/execution/engine/http.d.ts +45 -13
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +236 -198
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/index.d.ts +3 -2
- package/lib/execution/engine/index.d.ts.map +1 -1
- package/lib/execution/engine/index.js +33 -8
- package/lib/execution/engine/index.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +1 -1
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.d.ts +25 -0
- package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -0
- package/lib/execution/engine/jsonRpcTransport.js +158 -0
- package/lib/execution/engine/jsonRpcTransport.js.map +1 -0
- package/lib/execution/engine/restHttpClient.d.ts +71 -0
- package/lib/execution/engine/restHttpClient.d.ts.map +1 -0
- package/lib/execution/engine/restHttpClient.js +201 -0
- package/lib/execution/engine/restHttpClient.js.map +1 -0
- package/lib/execution/engine/restTransport.d.ts +46 -0
- package/lib/execution/engine/restTransport.d.ts.map +1 -0
- package/lib/execution/engine/restTransport.js +399 -0
- package/lib/execution/engine/restTransport.js.map +1 -0
- package/lib/execution/engine/sszTypes.d.ts +1261 -0
- package/lib/execution/engine/sszTypes.d.ts.map +1 -0
- package/lib/execution/engine/sszTypes.js +216 -0
- package/lib/execution/engine/sszTypes.js.map +1 -0
- package/lib/execution/engine/transport.d.ts +39 -0
- package/lib/execution/engine/transport.d.ts.map +1 -0
- package/lib/execution/engine/transport.js +2 -0
- package/lib/execution/engine/transport.js.map +1 -0
- package/lib/execution/engine/types.d.ts +2 -0
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +24 -57
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/execution/engine/utils.d.ts.map +1 -1
- package/lib/execution/engine/utils.js +9 -2
- package/lib/execution/engine/utils.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +10 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +22 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/core/events.d.ts +5 -1
- package/lib/network/core/events.d.ts.map +1 -1
- package/lib/network/core/events.js +8 -0
- package/lib/network/core/events.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +60 -64
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/node/nodejs.d.ts +3 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +2 -1
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/options.d.ts +3 -2
- package/lib/node/options.d.ts.map +1 -1
- package/lib/node/options.js +2 -2
- package/lib/node/options.js.map +1 -1
- package/lib/sync/range/batch.d.ts +5 -5
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +11 -17
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +4 -4
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +9 -5
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/range.d.ts.map +1 -1
- package/lib/sync/range/range.js +25 -11
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +5 -2
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +44 -20
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +38 -14
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +84 -39
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/util/asyncIterableToEvents.d.ts +10 -2
- package/lib/util/asyncIterableToEvents.d.ts.map +1 -1
- package/lib/util/asyncIterableToEvents.js +29 -3
- package/lib/util/asyncIterableToEvents.js.map +1 -1
- package/lib/util/metadata.d.ts.map +1 -1
- package/lib/util/metadata.js +2 -1
- package/lib/util/metadata.js.map +1 -1
- package/package.json +17 -16
- package/src/api/impl/beacon/index.ts +15 -0
- package/src/api/impl/beacon/state/index.ts +43 -6
- package/src/api/impl/debug/index.ts +28 -19
- package/src/api/impl/validator/index.ts +45 -0
- package/src/chain/archiveStore/archiveStore.ts +18 -24
- package/src/chain/archiveStore/utils/pruneHistory.ts +4 -1
- package/src/chain/beaconProposerCache.ts +19 -1
- package/src/chain/blocks/importBlock.ts +17 -7
- package/src/chain/blocks/verifyBlock.ts +7 -6
- package/src/chain/chain.ts +97 -19
- package/src/chain/interface.ts +3 -0
- package/src/chain/opPools/aggregatedAttestationPool.ts +34 -10
- package/src/chain/opPools/opPool.ts +1 -31
- package/src/chain/opPools/proposerPreferencesPool.ts +34 -11
- package/src/chain/opPools/utils.ts +31 -0
- package/src/chain/options.ts +1 -1
- package/src/chain/prepareNextSlot.ts +15 -3
- package/src/chain/produceBlock/produceBlockBody.ts +68 -34
- package/src/chain/seenCache/seenGossipBlockInput.ts +23 -0
- package/src/chain/shufflingCache.ts +84 -22
- package/src/db/beacon.ts +6 -0
- package/src/db/buckets.ts +2 -0
- package/src/db/interface.ts +4 -0
- package/src/db/repositories/earliestAvailableSlot.ts +19 -0
- package/src/db/repositories/index.ts +1 -0
- package/src/db/repositories/proposerPreferences.ts +23 -0
- package/src/execution/engine/blobVersionedHashes.ts +72 -0
- package/src/execution/engine/http.ts +304 -271
- package/src/execution/engine/index.ts +41 -7
- package/src/execution/engine/interface.ts +1 -1
- package/src/execution/engine/jsonRpcTransport.ts +247 -0
- package/src/execution/engine/restHttpClient.ts +269 -0
- package/src/execution/engine/restTransport.ts +544 -0
- package/src/execution/engine/sszTypes.ts +354 -0
- package/src/execution/engine/transport.ts +61 -0
- package/src/execution/engine/types.ts +34 -74
- package/src/execution/engine/utils.ts +12 -2
- package/src/metrics/metrics/lodestar.ts +23 -0
- package/src/network/core/events.ts +16 -1
- package/src/network/processor/gossipHandlers.ts +91 -77
- package/src/node/nodejs.ts +4 -0
- package/src/node/options.ts +10 -1
- package/src/sync/range/batch.ts +14 -19
- package/src/sync/range/chain.ts +12 -7
- package/src/sync/range/range.ts +26 -12
- package/src/sync/unknownBlock.ts +57 -21
- package/src/sync/utils/downloadByRange.ts +123 -58
- package/src/util/asyncIterableToEvents.ts +44 -5
- package/src/util/metadata.ts +2 -1
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.c24762bc60",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"@chainsafe/persistent-merkle-tree": "^1.3.1",
|
|
110
110
|
"@chainsafe/prometheus-gc-stats": "^1.0.0",
|
|
111
111
|
"@chainsafe/snappy-wasm": "^0.5.2",
|
|
112
|
-
"@chainsafe/ssz": "^1.8.
|
|
112
|
+
"@chainsafe/ssz": "^1.8.1",
|
|
113
113
|
"@chainsafe/threads": "^1.11.3",
|
|
114
114
|
"@crate-crypto/node-eth-kzg": "0.9.1",
|
|
115
115
|
"@fastify/bearer-auth": "^10.0.1",
|
|
@@ -127,17 +127,17 @@
|
|
|
127
127
|
"@libp2p/prometheus-metrics": "^5.0.28",
|
|
128
128
|
"@libp2p/tcp": "^11.0.27",
|
|
129
129
|
"@libp2p/utils": "^7.4.0",
|
|
130
|
-
"@lodestar/api": "^1.50.0-dev.
|
|
131
|
-
"@lodestar/config": "^1.50.0-dev.
|
|
132
|
-
"@lodestar/db": "^1.50.0-dev.
|
|
133
|
-
"@lodestar/fork-choice": "^1.50.0-dev.
|
|
134
|
-
"@lodestar/logger": "^1.50.0-dev.
|
|
135
|
-
"@lodestar/params": "^1.50.0-dev.
|
|
136
|
-
"@lodestar/reqresp": "^1.50.0-dev.
|
|
137
|
-
"@lodestar/state-transition": "^1.50.0-dev.
|
|
138
|
-
"@lodestar/types": "^1.50.0-dev.
|
|
139
|
-
"@lodestar/utils": "^1.50.0-dev.
|
|
140
|
-
"@lodestar/validator": "^1.50.0-dev.
|
|
130
|
+
"@lodestar/api": "^1.50.0-dev.c24762bc60",
|
|
131
|
+
"@lodestar/config": "^1.50.0-dev.c24762bc60",
|
|
132
|
+
"@lodestar/db": "^1.50.0-dev.c24762bc60",
|
|
133
|
+
"@lodestar/fork-choice": "^1.50.0-dev.c24762bc60",
|
|
134
|
+
"@lodestar/logger": "^1.50.0-dev.c24762bc60",
|
|
135
|
+
"@lodestar/params": "^1.50.0-dev.c24762bc60",
|
|
136
|
+
"@lodestar/reqresp": "^1.50.0-dev.c24762bc60",
|
|
137
|
+
"@lodestar/state-transition": "^1.50.0-dev.c24762bc60",
|
|
138
|
+
"@lodestar/types": "^1.50.0-dev.c24762bc60",
|
|
139
|
+
"@lodestar/utils": "^1.50.0-dev.c24762bc60",
|
|
140
|
+
"@lodestar/validator": "^1.50.0-dev.c24762bc60",
|
|
141
141
|
"@multiformats/multiaddr": "^13.0.1",
|
|
142
142
|
"datastore-core": "^12.0.1",
|
|
143
143
|
"datastore-level": "^13.0.1",
|
|
@@ -156,10 +156,11 @@
|
|
|
156
156
|
"xxhash-wasm": "1.0.2"
|
|
157
157
|
},
|
|
158
158
|
"devDependencies": {
|
|
159
|
+
"@ethereumjs/rlp": "^4.0.1",
|
|
159
160
|
"@libp2p/interface-internal": "^3.1.12",
|
|
160
161
|
"@libp2p/logger": "^6.2.13",
|
|
161
|
-
"@lodestar/spec-test-util": "^1.50.0-dev.
|
|
162
|
-
"@lodestar/test-utils": "^1.50.0-dev.
|
|
162
|
+
"@lodestar/spec-test-util": "^1.50.0-dev.c24762bc60",
|
|
163
|
+
"@lodestar/test-utils": "^1.50.0-dev.c24762bc60",
|
|
163
164
|
"@types/js-yaml": "^4.0.5",
|
|
164
165
|
"@types/qs": "^6.9.7",
|
|
165
166
|
"@types/tmp": "^0.2.3",
|
|
@@ -174,5 +175,5 @@
|
|
|
174
175
|
"beacon",
|
|
175
176
|
"blockchain"
|
|
176
177
|
],
|
|
177
|
-
"gitHead": "
|
|
178
|
+
"gitHead": "9bf656e5d68744b152f79b9abf6cf29519d18744"
|
|
178
179
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ApplicationMethods} from "@lodestar/api/server";
|
|
3
|
+
import {isForkPostGloas} from "@lodestar/params";
|
|
4
|
+
import {computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
|
5
|
+
import {toRootHex} from "@lodestar/utils";
|
|
6
|
+
import {ApiError} from "../errors.js";
|
|
3
7
|
import {ApiModules} from "../types.js";
|
|
4
8
|
import {getBeaconBlockApi} from "./blocks/index.js";
|
|
5
9
|
import {getBeaconPoolApi} from "./pool/index.js";
|
|
@@ -31,5 +35,16 @@ export function getBeaconApi(
|
|
|
31
35
|
},
|
|
32
36
|
};
|
|
33
37
|
},
|
|
38
|
+
|
|
39
|
+
async getProposerPreferences({slot, dependentRoot}) {
|
|
40
|
+
// Preferences are broadcast up to one epoch ahead of their proposal slot, the first ones before Gloas is active
|
|
41
|
+
const fork = config.getForkName(slot ?? computeStartSlotAtEpoch(chain.clock.currentEpoch + 1));
|
|
42
|
+
if (!isForkPostGloas(fork)) {
|
|
43
|
+
throw new ApiError(400, `Proposer preferences are not supported before Gloas fork=${fork}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const preferences = chain.proposerPreferencesPool.getAll(slot, dependentRoot && toRootHex(dependentRoot));
|
|
47
|
+
return {data: preferences, meta: {version: fork}};
|
|
48
|
+
},
|
|
34
49
|
};
|
|
35
50
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ApplicationMethods} from "@lodestar/api/server";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
EPOCHS_PER_HISTORICAL_VECTOR,
|
|
5
|
+
MIN_SEED_LOOKAHEAD,
|
|
6
|
+
SLOTS_PER_EPOCH,
|
|
7
|
+
SYNC_COMMITTEE_SUBNET_SIZE,
|
|
8
|
+
} from "@lodestar/params";
|
|
4
9
|
import {
|
|
5
10
|
IBeaconStateView,
|
|
6
11
|
computeEpochAtSlot,
|
|
@@ -11,7 +16,14 @@ import {
|
|
|
11
16
|
isStatePostFulu,
|
|
12
17
|
isStatePostGloas,
|
|
13
18
|
} from "@lodestar/state-transition";
|
|
14
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
ValidatorIndex,
|
|
21
|
+
getBuilderStatus,
|
|
22
|
+
getValidatorStatus,
|
|
23
|
+
mapToGeneralStatus,
|
|
24
|
+
ssz,
|
|
25
|
+
sszTypesFor,
|
|
26
|
+
} from "@lodestar/types";
|
|
15
27
|
import {ApiError} from "../../errors.js";
|
|
16
28
|
import {ApiModules} from "../../types.js";
|
|
17
29
|
import {assertUniqueItems} from "../../utils.js";
|
|
@@ -100,7 +112,8 @@ export function getBeaconStateApi({
|
|
|
100
112
|
if (resp.valid) {
|
|
101
113
|
const validatorIndex = resp.validatorIndex;
|
|
102
114
|
const validator = state.getValidator(validatorIndex);
|
|
103
|
-
|
|
115
|
+
const status = getValidatorStatus(validator, currentEpoch);
|
|
116
|
+
if (statuses.length && !statuses.includes(status) && !statuses.includes(mapToGeneralStatus(status))) {
|
|
104
117
|
continue;
|
|
105
118
|
}
|
|
106
119
|
const validatorResponse = toValidatorResponse(
|
|
@@ -374,6 +387,28 @@ export function getBeaconStateApi({
|
|
|
374
387
|
};
|
|
375
388
|
},
|
|
376
389
|
|
|
390
|
+
async getStatePtc({stateId, slot}) {
|
|
391
|
+
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
392
|
+
if (!isStatePostGloas(state)) {
|
|
393
|
+
throw new ApiError(400, `Cannot retrieve PTC for pre-gloas state fork=${state.forkName}`);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const usedSlot = slot ?? state.slot;
|
|
397
|
+
const epoch = computeEpochAtSlot(usedSlot);
|
|
398
|
+
const stateEpoch = computeEpochAtSlot(state.slot);
|
|
399
|
+
if (epoch < config.GLOAS_FORK_EPOCH) {
|
|
400
|
+
throw new ApiError(400, `Cannot retrieve PTC for pre-gloas slot=${usedSlot}`);
|
|
401
|
+
}
|
|
402
|
+
if (epoch < stateEpoch - 1 || epoch > stateEpoch + MIN_SEED_LOOKAHEAD) {
|
|
403
|
+
throw new ApiError(400, `Slot ${usedSlot} is outside the PTC window of state epoch ${stateEpoch}`);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return {
|
|
407
|
+
data: {slot: usedSlot, validators: Array.from(state.getPayloadTimelinessCommittee(usedSlot))},
|
|
408
|
+
meta: {executionOptimistic, finalized},
|
|
409
|
+
};
|
|
410
|
+
},
|
|
411
|
+
|
|
377
412
|
async getPendingDeposits({stateId}, context) {
|
|
378
413
|
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
379
414
|
const fork = state.forkName;
|
|
@@ -385,7 +420,9 @@ export function getBeaconStateApi({
|
|
|
385
420
|
const pendingDeposits = state.pendingDeposits;
|
|
386
421
|
|
|
387
422
|
return {
|
|
388
|
-
data: context?.returnBytes
|
|
423
|
+
data: context?.returnBytes
|
|
424
|
+
? sszTypesFor(state.forkName).PendingDeposits.serialize(pendingDeposits)
|
|
425
|
+
: pendingDeposits,
|
|
389
426
|
meta: {executionOptimistic, finalized, version: fork},
|
|
390
427
|
};
|
|
391
428
|
},
|
|
@@ -402,7 +439,7 @@ export function getBeaconStateApi({
|
|
|
402
439
|
|
|
403
440
|
return {
|
|
404
441
|
data: context?.returnBytes
|
|
405
|
-
?
|
|
442
|
+
? sszTypesFor(state.forkName).PendingPartialWithdrawals.serialize(pendingPartialWithdrawals)
|
|
406
443
|
: pendingPartialWithdrawals,
|
|
407
444
|
meta: {executionOptimistic, finalized, version: fork},
|
|
408
445
|
};
|
|
@@ -420,7 +457,7 @@ export function getBeaconStateApi({
|
|
|
420
457
|
|
|
421
458
|
return {
|
|
422
459
|
data: context?.returnBytes
|
|
423
|
-
?
|
|
460
|
+
? sszTypesFor(state.forkName).PendingConsolidations.serialize(pendingConsolidations)
|
|
424
461
|
: pendingConsolidations,
|
|
425
462
|
meta: {executionOptimistic, finalized, version: fork},
|
|
426
463
|
};
|
|
@@ -4,7 +4,7 @@ import {ExecutionStatus, PayloadStatus} from "@lodestar/fork-choice";
|
|
|
4
4
|
import {ForkPostDeneb, ZERO_HASH_HEX, isForkPostDeneb, isForkPostFulu} from "@lodestar/params";
|
|
5
5
|
import {computeTimeAtSlot} from "@lodestar/state-transition";
|
|
6
6
|
import {BeaconState, DataColumnSidecar, DataColumnSidecars, type SignedBeaconBlock, sszTypesFor} from "@lodestar/types";
|
|
7
|
-
import {toRootHex} from "@lodestar/utils";
|
|
7
|
+
import {fromHex, toRootHex} from "@lodestar/utils";
|
|
8
8
|
import {getBlobKzgCommitments} from "../../../util/dataColumns.js";
|
|
9
9
|
import {isOptimisticBlock} from "../../../util/forkChoice.js";
|
|
10
10
|
import {getStateSlotFromBytes} from "../../../util/multifork.js";
|
|
@@ -74,46 +74,55 @@ export function getDebugApi({
|
|
|
74
74
|
|
|
75
75
|
async getDebugForkChoiceV2() {
|
|
76
76
|
const {forkChoice} = chain;
|
|
77
|
+
const nodes = forkChoice.getAllNodes();
|
|
78
|
+
const head = forkChoice.getHead();
|
|
77
79
|
return {
|
|
78
80
|
data: {
|
|
79
81
|
justifiedCheckpoint: forkChoice.getJustifiedCheckpoint(),
|
|
80
82
|
finalizedCheckpoint: forkChoice.getFinalizedCheckpoint(),
|
|
81
|
-
forkChoiceNodes:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const ptc = node.payloadStatus === PayloadStatus.FULL ? forkChoice.getPTCVoteCounts(node.blockRoot) : null;
|
|
83
|
+
forkChoiceNodes: nodes.map((node) => {
|
|
84
|
+
const parent = node.parent === undefined ? undefined : nodes[node.parent];
|
|
85
|
+
const ptc = forkChoice.getPTCVoteCounts(node.blockRoot);
|
|
85
86
|
return {
|
|
86
|
-
payloadStatus: toPayloadStatusName(node.payloadStatus),
|
|
87
87
|
slot: node.slot,
|
|
88
88
|
blockRoot: node.blockRoot,
|
|
89
|
-
|
|
89
|
+
payloadStatus: toPayloadStatusName(node.payloadStatus),
|
|
90
|
+
parentRoot:
|
|
91
|
+
node.parentBlockHash !== null && node.payloadStatus !== PayloadStatus.PENDING
|
|
92
|
+
? node.blockRoot
|
|
93
|
+
: node.parentRoot,
|
|
94
|
+
parentPayloadStatus: parent === undefined ? null : toPayloadStatusName(parent.payloadStatus),
|
|
95
|
+
justifiedCheckpoint: {epoch: node.justifiedEpoch, root: fromHex(node.justifiedRoot)},
|
|
96
|
+
finalizedCheckpoint: {epoch: node.finalizedEpoch, root: fromHex(node.finalizedRoot)},
|
|
90
97
|
weight: node.weight,
|
|
91
98
|
validity: toForkChoiceValidity(node.executionStatus),
|
|
92
99
|
executionBlockHash: node.executionPayloadBlockHash ?? ZERO_HASH_HEX,
|
|
100
|
+
payloadAttesterCount: ptc?.attesterCount ?? 0,
|
|
101
|
+
payloadAvailabilityYesCount: ptc?.payloadPresentCount ?? 0,
|
|
102
|
+
payloadDataAvailabilityYesCount: ptc?.dataAvailableCount ?? 0,
|
|
93
103
|
extraData: {
|
|
104
|
+
attestationScore: node.attestationScore,
|
|
94
105
|
executionOptimistic: isOptimisticBlock(node),
|
|
106
|
+
gasLimit:
|
|
107
|
+
node.payloadStatus === PayloadStatus.FULL && node.executionStatus !== ExecutionStatus.PreMerge
|
|
108
|
+
? node.executionPayloadGasLimit
|
|
109
|
+
: null,
|
|
95
110
|
timestamp: computeTimeAtSlot(config, node.slot, chain.genesisTime),
|
|
111
|
+
stateRoot: node.stateRoot,
|
|
96
112
|
target: node.targetRoot,
|
|
97
|
-
justifiedEpoch: node.justifiedEpoch,
|
|
98
|
-
finalizedEpoch: node.finalizedEpoch,
|
|
99
113
|
unrealizedJustifiedEpoch: node.unrealizedJustifiedEpoch,
|
|
114
|
+
unrealizedJustifiedRoot: node.unrealizedJustifiedRoot,
|
|
100
115
|
unrealizedFinalizedEpoch: node.unrealizedFinalizedEpoch,
|
|
101
|
-
|
|
102
|
-
payloadAvailabilityYesCount: ptc?.payloadPresentCount ?? null,
|
|
103
|
-
payloadDataAvailabilityYesCount: ptc?.dataAvailableCount ?? null,
|
|
104
|
-
gasLimit:
|
|
105
|
-
node.payloadStatus === PayloadStatus.FULL && "executionPayloadGasLimit" in node
|
|
106
|
-
? node.executionPayloadGasLimit
|
|
107
|
-
: null,
|
|
116
|
+
unrealizedFinalizedRoot: node.unrealizedFinalizedRoot,
|
|
108
117
|
},
|
|
109
118
|
};
|
|
110
119
|
}),
|
|
111
120
|
extraData: {
|
|
112
|
-
|
|
113
|
-
unrealizedFinalizedCheckpoint: forkChoice.getUnrealizedFinalizedCheckpoint(),
|
|
121
|
+
head: {blockRoot: head.blockRoot, payloadStatus: toPayloadStatusName(head.payloadStatus)},
|
|
114
122
|
proposerBoostRoot: forkChoice.getProposerBoostRoot(),
|
|
115
123
|
previousProposerBoostRoot: forkChoice.getPreviousProposerBoostRoot(),
|
|
116
|
-
|
|
124
|
+
unrealizedJustifiedCheckpoint: forkChoice.getUnrealizedJustifiedCheckpoint(),
|
|
125
|
+
unrealizedFinalizedCheckpoint: forkChoice.getUnrealizedFinalizedCheckpoint(),
|
|
117
126
|
},
|
|
118
127
|
},
|
|
119
128
|
};
|
|
@@ -1300,6 +1300,10 @@ export function getValidatorApi(
|
|
|
1300
1300
|
blobs: blobsBundle.blobs,
|
|
1301
1301
|
};
|
|
1302
1302
|
|
|
1303
|
+
if (chain.opts.persistProducedPayloadEnvelopes) {
|
|
1304
|
+
chain.persistExecutionPayloadEnvelope(blockContents.executionPayloadEnvelope);
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1303
1307
|
return {
|
|
1304
1308
|
data: blockContents,
|
|
1305
1309
|
meta: {version: fork, consensusBlockValue, executionPayloadValue, executionPayloadIncluded: true},
|
|
@@ -1928,6 +1932,17 @@ export function getValidatorApi(
|
|
|
1928
1932
|
},
|
|
1929
1933
|
|
|
1930
1934
|
async prepareBeaconCommitteeSubnet({subscriptions}) {
|
|
1935
|
+
// The subscribing validators use this node for duties regardless of its sync state and
|
|
1936
|
+
// the subscription must not fail on the tracking, e.g. if the finalized state is unavailable
|
|
1937
|
+
try {
|
|
1938
|
+
await chain.updateAttachedValidators(
|
|
1939
|
+
chain.clock.currentEpoch,
|
|
1940
|
+
Array.from(new Set(subscriptions.map(({validatorIndex}) => validatorIndex)))
|
|
1941
|
+
);
|
|
1942
|
+
} catch (e) {
|
|
1943
|
+
logger.warn("Error tracking attached validators", {count: subscriptions.length}, e as Error);
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1931
1946
|
notWhileSyncing(chain, sync.state);
|
|
1932
1947
|
|
|
1933
1948
|
await network.prepareBeaconCommitteeSubnets(
|
|
@@ -1991,6 +2006,13 @@ export function getValidatorApi(
|
|
|
1991
2006
|
},
|
|
1992
2007
|
|
|
1993
2008
|
async prepareBeaconProposer({proposers}) {
|
|
2009
|
+
if (isForkPostGloas(config.getForkName(chain.clock.currentSlot))) {
|
|
2010
|
+
throw new ApiError(
|
|
2011
|
+
410,
|
|
2012
|
+
"prepareBeaconProposer is no longer supported from gloas, submit signed proposer preferences via POST /eth/v1/validator/proposer_preferences instead"
|
|
2013
|
+
);
|
|
2014
|
+
}
|
|
2015
|
+
|
|
1994
2016
|
await chain.updateBeaconProposerData(chain.clock.currentEpoch, proposers);
|
|
1995
2017
|
},
|
|
1996
2018
|
|
|
@@ -2025,6 +2047,13 @@ export function getValidatorApi(
|
|
|
2025
2047
|
},
|
|
2026
2048
|
|
|
2027
2049
|
async registerValidator({registrations}) {
|
|
2050
|
+
if (isForkPostGloas(config.getForkName(chain.clock.currentSlot))) {
|
|
2051
|
+
throw new ApiError(
|
|
2052
|
+
410,
|
|
2053
|
+
"registerValidator is no longer supported from gloas, submit builder preferences via POST /eth/v1/validator/builder_preferences instead"
|
|
2054
|
+
);
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2028
2057
|
if (!chain.executionBuilder) {
|
|
2029
2058
|
throw Error("External builder not configured");
|
|
2030
2059
|
}
|
|
@@ -2060,11 +2089,14 @@ export function getValidatorApi(
|
|
|
2060
2089
|
|
|
2061
2090
|
async submitProposerPreferences({signedProposerPreferences}) {
|
|
2062
2091
|
const failures: FailureList = [];
|
|
2092
|
+
// Preferences submitted here are signed by validators using this node, gossiped ones are not
|
|
2093
|
+
const attachedValidatorIndices: ValidatorIndex[] = [];
|
|
2063
2094
|
|
|
2064
2095
|
await Promise.all(
|
|
2065
2096
|
signedProposerPreferences.map(async (signed, i) => {
|
|
2066
2097
|
try {
|
|
2067
2098
|
await validateGossipProposerPreferences(chain, signed);
|
|
2099
|
+
attachedValidatorIndices.push(signed.message.validatorIndex);
|
|
2068
2100
|
|
|
2069
2101
|
chain.proposerPreferencesPool.add(signed);
|
|
2070
2102
|
await network.publishProposerPreferences(signed);
|
|
@@ -2080,6 +2112,7 @@ export function getValidatorApi(
|
|
|
2080
2112
|
};
|
|
2081
2113
|
|
|
2082
2114
|
if (e instanceof ProposerPreferencesError && e.type.code === ProposerPreferencesErrorCode.ALREADY_KNOWN) {
|
|
2115
|
+
attachedValidatorIndices.push(signed.message.validatorIndex);
|
|
2083
2116
|
logger.debug("Ignoring known signed proposer preferences", logCtx);
|
|
2084
2117
|
return;
|
|
2085
2118
|
}
|
|
@@ -2093,6 +2126,14 @@ export function getValidatorApi(
|
|
|
2093
2126
|
})
|
|
2094
2127
|
);
|
|
2095
2128
|
|
|
2129
|
+
if (attachedValidatorIndices.length > 0) {
|
|
2130
|
+
try {
|
|
2131
|
+
await chain.updateAttachedValidators(chain.clock.currentEpoch, attachedValidatorIndices);
|
|
2132
|
+
} catch (e) {
|
|
2133
|
+
logger.warn("Error tracking attached validators", {count: attachedValidatorIndices.length}, e as Error);
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2096
2137
|
if (failures.length > 0) {
|
|
2097
2138
|
throw new IndexedError("Error processing signed proposer preferences", failures);
|
|
2098
2139
|
}
|
|
@@ -2187,6 +2228,10 @@ export function getValidatorApi(
|
|
|
2187
2228
|
blockHash: toRootHex(executionPayload.blockHash),
|
|
2188
2229
|
});
|
|
2189
2230
|
|
|
2231
|
+
if (chain.opts.persistProducedPayloadEnvelopes) {
|
|
2232
|
+
chain.persistExecutionPayloadEnvelope(envelope);
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2190
2235
|
return {
|
|
2191
2236
|
data: envelope,
|
|
2192
2237
|
meta: {
|
|
@@ -113,7 +113,9 @@ export class ArchiveStore {
|
|
|
113
113
|
this.logger,
|
|
114
114
|
this.metrics,
|
|
115
115
|
this.opts.anchorState.finalizedCheckpoint.epoch,
|
|
116
|
-
this.chain.clock.currentEpoch
|
|
116
|
+
this.chain.clock.currentEpoch,
|
|
117
|
+
this.statePruneFromSlot,
|
|
118
|
+
this.advanceEarliestAvailableSlot
|
|
117
119
|
),
|
|
118
120
|
() => this.logger.info("Still pruning historical data, please wait..."),
|
|
119
121
|
30_000,
|
|
@@ -122,26 +124,6 @@ export class ArchiveStore {
|
|
|
122
124
|
this.statePruneFromSlot = stateCutoffSlot;
|
|
123
125
|
}
|
|
124
126
|
|
|
125
|
-
// Initialize earliestAvailableSlot from the earliest block actually retained (after any pruning
|
|
126
|
-
// above), rather than the anchor state slot set in the constructor. On an in-place restart the DB
|
|
127
|
-
// still holds finalized history below the anchor; leaving the value at the anchor makes the node
|
|
128
|
-
// reject by_range requests (beacon_blocks, execution_payload_envelopes and data_column_sidecars
|
|
129
|
-
// all gate on this slot) for data it still retains. An empty archive (e.g. a fresh checkpoint
|
|
130
|
-
// sync with nothing below the anchor) leaves the constructor's anchor slot in place.
|
|
131
|
-
const earliestArchivedBlockSlot = await this.db.blockArchive.firstKey();
|
|
132
|
-
if (earliestArchivedBlockSlot != null) {
|
|
133
|
-
const oldEarliestAvailableSlot = this.chain.earliestAvailableSlot;
|
|
134
|
-
this.chain.earliestAvailableSlot = earliestArchivedBlockSlot;
|
|
135
|
-
this.logger.verbose("Initialized earliestAvailableSlot from retained block archive", {
|
|
136
|
-
oldEarliestAvailableSlot,
|
|
137
|
-
newEarliestAvailableSlot: earliestArchivedBlockSlot,
|
|
138
|
-
});
|
|
139
|
-
} else {
|
|
140
|
-
this.logger.verbose("Empty block archive on init, keeping anchor earliestAvailableSlot", {
|
|
141
|
-
earliestAvailableSlot: this.chain.earliestAvailableSlot,
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
127
|
if (this.opts.serveHistoricalState) {
|
|
146
128
|
this.historicalStateRegen = await HistoricalStateRegen.init({
|
|
147
129
|
opts: {
|
|
@@ -158,6 +140,18 @@ export class ArchiveStore {
|
|
|
158
140
|
}
|
|
159
141
|
}
|
|
160
142
|
|
|
143
|
+
/**
|
|
144
|
+
* The CLI owns the initial value; this only advances it during pruneHistory.
|
|
145
|
+
* Persisted before any deletion so a crash mid-prune never leaves the floor below deleted data.
|
|
146
|
+
*/
|
|
147
|
+
private advanceEarliestAvailableSlot = async (blockCutoffSlot: Slot): Promise<void> => {
|
|
148
|
+
const earliestAvailableSlot = Math.max(this.chain.earliestAvailableSlot, blockCutoffSlot);
|
|
149
|
+
if (earliestAvailableSlot !== this.chain.earliestAvailableSlot) {
|
|
150
|
+
await this.db.earliestAvailableSlot.set(earliestAvailableSlot);
|
|
151
|
+
this.chain.earliestAvailableSlot = earliestAvailableSlot;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
161
155
|
async close(): Promise<void> {
|
|
162
156
|
await this.historicalStateRegen?.close();
|
|
163
157
|
}
|
|
@@ -259,17 +253,17 @@ export class ArchiveStore {
|
|
|
259
253
|
|
|
260
254
|
if (this.opts.pruneHistory) {
|
|
261
255
|
timer = this.metrics?.processFinalizedCheckpoint.durationByTask.startTimer();
|
|
262
|
-
const {
|
|
256
|
+
const {stateCutoffSlot} = await pruneHistory(
|
|
263
257
|
this.chain.config,
|
|
264
258
|
this.db,
|
|
265
259
|
this.logger,
|
|
266
260
|
this.metrics,
|
|
267
261
|
finalizedEpoch,
|
|
268
262
|
this.chain.clock.currentEpoch,
|
|
269
|
-
this.statePruneFromSlot
|
|
263
|
+
this.statePruneFromSlot,
|
|
264
|
+
this.advanceEarliestAvailableSlot
|
|
270
265
|
);
|
|
271
266
|
this.statePruneFromSlot = stateCutoffSlot;
|
|
272
|
-
this.chain.earliestAvailableSlot = Math.max(this.chain.earliestAvailableSlot, blockCutoffSlot);
|
|
273
267
|
timer?.({source: ArchiveStoreTask.PruneHistory});
|
|
274
268
|
}
|
|
275
269
|
|
|
@@ -12,7 +12,8 @@ export async function pruneHistory(
|
|
|
12
12
|
metrics: Metrics | null | undefined,
|
|
13
13
|
finalizedEpoch: Epoch,
|
|
14
14
|
currentEpoch: Epoch,
|
|
15
|
-
statePruneFromSlot: Slot
|
|
15
|
+
statePruneFromSlot: Slot,
|
|
16
|
+
beforePrune: (blockCutoffSlot: Slot) => Promise<void>
|
|
16
17
|
): Promise<{blockCutoffSlot: Slot; stateCutoffSlot: Slot}> {
|
|
17
18
|
const blockCutoffEpoch = Math.min(
|
|
18
19
|
// set by config, with underflow protection
|
|
@@ -51,6 +52,8 @@ export async function pruneHistory(
|
|
|
51
52
|
stateSlots: prettyPrintIndices(states),
|
|
52
53
|
});
|
|
53
54
|
|
|
55
|
+
await beforePrune(blockCutoffSlot);
|
|
56
|
+
|
|
54
57
|
const step1 = metrics?.pruneHistory.pruneKeys.startTimer();
|
|
55
58
|
await Promise.all([
|
|
56
59
|
// ->
|
|
@@ -6,7 +6,7 @@ const PROPOSER_PRESERVE_EPOCHS = 2;
|
|
|
6
6
|
export type ProposerPreparationData = routes.validator.ProposerPreparationData;
|
|
7
7
|
|
|
8
8
|
export class BeaconProposerCache {
|
|
9
|
-
private readonly feeRecipientByValidatorIndex: Map<number, {epoch: Epoch; feeRecipient
|
|
9
|
+
private readonly feeRecipientByValidatorIndex: Map<number, {epoch: Epoch; feeRecipient?: string}>;
|
|
10
10
|
constructor(readonly opts: {suggestedFeeRecipient: string}) {
|
|
11
11
|
this.feeRecipientByValidatorIndex = new Map();
|
|
12
12
|
}
|
|
@@ -15,6 +15,24 @@ export class BeaconProposerCache {
|
|
|
15
15
|
this.feeRecipientByValidatorIndex.set(validatorIndex, {epoch, feeRecipient});
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Track a validator that uses this node for duties, keeping the fee recipient it may have
|
|
20
|
+
* registered. Returns true if the validator was not tracked before.
|
|
21
|
+
*/
|
|
22
|
+
track(epoch: Epoch, validatorIndex: number): boolean {
|
|
23
|
+
const entry = this.feeRecipientByValidatorIndex.get(validatorIndex);
|
|
24
|
+
if (entry !== undefined) {
|
|
25
|
+
entry.epoch = epoch;
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
this.feeRecipientByValidatorIndex.set(validatorIndex, {epoch});
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
has(validatorIndex: number): boolean {
|
|
33
|
+
return this.feeRecipientByValidatorIndex.has(validatorIndex);
|
|
34
|
+
}
|
|
35
|
+
|
|
18
36
|
prune(epoch: Epoch): void {
|
|
19
37
|
// This is not so optimized function, but could maintain a 2d array may be?
|
|
20
38
|
for (const [validatorIndex, feeRecipientEntry] of this.feeRecipientByValidatorIndex.entries()) {
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
RootCache,
|
|
23
23
|
computeEpochAtSlot,
|
|
24
24
|
computeTimeAtSlot,
|
|
25
|
+
getBeaconCommittees,
|
|
25
26
|
isStatePostAltair,
|
|
26
27
|
isStatePostBellatrix,
|
|
27
28
|
} from "@lodestar/state-transition";
|
|
@@ -129,11 +130,17 @@ export async function importBlock(
|
|
|
129
130
|
|
|
130
131
|
// Should compute checkpoint balances before forkchoice.onBlock
|
|
131
132
|
this.checkpointBalancesCache.processState(blockRootHex, postState);
|
|
132
|
-
if (
|
|
133
|
+
if (isGloasBeaconBlock(block.message)) {
|
|
134
|
+
// A gloas block has no payload of its own, it inherits the status of the payload it builds on,
|
|
135
|
+
// i.e. the parent variant matching the bid's parent block hash. The parent's default (PENDING)
|
|
136
|
+
// variant does not reflect a SYNCING parent payload, and onBlock would then mark that payload VALID.
|
|
133
137
|
const parentRootHex = toRootHex(block.message.parentRoot);
|
|
134
|
-
const
|
|
138
|
+
const parentBlockHashHex = toRootHex(block.message.body.signedExecutionPayloadBid.message.parentBlockHash);
|
|
139
|
+
const parentBlock = this.forkChoice.getBlockHexAndBlockHash(parentRootHex, parentBlockHashHex);
|
|
135
140
|
if (parentBlock === null) {
|
|
136
|
-
throw Error(
|
|
141
|
+
throw Error(
|
|
142
|
+
`Parent block not found in forkChoice, parentRoot=${parentRootHex} parentBlockHash=${parentBlockHashHex}`
|
|
143
|
+
);
|
|
137
144
|
}
|
|
138
145
|
if (parentBlock.executionStatus === ExecutionStatus.Invalid) {
|
|
139
146
|
throw Error(`Parent block has invalid execution status, parentRoot=${parentRootHex}`);
|
|
@@ -400,9 +407,8 @@ export async function importBlock(
|
|
|
400
407
|
const proposalSlot = blockSlot + 1;
|
|
401
408
|
try {
|
|
402
409
|
const proposerIndex = postState.getBeaconProposer(proposalSlot);
|
|
403
|
-
const feeRecipient = this.beaconProposerCache.get(proposerIndex);
|
|
404
410
|
|
|
405
|
-
if (
|
|
411
|
+
if (this.beaconProposerCache.has(proposerIndex)) {
|
|
406
412
|
// We would set this to true if
|
|
407
413
|
// 1) This is a gossip block
|
|
408
414
|
// 2) We are proposer of next slot
|
|
@@ -657,8 +663,12 @@ export function addAttestationPostElectra(
|
|
|
657
663
|
} else {
|
|
658
664
|
const attSlot = attestation.data.slot;
|
|
659
665
|
const attEpoch = computeEpochAtSlot(attSlot);
|
|
660
|
-
|
|
661
|
-
|
|
666
|
+
// calling getShufflingAtEpoch may take some time for NativeBeaconStateView
|
|
667
|
+
// we should have the shuffling inside ShufflingCache most of the time
|
|
668
|
+
const shuffling =
|
|
669
|
+
this.shufflingCache.getSync(attEpoch, state.getShufflingDecisionRoot(attEpoch)) ??
|
|
670
|
+
state.getShufflingAtEpoch(attEpoch);
|
|
671
|
+
const committees = getBeaconCommittees(shuffling, attSlot, committeeIndices);
|
|
662
672
|
const aggregationBools = attestation.aggregationBits.toBoolArray();
|
|
663
673
|
let offset = 0;
|
|
664
674
|
for (let i = 0; i < committees.length; i++) {
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
DataAvailabilityStatus,
|
|
5
5
|
IBeaconStateView,
|
|
6
6
|
computeEpochAtSlot,
|
|
7
|
+
getIndexedAttestation,
|
|
7
8
|
signedBlockToSignedHeader,
|
|
8
9
|
} from "@lodestar/state-transition";
|
|
9
10
|
import {IndexedAttestation, Slot, deneb} from "@lodestar/types";
|
|
@@ -81,10 +82,6 @@ export async function verifyBlocksInEpoch(
|
|
|
81
82
|
throw new BlockError(block0, {code: BlockErrorCode.PRESTATE_MISSING, error: e as Error});
|
|
82
83
|
});
|
|
83
84
|
|
|
84
|
-
// in forky condition, make sure to populate ShufflingCache with regened state
|
|
85
|
-
// otherwise it may fail to get indexed attestations from shuffling cache later
|
|
86
|
-
this.shufflingCache.processState(preState0);
|
|
87
|
-
|
|
88
85
|
if (!preState0.isStateValidatorsNodesPopulated()) {
|
|
89
86
|
this.logger.verbose("verifyBlocksInEpoch preState0 SSZ cache stats", {
|
|
90
87
|
slot: preState0.slot,
|
|
@@ -117,8 +114,12 @@ export async function verifyBlocksInEpoch(
|
|
|
117
114
|
for (const [i, block] of blocks.entries()) {
|
|
118
115
|
indexedAttestationsByBlock[i] = block.message.body.attestations.map((attestation) => {
|
|
119
116
|
const attEpoch = computeEpochAtSlot(attestation.data.slot);
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
// calling getShufflingAtEpoch may take some time for NativeBeaconStateView
|
|
118
|
+
// we should have the shuffling inside ShufflingCache most of the time
|
|
119
|
+
const shuffling =
|
|
120
|
+
this.shufflingCache.getSync(attEpoch, preState0.getShufflingDecisionRoot(attEpoch)) ??
|
|
121
|
+
preState0.getShufflingAtEpoch(attEpoch);
|
|
122
|
+
return getIndexedAttestation(shuffling, fork, attestation);
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
|