@lodestar/beacon-node 1.52.0-dev.77088eb712 → 1.52.0-dev.7dadcecdca

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 (241) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +63 -39
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/pool/index.js +3 -1
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  8. package/lib/api/impl/beacon/state/utils.js +2 -1
  9. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  10. package/lib/api/impl/debug/index.d.ts.map +1 -1
  11. package/lib/api/impl/debug/index.js +6 -2
  12. package/lib/api/impl/debug/index.js.map +1 -1
  13. package/lib/api/impl/validator/index.d.ts.map +1 -1
  14. package/lib/api/impl/validator/index.js +17 -7
  15. package/lib/api/impl/validator/index.js.map +1 -1
  16. package/lib/chain/ColumnReconstructionTracker.d.ts +4 -0
  17. package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
  18. package/lib/chain/ColumnReconstructionTracker.js +4 -0
  19. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  20. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  21. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +7 -0
  22. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  23. package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
  24. package/lib/chain/archiveStore/utils/pruneHistory.js +8 -4
  25. package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
  26. package/lib/chain/blocks/importExecutionPayload.d.ts +1 -1
  27. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  28. package/lib/chain/blocks/importExecutionPayload.js +9 -3
  29. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  30. package/lib/chain/blocks/index.d.ts.map +1 -1
  31. package/lib/chain/blocks/index.js +3 -17
  32. package/lib/chain/blocks/index.js.map +1 -1
  33. package/lib/chain/chain.d.ts +6 -5
  34. package/lib/chain/chain.d.ts.map +1 -1
  35. package/lib/chain/chain.js +74 -26
  36. package/lib/chain/chain.js.map +1 -1
  37. package/lib/chain/errors/attestationError.d.ts +15 -1
  38. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  39. package/lib/chain/errors/attestationError.js +8 -0
  40. package/lib/chain/errors/attestationError.js.map +1 -1
  41. package/lib/chain/errors/executionPayloadBid.d.ts +3 -2
  42. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  43. package/lib/chain/errors/executionPayloadBid.js +1 -1
  44. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  45. package/lib/chain/errors/executionPayloadEnvelope.d.ts +48 -0
  46. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  47. package/lib/chain/errors/executionPayloadEnvelope.js +7 -0
  48. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  49. package/lib/chain/interface.d.ts +1 -1
  50. package/lib/chain/interface.d.ts.map +1 -1
  51. package/lib/chain/lightClient/index.d.ts +13 -6
  52. package/lib/chain/lightClient/index.d.ts.map +1 -1
  53. package/lib/chain/lightClient/index.js +95 -115
  54. package/lib/chain/lightClient/index.js.map +1 -1
  55. package/lib/chain/opPools/opPool.js +6 -6
  56. package/lib/chain/opPools/opPool.js.map +1 -1
  57. package/lib/chain/seenCache/seenAttesters.d.ts +1 -0
  58. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  59. package/lib/chain/seenCache/seenAttesters.js +1 -1
  60. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  61. package/lib/chain/seenCache/seenBlockAttesters.d.ts +8 -2
  62. package/lib/chain/seenCache/seenBlockAttesters.d.ts.map +1 -1
  63. package/lib/chain/seenCache/seenBlockAttesters.js +43 -6
  64. package/lib/chain/seenCache/seenBlockAttesters.js.map +1 -1
  65. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +13 -4
  66. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
  67. package/lib/chain/seenCache/seenExecutionPayloadBids.js +13 -12
  68. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
  69. package/lib/chain/validation/aggregateAndProof.d.ts.map +1 -1
  70. package/lib/chain/validation/aggregateAndProof.js +24 -7
  71. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  72. package/lib/chain/validation/attestation.d.ts.map +1 -1
  73. package/lib/chain/validation/attestation.js +32 -16
  74. package/lib/chain/validation/attestation.js.map +1 -1
  75. package/lib/chain/validation/block.d.ts.map +1 -1
  76. package/lib/chain/validation/block.js +9 -1
  77. package/lib/chain/validation/block.js.map +1 -1
  78. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  79. package/lib/chain/validation/executionPayloadBid.js +30 -40
  80. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  81. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  82. package/lib/chain/validation/executionPayloadEnvelope.js +79 -4
  83. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  84. package/lib/chain/validation/payloadAttestationMessage.js +9 -0
  85. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  86. package/lib/chain/validatorMonitor.js +43 -43
  87. package/lib/chain/validatorMonitor.js.map +1 -1
  88. package/lib/execution/engine/http.d.ts +2 -2
  89. package/lib/execution/engine/http.d.ts.map +1 -1
  90. package/lib/execution/engine/http.js +13 -7
  91. package/lib/execution/engine/http.js.map +1 -1
  92. package/lib/execution/engine/interface.d.ts +16 -3
  93. package/lib/execution/engine/interface.d.ts.map +1 -1
  94. package/lib/execution/engine/interface.js +11 -0
  95. package/lib/execution/engine/interface.js.map +1 -1
  96. package/lib/execution/engine/jsonRpcHttpClient.d.ts +2 -0
  97. package/lib/execution/engine/jsonRpcHttpClient.d.ts.map +1 -1
  98. package/lib/execution/engine/jsonRpcHttpClient.js +14 -6
  99. package/lib/execution/engine/jsonRpcHttpClient.js.map +1 -1
  100. package/lib/execution/engine/jsonRpcTransport.d.ts +2 -2
  101. package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
  102. package/lib/execution/engine/jsonRpcTransport.js +4 -4
  103. package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
  104. package/lib/execution/engine/restHttpClient.d.ts.map +1 -1
  105. package/lib/execution/engine/restHttpClient.js +9 -5
  106. package/lib/execution/engine/restHttpClient.js.map +1 -1
  107. package/lib/execution/engine/restTransport.d.ts +2 -2
  108. package/lib/execution/engine/restTransport.d.ts.map +1 -1
  109. package/lib/execution/engine/restTransport.js +4 -4
  110. package/lib/execution/engine/restTransport.js.map +1 -1
  111. package/lib/execution/engine/signal.d.ts +6 -0
  112. package/lib/execution/engine/signal.d.ts.map +1 -0
  113. package/lib/execution/engine/signal.js +24 -0
  114. package/lib/execution/engine/signal.js.map +1 -0
  115. package/lib/execution/engine/transport.d.ts +2 -2
  116. package/lib/execution/engine/transport.d.ts.map +1 -1
  117. package/lib/index.d.ts +1 -1
  118. package/lib/index.d.ts.map +1 -1
  119. package/lib/index.js +1 -1
  120. package/lib/index.js.map +1 -1
  121. package/lib/network/gossip/gossipsub.d.ts +1 -0
  122. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  123. package/lib/network/gossip/gossipsub.js +5 -2
  124. package/lib/network/gossip/gossipsub.js.map +1 -1
  125. package/lib/network/gossip/topic.d.ts +1 -7
  126. package/lib/network/gossip/topic.d.ts.map +1 -1
  127. package/lib/network/gossip/topic.js +0 -13
  128. package/lib/network/gossip/topic.js.map +1 -1
  129. package/lib/network/network.d.ts +1 -0
  130. package/lib/network/network.d.ts.map +1 -1
  131. package/lib/network/network.js +26 -12
  132. package/lib/network/network.js.map +1 -1
  133. package/lib/network/peers/peerManager.d.ts.map +1 -1
  134. package/lib/network/peers/peerManager.js +22 -2
  135. package/lib/network/peers/peerManager.js.map +1 -1
  136. package/lib/network/peers/utils/prioritizePeers.d.ts +2 -0
  137. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  138. package/lib/network/peers/utils/prioritizePeers.js +11 -2
  139. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  140. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  141. package/lib/network/processor/gossipHandlers.js +19 -6
  142. package/lib/network/processor/gossipHandlers.js.map +1 -1
  143. package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
  144. package/lib/network/processor/gossipValidatorFn.js +4 -1
  145. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  146. package/lib/network/processor/index.d.ts.map +1 -1
  147. package/lib/network/processor/index.js +4 -2
  148. package/lib/network/processor/index.js.map +1 -1
  149. package/lib/network/reqresp/utils/collect.d.ts +4 -4
  150. package/lib/network/reqresp/utils/collect.d.ts.map +1 -1
  151. package/lib/network/reqresp/utils/collect.js +9 -8
  152. package/lib/network/reqresp/utils/collect.js.map +1 -1
  153. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts +1 -1
  154. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts.map +1 -1
  155. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js +2 -2
  156. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js.map +1 -1
  157. package/lib/sync/range/batch.d.ts +6 -0
  158. package/lib/sync/range/batch.d.ts.map +1 -1
  159. package/lib/sync/range/batch.js +17 -0
  160. package/lib/sync/range/batch.js.map +1 -1
  161. package/lib/sync/range/chain.d.ts.map +1 -1
  162. package/lib/sync/range/chain.js +8 -1
  163. package/lib/sync/range/chain.js.map +1 -1
  164. package/lib/sync/range/range.d.ts.map +1 -1
  165. package/lib/sync/range/range.js +43 -3
  166. package/lib/sync/range/range.js.map +1 -1
  167. package/lib/sync/types.d.ts +12 -1
  168. package/lib/sync/types.d.ts.map +1 -1
  169. package/lib/sync/types.js +2 -0
  170. package/lib/sync/types.js.map +1 -1
  171. package/lib/sync/unknownBlock.d.ts +28 -1
  172. package/lib/sync/unknownBlock.d.ts.map +1 -1
  173. package/lib/sync/unknownBlock.js +296 -24
  174. package/lib/sync/unknownBlock.js.map +1 -1
  175. package/lib/sync/utils/downloadByRange.d.ts +14 -1
  176. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  177. package/lib/sync/utils/downloadByRange.js +12 -2
  178. package/lib/sync/utils/downloadByRange.js.map +1 -1
  179. package/lib/sync/utils/downloadByRoot.d.ts +24 -2
  180. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  181. package/lib/sync/utils/downloadByRoot.js +48 -5
  182. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  183. package/lib/util/eventLoop.d.ts +3 -3
  184. package/lib/util/eventLoop.d.ts.map +1 -1
  185. package/lib/util/eventLoop.js +3 -3
  186. package/lib/util/eventLoop.js.map +1 -1
  187. package/package.json +26 -26
  188. package/src/api/impl/beacon/blocks/index.ts +74 -47
  189. package/src/api/impl/beacon/pool/index.ts +9 -7
  190. package/src/api/impl/beacon/state/utils.ts +2 -1
  191. package/src/api/impl/debug/index.ts +6 -2
  192. package/src/api/impl/validator/index.ts +19 -7
  193. package/src/chain/ColumnReconstructionTracker.ts +5 -0
  194. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +9 -0
  195. package/src/chain/archiveStore/utils/pruneHistory.ts +9 -4
  196. package/src/chain/blocks/importExecutionPayload.ts +9 -2
  197. package/src/chain/blocks/index.ts +3 -31
  198. package/src/chain/chain.ts +107 -43
  199. package/src/chain/errors/attestationError.ts +11 -1
  200. package/src/chain/errors/executionPayloadBid.ts +3 -2
  201. package/src/chain/errors/executionPayloadEnvelope.ts +50 -0
  202. package/src/chain/interface.ts +1 -1
  203. package/src/chain/lightClient/index.ts +108 -142
  204. package/src/chain/opPools/opPool.ts +6 -6
  205. package/src/chain/seenCache/seenAttesters.ts +1 -1
  206. package/src/chain/seenCache/seenBlockAttesters.ts +48 -6
  207. package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -15
  208. package/src/chain/validation/aggregateAndProof.ts +24 -9
  209. package/src/chain/validation/attestation.ts +31 -20
  210. package/src/chain/validation/block.ts +9 -1
  211. package/src/chain/validation/executionPayloadBid.ts +40 -42
  212. package/src/chain/validation/executionPayloadEnvelope.ts +87 -3
  213. package/src/chain/validation/payloadAttestationMessage.ts +10 -0
  214. package/src/chain/validatorMonitor.ts +43 -43
  215. package/src/execution/engine/http.ts +18 -10
  216. package/src/execution/engine/interface.ts +18 -3
  217. package/src/execution/engine/jsonRpcHttpClient.ts +26 -14
  218. package/src/execution/engine/jsonRpcTransport.ts +8 -4
  219. package/src/execution/engine/restHttpClient.ts +17 -11
  220. package/src/execution/engine/restTransport.ts +5 -4
  221. package/src/execution/engine/signal.ts +28 -0
  222. package/src/execution/engine/transport.ts +3 -2
  223. package/src/index.ts +6 -1
  224. package/src/network/gossip/gossipsub.ts +6 -2
  225. package/src/network/gossip/topic.ts +1 -14
  226. package/src/network/network.ts +39 -13
  227. package/src/network/peers/peerManager.ts +26 -2
  228. package/src/network/peers/utils/prioritizePeers.ts +14 -1
  229. package/src/network/processor/gossipHandlers.ts +25 -13
  230. package/src/network/processor/gossipValidatorFn.ts +4 -0
  231. package/src/network/processor/index.ts +7 -2
  232. package/src/network/reqresp/utils/collect.ts +16 -8
  233. package/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +3 -2
  234. package/src/sync/range/batch.ts +20 -0
  235. package/src/sync/range/chain.ts +8 -0
  236. package/src/sync/range/range.ts +56 -3
  237. package/src/sync/types.ts +11 -0
  238. package/src/sync/unknownBlock.ts +340 -24
  239. package/src/sync/utils/downloadByRange.ts +29 -3
  240. package/src/sync/utils/downloadByRoot.ts +75 -7
  241. package/src/util/eventLoop.ts +3 -3
