@lodestar/beacon-node 1.45.0-dev.51a1c44b27 → 1.45.0-dev.6568180f96

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 (282) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +186 -57
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/index.d.ts +1 -1
  5. package/lib/api/impl/beacon/index.d.ts.map +1 -1
  6. package/lib/api/impl/beacon/index.js.map +1 -1
  7. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  8. package/lib/api/impl/beacon/pool/index.js +6 -43
  9. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  10. package/lib/api/impl/beacon/state/index.d.ts +1 -1
  11. package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
  12. package/lib/api/impl/beacon/state/index.js +48 -5
  13. package/lib/api/impl/beacon/state/index.js.map +1 -1
  14. package/lib/api/impl/beacon/state/utils.d.ts +13 -3
  15. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  16. package/lib/api/impl/beacon/state/utils.js +48 -4
  17. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  18. package/lib/api/impl/debug/index.d.ts +1 -1
  19. package/lib/api/impl/debug/index.d.ts.map +1 -1
  20. package/lib/api/impl/debug/index.js +2 -2
  21. package/lib/api/impl/debug/index.js.map +1 -1
  22. package/lib/api/impl/lodestar/index.js +2 -2
  23. package/lib/api/impl/lodestar/index.js.map +1 -1
  24. package/lib/api/impl/proof/index.d.ts +1 -1
  25. package/lib/api/impl/proof/index.d.ts.map +1 -1
  26. package/lib/api/impl/proof/index.js +2 -2
  27. package/lib/api/impl/proof/index.js.map +1 -1
  28. package/lib/api/impl/utils.d.ts +23 -0
  29. package/lib/api/impl/utils.d.ts.map +1 -1
  30. package/lib/api/impl/utils.js +44 -1
  31. package/lib/api/impl/utils.js.map +1 -1
  32. package/lib/api/impl/validator/index.d.ts +0 -14
  33. package/lib/api/impl/validator/index.d.ts.map +1 -1
  34. package/lib/api/impl/validator/index.js +238 -149
  35. package/lib/api/impl/validator/index.js.map +1 -1
  36. package/lib/api/rest/base.d.ts.map +1 -1
  37. package/lib/api/rest/base.js +14 -3
  38. package/lib/api/rest/base.js.map +1 -1
  39. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  40. package/lib/chain/blocks/importBlock.js +4 -22
  41. package/lib/chain/blocks/importBlock.js.map +1 -1
  42. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts +5 -2
  43. package/lib/chain/blocks/payloadEnvelopeProcessor.d.ts.map +1 -1
  44. package/lib/chain/blocks/payloadEnvelopeProcessor.js +17 -17
  45. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  46. package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
  47. package/lib/chain/blocks/utils/chainSegment.js +13 -5
  48. package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
  49. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +1 -1
  50. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  51. package/lib/chain/blocks/verifyBlocksSanityChecks.js +1 -1
  52. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  53. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +2 -2
  54. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
  55. package/lib/chain/builderCircuitBreaker.d.ts +31 -0
  56. package/lib/chain/builderCircuitBreaker.d.ts.map +1 -0
  57. package/lib/chain/builderCircuitBreaker.js +59 -0
  58. package/lib/chain/builderCircuitBreaker.js.map +1 -0
  59. package/lib/chain/chain.d.ts +3 -2
  60. package/lib/chain/chain.d.ts.map +1 -1
  61. package/lib/chain/chain.js +27 -5
  62. package/lib/chain/chain.js.map +1 -1
  63. package/lib/chain/errors/blockError.d.ts +48 -6
  64. package/lib/chain/errors/blockError.d.ts.map +1 -1
  65. package/lib/chain/errors/blockError.js +25 -4
  66. package/lib/chain/errors/blockError.js.map +1 -1
  67. package/lib/chain/errors/executionPayloadEnvelope.d.ts +11 -0
  68. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  69. package/lib/chain/errors/executionPayloadEnvelope.js +2 -0
  70. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  71. package/lib/chain/errors/proposerPreferences.d.ts +14 -1
  72. package/lib/chain/errors/proposerPreferences.d.ts.map +1 -1
  73. package/lib/chain/errors/proposerPreferences.js +2 -0
  74. package/lib/chain/errors/proposerPreferences.js.map +1 -1
  75. package/lib/chain/interface.d.ts +3 -2
  76. package/lib/chain/interface.d.ts.map +1 -1
  77. package/lib/chain/interface.js.map +1 -1
  78. package/lib/chain/lightClient/index.d.ts.map +1 -1
  79. package/lib/chain/lightClient/index.js +11 -6
  80. package/lib/chain/lightClient/index.js.map +1 -1
  81. package/lib/chain/lightClient/proofs.d.ts.map +1 -1
  82. package/lib/chain/lightClient/proofs.js +28 -2
  83. package/lib/chain/lightClient/proofs.js.map +1 -1
  84. package/lib/chain/lightClient/types.d.ts +3 -1
  85. package/lib/chain/lightClient/types.d.ts.map +1 -1
  86. package/lib/chain/opPools/aggregatedAttestationPool.js +1 -1
  87. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  88. package/lib/chain/opPools/proposerPreferencesPool.d.ts +3 -2
  89. package/lib/chain/opPools/proposerPreferencesPool.d.ts.map +1 -1
  90. package/lib/chain/opPools/proposerPreferencesPool.js +4 -1
  91. package/lib/chain/opPools/proposerPreferencesPool.js.map +1 -1
  92. package/lib/chain/options.d.ts +5 -0
  93. package/lib/chain/options.d.ts.map +1 -1
  94. package/lib/chain/options.js +1 -0
  95. package/lib/chain/options.js.map +1 -1
  96. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  97. package/lib/chain/prepareNextSlot.js +12 -7
  98. package/lib/chain/prepareNextSlot.js.map +1 -1
  99. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  100. package/lib/chain/produceBlock/produceBlockBody.js +4 -12
  101. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  102. package/lib/chain/seenCache/index.d.ts +0 -1
  103. package/lib/chain/seenCache/index.d.ts.map +1 -1
  104. package/lib/chain/seenCache/index.js +0 -1
  105. package/lib/chain/seenCache/index.js.map +1 -1
  106. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  107. package/lib/chain/stateCache/persistentCheckpointsCache.js +3 -2
  108. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  109. package/lib/chain/validation/aggregateAndProof.js +10 -6
  110. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  111. package/lib/chain/validation/attestation.d.ts.map +1 -1
  112. package/lib/chain/validation/attestation.js +10 -6
  113. package/lib/chain/validation/attestation.js.map +1 -1
  114. package/lib/chain/validation/block.d.ts.map +1 -1
  115. package/lib/chain/validation/block.js +53 -4
  116. package/lib/chain/validation/block.js.map +1 -1
  117. package/lib/chain/validation/executionPayloadBid.js +13 -12
  118. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  119. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  120. package/lib/chain/validation/executionPayloadEnvelope.js +29 -0
  121. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  122. package/lib/chain/validation/proposerPreferences.d.ts +9 -2
  123. package/lib/chain/validation/proposerPreferences.d.ts.map +1 -1
  124. package/lib/chain/validation/proposerPreferences.js +75 -14
  125. package/lib/chain/validation/proposerPreferences.js.map +1 -1
  126. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts.map +1 -1
  127. package/lib/chain/validation/signatureSets/aggregateAndProof.js +2 -3
  128. package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
  129. package/lib/db/repositories/lightclientSyncCommitteeWitness.d.ts.map +1 -1
  130. package/lib/db/repositories/lightclientSyncCommitteeWitness.js +42 -7
  131. package/lib/db/repositories/lightclientSyncCommitteeWitness.js.map +1 -1
  132. package/lib/execution/builder/http.d.ts +18 -0
  133. package/lib/execution/builder/http.d.ts.map +1 -1
  134. package/lib/execution/builder/http.js +20 -11
  135. package/lib/execution/builder/http.js.map +1 -1
  136. package/lib/metrics/metrics/beacon.d.ts +6 -0
  137. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  138. package/lib/metrics/metrics/beacon.js +18 -0
  139. package/lib/metrics/metrics/beacon.js.map +1 -1
  140. package/lib/network/core/metrics.d.ts +65 -0
  141. package/lib/network/core/metrics.d.ts.map +1 -1
  142. package/lib/network/core/metrics.js +94 -0
  143. package/lib/network/core/metrics.js.map +1 -1
  144. package/lib/network/discv5/utils.d.ts.map +1 -1
  145. package/lib/network/discv5/utils.js +12 -3
  146. package/lib/network/discv5/utils.js.map +1 -1
  147. package/lib/network/gossip/encoding.d.ts +2 -2
  148. package/lib/network/gossip/encoding.d.ts.map +1 -1
  149. package/lib/network/gossip/encoding.js +22 -9
  150. package/lib/network/gossip/encoding.js.map +1 -1
  151. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  152. package/lib/network/gossip/gossipsub.js +4 -3
  153. package/lib/network/gossip/gossipsub.js.map +1 -1
  154. package/lib/network/gossip/topic.d.ts +831 -226
  155. package/lib/network/gossip/topic.d.ts.map +1 -1
  156. package/lib/network/gossip/topic.js +47 -4
  157. package/lib/network/gossip/topic.js.map +1 -1
  158. package/lib/network/interface.d.ts +4 -1
  159. package/lib/network/interface.d.ts.map +1 -1
  160. package/lib/network/network.d.ts +4 -1
  161. package/lib/network/network.d.ts.map +1 -1
  162. package/lib/network/network.js +19 -11
  163. package/lib/network/network.js.map +1 -1
  164. package/lib/network/peers/peerManager.d.ts.map +1 -1
  165. package/lib/network/peers/peerManager.js +10 -0
  166. package/lib/network/peers/peerManager.js.map +1 -1
  167. package/lib/network/peers/score/score.d.ts +3 -1
  168. package/lib/network/peers/score/score.d.ts.map +1 -1
  169. package/lib/network/peers/score/score.js +6 -1
  170. package/lib/network/peers/score/score.js.map +1 -1
  171. package/lib/network/peers/score/store.d.ts.map +1 -1
  172. package/lib/network/peers/score/store.js +6 -1
  173. package/lib/network/peers/score/store.js.map +1 -1
  174. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  175. package/lib/network/peers/utils/prioritizePeers.js +14 -0
  176. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  177. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  178. package/lib/network/processor/gossipHandlers.js +18 -9
  179. package/lib/network/processor/gossipHandlers.js.map +1 -1
  180. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
  181. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +4 -2
  182. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
  183. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  184. package/lib/network/reqresp/handlers/index.js +20 -11
  185. package/lib/network/reqresp/handlers/index.js.map +1 -1
  186. package/lib/network/util.d.ts +1 -0
  187. package/lib/network/util.d.ts.map +1 -1
  188. package/lib/network/util.js +4 -0
  189. package/lib/network/util.js.map +1 -1
  190. package/lib/sync/range/chain.d.ts +4 -1
  191. package/lib/sync/range/chain.d.ts.map +1 -1
  192. package/lib/sync/range/chain.js +3 -3
  193. package/lib/sync/range/chain.js.map +1 -1
  194. package/lib/sync/range/range.d.ts.map +1 -1
  195. package/lib/sync/range/range.js +10 -0
  196. package/lib/sync/range/range.js.map +1 -1
  197. package/lib/sync/sync.d.ts.map +1 -1
  198. package/lib/sync/sync.js +7 -0
  199. package/lib/sync/sync.js.map +1 -1
  200. package/lib/sync/unknownBlock.d.ts.map +1 -1
  201. package/lib/sync/unknownBlock.js +7 -2
  202. package/lib/sync/unknownBlock.js.map +1 -1
  203. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  204. package/lib/sync/utils/downloadByRange.js +6 -0
  205. package/lib/sync/utils/downloadByRange.js.map +1 -1
  206. package/lib/util/execution.js +1 -1
  207. package/lib/util/execution.js.map +1 -1
  208. package/lib/util/graffiti.d.ts +15 -0
  209. package/lib/util/graffiti.d.ts.map +1 -1
  210. package/lib/util/graffiti.js +55 -0
  211. package/lib/util/graffiti.js.map +1 -1
  212. package/package.json +23 -21
  213. package/src/api/impl/beacon/blocks/index.ts +221 -63
  214. package/src/api/impl/beacon/index.ts +1 -1
  215. package/src/api/impl/beacon/pool/index.ts +5 -53
  216. package/src/api/impl/beacon/state/index.ts +55 -3
  217. package/src/api/impl/beacon/state/utils.ts +68 -4
  218. package/src/api/impl/debug/index.ts +3 -2
  219. package/src/api/impl/lodestar/index.ts +2 -2
  220. package/src/api/impl/proof/index.ts +2 -2
  221. package/src/api/impl/utils.ts +51 -1
  222. package/src/api/impl/validator/index.ts +278 -162
  223. package/src/api/rest/base.ts +17 -3
  224. package/src/chain/blocks/importBlock.ts +2 -24
  225. package/src/chain/blocks/payloadEnvelopeProcessor.ts +17 -17
  226. package/src/chain/blocks/utils/chainSegment.ts +16 -5
  227. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +1 -1
  228. package/src/chain/blocks/verifyBlocksSanityChecks.ts +1 -1
  229. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +2 -2
  230. package/src/chain/builderCircuitBreaker.ts +84 -0
  231. package/src/chain/chain.ts +38 -5
  232. package/src/chain/errors/blockError.ts +44 -7
  233. package/src/chain/errors/executionPayloadEnvelope.ts +9 -0
  234. package/src/chain/errors/proposerPreferences.ts +16 -1
  235. package/src/chain/interface.ts +2 -2
  236. package/src/chain/lightClient/index.ts +12 -7
  237. package/src/chain/lightClient/proofs.ts +36 -1
  238. package/src/chain/lightClient/types.ts +3 -1
  239. package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
  240. package/src/chain/opPools/proposerPreferencesPool.ts +6 -2
  241. package/src/chain/options.ts +6 -0
  242. package/src/chain/prepareNextSlot.ts +11 -7
  243. package/src/chain/produceBlock/produceBlockBody.ts +9 -17
  244. package/src/chain/seenCache/index.ts +0 -1
  245. package/src/chain/stateCache/persistentCheckpointsCache.ts +3 -2
  246. package/src/chain/validation/aggregateAndProof.ts +12 -6
  247. package/src/chain/validation/attestation.ts +12 -6
  248. package/src/chain/validation/block.ts +69 -4
  249. package/src/chain/validation/executionPayloadBid.ts +16 -11
  250. package/src/chain/validation/executionPayloadEnvelope.ts +37 -0
  251. package/src/chain/validation/proposerPreferences.ts +86 -14
  252. package/src/chain/validation/signatureSets/aggregateAndProof.ts +3 -3
  253. package/src/db/repositories/lightclientSyncCommitteeWitness.ts +57 -9
  254. package/src/execution/builder/http.ts +30 -17
  255. package/src/metrics/metrics/beacon.ts +19 -0
  256. package/src/network/core/metrics.ts +94 -0
  257. package/src/network/discv5/utils.ts +11 -3
  258. package/src/network/gossip/encoding.ts +20 -7
  259. package/src/network/gossip/gossipsub.ts +9 -3
  260. package/src/network/gossip/topic.ts +58 -4
  261. package/src/network/interface.ts +3 -1
  262. package/src/network/network.ts +24 -15
  263. package/src/network/peers/peerManager.ts +11 -0
  264. package/src/network/peers/score/score.ts +8 -1
  265. package/src/network/peers/score/store.ts +8 -1
  266. package/src/network/peers/utils/prioritizePeers.ts +15 -0
  267. package/src/network/processor/gossipHandlers.ts +18 -8
  268. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +4 -2
  269. package/src/network/reqresp/handlers/index.ts +21 -12
  270. package/src/network/util.ts +5 -0
  271. package/src/sync/range/chain.ts +4 -5
  272. package/src/sync/range/range.ts +10 -0
  273. package/src/sync/sync.ts +10 -0
  274. package/src/sync/unknownBlock.ts +8 -2
  275. package/src/sync/utils/downloadByRange.ts +6 -0
  276. package/src/util/execution.ts +1 -1
  277. package/src/util/graffiti.ts +78 -0
  278. package/lib/chain/seenCache/seenProposerPreferences.d.ts +0 -16
  279. package/lib/chain/seenCache/seenProposerPreferences.d.ts.map +0 -1
  280. package/lib/chain/seenCache/seenProposerPreferences.js +0 -26
  281. package/lib/chain/seenCache/seenProposerPreferences.js.map +0 -1
  282. package/src/chain/seenCache/seenProposerPreferences.ts +0 -32
