@lodestar/beacon-node 1.43.0-dev.2740f92909 → 1.43.0-dev.5f9285892c

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 (68) hide show
  1. package/lib/chain/blocks/importBlock.js +4 -4
  2. package/lib/chain/blocks/importBlock.js.map +1 -1
  3. package/lib/chain/chain.d.ts.map +1 -1
  4. package/lib/chain/chain.js +3 -7
  5. package/lib/chain/chain.js.map +1 -1
  6. package/lib/chain/errors/attestationError.d.ts +8 -1
  7. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  8. package/lib/chain/errors/attestationError.js +4 -0
  9. package/lib/chain/errors/attestationError.js.map +1 -1
  10. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  11. package/lib/chain/forkChoice/index.js +6 -2
  12. package/lib/chain/forkChoice/index.js.map +1 -1
  13. package/lib/chain/regen/interface.d.ts +0 -1
  14. package/lib/chain/regen/interface.d.ts.map +1 -1
  15. package/lib/chain/regen/queued.d.ts +2 -3
  16. package/lib/chain/regen/queued.d.ts.map +1 -1
  17. package/lib/chain/regen/queued.js +7 -32
  18. package/lib/chain/regen/queued.js.map +1 -1
  19. package/lib/chain/regen/regen.d.ts.map +1 -1
  20. package/lib/chain/regen/regen.js +7 -26
  21. package/lib/chain/regen/regen.js.map +1 -1
  22. package/lib/chain/stateCache/datastore/db.d.ts +5 -4
  23. package/lib/chain/stateCache/datastore/db.d.ts.map +1 -1
  24. package/lib/chain/stateCache/datastore/db.js +10 -32
  25. package/lib/chain/stateCache/datastore/db.js.map +1 -1
  26. package/lib/chain/stateCache/datastore/file.d.ts +1 -1
  27. package/lib/chain/stateCache/datastore/file.d.ts.map +1 -1
  28. package/lib/chain/stateCache/datastore/file.js +5 -5
  29. package/lib/chain/stateCache/datastore/file.js.map +1 -1
  30. package/lib/chain/stateCache/datastore/types.d.ts +1 -1
  31. package/lib/chain/stateCache/datastore/types.d.ts.map +1 -1
  32. package/lib/chain/stateCache/fifoBlockStateCache.d.ts +1 -7
  33. package/lib/chain/stateCache/fifoBlockStateCache.d.ts.map +1 -1
  34. package/lib/chain/stateCache/fifoBlockStateCache.js +0 -8
  35. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  36. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +19 -30
  37. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  38. package/lib/chain/stateCache/persistentCheckpointsCache.js +118 -209
  39. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  40. package/lib/chain/stateCache/types.d.ts +12 -13
  41. package/lib/chain/stateCache/types.d.ts.map +1 -1
  42. package/lib/chain/stateCache/types.js.map +1 -1
  43. package/lib/chain/validation/aggregateAndProof.js +12 -0
  44. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  45. package/lib/chain/validation/attestation.d.ts.map +1 -1
  46. package/lib/chain/validation/attestation.js +12 -0
  47. package/lib/chain/validation/attestation.js.map +1 -1
  48. package/lib/chain/validation/executionPayloadEnvelope.js +1 -1
  49. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  50. package/lib/network/gossip/topic.d.ts +2 -729
  51. package/lib/network/gossip/topic.d.ts.map +1 -1
  52. package/package.json +15 -15
  53. package/src/chain/blocks/importBlock.ts +4 -4
  54. package/src/chain/chain.ts +3 -15
  55. package/src/chain/errors/attestationError.ts +6 -1
  56. package/src/chain/forkChoice/index.ts +6 -2
  57. package/src/chain/regen/interface.ts +0 -1
  58. package/src/chain/regen/queued.ts +8 -36
  59. package/src/chain/regen/regen.ts +8 -28
  60. package/src/chain/stateCache/datastore/db.ts +10 -33
  61. package/src/chain/stateCache/datastore/file.ts +5 -6
  62. package/src/chain/stateCache/datastore/types.ts +2 -3
  63. package/src/chain/stateCache/fifoBlockStateCache.ts +1 -10
  64. package/src/chain/stateCache/persistentCheckpointsCache.ts +142 -240
  65. package/src/chain/stateCache/types.ts +10 -13
  66. package/src/chain/validation/aggregateAndProof.ts +13 -0
  67. package/src/chain/validation/attestation.ts +13 -0
  68. package/src/chain/validation/executionPayloadEnvelope.ts +1 -1
@@ -90,6 +90,19 @@ async function validateAggregateAndProof(
90
90
  });
91
91
  }
92
92
 
93
+ // [REJECT] If `aggregate.data.index == 1` (payload present for a past
94
+ // block), the execution payload for `block` passes validation.
95
+ // [IGNORE] When `aggregate.data.index == 1` (payload present for a past block),
96
+ // the corresponding execution payload for `block` has been seen (a client MAY queue
97
+ // attestations for processing once the payload is retrieved and SHOULD request the
98
+ // payload envelope via `ExecutionPayloadEnvelopesByRoot`).
99
+ if (block !== null && attData.index === 1 && !chain.seenPayloadEnvelope(toRootHex(attData.beaconBlockRoot))) {
100
+ throw new AttestationError(GossipAction.IGNORE, {
101
+ code: AttestationErrorCode.EXECUTION_PAYLOAD_NOT_SEEN,
102
+ beaconBlockRoot: toRootHex(attData.beaconBlockRoot),
103
+ });
104
+ }
105
+
93
106
  // [REJECT] len(committee_indices) == 1, where committee_indices = get_committee_indices(aggregate)
94
107
  committeeIndex = (aggregate as electra.Attestation).committeeBits.getSingleTrueBit();
95
108
  if (committeeIndex === null) {
@@ -315,6 +315,19 @@ async function validateAttestationNoSignatureCheck(
315
315
  code: AttestationErrorCode.PREMATURELY_INDICATED_PAYLOAD_PRESENT,
316
316
  });
317
317
  }
318
+
319
+ // [REJECT] If `attestation.data.index == 1` (payload present for a past
320
+ // block), the execution payload for `block` passes validation.
321
+ // [IGNORE] When `attestation.data.index == 1` (payload present for a past block),
322
+ // the corresponding execution payload for `block` has been seen (a client MAY queue
323
+ // attestations for processing once the payload is retrieved and SHOULD request the
324
+ // payload envelope via `ExecutionPayloadEnvelopesByRoot`).
325
+ if (block !== null && attData.index === 1 && !chain.seenPayloadEnvelope(toRootHex(attData.beaconBlockRoot))) {
326
+ throw new AttestationError(GossipAction.IGNORE, {
327
+ code: AttestationErrorCode.EXECUTION_PAYLOAD_NOT_SEEN,
328
+ beaconBlockRoot: toRootHex(attData.beaconBlockRoot),
329
+ });
330
+ }
318
331
  } else {
319
332
  // [REJECT] attestation.data.index == 0
320
333
  if (attData.index !== 0) {
@@ -32,7 +32,7 @@ async function validateExecutionPayloadEnvelope(
32
32
  const {payload} = envelope;
33
33
  const blockRootHex = toRootHex(envelope.beaconBlockRoot);
34
34
 
35
- // [IGNORE] The envelope's block root `envelope.block_root` has been seen (via
35
+ // [IGNORE] The envelope's block root `envelope.beacon_block_root` has been seen (via
36
36
  // gossip or non-gossip sources) (a client MAY queue payload for processing once
37
37
  // the block is retrieved).
38
38
  // TODO GLOAS: Need to review this, we should queue the envelope for later