@@ -121,13 +121,21 @@ export async function validateGossipBlock(
121
121
  // (via gossip or non-gossip sources) (a client MAY queue blocks for processing once the parent payload is retrieved).
122
122
  if (isGloasBeaconBlock(block)) {
123
123
  const parentBlockHashHex = toRootHex(block.body.signedExecutionPayloadBid.message.parentBlockHash);
124
- if (chain.forkChoice.getBlockHexAndBlockHash(parentRoot, parentBlockHashHex) === null) {
124
+ const parentPayloadBlock = chain.forkChoice.getBlockHexAndBlockHash(parentRoot, parentBlockHashHex);
125
+ if (parentPayloadBlock === null) {
125
126
  throw new BlockGossipError(GossipAction.IGNORE, {
126
127
  code: BlockErrorCode.PARENT_PAYLOAD_UNKNOWN,
127
128
  parentRoot,
128
129
  parentBlockHash: parentBlockHashHex,
129
130
  });
130
131
  }
132
+ // [IGNORE] The block's parent passed validation but the payload it builds on is invalid
133
+ if (parentPayloadBlock.executionStatus === ExecutionStatus.Invalid) {
134
+ throw new BlockGossipError(GossipAction.IGNORE, {
135
+ code: BlockErrorCode.PARENT_EXECUTION_INVALID,
136
+ parentRoot,
137
+ });
138
+ }
131
139
  }
132
140
 
133
141
  // [REJECT] The block is from a higher slot than its parent.
@@ -16,33 +16,6 @@ import {ExecutionPayloadBidError, ExecutionPayloadBidErrorCode, GossipAction} fr
16
16
  import {IBeaconChain} from "../index.js";
17
17
  import {RegenCaller} from "../regen/index.js";
18
18
 
19
- /**
20
- * Relative increment over the current highest bid required to forward a bid, in basis points.
21
- * With 3%, laddering from 1 gwei to 1 ETH takes ~256 bids given the floor and cap below, see
22
- * https://github.com/ethereum/consensus-specs/pull/4792#issuecomment-3714553549.
23
- */
24
- const BID_INCREMENT_BPS = 300;
25
- /**
26
- * Minimum absolute increment (0.0001 ETH). Covers low bid values where the relative increment
27
- * is tiny and provides weak spam protection.
28
- */
29
- const BID_INCREMENT_FLOOR_GWEI = 100_000;
30
- /**
31
- * Maximum absolute increment (0.01 ETH). Bounds the barrier for legitimate competition on
32
- * high value blocks where the relative increment would suppress closely competing bids.
33
- */
34
- const BID_INCREMENT_CAP_GWEI = 10_000_000;
35
-
36
- /**
37
- * Return the minimum value a new bid must have to be forwarded given the current highest bid.
38
- * Division before multiplication to stay within safe integer range for max gwei values.
39
- */
40
- function getMinBidValue(currentHighestBid: number): number {
41
- const relativeIncrement = Math.floor(currentHighestBid / 10_000) * BID_INCREMENT_BPS;
42
- const increment = Math.min(Math.max(BID_INCREMENT_FLOOR_GWEI, relativeIncrement), BID_INCREMENT_CAP_GWEI);
43
- return currentHighestBid + increment;
44
- }
45
-
46
19
  /**
47
20
  * Check whether a bid builds on one of the paths compatible with the local head branch.
48
21
  *
@@ -165,27 +138,30 @@ async function validateExecutionPayloadBid(
165
138
  });
166
139
  }
167
140
 
168
- // [IGNORE] this is the first signed bid seen with a valid signature from the given builder for
169
- // the tuple `(bid.slot, bid.parent_block_hash, bid.parent_block_root)`.
170
- // Entries are only added after signature verification, so known tuples can be dropped before
171
- // state regeneration and the other expensive validation steps.
172
- if (chain.seenExecutionPayloadBids.isKnown(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot)) {
141
+ // [IGNORE] The builder has not reached its bid limit, checked against the limit of its last valid bid.
142
+ // Bids for the same slot and parent root are validated against the same state, so bids past the
143
+ // limit can be dropped before state regeneration and the other expensive validation steps.
144
+ const seenBids = chain.seenExecutionPayloadBids.get(
145
+ bid.slot,
146
+ bid.builderIndex,
147
+ bidParentBlockHash,
148
+ bidParentBlockRoot
149
+ );
150
+ if (seenBids !== undefined && seenBids.count >= seenBids.limit) {
173
151
  throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
174
- code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN,
152
+ code: ExecutionPayloadBidErrorCode.BID_LIMIT_REACHED,
175
153
  builderIndex: bid.builderIndex,
176
154
  slot: bid.slot,
177
155
  parentBlockRoot: bidParentBlockRoot,
178
156
  parentBlockHash: bidParentBlockHash,
157
+ bidLimit: seenBids.limit,
179
158
  });
180
159
  }
181
160
 
182
161
  // [IGNORE] this bid is the highest value bid seen for the tuple
183
162
  // `(bid.slot, bid.parent_block_hash, bid.parent_block_root)`.
184
- // As a DoS prevention measure, the bid must also exceed the current highest bid by a minimum
185
- // increment, see https://github.com/ethereum/consensus-specs/pull/4831. This prevents spam
186
- // from builders submitting numerous bids with minimal value increments.
187
163
  const bestBid = chain.executionPayloadBidPool.getBestBid(bid.slot, bidParentBlockHash, bidParentBlockRoot);
188
- if (bestBid !== null && bid.value < getMinBidValue(bestBid.signedBid.message.value)) {
164
+ if (bestBid !== null && bid.value <= bestBid.signedBid.message.value) {
189
165
  throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
190
166
  code: ExecutionPayloadBidErrorCode.BID_TOO_LOW,
191
167
  bidValue: bid.value,
@@ -366,6 +342,24 @@ async function validateExecutionPayloadBid(
366
342
  });
367
343
  }
368
344
 
345
+ // [IGNORE] The builder has not reached its bid limit for the tuple
346
+ // `(bid.slot, bid.parent_block_hash, bid.parent_block_root)` -- i.e. one bid per ETH of builder balance
347
+ // not owed in pending withdrawals, `get_builder_bid_limit(state, bid.builder_index)`.
348
+ const bidLimit = state.getBuilderBidLimit(bid.builderIndex);
349
+ if (
350
+ (chain.seenExecutionPayloadBids.get(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot)?.count ??
351
+ 0) >= bidLimit
352
+ ) {
353
+ throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
354
+ code: ExecutionPayloadBidErrorCode.BID_LIMIT_REACHED,
355
+ builderIndex: bid.builderIndex,
356
+ slot: bid.slot,
357
+ parentBlockRoot: bidParentBlockRoot,
358
+ parentBlockHash: bidParentBlockHash,
359
+ bidLimit,
360
+ });
361
+ }
362
+
369
363
  // [IGNORE] `bid.value` is less or equal than the builder's excess balance --
370
364
  // i.e. `can_builder_cover_bid(state, builder_index, amount)` returns `True`.
371
365
  if (!state.canBuilderCoverBid(bid.builderIndex, bid.value)) {
@@ -426,20 +420,24 @@ async function validateExecutionPayloadBid(
426
420
  });
427
421
  }
428
422
 
429
- // Repeat the seen check after the awaited signature verification to prevent concurrent bids
430
- // for the same builder and tuple from both passing validation.
431
- if (chain.seenExecutionPayloadBids.isKnown(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot)) {
423
+ // Repeat the bid limit check after the awaited signature verification to prevent concurrent bids
424
+ // for the same builder and tuple from all passing validation.
425
+ if (
426
+ (chain.seenExecutionPayloadBids.get(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot)?.count ??
427
+ 0) >= bidLimit
428
+ ) {
432
429
  throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
433
- code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN,
430
+ code: ExecutionPayloadBidErrorCode.BID_LIMIT_REACHED,
434
431
  builderIndex: bid.builderIndex,
435
432
  slot: bid.slot,
436
433
  parentBlockRoot: bidParentBlockRoot,
437
434
  parentBlockHash: bidParentBlockHash,
435
+ bidLimit,
438
436
  });
439
437
  }
440
438
 
441
439
  // Valid
442
- chain.seenExecutionPayloadBids.add(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot);
440
+ chain.seenExecutionPayloadBids.add(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot, bidLimit);
443
441
 
444
442
  return {proposerIndex: proposerPreferences.message.validatorIndex};
445
443
  }
@@ -1,6 +1,7 @@
1
1
  import {PayloadStatus, ProtoBlock} from "@lodestar/fork-choice";
2
2
  import {
3
3
  computeStartSlotAtEpoch,
4
+ computeTimeAtSlot,
4
5
  getExecutionPayloadEnvelopeSignatureSet,
5
6
  isStatePostGloas,
6
7
  } from "@lodestar/state-transition";
@@ -129,6 +130,17 @@ async function validateExecutionPayloadEnvelope(
129
130
  });
130
131
  }
131
132
 
133
+ // [REJECT] `envelope.parent_beacon_block_root == block.parent_root`
134
+ if (toRootHex(envelope.parentBeaconBlockRoot) !== block.parentRoot) {
135
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
136
+ code: ExecutionPayloadEnvelopeErrorCode.PARENT_BEACON_BLOCK_ROOT_MISMATCH,
137
+ slot: payload.slotNumber,
138
+ root: blockRootHex,
139
+ envelopeParentBeaconBlockRoot: toRootHex(envelope.parentBeaconBlockRoot),
140
+ blockParentRoot: block.parentRoot,
141
+ });
142
+ }
143
+
132
144
  // [REJECT] `envelope.builder_index == bid.builder_index`
133
145
  if (envelope.builderIndex !== payloadInput.getBuilderIndex()) {
134
146
  throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
@@ -140,6 +152,30 @@ async function validateExecutionPayloadEnvelope(
140
152
  });
141
153
  }
142
154
 
155
+ const bid = payloadInput.getBid();
156
+
157
+ // [REJECT] `payload.prev_randao == bid.prev_randao`
158
+ if (!byteArrayEquals(payload.prevRandao, bid.prevRandao)) {
159
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
160
+ code: ExecutionPayloadEnvelopeErrorCode.PREV_RANDAO_MISMATCH,
161
+ slot: payload.slotNumber,
162
+ root: blockRootHex,
163
+ envelopePrevRandao: toRootHex(payload.prevRandao),
164
+ bidPrevRandao: toRootHex(bid.prevRandao),
165
+ });
166
+ }
167
+
168
+ // [REJECT] `payload.gas_limit == bid.gas_limit`
169
+ if (BigInt(payload.gasLimit) !== bid.gasLimit) {
170
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
171
+ code: ExecutionPayloadEnvelopeErrorCode.GAS_LIMIT_MISMATCH,
172
+ slot: payload.slotNumber,
173
+ root: blockRootHex,
174
+ envelopeGasLimit: payload.gasLimit,
175
+ bidGasLimit: bid.gasLimit,
176
+ });
177
+ }
178
+
143
179
  // [REJECT] `payload.block_hash == bid.block_hash`
144
180
  if (toRootHex(payload.blockHash) !== payloadInput.getBlockHashHex()) {
145
181
  throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
@@ -153,13 +189,13 @@ async function validateExecutionPayloadEnvelope(
153
189
 
154
190
  // [REJECT] `hash_tree_root(envelope.execution_requests) == bid.execution_requests_root`
155
191
  const requestsRoot = ssz.gloas.ExecutionRequests.hashTreeRoot(envelope.executionRequests);
156
- if (!byteArrayEquals(requestsRoot, payloadInput.getBid().executionRequestsRoot)) {
192
+ if (!byteArrayEquals(requestsRoot, bid.executionRequestsRoot)) {
157
193
  throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
158
194
  code: ExecutionPayloadEnvelopeErrorCode.EXECUTION_REQUESTS_ROOT_MISMATCH,
159
195
  slot: payload.slotNumber,
160
196
  root: blockRootHex,
161
197
  envelopeRequestsRoot: toRootHex(requestsRoot),
162
- bidRequestsRoot: toRootHex(payloadInput.getBid().executionRequestsRoot),
198
+ bidRequestsRoot: toRootHex(bid.executionRequestsRoot),
163
199
  });
164
200
  }
165
201
 
@@ -177,7 +213,7 @@ async function validateExecutionPayloadEnvelope(
177
213
  });
178
214
  }
179
215
 
180
- // Get the block state to verify the builder's signature.
216
+ // Get the block state to verify the payload against it and the builder's signature.
181
217
  const blockState = await chain.regen
182
218
  .getState(block.stateRoot, RegenCaller.validateGossipPayloadEnvelope)
183
219
  .catch(() => {
@@ -191,6 +227,54 @@ async function validateExecutionPayloadEnvelope(
191
227
  throw new Error(`Expected gloas+ state for execution payload envelope validation, got fork=${blockState.forkName}`);
192
228
  }
193
229
 
230
+ // [REJECT] `payload.parent_hash == state.latest_block_hash`
231
+ if (!byteArrayEquals(payload.parentHash, blockState.latestBlockHash)) {
232
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
233
+ code: ExecutionPayloadEnvelopeErrorCode.PARENT_HASH_MISMATCH,
234
+ slot: payload.slotNumber,
235
+ root: blockRootHex,
236
+ envelopeParentHash: toRootHex(payload.parentHash),
237
+ latestBlockHash: toRootHex(blockState.latestBlockHash),
238
+ });
239
+ }
240
+
241
+ // [REJECT] `payload.timestamp == compute_time_at_slot(state.genesis_time, block.slot)`
242
+ const expectedTimestamp = computeTimeAtSlot(chain.config, block.slot, blockState.genesisTime);
243
+ if (payload.timestamp !== expectedTimestamp) {
244
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
245
+ code: ExecutionPayloadEnvelopeErrorCode.INCORRECT_TIMESTAMP,
246
+ slot: payload.slotNumber,
247
+ root: blockRootHex,
248
+ envelopeTimestamp: payload.timestamp,
249
+ expectedTimestamp,
250
+ });
251
+ }
252
+
253
+ // [REJECT] The payload contains no empty transactions
254
+ for (let i = 0; i < payload.transactions.length; i++) {
255
+ if (payload.transactions.getSize(i) === 0) {
256
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
257
+ code: ExecutionPayloadEnvelopeErrorCode.EMPTY_TRANSACTION,
258
+ slot: payload.slotNumber,
259
+ root: blockRootHex,
260
+ transactionIndex: i,
261
+ });
262
+ }
263
+ }
264
+
265
+ // [REJECT] `hash_tree_root(payload.withdrawals) == hash_tree_root(state.payload_expected_withdrawals)`
266
+ const withdrawalsRoot = ssz.gloas.Withdrawals.hashTreeRoot(payload.withdrawals);
267
+ const expectedWithdrawalsRoot = ssz.gloas.Withdrawals.hashTreeRoot(blockState.payloadExpectedWithdrawals);
268
+ if (!byteArrayEquals(withdrawalsRoot, expectedWithdrawalsRoot)) {
269
+ throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
270
+ code: ExecutionPayloadEnvelopeErrorCode.WITHDRAWALS_MISMATCH,
271
+ slot: payload.slotNumber,
272
+ root: blockRootHex,
273
+ envelopeWithdrawalsRoot: toRootHex(withdrawalsRoot),
274
+ expectedWithdrawalsRoot: toRootHex(expectedWithdrawalsRoot),
275
+ });
276
+ }
277
+
194
278
  // [REJECT] `signed_execution_payload_envelope.signature` is valid as verified
195
279
  // by `verify_execution_payload_envelope_signature`.
196
280
  const signatureSet = getExecutionPayloadEnvelopeSignatureSet(
@@ -131,6 +131,16 @@ async function validatePayloadAttestationMessage(
131
131
  });
132
132
  }
133
133
 
134
+ // Re-check after the await: concurrent messages from the same validator all pass the check above
135
+ if (chain.seenPayloadAttesters.isKnown(data.slot, validatorIndex)) {
136
+ throw new PayloadAttestationError(GossipAction.IGNORE, {
137
+ code: PayloadAttestationErrorCode.PAYLOAD_ATTESTATION_ALREADY_KNOWN,
138
+ validatorIndex,
139
+ slot: data.slot,
140
+ blockRoot: toRootHex(data.beaconBlockRoot),
141
+ });
142
+ }
143
+
134
144
  // Valid
135
145
  chain.seenPayloadAttesters.add(data.slot, validatorIndex);
136
146
 
@@ -1216,137 +1216,137 @@ function createValidatorMonitorMetrics(register: RegistryMetricCreator, register
1216
1216
 
1217
1217
  return {
1218
1218
  validatorsConnected: register.gauge({
1219
- name: "lodestar_validator_monitor_validators",
1219
+ name: "validator_monitor_validators",
1220
1220
  help: "Count of validators that are specifically monitored by this beacon node",
1221
1221
  }),
1222
1222
 
1223
1223
  validatorsConnectedIndices: register.gauge<{indices: string}>({
1224
- name: "lodestar_validator_monitor_indices",
1224
+ name: "validator_monitor_indices",
1225
1225
  help: "Static metric with connected validator indices as label, value is always 1",
1226
1226
  labelNames: ["indices"],
1227
1227
  }),
1228
1228
 
1229
1229
  validatorsInSyncCommittee: register.gauge({
1230
- name: "lodestar_validator_monitor_validators_in_sync_committee",
1230
+ name: "validator_monitor_validators_in_sync_committee",
1231
1231
  help: "Count of validators monitored by this beacon node that are part of sync committee",
1232
1232
  }),
1233
1233
 
1234
1234
  // Validator Monitor Metrics (per-epoch summaries)
1235
1235
  prevEpochOnChainBalance: stateDerivedRegister?.gauge({
1236
- name: "lodestar_validator_monitor_prev_epoch_on_chain_balance",
1236
+ name: "validator_monitor_prev_epoch_on_chain_balance",
1237
1237
  help: "Total balance of all monitored validators after an epoch",
1238
1238
  }),
1239
1239
  prevEpochOnChainAttesterHit: register.gauge({
1240
- name: "lodestar_validator_monitor_prev_epoch_on_chain_attester_hit_total",
1240
+ name: "validator_monitor_prev_epoch_on_chain_attester_hit_total",
1241
1241
  help: "Incremented if validator's submitted attestation is included in some blocks",
1242
1242
  }),
1243
1243
  prevEpochOnChainAttesterMiss: register.gauge({
1244
- name: "lodestar_validator_monitor_prev_epoch_on_chain_attester_miss_total",
1244
+ name: "validator_monitor_prev_epoch_on_chain_attester_miss_total",
1245
1245
  help: "Incremented if validator's submitted attestation is not included in any blocks",
1246
1246
  }),
1247
1247
  prevEpochOnChainSourceAttesterHit: stateDerivedRegister?.gauge({
1248
- name: "lodestar_validator_monitor_prev_epoch_on_chain_source_attester_hit_total",
1248
+ name: "validator_monitor_prev_epoch_on_chain_source_attester_hit_total",
1249
1249
  help: "Incremented if the validator is flagged as a previous epoch source attester during per epoch processing",
1250
1250
  }),
1251
1251
  prevEpochOnChainSourceAttesterMiss: stateDerivedRegister?.gauge({
1252
- name: "lodestar_validator_monitor_prev_epoch_on_chain_source_attester_miss_total",
1252
+ name: "validator_monitor_prev_epoch_on_chain_source_attester_miss_total",
1253
1253
  help: "Incremented if the validator is not flagged as a previous epoch source attester during per epoch processing",
1254
1254
  }),
1255
1255
  prevEpochOnChainHeadAttesterHit: stateDerivedRegister?.gauge({
1256
- name: "lodestar_validator_monitor_prev_epoch_on_chain_head_attester_hit_total",
1256
+ name: "validator_monitor_prev_epoch_on_chain_head_attester_hit_total",
1257
1257
  help: "Incremented if the validator is flagged as a previous epoch head attester during per epoch processing",
1258
1258
  }),
1259
1259
  prevEpochOnChainHeadAttesterMiss: stateDerivedRegister?.gauge({
1260
- name: "lodestar_validator_monitor_prev_epoch_on_chain_head_attester_miss_total",
1260
+ name: "validator_monitor_prev_epoch_on_chain_head_attester_miss_total",
1261
1261
  help: "Incremented if the validator is not flagged as a previous epoch head attester during per epoch processing",
1262
1262
  }),
1263
1263
  prevOnChainAttesterCorrectHead: register.gauge({
1264
- name: "lodestar_validator_monitor_prev_epoch_on_chain_attester_correct_head_total",
1264
+ name: "validator_monitor_prev_epoch_on_chain_attester_correct_head_total",
1265
1265
  help: "Total count of times a validator votes correct head",
1266
1266
  }),
1267
1267
  prevOnChainAttesterIncorrectHead: register.gauge({
1268
- name: "lodestar_validator_monitor_prev_epoch_on_chain_attester_incorrect_head_total",
1268
+ name: "validator_monitor_prev_epoch_on_chain_attester_incorrect_head_total",
1269
1269
  help: "Total count of times a validator votes incorrect head",
1270
1270
  }),
1271
1271
  prevEpochOnChainTargetAttesterHit: stateDerivedRegister?.gauge({
1272
- name: "lodestar_validator_monitor_prev_epoch_on_chain_target_attester_hit_total",
1272
+ name: "validator_monitor_prev_epoch_on_chain_target_attester_hit_total",
1273
1273
  help: "Incremented if the validator is flagged as a previous epoch target attester during per epoch processing",
1274
1274
  }),
1275
1275
  prevEpochOnChainTargetAttesterMiss: stateDerivedRegister?.gauge({
1276
- name: "lodestar_validator_monitor_prev_epoch_on_chain_target_attester_miss_total",
1276
+ name: "validator_monitor_prev_epoch_on_chain_target_attester_miss_total",
1277
1277
  help: "Incremented if the validator is not flagged as a previous epoch target attester during per epoch processing",
1278
1278
  }),
1279
1279
  prevEpochOnChainInclusionDistance: register.histogram({
1280
- name: "lodestar_validator_monitor_prev_epoch_on_chain_inclusion_distance",
1280
+ name: "validator_monitor_prev_epoch_on_chain_inclusion_distance",
1281
1281
  help: "The attestation inclusion distance calculated during per epoch processing",
1282
1282
  // min inclusion distance is 1, usual values are 1,2,3 max is 32 (1 epoch)
1283
1283
  buckets: [1, 2, 3, 5, 10, 32],
1284
1284
  }),
1285
1285
  prevEpochAttestations: register.histogram({
1286
- name: "lodestar_validator_monitor_prev_epoch_attestations",
1286
+ name: "validator_monitor_prev_epoch_attestations",
1287
1287
  help: "The number of unagg. attestations seen in the previous epoch",
1288
1288
  buckets: [0, 1, 2, 3],
1289
1289
  }),
1290
1290
  prevEpochAttestationsMinDelaySeconds: register.histogram({
1291
- name: "lodestar_validator_monitor_prev_epoch_attestations_min_delay_seconds",
1291
+ name: "validator_monitor_prev_epoch_attestations_min_delay_seconds",
1292
1292
  help: "The min delay between when the validator should send the attestation and when it was received",
1293
1293
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1294
1294
  }),
1295
1295
  prevEpochAttestationAggregateInclusions: register.histogram({
1296
- name: "lodestar_validator_monitor_prev_epoch_attestation_aggregate_inclusions",
1296
+ name: "validator_monitor_prev_epoch_attestation_aggregate_inclusions",
1297
1297
  help: "The count of times an attestation was seen inside an aggregate",
1298
1298
  buckets: [0, 1, 2, 3, 5, 10],
1299
1299
  }),
1300
1300
  prevEpochAttestationBlockInclusions: register.histogram({
1301
- name: "lodestar_validator_monitor_prev_epoch_attestation_block_inclusions",
1301
+ name: "validator_monitor_prev_epoch_attestation_block_inclusions",
1302
1302
  help: "The count of times an attestation was seen inside a block",
1303
1303
  buckets: [0, 1, 2, 3, 5],
1304
1304
  }),
1305
1305
  prevEpochAttestationBlockMinInclusionDistance: register.histogram({
1306
- name: "lodestar_validator_monitor_prev_epoch_attestation_block_min_inclusion_distance",
1306
+ name: "validator_monitor_prev_epoch_attestation_block_min_inclusion_distance",
1307
1307
  help: "The minimum inclusion distance observed for the inclusion of an attestation in a block",
1308
1308
  buckets: [1, 2, 3, 5, 10, 32],
1309
1309
  }),
1310
1310
  prevEpochBeaconBlocks: register.histogram({
1311
- name: "lodestar_validator_monitor_prev_epoch_beacon_blocks",
1311
+ name: "validator_monitor_prev_epoch_beacon_blocks",
1312
1312
  help: "The number of beacon_blocks seen in the previous epoch",
1313
1313
  buckets: [0, 1, 2, 3, 5, 10],
1314
1314
  }),
1315
1315
  prevEpochBeaconBlocksMinDelaySeconds: register.histogram({
1316
- name: "lodestar_validator_monitor_prev_epoch_beacon_blocks_min_delay_seconds",
1316
+ name: "validator_monitor_prev_epoch_beacon_blocks_min_delay_seconds",
1317
1317
  help: "The min delay between when the validator should send the block and when it was received",
1318
1318
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1319
1319
  }),
1320
1320
  prevEpochAggregatesTotal: register.histogram({
1321
- name: "lodestar_validator_monitor_prev_epoch_aggregates",
1321
+ name: "validator_monitor_prev_epoch_aggregates",
1322
1322
  help: "The number of aggregates seen in the previous epoch",
1323
1323
  buckets: [0, 1, 2, 3, 5, 10],
1324
1324
  }),
1325
1325
  prevEpochAggregatesMinDelaySeconds: register.histogram({
1326
- name: "lodestar_validator_monitor_prev_epoch_aggregates_min_delay_seconds",
1326
+ name: "validator_monitor_prev_epoch_aggregates_min_delay_seconds",
1327
1327
  help: "The min delay between when the validator should send the aggregate and when it was received",
1328
1328
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1329
1329
  }),
1330
1330
  prevEpochSyncCommitteeHits: register.gauge({
1331
- name: "lodestar_validator_monitor_prev_epoch_sync_committee_hits",
1331
+ name: "validator_monitor_prev_epoch_sync_committee_hits",
1332
1332
  help: "Count of times in prev epoch connected validators participated in imported block's syncAggregate",
1333
1333
  }),
1334
1334
  prevEpochSyncCommitteeMisses: register.gauge({
1335
- name: "lodestar_validator_monitor_prev_epoch_sync_committee_misses",
1335
+ name: "validator_monitor_prev_epoch_sync_committee_misses",
1336
1336
  help: "Count of times in prev epoch connected validators fail to participate in imported block's syncAggregate",
1337
1337
  }),
1338
1338
  prevEpochSyncSignatureAggregateInclusions: register.histogram({
1339
- name: "lodestar_validator_monitor_prev_epoch_sync_signature_aggregate_inclusions",
1339
+ name: "validator_monitor_prev_epoch_sync_signature_aggregate_inclusions",
1340
1340
  help: "The count of times a sync signature was seen inside an aggregate",
1341
1341
  buckets: [0, 1, 2, 3, 5, 10],
1342
1342
  }),
1343
1343
  prevEpochAttestationSummary: register.gauge<{summary: string}>({
1344
- name: "lodestar_validator_monitor_prev_epoch_attestation_summary",
1344
+ name: "validator_monitor_prev_epoch_attestation_summary",
1345
1345
  help: "Best guess of the node of the result of previous epoch validators attestation actions and causality",
1346
1346
  labelNames: ["summary"],
1347
1347
  }),
1348
1348
  prevEpochBlockProposalSummary: register.gauge<{summary: string}>({
1349
- name: "lodestar_validator_monitor_prev_epoch_block_proposal_summary",
1349
+ name: "validator_monitor_prev_epoch_block_proposal_summary",
1350
1350
  help: "Best guess of the node of the result of previous epoch validators block proposal actions and causality",
1351
1351
  labelNames: ["summary"],
1352
1352
  }),
@@ -1354,18 +1354,18 @@ function createValidatorMonitorMetrics(register: RegistryMetricCreator, register
1354
1354
  // Validator Monitor Metrics (real-time)
1355
1355
 
1356
1356
  unaggregatedAttestationTotal: register.gauge<{src: OpSource}>({
1357
- name: "lodestar_validator_monitor_unaggregated_attestation_total",
1357
+ name: "validator_monitor_unaggregated_attestation_total",
1358
1358
  help: "Number of unaggregated attestations seen",
1359
1359
  labelNames: ["src"],
1360
1360
  }),
1361
1361
  unaggregatedAttestationDelaySeconds: register.histogram<{src: OpSource}>({
1362
- name: "lodestar_validator_monitor_unaggregated_attestation_delay_seconds",
1362
+ name: "validator_monitor_unaggregated_attestation_delay_seconds",
1363
1363
  help: "The delay between when the validator should send the attestation and when it was received",
1364
1364
  labelNames: ["src"],
1365
1365
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1366
1366
  }),
1367
1367
  unaggregatedAttestationSubmittedSentPeers: register.histogram({
1368
- name: "lodestar_validator_monitor_unaggregated_attestation_submitted_sent_peers_count",
1368
+ name: "validator_monitor_unaggregated_attestation_submitted_sent_peers_count",
1369
1369
  help: "Number of peers that an unaggregated attestation sent to",
1370
1370
  // as of Apr 2022, most of the time we sent to >30 peers per attestations
1371
1371
  // these bucket values just base on that fact to get equal range
@@ -1373,52 +1373,52 @@ function createValidatorMonitorMetrics(register: RegistryMetricCreator, register
1373
1373
  buckets: [0, 10, 20, 30],
1374
1374
  }),
1375
1375
  aggregatedAttestationTotal: register.gauge<{src: OpSource}>({
1376
- name: "lodestar_validator_monitor_aggregated_attestation_total",
1376
+ name: "validator_monitor_aggregated_attestation_total",
1377
1377
  help: "Number of aggregated attestations seen",
1378
1378
  labelNames: ["src"],
1379
1379
  }),
1380
1380
  aggregatedAttestationDelaySeconds: register.histogram<{src: OpSource}>({
1381
- name: "lodestar_validator_monitor_aggregated_attestation_delay_seconds",
1381
+ name: "validator_monitor_aggregated_attestation_delay_seconds",
1382
1382
  help: "The delay between then the validator should send the aggregate and when it was received",
1383
1383
  labelNames: ["src"],
1384
1384
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1385
1385
  }),
1386
1386
  attestationInAggregateTotal: register.gauge<{src: OpSource}>({
1387
- name: "lodestar_validator_monitor_attestation_in_aggregate_total",
1387
+ name: "validator_monitor_attestation_in_aggregate_total",
1388
1388
  help: "Number of times an attestation has been seen in an aggregate",
1389
1389
  labelNames: ["src"],
1390
1390
  }),
1391
1391
  attestationInAggregateDelaySeconds: register.histogram<{src: OpSource}>({
1392
- name: "lodestar_validator_monitor_attestation_in_aggregate_delay_seconds",
1392
+ name: "validator_monitor_attestation_in_aggregate_delay_seconds",
1393
1393
  help: "The delay between when the validator should send the aggregate and when it was received",
1394
1394
  labelNames: ["src"],
1395
1395
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1396
1396
  }),
1397
1397
  attestationInBlockTotal: register.gauge({
1398
- name: "lodestar_validator_monitor_attestation_in_block_total",
1398
+ name: "validator_monitor_attestation_in_block_total",
1399
1399
  help: "Number of times an attestation has been seen in a block",
1400
1400
  }),
1401
1401
  attestationInBlockDelaySlots: register.histogram({
1402
- name: "lodestar_validator_monitor_attestation_in_block_delay_slots",
1402
+ name: "validator_monitor_attestation_in_block_delay_slots",
1403
1403
  help: "The excess slots (beyond the minimum delay) between the attestation slot and the block slot",
1404
1404
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1405
1405
  }),
1406
1406
  attestationInBlockParticipants: register.histogram({
1407
- name: "lodestar_validator_monitor_attestation_in_block_participants",
1407
+ name: "validator_monitor_attestation_in_block_participants",
1408
1408
  help: "The total participants in attestations of monitored validators included in blocks",
1409
1409
  buckets: [1, 5, 20, 50, 100, 200],
1410
1410
  }),
1411
1411
  syncSignatureInAggregateTotal: register.gauge({
1412
- name: "lodestar_validator_monitor_sync_signature_in_aggregate_total",
1412
+ name: "validator_monitor_sync_signature_in_aggregate_total",
1413
1413
  help: "Number of times a sync signature has been seen in an aggregate",
1414
1414
  }),
1415
1415
  beaconBlockTotal: register.gauge<{src: OpSource}>({
1416
- name: "lodestar_validator_monitor_beacon_block_total",
1416
+ name: "validator_monitor_beacon_block_total",
1417
1417
  help: "Total number of beacon blocks seen",
1418
1418
  labelNames: ["src"],
1419
1419
  }),
1420
1420
  beaconBlockDelaySeconds: register.histogram<{src: OpSource}>({
1421
- name: "lodestar_validator_monitor_beacon_block_delay_seconds",
1421
+ name: "validator_monitor_beacon_block_delay_seconds",
1422
1422
  help: "The delay between when the validator should send the block and when it was received",
1423
1423
  labelNames: ["src"],
1424
1424
  // we also want other nodes to received our published before 4s so add bucket 3 and 3.5
@@ -1427,7 +1427,7 @@ function createValidatorMonitorMetrics(register: RegistryMetricCreator, register
1427
1427
 
1428
1428
  // Only for known
1429
1429
  proposerBalanceDeltaKnown: register.histogram({
1430
- name: "lodestar_validator_monitor_proposer_balance_delta_known_gwei",
1430
+ name: "validator_monitor_proposer_balance_delta_known_gwei",
1431
1431
  help: "Balance delta of known block proposer after importing a valid block",
1432
1432
  // Jul22 mainnet block reward is consistently between 29,000,000-28,000,000 GWei
1433
1433
  buckets: [10_000, 100_000, 1e6, 10e6, 20e6, 50e6, 100e6, 1000e6],
@@ -2,7 +2,7 @@ import {Logger} from "@lodestar/logger";
2
2
  import {ForkName, ForkPostFulu, ForkSeq, SLOTS_PER_EPOCH, isForkPostBellatrix} from "@lodestar/params";
3
3
  import {BlobsBundle, ExecutionPayload, ExecutionRequests, Root, RootHex, Wei, bellatrix} from "@lodestar/types";
4
4
  import {BlobAndProofV2} from "@lodestar/types/fulu";
5
- import {isErrorAborted} from "@lodestar/utils";
5
+ import {ErrorAborted, isErrorAborted} from "@lodestar/utils";
6
6
  import {Metrics} from "../../metrics/index.js";
7
7
  import {EPOCHS_PER_BATCH} from "../../sync/constants.js";
8
8
  import {getLodestarClientVersion} from "../../util/metadata.js";
@@ -11,6 +11,8 @@ import {JobItemQueue} from "../../util/queue/index.js";
11
11
  import {
12
12
  ClientVersion,
13
13
  ExecutePayloadResponse,
14
+ ExecutionEngineError,
15
+ ExecutionEngineErrorCode,
14
16
  ExecutionEngineState,
15
17
  ExecutionPayloadStatus,
16
18
  ForkchoiceUpdatedResult,
@@ -334,13 +336,18 @@ export class ExecutionEngineHttp implements IExecutionEngine {
334
336
  headBlockHash: RootHex,
335
337
  safeBlockHash: RootHex,
336
338
  finalizedBlockHash: RootHex,
337
- payloadAttributes?: PayloadAttributes
339
+ payloadAttributes?: PayloadAttributes,
340
+ signal?: AbortSignal
338
341
  ): Promise<ForkchoiceUpdatedResult> {
339
- const result = await this.enqueue(() =>
340
- this.withTransport(fork, undefined, (transport) =>
341
- transport.forkchoiceUpdated(fork, headBlockHash, safeBlockHash, finalizedBlockHash, payloadAttributes)
342
- )
343
- );
342
+ const result = await this.enqueue(() => {
343
+ // Aborted while waiting in the queue, do not select a transport and sign a request that is not sent
344
+ if (signal?.aborted) {
345
+ throw new ErrorAborted("notifyForkchoiceUpdate");
346
+ }
347
+ return this.withTransport(fork, undefined, (transport) =>
348
+ transport.forkchoiceUpdated(fork, headBlockHash, safeBlockHash, finalizedBlockHash, payloadAttributes, signal)
349
+ );
350
+ });
344
351
  const {
345
352
  payloadStatus: {status},
346
353
  payloadId,
@@ -373,7 +380,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
373
380
  case ExecutionPayloadStatus.SYNCING:
374
381
  // Throw error on syncing if requested to produce a block, else silently ignore
375
382
  if (payloadAttributes) {
376
- throw Error("Execution Layer Syncing");
383
+ throw new ExecutionEngineError({code: ExecutionEngineErrorCode.SYNCING}, "Execution Layer Syncing");
377
384
  }
378
385
  return result;
379
386
 
@@ -394,7 +401,8 @@ export class ExecutionEngineHttp implements IExecutionEngine {
394
401
  */
395
402
  async getPayload(
396
403
  fork: ForkName,
397
- payloadId: PayloadId
404
+ payloadId: PayloadId,
405
+ signal?: AbortSignal
398
406
  ): Promise<{
399
407
  executionPayload: ExecutionPayload;
400
408
  executionPayloadValue: Wei;
@@ -402,7 +410,7 @@ export class ExecutionEngineHttp implements IExecutionEngine {
402
410
  executionRequests?: ExecutionRequests;
403
411
  shouldOverrideBuilder?: boolean;
404
412
  }> {
405
- return this.withTransport(fork, undefined, (transport) => transport.getPayload(fork, payloadId));
413
+ return this.withTransport(fork, undefined, (transport) => transport.getPayload(fork, payloadId, signal));
406
414
  }
407
415
 
408
416
  async prunePayloadIdCache(): Promise<void> {