@lodestar/beacon-node 1.46.0-dev.ba5ee9aff0 → 1.46.0-dev.ba701016f3
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.
- package/lib/api/impl/config/constants.d.ts +1 -0
- package/lib/api/impl/config/constants.d.ts.map +1 -1
- package/lib/api/impl/config/constants.js +2 -1
- package/lib/api/impl/config/constants.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +2 -3
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/validator/index.js +1 -1
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +17 -3
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js +0 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
- package/lib/chain/bls/multithread/index.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.js +0 -1
- package/lib/chain/bls/multithread/index.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +11 -4
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadBid.js +1 -0
- package/lib/chain/errors/executionPayloadBid.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +2 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.js +1 -1
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +4 -4
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +6 -5
- package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
- package/lib/chain/seenCache/seenExecutionPayloadBids.js +16 -8
- package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
- package/lib/chain/validation/blobSidecar.js +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts +0 -5
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +70 -24
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/proposerPreferences.js +8 -8
- package/lib/chain/validation/proposerPreferences.js.map +1 -1
- package/lib/chain/validatorMonitor.js +1 -1
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +1 -1
- package/lib/execution/engine/types.js +1 -1
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/metrics/nodeJsMetrics.js +1 -1
- package/lib/metrics/nodeJsMetrics.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.js +2 -7
- package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
- package/lib/network/discv5/index.d.ts.map +1 -1
- package/lib/network/discv5/index.js +1 -4
- package/lib/network/discv5/index.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +5 -5
- package/lib/network/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +2 -9
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/peers/datastore.d.ts +1 -1
- package/lib/network/peers/datastore.d.ts.map +1 -1
- package/lib/network/peers/datastore.js +1 -1
- package/lib/network/peers/datastore.js.map +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +2 -1
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js +5 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js.map +1 -1
- package/lib/sync/constants.d.ts +6 -5
- package/lib/sync/constants.d.ts.map +1 -1
- package/lib/sync/constants.js +6 -5
- package/lib/sync/constants.js.map +1 -1
- package/lib/sync/range/batch.d.ts +10 -1
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +28 -10
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +30 -15
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/utils/batches.d.ts +18 -0
- package/lib/sync/range/utils/batches.d.ts.map +1 -1
- package/lib/sync/range/utils/batches.js +39 -0
- package/lib/sync/range/utils/batches.js.map +1 -1
- package/lib/util/profile.d.ts +3 -0
- package/lib/util/profile.d.ts.map +1 -1
- package/lib/util/profile.js +1 -27
- package/lib/util/profile.js.map +1 -1
- package/lib/util/sszBytes.js +1 -1
- package/package.json +25 -36
- package/src/api/impl/config/constants.ts +2 -0
- package/src/api/impl/lodestar/index.ts +2 -3
- package/src/api/impl/validator/index.ts +1 -1
- package/src/chain/archiveStore/archiveStore.ts +20 -3
- package/src/chain/archiveStore/historicalState/historicalStateRegen.ts +0 -1
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +1 -1
- package/src/chain/bls/multithread/index.ts +0 -1
- package/src/chain/errors/executionPayloadBid.ts +12 -4
- package/src/chain/opPools/aggregatedAttestationPool.ts +3 -1
- package/src/chain/prepareNextSlot.ts +1 -1
- package/src/chain/produceBlock/produceBlockBody.ts +5 -5
- package/src/chain/seenCache/seenExecutionPayloadBids.ts +22 -9
- package/src/chain/validation/blobSidecar.ts +1 -1
- package/src/chain/validation/executionPayloadBid.ts +87 -26
- package/src/chain/validation/proposerPreferences.ts +8 -8
- package/src/chain/validatorMonitor.ts +1 -1
- package/src/execution/engine/interface.ts +1 -1
- package/src/execution/engine/types.ts +1 -1
- package/src/metrics/nodeJsMetrics.ts +1 -1
- package/src/network/core/networkCoreWorkerHandler.ts +2 -6
- package/src/network/discv5/index.ts +1 -4
- package/src/network/libp2p/index.ts +2 -10
- package/src/network/peers/datastore.ts +1 -1
- package/src/network/processor/index.ts +2 -1
- package/src/network/reqresp/handlers/lightClientUpdatesByRange.ts +5 -1
- package/src/sync/constants.ts +6 -5
- package/src/sync/range/batch.ts +31 -10
- package/src/sync/range/chain.ts +36 -16
- package/src/sync/range/utils/batches.ts +44 -0
- package/src/util/profile.ts +1 -31
- package/src/util/sszBytes.ts +1 -1
- package/lib/bun-wrappers/prometheus-gc-stats.d.ts +0 -2
- package/lib/bun-wrappers/prometheus-gc-stats.d.ts.map +0 -1
- package/lib/bun-wrappers/prometheus-gc-stats.js +0 -8
- package/lib/bun-wrappers/prometheus-gc-stats.js.map +0 -1
- package/lib/network/peers/datastore_bun.d.ts +0 -3
- package/lib/network/peers/datastore_bun.d.ts.map +0 -1
- package/lib/network/peers/datastore_bun.js +0 -3
- package/lib/network/peers/datastore_bun.js.map +0 -1
- package/src/bun-wrappers/prometheus-gc-stats.ts +0 -7
- package/src/network/peers/datastore_bun.ts +0 -3
package/package.json
CHANGED
|
@@ -11,75 +11,65 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.46.0-dev.
|
|
14
|
+
"version": "1.46.0-dev.ba701016f3",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"
|
|
18
|
+
"typescript": "./src/index.ts",
|
|
19
19
|
"types": "./lib/index.d.ts",
|
|
20
20
|
"import": "./lib/index.js"
|
|
21
21
|
},
|
|
22
22
|
"./api": {
|
|
23
|
-
"
|
|
23
|
+
"typescript": "./src/api/index.ts",
|
|
24
24
|
"types": "./lib/api/index.d.ts",
|
|
25
25
|
"import": "./lib/api/index.js"
|
|
26
26
|
},
|
|
27
27
|
"./chain": {
|
|
28
|
-
"
|
|
28
|
+
"typescript": "./src/chain/index.ts",
|
|
29
29
|
"types": "./lib/chain/index.d.ts",
|
|
30
30
|
"import": "./lib/chain/index.js"
|
|
31
31
|
},
|
|
32
32
|
"./constants": {
|
|
33
|
-
"
|
|
33
|
+
"typescript": "./src/constants/index.ts",
|
|
34
34
|
"types": "./lib/constants/index.d.ts",
|
|
35
35
|
"import": "./lib/constants/index.js"
|
|
36
36
|
},
|
|
37
37
|
"./db": {
|
|
38
|
-
"
|
|
38
|
+
"typescript": "./src/db/index.ts",
|
|
39
39
|
"types": "./lib/db/index.d.ts",
|
|
40
40
|
"import": "./lib/db/index.js"
|
|
41
41
|
},
|
|
42
42
|
"./metrics": {
|
|
43
|
-
"
|
|
43
|
+
"typescript": "./src/metrics/index.ts",
|
|
44
44
|
"types": "./lib/metrics/index.d.ts",
|
|
45
45
|
"import": "./lib/metrics/index.js"
|
|
46
46
|
},
|
|
47
47
|
"./monitoring": {
|
|
48
|
-
"
|
|
48
|
+
"typescript": "./src/monitoring/index.ts",
|
|
49
49
|
"types": "./lib/monitoring/index.d.ts",
|
|
50
50
|
"import": "./lib/monitoring/index.js"
|
|
51
51
|
},
|
|
52
52
|
"./network": {
|
|
53
|
-
"
|
|
53
|
+
"typescript": "./src/network/index.ts",
|
|
54
54
|
"types": "./lib/network/index.d.ts",
|
|
55
55
|
"import": "./lib/network/index.js"
|
|
56
56
|
},
|
|
57
57
|
"./node": {
|
|
58
|
-
"
|
|
58
|
+
"typescript": "./src/node/index.ts",
|
|
59
59
|
"types": "./lib/node/index.d.ts",
|
|
60
60
|
"import": "./lib/node/index.js"
|
|
61
61
|
},
|
|
62
62
|
"./sync": {
|
|
63
|
-
"
|
|
63
|
+
"typescript": "./src/sync/index.ts",
|
|
64
64
|
"types": "./lib/sync/index.d.ts",
|
|
65
65
|
"import": "./lib/sync/index.js"
|
|
66
66
|
},
|
|
67
67
|
"./util": {
|
|
68
|
-
"
|
|
68
|
+
"typescript": "./src/util/index.ts",
|
|
69
69
|
"types": "./lib/util/index.d.ts",
|
|
70
70
|
"import": "./lib/util/index.js"
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
"imports": {
|
|
74
|
-
"#prometheus-gc-stats-wrapper": {
|
|
75
|
-
"bun": "./src/bun-wrappers/prometheus-gc-stats.ts",
|
|
76
|
-
"default": "@chainsafe/prometheus-gc-stats"
|
|
77
|
-
},
|
|
78
|
-
"#datastore-wrapper": {
|
|
79
|
-
"bun": "./src/network/peers/datastore_bun.ts",
|
|
80
|
-
"default": "datastore-level"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
73
|
"files": [
|
|
84
74
|
"src",
|
|
85
75
|
"lib",
|
|
@@ -136,20 +126,19 @@
|
|
|
136
126
|
"@libp2p/peer-id": "^6.0.4",
|
|
137
127
|
"@libp2p/prometheus-metrics": "^5.0.14",
|
|
138
128
|
"@libp2p/tcp": "^11.0.13",
|
|
139
|
-
"@lodestar/api": "^1.46.0-dev.
|
|
140
|
-
"@lodestar/config": "^1.46.0-dev.
|
|
141
|
-
"@lodestar/db": "^1.46.0-dev.
|
|
142
|
-
"@lodestar/fork-choice": "^1.46.0-dev.
|
|
143
|
-
"@lodestar/logger": "^1.46.0-dev.
|
|
144
|
-
"@lodestar/params": "^1.46.0-dev.
|
|
145
|
-
"@lodestar/reqresp": "^1.46.0-dev.
|
|
146
|
-
"@lodestar/state-transition": "^1.46.0-dev.
|
|
147
|
-
"@lodestar/types": "^1.46.0-dev.
|
|
148
|
-
"@lodestar/utils": "^1.46.0-dev.
|
|
149
|
-
"@lodestar/validator": "^1.46.0-dev.
|
|
129
|
+
"@lodestar/api": "^1.46.0-dev.ba701016f3",
|
|
130
|
+
"@lodestar/config": "^1.46.0-dev.ba701016f3",
|
|
131
|
+
"@lodestar/db": "^1.46.0-dev.ba701016f3",
|
|
132
|
+
"@lodestar/fork-choice": "^1.46.0-dev.ba701016f3",
|
|
133
|
+
"@lodestar/logger": "^1.46.0-dev.ba701016f3",
|
|
134
|
+
"@lodestar/params": "^1.46.0-dev.ba701016f3",
|
|
135
|
+
"@lodestar/reqresp": "^1.46.0-dev.ba701016f3",
|
|
136
|
+
"@lodestar/state-transition": "^1.46.0-dev.ba701016f3",
|
|
137
|
+
"@lodestar/types": "^1.46.0-dev.ba701016f3",
|
|
138
|
+
"@lodestar/utils": "^1.46.0-dev.ba701016f3",
|
|
139
|
+
"@lodestar/validator": "^1.46.0-dev.ba701016f3",
|
|
150
140
|
"@multiformats/multiaddr": "^13.0.1",
|
|
151
141
|
"datastore-core": "^11.0.2",
|
|
152
|
-
"datastore-fs": "^11.0.2",
|
|
153
142
|
"datastore-level": "^12.0.2",
|
|
154
143
|
"deepmerge": "^4.3.1",
|
|
155
144
|
"fastify": "^5.8.1",
|
|
@@ -169,7 +158,7 @@
|
|
|
169
158
|
"@libp2p/interface-internal": "^3.0.13",
|
|
170
159
|
"@libp2p/logger": "^6.2.2",
|
|
171
160
|
"@libp2p/utils": "^7.0.13",
|
|
172
|
-
"@lodestar/spec-test-util": "^1.46.0-dev.
|
|
161
|
+
"@lodestar/spec-test-util": "^1.46.0-dev.ba701016f3",
|
|
173
162
|
"@types/js-yaml": "^4.0.5",
|
|
174
163
|
"@types/qs": "^6.9.7",
|
|
175
164
|
"@types/tmp": "^0.2.3",
|
|
@@ -186,5 +175,5 @@
|
|
|
186
175
|
"beacon",
|
|
187
176
|
"blockchain"
|
|
188
177
|
],
|
|
189
|
-
"gitHead": "
|
|
178
|
+
"gitHead": "5170bb623eb2d1c9cdd25a368c776b410e2e25fb"
|
|
190
179
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
BUILDER_PAYMENT_THRESHOLD_DENOMINATOR,
|
|
13
13
|
BUILDER_PAYMENT_THRESHOLD_NUMERATOR,
|
|
14
14
|
BUILDER_WITHDRAWAL_PREFIX,
|
|
15
|
+
BYTES_PER_FIELD_ELEMENT,
|
|
15
16
|
COMPOUNDING_WITHDRAWAL_PREFIX,
|
|
16
17
|
CONSOLIDATION_REQUEST_TYPE,
|
|
17
18
|
DEPOSIT_CONTRACT_TREE_DEPTH,
|
|
@@ -131,6 +132,7 @@ export const specConstants = {
|
|
|
131
132
|
// Deneb types
|
|
132
133
|
BLOB_TX_TYPE: toHexByte(BLOB_TX_TYPE),
|
|
133
134
|
VERSIONED_HASH_VERSION_KZG: toHexByte(VERSIONED_HASH_VERSION_KZG),
|
|
135
|
+
BYTES_PER_FIELD_ELEMENT,
|
|
134
136
|
|
|
135
137
|
// electra
|
|
136
138
|
UNSET_DEPOSIT_REQUESTS_START_INDEX,
|
|
@@ -32,9 +32,8 @@ export function getLodestarApi({
|
|
|
32
32
|
}: Pick<ApiModules, "chain" | "config" | "db" | "network" | "sync">): ApplicationMethods<routes.lodestar.Endpoints> {
|
|
33
33
|
let writingHeapdump = false;
|
|
34
34
|
let writingProfile = false;
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
const defaultProfileMs = globalThis.Bun ? config.SLOT_DURATION_MS : SLOTS_PER_EPOCH * config.SLOT_DURATION_MS;
|
|
35
|
+
// profile the whole epoch by default
|
|
36
|
+
const defaultProfileMs = SLOTS_PER_EPOCH * config.SLOT_DURATION_MS;
|
|
38
37
|
|
|
39
38
|
return {
|
|
40
39
|
async writeHeapdump({thread = "main", dirpath = "."}) {
|
|
@@ -1808,7 +1808,7 @@ export function getValidatorApi(
|
|
|
1808
1808
|
const filteredRegistrations = registrations.filter((registration) => {
|
|
1809
1809
|
const {pubkey} = registration.message;
|
|
1810
1810
|
const validatorIndex = chain.pubkeyCache.getIndex(pubkey);
|
|
1811
|
-
if (validatorIndex === null) return false;
|
|
1811
|
+
if (validatorIndex === null || validatorIndex >= headState.validatorCount) return false;
|
|
1812
1812
|
|
|
1813
1813
|
const validator = headState.getValidator(validatorIndex);
|
|
1814
1814
|
const status = getValidatorStatus(validator, currentEpoch);
|
|
@@ -4,6 +4,7 @@ import {Checkpoint} from "@lodestar/types/phase0";
|
|
|
4
4
|
import {callFnWhenAwait} from "@lodestar/utils";
|
|
5
5
|
import {IBeaconDb} from "../../db/index.js";
|
|
6
6
|
import {Metrics} from "../../metrics/metrics.js";
|
|
7
|
+
import {callInNextEventLoop} from "../../util/eventLoop.js";
|
|
7
8
|
import {isOptimisticBlock} from "../../util/forkChoice.js";
|
|
8
9
|
import {JobItemQueue, isQueueErrorAborted} from "../../util/queue/index.js";
|
|
9
10
|
import {ChainEvent} from "../emitter.js";
|
|
@@ -166,9 +167,25 @@ export class ArchiveStore {
|
|
|
166
167
|
// Event handlers
|
|
167
168
|
//-------------------------------------------------------------------------
|
|
168
169
|
private onFinalizedCheckpoint = (finalized: CheckpointWithHex): void => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
// Decouple finalized-checkpoint processing from block import. This handler runs synchronously
|
|
171
|
+
// inside the `ChainEvent.forkChoiceFinalized` emit from `forkChoice.onBlock()` during
|
|
172
|
+
// `importBlock()`; deferring the work to the next event-loop tick keeps any failure here off the
|
|
173
|
+
// import call stack, so it can't abort `importBlock()` before `regen.processState()` caches the
|
|
174
|
+
// head post-state — the deep-sync wedge this PR fixes (#9716).
|
|
175
|
+
//
|
|
176
|
+
// `jobQueue.push()` can throw synchronously (queue aborted / full) or reject asynchronously;
|
|
177
|
+
// awaiting it inside the deferred callback funnels both failure modes into the one catch.
|
|
178
|
+
callInNextEventLoop(async () => {
|
|
179
|
+
try {
|
|
180
|
+
await this.jobQueue.push(finalized);
|
|
181
|
+
} catch (e) {
|
|
182
|
+
if (!isQueueErrorAborted(e)) {
|
|
183
|
+
this.logger.error(
|
|
184
|
+
"Error queuing finalized checkpoint",
|
|
185
|
+
{epoch: finalized.epoch, rootHex: finalized.rootHex},
|
|
186
|
+
e as Error
|
|
187
|
+
);
|
|
188
|
+
}
|
|
172
189
|
}
|
|
173
190
|
});
|
|
174
191
|
};
|
|
@@ -39,7 +39,6 @@ export class HistoricalStateRegen implements HistoricalStateWorkerApi {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const worker = new Worker(path.join(WORKER_DIR, "worker.js"), {
|
|
42
|
-
suppressTranspileTS: Boolean(globalThis.Bun),
|
|
43
42
|
workerData,
|
|
44
43
|
} as ConstructorParameters<typeof Worker>[1]);
|
|
45
44
|
|
|
@@ -61,7 +61,7 @@ export function verifyExecutionPayloadEnvelope(
|
|
|
61
61
|
`Prev randao mismatch between bid and payload bid=${toHex(bid.prevRandao)} payload=${toHex(payload.prevRandao)}`
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
if (bid.gasLimit !== payload.gasLimit) {
|
|
64
|
+
if (bid.gasLimit !== BigInt(payload.gasLimit)) {
|
|
65
65
|
throw new Error(`Gas limit mismatch between payload and bid payload=${payload.gasLimit} bid=${bid.gasLimit}`);
|
|
66
66
|
}
|
|
67
67
|
if (!byteArrayEquals(bid.blockHash, payload.blockHash)) {
|
|
@@ -267,7 +267,6 @@ export class BlsMultiThreadWorkerPool implements IBlsVerifier {
|
|
|
267
267
|
for (let i = 0; i < poolSize; i++) {
|
|
268
268
|
const workerData: WorkerData = {workerId: i};
|
|
269
269
|
const worker = new Worker(path.join(workerDir, "worker.js"), {
|
|
270
|
-
suppressTranspileTS: Boolean(globalThis.Bun),
|
|
271
270
|
workerData,
|
|
272
271
|
} as ConstructorParameters<typeof Worker>[1]);
|
|
273
272
|
|
|
@@ -5,6 +5,7 @@ export enum ExecutionPayloadBidErrorCode {
|
|
|
5
5
|
BUILDER_NOT_ELIGIBLE = "EXECUTION_PAYLOAD_BID_ERROR_BUILDER_NOT_ELIGIBLE",
|
|
6
6
|
INVALID_BUILDER_VERSION = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_BUILDER_VERSION",
|
|
7
7
|
NON_ZERO_EXECUTION_PAYMENT = "EXECUTION_PAYLOAD_BID_ERROR_NON_ZERO_EXECUTION_PAYMENT",
|
|
8
|
+
INCOMPATIBLE_WITH_HEAD = "EXECUTION_PAYLOAD_BID_ERROR_INCOMPATIBLE_WITH_HEAD",
|
|
8
9
|
BID_ALREADY_KNOWN = "EXECUTION_PAYLOAD_BID_ERROR_BID_ALREADY_KNOWN",
|
|
9
10
|
BID_TOO_LOW = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_LOW",
|
|
10
11
|
BID_TOO_HIGH = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_HIGH",
|
|
@@ -31,7 +32,14 @@ export type ExecutionPayloadBidErrorType =
|
|
|
31
32
|
| {
|
|
32
33
|
code: ExecutionPayloadBidErrorCode.NON_ZERO_EXECUTION_PAYMENT;
|
|
33
34
|
builderIndex: BuilderIndex;
|
|
34
|
-
executionPayment:
|
|
35
|
+
executionPayment: bigint;
|
|
36
|
+
}
|
|
37
|
+
| {
|
|
38
|
+
code: ExecutionPayloadBidErrorCode.INCOMPATIBLE_WITH_HEAD;
|
|
39
|
+
slot: Slot;
|
|
40
|
+
parentBlockRoot: RootHex;
|
|
41
|
+
parentBlockHash: RootHex;
|
|
42
|
+
headBlockRoot: RootHex;
|
|
35
43
|
}
|
|
36
44
|
| {
|
|
37
45
|
code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN;
|
|
@@ -73,9 +81,9 @@ export type ExecutionPayloadBidErrorType =
|
|
|
73
81
|
| {
|
|
74
82
|
code: ExecutionPayloadBidErrorCode.PROPOSER_PREFERENCES_GAS_LIMIT_MISMATCH;
|
|
75
83
|
builderIndex: BuilderIndex;
|
|
76
|
-
bidGasLimit:
|
|
77
|
-
parentGasLimit:
|
|
78
|
-
targetGasLimit:
|
|
84
|
+
bidGasLimit: bigint;
|
|
85
|
+
parentGasLimit: bigint;
|
|
86
|
+
targetGasLimit: bigint;
|
|
79
87
|
};
|
|
80
88
|
|
|
81
89
|
export class ExecutionPayloadBidError extends GossipActionError<ExecutionPayloadBidErrorType> {}
|
|
@@ -234,6 +234,7 @@ export class AggregatedAttestationPool {
|
|
|
234
234
|
const stateEpoch = state.epoch;
|
|
235
235
|
const statePrevEpoch = stateEpoch - 1;
|
|
236
236
|
const rootCache = new RootCache(state);
|
|
237
|
+
const gloasState = isStatePostGloas(state) ? state : null;
|
|
237
238
|
|
|
238
239
|
const notSeenValidatorsFn = getNotSeenValidatorsFn(this.config, shufflingCache, state);
|
|
239
240
|
const validateAttestationDataFn = getValidateAttestationDataFn(forkChoice, state);
|
|
@@ -361,7 +362,8 @@ export class AggregatedAttestationPool {
|
|
|
361
362
|
inclusionDistance,
|
|
362
363
|
stateEpoch,
|
|
363
364
|
rootCache,
|
|
364
|
-
|
|
365
|
+
gloasState?.executionPayloadAvailability ?? null,
|
|
366
|
+
gloasState?.latestExecutionPayloadBid.slot ?? null
|
|
365
367
|
);
|
|
366
368
|
|
|
367
369
|
const weight =
|
|
@@ -173,7 +173,7 @@ export class PrepareNextSlotScheduler {
|
|
|
173
173
|
// Apply parent payload once here as it's reused by EL prep and SSE emit below
|
|
174
174
|
let stateAfterParentPayload: IBeaconStateViewBellatrix = updatedPrepareState;
|
|
175
175
|
if (isStatePostGloas(updatedPrepareState)) {
|
|
176
|
-
// Spec: should_build_on_full(store, head)
|
|
176
|
+
// Spec: should_build_on_full(store, head, slot) - see produceBlockBody.ts for context.
|
|
177
177
|
if (this.chain.forkChoice.shouldBuildOnFull(updatedHead, prepareSlot)) {
|
|
178
178
|
parentBlockHash = updatedPrepareState.latestExecutionPayloadBid.blockHash;
|
|
179
179
|
// Skip applying parent payload unless we're proposing the next slot or have to emit payload_attributes events
|
|
@@ -276,7 +276,7 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
276
276
|
let parentExecutionRequests: gloas.ExecutionRequests;
|
|
277
277
|
// Apply parent payload once here as it's reused by EL prep and voluntary exit filtering below
|
|
278
278
|
let stateAfterParentPayload: IBeaconStateViewBellatrix = currentState;
|
|
279
|
-
// Spec: should_build_on_full(store, head). `parentBlock` is the proposer's head
|
|
279
|
+
// Spec: should_build_on_full(store, head, slot). `parentBlock` is the proposer's head
|
|
280
280
|
// (set by chain.getProposerHead(slot)). Returns false when the PTC majority signalled
|
|
281
281
|
// the blob data is not available or the payload was not timely, forcing a build on EMPTY (reorg).
|
|
282
282
|
const isBuildingOnFull = this.forkChoice.shouldBuildOnFull(parentBlock, blockSlot);
|
|
@@ -345,11 +345,11 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
345
345
|
blockHash: executionPayload.blockHash,
|
|
346
346
|
prevRandao: currentState.getRandaoMix(currentState.epoch),
|
|
347
347
|
feeRecipient: executionPayload.feeRecipient,
|
|
348
|
-
gasLimit: executionPayload.gasLimit,
|
|
348
|
+
gasLimit: BigInt(executionPayload.gasLimit),
|
|
349
349
|
builderIndex: BUILDER_INDEX_SELF_BUILD,
|
|
350
350
|
slot: blockSlot,
|
|
351
351
|
value: 0,
|
|
352
|
-
executionPayment:
|
|
352
|
+
executionPayment: 0n,
|
|
353
353
|
blobKzgCommitments: blobsBundle.commitments,
|
|
354
354
|
executionRequestsRoot: ssz.gloas.ExecutionRequests.hashTreeRoot(executionRequests as gloas.ExecutionRequests),
|
|
355
355
|
};
|
|
@@ -949,7 +949,7 @@ function getProposerTargetGasLimit(
|
|
|
949
949
|
prepareSlot: Slot,
|
|
950
950
|
parentBlockRoot: Root,
|
|
951
951
|
parentBlockHash: Bytes32
|
|
952
|
-
):
|
|
952
|
+
): bigint {
|
|
953
953
|
const parentBlockRootHex = toRootHex(parentBlockRoot);
|
|
954
954
|
const parentBlock = chain.forkChoice.getBlockHexDefaultStatus(parentBlockRootHex);
|
|
955
955
|
const dependentRootHex = (() => {
|
|
@@ -979,7 +979,7 @@ function getProposerTargetGasLimit(
|
|
|
979
979
|
`Cannot resolve parent payload gas_limit for proposer targetGasLimit fallback parentBlockRoot=${parentBlockRootHex} parentBlockHash=${toRootHex(parentBlockHash)}`
|
|
980
980
|
);
|
|
981
981
|
}
|
|
982
|
-
return parentPayloadVariant.executionPayloadGasLimit;
|
|
982
|
+
return BigInt(parentPayloadVariant.executionPayloadGasLimit);
|
|
983
983
|
}
|
|
984
984
|
|
|
985
985
|
export async function produceCommonBlockBody<T extends BlockType>(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {BuilderIndex, Slot} from "@lodestar/types";
|
|
1
|
+
import {BuilderIndex, RootHex, Slot} from "@lodestar/types";
|
|
2
2
|
import {MapDef} from "@lodestar/utils";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -7,29 +7,42 @@ import {MapDef} from "@lodestar/utils";
|
|
|
7
7
|
const SLOTS_RETAINED = 2;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Tracks execution payload bids we've already seen per
|
|
10
|
+
* Tracks execution payload bids we've already seen per
|
|
11
|
+
* (slot, builder, parent block hash, parent block root).
|
|
11
12
|
*/
|
|
12
13
|
export class SeenExecutionPayloadBids {
|
|
13
|
-
private readonly
|
|
14
|
+
private readonly branchesByBuilderBySlot = new MapDef<Slot, MapDef<BuilderIndex, Set<string>>>(
|
|
15
|
+
() => new MapDef<BuilderIndex, Set<string>>(() => new Set<string>())
|
|
16
|
+
);
|
|
14
17
|
private lowestPermissibleSlot: Slot = 0;
|
|
15
18
|
|
|
16
|
-
isKnown(slot: Slot, builderIndex: BuilderIndex): boolean {
|
|
17
|
-
return
|
|
19
|
+
isKnown(slot: Slot, builderIndex: BuilderIndex, parentBlockHash: RootHex, parentBlockRoot: RootHex): boolean {
|
|
20
|
+
return (
|
|
21
|
+
this.branchesByBuilderBySlot.get(slot)?.get(builderIndex)?.has(branchKey(parentBlockHash, parentBlockRoot)) ===
|
|
22
|
+
true
|
|
23
|
+
);
|
|
18
24
|
}
|
|
19
25
|
|
|
20
|
-
add(slot: Slot, builderIndex: BuilderIndex): void {
|
|
26
|
+
add(slot: Slot, builderIndex: BuilderIndex, parentBlockHash: RootHex, parentBlockRoot: RootHex): void {
|
|
21
27
|
if (slot < this.lowestPermissibleSlot) {
|
|
22
28
|
throw Error(`slot ${slot} < lowestPermissibleSlot ${this.lowestPermissibleSlot}`);
|
|
23
29
|
}
|
|
24
|
-
this.
|
|
30
|
+
this.branchesByBuilderBySlot
|
|
31
|
+
.getOrDefault(slot)
|
|
32
|
+
.getOrDefault(builderIndex)
|
|
33
|
+
.add(branchKey(parentBlockHash, parentBlockRoot));
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
prune(currentSlot: Slot): void {
|
|
28
37
|
this.lowestPermissibleSlot = Math.max(currentSlot - SLOTS_RETAINED, 0);
|
|
29
|
-
for (const slot of this.
|
|
38
|
+
for (const slot of this.branchesByBuilderBySlot.keys()) {
|
|
30
39
|
if (slot < this.lowestPermissibleSlot) {
|
|
31
|
-
this.
|
|
40
|
+
this.branchesByBuilderBySlot.delete(slot);
|
|
32
41
|
}
|
|
33
42
|
}
|
|
34
43
|
}
|
|
35
44
|
}
|
|
45
|
+
|
|
46
|
+
function branchKey(parentBlockHash: RootHex, parentBlockRoot: RootHex): string {
|
|
47
|
+
return `${parentBlockHash}:${parentBlockRoot}`;
|
|
48
|
+
}
|
|
@@ -111,7 +111,7 @@ export async function validateGossipBlobSidecar(
|
|
|
111
111
|
|
|
112
112
|
// [REJECT] The blob is from a higher slot than its parent.
|
|
113
113
|
if (parentBlock.slot >= blobSlot) {
|
|
114
|
-
throw new BlobSidecarGossipError(GossipAction.
|
|
114
|
+
throw new BlobSidecarGossipError(GossipAction.REJECT, {
|
|
115
115
|
code: BlobSidecarErrorCode.NOT_LATER_THAN_PARENT,
|
|
116
116
|
parentSlot: parentBlock.slot,
|
|
117
117
|
slot: blobSlot,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {PublicKey} from "@chainsafe/blst";
|
|
2
|
+
import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
|
|
2
3
|
import {PAYLOAD_BUILDER_VERSION} from "@lodestar/params";
|
|
3
4
|
import {
|
|
4
5
|
computeEpochAtSlot,
|
|
@@ -8,7 +9,7 @@ import {
|
|
|
8
9
|
isGasLimitTargetCompatible,
|
|
9
10
|
isStatePostGloas,
|
|
10
11
|
} from "@lodestar/state-transition";
|
|
11
|
-
import {ValidatorIndex, gloas} from "@lodestar/types";
|
|
12
|
+
import {RootHex, Slot, ValidatorIndex, gloas} from "@lodestar/types";
|
|
12
13
|
import {byteArrayEquals, toHex, toRootHex} from "@lodestar/utils";
|
|
13
14
|
import {getShufflingDependentRoot} from "../../util/dependentRoot.js";
|
|
14
15
|
import {ExecutionPayloadBidError, ExecutionPayloadBidErrorCode, GossipAction} from "../errors/index.js";
|
|
@@ -36,12 +37,45 @@ const BID_INCREMENT_CAP_GWEI = 10_000_000;
|
|
|
36
37
|
* Return the minimum value a new bid must have to be forwarded given the current highest bid.
|
|
37
38
|
* Division before multiplication to stay within safe integer range for max gwei values.
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
+
function getMinBidValue(currentHighestBid: number): number {
|
|
40
41
|
const relativeIncrement = Math.floor(currentHighestBid / 10_000) * BID_INCREMENT_BPS;
|
|
41
42
|
const increment = Math.min(Math.max(BID_INCREMENT_FLOOR_GWEI, relativeIncrement), BID_INCREMENT_CAP_GWEI);
|
|
42
43
|
return currentHighestBid + increment;
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Check whether a bid builds on one of the paths compatible with the local head branch.
|
|
48
|
+
*
|
|
49
|
+
* The direct parent path is always allowed for proposer-boost reorgs. Otherwise the bid
|
|
50
|
+
* must build on the local head's full or empty payload variant, as selected for its slot.
|
|
51
|
+
*/
|
|
52
|
+
function isBidCompatibleWithHead(
|
|
53
|
+
forkChoice: IForkChoice,
|
|
54
|
+
head: ProtoBlock,
|
|
55
|
+
bidSlot: Slot,
|
|
56
|
+
bidParentBlockRoot: RootHex,
|
|
57
|
+
bidParentBlockHash: RootHex
|
|
58
|
+
): boolean {
|
|
59
|
+
const buildsOnParentBlock = bidParentBlockRoot === head.parentRoot;
|
|
60
|
+
const buildsOnParentPayload = bidParentBlockHash === head.parentBlockHash;
|
|
61
|
+
|
|
62
|
+
if (buildsOnParentBlock && buildsOnParentPayload) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (bidParentBlockRoot !== head.blockRoot) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const buildsOnHeadPayload = bidParentBlockHash === head.executionPayloadBlockHash;
|
|
71
|
+
|
|
72
|
+
if (forkChoice.shouldBuildOnFull(head, bidSlot)) {
|
|
73
|
+
return buildsOnHeadPayload;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return buildsOnParentPayload;
|
|
77
|
+
}
|
|
78
|
+
|
|
45
79
|
export async function validateApiExecutionPayloadBid(
|
|
46
80
|
chain: IBeaconChain,
|
|
47
81
|
signedExecutionPayloadBid: gloas.SignedExecutionPayloadBid
|
|
@@ -61,8 +95,8 @@ async function validateExecutionPayloadBid(
|
|
|
61
95
|
signedExecutionPayloadBid: gloas.SignedExecutionPayloadBid
|
|
62
96
|
): Promise<{proposerIndex: ValidatorIndex}> {
|
|
63
97
|
const bid = signedExecutionPayloadBid.message;
|
|
64
|
-
const
|
|
65
|
-
const
|
|
98
|
+
const bidParentBlockRoot = toRootHex(bid.parentBlockRoot);
|
|
99
|
+
const bidParentBlockHash = toRootHex(bid.parentBlockHash);
|
|
66
100
|
|
|
67
101
|
// [IGNORE] `bid.slot` is the current slot, or the next slot (`bid.slot - 1` is current), allowing for `MAXIMUM_GOSSIP_CLOCK_DISPARITY`.
|
|
68
102
|
if (
|
|
@@ -76,14 +110,40 @@ async function validateExecutionPayloadBid(
|
|
|
76
110
|
});
|
|
77
111
|
}
|
|
78
112
|
|
|
113
|
+
// [IGNORE] The bid is compatible with the current head branch.
|
|
114
|
+
const head = chain.forkChoice.getHead();
|
|
115
|
+
if (!isBidCompatibleWithHead(chain.forkChoice, head, bid.slot, bidParentBlockRoot, bidParentBlockHash)) {
|
|
116
|
+
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
117
|
+
code: ExecutionPayloadBidErrorCode.INCOMPATIBLE_WITH_HEAD,
|
|
118
|
+
slot: bid.slot,
|
|
119
|
+
parentBlockRoot: bidParentBlockRoot,
|
|
120
|
+
parentBlockHash: bidParentBlockHash,
|
|
121
|
+
headBlockRoot: head.blockRoot,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// [IGNORE] this is the first signed bid seen with a valid signature from the given builder for
|
|
126
|
+
// the tuple `(bid.slot, bid.parent_block_hash, bid.parent_block_root)`.
|
|
127
|
+
// Entries are only added after signature verification, so known tuples can be dropped before
|
|
128
|
+
// state regeneration and the other expensive validation steps.
|
|
129
|
+
if (chain.seenExecutionPayloadBids.isKnown(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot)) {
|
|
130
|
+
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
131
|
+
code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN,
|
|
132
|
+
builderIndex: bid.builderIndex,
|
|
133
|
+
slot: bid.slot,
|
|
134
|
+
parentBlockRoot: bidParentBlockRoot,
|
|
135
|
+
parentBlockHash: bidParentBlockHash,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
79
139
|
// [IGNORE] `bid.parent_block_root` is the hash tree root of a known beacon block in fork choice.
|
|
80
140
|
// Moved earlier than the spec ordering so we can derive the proposer dependent root for the
|
|
81
141
|
// proposer-preferences lookup below from a known fork-choice block.
|
|
82
|
-
const parentBlock = chain.forkChoice.getBlockHexDefaultStatus(
|
|
142
|
+
const parentBlock = chain.forkChoice.getBlockHexDefaultStatus(bidParentBlockRoot);
|
|
83
143
|
if (parentBlock === null) {
|
|
84
144
|
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
85
145
|
code: ExecutionPayloadBidErrorCode.UNKNOWN_BLOCK_ROOT,
|
|
86
|
-
parentBlockRoot:
|
|
146
|
+
parentBlockRoot: bidParentBlockRoot,
|
|
87
147
|
});
|
|
88
148
|
}
|
|
89
149
|
|
|
@@ -122,7 +182,7 @@ async function validateExecutionPayloadBid(
|
|
|
122
182
|
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
123
183
|
code: ExecutionPayloadBidErrorCode.NO_MATCHING_PROPOSER_PREFERENCES,
|
|
124
184
|
slot: bid.slot,
|
|
125
|
-
parentBlockRoot:
|
|
185
|
+
parentBlockRoot: bidParentBlockRoot,
|
|
126
186
|
dependentRoot: "unknown",
|
|
127
187
|
});
|
|
128
188
|
}
|
|
@@ -132,7 +192,7 @@ async function validateExecutionPayloadBid(
|
|
|
132
192
|
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
133
193
|
code: ExecutionPayloadBidErrorCode.NO_MATCHING_PROPOSER_PREFERENCES,
|
|
134
194
|
slot: bid.slot,
|
|
135
|
-
parentBlockRoot:
|
|
195
|
+
parentBlockRoot: bidParentBlockRoot,
|
|
136
196
|
dependentRoot: dependentRootHex,
|
|
137
197
|
});
|
|
138
198
|
}
|
|
@@ -143,7 +203,7 @@ async function validateExecutionPayloadBid(
|
|
|
143
203
|
.catch(() => {
|
|
144
204
|
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
145
205
|
code: ExecutionPayloadBidErrorCode.UNKNOWN_BLOCK_ROOT,
|
|
146
|
-
parentBlockRoot:
|
|
206
|
+
parentBlockRoot: bidParentBlockRoot,
|
|
147
207
|
});
|
|
148
208
|
});
|
|
149
209
|
|
|
@@ -184,7 +244,7 @@ async function validateExecutionPayloadBid(
|
|
|
184
244
|
}
|
|
185
245
|
|
|
186
246
|
// [REJECT] `bid.execution_payment` is zero.
|
|
187
|
-
if (bid.executionPayment !==
|
|
247
|
+
if (bid.executionPayment !== 0n) {
|
|
188
248
|
throw new ExecutionPayloadBidError(GossipAction.REJECT, {
|
|
189
249
|
code: ExecutionPayloadBidErrorCode.NON_ZERO_EXECUTION_PAYMENT,
|
|
190
250
|
builderIndex: bid.builderIndex,
|
|
@@ -208,11 +268,11 @@ async function validateExecutionPayloadBid(
|
|
|
208
268
|
// payload's hash) and EMPTY parents (EMPTY/PENDING variants carry the inherited parent
|
|
209
269
|
// payload's hash, since the new block doesn't have its own payload). Variant carries the
|
|
210
270
|
// executed payload's gas_limit, which we use as `parent_gas_limit` below.
|
|
211
|
-
const parentPayloadVariant = chain.forkChoice.getBlockHexAndBlockHash(
|
|
271
|
+
const parentPayloadVariant = chain.forkChoice.getBlockHexAndBlockHash(bidParentBlockRoot, bidParentBlockHash);
|
|
212
272
|
if (parentPayloadVariant === null || parentPayloadVariant.executionPayloadBlockHash === null) {
|
|
213
273
|
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
214
274
|
code: ExecutionPayloadBidErrorCode.UNKNOWN_PARENT_BLOCK_HASH,
|
|
215
|
-
parentBlockHash:
|
|
275
|
+
parentBlockHash: bidParentBlockHash,
|
|
216
276
|
});
|
|
217
277
|
}
|
|
218
278
|
|
|
@@ -220,7 +280,7 @@ async function validateExecutionPayloadBid(
|
|
|
220
280
|
// where `parent_gas_limit` is the `gas_limit` of the parent execution payload and
|
|
221
281
|
// `target_gas_limit` is `proposer_preferences.target_gas_limit`.
|
|
222
282
|
const bidGasLimit = bid.gasLimit;
|
|
223
|
-
const parentGasLimit = parentPayloadVariant.executionPayloadGasLimit;
|
|
283
|
+
const parentGasLimit = BigInt(parentPayloadVariant.executionPayloadGasLimit);
|
|
224
284
|
const targetGasLimit = proposerPreferences.message.targetGasLimit;
|
|
225
285
|
if (!isGasLimitTargetCompatible(parentGasLimit, bidGasLimit, targetGasLimit)) {
|
|
226
286
|
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
@@ -245,23 +305,12 @@ async function validateExecutionPayloadBid(
|
|
|
245
305
|
});
|
|
246
306
|
}
|
|
247
307
|
|
|
248
|
-
// [IGNORE] this is the first signed bid seen with a valid signature from the given builder for this slot.
|
|
249
|
-
if (chain.seenExecutionPayloadBids.isKnown(bid.slot, bid.builderIndex)) {
|
|
250
|
-
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
251
|
-
code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN,
|
|
252
|
-
builderIndex: bid.builderIndex,
|
|
253
|
-
slot: bid.slot,
|
|
254
|
-
parentBlockRoot: parentBlockRootHex,
|
|
255
|
-
parentBlockHash: parentBlockHashHex,
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
308
|
// [IGNORE] this bid is the highest value bid seen for the tuple
|
|
260
309
|
// `(bid.slot, bid.parent_block_hash, bid.parent_block_root)`.
|
|
261
310
|
// As a DoS prevention measure, the bid must also exceed the current highest bid by a minimum
|
|
262
311
|
// increment, see https://github.com/ethereum/consensus-specs/pull/4831. This prevents spam
|
|
263
312
|
// from builders submitting numerous bids with minimal value increments.
|
|
264
|
-
const bestBid = chain.executionPayloadBidPool.getBestBid(bid.slot,
|
|
313
|
+
const bestBid = chain.executionPayloadBidPool.getBestBid(bid.slot, bidParentBlockHash, bidParentBlockRoot);
|
|
265
314
|
if (bestBid !== null && bid.value < getMinBidValue(bestBid.message.value)) {
|
|
266
315
|
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
267
316
|
code: ExecutionPayloadBidErrorCode.BID_TOO_LOW,
|
|
@@ -306,8 +355,20 @@ async function validateExecutionPayloadBid(
|
|
|
306
355
|
});
|
|
307
356
|
}
|
|
308
357
|
|
|
358
|
+
// Repeat the seen check after the awaited signature verification to prevent concurrent bids
|
|
359
|
+
// for the same builder and tuple from both passing validation.
|
|
360
|
+
if (chain.seenExecutionPayloadBids.isKnown(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot)) {
|
|
361
|
+
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
362
|
+
code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN,
|
|
363
|
+
builderIndex: bid.builderIndex,
|
|
364
|
+
slot: bid.slot,
|
|
365
|
+
parentBlockRoot: bidParentBlockRoot,
|
|
366
|
+
parentBlockHash: bidParentBlockHash,
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
|
|
309
370
|
// Valid
|
|
310
|
-
chain.seenExecutionPayloadBids.add(bid.slot, bid.builderIndex);
|
|
371
|
+
chain.seenExecutionPayloadBids.add(bid.slot, bid.builderIndex, bidParentBlockHash, bidParentBlockRoot);
|
|
311
372
|
|
|
312
373
|
return {proposerIndex: proposerPreferences.message.validatorIndex};
|
|
313
374
|
}
|