@lodestar/beacon-node 1.42.0-dev.83dedda569 → 1.42.0-dev.a5906cd323

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.
Files changed (50) hide show
  1. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  2. package/lib/chain/archiveStore/archiveStore.js +1 -0
  3. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  4. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +3 -3
  5. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  6. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +6 -4
  7. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  8. package/lib/chain/archiveStore/historicalState/historicalStateRegen.d.ts +2 -2
  9. package/lib/chain/archiveStore/historicalState/historicalStateRegen.d.ts.map +1 -1
  10. package/lib/chain/archiveStore/historicalState/historicalStateRegen.js +1 -0
  11. package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
  12. package/lib/chain/archiveStore/historicalState/types.d.ts +2 -0
  13. package/lib/chain/archiveStore/historicalState/types.d.ts.map +1 -1
  14. package/lib/chain/archiveStore/historicalState/types.js.map +1 -1
  15. package/lib/chain/archiveStore/historicalState/worker.js +1 -4
  16. package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
  17. package/lib/chain/archiveStore/interface.d.ts +1 -0
  18. package/lib/chain/archiveStore/interface.d.ts.map +1 -1
  19. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  20. package/lib/chain/blocks/importBlock.js +17 -17
  21. package/lib/chain/blocks/importBlock.js.map +1 -1
  22. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  23. package/lib/chain/blocks/importExecutionPayload.js +21 -12
  24. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  25. package/lib/chain/blocks/index.d.ts.map +1 -1
  26. package/lib/chain/blocks/index.js +2 -1
  27. package/lib/chain/blocks/index.js.map +1 -1
  28. package/lib/chain/blocks/types.d.ts +20 -14
  29. package/lib/chain/blocks/types.d.ts.map +1 -1
  30. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +2 -2
  31. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  32. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +1 -1
  33. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  34. package/lib/chain/options.d.ts +1 -0
  35. package/lib/chain/options.d.ts.map +1 -1
  36. package/lib/chain/options.js +1 -0
  37. package/lib/chain/options.js.map +1 -1
  38. package/package.json +15 -15
  39. package/src/chain/archiveStore/archiveStore.ts +1 -0
  40. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +6 -5
  41. package/src/chain/archiveStore/historicalState/historicalStateRegen.ts +2 -1
  42. package/src/chain/archiveStore/historicalState/types.ts +2 -0
  43. package/src/chain/archiveStore/historicalState/worker.ts +1 -5
  44. package/src/chain/archiveStore/interface.ts +1 -0
  45. package/src/chain/blocks/importBlock.ts +18 -17
  46. package/src/chain/blocks/importExecutionPayload.ts +23 -12
  47. package/src/chain/blocks/index.ts +2 -1
  48. package/src/chain/blocks/types.ts +25 -14
  49. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +4 -4
  50. package/src/chain/options.ts +2 -0
@@ -1,5 +1,5 @@
1
1
  import type {ChainForkConfig} from "@lodestar/config";
2
- import {MaybeValidExecutionStatus} from "@lodestar/fork-choice";
2
+ import {BlockExecutionStatus, PayloadExecutionStatus} from "@lodestar/fork-choice";
3
3
  import {ForkSeq} from "@lodestar/params";
4
4
  import {DataAvailabilityStatus, IBeaconStateView, computeEpochAtSlot} from "@lodestar/state-transition";
5
5
  import type {IndexedAttestation, Slot, fulu} from "@lodestar/types";
@@ -88,24 +88,35 @@ export type ImportBlockOpts = {
88
88
  seenTimestampSec?: number;
89
89
  };
90
90
 
