@lodestar/beacon-node 1.41.0-dev.4a2801bf60 → 1.41.0-dev.4e115ed25d
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/blocks/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +121 -3
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.js +8 -8
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +3 -4
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +5 -24
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +6 -2
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/node/utils.d.ts +1 -1
- package/lib/api/impl/node/utils.d.ts.map +1 -1
- package/lib/api/impl/node/utils.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +104 -6
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts +1 -0
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +9 -0
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +5 -6
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +9 -10
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +3 -3
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/archiveStore/utils/archivePayloads.d.ts +7 -0
- package/lib/chain/archiveStore/utils/archivePayloads.d.ts.map +1 -0
- package/lib/chain/archiveStore/utils/archivePayloads.js +10 -0
- package/lib/chain/archiveStore/utils/archivePayloads.js.map +1 -0
- package/lib/chain/blocks/blockInput/blockInput.d.ts +20 -2
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +47 -0
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/blockInput/types.d.ts +2 -1
- package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/types.js +1 -0
- package/lib/chain/blocks/blockInput/types.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.js +3 -0
- package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +4 -0
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +5 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
- package/lib/chain/bls/multithread/index.d.ts +3 -3
- package/lib/chain/bls/multithread/index.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.js +5 -5
- package/lib/chain/bls/multithread/index.js.map +1 -1
- package/lib/chain/bls/multithread/jobItem.d.ts +2 -2
- package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
- package/lib/chain/bls/multithread/jobItem.js +2 -2
- package/lib/chain/bls/multithread/jobItem.js.map +1 -1
- package/lib/chain/bls/singleThread.d.ts +4 -4
- package/lib/chain/bls/singleThread.d.ts.map +1 -1
- package/lib/chain/bls/singleThread.js +4 -4
- package/lib/chain/bls/singleThread.js.map +1 -1
- package/lib/chain/bls/utils.d.ts +2 -2
- package/lib/chain/bls/utils.d.ts.map +1 -1
- package/lib/chain/bls/utils.js +7 -4
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/chain.d.ts +6 -9
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +32 -16
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +2 -2
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/interface.d.ts +4 -6
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/prepareNextSlot.js +3 -3
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts +10 -2
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +24 -2
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +22 -7
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +110 -10
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +15 -7
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +4 -1
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/attesterSlashing.js +1 -1
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts +2 -2
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +8 -1
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +1 -1
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +1 -1
- package/lib/db/beacon.d.ts +3 -1
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +5 -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 +3 -1
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/blockArchive.d.ts.map +1 -1
- package/lib/db/repositories/blockArchive.js +1 -2
- package/lib/db/repositories/blockArchive.js.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/dataColumnSidecar.d.ts +5 -3
- package/lib/db/repositories/dataColumnSidecar.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecar.js +14 -1
- package/lib/db/repositories/dataColumnSidecar.js.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts +5 -3
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js +14 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
- package/lib/db/repositories/executionPayloadEnvelope.d.ts +19 -0
- package/lib/db/repositories/executionPayloadEnvelope.d.ts.map +1 -0
- package/lib/db/repositories/executionPayloadEnvelope.js +22 -0
- package/lib/db/repositories/executionPayloadEnvelope.js.map +1 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts +18 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts.map +1 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js +28 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -0
- package/lib/db/repositories/index.d.ts +2 -0
- package/lib/db/repositories/index.d.ts.map +1 -1
- package/lib/db/repositories/index.js +2 -0
- package/lib/db/repositories/index.js.map +1 -1
- package/lib/execution/engine/http.d.ts +1 -0
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +3 -0
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +1 -0
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +5 -0
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +8 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +14 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/monitoring/service.d.ts +2 -2
- package/lib/monitoring/service.d.ts.map +1 -1
- package/lib/monitoring/service.js +3 -2
- package/lib/monitoring/service.js.map +1 -1
- package/lib/network/core/networkCore.d.ts +3 -3
- package/lib/network/core/networkCore.d.ts.map +1 -1
- package/lib/network/core/networkCore.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts +3 -3
- package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
- package/lib/network/core/types.d.ts +2 -2
- package/lib/network/core/types.d.ts.map +1 -1
- package/lib/network/events.d.ts +2 -1
- package/lib/network/events.d.ts.map +1 -1
- package/lib/network/events.js.map +1 -1
- package/lib/network/gossip/encoding.d.ts +3 -3
- package/lib/network/gossip/encoding.d.ts.map +1 -1
- package/lib/network/gossip/encoding.js.map +1 -1
- package/lib/network/gossip/gossipsub.d.ts +13 -4
- package/lib/network/gossip/gossipsub.d.ts.map +1 -1
- package/lib/network/gossip/gossipsub.js +47 -20
- package/lib/network/gossip/gossipsub.js.map +1 -1
- package/lib/network/gossip/interface.d.ts +6 -6
- package/lib/network/gossip/interface.d.ts.map +1 -1
- package/lib/network/gossip/scoringParameters.d.ts +1 -1
- package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
- package/lib/network/gossip/scoringParameters.js +1 -1
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +113 -63
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +2 -2
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/interface.d.ts +6 -5
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/libp2p/index.d.ts +1 -1
- package/lib/network/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +29 -9
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/network.d.ts +5 -4
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +10 -1
- package/lib/network/network.js.map +1 -1
- package/lib/network/options.d.ts.map +1 -1
- package/lib/network/options.js +3 -0
- package/lib/network/options.js.map +1 -1
- package/lib/network/peers/datastore.d.ts +7 -5
- package/lib/network/peers/datastore.d.ts.map +1 -1
- package/lib/network/peers/datastore.js +10 -10
- package/lib/network/peers/datastore.js.map +1 -1
- package/lib/network/peers/peerManager.d.ts +3 -0
- package/lib/network/peers/peerManager.d.ts.map +1 -1
- package/lib/network/peers/peerManager.js +103 -53
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.d.ts +3 -3
- package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +8 -2
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipValidatorFn.js +1 -1
- package/lib/network/processor/types.d.ts +1 -1
- package/lib/network/processor/types.d.ts.map +1 -1
- package/lib/network/reqresp/score.d.ts.map +1 -1
- package/lib/network/reqresp/score.js +0 -1
- package/lib/network/reqresp/score.js.map +1 -1
- package/lib/network/util.js +2 -2
- package/lib/network/util.js.map +1 -1
- package/lib/node/nodejs.d.ts +3 -5
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +6 -4
- package/lib/node/nodejs.js.map +1 -1
- package/lib/util/blobs.d.ts +2 -2
- package/lib/util/blobs.d.ts.map +1 -1
- package/lib/util/blobs.js.map +1 -1
- package/lib/util/dataColumns.d.ts +11 -3
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +27 -0
- package/lib/util/dataColumns.js.map +1 -1
- package/lib/util/multifork.d.ts +8 -0
- package/lib/util/multifork.d.ts.map +1 -1
- package/lib/util/multifork.js +37 -0
- package/lib/util/multifork.js.map +1 -1
- package/package.json +38 -41
- package/src/api/impl/beacon/blocks/index.ts +145 -2
- package/src/api/impl/beacon/state/index.ts +8 -8
- package/src/api/impl/beacon/state/utils.ts +15 -29
- package/src/api/impl/debug/index.ts +9 -5
- package/src/api/impl/node/utils.ts +3 -3
- package/src/api/impl/validator/index.ts +127 -5
- package/src/chain/archiveStore/archiveStore.ts +10 -0
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +10 -11
- package/src/chain/archiveStore/historicalState/worker.ts +3 -3
- package/src/chain/archiveStore/utils/archivePayloads.ts +15 -0
- package/src/chain/blocks/blockInput/blockInput.ts +68 -3
- package/src/chain/blocks/blockInput/types.ts +1 -0
- package/src/chain/blocks/verifyBlocksDataAvailability.ts +3 -0
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +9 -2
- package/src/chain/bls/multithread/index.ts +7 -7
- package/src/chain/bls/multithread/jobItem.ts +3 -3
- package/src/chain/bls/singleThread.ts +5 -5
- package/src/chain/bls/utils.ts +8 -5
- package/src/chain/chain.ts +51 -26
- package/src/chain/emitter.ts +2 -2
- package/src/chain/interface.ts +4 -11
- package/src/chain/options.ts +1 -0
- package/src/chain/prepareNextSlot.ts +5 -5
- package/src/chain/produceBlock/computeNewStateRoot.ts +35 -3
- package/src/chain/produceBlock/produceBlockBody.ts +163 -13
- package/src/chain/seenCache/seenGossipBlockInput.ts +16 -7
- package/src/chain/validation/attestation.ts +4 -1
- package/src/chain/validation/attesterSlashing.ts +1 -1
- package/src/chain/validation/dataColumnSidecar.ts +2 -5
- package/src/chain/validation/payloadAttestationMessage.ts +9 -1
- package/src/chain/validation/proposerSlashing.ts +1 -1
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +1 -1
- package/src/db/beacon.ts +8 -0
- package/src/db/buckets.ts +3 -0
- package/src/db/interface.ts +5 -0
- package/src/db/repositories/blockArchive.ts +1 -2
- package/src/db/repositories/dataColumnSidecar.ts +18 -3
- package/src/db/repositories/dataColumnSidecarArchive.ts +18 -3
- package/src/db/repositories/executionPayloadEnvelope.ts +26 -0
- package/src/db/repositories/executionPayloadEnvelopeArchive.ts +32 -0
- package/src/db/repositories/index.ts +2 -0
- package/src/execution/engine/http.ts +3 -0
- package/src/metrics/metrics/beacon.ts +5 -0
- package/src/metrics/metrics/lodestar.ts +14 -0
- package/src/monitoring/service.ts +3 -2
- package/src/network/core/networkCore.ts +3 -3
- package/src/network/core/networkCoreWorkerHandler.ts +3 -3
- package/src/network/core/types.ts +2 -2
- package/src/network/events.ts +2 -1
- package/src/network/gossip/encoding.ts +3 -3
- package/src/network/gossip/gossipsub.ts +86 -25
- package/src/network/gossip/interface.ts +6 -6
- package/src/network/gossip/scoringParameters.ts +4 -4
- package/src/network/gossip/topic.ts +2 -1
- package/src/network/interface.ts +7 -4
- package/src/network/libp2p/index.ts +33 -10
- package/src/network/network.ts +24 -6
- package/src/network/options.ts +3 -0
- package/src/network/peers/datastore.ts +13 -10
- package/src/network/peers/peerManager.ts +118 -54
- package/src/network/peers/utils/prioritizePeers.ts +3 -3
- package/src/network/processor/gossipHandlers.ts +14 -4
- package/src/network/processor/gossipValidatorFn.ts +1 -1
- package/src/network/processor/types.ts +1 -1
- package/src/network/reqresp/score.ts +0 -1
- package/src/network/util.ts +2 -2
- package/src/node/nodejs.ts +8 -9
- package/src/util/blobs.ts +3 -3
- package/src/util/dataColumns.ts +37 -1
- package/src/util/multifork.ts +45 -0
- package/src/util/workerEvents.ts +1 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {ProtoBlock, getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
2
|
+
import {IForkChoice, ProtoBlock, getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
3
3
|
import {
|
|
4
|
+
BUILDER_INDEX_SELF_BUILD,
|
|
4
5
|
ForkName,
|
|
5
6
|
ForkPostBellatrix,
|
|
7
|
+
ForkPostCapella,
|
|
6
8
|
ForkPostDeneb,
|
|
7
9
|
ForkPostFulu,
|
|
10
|
+
ForkPostGloas,
|
|
8
11
|
ForkPreGloas,
|
|
9
12
|
ForkSeq,
|
|
10
13
|
isForkPostAltair,
|
|
@@ -16,6 +19,8 @@ import {
|
|
|
16
19
|
CachedBeaconStateBellatrix,
|
|
17
20
|
CachedBeaconStateCapella,
|
|
18
21
|
CachedBeaconStateExecutions,
|
|
22
|
+
CachedBeaconStateGloas,
|
|
23
|
+
G2_POINT_AT_INFINITY,
|
|
19
24
|
computeTimeAtSlot,
|
|
20
25
|
getExpectedWithdrawals,
|
|
21
26
|
getRandaoMix,
|
|
@@ -42,6 +47,7 @@ import {
|
|
|
42
47
|
deneb,
|
|
43
48
|
electra,
|
|
44
49
|
fulu,
|
|
50
|
+
gloas,
|
|
45
51
|
} from "@lodestar/types";
|
|
46
52
|
import {Logger, fromHex, sleep, toHex, toPubkeyHex, toRootHex} from "@lodestar/utils";
|
|
47
53
|
import {ZERO_HASH_HEX} from "../../constants/index.js";
|
|
@@ -99,6 +105,20 @@ export type AssembledBodyType<T extends BlockType> = T extends BlockType.Full
|
|
|
99
105
|
: BlindedBeaconBlockBody;
|
|
100
106
|
export type AssembledBlockType<T extends BlockType> = T extends BlockType.Full ? BeaconBlock : BlindedBeaconBlock;
|
|
101
107
|
|
|
108
|
+
export type ProduceFullGloas = {
|
|
109
|
+
type: BlockType.Full;
|
|
110
|
+
fork: ForkPostGloas;
|
|
111
|
+
executionPayload: ExecutionPayload<ForkPostGloas>;
|
|
112
|
+
executionRequests: electra.ExecutionRequests;
|
|
113
|
+
blobsBundle: BlobsBundle<ForkPostGloas>;
|
|
114
|
+
cells: fulu.Cell[][];
|
|
115
|
+
/**
|
|
116
|
+
* Cached envelope state root computed during block production.
|
|
117
|
+
* This is the state root after running `processExecutionPayloadEnvelope` on the
|
|
118
|
+
* post-block state, and later used to construct the `ExecutionPayloadEnvelope`.
|
|
119
|
+
*/
|
|
120
|
+
envelopeStateRoot: Root;
|
|
121
|
+
};
|
|
102
122
|
export type ProduceFullFulu = {
|
|
103
123
|
type: BlockType.Full;
|
|
104
124
|
fork: ForkPostFulu;
|
|
@@ -131,6 +151,7 @@ export type ProduceBlinded = {
|
|
|
131
151
|
|
|
132
152
|
/** The result of local block production, everything that's not the block itself */
|
|
133
153
|
export type ProduceResult =
|
|
154
|
+
| ProduceFullGloas
|
|
134
155
|
| ProduceFullFulu
|
|
135
156
|
| ProduceFullDeneb
|
|
136
157
|
| ProduceFullBellatrix
|
|
@@ -180,12 +201,112 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
180
201
|
this.logger.verbose("Producing beacon block body", logMeta);
|
|
181
202
|
|
|
182
203
|
if (isForkPostGloas(fork)) {
|
|
183
|
-
// TODO GLOAS:
|
|
204
|
+
// TODO GLOAS: support non self-building here, the block type differentiation between
|
|
205
|
+
// full and blinded no longer makes sense in gloas, it might be a good idea to move
|
|
206
|
+
// this into a completely separate function and have pre/post gloas more separated
|
|
207
|
+
const gloasState = currentState as CachedBeaconStateGloas;
|
|
208
|
+
const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice);
|
|
209
|
+
const finalizedBlockHash = this.forkChoice.getFinalizedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX;
|
|
210
|
+
const feeRecipient = requestedFeeRecipient ?? this.beaconProposerCache.getOrDefault(proposerIndex);
|
|
211
|
+
|
|
212
|
+
const endExecutionPayload = this.metrics?.executionBlockProductionTimeSteps.startTimer();
|
|
213
|
+
|
|
214
|
+
this.logger.verbose("Preparing execution payload from engine", {
|
|
215
|
+
slot: blockSlot,
|
|
216
|
+
parentBlockRoot: toRootHex(parentBlockRoot),
|
|
217
|
+
feeRecipient,
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// Get execution payload from EL
|
|
221
|
+
const prepareRes = await prepareExecutionPayload(
|
|
222
|
+
this,
|
|
223
|
+
this.logger,
|
|
224
|
+
fork,
|
|
225
|
+
parentBlockRoot,
|
|
226
|
+
safeBlockHash,
|
|
227
|
+
finalizedBlockHash ?? ZERO_HASH_HEX,
|
|
228
|
+
gloasState,
|
|
229
|
+
feeRecipient
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
const {prepType, payloadId} = prepareRes;
|
|
233
|
+
Object.assign(logMeta, {executionPayloadPrepType: prepType});
|
|
234
|
+
|
|
235
|
+
if (prepType !== PayloadPreparationType.Cached) {
|
|
236
|
+
await sleep(PAYLOAD_GENERATION_TIME_MS);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
this.logger.verbose("Fetching execution payload from engine", {slot: blockSlot, payloadId});
|
|
240
|
+
const payloadRes = await this.executionEngine.getPayload(fork, payloadId);
|
|
241
|
+
|
|
242
|
+
endExecutionPayload?.({step: BlockProductionStep.executionPayload});
|
|
243
|
+
|
|
244
|
+
const {executionPayload, blobsBundle, executionRequests} = payloadRes;
|
|
245
|
+
executionPayloadValue = payloadRes.executionPayloadValue;
|
|
246
|
+
shouldOverrideBuilder = payloadRes.shouldOverrideBuilder;
|
|
247
|
+
|
|
248
|
+
if (blobsBundle === undefined) {
|
|
249
|
+
throw Error(`Missing blobsBundle response from getPayload at fork=${fork}`);
|
|
250
|
+
}
|
|
251
|
+
if (executionRequests === undefined) {
|
|
252
|
+
throw Error(`Missing executionRequests response from getPayload at fork=${fork}`);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const cells = blobsBundle.blobs.map((blob) => kzg.computeCells(blob));
|
|
256
|
+
if (this.opts.sanityCheckExecutionEngineBlobs) {
|
|
257
|
+
await validateCellsAndKzgCommitments(blobsBundle.commitments, blobsBundle.proofs, cells);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Create self-build execution payload bid
|
|
261
|
+
const bid: gloas.ExecutionPayloadBid = {
|
|
262
|
+
parentBlockHash: gloasState.latestBlockHash,
|
|
263
|
+
parentBlockRoot: parentBlockRoot,
|
|
264
|
+
blockHash: executionPayload.blockHash,
|
|
265
|
+
prevRandao: getRandaoMix(gloasState, gloasState.epochCtx.epoch),
|
|
266
|
+
feeRecipient: executionPayload.feeRecipient,
|
|
267
|
+
gasLimit: BigInt(executionPayload.gasLimit),
|
|
268
|
+
builderIndex: BUILDER_INDEX_SELF_BUILD,
|
|
269
|
+
slot: blockSlot,
|
|
270
|
+
value: 0,
|
|
271
|
+
executionPayment: 0,
|
|
272
|
+
blobKzgCommitments: blobsBundle.commitments,
|
|
273
|
+
};
|
|
274
|
+
const signedBid: gloas.SignedExecutionPayloadBid = {
|
|
275
|
+
message: bid,
|
|
276
|
+
signature: G2_POINT_AT_INFINITY,
|
|
277
|
+
};
|
|
278
|
+
|
|
184
279
|
const commonBlockBody = await commonBlockBodyPromise;
|
|
185
|
-
|
|
186
|
-
|
|
280
|
+
const gloasBody = Object.assign({}, commonBlockBody) as gloas.BeaconBlockBody;
|
|
281
|
+
gloasBody.signedExecutionPayloadBid = signedBid;
|
|
282
|
+
// TODO GLOAS: Get payload attestations from pool for previous slot
|
|
283
|
+
gloasBody.payloadAttestations = [];
|
|
284
|
+
blockBody = gloasBody as AssembledBodyType<T>;
|
|
285
|
+
|
|
286
|
+
// Store execution payload data required to construct execution payload envelope later
|
|
287
|
+
const gloasResult = produceResult as ProduceFullGloas;
|
|
288
|
+
gloasResult.executionPayload = executionPayload as ExecutionPayload<ForkPostGloas>;
|
|
289
|
+
gloasResult.executionRequests = executionRequests;
|
|
290
|
+
gloasResult.blobsBundle = blobsBundle;
|
|
291
|
+
gloasResult.cells = cells;
|
|
292
|
+
|
|
293
|
+
const fetchedTime = Date.now() / 1000 - computeTimeAtSlot(this.config, blockSlot, this.genesisTime);
|
|
294
|
+
this.metrics?.blockPayload.payloadFetchedTime.observe({prepType}, fetchedTime);
|
|
295
|
+
this.logger.verbose("Produced block with self-build bid", {
|
|
296
|
+
slot: blockSlot,
|
|
297
|
+
executionPayloadValue,
|
|
298
|
+
prepType,
|
|
299
|
+
payloadId,
|
|
300
|
+
fetchedTime,
|
|
301
|
+
executionBlockHash: toRootHex(executionPayload.blockHash),
|
|
302
|
+
blobs: blobsBundle.commitments.length,
|
|
303
|
+
});
|
|
187
304
|
|
|
188
|
-
|
|
305
|
+
Object.assign(logMeta, {
|
|
306
|
+
transactions: executionPayload.transactions.length,
|
|
307
|
+
blobs: blobsBundle.commitments.length,
|
|
308
|
+
shouldOverrideBuilder,
|
|
309
|
+
});
|
|
189
310
|
} else if (isForkPostBellatrix(fork)) {
|
|
190
311
|
const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice);
|
|
191
312
|
const finalizedBlockHash = this.forkChoice.getFinalizedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX;
|
|
@@ -447,8 +568,14 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
447
568
|
});
|
|
448
569
|
}
|
|
449
570
|
|
|
450
|
-
if (ForkSeq[fork] >= ForkSeq.
|
|
451
|
-
const {blsToExecutionChanges,
|
|
571
|
+
if (ForkSeq[fork] >= ForkSeq.gloas) {
|
|
572
|
+
const {blsToExecutionChanges, payloadAttestations} = blockBody as BeaconBlockBody<ForkPostGloas>;
|
|
573
|
+
Object.assign(logMeta, {
|
|
574
|
+
blsToExecutionChanges: blsToExecutionChanges.length,
|
|
575
|
+
payloadAttestations: payloadAttestations.length,
|
|
576
|
+
});
|
|
577
|
+
} else if (ForkSeq[fork] >= ForkSeq.capella) {
|
|
578
|
+
const {blsToExecutionChanges, executionPayload} = blockBody as BeaconBlockBody<ForkPostCapella & ForkPreGloas>;
|
|
452
579
|
Object.assign(logMeta, {
|
|
453
580
|
blsToExecutionChanges: blsToExecutionChanges.length,
|
|
454
581
|
});
|
|
@@ -480,10 +607,12 @@ export async function prepareExecutionPayload(
|
|
|
480
607
|
parentBlockRoot: Root,
|
|
481
608
|
safeBlockHash: RootHex,
|
|
482
609
|
finalizedBlockHash: RootHex,
|
|
483
|
-
state: CachedBeaconStateExecutions,
|
|
610
|
+
state: CachedBeaconStateExecutions | CachedBeaconStateGloas,
|
|
484
611
|
suggestedFeeRecipient: string
|
|
485
612
|
): Promise<{prepType: PayloadPreparationType; payloadId: PayloadId}> {
|
|
486
|
-
const parentHash =
|
|
613
|
+
const parentHash = isForkPostGloas(fork)
|
|
614
|
+
? (state as CachedBeaconStateGloas).latestBlockHash
|
|
615
|
+
: (state as CachedBeaconStateExecutions).latestExecutionPayloadHeader.blockHash;
|
|
487
616
|
const timestamp = computeTimeAtSlot(chain.config, state.slot, state.genesisTime);
|
|
488
617
|
const prevRandao = getRandaoMix(state, state.epochCtx.epoch);
|
|
489
618
|
|
|
@@ -568,25 +697,46 @@ export function getPayloadAttributesForSSE(
|
|
|
568
697
|
fork: ForkPostBellatrix,
|
|
569
698
|
chain: {
|
|
570
699
|
config: ChainForkConfig;
|
|
700
|
+
forkChoice: IForkChoice;
|
|
571
701
|
},
|
|
572
702
|
{
|
|
573
703
|
prepareState,
|
|
574
704
|
prepareSlot,
|
|
575
705
|
parentBlockRoot,
|
|
576
706
|
feeRecipient,
|
|
577
|
-
}: {
|
|
707
|
+
}: {
|
|
708
|
+
prepareState: CachedBeaconStateExecutions | CachedBeaconStateGloas;
|
|
709
|
+
prepareSlot: Slot;
|
|
710
|
+
parentBlockRoot: Root;
|
|
711
|
+
feeRecipient: string;
|
|
712
|
+
}
|
|
578
713
|
): SSEPayloadAttributes {
|
|
579
|
-
const parentHash =
|
|
714
|
+
const parentHash = isForkPostGloas(fork)
|
|
715
|
+
? (prepareState as CachedBeaconStateGloas).latestBlockHash
|
|
716
|
+
: (prepareState as CachedBeaconStateExecutions).latestExecutionPayloadHeader.blockHash;
|
|
580
717
|
const payloadAttributes = preparePayloadAttributes(fork, chain, {
|
|
581
718
|
prepareState,
|
|
582
719
|
prepareSlot,
|
|
583
720
|
parentBlockRoot,
|
|
584
721
|
feeRecipient,
|
|
585
722
|
});
|
|
723
|
+
|
|
724
|
+
let parentBlockNumber: number;
|
|
725
|
+
if (isForkPostGloas(fork)) {
|
|
726
|
+
// TODO GLOAS: revisit this after fork choice changes are merged
|
|
727
|
+
const parentBlock = chain.forkChoice.getBlock(parentBlockRoot);
|
|
728
|
+
if (parentBlock?.executionPayloadBlockHash == null) {
|
|
729
|
+
throw Error(`Parent block not found in fork choice root=${toRootHex(parentBlockRoot)}`);
|
|
730
|
+
}
|
|
731
|
+
parentBlockNumber = parentBlock.executionPayloadNumber;
|
|
732
|
+
} else {
|
|
733
|
+
parentBlockNumber = (prepareState as CachedBeaconStateExecutions).latestExecutionPayloadHeader.blockNumber;
|
|
734
|
+
}
|
|
735
|
+
|
|
586
736
|
const ssePayloadAttributes: SSEPayloadAttributes = {
|
|
587
737
|
proposerIndex: prepareState.epochCtx.getBeaconProposer(prepareSlot),
|
|
588
738
|
proposalSlot: prepareSlot,
|
|
589
|
-
parentBlockNumber
|
|
739
|
+
parentBlockNumber,
|
|
590
740
|
parentBlockRoot,
|
|
591
741
|
parentBlockHash: parentHash,
|
|
592
742
|
payloadAttributes,
|
|
@@ -605,7 +755,7 @@ function preparePayloadAttributes(
|
|
|
605
755
|
parentBlockRoot,
|
|
606
756
|
feeRecipient,
|
|
607
757
|
}: {
|
|
608
|
-
prepareState: CachedBeaconStateExecutions;
|
|
758
|
+
prepareState: CachedBeaconStateExecutions | CachedBeaconStateGloas;
|
|
609
759
|
prepareSlot: Slot;
|
|
610
760
|
parentBlockRoot: Root;
|
|
611
761
|
feeRecipient: string;
|
|
@@ -3,6 +3,7 @@ import {CheckpointWithHex} from "@lodestar/fork-choice";
|
|
|
3
3
|
import {
|
|
4
4
|
ForkName,
|
|
5
5
|
ForkPostFulu,
|
|
6
|
+
ForkPostGloas,
|
|
6
7
|
ForkPreGloas,
|
|
7
8
|
SLOTS_PER_EPOCH,
|
|
8
9
|
isForkPostDeneb,
|
|
@@ -20,6 +21,7 @@ import {
|
|
|
20
21
|
BlockInput,
|
|
21
22
|
BlockInputBlobs,
|
|
22
23
|
BlockInputColumns,
|
|
24
|
+
BlockInputNoData,
|
|
23
25
|
BlockInputPreData,
|
|
24
26
|
BlockWithSource,
|
|
25
27
|
DAType,
|
|
@@ -179,12 +181,19 @@ export class SeenBlockInput {
|
|
|
179
181
|
if (!blockInput) {
|
|
180
182
|
const {forkName, daOutOfRange} = this.buildCommonProps(block.message.slot);
|
|
181
183
|
|
|
182
|
-
// TODO GLOAS: Implement
|
|
183
184
|
if (isForkPostGloas(forkName)) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
// Post-gloas
|
|
186
|
+
blockInput = BlockInputNoData.createFromBlock({
|
|
187
|
+
block: block as SignedBeaconBlock<ForkPostGloas>,
|
|
188
|
+
blockRootHex,
|
|
189
|
+
daOutOfRange,
|
|
190
|
+
forkName,
|
|
191
|
+
source,
|
|
192
|
+
seenTimestampSec,
|
|
193
|
+
peerIdStr,
|
|
194
|
+
});
|
|
195
|
+
} else if (!isForkPostDeneb(forkName)) {
|
|
196
|
+
// Pre-deneb
|
|
188
197
|
blockInput = BlockInputPreData.createFromBlock({
|
|
189
198
|
block,
|
|
190
199
|
blockRootHex,
|
|
@@ -194,8 +203,8 @@ export class SeenBlockInput {
|
|
|
194
203
|
seenTimestampSec,
|
|
195
204
|
peerIdStr,
|
|
196
205
|
});
|
|
197
|
-
// Fulu Only
|
|
198
206
|
} else if (isForkPostFulu(forkName)) {
|
|
207
|
+
// Fulu Only
|
|
199
208
|
blockInput = BlockInputColumns.createFromBlock({
|
|
200
209
|
block: block as SignedBeaconBlock<ForkPostFulu & ForkPreGloas>,
|
|
201
210
|
blockRootHex,
|
|
@@ -207,8 +216,8 @@ export class SeenBlockInput {
|
|
|
207
216
|
seenTimestampSec,
|
|
208
217
|
peerIdStr,
|
|
209
218
|
});
|
|
210
|
-
// Deneb and Electra
|
|
211
219
|
} else {
|
|
220
|
+
// Deneb and Electra
|
|
212
221
|
blockInput = BlockInputBlobs.createFromBlock({
|
|
213
222
|
block: block as SignedBeaconBlock<ForkBlobsDA>,
|
|
214
223
|
blockRootHex,
|
|
@@ -143,7 +143,10 @@ export async function validateGossipAttestationsSameAttData(
|
|
|
143
143
|
if (batchableBls) {
|
|
144
144
|
// all signature sets should have same signing root since we filtered in network processor
|
|
145
145
|
signatureValids = await chain.bls.verifySignatureSetsSameMessage(
|
|
146
|
-
signatureSets.map((set) =>
|
|
146
|
+
signatureSets.map((set) => {
|
|
147
|
+
const publicKey = chain.pubkeyCache.getOrThrow(set.index);
|
|
148
|
+
return {publicKey, signature: set.signature};
|
|
149
|
+
}),
|
|
147
150
|
signatureSets[0].signingRoot
|
|
148
151
|
);
|
|
149
152
|
} else {
|
|
@@ -45,7 +45,7 @@ export async function validateAttesterSlashing(
|
|
|
45
45
|
// verifySignature = false, verified in batch below
|
|
46
46
|
assertValidAttesterSlashing(
|
|
47
47
|
chain.config,
|
|
48
|
-
chain.
|
|
48
|
+
chain.pubkeyCache,
|
|
49
49
|
state.slot,
|
|
50
50
|
state.validators.length,
|
|
51
51
|
attesterSlashing,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getBlockHeaderProposerSignatureSetByHeaderSlot,
|
|
11
11
|
getBlockHeaderProposerSignatureSetByParentStateSlot,
|
|
12
12
|
} from "@lodestar/state-transition";
|
|
13
|
-
import {Root, Slot, SubnetID, fulu, ssz} from "@lodestar/types";
|
|
13
|
+
import {DataColumnSidecar, Root, Slot, SubnetID, fulu, ssz} from "@lodestar/types";
|
|
14
14
|
import {byteArrayEquals, toRootHex, verifyMerkleBranch} from "@lodestar/utils";
|
|
15
15
|
import {Metrics} from "../../metrics/metrics.js";
|
|
16
16
|
import {kzg} from "../../util/kzg.js";
|
|
@@ -457,9 +457,6 @@ export async function validateBlockDataColumnSidecars(
|
|
|
457
457
|
* SPEC FUNCTION
|
|
458
458
|
* https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.4/specs/fulu/p2p-interface.md#compute_subnet_for_data_column_sidecar
|
|
459
459
|
*/
|
|
460
|
-
export function computeSubnetForDataColumnSidecar(
|
|
461
|
-
config: ChainConfig,
|
|
462
|
-
columnSidecar: fulu.DataColumnSidecar
|
|
463
|
-
): SubnetID {
|
|
460
|
+
export function computeSubnetForDataColumnSidecar(config: ChainConfig, columnSidecar: DataColumnSidecar): SubnetID {
|
|
464
461
|
return columnSidecar.index % config.DATA_COLUMN_SIDECAR_SUBNET_COUNT;
|
|
465
462
|
}
|
|
@@ -87,8 +87,16 @@ async function validatePayloadAttestationMessage(
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// [REJECT] `payload_attestation_message.signature` is valid with respect to the validator's public key.
|
|
90
|
+
const validatorPubkey = chain.pubkeyCache.get(validatorIndex);
|
|
91
|
+
if (!validatorPubkey) {
|
|
92
|
+
throw new PayloadAttestationError(GossipAction.REJECT, {
|
|
93
|
+
code: PayloadAttestationErrorCode.INVALID_ATTESTER,
|
|
94
|
+
attesterIndex: validatorIndex,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
90
98
|
const signatureSet = createSingleSignatureSetFromComponents(
|
|
91
|
-
|
|
99
|
+
validatorPubkey,
|
|
92
100
|
getPayloadAttestationDataSigningRoot(chain.config, data),
|
|
93
101
|
payloadAttestationMessage.signature
|
|
94
102
|
);
|
|
@@ -37,7 +37,7 @@ async function validateProposerSlashing(
|
|
|
37
37
|
try {
|
|
38
38
|
const proposer = state.validators.getReadonly(proposerSlashing.signedHeader1.message.proposerIndex);
|
|
39
39
|
// verifySignature = false, verified in batch below
|
|
40
|
-
assertValidProposerSlashing(chain.config, chain.
|
|
40
|
+
assertValidProposerSlashing(chain.config, chain.pubkeyCache, state.slot, proposerSlashing, proposer, false);
|
|
41
41
|
} catch (e) {
|
|
42
42
|
throw new ProposerSlashingError(GossipAction.REJECT, {
|
|
43
43
|
code: ProposerSlashingErrorCode.INVALID,
|
|
@@ -106,7 +106,7 @@ export async function validateSyncCommitteeGossipContributionAndProof(
|
|
|
106
106
|
/**
|
|
107
107
|
* Retrieve pubkeys in contribution aggregate using epochCtx:
|
|
108
108
|
* - currSyncCommitteeIndexes cache
|
|
109
|
-
* -
|
|
109
|
+
* - pubkeyCache
|
|
110
110
|
*/
|
|
111
111
|
function getContributionIndices(
|
|
112
112
|
state: CachedBeaconStateAltair,
|
package/src/db/beacon.ts
CHANGED
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
CheckpointHeaderRepository,
|
|
16
16
|
DataColumnSidecarArchiveRepository,
|
|
17
17
|
DataColumnSidecarRepository,
|
|
18
|
+
ExecutionPayloadEnvelopeArchiveRepository,
|
|
19
|
+
ExecutionPayloadEnvelopeRepository,
|
|
18
20
|
ProposerSlashingRepository,
|
|
19
21
|
StateArchiveRepository,
|
|
20
22
|
SyncCommitteeRepository,
|
|
@@ -36,6 +38,9 @@ export class BeaconDb implements IBeaconDb {
|
|
|
36
38
|
dataColumnSidecar: DataColumnSidecarRepository;
|
|
37
39
|
dataColumnSidecarArchive: DataColumnSidecarArchiveRepository;
|
|
38
40
|
|
|
41
|
+
executionPayloadEnvelope: ExecutionPayloadEnvelopeRepository;
|
|
42
|
+
executionPayloadEnvelopeArchive: ExecutionPayloadEnvelopeArchiveRepository;
|
|
43
|
+
|
|
39
44
|
stateArchive: StateArchiveRepository;
|
|
40
45
|
checkpointState: CheckpointStateRepository;
|
|
41
46
|
|
|
@@ -65,6 +70,9 @@ export class BeaconDb implements IBeaconDb {
|
|
|
65
70
|
this.dataColumnSidecar = new DataColumnSidecarRepository(config, db);
|
|
66
71
|
this.dataColumnSidecarArchive = new DataColumnSidecarArchiveRepository(config, db);
|
|
67
72
|
|
|
73
|
+
this.executionPayloadEnvelope = new ExecutionPayloadEnvelopeRepository(config, db);
|
|
74
|
+
this.executionPayloadEnvelopeArchive = new ExecutionPayloadEnvelopeArchiveRepository(config, db);
|
|
75
|
+
|
|
68
76
|
this.stateArchive = new StateArchiveRepository(config, db);
|
|
69
77
|
this.checkpointState = new CheckpointStateRepository(config, db);
|
|
70
78
|
this.voluntaryExit = new VoluntaryExitRepository(config, db);
|
package/src/db/buckets.ts
CHANGED
|
@@ -69,6 +69,9 @@ export enum Bucket {
|
|
|
69
69
|
|
|
70
70
|
fulu_dataColumnSidecars = 57, // FULU BeaconBlockRoot -> DataColumnSidecars
|
|
71
71
|
fulu_dataColumnSidecarsArchive = 58, // FULU BeaconBlockSlot -> DataColumnSidecars
|
|
72
|
+
|
|
73
|
+
gloas_executionPayloadEnvelope = 59, // GLOAS BeaconBlockRoot -> SignedExecutionPayloadEnvelope
|
|
74
|
+
gloas_executionPayloadEnvelopeArchive = 60, // GLOAS Slot -> SignedExecutionPayloadEnvelope
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
export function getBucketNameByValue<T extends Bucket>(enumValue: T): keyof typeof Bucket {
|
package/src/db/interface.ts
CHANGED
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
CheckpointHeaderRepository,
|
|
13
13
|
DataColumnSidecarArchiveRepository,
|
|
14
14
|
DataColumnSidecarRepository,
|
|
15
|
+
ExecutionPayloadEnvelopeArchiveRepository,
|
|
16
|
+
ExecutionPayloadEnvelopeRepository,
|
|
15
17
|
ProposerSlashingRepository,
|
|
16
18
|
StateArchiveRepository,
|
|
17
19
|
SyncCommitteeRepository,
|
|
@@ -35,6 +37,9 @@ export interface IBeaconDb {
|
|
|
35
37
|
dataColumnSidecar: DataColumnSidecarRepository;
|
|
36
38
|
dataColumnSidecarArchive: DataColumnSidecarArchiveRepository;
|
|
37
39
|
|
|
40
|
+
executionPayloadEnvelope: ExecutionPayloadEnvelopeRepository;
|
|
41
|
+
executionPayloadEnvelopeArchive: ExecutionPayloadEnvelopeArchiveRepository;
|
|
42
|
+
|
|
38
43
|
// finalized states
|
|
39
44
|
stateArchive: StateArchiveRepository;
|
|
40
45
|
// checkpoint states
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import all from "it-all";
|
|
2
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
2
|
import {Db, FilterOptions, KeyValue, Repository} from "@lodestar/db";
|
|
4
3
|
import {Root, SignedBeaconBlock, Slot, ssz} from "@lodestar/types";
|
|
@@ -121,7 +120,7 @@ export class BlockArchiveRepository extends Repository<Slot, SignedBeaconBlock>
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
async values(opts?: BlockFilterOptions): Promise<SignedBeaconBlock[]> {
|
|
124
|
-
return
|
|
123
|
+
return await Array.fromAsync(this.valuesStream(opts));
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
// INDEX
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {Db, PrefixedRepository, decodeNumberForDbKey, encodeNumberForDbKey} from "@lodestar/db";
|
|
3
3
|
import {NUMBER_OF_COLUMNS} from "@lodestar/params";
|
|
4
|
-
import {ColumnIndex, Root,
|
|
4
|
+
import {ColumnIndex, DataColumnSidecar, Root, isGloasDataColumnSidecar, ssz} from "@lodestar/types";
|
|
5
|
+
import {isGloasDataColumnSidecarBytes} from "../../util/multifork.js";
|
|
5
6
|
import {Bucket, getBucketNameByValue} from "../buckets.js";
|
|
6
7
|
|
|
7
8
|
const COLUMN_INDEX_BYTE_SIZE = 2;
|
|
@@ -15,7 +16,7 @@ type BlockRoot = Root;
|
|
|
15
16
|
*
|
|
16
17
|
* Indexed data by `blockRoot` + `columnIndex`
|
|
17
18
|
*/
|
|
18
|
-
export class DataColumnSidecarRepository extends PrefixedRepository<BlockRoot, ColumnIndex,
|
|
19
|
+
export class DataColumnSidecarRepository extends PrefixedRepository<BlockRoot, ColumnIndex, DataColumnSidecar> {
|
|
19
20
|
constructor(config: ChainForkConfig, db: Db) {
|
|
20
21
|
const bucket = Bucket.fulu_dataColumnSidecars;
|
|
21
22
|
super(config, db, bucket, ssz.fulu.DataColumnSidecar, getBucketNameByValue(bucket));
|
|
@@ -24,10 +25,24 @@ export class DataColumnSidecarRepository extends PrefixedRepository<BlockRoot, C
|
|
|
24
25
|
/**
|
|
25
26
|
* Id is hashTreeRoot of unsigned BeaconBlock
|
|
26
27
|
*/
|
|
27
|
-
getId(value:
|
|
28
|
+
getId(value: DataColumnSidecar): ColumnIndex {
|
|
28
29
|
return value.index;
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
encodeValue(value: DataColumnSidecar): Uint8Array {
|
|
33
|
+
if (isGloasDataColumnSidecar(value)) {
|
|
34
|
+
return ssz.gloas.DataColumnSidecar.serialize(value);
|
|
35
|
+
}
|
|
36
|
+
return ssz.fulu.DataColumnSidecar.serialize(value);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
decodeValue(data: Uint8Array): DataColumnSidecar {
|
|
40
|
+
if (isGloasDataColumnSidecarBytes(data)) {
|
|
41
|
+
return ssz.gloas.DataColumnSidecar.deserialize(data);
|
|
42
|
+
}
|
|
43
|
+
return ssz.fulu.DataColumnSidecar.deserialize(data);
|
|
44
|
+
}
|
|
45
|
+
|
|
31
46
|
encodeKeyRaw(prefix: BlockRoot, id: ColumnIndex): Uint8Array {
|
|
32
47
|
return Buffer.concat([prefix, encodeNumberForDbKey(id, COLUMN_INDEX_BYTE_SIZE)]);
|
|
33
48
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {Db, PrefixedRepository, decodeNumberForDbKey, encodeNumberForDbKey} from "@lodestar/db";
|
|
3
3
|
import {NUMBER_OF_COLUMNS} from "@lodestar/params";
|
|
4
|
-
import {ColumnIndex, Slot,
|
|
4
|
+
import {ColumnIndex, DataColumnSidecar, Slot, isGloasDataColumnSidecar, ssz} from "@lodestar/types";
|
|
5
|
+
import {isGloasDataColumnSidecarBytes} from "../../util/multifork.js";
|
|
5
6
|
import {Bucket, getBucketNameByValue} from "../buckets.js";
|
|
6
7
|
|
|
7
8
|
const COLUMN_INDEX_BYTE_SIZE = 2;
|
|
@@ -13,7 +14,7 @@ const SLOT_BYTE_SIZE = 8;
|
|
|
13
14
|
*
|
|
14
15
|
* Indexed data by `slot` + `columnIndex`
|
|
15
16
|
*/
|
|
16
|
-
export class DataColumnSidecarArchiveRepository extends PrefixedRepository<Slot, ColumnIndex,
|
|
17
|
+
export class DataColumnSidecarArchiveRepository extends PrefixedRepository<Slot, ColumnIndex, DataColumnSidecar> {
|
|
17
18
|
constructor(config: ChainForkConfig, db: Db) {
|
|
18
19
|
const bucket = Bucket.fulu_dataColumnSidecarsArchive;
|
|
19
20
|
super(config, db, bucket, ssz.fulu.DataColumnSidecar, getBucketNameByValue(bucket));
|
|
@@ -22,10 +23,24 @@ export class DataColumnSidecarArchiveRepository extends PrefixedRepository<Slot,
|
|
|
22
23
|
/**
|
|
23
24
|
* Id is hashTreeRoot of unsigned BeaconBlock
|
|
24
25
|
*/
|
|
25
|
-
getId(value:
|
|
26
|
+
getId(value: DataColumnSidecar): ColumnIndex {
|
|
26
27
|
return value.index;
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
encodeValue(value: DataColumnSidecar): Uint8Array {
|
|
31
|
+
if (isGloasDataColumnSidecar(value)) {
|
|
32
|
+
return ssz.gloas.DataColumnSidecar.serialize(value);
|
|
33
|
+
}
|
|
34
|
+
return ssz.fulu.DataColumnSidecar.serialize(value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
decodeValue(data: Uint8Array): DataColumnSidecar {
|
|
38
|
+
if (isGloasDataColumnSidecarBytes(data)) {
|
|
39
|
+
return ssz.gloas.DataColumnSidecar.deserialize(data);
|
|
40
|
+
}
|
|
41
|
+
return ssz.fulu.DataColumnSidecar.deserialize(data);
|
|
42
|
+
}
|
|
43
|
+
|
|
29
44
|
encodeKeyRaw(prefix: Slot, id: ColumnIndex): Uint8Array {
|
|
30
45
|
return Buffer.concat([
|
|
31
46
|
encodeNumberForDbKey(prefix, SLOT_BYTE_SIZE),
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
+
import {Db, Repository} from "@lodestar/db";
|
|
3
|
+
import {Root, gloas, ssz} from "@lodestar/types";
|
|
4
|
+
import {Bucket, getBucketNameByValue} from "../buckets.js";
|
|
5
|
+
|
|
6
|
+
type BlockRoot = Root;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Used to store unfinalized `SignedExecutionPayloadEnvelope`
|
|
10
|
+
*
|
|
11
|
+
* Indexed by beacon block root (root of the beacon block that contains the bid)
|
|
12
|
+
*/
|
|
13
|
+
export class ExecutionPayloadEnvelopeRepository extends Repository<BlockRoot, gloas.SignedExecutionPayloadEnvelope> {
|
|
14
|
+
constructor(config: ChainForkConfig, db: Db) {
|
|
15
|
+
const bucket = Bucket.gloas_executionPayloadEnvelope;
|
|
16
|
+
super(config, db, bucket, ssz.gloas.SignedExecutionPayloadEnvelope, getBucketNameByValue(bucket));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Id is the beacon block root (not execution payload hash)
|
|
21
|
+
* This allows correlation with the block that contains the bid
|
|
22
|
+
*/
|
|
23
|
+
getId(value: gloas.SignedExecutionPayloadEnvelope): BlockRoot {
|
|
24
|
+
return value.message.beaconBlockRoot;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
+
import {BUCKET_LENGTH, Db, Repository, encodeKey as encodeDbKey} from "@lodestar/db";
|
|
3
|
+
import {Slot, gloas, ssz} from "@lodestar/types";
|
|
4
|
+
import {bytesToInt} from "@lodestar/utils";
|
|
5
|
+
import {Bucket, getBucketNameByValue} from "../buckets.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Used to store finalized `SignedExecutionPayloadEnvelope`
|
|
9
|
+
*
|
|
10
|
+
* Indexed by slot for chronological archival
|
|
11
|
+
*/
|
|
12
|
+
export class ExecutionPayloadEnvelopeArchiveRepository extends Repository<Slot, gloas.SignedExecutionPayloadEnvelope> {
|
|
13
|
+
constructor(config: ChainForkConfig, db: Db) {
|
|
14
|
+
const bucket = Bucket.gloas_executionPayloadEnvelopeArchive;
|
|
15
|
+
super(config, db, bucket, ssz.gloas.SignedExecutionPayloadEnvelope, getBucketNameByValue(bucket));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Id is the slot from the envelope
|
|
20
|
+
*/
|
|
21
|
+
getId(value: gloas.SignedExecutionPayloadEnvelope): Slot {
|
|
22
|
+
return value.message.slot;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
encodeKey(id: Slot): Uint8Array {
|
|
26
|
+
return encodeDbKey(this.bucket, id);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
decodeKey(data: Uint8Array): number {
|
|
30
|
+
return bytesToInt(data.subarray(BUCKET_LENGTH), "be");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -8,6 +8,8 @@ export {BlockArchiveRepository} from "./blockArchive.js";
|
|
|
8
8
|
export {BLSToExecutionChangeRepository} from "./blsToExecutionChange.js";
|
|
9
9
|
export {DataColumnSidecarRepository} from "./dataColumnSidecar.js";
|
|
10
10
|
export {DataColumnSidecarArchiveRepository} from "./dataColumnSidecarArchive.js";
|
|
11
|
+
export {ExecutionPayloadEnvelopeRepository} from "./executionPayloadEnvelope.js";
|
|
12
|
+
export {ExecutionPayloadEnvelopeArchiveRepository} from "./executionPayloadEnvelopeArchive.js";
|
|
11
13
|
export {BestLightClientUpdateRepository} from "./lightclientBestUpdate.js";
|
|
12
14
|
export {CheckpointHeaderRepository} from "./lightclientCheckpointHeader.js";
|
|
13
15
|
export {SyncCommitteeRepository} from "./lightclientSyncCommittee.js";
|
|
@@ -128,6 +128,7 @@ const getClientVersionOpts: ReqOpts = {routeId: "getClientVersion"};
|
|
|
128
128
|
*/
|
|
129
129
|
export class ExecutionEngineHttp implements IExecutionEngine {
|
|
130
130
|
private logger: Logger;
|
|
131
|
+
private metrics: Metrics | null;
|
|
131
132
|
|
|
132
133
|
// The default state is ONLINE, it will be updated to SYNCING once we receive the first payload
|
|
133
134
|
// This assumption is better than the OFFLINE state, since we can't be sure if the EL is offline and being offline may trigger some notifications
|
|
@@ -167,6 +168,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
|
|
|
167
168
|
metrics?.engineHttpProcessorQueue
|
|
168
169
|
);
|
|
169
170
|
this.logger = logger;
|
|
171
|
+
this.metrics = metrics ?? null;
|
|
170
172
|
|
|
171
173
|
this.rpc.emitter.on(JsonRpcHttpClientEvent.ERROR, ({error}) => {
|
|
172
174
|
this.updateEngineState(getExecutionEngineState({payloadError: error, oldState: this.state}));
|
|
@@ -369,6 +371,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
|
|
|
369
371
|
} = await request;
|
|
370
372
|
|
|
371
373
|
this.updateEngineState(getExecutionEngineState({payloadStatus: status, oldState: this.state}));
|
|
374
|
+
this.metrics?.engineNotifyForkchoiceUpdateResult.inc({result: status});
|
|
372
375
|
|
|
373
376
|
switch (status) {
|
|
374
377
|
case ExecutionPayloadStatus.VALID:
|