@lodestar/state-transition 1.44.0-dev.6ef8199cfa → 1.44.0-dev.762dd5f186

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 (90) hide show
  1. package/lib/block/index.d.ts +2 -0
  2. package/lib/block/index.d.ts.map +1 -1
  3. package/lib/block/index.js +3 -1
  4. package/lib/block/index.js.map +1 -1
  5. package/lib/block/processBuilderDepositRequest.d.ts +10 -0
  6. package/lib/block/processBuilderDepositRequest.d.ts.map +1 -0
  7. package/lib/block/processBuilderDepositRequest.js +27 -0
  8. package/lib/block/processBuilderDepositRequest.js.map +1 -0
  9. package/lib/block/processBuilderExitRequest.d.ts +13 -0
  10. package/lib/block/processBuilderExitRequest.d.ts.map +1 -0
  11. package/lib/block/processBuilderExitRequest.js +29 -0
  12. package/lib/block/processBuilderExitRequest.js.map +1 -0
  13. package/lib/block/processDepositRequest.d.ts +2 -8
  14. package/lib/block/processDepositRequest.d.ts.map +1 -1
  15. package/lib/block/processDepositRequest.js +3 -98
  16. package/lib/block/processDepositRequest.js.map +1 -1
  17. package/lib/block/processExecutionPayloadBid.d.ts +2 -3
  18. package/lib/block/processExecutionPayloadBid.d.ts.map +1 -1
  19. package/lib/block/processExecutionPayloadBid.js +16 -8
  20. package/lib/block/processExecutionPayloadBid.js.map +1 -1
  21. package/lib/block/processOperations.d.ts.map +1 -1
  22. package/lib/block/processOperations.js +3 -2
  23. package/lib/block/processOperations.js.map +1 -1
  24. package/lib/block/processParentExecutionPayload.d.ts +2 -2
  25. package/lib/block/processParentExecutionPayload.d.ts.map +1 -1
  26. package/lib/block/processParentExecutionPayload.js +16 -8
  27. package/lib/block/processParentExecutionPayload.js.map +1 -1
  28. package/lib/block/processProposerSlashing.d.ts.map +1 -1
  29. package/lib/block/processProposerSlashing.js +9 -1
  30. package/lib/block/processProposerSlashing.js.map +1 -1
  31. package/lib/block/processVoluntaryExit.d.ts +1 -1
  32. package/lib/block/processVoluntaryExit.d.ts.map +1 -1
  33. package/lib/block/processVoluntaryExit.js +1 -35
  34. package/lib/block/processVoluntaryExit.js.map +1 -1
  35. package/lib/cache/epochCache.d.ts.map +1 -1
  36. package/lib/cache/epochCache.js +10 -7
  37. package/lib/cache/epochCache.js.map +1 -1
  38. package/lib/epoch/processPendingDeposits.d.ts.map +1 -1
  39. package/lib/epoch/processPendingDeposits.js +4 -3
  40. package/lib/epoch/processPendingDeposits.js.map +1 -1
  41. package/lib/epoch/processProposerLookahead.d.ts.map +1 -1
  42. package/lib/epoch/processProposerLookahead.js +7 -2
  43. package/lib/epoch/processProposerLookahead.js.map +1 -1
  44. package/lib/slot/upgradeStateToGloas.js +35 -29
  45. package/lib/slot/upgradeStateToGloas.js.map +1 -1
  46. package/lib/stateView/beaconStateView.d.ts +5 -2
  47. package/lib/stateView/beaconStateView.d.ts.map +1 -1
  48. package/lib/stateView/beaconStateView.js +14 -0
  49. package/lib/stateView/beaconStateView.js.map +1 -1
  50. package/lib/stateView/interface.d.ts +30 -2
  51. package/lib/stateView/interface.d.ts.map +1 -1
  52. package/lib/stateView/interface.js.map +1 -1
  53. package/lib/stateView/nativeBeaconStateView.d.ts +230 -0
  54. package/lib/stateView/nativeBeaconStateView.d.ts.map +1 -0
  55. package/lib/stateView/nativeBeaconStateView.js +717 -0
  56. package/lib/stateView/nativeBeaconStateView.js.map +1 -0
  57. package/lib/stateView/stateViewFactory.d.ts.map +1 -1
  58. package/lib/stateView/stateViewFactory.js +2 -0
  59. package/lib/stateView/stateViewFactory.js.map +1 -1
  60. package/lib/util/epochShuffling.js +1 -1
  61. package/lib/util/epochShuffling.js.map +1 -1
  62. package/lib/util/gloas.d.ts +31 -0
  63. package/lib/util/gloas.d.ts.map +1 -1
  64. package/lib/util/gloas.js +83 -1
  65. package/lib/util/gloas.js.map +1 -1
  66. package/lib/util/shuffling.d.ts +2 -2
  67. package/lib/util/shuffling.d.ts.map +1 -1
  68. package/lib/util/shuffling.js +4 -3
  69. package/lib/util/shuffling.js.map +1 -1
  70. package/package.json +7 -8
  71. package/src/block/index.ts +6 -1
  72. package/src/block/processBuilderDepositRequest.ts +43 -0
  73. package/src/block/processBuilderExitRequest.ts +39 -0
  74. package/src/block/processDepositRequest.ts +4 -124
  75. package/src/block/processExecutionPayloadBid.ts +24 -9
  76. package/src/block/processOperations.ts +3 -2
  77. package/src/block/processParentExecutionPayload.ts +23 -11
  78. package/src/block/processProposerSlashing.ts +9 -4
  79. package/src/block/processVoluntaryExit.ts +2 -61
  80. package/src/cache/epochCache.ts +10 -7
  81. package/src/epoch/processPendingDeposits.ts +2 -0
  82. package/src/epoch/processProposerLookahead.ts +8 -1
  83. package/src/slot/upgradeStateToGloas.ts +49 -33
  84. package/src/stateView/beaconStateView.ts +18 -1
  85. package/src/stateView/interface.ts +34 -1
  86. package/src/stateView/nativeBeaconStateView.ts +915 -0
  87. package/src/stateView/stateViewFactory.ts +2 -0
  88. package/src/util/epochShuffling.ts +1 -1
  89. package/src/util/gloas.ts +104 -1
  90. package/src/util/shuffling.ts +4 -3