91
- /**
92
- * A wrapper around a `SignedBeaconBlock` that indicates that this block is fully verified and ready to import
93
- */
94
- export type FullyVerifiedBlock = {
91
+ type FullyVerifiedBlockBase = {
95
92
  blockInput: IBlockInput;
96
- postState: IBeaconStateView;
93
+ postBlockState: IBeaconStateView;
97
94
  parentBlockSlot: Slot;
98
95
  proposerBalanceDelta: number;
99
- /**
100
- * If the execution payload couldnt be verified because of EL syncing status,
101
- * used in optimistic sync or for merge block
102
- */
103
- executionStatus: MaybeValidExecutionStatus;
104
96
  dataAvailabilityStatus: DataAvailabilityStatus;
105
- /**
106
- * Pre-computed indexed attestations from signature verification to avoid duplicate work
107
- */
97
+ /** Pre-computed indexed attestations from signature verification to avoid duplicate work */
108
98
  indexedAttestations: IndexedAttestation[];
109
99
  /** Seen timestamp seconds */
110
100
  seenTimestampSec: number;
111
101
  };
102
+
103
+ /**
104
+ * A wrapper around a `SignedBeaconBlock` that indicates that this block is fully verified and ready to import.
105
+ *
106
+ * Discriminated union on `postEnvelopeState`:
107
+ * - `null` → block has no pre-verified envelope; `executionStatus` is any `BlockExecutionStatus`
108
+ * - non-null → envelope was pre-verified during state transition; `executionStatus` is narrowed to
109
+ * `Valid | Syncing` (matching what `forkChoice.onExecutionPayload` expects)
110
+ */
111
+ export type FullyVerifiedBlock = FullyVerifiedBlockBase &
112
+ (
113
+ | {
114
+ postEnvelopeState: null;
115
+ /** If the execution payload couldn't be verified because of EL syncing status, used in optimistic sync or for merge block */
116
+ executionStatus: BlockExecutionStatus;
117
+ }
118
+ | {
119
+ postEnvelopeState: IBeaconStateView;
120
+ executionStatus: PayloadExecutionStatus;
121
+ }
122
+ );
@@ -1,10 +1,10 @@
1
1
  import {ChainForkConfig} from "@lodestar/config";
2
2
  import {
3
+ BlockExecutionStatus,
3
4
  ExecutionStatus,
4
5
  IForkChoice,
5
6
  LVHInvalidResponse,
6
7
  LVHValidResponse,
7
- MaybeValidExecutionStatus,
8
8
  ProtoBlock,
9
9
  } from "@lodestar/fork-choice";
10
10
  import {ForkSeq} from "@lodestar/params";
@@ -33,7 +33,7 @@ type ExecAbortType = {blockIndex: number; execError: BlockError};
33
33
  export type SegmentExecStatus =
34
34
  | {
35
35
  execAborted: null;
36
- executionStatuses: MaybeValidExecutionStatus[];
36
+ executionStatuses: BlockExecutionStatus[];
37
37
  executionTime: number;
38
38
  }
39
39
  | {execAborted: ExecAbortType; invalidSegmentLVH?: LVHInvalidResponse};
@@ -62,7 +62,7 @@ export async function verifyBlocksExecutionPayload(
62
62
  signal: AbortSignal,
63
63
  opts: BlockProcessOpts & ImportBlockOpts
64
64
  ): Promise<SegmentExecStatus> {
65
- const executionStatuses: MaybeValidExecutionStatus[] = [];
65
+ const executionStatuses: BlockExecutionStatus[] = [];
66
66
  const recvToValLatency = Date.now() / 1000 - (opts.seenTimestampSec ?? Date.now() / 1000);
67
67
  const lastBlock = blockInputs.at(-1);
68
68
 
@@ -103,7 +103,7 @@ export async function verifyBlocksExecutionPayload(
103
103
  return getSegmentErrorResponse({verifyResponse, blockIndex}, parentBlock, blockInputs);
104
104
  }
105
105
 
106
- // If we are here then its because executionStatus is one of MaybeValidExecutionStatus
106
+ // If we are here then its because executionStatus is one of BlockExecutionStatus
107
107
  const {executionStatus} = verifyResponse;
108
108
  executionStatuses.push(executionStatus);
109
109
  }
@@ -47,6 +47,7 @@ export type IChainOptions = BlockProcessOpts &
47
47
  minSameMessageSignatureSetsToBatch: number;
48
48
  archiveDateEpochs?: number;
49
49
  nHistoricalStatesFileDataStore?: boolean;
50
+ nativeStateView?: boolean;
50
51
  };
51
52
 
52
53
  export type BlockProcessOpts = {
@@ -124,6 +125,7 @@ export const defaultChainOptions: IChainOptions = {
124
125
  // - users can prune the persisted checkpoint state files manually to save disc space
125
126
  // - it helps debug easier when network is unfinalized
126
127
  nHistoricalStatesFileDataStore: true,
128
+ nativeStateView: false,
127
129
  maxBlockStates: DEFAULT_MAX_BLOCK_STATES,
128
130
  maxCPStateEpochsInMemory: DEFAULT_MAX_CP_STATE_EPOCHS_IN_MEMORY,
129
131
  maxCPStateEpochsOnDisk: DEFAULT_MAX_CP_STATE_ON_DISK,