@lodestar/beacon-node 1.49.0-dev.3f33d73d55 → 1.49.0-dev.4631f9fe5a
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 +13 -4
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +4 -2
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +3 -1
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts +1 -2
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +5 -8
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.js +5 -6
- package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +11 -2
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +46 -28
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts +2 -2
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js +1 -0
- package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +13 -0
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/chain.d.ts +10 -0
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +85 -16
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/envelopeReconstructionError.d.ts +23 -0
- package/lib/chain/errors/envelopeReconstructionError.d.ts.map +1 -0
- package/lib/chain/errors/envelopeReconstructionError.js +13 -0
- package/lib/chain/errors/envelopeReconstructionError.js.map +1 -0
- package/lib/chain/errors/index.d.ts +1 -0
- package/lib/chain/errors/index.d.ts.map +1 -1
- package/lib/chain/errors/index.js +1 -0
- package/lib/chain/errors/index.js.map +1 -1
- package/lib/chain/errors/payloadAttestation.d.ts +4 -0
- package/lib/chain/errors/payloadAttestation.d.ts.map +1 -1
- package/lib/chain/errors/payloadAttestation.js +1 -0
- package/lib/chain/errors/payloadAttestation.js.map +1 -1
- package/lib/chain/interface.d.ts +6 -1
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/options.d.ts +2 -4
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +4 -2
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +8 -1
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/db/beacon.d.ts +1 -2
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +1 -3
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/buckets.d.ts +0 -1
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +1 -1
- package/lib/db/buckets.js.map +1 -1
- package/lib/db/interface.d.ts +1 -2
- 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/executionPayloadEnvelopeArchive.d.ts +21 -9
- package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts.map +1 -1
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js +32 -12
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -1
- package/lib/db/repositories/index.d.ts +1 -2
- package/lib/db/repositories/index.d.ts.map +1 -1
- package/lib/db/repositories/index.js +1 -2
- package/lib/db/repositories/index.js.map +1 -1
- package/lib/execution/engine/disabled.d.ts +1 -0
- package/lib/execution/engine/disabled.d.ts.map +1 -1
- package/lib/execution/engine/disabled.js +3 -0
- package/lib/execution/engine/disabled.js.map +1 -1
- package/lib/execution/engine/http.d.ts +2 -1
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +7 -1
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +3 -1
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/mock.d.ts +1 -0
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +14 -2
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/types.d.ts +11 -0
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +10 -0
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +9 -0
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +16 -0
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +21 -11
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +48 -23
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/metrics/metrics.d.ts +3 -1
- package/lib/metrics/metrics.d.ts.map +1 -1
- package/lib/metrics/metrics.js +2 -2
- package/lib/metrics/metrics.js.map +1 -1
- package/lib/network/processor/index.d.ts +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +42 -21
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +47 -34
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +23 -4
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/index.js +20 -4
- package/lib/network/reqresp/handlers/index.js.map +1 -1
- package/lib/node/nodejs.d.ts +2 -7
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +2 -22
- package/lib/node/nodejs.js.map +1 -1
- package/lib/sync/interface.d.ts +1 -2
- package/lib/sync/interface.d.ts.map +1 -1
- package/lib/sync/options.d.ts +0 -6
- package/lib/sync/options.d.ts.map +1 -1
- package/lib/sync/options.js +0 -2
- package/lib/sync/options.js.map +1 -1
- package/lib/sync/types.d.ts +18 -3
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +19 -3
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +19 -0
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +184 -15
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/execution.d.ts +42 -0
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js +123 -2
- package/lib/util/execution.js.map +1 -1
- package/lib/util/headerEnvelope.d.ts +17 -0
- package/lib/util/headerEnvelope.d.ts.map +1 -0
- package/lib/util/headerEnvelope.js +43 -0
- package/lib/util/headerEnvelope.js.map +1 -0
- package/lib/util/shuffle.d.ts +0 -4
- package/lib/util/shuffle.d.ts.map +1 -1
- package/lib/util/shuffle.js +0 -8
- package/lib/util/shuffle.js.map +1 -1
- package/package.json +16 -16
- package/src/api/impl/beacon/blocks/index.ts +16 -3
- package/src/api/impl/beacon/pool/index.ts +6 -2
- package/src/api/impl/validator/index.ts +3 -1
- package/src/chain/archiveStore/archiveStore.ts +6 -9
- package/src/chain/archiveStore/historicalState/metrics.ts +5 -7
- package/src/chain/archiveStore/utils/archiveBlocks.ts +54 -32
- package/src/chain/archiveStore/utils/pruneHistory.ts +4 -2
- package/src/chain/blocks/importExecutionPayload.ts +14 -0
- package/src/chain/chain.ts +96 -20
- package/src/chain/errors/envelopeReconstructionError.ts +22 -0
- package/src/chain/errors/index.ts +1 -0
- package/src/chain/errors/payloadAttestation.ts +2 -0
- package/src/chain/interface.ts +6 -1
- package/src/chain/options.ts +3 -5
- package/src/chain/produceBlock/computeNewStateRoot.ts +9 -2
- package/src/chain/validation/payloadAttestationMessage.ts +9 -0
- package/src/db/beacon.ts +0 -5
- package/src/db/buckets.ts +2 -2
- package/src/db/interface.ts +0 -3
- package/src/db/repositories/executionPayloadEnvelopeArchive.ts +43 -13
- package/src/db/repositories/index.ts +6 -2
- package/src/execution/engine/disabled.ts +4 -0
- package/src/execution/engine/http.ts +12 -0
- package/src/execution/engine/interface.ts +4 -1
- package/src/execution/engine/mock.ts +22 -2
- package/src/execution/engine/types.ts +25 -0
- package/src/metrics/metrics/beacon.ts +16 -0
- package/src/metrics/metrics/lodestar.ts +58 -26
- package/src/metrics/metrics.ts +7 -2
- package/src/network/processor/index.ts +51 -22
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +57 -39
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +27 -5
- package/src/network/reqresp/handlers/index.ts +49 -5
- package/src/node/nodejs.ts +0 -27
- package/src/sync/interface.ts +1 -2
- package/src/sync/options.ts +0 -8
- package/src/sync/types.ts +19 -3
- package/src/sync/unknownBlock.ts +192 -14
- package/src/util/execution.ts +175 -2
- package/src/util/headerEnvelope.ts +76 -0
- package/src/util/shuffle.ts +0 -9
- package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts +0 -20
- package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts.map +0 -1
- package/lib/chain/archiveStore/utils/updateBackfillRange.js +0 -40
- package/lib/chain/archiveStore/utils/updateBackfillRange.js.map +0 -1
- package/lib/db/repositories/backfilledRanges.d.ts +0 -18
- package/lib/db/repositories/backfilledRanges.d.ts.map +0 -1
- package/lib/db/repositories/backfilledRanges.js +0 -26
- package/lib/db/repositories/backfilledRanges.js.map +0 -1
- package/lib/sync/backfill/backfill.d.ts +0 -169
- package/lib/sync/backfill/backfill.d.ts.map +0 -1
- package/lib/sync/backfill/backfill.js +0 -686
- package/lib/sync/backfill/backfill.js.map +0 -1
- package/lib/sync/backfill/errors.d.ts +0 -30
- package/lib/sync/backfill/errors.d.ts.map +0 -1
- package/lib/sync/backfill/errors.js +0 -15
- package/lib/sync/backfill/errors.js.map +0 -1
- package/lib/sync/backfill/index.d.ts +0 -2
- package/lib/sync/backfill/index.d.ts.map +0 -1
- package/lib/sync/backfill/index.js +0 -2
- package/lib/sync/backfill/index.js.map +0 -1
- package/lib/sync/backfill/verify.d.ts +0 -18
- package/lib/sync/backfill/verify.d.ts.map +0 -1
- package/lib/sync/backfill/verify.js +0 -36
- package/lib/sync/backfill/verify.js.map +0 -1
- package/src/chain/archiveStore/utils/updateBackfillRange.ts +0 -50
- package/src/db/repositories/backfilledRanges.ts +0 -29
- package/src/sync/backfill/backfill.ts +0 -916
- package/src/sync/backfill/errors.ts +0 -23
- package/src/sync/backfill/index.ts +0 -1
- package/src/sync/backfill/verify.ts +0 -58
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {Slot} from "@lodestar/types";
|
|
2
|
+
import {LodestarError} from "@lodestar/utils";
|
|
3
|
+
|
|
4
|
+
export enum EnvelopeReconstructionErrorCode {
|
|
5
|
+
/** The EL failed to answer engine_getPayloadBodiesByHashV2 (transport / EL down). Transient. */
|
|
6
|
+
ENGINE_UNAVAILABLE = "ENVELOPE_RECONSTRUCTION_ERROR_ENGINE_UNAVAILABLE",
|
|
7
|
+
/** A body returned by the EL does not hash to the root stored in the header envelope. Local DB/EL inconsistency. */
|
|
8
|
+
BODY_ROOT_MISMATCH = "ENVELOPE_RECONSTRUCTION_ERROR_BODY_ROOT_MISMATCH",
|
|
9
|
+
/** A by-range stream stopped short at a slot that cannot be served; the response so far is still valid */
|
|
10
|
+
RANGE_UNSERVABLE = "ENVELOPE_RECONSTRUCTION_ERROR_RANGE_UNSERVABLE",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type EnvelopeReconstructionErrorType =
|
|
14
|
+
| {code: EnvelopeReconstructionErrorCode.ENGINE_UNAVAILABLE}
|
|
15
|
+
| {
|
|
16
|
+
code: EnvelopeReconstructionErrorCode.BODY_ROOT_MISMATCH;
|
|
17
|
+
slot: Slot;
|
|
18
|
+
field: "transactions" | "withdrawals" | "blockAccessList";
|
|
19
|
+
}
|
|
20
|
+
| {code: EnvelopeReconstructionErrorCode.RANGE_UNSERVABLE; slot: Slot};
|
|
21
|
+
|
|
22
|
+
export class EnvelopeReconstructionError extends LodestarError<EnvelopeReconstructionErrorType> {}
|
|
@@ -4,6 +4,7 @@ export * from "./blobSidecarError.js";
|
|
|
4
4
|
export * from "./blockError.js";
|
|
5
5
|
export * from "./blsToExecutionChangeError.js";
|
|
6
6
|
export * from "./dataColumnSidecarError.js";
|
|
7
|
+
export * from "./envelopeReconstructionError.js";
|
|
7
8
|
export * from "./executionPayloadBid.js";
|
|
8
9
|
export * from "./executionPayloadEnvelope.js";
|
|
9
10
|
export * from "./gossipValidation.js";
|
|
@@ -6,6 +6,7 @@ export enum PayloadAttestationErrorCode {
|
|
|
6
6
|
PAYLOAD_ATTESTATION_ALREADY_KNOWN = "PAYLOAD_ATTESTATION_ERROR_PAYLOAD_ATTESTATION_ALREADY_KNOWN",
|
|
7
7
|
UNKNOWN_BLOCK_ROOT = "PAYLOAD_ATTESTATION_ERROR_UNKNOWN_BLOCK_ROOT",
|
|
8
8
|
INVALID_BLOCK_SLOT = "PAYLOAD_ATTESTATION_ERROR_INVALID_BLOCK_SLOT",
|
|
9
|
+
PRE_GLOAS_SLOT = "PAYLOAD_ATTESTATION_ERROR_PRE_GLOAS_SLOT",
|
|
9
10
|
INVALID_BLOCK = "PAYLOAD_ATTESTATION_ERROR_INVALID_BLOCK",
|
|
10
11
|
INVALID_ATTESTER = "PAYLOAD_ATTESTATION_ERROR_INVALID_ATTESTER",
|
|
11
12
|
INVALID_SIGNATURE = "PAYLOAD_ATTESTATION_ERROR_INVALID_SIGNATURE",
|
|
@@ -20,6 +21,7 @@ export type PayloadAttestationErrorType =
|
|
|
20
21
|
}
|
|
21
22
|
| {code: PayloadAttestationErrorCode.UNKNOWN_BLOCK_ROOT; blockRoot: RootHex}
|
|
22
23
|
| {code: PayloadAttestationErrorCode.INVALID_BLOCK_SLOT; blockRoot: RootHex; blockSlot: Slot; slot: Slot}
|
|
24
|
+
| {code: PayloadAttestationErrorCode.PRE_GLOAS_SLOT; slot: Slot}
|
|
23
25
|
| {code: PayloadAttestationErrorCode.INVALID_BLOCK; blockRoot: RootHex}
|
|
24
26
|
| {code: PayloadAttestationErrorCode.INVALID_ATTESTER; attesterIndex: ValidatorIndex}
|
|
25
27
|
| {code: PayloadAttestationErrorCode.INVALID_SIGNATURE};
|
package/src/chain/interface.ts
CHANGED
|
@@ -30,6 +30,7 @@ import {Metrics} from "../metrics/metrics.js";
|
|
|
30
30
|
import {BufferPool} from "../util/bufferPool.js";
|
|
31
31
|
import {IClock} from "../util/clock.js";
|
|
32
32
|
import {CustodyConfig} from "../util/dataColumns.js";
|
|
33
|
+
import {ReconstructMismatchPolicy} from "../util/execution.js";
|
|
33
34
|
import {SerializedCache} from "../util/serializedCache.js";
|
|
34
35
|
import {IArchiveStore} from "./archiveStore/interface.js";
|
|
35
36
|
import {CheckpointBalancesCache} from "./balancesCache.js";
|
|
@@ -96,7 +97,7 @@ export enum FindHeadFnName {
|
|
|
96
97
|
export interface IBeaconChain {
|
|
97
98
|
readonly genesisTime: UintNum64;
|
|
98
99
|
readonly genesisValidatorsRoot: Root;
|
|
99
|
-
|
|
100
|
+
earliestAvailableSlot: Slot;
|
|
100
101
|
readonly executionEngine: IExecutionEngine;
|
|
101
102
|
readonly executionBuilder?: IExecutionBuilder;
|
|
102
103
|
readonly builderCircuitBreaker: BuilderCircuitBreaker;
|
|
@@ -236,6 +237,10 @@ export interface IBeaconChain {
|
|
|
236
237
|
indices: number[]
|
|
237
238
|
): Promise<(Uint8Array | undefined)[]>;
|
|
238
239
|
getSerializedExecutionPayloadEnvelope(blockSlot: Slot, blockRootHex: string): Promise<Uint8Array | null>;
|
|
240
|
+
getSerializedExecutionPayloadEnvelopes(
|
|
241
|
+
requests: {blockSlot: Slot; blockRootHex: RootHex}[],
|
|
242
|
+
onMismatch?: ReconstructMismatchPolicy
|
|
243
|
+
): Promise<(Uint8Array | null)[]>;
|
|
239
244
|
getExecutionPayloadEnvelope(
|
|
240
245
|
blockSlot: Slot,
|
|
241
246
|
blockRootHex: string
|
package/src/chain/options.ts
CHANGED
|
@@ -29,6 +29,8 @@ export type IChainOptions = BlockProcessOpts &
|
|
|
29
29
|
blacklistedBlocks?: string[];
|
|
30
30
|
// TODO GLOAS: add similar option for execution payload envelopes?
|
|
31
31
|
persistProducedBlocks?: boolean;
|
|
32
|
+
/** Archive finalized Gloas payload envelopes as headers (bodies reconstructed from the EL on read) */
|
|
33
|
+
dedupePayloads?: boolean;
|
|
32
34
|
persistInvalidSszObjects?: boolean;
|
|
33
35
|
persistInvalidSszObjectsDir?: string;
|
|
34
36
|
persistOrphanedBlocks?: boolean;
|
|
@@ -63,10 +65,6 @@ export type BlockProcessOpts = {
|
|
|
63
65
|
* Will double processing times. Use only for debugging purposes.
|
|
64
66
|
*/
|
|
65
67
|
disableBlsBatchVerify?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Assert progressive balances the same to EpochTransitionCache
|
|
68
|
-
*/
|
|
69
|
-
assertCorrectProgressiveBalances?: boolean;
|
|
70
68
|
/** Used for fork_choice spec tests */
|
|
71
69
|
disableOnBlockError?: boolean;
|
|
72
70
|
/** Used for fork_choice spec tests */
|
|
@@ -109,12 +107,12 @@ export const defaultChainOptions: IChainOptions = {
|
|
|
109
107
|
disableBlsBatchVerify: false,
|
|
110
108
|
proposerBoost: true,
|
|
111
109
|
proposerBoostReorg: true,
|
|
110
|
+
dedupePayloads: true,
|
|
112
111
|
computeUnrealized: true,
|
|
113
112
|
fastConfirmation: false,
|
|
114
113
|
suggestedFeeRecipient: defaultValidatorOptions.suggestedFeeRecipient,
|
|
115
114
|
graffitiAppend: true,
|
|
116
115
|
serveHistoricalState: false,
|
|
117
|
-
assertCorrectProgressiveBalances: false,
|
|
118
116
|
archiveStateEpochFrequency: 1024,
|
|
119
117
|
archiveMode: DEFAULT_ARCHIVE_MODE,
|
|
120
118
|
pruneHistory: false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {EMPTY_SIGNATURE, IBeaconStateView} from "@lodestar/state-transition";
|
|
1
|
+
import {EMPTY_SIGNATURE, IBeaconStateView, StateHashTreeRootSource} from "@lodestar/state-transition";
|
|
2
2
|
import {BeaconBlock, BlindedBeaconBlock, Gwei, Root} from "@lodestar/types";
|
|
3
3
|
import {Metrics} from "../../metrics/index.js";
|
|
4
4
|
|
|
@@ -14,5 +14,12 @@ export function computeNewStateRoot(
|
|
|
14
14
|
): {newStateRoot: Root; proposerReward: Gwei; postState: IBeaconStateView} {
|
|
15
15
|
// Set signature to zero to re-use stateTransition() function which requires the SignedBeaconBlock type
|
|
16
16
|
const signedBlock = {message: block, signature: EMPTY_SIGNATURE};
|
|
17
|
-
|
|
17
|
+
const {newStateRoot, proposerReward, postState, hashTreeRootTime} = state.computeNewStateRoot(
|
|
18
|
+
{block: signedBlock},
|
|
19
|
+
{metrics}
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
metrics?.stateHashTreeRootTime.observe({source: StateHashTreeRootSource.computeNewStateRoot}, hashTreeRootTime);
|
|
23
|
+
|
|
24
|
+
return {newStateRoot, proposerReward, postState};
|
|
18
25
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
computeEpochAtSlot,
|
|
2
3
|
createIndexedSignatureSetFromComponents,
|
|
3
4
|
getPayloadAttestationDataSigningRoot,
|
|
4
5
|
isStatePostGloas,
|
|
@@ -35,6 +36,14 @@ async function validatePayloadAttestationMessage(
|
|
|
35
36
|
): Promise<PayloadAttestationValidationResult> {
|
|
36
37
|
const {data, validatorIndex} = payloadAttestationMessage;
|
|
37
38
|
|
|
39
|
+
// [REJECT] The payload attestation slot is at or after the Gloas fork.
|
|
40
|
+
if (computeEpochAtSlot(data.slot) < chain.config.GLOAS_FORK_EPOCH) {
|
|
41
|
+
throw new PayloadAttestationError(GossipAction.REJECT, {
|
|
42
|
+
code: PayloadAttestationErrorCode.PRE_GLOAS_SLOT,
|
|
43
|
+
slot: data.slot,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
// [IGNORE] The message's slot is for the current slot (with a `MAXIMUM_GOSSIP_CLOCK_DISPARITY` allowance), i.e. `data.slot == current_slot`.
|
|
39
48
|
if (!chain.clock.isCurrentSlotGivenGossipDisparity(data.slot)) {
|
|
40
49
|
throw new PayloadAttestationError(GossipAction.IGNORE, {
|
package/src/db/beacon.ts
CHANGED
|
@@ -11,7 +11,6 @@ import {CheckpointStateRepository} from "./repositories/checkpointState.js";
|
|
|
11
11
|
import {
|
|
12
12
|
AttesterSlashingRepository,
|
|
13
13
|
BLSToExecutionChangeRepository,
|
|
14
|
-
BackfilledRanges,
|
|
15
14
|
BestLightClientUpdateRepository,
|
|
16
15
|
BlobSidecarsArchiveRepository,
|
|
17
16
|
BlobSidecarsRepository,
|
|
@@ -61,8 +60,6 @@ export class BeaconDb implements IBeaconDb {
|
|
|
61
60
|
syncCommittee: SyncCommitteeRepository;
|
|
62
61
|
syncCommitteeWitness: SyncCommitteeWitnessRepository;
|
|
63
62
|
|
|
64
|
-
backfilledRanges: BackfilledRanges;
|
|
65
|
-
|
|
66
63
|
readonly dataColumns: IDataColumnStore;
|
|
67
64
|
lastLegacyArchiveSlot: Slot | null = null;
|
|
68
65
|
private readonly flatFileStore: FlatFileStore;
|
|
@@ -97,8 +94,6 @@ export class BeaconDb implements IBeaconDb {
|
|
|
97
94
|
this.syncCommittee = new SyncCommitteeRepository(config, db);
|
|
98
95
|
this.syncCommitteeWitness = new SyncCommitteeWitnessRepository(config, db);
|
|
99
96
|
|
|
100
|
-
this.backfilledRanges = new BackfilledRanges(config, db);
|
|
101
|
-
|
|
102
97
|
this.flatFileStore = new FlatFileStore(opts.dataColumnDir, config, opts.logger, opts.metrics);
|
|
103
98
|
this.dataColumns = new LegacyDataColumnStore(
|
|
104
99
|
this.flatFileStore,
|
package/src/db/buckets.ts
CHANGED
|
@@ -56,7 +56,7 @@ export enum Bucket {
|
|
|
56
56
|
// altair_lightClientSyncCommitteeProof = 35, // DEPRECATED on v0.32.0
|
|
57
57
|
// index_lightClientInitProof = 36, // DEPRECATED on v0.32.0
|
|
58
58
|
|
|
59
|
-
backfilled_ranges = 42, //
|
|
59
|
+
// backfilled_ranges = 42, // DEPRECATED on v1.48.0
|
|
60
60
|
|
|
61
61
|
// Buckets to support LightClient server v2
|
|
62
62
|
lightClient_syncCommitteeWitness = 51, // BlockRoot -> SyncCommitteeWitness
|
|
@@ -71,7 +71,7 @@ export enum Bucket {
|
|
|
71
71
|
allForks_dataColumnSidecarsArchive = 58, // BeaconBlockSlot -> DataColumnSidecars
|
|
72
72
|
|
|
73
73
|
gloas_executionPayloadEnvelope = 59, // GLOAS BeaconBlockRoot -> SignedExecutionPayloadEnvelope
|
|
74
|
-
gloas_executionPayloadEnvelopeArchive = 60, // GLOAS Slot -> SignedExecutionPayloadEnvelope
|
|
74
|
+
gloas_executionPayloadEnvelopeArchive = 60, // GLOAS Slot -> SignedExecutionPayloadEnvelope, or 0x00 + SignedExecutionPayloadHeaderEnvelope
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export function getBucketNameByValue<T extends Bucket>(enumValue: T): keyof typeof Bucket {
|
package/src/db/interface.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {CheckpointStateRepository} from "./repositories/checkpointState.js";
|
|
|
6
6
|
import {
|
|
7
7
|
AttesterSlashingRepository,
|
|
8
8
|
BLSToExecutionChangeRepository,
|
|
9
|
-
BackfilledRanges,
|
|
10
9
|
BestLightClientUpdateRepository,
|
|
11
10
|
BlobSidecarsArchiveRepository,
|
|
12
11
|
BlobSidecarsRepository,
|
|
@@ -60,8 +59,6 @@ export interface IBeaconDb {
|
|
|
60
59
|
syncCommittee: SyncCommitteeRepository;
|
|
61
60
|
syncCommitteeWitness: SyncCommitteeWitnessRepository;
|
|
62
61
|
|
|
63
|
-
backfilledRanges: BackfilledRanges;
|
|
64
|
-
|
|
65
62
|
dataColumns: IDataColumnStore;
|
|
66
63
|
/** Highest legacy column slot at startup; later archival writes the block-root index first. */
|
|
67
64
|
readonly lastLegacyArchiveSlot: Slot | null;
|
|
@@ -1,25 +1,44 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {BUCKET_LENGTH, Db,
|
|
2
|
+
import {BUCKET_LENGTH, BinaryRepository, Db, DbBatch, encodeKey as encodeDbKey} from "@lodestar/db";
|
|
3
3
|
import {Slot, gloas, ssz} from "@lodestar/types";
|
|
4
4
|
import {bytesToInt} from "@lodestar/utils";
|
|
5
5
|
import {Bucket, getBucketNameByValue} from "../buckets.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Prefix of a header entry. A full `SignedExecutionPayloadEnvelope` starts with the offset of its
|
|
9
|
+
* variable-size `message` field (4 + 96 = 0x64), so a leading 0x00 byte is unambiguous and full
|
|
10
|
+
* entries can be stored as the hot db bytes, untouched.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
const HEADER_ENVELOPE_PREFIX = 0x00;
|
|
13
|
+
|
|
14
|
+
/** An archive entry as the serving paths need it: full stays bytes, header is deserialized for reconstruction */
|
|
15
|
+
export type ArchivedEnvelope =
|
|
16
|
+
| {headerEnvelope: gloas.SignedExecutionPayloadHeaderEnvelope; envelopeBytes?: undefined}
|
|
17
|
+
| {headerEnvelope?: undefined; envelopeBytes: Uint8Array};
|
|
18
|
+
|
|
19
|
+
export function decodeArchivedEnvelope(bytes: Uint8Array): ArchivedEnvelope {
|
|
20
|
+
return bytes[0] === HEADER_ENVELOPE_PREFIX
|
|
21
|
+
? {headerEnvelope: ssz.gloas.SignedExecutionPayloadHeaderEnvelope.deserialize(bytes.subarray(1))}
|
|
22
|
+
: {envelopeBytes: bytes};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function encodeArchivedHeaderEnvelope(headerEnvelope: gloas.SignedExecutionPayloadHeaderEnvelope): Uint8Array {
|
|
26
|
+
const value = ssz.gloas.SignedExecutionPayloadHeaderEnvelope.serialize(headerEnvelope);
|
|
27
|
+
const out = new Uint8Array(1 + value.length);
|
|
28
|
+
out[0] = HEADER_ENVELOPE_PREFIX;
|
|
29
|
+
out.set(value, 1);
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Finalized envelopes indexed by slot: `SignedExecutionPayloadEnvelope` bytes as-is
|
|
35
|
+
* (`--chain.dedupePayloads=false`, or the block was still optimistic when archived), or a
|
|
36
|
+
* `SignedExecutionPayloadHeaderEnvelope` behind a 0x00 prefix. See {@link decodeArchivedEnvelope}.
|
|
37
|
+
*/
|
|
38
|
+
export class ExecutionPayloadEnvelopeArchiveRepository extends BinaryRepository<Slot> {
|
|
13
39
|
constructor(config: ChainForkConfig, db: Db) {
|
|
14
40
|
const bucket = Bucket.gloas_executionPayloadEnvelopeArchive;
|
|
15
|
-
super(config, db, bucket,
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Id is the slot from the envelope
|
|
20
|
-
*/
|
|
21
|
-
getId(value: gloas.SignedExecutionPayloadEnvelope): Slot {
|
|
22
|
-
return value.message.payload.slotNumber;
|
|
41
|
+
super(config, db, bucket, getBucketNameByValue(bucket));
|
|
23
42
|
}
|
|
24
43
|
|
|
25
44
|
encodeKey(id: Slot): Uint8Array {
|
|
@@ -29,4 +48,15 @@ export class ExecutionPayloadEnvelopeArchiveRepository extends Repository<Slot,
|
|
|
29
48
|
decodeKey(data: Uint8Array): number {
|
|
30
49
|
return bytesToInt(data.subarray(BUCKET_LENGTH), "be");
|
|
31
50
|
}
|
|
51
|
+
|
|
52
|
+
/** Archive entries and delete their hot counterparts (`hotKey` pre-encoded) in one atomic batch */
|
|
53
|
+
async batchArchiveAndDeleteHot(
|
|
54
|
+
entries: {slot: Slot; archivedBytes: Uint8Array; hotKey: Uint8Array}[]
|
|
55
|
+
): Promise<void> {
|
|
56
|
+
const operations: DbBatch<Uint8Array, Uint8Array> = [];
|
|
57
|
+
for (const {slot, archivedBytes, hotKey} of entries) {
|
|
58
|
+
operations.push({type: "put", key: this.encodeKey(slot), value: archivedBytes}, {type: "del", key: hotKey});
|
|
59
|
+
}
|
|
60
|
+
await this.db.batch(operations, this.dbReqOpts);
|
|
61
|
+
}
|
|
32
62
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export {AttesterSlashingRepository} from "./attesterSlashing.js";
|
|
2
|
-
export {BackfilledRanges} from "./backfilledRanges.js";
|
|
3
2
|
export {BlobSidecarsRepository} from "./blobSidecars.js";
|
|
4
3
|
export {BlobSidecarsArchiveRepository} from "./blobSidecarsArchive.js";
|
|
5
4
|
export {BlockRepository} from "./block.js";
|
|
@@ -9,7 +8,12 @@ export {BLSToExecutionChangeRepository} from "./blsToExecutionChange.js";
|
|
|
9
8
|
export {DataColumnSidecarRepository} from "./dataColumnSidecar.js";
|
|
10
9
|
export {DataColumnSidecarArchiveRepository} from "./dataColumnSidecarArchive.js";
|
|
11
10
|
export {ExecutionPayloadEnvelopeRepository} from "./executionPayloadEnvelope.js";
|
|
12
|
-
export {
|
|
11
|
+
export {
|
|
12
|
+
type ArchivedEnvelope,
|
|
13
|
+
ExecutionPayloadEnvelopeArchiveRepository,
|
|
14
|
+
decodeArchivedEnvelope,
|
|
15
|
+
encodeArchivedHeaderEnvelope,
|
|
16
|
+
} from "./executionPayloadEnvelopeArchive.js";
|
|
13
17
|
export {BestLightClientUpdateRepository} from "./lightclientBestUpdate.js";
|
|
14
18
|
export {CheckpointHeaderRepository} from "./lightclientCheckpointHeader.js";
|
|
15
19
|
export {SyncCommitteeRepository} from "./lightclientSyncCommittee.js";
|
|
@@ -25,6 +25,10 @@ export class ExecutionEngineDisabled implements IExecutionEngine {
|
|
|
25
25
|
throw Error("Execution engine disabled");
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
getPayloadBodiesByHashV2(): Promise<never> {
|
|
29
|
+
throw Error("Execution engine disabled");
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
getPayloadBodiesByRange(): Promise<never> {
|
|
29
33
|
throw Error("Execution engine disabled");
|
|
30
34
|
}
|
|
@@ -32,11 +32,13 @@ import {
|
|
|
32
32
|
EngineApiRpcParamTypes,
|
|
33
33
|
EngineApiRpcReturnTypes,
|
|
34
34
|
ExecutionPayloadBody,
|
|
35
|
+
ExecutionPayloadBodyV2,
|
|
35
36
|
assertReqSizeLimit,
|
|
36
37
|
deserializeBlobAndProofs,
|
|
37
38
|
deserializeBlobAndProofsV2,
|
|
38
39
|
deserializeBlobAndProofsV2IntoBytes,
|
|
39
40
|
deserializeExecutionPayloadBody,
|
|
41
|
+
deserializeExecutionPayloadBodyV2,
|
|
40
42
|
parseExecutionPayload,
|
|
41
43
|
serializeBeaconBlockRoot,
|
|
42
44
|
serializeExecutionPayload,
|
|
@@ -476,6 +478,16 @@ export class ExecutionEngineHttp implements IExecutionEngine {
|
|
|
476
478
|
return response.map(deserializeExecutionPayloadBody);
|
|
477
479
|
}
|
|
478
480
|
|
|
481
|
+
async getPayloadBodiesByHashV2(blockHashes: RootHex[]): Promise<(ExecutionPayloadBodyV2 | null)[]> {
|
|
482
|
+
const method = "engine_getPayloadBodiesByHashV2";
|
|
483
|
+
assertReqSizeLimit(blockHashes.length, 32);
|
|
484
|
+
const response = await this.rpc.fetchWithRetries<
|
|
485
|
+
EngineApiRpcReturnTypes[typeof method],
|
|
486
|
+
EngineApiRpcParamTypes[typeof method]
|
|
487
|
+
>({method, params: [blockHashes]}, getPayloadBodiesByHashOpts);
|
|
488
|
+
return response.map(deserializeExecutionPayloadBodyV2);
|
|
489
|
+
}
|
|
490
|
+
|
|
479
491
|
async getPayloadBodiesByRange(
|
|
480
492
|
_fork: ForkName,
|
|
481
493
|
startBlockNumber: number,
|
|
@@ -13,7 +13,7 @@ import {BlobsBundle, ExecutionPayload, ExecutionRequests, Root, RootHex, Wei, ca
|
|
|
13
13
|
import {BlobAndProof} from "@lodestar/types/deneb";
|
|
14
14
|
import {BlobAndProofV2} from "@lodestar/types/fulu";
|
|
15
15
|
import {PayloadId, PayloadIdCache, WithdrawalV1} from "./payloadIdCache.js";
|
|
16
|
-
import {ExecutionPayloadBody} from "./types.js";
|
|
16
|
+
import {ExecutionPayloadBody, ExecutionPayloadBodyV2} from "./types.js";
|
|
17
17
|
import {DATA} from "./utils.js";
|
|
18
18
|
|
|
19
19
|
export {PayloadIdCache, type PayloadId, type WithdrawalV1};
|
|
@@ -172,6 +172,9 @@ export interface IExecutionEngine {
|
|
|
172
172
|
|
|
173
173
|
getPayloadBodiesByHash(fork: ForkName, blockHash: DATA[]): Promise<(ExecutionPayloadBody | null)[]>;
|
|
174
174
|
|
|
175
|
+
/** Amsterdam: like V1 but also returns the block access list (null if the EL no longer has it) */
|
|
176
|
+
getPayloadBodiesByHashV2(blockHash: DATA[]): Promise<(ExecutionPayloadBodyV2 | null)[]>;
|
|
177
|
+
|
|
175
178
|
getPayloadBodiesByRange(fork: ForkName, start: number, count: number): Promise<(ExecutionPayloadBody | null)[]>;
|
|
176
179
|
|
|
177
180
|
getBlobs(
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
EngineApiRpcParamTypes,
|
|
24
24
|
EngineApiRpcReturnTypes,
|
|
25
25
|
ExecutionPayloadBodyRpc,
|
|
26
|
+
ExecutionPayloadBodyV2Rpc,
|
|
26
27
|
ExecutionPayloadRpc,
|
|
27
28
|
ExecutionRequestsRpc,
|
|
28
29
|
PayloadStatus,
|
|
@@ -49,6 +50,8 @@ type ExecutionBlock = {
|
|
|
49
50
|
blockHash: RootHex;
|
|
50
51
|
timestamp: number;
|
|
51
52
|
blockNumber: number;
|
|
53
|
+
/** Bodies as received via newPayload, served back by engine_getPayloadBodiesByHash{V1,V2} */
|
|
54
|
+
body: ExecutionPayloadBodyV2Rpc;
|
|
52
55
|
};
|
|
53
56
|
|
|
54
57
|
const TX_TYPE_EIP1559 = 2;
|
|
@@ -93,6 +96,7 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
|
|
|
93
96
|
blockHash: ZERO_HASH_HEX,
|
|
94
97
|
timestamp: 0,
|
|
95
98
|
blockNumber: 0,
|
|
99
|
+
body: {transactions: [], withdrawals: null, blockAccessList: null},
|
|
96
100
|
});
|
|
97
101
|
|
|
98
102
|
const eth1BlockHash = opts.eth1BlockHash ?? toRootHex(INTEROP_BLOCK_HASH);
|
|
@@ -102,6 +106,7 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
|
|
|
102
106
|
blockHash: eth1BlockHash,
|
|
103
107
|
timestamp: 0,
|
|
104
108
|
blockNumber: 1,
|
|
109
|
+
body: {transactions: [], withdrawals: null, blockAccessList: null},
|
|
105
110
|
});
|
|
106
111
|
|
|
107
112
|
const {config} = opts;
|
|
@@ -144,6 +149,7 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
|
|
|
144
149
|
engine_getPayloadV5: this.getPayloadV5.bind(this),
|
|
145
150
|
engine_getPayloadV6: this.getPayloadV5.bind(this),
|
|
146
151
|
engine_getPayloadBodiesByHashV1: this.getPayloadBodiesByHash.bind(this),
|
|
152
|
+
engine_getPayloadBodiesByHashV2: this.getPayloadBodiesByHashV2.bind(this),
|
|
147
153
|
engine_getPayloadBodiesByRangeV1: this.getPayloadBodiesByRange.bind(this),
|
|
148
154
|
engine_getClientVersionV1: this.getClientVersionV1.bind(this),
|
|
149
155
|
engine_getBlobsV1: this.getBlobs.bind(this),
|
|
@@ -152,9 +158,18 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
|
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
private getPayloadBodiesByHash(
|
|
155
|
-
|
|
161
|
+
blockHashes: EngineApiRpcParamTypes["engine_getPayloadBodiesByHashV1"][0]
|
|
156
162
|
): EngineApiRpcReturnTypes["engine_getPayloadBodiesByHashV1"] {
|
|
157
|
-
return
|
|
163
|
+
return this.getPayloadBodiesByHashV2(blockHashes).map((body) =>
|
|
164
|
+
body ? {transactions: body.transactions, withdrawals: body.withdrawals} : null
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
private getPayloadBodiesByHashV2(
|
|
169
|
+
blockHashes: EngineApiRpcParamTypes["engine_getPayloadBodiesByHashV2"][0]
|
|
170
|
+
): EngineApiRpcReturnTypes["engine_getPayloadBodiesByHashV2"] {
|
|
171
|
+
// null for unknown blocks, as a real EL does; the genesis/eth1 seed blocks carry no body
|
|
172
|
+
return blockHashes.map((hash) => this.validBlocks.get(hash)?.body ?? null);
|
|
158
173
|
}
|
|
159
174
|
|
|
160
175
|
private getPayloadBodiesByRange(
|
|
@@ -227,6 +242,11 @@ export class ExecutionEngineMockBackend implements JsonRpcBackend {
|
|
|
227
242
|
blockHash,
|
|
228
243
|
timestamp: quantityToNum(executionPayloadRpc.timestamp),
|
|
229
244
|
blockNumber: quantityToNum(executionPayloadRpc.blockNumber),
|
|
245
|
+
body: {
|
|
246
|
+
transactions: executionPayloadRpc.transactions,
|
|
247
|
+
withdrawals: executionPayloadRpc.withdrawals ?? null,
|
|
248
|
+
blockAccessList: executionPayloadRpc.blockAccessList ?? null,
|
|
249
|
+
},
|
|
230
250
|
});
|
|
231
251
|
|
|
232
252
|
// IF the payload has been fully validated while processing the call
|
|
@@ -89,6 +89,7 @@ export type EngineApiRpcParamTypes = {
|
|
|
89
89
|
* 1. Array of DATA - Array of block_hash field values of the ExecutionPayload structure
|
|
90
90
|
* */
|
|
91
91
|
engine_getPayloadBodiesByHashV1: DATA[][];
|
|
92
|
+
engine_getPayloadBodiesByHashV2: DATA[][];
|
|
92
93
|
|
|
93
94
|
/**
|
|
94
95
|
* 1. start: QUANTITY, 64 bits - Starting block number
|
|
@@ -148,6 +149,7 @@ export type EngineApiRpcReturnTypes = {
|
|
|
148
149
|
engine_getPayloadV6: ExecutionPayloadResponse;
|
|
149
150
|
|
|
150
151
|
engine_getPayloadBodiesByHashV1: (ExecutionPayloadBodyRpc | null)[];
|
|
152
|
+
engine_getPayloadBodiesByHashV2: (ExecutionPayloadBodyV2Rpc | null)[];
|
|
151
153
|
|
|
152
154
|
engine_getPayloadBodiesByRangeV1: (ExecutionPayloadBodyRpc | null)[];
|
|
153
155
|
|
|
@@ -177,6 +179,15 @@ export type ExecutionPayloadBody = {
|
|
|
177
179
|
withdrawals: capella.Withdrawals | null;
|
|
178
180
|
};
|
|
179
181
|
|
|
182
|
+
/** engine_getPayloadBodiesByHashV2 (Amsterdam): adds the RLP-encoded block access list, or null if the EL has pruned it */
|
|
183
|
+
export type ExecutionPayloadBodyV2Rpc = ExecutionPayloadBodyRpc & {
|
|
184
|
+
blockAccessList?: DATA | null;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export type ExecutionPayloadBodyV2 = ExecutionPayloadBody & {
|
|
188
|
+
blockAccessList: Uint8Array | null;
|
|
189
|
+
};
|
|
190
|
+
|
|
180
191
|
export type ExecutionPayloadRpc = {
|
|
181
192
|
parentHash: DATA; // 32 bytes
|
|
182
193
|
feeRecipient: DATA; // 20 bytes
|
|
@@ -678,6 +689,20 @@ export function deserializeExecutionPayloadBody(data: ExecutionPayloadBodyRpc |
|
|
|
678
689
|
: null;
|
|
679
690
|
}
|
|
680
691
|
|
|
692
|
+
export function deserializeExecutionPayloadBodyV2(
|
|
693
|
+
data: ExecutionPayloadBodyV2Rpc | null
|
|
694
|
+
): ExecutionPayloadBodyV2 | null {
|
|
695
|
+
const body = deserializeExecutionPayloadBody(data);
|
|
696
|
+
return body
|
|
697
|
+
? {...body, blockAccessList: data?.blockAccessList ? dataToBytes(data.blockAccessList, null) : null}
|
|
698
|
+
: null;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
export function serializeExecutionPayloadBodyV2(data: ExecutionPayloadBodyV2 | null): ExecutionPayloadBodyV2Rpc | null {
|
|
702
|
+
const body = serializeExecutionPayloadBody(data);
|
|
703
|
+
return body ? {...body, blockAccessList: data?.blockAccessList ? bytesToData(data.blockAccessList) : null} : null;
|
|
704
|
+
}
|
|
705
|
+
|
|
681
706
|
export function serializeExecutionPayloadBody(data: ExecutionPayloadBody | null): ExecutionPayloadBodyRpc | null {
|
|
682
707
|
return data
|
|
683
708
|
? {
|
|
@@ -215,6 +215,22 @@ export function createBeaconMetrics(register: RegistryMetricCreator) {
|
|
|
215
215
|
help: "Number of getBlobsV1 hits where a versioned hash returns blob and the blob is needed so call is useful",
|
|
216
216
|
}),
|
|
217
217
|
},
|
|
218
|
+
payloadEnvelopeReconstruction: {
|
|
219
|
+
envelopes: register.counter<{result: "ok" | "unavailable" | "mismatch"}>({
|
|
220
|
+
name: "beacon_payload_envelope_reconstruction_envelopes_total",
|
|
221
|
+
help: "Archived header envelopes rebuilt from EL bodies, by outcome",
|
|
222
|
+
labelNames: ["result"],
|
|
223
|
+
}),
|
|
224
|
+
mismatchByField: register.counter<{field: "transactions" | "withdrawals" | "blockAccessList"}>({
|
|
225
|
+
name: "beacon_payload_envelope_reconstruction_mismatch_total",
|
|
226
|
+
help: "Body root mismatches, by which body differed from the stored root",
|
|
227
|
+
labelNames: ["field"],
|
|
228
|
+
}),
|
|
229
|
+
engineErrors: register.counter({
|
|
230
|
+
name: "beacon_payload_envelope_reconstruction_engine_errors_total",
|
|
231
|
+
help: "engine_getPayloadBodiesByHashV2 round-trips that failed while rebuilding envelopes",
|
|
232
|
+
}),
|
|
233
|
+
},
|
|
218
234
|
|
|
219
235
|
blockInputFetchStats: {
|
|
220
236
|
// of already available blocks which didn't have to go through blobs pull
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** biome-ignore-all lint/suspicious/noTemplateCurlyInString: The metric templates requires to have `${}` in a normal string */
|
|
2
2
|
import {NotReorgedReason} from "@lodestar/fork-choice";
|
|
3
|
+
import {StateHashTreeRootSource} from "@lodestar/state-transition";
|
|
3
4
|
import {ArchiveStoreTask} from "../../chain/archiveStore/archiveStore.js";
|
|
4
5
|
import {FrequencyStateArchiveStep} from "../../chain/archiveStore/strategies/frequencyStateArchiveStrategy.js";
|
|
5
6
|
import type {LateCanonicalBlockReason} from "../../chain/archiveStore/utils/archiveBlocks.js";
|
|
@@ -25,8 +26,13 @@ import type {FlatFileStoreOperation} from "../../db/flatFileStore/metrics.js";
|
|
|
25
26
|
import {ExecutionPayloadStatus} from "../../execution/index.js";
|
|
26
27
|
import {GossipType} from "../../network/index.js";
|
|
27
28
|
import {CannotAcceptWorkReason, ReprocessRejectReason} from "../../network/processor/index.js";
|
|
28
|
-
import {
|
|
29
|
-
|
|
29
|
+
import {
|
|
30
|
+
DeferredPayloadResult,
|
|
31
|
+
DownloadResult,
|
|
32
|
+
DroppedItemReason,
|
|
33
|
+
FetchResult,
|
|
34
|
+
PendingBlockType,
|
|
35
|
+
} from "../../sync/types.js";
|
|
30
36
|
import {PeerSyncType, RangeSyncType} from "../../sync/utils/remoteSyncType.js";
|
|
31
37
|
import {AllocSource} from "../../util/bufferPool.js";
|
|
32
38
|
import {DataColumnReconstructionCode} from "../../util/dataColumns.js";
|
|
@@ -174,6 +180,30 @@ export function createLodestarMetrics(
|
|
|
174
180
|
buckets: [0.001, 0.003, 0.01, 0.03, 0.1],
|
|
175
181
|
}),
|
|
176
182
|
|
|
183
|
+
reqRespByRange: {
|
|
184
|
+
requestedSlots: register.histogram<{method: string}>({
|
|
185
|
+
name: "lodestar_reqresp_by_range_requested_slots",
|
|
186
|
+
help: "Histogram of slot count requested per served by_range request",
|
|
187
|
+
labelNames: ["method"],
|
|
188
|
+
buckets: [1, 16, 32, 64, 128],
|
|
189
|
+
}),
|
|
190
|
+
// data_column_sidecars_by_range is the only by_range request carrying columns
|
|
191
|
+
requestedColumns: register.histogram({
|
|
192
|
+
name: "lodestar_reqresp_by_range_requested_columns",
|
|
193
|
+
help: "Histogram of column count requested per served data_column_sidecars_by_range request",
|
|
194
|
+
// 128 is NUMBER_OF_COLUMNS.
|
|
195
|
+
buckets: [1, 4, 8, 32, 128],
|
|
196
|
+
}),
|
|
197
|
+
servedBytes: register.histogram<{method: string}>({
|
|
198
|
+
name: "lodestar_reqresp_by_range_served_bytes",
|
|
199
|
+
help: "Histogram of total serialized bytes served per by_range request",
|
|
200
|
+
labelNames: ["method"],
|
|
201
|
+
// min bucket is roughly a typical mainnet block is 100MB,
|
|
202
|
+
// max bucket is roughly 100 * MAX_PAYLOAD_SIZE
|
|
203
|
+
buckets: [100e3, 1e6, 10e6, 100e6, 1000e6],
|
|
204
|
+
}),
|
|
205
|
+
},
|
|
206
|
+
|
|
177
207
|
regenQueue: {
|
|
178
208
|
length: register.gauge({
|
|
179
209
|
name: "lodestar_regen_queue_length",
|
|
@@ -403,6 +433,15 @@ export function createLodestarMetrics(
|
|
|
403
433
|
labelNames: ["caller"],
|
|
404
434
|
}),
|
|
405
435
|
|
|
436
|
+
// this metrics stay here instead of @lodestar/state-transition in order to prepare
|
|
437
|
+
// for the native zig state-transition in the future
|
|
438
|
+
stateHashTreeRootTime: register.histogram<{source: StateHashTreeRootSource}>({
|
|
439
|
+
name: "lodestar_stfn_hash_tree_root_seconds",
|
|
440
|
+
help: "Time to compute the hash tree root of a post state in seconds",
|
|
441
|
+
buckets: [0.01, 0.05, 0.1, 0.2, 0.3, 0.5],
|
|
442
|
+
labelNames: ["source"],
|
|
443
|
+
}),
|
|
444
|
+
|
|
406
445
|
// BLS verifier thread pool and queue
|
|
407
446
|
|
|
408
447
|
bls: {
|
|
@@ -655,6 +694,16 @@ export function createLodestarMetrics(
|
|
|
655
694
|
help: "Count of payload (execution payload envelope) sync triggers, labeled by their source",
|
|
656
695
|
labelNames: ["source"],
|
|
657
696
|
}),
|
|
697
|
+
deferredPayloadResult: register.counter<{result: DeferredPayloadResult}>({
|
|
698
|
+
name: "lodestar_sync_deferred_payload_result_total",
|
|
699
|
+
help: "Outcome of a slot's deferred optimistic payload searches, by result",
|
|
700
|
+
labelNames: ["result"],
|
|
701
|
+
}),
|
|
702
|
+
deferredPayloadPolls: register.histogram({
|
|
703
|
+
name: "lodestar_sync_deferred_payload_polls_count",
|
|
704
|
+
help: "Poll ticks after PAYLOAD_DUE until a searched payload was imported",
|
|
705
|
+
buckets: [0, 1, 2, 3, 6],
|
|
706
|
+
}),
|
|
658
707
|
pendingBlocks: register.gauge({
|
|
659
708
|
name: "lodestar_sync_unknown_block_pending_blocks_size",
|
|
660
709
|
help: "Current size of UnknownBlockSync pending blocks cache",
|
|
@@ -986,6 +1035,13 @@ export function createLodestarMetrics(
|
|
|
986
1035
|
help: "Count of errors, by error type, while processing execution payload envelopes",
|
|
987
1036
|
labelNames: ["error"],
|
|
988
1037
|
}),
|
|
1038
|
+
executionPayload: {
|
|
1039
|
+
recvToValidation: register.histogram({
|
|
1040
|
+
name: "lodestar_gossip_execution_payload_envelope_received_to_execution_payload_verification_seconds",
|
|
1041
|
+
help: "Time elapsed between execution payload envelope received and execution payload verification",
|
|
1042
|
+
buckets: [0.05, 0.1, 0.25, 0.5, 1, 2, 3, 4, 6, 8],
|
|
1043
|
+
}),
|
|
1044
|
+
},
|
|
989
1045
|
},
|
|
990
1046
|
gossipExecutionPayloadBid: {
|
|
991
1047
|
elapsedTimeTillReceived: register.histogram<{source: OpSource}>({
|
|
@@ -1120,30 +1176,6 @@ export function createLodestarMetrics(
|
|
|
1120
1176
|
help: "The total result of calling notifyForkchoiceUpdate execution engine api",
|
|
1121
1177
|
labelNames: ["result"],
|
|
1122
1178
|
}),
|
|
1123
|
-
backfillSync: {
|
|
1124
|
-
backfilledTillSlot: register.gauge({
|
|
1125
|
-
name: "lodestar_backfill_till_slot",
|
|
1126
|
-
help: "Current lowest backfilled slot",
|
|
1127
|
-
}),
|
|
1128
|
-
prevFinOrWsSlot: register.gauge({
|
|
1129
|
-
name: "lodestar_backfill_prev_fin_or_ws_slot",
|
|
1130
|
-
help: "Slot of previous finalized or wsCheckpoint block to be validated",
|
|
1131
|
-
}),
|
|
1132
|
-
totalBlocks: register.gauge<{method: BackfillSyncMethod}>({
|
|
1133
|
-
name: "lodestar_backfill_sync_blocks_total",
|
|
1134
|
-
help: "Total amount of backfilled blocks",
|
|
1135
|
-
labelNames: ["method"],
|
|
1136
|
-
}),
|
|
1137
|
-
errors: register.gauge({
|
|
1138
|
-
name: "lodestar_backfill_sync_errors_total",
|
|
1139
|
-
help: "Total number of errors while backfilling",
|
|
1140
|
-
}),
|
|
1141
|
-
status: register.gauge({
|
|
1142
|
-
name: "lodestar_backfill_sync_status",
|
|
1143
|
-
help: "Current backfill syncing status: [Aborted, Pending, Syncing, Completed]",
|
|
1144
|
-
}),
|
|
1145
|
-
},
|
|
1146
|
-
|
|
1147
1179
|
opPool: {
|
|
1148
1180
|
aggregatedAttestationPool: {
|
|
1149
1181
|
size: register.gauge({
|