@@ -10,9 +10,8 @@ import {
10
10
  MIN_SYNC_COMMITTEE_PARTICIPANTS,
11
11
  SLOTS_PER_EPOCH,
12
12
  SYNC_COMMITTEE_SIZE,
13
- forkPostAltair,
14
- highestFork,
15
13
  isForkPostElectra,
14
+ isForkPostGloas,
16
15
  } from "@lodestar/params";
17
16
  import {
18
17
  type IBeaconStateViewAltair,
@@ -44,7 +43,6 @@ import {
44
43
  electra,
45
44
  phase0,
46
45
  ssz,
47
- sszTypesFor,
48
46
  } from "@lodestar/types";
49
47
  import {Logger, MapDef, byteArrayEquals, pruneSetToMax, toRootHex} from "@lodestar/utils";
50
48
  import {ZERO_HASH} from "../../constants/index.js";
@@ -230,8 +228,8 @@ export class LightClientServer {
230
228
  this.signal = signal;
231
229
 
232
230
  this.zero = {
233
- // Assign the hightest fork's default value because it can always be typecasted down to correct fork
234
- finalizedHeader: sszTypesFor(highestFork(forkPostAltair)).LightClientHeader.defaultValue(),
231
+ // Assign the highest pre-Gloas light-client header because post-Gloas light-client updates are skipped for now.
232
+ finalizedHeader: ssz.electra.LightClientHeader.defaultValue(),
235
233
  // Electra finalityBranch has fixed length of 5 whereas altair has 4. The fifth element will be ignored
236
234
  // when serializing as altair LightClientUpdate
237
235
  finalityBranch: ssz.electra.LightClientUpdate.fields.finalityBranch.defaultValue(),
@@ -658,10 +656,17 @@ export class LightClientServer {
658
656
 
659
657
  const attestedFork = this.config.getForkName(attestedHeader.beacon.slot);
660
658
  const numWitness = syncCommitteeWitness.witness.length;
661
- if (isForkPostElectra(attestedFork) && numWitness !== NUM_WITNESS_ELECTRA) {
659
+ if (
660
+ isForkPostGloas(attestedFork) &&
661
+ (syncCommitteeWitness.currentSyncCommitteeBranch === undefined ||
662
+ syncCommitteeWitness.nextSyncCommitteeBranch === undefined)
663
+ ) {
664
+ throw Error("Expected post-Gloas sync committee branches");
665
+ }
666
+ if (!isForkPostGloas(attestedFork) && isForkPostElectra(attestedFork) && numWitness !== NUM_WITNESS_ELECTRA) {
662
667
  throw Error(`Expected ${NUM_WITNESS_ELECTRA} witnesses in post-Electra numWitness=${numWitness}`);
663
668
  }
664
- if (!isForkPostElectra(attestedFork) && numWitness !== NUM_WITNESS) {
669
+ if (!isForkPostGloas(attestedFork) && !isForkPostElectra(attestedFork) && numWitness !== NUM_WITNESS) {
665
670
  throw Error(`Expected ${NUM_WITNESS} witnesses in pre-Electra numWitness=${numWitness}`);
666
671
  }
667
672
 
@@ -1,11 +1,15 @@
1
1
  import {Tree} from "@chainsafe/persistent-merkle-tree";
2
2
  import {
3
3
  BLOCK_BODY_EXECUTION_PAYLOAD_GINDEX,
4
+ CURRENT_SYNC_COMMITTEE_GINDEX_GLOAS,
4
5
  FINALIZED_ROOT_GINDEX,
5
6
  FINALIZED_ROOT_GINDEX_ELECTRA,
7
+ FINALIZED_ROOT_GINDEX_GLOAS,
6
8
  ForkName,
7
9
  ForkPostBellatrix,
10
+ NEXT_SYNC_COMMITTEE_GINDEX_GLOAS,
8
11
  isForkPostElectra,
12
+ isForkPostGloas,
9
13
  } from "@lodestar/params";
10
14
  import {BeaconStateAllForks, CachedBeaconStateAllForks} from "@lodestar/state-transition";
11
15
  import {BeaconBlockBody, SSZTypesFor, ssz} from "@lodestar/types";
@@ -17,6 +21,24 @@ export function getSyncCommitteesWitness(fork: ForkName, state: BeaconStateAllFo
17
21
  let currentSyncCommitteeRoot: Uint8Array;
18
22
  let nextSyncCommitteeRoot: Uint8Array;
19
23
 
24
+ if (isForkPostGloas(fork)) {
25
+ const tree = new Tree(state.node);
26
+ const currentSyncCommitteeGindex = BigInt(CURRENT_SYNC_COMMITTEE_GINDEX_GLOAS);
27
+ const nextSyncCommitteeGindex = BigInt(NEXT_SYNC_COMMITTEE_GINDEX_GLOAS);
28
+
29
+ currentSyncCommitteeRoot = tree.getRoot(currentSyncCommitteeGindex);
30
+ nextSyncCommitteeRoot = tree.getRoot(nextSyncCommitteeGindex);
31
+ witness = [];
32
+
33
+ return {
34
+ witness,
35
+ currentSyncCommitteeRoot,
36
+ nextSyncCommitteeRoot,
37
+ currentSyncCommitteeBranch: tree.getSingleProof(currentSyncCommitteeGindex),
38
+ nextSyncCommitteeBranch: tree.getSingleProof(nextSyncCommitteeGindex),
39
+ };
40
+ }
41
+
20
42
  if (isForkPostElectra(fork)) {
21
43
  const n2 = n1.left;
22
44
  const n5 = n2.right;
@@ -60,17 +82,30 @@ export function getSyncCommitteesWitness(fork: ForkName, state: BeaconStateAllFo
60
82
  }
61
83
 
62
84
  export function getNextSyncCommitteeBranch(syncCommitteesWitness: SyncCommitteeWitness): Uint8Array[] {
85
+ if (syncCommitteesWitness.nextSyncCommitteeBranch) {
86
+ return syncCommitteesWitness.nextSyncCommitteeBranch;
87
+ }
88
+
63
89
  // Witness branch is sorted by descending gindex
64
90
  return [syncCommitteesWitness.currentSyncCommitteeRoot, ...syncCommitteesWitness.witness];
65
91
  }
66
92
 
67
93
  export function getCurrentSyncCommitteeBranch(syncCommitteesWitness: SyncCommitteeWitness): Uint8Array[] {
94
+ if (syncCommitteesWitness.currentSyncCommitteeBranch) {
95
+ return syncCommitteesWitness.currentSyncCommitteeBranch;
96
+ }
97
+
68
98
  // Witness branch is sorted by descending gindex
69
99
  return [syncCommitteesWitness.nextSyncCommitteeRoot, ...syncCommitteesWitness.witness];
70
100
  }
71
101
 
72
102
  export function getFinalizedRootProof(state: CachedBeaconStateAllForks): Uint8Array[] {
73
- const finalizedRootGindex = state.epochCtx.isPostElectra() ? FINALIZED_ROOT_GINDEX_ELECTRA : FINALIZED_ROOT_GINDEX;
103
+ const fork = state.config.getForkName(state.slot);
104
+ const finalizedRootGindex = isForkPostGloas(fork)
105
+ ? FINALIZED_ROOT_GINDEX_GLOAS
106
+ : state.epochCtx.isPostElectra()
107
+ ? FINALIZED_ROOT_GINDEX_ELECTRA
108
+ : FINALIZED_ROOT_GINDEX;
74
109
  return new Tree(state.node).getSingleProof(BigInt(finalizedRootGindex));
75
110
  }
76
111
 
@@ -26,8 +26,10 @@
26
26
  * ```
27
27
  */
28
28
  export type SyncCommitteeWitness = {
29
- /** Vector[Bytes32, 4] or Vector[Bytes32, 5] depending on the fork */
29
+ /** Shared witness for pre-Gloas forks where current and next sync committees are siblings. */
30
30
  witness: Uint8Array[];
31
31
  currentSyncCommitteeRoot: Uint8Array;
32
32
  nextSyncCommitteeRoot: Uint8Array;
33
+ currentSyncCommitteeBranch?: Uint8Array[];
34
+ nextSyncCommitteeBranch?: Uint8Array[];
33
35
  };
@@ -355,7 +355,7 @@ export class AggregatedAttestationPool {
355
355
  // after all committees are processed, we have a list of sameAttDataCons
356
356
  for (const consolidation of sameAttDataCons) {
357
357
  // Score attestations by profitability to maximize proposer reward
358
- const flags = getAttestationParticipationStatus(
358
+ const {flags} = getAttestationParticipationStatus(
359
359
  ForkSeq[fork],
360
360
  consolidation.attData,
361
361
  inclusionDistance,
@@ -1,4 +1,4 @@
1
- import {RootHex, Slot, gloas} from "@lodestar/types";
1
+ import {RootHex, Slot, ValidatorIndex, gloas} from "@lodestar/types";
2
2
  import {toRootHex} from "@lodestar/utils";
3
3
 
4
4
  /**
@@ -17,11 +17,15 @@ import {toRootHex} from "@lodestar/utils";
17
17
  export class ProposerPreferencesPool {
18
18
  private readonly bySlot = new Map<Slot, Map<RootHex, gloas.SignedProposerPreferences>>();
19
19
 
20
- /** Lookup for bid validation: matches `(bid.slot, get_proposer_dependent_root(parent_state, ...))`. */
20
+ /** Lookup for bid validation: matches `(bid.slot, get_shuffling_dependent_root(store, bid.parent_block_root, epoch))`. */
21
21
  get(slot: Slot, dependentRootHex: RootHex): gloas.SignedProposerPreferences | null {
22
22
  return this.bySlot.get(slot)?.get(dependentRootHex) ?? null;
23
23
  }
24
24
 
25
+ isKnown(proposalSlot: Slot, dependentRoot: RootHex, validatorIndex: ValidatorIndex): boolean {
26
+ return this.get(proposalSlot, dependentRoot)?.message.validatorIndex === validatorIndex;
27
+ }
28
+
25
29
  add(signed: gloas.SignedProposerPreferences): void {
26
30
  const {proposalSlot, dependentRoot} = signed.message;
27
31
  const rootHex = toRootHex(dependentRoot);
@@ -35,6 +35,7 @@ export type IChainOptions = BlockProcessOpts &
35
35
  persistOrphanedBlocksDir?: string;
36
36
  skipCreateStateCacheIfAvailable?: boolean;
37
37
  suggestedFeeRecipient: string;
38
+ graffitiAppend?: boolean;
38
39
  maxSkipSlots?: number;
39
40
  /** Ensure blobs returned by the execution engine are valid */
40
41
  sanityCheckExecutionEngineBlobs?: boolean;
@@ -48,6 +49,10 @@ export type IChainOptions = BlockProcessOpts &
48
49
  archiveDateEpochs?: number;
49
50
  nHistoricalStatesFileDataStore?: boolean;
50
51
  nativeStateView?: boolean;
52
+ /** Builder circuit breaker fault inspection window in slots */
53
+ faultInspectionWindow?: number;
54
+ /** Allowed unrevealed payloads within the fault inspection window */
55
+ allowedFaults?: number;
51
56
  };
52
57
 
53
58
  export type BlockProcessOpts = {
@@ -107,6 +112,7 @@ export const defaultChainOptions: IChainOptions = {
107
112
  computeUnrealized: true,
108
113
  fastConfirmation: false,
109
114
  suggestedFeeRecipient: defaultValidatorOptions.suggestedFeeRecipient,
115
+ graffitiAppend: true,
110
116
  serveHistoricalState: false,
111
117
  assertCorrectProgressiveBalances: false,
112
118
  archiveStateEpochFrequency: 1024,
@@ -1,7 +1,7 @@
1
1
  import {routes} from "@lodestar/api";
2
2
  import {ChainForkConfig} from "@lodestar/config";
3
3
  import {getSafeExecutionBlockHash} from "@lodestar/fork-choice";
4
- import {ForkPostBellatrix, ForkSeq, SLOTS_PER_EPOCH, isForkPostBellatrix} from "@lodestar/params";
4
+ import {ForkPostBellatrix, ForkSeq, SLOTS_PER_EPOCH, isForkPostBellatrix, isForkPostGloas} from "@lodestar/params";
5
5
  import {
6
6
  IBeaconStateView,
7
7
  IBeaconStateViewBellatrix,
@@ -152,12 +152,16 @@ export class PrepareNextSlotScheduler {
152
152
  updatedHead = proposerHead;
153
153
  }
154
154
 
155
- // Update the builder status, if enabled shoot an api call to check status
156
- this.chain.updateBuilderStatus(clockSlot);
157
- if (this.chain.executionBuilder?.status === BuilderStatus.enabled) {
158
- this.chain.executionBuilder.checkStatus().catch((e) => {
159
- this.logger.error("Builder disabled as the check status api failed", {prepareSlot}, e as Error);
160
- });
155
+ if (isForkPostGloas(fork)) {
156
+ this.chain.builderCircuitBreaker.update(clockSlot);
157
+ } else {
158
+ // Update the builder status, if enabled shoot an api call to check status
159
+ this.chain.updateBuilderStatus(clockSlot);
160
+ if (this.chain.executionBuilder?.status === BuilderStatus.enabled) {
161
+ this.chain.executionBuilder.checkStatus().catch((e) => {
162
+ this.logger.error("Builder disabled as the check status api failed", {prepareSlot}, e as Error);
163
+ });
164
+ }
161
165
  }
162
166
  }
163
167
 
@@ -43,6 +43,7 @@ import {
43
43
  ValidatorIndex,
44
44
  Wei,
45
45
  altair,
46
+ bellatrix,
46
47
  capella,
47
48
  deneb,
48
49
  electra,
@@ -830,28 +831,19 @@ export function getPayloadAttributesForSSE(
830
831
  feeRecipient,
831
832
  });
832
833
 
833
- let parentBlockNumber: number;
834
- if (isForkPostGloas(fork)) {
835
- const parentBlock = chain.forkChoice.getBlockHexAndBlockHash(
836
- toRootHex(parentBlockRoot),
837
- toRootHex(parentBlockHash)
838
- );
839
- if (parentBlock?.executionPayloadBlockHash == null) {
840
- throw Error(`Parent block not found in fork choice root=${toRootHex(parentBlockRoot)}`);
841
- }
842
- parentBlockNumber = parentBlock.executionPayloadNumber;
843
- } else {
844
- parentBlockNumber = prepareState.payloadBlockNumber;
845
- }
846
-
847
- const ssePayloadAttributes: SSEPayloadAttributes = {
834
+ const ssePayloadAttributes = {
848
835
  proposerIndex: prepareState.getBeaconProposer(prepareSlot),
849
836
  proposalSlot: prepareSlot,
850
- parentBlockNumber,
851
837
  parentBlockRoot,
852
838
  parentBlockHash,
853
839
  payloadAttributes,
854
- };
840
+ } as SSEPayloadAttributes;
841
+
842
+ if (!isForkPostGloas(fork)) {
843
+ // Removed in Gloas, builders can get the block number from the EL via the block hash if required
844
+ (ssePayloadAttributes as bellatrix.SSEPayloadAttributes).parentBlockNumber = prepareState.payloadBlockNumber;
845
+ }
846
+
855
847
  return ssePayloadAttributes;
856
848
  }
857
849
 
@@ -5,4 +5,3 @@ export {SeenContributionAndProof} from "./seenCommitteeContribution.js";
5
5
  export {SeenExecutionPayloadBids} from "./seenExecutionPayloadBids.js";
6
6
  export {SeenBlockInput} from "./seenGossipBlockInput.js";
7
7
  export {PayloadEnvelopeInput, SeenPayloadEnvelopeInput} from "./seenPayloadEnvelopeInput.js";
8
- export {SeenProposerPreferences} from "./seenProposerPreferences.js";
@@ -331,8 +331,9 @@ export class PersistentCheckpointStateCache implements CheckpointStateCache {
331
331
  const key = toCacheKey(cpHex);
332
332
  const cacheItem = this.cache.get(key);
333
333
  this.metrics?.cpStateCache.adds.inc();
334
- if (cacheItem !== undefined && isPersistedCacheItem(cacheItem)) {
335
- const persistedKey = cacheItem.value;
334
+ // keep an existing persistedKey (persisted or reloaded-in-memory); dropping it orphans the on-disk file
335
+ const persistedKey = cacheItem && (isPersistedCacheItem(cacheItem) ? cacheItem.value : cacheItem.persistedKey);
336
+ if (persistedKey !== undefined) {
336
337
  // was persisted to disk, set back to memory
337
338
  this.cache.set(key, {type: CacheItemType.inMemory, state, persistedKey});
338
339
  this.logger.verbose("Added checkpoint state to memory but a persisted key existed", {
@@ -90,13 +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.
93
+ // [REJECT] If `aggregate.data.index == 1` (payload present for a past block)
94
+ // the corresponding execution payload for `block` passes validation.
95
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))) {
96
+ // the corresponding execution payload for `block` has been fully imported, including its
97
+ // data -- i.e. `is_payload_verified(store, aggregate.data.beacon_block_root)` returns `True`
98
+ // (a client MAY queue attestations for processing until the payload is imported and SHOULD
99
+ // request the payload envelope via `ExecutionPayloadEnvelopesByRoot` using
100
+ // `aggregate.data.beacon_block_root`).
101
+ if (
102
+ block !== null &&
103
+ attData.index === 1 &&
104
+ !chain.forkChoice.hasPayloadHexUnsafe(toRootHex(attData.beaconBlockRoot))
105
+ ) {
100
106
  throw new AttestationError(GossipAction.IGNORE, {
101
107
  code: AttestationErrorCode.EXECUTION_PAYLOAD_NOT_SEEN,
102
108
  beaconBlockRoot: toRootHex(attData.beaconBlockRoot),
@@ -316,13 +316,19 @@ async function validateAttestationNoSignatureCheck(
316
316
  });
317
317
  }
318
318
 
319
- // [REJECT] If `attestation.data.index == 1` (payload present for a past
320
- // block), the execution payload for `block` passes validation.
319
+ // [REJECT] If `attestation.data.index == 1` (payload present for a past block),
320
+ // the execution payload for `block` passes validation.
321
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))) {
322
+ // the execution payload for `block` has been fully imported, including its data -- i.e.
323
+ // `is_payload_verified(store, attestation.data.beacon_block_root)` returns `True`
324
+ // (a client MAY queue attestations for processing until the payload is imported and
325
+ // SHOULD request the payload envelope via `ExecutionPayloadEnvelopesByRoot` using
326
+ // `attestation.data.beacon_block_root`).
327
+ if (
328
+ block !== null &&
329
+ attData.index === 1 &&
330
+ !chain.forkChoice.hasPayloadHexUnsafe(toRootHex(attData.beaconBlockRoot))
331
+ ) {
326
332
  throw new AttestationError(GossipAction.IGNORE, {
327
333
  code: AttestationErrorCode.EXECUTION_PAYLOAD_NOT_SEEN,
328
334
  beaconBlockRoot: toRootHex(attData.beaconBlockRoot),
@@ -1,6 +1,21 @@
1
1
  import {ChainForkConfig} from "@lodestar/config";
2
2
  import {ExecutionStatus} from "@lodestar/fork-choice";
3
- import {ForkName, isForkPostBellatrix, isForkPostDeneb, isForkPostGloas} from "@lodestar/params";
3
+ import {
4
+ ForkName,
5
+ MAX_ATTESTATIONS_ELECTRA,
6
+ MAX_ATTESTER_SLASHINGS_ELECTRA,
7
+ MAX_BLS_TO_EXECUTION_CHANGES,
8
+ MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD,
9
+ MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD,
10
+ MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
11
+ MAX_PAYLOAD_ATTESTATIONS,
12
+ MAX_PROPOSER_SLASHINGS,
13
+ MAX_VOLUNTARY_EXITS,
14
+ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
15
+ isForkPostBellatrix,
16
+ isForkPostDeneb,
17
+ isForkPostGloas,
18
+ } from "@lodestar/params";
4
19
  import {
5
20
  computeEpochAtSlot,
6
21
  computeStartSlotAtEpoch,
@@ -88,8 +103,8 @@ export async function validateGossipBlock(
88
103
  // 2. The parent is unknown to us, we probably want to download it since it might actually
89
104
  // descend from the finalized root.
90
105
  // (Non-Lighthouse): Since we prune all blocks non-descendant from finalized checking the `db.block` database won't be useful to guard
91
- // against known bad fork blocks, so we throw PARENT_UNKNOWN for cases (1) and (2)
92
- throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.PARENT_UNKNOWN, parentRoot});
106
+ // against known bad fork blocks, so we throw PARENT_BLOCK_UNKNOWN for cases (1) and (2)
107
+ throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.PARENT_BLOCK_UNKNOWN, parentRoot});
93
108
  }
94
109
 
95
110
  // [IGNORE] The block's parent (defined by `block.parent_root`) passes all validation
@@ -164,6 +179,56 @@ export async function validateGossipBlock(
164
179
  });
165
180
  }
166
181
 
182
+ // [REJECT] The counts of `block.body.parent_execution_requests` are within
183
+ // their respective limits -- i.e. validate that
184
+ // `len(block.body.parent_execution_requests.withdrawals) <= MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD`,
185
+ // `len(block.body.parent_execution_requests.consolidations) <= MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD`,
186
+ // `len(block.body.parent_execution_requests.builder_deposits) <= MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD`,
187
+ // and
188
+ // `len(block.body.parent_execution_requests.builder_exits) <= MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD`.
189
+ // [REJECT] The counts of the block body operations are within their respective
190
+ // limits -- i.e. validate that
191
+ // `len(block.body.proposer_slashings) <= MAX_PROPOSER_SLASHINGS`,
192
+ // `len(block.body.attester_slashings) <= MAX_ATTESTER_SLASHINGS_ELECTRA`,
193
+ // `len(block.body.attestations) <= MAX_ATTESTATIONS_ELECTRA`,
194
+ // `len(block.body.deposits) == 0`,
195
+ // `len(block.body.voluntary_exits) <= MAX_VOLUNTARY_EXITS`,
196
+ // `len(block.body.bls_to_execution_changes) <= MAX_BLS_TO_EXECUTION_CHANGES`,
197
+ // and `len(block.body.payload_attestations) <= MAX_PAYLOAD_ATTESTATIONS`.
198
+ const body = (block as gloas.BeaconBlock).body;
199
+ const requests = body.parentExecutionRequests;
200
+ const countLimits: [string, number, number][] = [
201
+ ["parentExecutionRequests.withdrawals", requests.withdrawals.length, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD],
202
+ [
203
+ "parentExecutionRequests.consolidations",
204
+ requests.consolidations.length,
205
+ MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
206
+ ],
207
+ [
208
+ "parentExecutionRequests.builderDeposits",
209
+ requests.builderDeposits.length,
210
+ MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD,
211
+ ],
212
+ ["parentExecutionRequests.builderExits", requests.builderExits.length, MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD],
213
+ ["proposerSlashings", body.proposerSlashings.length, MAX_PROPOSER_SLASHINGS],
214
+ ["attesterSlashings", body.attesterSlashings.length, MAX_ATTESTER_SLASHINGS_ELECTRA],
215
+ ["attestations", body.attestations.length, MAX_ATTESTATIONS_ELECTRA],
216
+ ["deposits", body.deposits.length, 0],
217
+ ["voluntaryExits", body.voluntaryExits.length, MAX_VOLUNTARY_EXITS],
218
+ ["blsToExecutionChanges", body.blsToExecutionChanges.length, MAX_BLS_TO_EXECUTION_CHANGES],
219
+ ["payloadAttestations", body.payloadAttestations.length, MAX_PAYLOAD_ATTESTATIONS],
220
+ ];
221
+ for (const [name, count, limit] of countLimits) {
222
+ if (count > limit) {
223
+ throw new BlockGossipError(GossipAction.REJECT, {
224
+ code: BlockErrorCode.TOO_MANY_BLOCK_OPERATIONS,
225
+ name,
226
+ count,
227
+ limit,
228
+ });
229
+ }
230
+ }
231
+
167
232
  // TODO GLOAS: [REJECT] The block's execution payload parent (defined by bid.parent_block_hash) passes all validation
168
233
  // This requires execution engine integration to verify the parent block hash
169
234
  }
@@ -176,7 +241,7 @@ export async function validateGossipBlock(
176
241
  const blockState = await chain.regen
177
242
  .getPreState(block, {dontTransferCache: true}, RegenCaller.validateGossipBlock)
178
243
  .catch(() => {
179
- throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.PARENT_UNKNOWN, parentRoot});
244
+ throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.PARENT_BLOCK_UNKNOWN, parentRoot});
180
245
  });
181
246
 
182
247
  // in forky condition, make sure to populate ShufflingCache with regened state
@@ -37,9 +37,11 @@ async function validateExecutionPayloadBid(
37
37
  const parentBlockRootHex = toRootHex(bid.parentBlockRoot);
38
38
  const parentBlockHashHex = toRootHex(bid.parentBlockHash);
39
39
 
40
- // [IGNORE] `bid.slot` is the current slot or the next slot.
41
- const currentSlot = chain.clock.currentSlot;
42
- if (bid.slot !== currentSlot && bid.slot !== currentSlot + 1) {
40
+ // [IGNORE] `bid.slot` is the current slot, or the next slot (`bid.slot - 1` is current), allowing for `MAXIMUM_GOSSIP_CLOCK_DISPARITY`.
41
+ if (
42
+ !chain.clock.isCurrentSlotGivenGossipDisparity(bid.slot) &&
43
+ !chain.clock.isCurrentSlotGivenGossipDisparity(bid.slot - 1)
44
+ ) {
43
45
  throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
44
46
  code: ExecutionPayloadBidErrorCode.INVALID_SLOT,
45
47
  builderIndex: bid.builderIndex,
@@ -122,17 +124,20 @@ async function validateExecutionPayloadBid(
122
124
  throw new Error(`Expected gloas+ state for execution payload bid validation, got fork=${state.forkName}`);
123
125
  }
124
126
 
125
- // [REJECT] `bid.builder_index` is a valid/active builder index -- i.e.
126
- // `is_active_builder(state, bid.builder_index)` returns `True`.
127
- let builder: gloas.Builder;
128
- try {
129
- builder = state.getBuilder(bid.builderIndex);
130
- } catch {
127
+ // [REJECT] `bid.builder_index` is within bounds -- i.e. `bid.builder_index < len(state.builders)`.
128
+ // `state.getBuilder` returns a lazy SSZ `getReadonly` view that is not bounds-checked eagerly; an
129
+ // out-of-range index only throws (`LeafNode has no right node`) on deferred field access (e.g. inside
130
+ // `isActiveBuilder`), escaping a try/catch around `getBuilder`. Check the length explicitly instead.
131
+ if (bid.builderIndex >= state.getBuildersLength()) {
131
132
  throw new ExecutionPayloadBidError(GossipAction.REJECT, {
132
133
  code: ExecutionPayloadBidErrorCode.BUILDER_NOT_ELIGIBLE,
133
134
  builderIndex: bid.builderIndex,
134
135
  });
135
136
  }
137
+
138
+ // [REJECT] `bid.builder_index` is a valid/active builder index -- i.e.
139
+ // `is_active_builder(state, bid.builder_index)` returns `True`.
140
+ const builder = state.getBuilder(bid.builderIndex);
136
141
  if (!isActiveBuilder(builder, state.finalizedCheckpoint.epoch)) {
137
142
  throw new ExecutionPayloadBidError(GossipAction.REJECT, {
138
143
  code: ExecutionPayloadBidErrorCode.BUILDER_NOT_ELIGIBLE,
@@ -160,9 +165,9 @@ async function validateExecutionPayloadBid(
160
165
  });
161
166
  }
162
167
 
163
- // [REJECT] `bid.fee_recipient == proposer_preferences.fee_recipient`.
168
+ // [IGNORE] `bid.fee_recipient == proposer_preferences.fee_recipient`.
164
169
  if (!byteArrayEquals(bid.feeRecipient, proposerPreferences.message.feeRecipient)) {
165
- throw new ExecutionPayloadBidError(GossipAction.REJECT, {
170
+ throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
166
171
  code: ExecutionPayloadBidErrorCode.PROPOSER_PREFERENCES_FEE_RECIPIENT_MISMATCH,
167
172
  builderIndex: bid.builderIndex,
168
173
  bidFeeRecipient: toHex(bid.feeRecipient),
@@ -1,4 +1,11 @@
1
1
  import {PayloadStatus} from "@lodestar/fork-choice";
2
+ import {
3
+ MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD,
4
+ MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD,
5
+ MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
6
+ MAX_WITHDRAWALS_PER_PAYLOAD,
7
+ MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
8
+ } from "@lodestar/params";
2
9
  import {
3
10
  computeStartSlotAtEpoch,
4
11
  getExecutionPayloadEnvelopeSignatureSet,
@@ -115,6 +122,36 @@ async function validateExecutionPayloadEnvelope(
115
122
  });
116
123
  }
117
124
 
125
+ // [REJECT] The counts of `execution_requests` are within their respective limits.
126
+ // New in Gloas:EIP7688 — progressive lists are unbounded at the type level, so bounds
127
+ // are enforced here in gossip validation.
128
+ const {executionRequests} = envelope;
129
+ const requestCountLimits: [string, number, number][] = [
130
+ ["withdrawals", executionRequests.withdrawals.length, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD],
131
+ ["consolidations", executionRequests.consolidations.length, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD],
132
+ ["builderDeposits", executionRequests.builderDeposits.length, MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD],
133
+ ["builderExits", executionRequests.builderExits.length, MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD],
134
+ ];
135
+ for (const [name, count, limit] of requestCountLimits) {
136
+ if (count > limit) {
137
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
138
+ code: ExecutionPayloadEnvelopeErrorCode.EXECUTION_REQUESTS_COUNT_EXCEEDED,
139
+ name,
140
+ count,
141
+ limit,
142
+ });
143
+ }
144
+ }
145
+
146
+ // [REJECT] The number of withdrawals is within the limit.
147
+ if (payload.withdrawals.length > MAX_WITHDRAWALS_PER_PAYLOAD) {
148
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
149
+ code: ExecutionPayloadEnvelopeErrorCode.WITHDRAWALS_COUNT_EXCEEDED,
150
+ count: payload.withdrawals.length,
151
+ limit: MAX_WITHDRAWALS_PER_PAYLOAD,
152
+ });
153
+ }
154
+
118
155
  // Get the block state to verify the builder's signature.
119
156
  const blockState = await chain.regen
120
157
  .getState(block.stateRoot, RegenCaller.validateGossipPayloadEnvelope)