@@ -23,6 +23,7 @@ import {
23
23
  BlindedBeaconBlock,
24
24
  BuilderIndex,
25
25
  Bytes32,
26
+ CommitteeIndex,
26
27
  Epoch,
27
28
  ExecutionPayloadBid,
28
29
  ExecutionPayloadHeader,
@@ -75,6 +76,8 @@ export interface IBeaconStateView {
75
76
 
76
77
  // Shuffling and committees
77
78
  getShufflingAtEpoch(epoch: Epoch): EpochShuffling;
79
+ getBeaconCommittee(slot: Slot, index: CommitteeIndex): Uint32Array;
80
+ getBeaconCommitteeCountPerSlot(epoch: Epoch): number;
78
81
  // Decision roots
79
82
  previousDecisionRoot: RootHex;
80
83
  currentDecisionRoot: RootHex;
@@ -89,6 +92,7 @@ export interface IBeaconStateView {
89
92
  currentProposers: ValidatorIndex[];
90
93
  nextProposers: ValidatorIndex[];
91
94
  getBeaconProposer(slot: Slot): ValidatorIndex;
95
+ getBeaconProposerOrNull(slot: Slot): ValidatorIndex | null;
92
96
 
93
97
  // Validators and balances
94
98
  effectiveBalanceIncrements: EffectiveBalanceIncrements;
@@ -260,7 +264,7 @@ export interface IBeaconStateViewGloas extends IBeaconStateViewFulu {
260
264
  * operation selection (e.g. voluntary exits) see the same post-apply state that the block
261
265
  * processor will see at import.
262
266
  */
263
- withParentPayloadApplied(executionRequests: electra.ExecutionRequests): IBeaconStateViewGloas;
267
+ withParentPayloadApplied(executionRequests: gloas.ExecutionRequests): IBeaconStateViewGloas;
264
268
  }
265
269
 
266
270
  /**
@@ -277,6 +281,35 @@ export type IBeaconStateViewLatestFork = Omit<
277
281
  latestExecutionPayloadHeader: ExecutionPayloadHeader;
278
282
  payloadBlockNumber: number;
279
283
  };
284
+
285
+ /**
286
+ * Contract a BeaconStateView backing implementation must satisfy.
287
+ *
288
+ * Differs from `IBeaconStateViewLatestFork` in two ways:
289
+ * - `executionPayloadAvailability` is a raw `{uint8Array, bitLen}` POJO — a
290
+ * native (`.node`) binding cannot construct a `BitArray` across FFI.
291
+ * `NativeBeaconStateView` lifts it back to `BitArray` for beacon-node.
292
+ * - Methods that produce another view (`stateTransition`, `processSlots`,
293
+ * `loadOtherState`, `withParentPayloadApplied`) return `IBeaconStateViewNative`
294
+ * so callers can re-wrap without an `as unknown` cast. Param lists are reused
295
+ * via `Parameters<...>` to avoid duplicating signatures.
296
+ *
297
+ * The TS-side `BeaconStateView` also structurally satisfies this contract since
298
+ * `BitArray` exposes `uint8Array` and `bitLen`.
299
+ */
300
+ export type IBeaconStateViewNative = Omit<
301
+ IBeaconStateViewLatestFork,
302
+ "executionPayloadAvailability" | "loadOtherState" | "stateTransition" | "processSlots" | "withParentPayloadApplied"
303
+ > & {
304
+ executionPayloadAvailability: {uint8Array: Uint8Array; bitLen: number};
305
+ loadOtherState(...args: Parameters<IBeaconStateViewLatestFork["loadOtherState"]>): IBeaconStateViewNative;
306
+ stateTransition(...args: Parameters<IBeaconStateViewLatestFork["stateTransition"]>): IBeaconStateViewNative;
307
+ processSlots(...args: Parameters<IBeaconStateViewLatestFork["processSlots"]>): IBeaconStateViewNative;
308
+ withParentPayloadApplied(
309
+ ...args: Parameters<IBeaconStateViewLatestFork["withParentPayloadApplied"]>
310
+ ): IBeaconStateViewNative;
311
+ };
312
+
280
313
  export function isStatePostAltair(state: IBeaconStateView): state is IBeaconStateViewAltair {
281
314
  return isForkPostAltair(state.forkName);
282
315
  }