@lodestar/beacon-node 2.0.0-rc.1 → 2.0.0
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/beacon/blocks/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +4 -3
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +1 -1
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +74 -44
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/chain.d.ts +1 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +18 -21
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +6 -1
- 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/errors/executionPayloadEnvelope.d.ts +7 -0
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +1 -0
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts +45 -0
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +265 -69
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +6 -2
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +54 -64
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/validation/attesterSlashing.d.ts.map +1 -1
- package/lib/chain/validation/attesterSlashing.js +4 -2
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +17 -2
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +21 -5
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +4 -2
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts +2 -2
- package/lib/chain/validation/signatureSets/contributionAndProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/contributionAndProof.js +2 -2
- package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommittee.js +2 -2
- package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.js +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.d.ts.map +1 -1
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js +2 -2
- package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
- package/lib/chain/validation/syncCommittee.d.ts +1 -1
- package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/syncCommittee.js +5 -5
- package/lib/chain/validation/syncCommittee.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +3 -3
- package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.d.ts.map +1 -1
- package/lib/chain/validation/voluntaryExit.js +39 -6
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/execution/engine/blockHash.d.ts +12 -0
- package/lib/execution/engine/blockHash.d.ts.map +1 -0
- package/lib/execution/engine/blockHash.js +17 -0
- package/lib/execution/engine/blockHash.js.map +1 -0
- package/lib/execution/engine/http.d.ts +2 -2
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +13 -7
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +16 -3
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/interface.js +11 -0
- package/lib/execution/engine/interface.js.map +1 -1
- package/lib/execution/engine/jsonRpcHttpClient.d.ts +2 -0
- package/lib/execution/engine/jsonRpcHttpClient.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcHttpClient.js +14 -6
- package/lib/execution/engine/jsonRpcHttpClient.js.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.d.ts +2 -2
- package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.js +4 -4
- package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +6 -6
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/payloadIdCache.d.ts +6 -1
- package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
- package/lib/execution/engine/payloadIdCache.js +7 -2
- package/lib/execution/engine/payloadIdCache.js.map +1 -1
- package/lib/execution/engine/restHttpClient.d.ts.map +1 -1
- package/lib/execution/engine/restHttpClient.js +9 -5
- package/lib/execution/engine/restHttpClient.js.map +1 -1
- package/lib/execution/engine/restTransport.d.ts +2 -2
- package/lib/execution/engine/restTransport.d.ts.map +1 -1
- package/lib/execution/engine/restTransport.js +4 -4
- package/lib/execution/engine/restTransport.js.map +1 -1
- package/lib/execution/engine/signal.d.ts +6 -0
- package/lib/execution/engine/signal.d.ts.map +1 -0
- package/lib/execution/engine/signal.js +24 -0
- package/lib/execution/engine/signal.js.map +1 -0
- package/lib/execution/engine/transport.d.ts +2 -2
- package/lib/execution/engine/transport.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +5 -0
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +5 -0
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +1 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +5 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/core/events.d.ts +6 -2
- package/lib/network/core/events.d.ts.map +1 -1
- package/lib/network/core/events.js +9 -0
- package/lib/network/core/events.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.js +3 -2
- package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
- package/lib/network/gossip/gossipsub.d.ts +1 -0
- package/lib/network/gossip/gossipsub.d.ts.map +1 -1
- package/lib/network/gossip/gossipsub.js +3 -0
- package/lib/network/gossip/gossipsub.js.map +1 -1
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +6 -1
- package/lib/network/network.js.map +1 -1
- package/lib/network/peers/peerManager.d.ts.map +1 -1
- package/lib/network/peers/peerManager.js +22 -2
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.d.ts +2 -0
- package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.js +11 -2
- package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
- package/lib/sync/range/batch.d.ts +4 -0
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +12 -0
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +17 -2
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +52 -19
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/range.d.ts.map +1 -1
- package/lib/sync/range/range.js +1 -0
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/range/utils/batches.d.ts +20 -4
- package/lib/sync/range/utils/batches.d.ts.map +1 -1
- package/lib/sync/range/utils/batches.js +31 -13
- package/lib/sync/range/utils/batches.js.map +1 -1
- package/lib/sync/range/utils/peerBalancer.d.ts +1 -1
- package/lib/sync/range/utils/peerBalancer.d.ts.map +1 -1
- package/lib/sync/range/utils/peerBalancer.js +5 -2
- package/lib/sync/range/utils/peerBalancer.js.map +1 -1
- package/lib/sync/types.d.ts +2 -0
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +100 -19
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +8 -0
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +43 -23
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +5 -4
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/util/asyncIterableToEvents.d.ts +20 -3
- package/lib/util/asyncIterableToEvents.d.ts.map +1 -1
- package/lib/util/asyncIterableToEvents.js +76 -20
- package/lib/util/asyncIterableToEvents.js.map +1 -1
- package/lib/util/dataColumns.d.ts +1 -1
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +4 -1
- package/lib/util/dataColumns.js.map +1 -1
- package/package.json +25 -25
- package/src/api/impl/beacon/blocks/index.ts +4 -3
- package/src/api/impl/beacon/pool/index.ts +1 -1
- package/src/api/impl/validator/index.ts +107 -61
- package/src/chain/archiveStore/utils/archiveBlocks.ts +1 -1
- package/src/chain/chain.ts +17 -41
- package/src/chain/errors/executionPayloadBid.ts +6 -0
- package/src/chain/errors/executionPayloadEnvelope.ts +8 -0
- package/src/chain/prepareNextSlot.ts +347 -89
- package/src/chain/produceBlock/produceBlockBody.ts +69 -80
- package/src/chain/validation/attesterSlashing.ts +4 -2
- package/src/chain/validation/executionPayloadBid.ts +20 -2
- package/src/chain/validation/executionPayloadEnvelope.ts +28 -5
- package/src/chain/validation/proposerSlashing.ts +4 -2
- package/src/chain/validation/signatureSets/contributionAndProof.ts +4 -6
- package/src/chain/validation/signatureSets/syncCommittee.ts +2 -3
- package/src/chain/validation/signatureSets/syncCommitteeContribution.ts +2 -3
- package/src/chain/validation/signatureSets/syncCommitteeSelectionProof.ts +2 -3
- package/src/chain/validation/syncCommittee.ts +3 -5
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +3 -3
- package/src/chain/validation/voluntaryExit.ts +44 -6
- package/src/execution/engine/blockHash.ts +27 -0
- package/src/execution/engine/http.ts +18 -10
- package/src/execution/engine/interface.ts +18 -3
- package/src/execution/engine/jsonRpcHttpClient.ts +26 -14
- package/src/execution/engine/jsonRpcTransport.ts +8 -4
- package/src/execution/engine/mock.ts +13 -8
- package/src/execution/engine/payloadIdCache.ts +12 -4
- package/src/execution/engine/restHttpClient.ts +17 -11
- package/src/execution/engine/restTransport.ts +5 -4
- package/src/execution/engine/signal.ts +28 -0
- package/src/execution/engine/transport.ts +3 -2
- package/src/index.ts +6 -1
- package/src/metrics/metrics/beacon.ts +9 -0
- package/src/metrics/metrics/lodestar.ts +5 -0
- package/src/network/core/events.ts +12 -0
- package/src/network/core/networkCoreWorkerHandler.ts +6 -2
- package/src/network/gossip/gossipsub.ts +4 -0
- package/src/network/network.ts +6 -2
- package/src/network/peers/peerManager.ts +26 -2
- package/src/network/peers/utils/prioritizePeers.ts +14 -1
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +1 -1
- package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +1 -1
- package/src/sync/range/batch.ts +13 -0
- package/src/sync/range/chain.ts +64 -17
- package/src/sync/range/range.ts +1 -0
- package/src/sync/range/utils/batches.ts +38 -13
- package/src/sync/range/utils/peerBalancer.ts +4 -1
- package/src/sync/types.ts +2 -0
- package/src/sync/unknownBlock.ts +110 -21
- package/src/sync/utils/downloadByRange.ts +60 -26
- package/src/sync/utils/downloadByRoot.ts +7 -5
- package/src/util/asyncIterableToEvents.ts +100 -21
- package/src/util/dataColumns.ts +4 -1
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "2.0.0
|
|
14
|
+
"version": "2.0.0",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -116,28 +116,28 @@
|
|
|
116
116
|
"@fastify/swagger": "^9.0.0",
|
|
117
117
|
"@fastify/swagger-ui": "^5.0.1",
|
|
118
118
|
"@libp2p/bootstrap": "^12.0.34",
|
|
119
|
-
"@libp2p/crypto": "^5.
|
|
120
|
-
"@libp2p/gossipsub": "^17.
|
|
121
|
-
"@libp2p/identify": "^4.1.
|
|
119
|
+
"@libp2p/crypto": "^5.2.0",
|
|
120
|
+
"@libp2p/gossipsub": "^17.2.2",
|
|
121
|
+
"@libp2p/identify": "^4.1.19",
|
|
122
122
|
"@libp2p/interface": "^3.4.0",
|
|
123
123
|
"@libp2p/mdns": "^12.0.34",
|
|
124
124
|
"@libp2p/mplex": "^12.0.34",
|
|
125
|
-
"@libp2p/peer-id": "^6.0.
|
|
125
|
+
"@libp2p/peer-id": "^6.0.18",
|
|
126
126
|
"@libp2p/prometheus-metrics": "^5.0.31",
|
|
127
127
|
"@libp2p/tcp": "^11.0.30",
|
|
128
|
-
"@libp2p/utils": "^7.4.
|
|
129
|
-
"@lodestar/api": "^2.0.0
|
|
130
|
-
"@lodestar/config": "^2.0.0
|
|
131
|
-
"@lodestar/db": "^2.0.0
|
|
132
|
-
"@lodestar/fork-choice": "^2.0.0
|
|
133
|
-
"@lodestar/logger": "^2.0.0
|
|
134
|
-
"@lodestar/native": "^2.0.0
|
|
135
|
-
"@lodestar/params": "^2.0.0
|
|
136
|
-
"@lodestar/reqresp": "^2.0.0
|
|
137
|
-
"@lodestar/state-transition": "^2.0.0
|
|
138
|
-
"@lodestar/types": "^2.0.0
|
|
139
|
-
"@lodestar/utils": "^2.0.0
|
|
140
|
-
"@lodestar/validator": "^2.0.0
|
|
128
|
+
"@libp2p/utils": "^7.4.6",
|
|
129
|
+
"@lodestar/api": "^2.0.0",
|
|
130
|
+
"@lodestar/config": "^2.0.0",
|
|
131
|
+
"@lodestar/db": "^2.0.0",
|
|
132
|
+
"@lodestar/fork-choice": "^2.0.0",
|
|
133
|
+
"@lodestar/logger": "^2.0.0",
|
|
134
|
+
"@lodestar/native": "^2.0.0",
|
|
135
|
+
"@lodestar/params": "^2.0.0",
|
|
136
|
+
"@lodestar/reqresp": "^2.0.0",
|
|
137
|
+
"@lodestar/state-transition": "^2.0.0",
|
|
138
|
+
"@lodestar/types": "^2.0.0",
|
|
139
|
+
"@lodestar/utils": "^2.0.0",
|
|
140
|
+
"@lodestar/validator": "^2.0.0",
|
|
141
141
|
"@multiformats/multiaddr": "^13.0.1",
|
|
142
142
|
"datastore-core": "^12.0.1",
|
|
143
143
|
"datastore-level": "^13.0.1",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"fastify": "^5.8.1",
|
|
146
146
|
"interface-datastore": "^10.0.1",
|
|
147
147
|
"jwt-simple": "0.5.6",
|
|
148
|
-
"libp2p": "3.
|
|
148
|
+
"libp2p": "3.5.2",
|
|
149
149
|
"multiformats": "^13.4.2",
|
|
150
150
|
"prom-client": "^15.1.0",
|
|
151
151
|
"qs": "^6.14.2",
|
|
@@ -156,11 +156,11 @@
|
|
|
156
156
|
"xxhash-wasm": "1.0.2"
|
|
157
157
|
},
|
|
158
158
|
"devDependencies": {
|
|
159
|
-
"@ethereumjs/rlp": "^
|
|
160
|
-
"@libp2p/interface-internal": "^3.2.
|
|
161
|
-
"@libp2p/logger": "^6.2.
|
|
162
|
-
"@lodestar/spec-test-util": "^2.0.0
|
|
163
|
-
"@lodestar/test-utils": "^2.0.0
|
|
159
|
+
"@ethereumjs/rlp": "^10.1.3",
|
|
160
|
+
"@libp2p/interface-internal": "^3.2.3",
|
|
161
|
+
"@libp2p/logger": "^6.2.16",
|
|
162
|
+
"@lodestar/spec-test-util": "^2.0.0",
|
|
163
|
+
"@lodestar/test-utils": "^2.0.0",
|
|
164
164
|
"@types/js-yaml": "^4.0.5",
|
|
165
165
|
"@types/qs": "^6.9.7",
|
|
166
166
|
"@types/tmp": "^0.2.3",
|
|
@@ -174,5 +174,5 @@
|
|
|
174
174
|
"beacon",
|
|
175
175
|
"blockchain"
|
|
176
176
|
],
|
|
177
|
-
"gitHead": "
|
|
177
|
+
"gitHead": "edba9f746c83bb6612595b38602893f66fcfec3c"
|
|
178
178
|
}
|
|
@@ -535,8 +535,9 @@ export function getBeaconBlockApi(
|
|
|
535
535
|
if (isOptimisticBlock(summary)) {
|
|
536
536
|
executionOptimistic = true;
|
|
537
537
|
}
|
|
538
|
-
|
|
539
|
-
|
|
538
|
+
if (!blockResult.finalized) {
|
|
539
|
+
finalized = false;
|
|
540
|
+
}
|
|
540
541
|
}
|
|
541
542
|
})
|
|
542
543
|
);
|
|
@@ -578,12 +579,12 @@ export function getBeaconBlockApi(
|
|
|
578
579
|
if (isOptimisticBlock(summary)) {
|
|
579
580
|
executionOptimistic = true;
|
|
580
581
|
}
|
|
581
|
-
finalized = false;
|
|
582
582
|
|
|
583
583
|
if (summary.blockRoot !== canonicalRoot) {
|
|
584
584
|
const blockResult = await chain.getBlockByRoot(summary.blockRoot);
|
|
585
585
|
if (blockResult) {
|
|
586
586
|
result.push(toBeaconHeaderResponse(config, blockResult.block));
|
|
587
|
+
finalized = false;
|
|
587
588
|
}
|
|
588
589
|
}
|
|
589
590
|
})
|
|
@@ -377,7 +377,7 @@ export function getBeaconPoolApi({
|
|
|
377
377
|
|
|
378
378
|
// Verify signature only, all other data is very likely to be correct, since the `signature` object is created by this node.
|
|
379
379
|
// Worst case if `signature` is not valid, gossip peers will drop it and slightly downscore us.
|
|
380
|
-
await validateApiSyncCommittee(chain,
|
|
380
|
+
await validateApiSyncCommittee(chain, signature);
|
|
381
381
|
|
|
382
382
|
// The same validator can appear multiple times in the sync committee. It can appear multiple times per
|
|
383
383
|
// subnet even. First compute on which subnet the signature must be broadcasted to.
|
|
@@ -132,8 +132,6 @@ const BLOCK_PRODUCTION_RACE_CUTOFF_BPS = 1667;
|
|
|
132
132
|
* TODO GLOAS: revisit, the block propagates faster as it only commits to a bid and the attestation deadline changed
|
|
133
133
|
*/
|
|
134
134
|
export const BLOCK_PRODUCTION_RACE_CUTOFF_GLOAS_BPS = 1667;
|
|
135
|
-
/** Rejection message of the bid block branch when there is no viable bid to commit to */
|
|
136
|
-
const NO_BID_AVAILABLE = "No builder bid available";
|
|
137
135
|
|
|
138
136
|
type BidCandidate = {
|
|
139
137
|
signedBid: gloas.SignedExecutionPayloadBid;
|
|
@@ -179,6 +177,8 @@ function compareBidCandidates(a: BidCandidate, b: BidCandidate): number {
|
|
|
179
177
|
return a.receivedMs - b.receivedMs;
|
|
180
178
|
}
|
|
181
179
|
|
|
180
|
+
type ParentStates = {parentState: IBeaconStateView; parentStateWithPayload: IBeaconStateView};
|
|
181
|
+
|
|
182
182
|
type ProduceBlockContentsRes = {executionPayloadValue: Wei; consensusBlockValue: Wei} & {
|
|
183
183
|
data: BlockContents<ForkPreGloas>;
|
|
184
184
|
version: ForkPreGloas;
|
|
@@ -450,9 +450,11 @@ export function getValidatorApi(
|
|
|
450
450
|
{
|
|
451
451
|
commonBlockBodyPromise,
|
|
452
452
|
parentBlock,
|
|
453
|
+
parentStatesPromise,
|
|
453
454
|
}: Omit<routes.validator.ExtraProduceBlockOpts, "builderSelection"> & {
|
|
454
455
|
commonBlockBodyPromise: Promise<CommonBlockBody>;
|
|
455
456
|
parentBlock: ProtoBlock;
|
|
457
|
+
parentStatesPromise: Promise<ParentStates>;
|
|
456
458
|
}
|
|
457
459
|
): Promise<ProduceBlindedBlockRes> {
|
|
458
460
|
const version = config.getForkName(slot);
|
|
@@ -487,6 +489,7 @@ export function getValidatorApi(
|
|
|
487
489
|
randaoReveal,
|
|
488
490
|
graffiti,
|
|
489
491
|
commonBlockBodyPromise,
|
|
492
|
+
...(await parentStatesPromise),
|
|
490
493
|
});
|
|
491
494
|
|
|
492
495
|
metrics?.blockProductionSuccess.inc({source});
|
|
@@ -519,9 +522,11 @@ export function getValidatorApi(
|
|
|
519
522
|
strictFeeRecipientCheck,
|
|
520
523
|
commonBlockBodyPromise,
|
|
521
524
|
parentBlock,
|
|
525
|
+
parentStatesPromise,
|
|
522
526
|
}: Omit<routes.validator.ExtraProduceBlockOpts, "builderSelection"> & {
|
|
523
527
|
commonBlockBodyPromise: Promise<CommonBlockBody>;
|
|
524
528
|
parentBlock: ProtoBlock;
|
|
529
|
+
parentStatesPromise: Promise<ParentStates>;
|
|
525
530
|
}
|
|
526
531
|
): Promise<ProduceBlockContentsRes & {shouldOverrideBuilder?: boolean}> {
|
|
527
532
|
const version = config.getForkName(slot);
|
|
@@ -541,6 +546,7 @@ export function getValidatorApi(
|
|
|
541
546
|
graffiti,
|
|
542
547
|
feeRecipient,
|
|
543
548
|
commonBlockBodyPromise,
|
|
549
|
+
...(await parentStatesPromise),
|
|
544
550
|
});
|
|
545
551
|
if (strictFeeRecipientCheck && feeRecipient && isForkPostBellatrix(version)) {
|
|
546
552
|
const blockFeeRecipient = toHex((block as bellatrix.BeaconBlock).body.executionPayload.feeRecipient);
|
|
@@ -636,6 +642,13 @@ export function getValidatorApi(
|
|
|
636
642
|
notOnOutOfRangeData(parentBlockRoot);
|
|
637
643
|
metrics?.blockProductionSlotDelta.set(slot - parentSlot);
|
|
638
644
|
|
|
645
|
+
// Fetch the production state once and thread it to all downstream production calls, not awaited so each
|
|
646
|
+
// block source includes it in its production time. Only reached for pre-gloas slots (produceBlockV3 rejects
|
|
647
|
+
// post-gloas forks), the execution payload is part of the parent block so its state already includes it
|
|
648
|
+
const parentStatesPromise: Promise<ParentStates> = chain.regen
|
|
649
|
+
.getBlockSlotState(parentBlock, slot, {dontTransferCache: true}, RegenCaller.produceBlock)
|
|
650
|
+
.then((parentState) => ({parentState, parentStateWithPayload: parentState}));
|
|
651
|
+
|
|
639
652
|
const fork = config.getForkName(slot);
|
|
640
653
|
|
|
641
654
|
const isBuilderEnabled =
|
|
@@ -678,6 +691,7 @@ export function getValidatorApi(
|
|
|
678
691
|
strictFeeRecipientCheck: false,
|
|
679
692
|
commonBlockBodyPromise,
|
|
680
693
|
parentBlock,
|
|
694
|
+
parentStatesPromise,
|
|
681
695
|
})
|
|
682
696
|
: Promise.reject(new Error("Builder disabled"));
|
|
683
697
|
|
|
@@ -686,6 +700,7 @@ export function getValidatorApi(
|
|
|
686
700
|
strictFeeRecipientCheck,
|
|
687
701
|
commonBlockBodyPromise,
|
|
688
702
|
parentBlock,
|
|
703
|
+
parentStatesPromise,
|
|
689
704
|
}).then((engineBlock) => {
|
|
690
705
|
// Once the engine returns a block, in the event of either:
|
|
691
706
|
// - suspected builder censorship
|
|
@@ -721,28 +736,28 @@ export function getValidatorApi(
|
|
|
721
736
|
});
|
|
722
737
|
|
|
723
738
|
// Ensure builder and engine HTTP requests are sent before starting common block body production
|
|
724
|
-
// by deferring the call to next event loop iteration, allowing pending
|
|
725
|
-
// HTTP requests to be processed first and sent out early in slot.
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
739
|
+
// by deferring the call to next event loop iteration once the state is available, allowing pending
|
|
740
|
+
// I/O operations like HTTP requests to be processed first and sent out early in slot.
|
|
741
|
+
parentStatesPromise.then(
|
|
742
|
+
(parentStates) =>
|
|
743
|
+
callInNextEventLoop(() => {
|
|
744
|
+
logger.verbose("Producing common block body", loggerContext);
|
|
745
|
+
const commonBlockBodyStartedAt = Date.now();
|
|
746
|
+
|
|
747
|
+
chain
|
|
748
|
+
.produceCommonBlockBody({slot, parentBlock, randaoReveal, graffiti: graffitiBytes, ...parentStates})
|
|
749
|
+
.then((commonBlockBody) => {
|
|
750
|
+
deferredCommonBlockBody.resolve(commonBlockBody);
|
|
751
|
+
logger.verbose("Produced common block body", {
|
|
752
|
+
...loggerContext,
|
|
753
|
+
durationMs: Date.now() - commonBlockBodyStartedAt,
|
|
754
|
+
});
|
|
755
|
+
})
|
|
756
|
+
.catch(deferredCommonBlockBody.reject);
|
|
757
|
+
}),
|
|
758
|
+
// Both block sources fail on the state themselves and do not await the common block body
|
|
759
|
+
() => {}
|
|
760
|
+
);
|
|
746
761
|
|
|
747
762
|
const [builder, engine] = await blockProductionRacePromise;
|
|
748
763
|
|
|
@@ -1010,19 +1025,23 @@ export function getValidatorApi(
|
|
|
1010
1025
|
(!circuitBreakerActive &&
|
|
1011
1026
|
chain.executionPayloadBidPool.getBestBid(slot, bidParentBlockHash, parentBlockRootHex) !== null);
|
|
1012
1027
|
|
|
1013
|
-
//
|
|
1014
|
-
//
|
|
1015
|
-
const cutoffMs =
|
|
1016
|
-
|
|
1017
|
-
config.getSlotComponentDurationMs(fork, BLOCK_PRODUCTION_RACE_CUTOFF_GLOAS_BPS) - chain.clock.msFromSlot(slot)
|
|
1018
|
-
);
|
|
1028
|
+
// Cutoff time into the slot, ensures a slow local payload build does not delay the proposal when a
|
|
1029
|
+
// builder bid block is available (and vice versa). Each timer waits for the time left until the cutoff
|
|
1030
|
+
const cutoffMs = config.getSlotComponentDurationMs(fork, BLOCK_PRODUCTION_RACE_CUTOFF_GLOAS_BPS);
|
|
1031
|
+
const msToCutoff = (): number => Math.max(0, cutoffMs - chain.clock.msFromSlot(slot));
|
|
1019
1032
|
|
|
1020
1033
|
// Give p2p bids the same time to bid up as granted to builder API bid requests via the advertised
|
|
1021
1034
|
// deadline, the pool is read once the deadline passed and the bid requests settled. A late request
|
|
1022
1035
|
// does not wait past the race cutoff, a pooled bid is still the fastest fallback if the local block fails
|
|
1023
1036
|
const bidDeadlinePromise = circuitBreakerActive
|
|
1024
1037
|
? Promise.resolve()
|
|
1025
|
-
: sleep(Math.min(chain.builderApiClient.bidDeadline,
|
|
1038
|
+
: sleep(Math.min(chain.builderApiClient.bidDeadline, msToCutoff()));
|
|
1039
|
+
|
|
1040
|
+
let parentExecutionRequestsPromise: Promise<gloas.ExecutionRequests> | null = null;
|
|
1041
|
+
const getParentExecutionRequests = (): Promise<gloas.ExecutionRequests> => {
|
|
1042
|
+
parentExecutionRequestsPromise ??= chain.getParentExecutionRequests(parentSlot, parentBlockRootHex);
|
|
1043
|
+
return parentExecutionRequestsPromise;
|
|
1044
|
+
};
|
|
1026
1045
|
|
|
1027
1046
|
// Candidates are ranked by their boosted counted total payment, the p2p bid is governed
|
|
1028
1047
|
// by the top-level factors and each builder API bid by its own entry. Ties prefer the
|
|
@@ -1032,10 +1051,9 @@ export function getValidatorApi(
|
|
|
1032
1051
|
// Past the race cutoff a pooled p2p bid is used right away rather than waiting for pending
|
|
1033
1052
|
// builder API requests, the local block is selected at the cutoff anyway if it is ready
|
|
1034
1053
|
let [builderApiBids] = await Promise.all([
|
|
1035
|
-
Promise.race([builderApiBidsPromise, sleep(
|
|
1054
|
+
Promise.race([builderApiBidsPromise, sleep(msToCutoff()).then(() => null)]),
|
|
1036
1055
|
bidDeadlinePromise,
|
|
1037
1056
|
]);
|
|
1038
|
-
let parentExecutionRequestsPromise: Promise<gloas.ExecutionRequests> | null = null;
|
|
1039
1057
|
|
|
1040
1058
|
let p2pBid: PooledExecutionPayloadBid | null = circuitBreakerActive
|
|
1041
1059
|
? null
|
|
@@ -1064,10 +1082,7 @@ export function getValidatorApi(
|
|
|
1064
1082
|
parentBlockHash: bidParentBlockHash,
|
|
1065
1083
|
parentBlockRoot: parentBlockRootHex,
|
|
1066
1084
|
entry,
|
|
1067
|
-
getParentExecutionRequests
|
|
1068
|
-
parentExecutionRequestsPromise ??= chain.getParentExecutionRequests(parentSlot, parentBlockRootHex);
|
|
1069
|
-
return parentExecutionRequestsPromise;
|
|
1070
|
-
},
|
|
1085
|
+
getParentExecutionRequests,
|
|
1071
1086
|
});
|
|
1072
1087
|
return {
|
|
1073
1088
|
signedBid,
|
|
@@ -1116,23 +1131,6 @@ export function getValidatorApi(
|
|
|
1116
1131
|
return rankedCandidates[0];
|
|
1117
1132
|
})();
|
|
1118
1133
|
|
|
1119
|
-
const commonBlockBodyPromise = chain.produceCommonBlockBody({
|
|
1120
|
-
slot,
|
|
1121
|
-
parentBlock,
|
|
1122
|
-
randaoReveal,
|
|
1123
|
-
graffiti: graffitiBytes,
|
|
1124
|
-
});
|
|
1125
|
-
|
|
1126
|
-
const baseAttrs = {
|
|
1127
|
-
slot,
|
|
1128
|
-
parentBlock,
|
|
1129
|
-
randaoReveal,
|
|
1130
|
-
graffiti: graffitiBytes,
|
|
1131
|
-
feeRecipient,
|
|
1132
|
-
strictFeeRecipientCheck,
|
|
1133
|
-
commonBlockBodyPromise,
|
|
1134
|
-
};
|
|
1135
|
-
|
|
1136
1134
|
metrics?.blockProductionRequests.inc({source: ProducedBlockSource.engine});
|
|
1137
1135
|
|
|
1138
1136
|
const timed = <T>(source: ProducedBlockSource, fn: () => Promise<T>): Promise<T> => {
|
|
@@ -1140,11 +1138,59 @@ export function getValidatorApi(
|
|
|
1140
1138
|
return fn().finally(() => t?.({source}));
|
|
1141
1139
|
};
|
|
1142
1140
|
|
|
1141
|
+
// Fetch the production state once and apply the parent execution payload once here, so all
|
|
1142
|
+
// downstream consumers share a single state: the un-applied `parentState` (for `computeNewStateRoot`)
|
|
1143
|
+
// and the applied `parentStateWithPayload` (for attestation scoring and execution-payload prep).
|
|
1144
|
+
// Not awaited, the race below covers it and both blocks are produced from it
|
|
1145
|
+
const baseAttrsPromise = (async () => {
|
|
1146
|
+
const parentState = await chain.regen.getBlockSlotState(
|
|
1147
|
+
parentBlock,
|
|
1148
|
+
slot,
|
|
1149
|
+
{dontTransferCache: true},
|
|
1150
|
+
RegenCaller.produceBlock
|
|
1151
|
+
);
|
|
1152
|
+
// Fetch the parent's execution requests once here and thread them via blockAttributes: they are
|
|
1153
|
+
// used both to apply the parent payload below and as the block's `parentExecutionRequests` field
|
|
1154
|
+
// (so both are guaranteed consistent). Only needed when building on FULL; empty parent has none.
|
|
1155
|
+
const parentExecutionRequests =
|
|
1156
|
+
isBuildingOnFull && isStatePostGloas(parentState)
|
|
1157
|
+
? await getParentExecutionRequests()
|
|
1158
|
+
: ssz.gloas.ExecutionRequests.defaultValue();
|
|
1159
|
+
// When building on EMPTY there is nothing to apply, so it stays the same view as parentState
|
|
1160
|
+
// (the availability bit for parentSlot stays false, which is correct).
|
|
1161
|
+
const parentStateWithPayload =
|
|
1162
|
+
isBuildingOnFull && isStatePostGloas(parentState)
|
|
1163
|
+
? parentState.withParentPayloadApplied(parentExecutionRequests)
|
|
1164
|
+
: parentState;
|
|
1165
|
+
|
|
1166
|
+
const commonBlockBodyPromise = chain.produceCommonBlockBody({
|
|
1167
|
+
slot,
|
|
1168
|
+
parentBlock,
|
|
1169
|
+
randaoReveal,
|
|
1170
|
+
graffiti: graffitiBytes,
|
|
1171
|
+
parentState,
|
|
1172
|
+
parentStateWithPayload,
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
return {
|
|
1176
|
+
slot,
|
|
1177
|
+
parentBlock,
|
|
1178
|
+
randaoReveal,
|
|
1179
|
+
graffiti: graffitiBytes,
|
|
1180
|
+
feeRecipient,
|
|
1181
|
+
strictFeeRecipientCheck,
|
|
1182
|
+
commonBlockBodyPromise,
|
|
1183
|
+
parentState,
|
|
1184
|
+
parentStateWithPayload,
|
|
1185
|
+
parentExecutionRequests,
|
|
1186
|
+
};
|
|
1187
|
+
})();
|
|
1188
|
+
|
|
1143
1189
|
// use abort controller to stop waiting for the bid block if the engine block will be selected
|
|
1144
1190
|
const controller = new AbortController();
|
|
1145
1191
|
|
|
1146
|
-
const enginePromise: ReturnType<typeof chain.produceBlock> = timed(ProducedBlockSource.engine, () =>
|
|
1147
|
-
chain.produceBlock(
|
|
1192
|
+
const enginePromise: ReturnType<typeof chain.produceBlock> = timed(ProducedBlockSource.engine, async () =>
|
|
1193
|
+
chain.produceBlock(await baseAttrsPromise)
|
|
1148
1194
|
).then((engineBlock) => {
|
|
1149
1195
|
// No need to wait for the bid block if the engine block will always be selected, either
|
|
1150
1196
|
// due to suspected builder censorship, or because no builders are configured and the
|
|
@@ -1156,16 +1202,16 @@ export function getValidatorApi(
|
|
|
1156
1202
|
});
|
|
1157
1203
|
const bidBlockPromise: ReturnType<typeof chain.produceBlock> = bestBidPromise.then((candidate) => {
|
|
1158
1204
|
if (candidate === null) {
|
|
1159
|
-
throw new
|
|
1205
|
+
throw new NoBidReceived();
|
|
1160
1206
|
}
|
|
1161
1207
|
metrics?.blockProductionRequests.inc({source: ProducedBlockSource.builder});
|
|
1162
|
-
return timed(ProducedBlockSource.builder, () =>
|
|
1163
|
-
chain.produceBlock({...
|
|
1208
|
+
return timed(ProducedBlockSource.builder, async () =>
|
|
1209
|
+
chain.produceBlock({...(await baseAttrsPromise), builderBid: candidate.signedBid})
|
|
1164
1210
|
);
|
|
1165
1211
|
});
|
|
1166
1212
|
|
|
1167
1213
|
const [engineResult, bidBlockResult] = await resolveOrRacePromises([enginePromise, bidBlockPromise], {
|
|
1168
|
-
resolveTimeoutMs:
|
|
1214
|
+
resolveTimeoutMs: msToCutoff(),
|
|
1169
1215
|
raceTimeoutMs: config.getSlotDurationMs(fork),
|
|
1170
1216
|
signal: controller.signal,
|
|
1171
1217
|
});
|
|
@@ -1270,7 +1316,7 @@ export function getValidatorApi(
|
|
|
1270
1316
|
source = ProducedBlockSource.engine;
|
|
1271
1317
|
bestResult = engineResult;
|
|
1272
1318
|
const reason =
|
|
1273
|
-
bidBlockResult.status === "rejected" &&
|
|
1319
|
+
bidBlockResult.status === "rejected" && bidBlockResult.reason instanceof NoBidReceived
|
|
1274
1320
|
? EngineBlockSelectionReason.BuilderNoBid
|
|
1275
1321
|
: bidBlockResult.status === "pending"
|
|
1276
1322
|
? EngineBlockSelectionReason.BuilderPending
|
|
@@ -284,7 +284,7 @@ export async function archiveBlocks(
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
// Delete expired data column sidecars
|
|
287
|
-
// Keep only `[
|
|
287
|
+
// Keep only `[current_epoch - max(MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS, archiveDataEpochs)]`
|
|
288
288
|
if (finalizedPostFulu) {
|
|
289
289
|
if (archiveDataEpochs !== Infinity) {
|
|
290
290
|
const dataColumnSidecarsMinEpoch = getDataColumnSidecarsMinEpoch(config, currentEpoch, archiveDataEpochs);
|
package/src/chain/chain.ts
CHANGED
|
@@ -896,16 +896,18 @@ export class BeaconChain implements IBeaconChain {
|
|
|
896
896
|
): Promise<{block: SignedBeaconBlock; executionOptimistic: boolean; finalized: boolean} | null> {
|
|
897
897
|
const block = this.forkChoice.getBlockHexDefaultStatus(root);
|
|
898
898
|
if (block) {
|
|
899
|
+
// The finalized block stays in fork-choice and the hot db until the archiver has migrated it
|
|
900
|
+
const finalized = block.slot <= this.forkChoice.getFinalizedBlock().slot;
|
|
899
901
|
// Block found in fork-choice.
|
|
900
902
|
// It may be in the block input cache, awaiting full DA reconstruction, check there first
|
|
901
903
|
// Otherwise (most likely), check the hot db
|
|
902
904
|
const blockInput = this.seenBlockInputCache.get(block.blockRoot);
|
|
903
905
|
if (blockInput?.hasBlock()) {
|
|
904
|
-
return {block: blockInput.getBlock(), executionOptimistic: isOptimisticBlock(block), finalized
|
|
906
|
+
return {block: blockInput.getBlock(), executionOptimistic: isOptimisticBlock(block), finalized};
|
|
905
907
|
}
|
|
906
908
|
const data = await this.db.block.get(fromHex(root));
|
|
907
909
|
if (data) {
|
|
908
|
-
return {block: data, executionOptimistic: isOptimisticBlock(block), finalized
|
|
910
|
+
return {block: data, executionOptimistic: isOptimisticBlock(block), finalized};
|
|
909
911
|
}
|
|
910
912
|
// If block is not found in hot db, try cold db since there could be an archive cycle happening
|
|
911
913
|
// TODO: Add a lock to the archiver to have deterministic behavior on where are blocks
|
|
@@ -920,6 +922,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
920
922
|
): Promise<{block: Uint8Array; executionOptimistic: boolean; finalized: boolean; slot: Slot} | null> {
|
|
921
923
|
const block = this.forkChoice.getBlockHexDefaultStatus(root);
|
|
922
924
|
if (block) {
|
|
925
|
+
// The finalized block stays in fork-choice and the hot db until the archiver has migrated it
|
|
926
|
+
const finalized = block.slot <= this.forkChoice.getFinalizedBlock().slot;
|
|
923
927
|
// Block found in fork-choice.
|
|
924
928
|
// It may be in the block input cache, awaiting full DA reconstruction, check there first
|
|
925
929
|
// Otherwise (most likely), check the hot db
|
|
@@ -931,14 +935,14 @@ export class BeaconChain implements IBeaconChain {
|
|
|
931
935
|
return {
|
|
932
936
|
block: serialized,
|
|
933
937
|
executionOptimistic: isOptimisticBlock(block),
|
|
934
|
-
finalized
|
|
938
|
+
finalized,
|
|
935
939
|
slot: blockInput.slot,
|
|
936
940
|
};
|
|
937
941
|
}
|
|
938
942
|
return {
|
|
939
943
|
block: sszTypesFor(blockInput.forkName).SignedBeaconBlock.serialize(signedBlock),
|
|
940
944
|
executionOptimistic: isOptimisticBlock(block),
|
|
941
|
-
finalized
|
|
945
|
+
finalized,
|
|
942
946
|
slot: blockInput.slot,
|
|
943
947
|
};
|
|
944
948
|
}
|
|
@@ -946,7 +950,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
946
950
|
if (data) {
|
|
947
951
|
const slot = getSlotFromSignedBeaconBlockSerialized(data);
|
|
948
952
|
if (slot === null) throw new Error(`Invalid block data stored in DB for root: ${root}`);
|
|
949
|
-
return {block: data, executionOptimistic: isOptimisticBlock(block), finalized
|
|
953
|
+
return {block: data, executionOptimistic: isOptimisticBlock(block), finalized, slot};
|
|
950
954
|
}
|
|
951
955
|
// If block is not found in hot db, try cold db since there could be an archive cycle happening
|
|
952
956
|
// TODO: Add a lock to the archiver to have deterministic behavior on where are blocks
|
|
@@ -1211,18 +1215,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1211
1215
|
}
|
|
1212
1216
|
|
|
1213
1217
|
async produceCommonBlockBody(blockAttributes: BlockAttributes): Promise<CommonBlockBody> {
|
|
1214
|
-
const {slot, parentBlock} = blockAttributes;
|
|
1215
|
-
const state = await this.regen.getBlockSlotState(
|
|
1216
|
-
parentBlock,
|
|
1217
|
-
slot,
|
|
1218
|
-
{dontTransferCache: true},
|
|
1219
|
-
RegenCaller.produceBlock
|
|
1220
|
-
);
|
|
1221
|
-
|
|
1222
1218
|
// TODO: To avoid breaking changes for metric define this attribute
|
|
1223
1219
|
const blockType = BlockType.Full;
|
|
1224
1220
|
|
|
1225
|
-
return produceCommonBlockBody.call(this, blockType,
|
|
1221
|
+
return produceCommonBlockBody.call(this, blockType, blockAttributes);
|
|
1226
1222
|
}
|
|
1227
1223
|
|
|
1228
1224
|
produceBlock(blockAttributes: BlockAttributes & {commonBlockBodyPromise: Promise<CommonBlockBody>}): Promise<{
|
|
@@ -1244,46 +1240,24 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1244
1240
|
|
|
1245
1241
|
async produceBlockWrapper<T extends BlockType>(
|
|
1246
1242
|
blockType: T,
|
|
1247
|
-
{
|
|
1248
|
-
randaoReveal,
|
|
1249
|
-
graffiti,
|
|
1250
|
-
slot,
|
|
1251
|
-
feeRecipient,
|
|
1252
|
-
strictFeeRecipientCheck,
|
|
1253
|
-
commonBlockBodyPromise,
|
|
1254
|
-
parentBlock,
|
|
1255
|
-
builderBid,
|
|
1256
|
-
}: BlockAttributes & {commonBlockBodyPromise: Promise<CommonBlockBody>}
|
|
1243
|
+
blockAttributes: BlockAttributes & {commonBlockBodyPromise: Promise<CommonBlockBody>}
|
|
1257
1244
|
): Promise<{
|
|
1258
1245
|
block: AssembledBlockType<T>;
|
|
1259
1246
|
executionPayloadValue: Wei;
|
|
1260
1247
|
consensusBlockValue: Wei;
|
|
1261
1248
|
shouldOverrideBuilder?: boolean;
|
|
1262
1249
|
}> {
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
slot,
|
|
1266
|
-
{dontTransferCache: true},
|
|
1267
|
-
RegenCaller.produceBlock
|
|
1268
|
-
);
|
|
1269
|
-
const proposerIndex = state.getBeaconProposer(slot);
|
|
1250
|
+
const {slot, parentBlock, parentState} = blockAttributes;
|
|
1251
|
+
const proposerIndex = parentState.getBeaconProposer(slot);
|
|
1270
1252
|
const proposerPubKey = this.pubkeyCache.getPubkeyBytesOrThrow(proposerIndex);
|
|
1271
1253
|
|
|
1272
1254
|
const {body, produceResult, executionPayloadValue, shouldOverrideBuilder} = await produceBlockBody.call(
|
|
1273
1255
|
this,
|
|
1274
1256
|
blockType,
|
|
1275
|
-
state,
|
|
1276
1257
|
{
|
|
1277
|
-
|
|
1278
|
-
graffiti,
|
|
1279
|
-
slot,
|
|
1280
|
-
feeRecipient,
|
|
1281
|
-
strictFeeRecipientCheck,
|
|
1282
|
-
parentBlock,
|
|
1258
|
+
...blockAttributes,
|
|
1283
1259
|
proposerIndex,
|
|
1284
1260
|
proposerPubKey,
|
|
1285
|
-
commonBlockBodyPromise,
|
|
1286
|
-
builderBid,
|
|
1287
1261
|
}
|
|
1288
1262
|
);
|
|
1289
1263
|
|
|
@@ -1308,7 +1282,9 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1308
1282
|
body,
|
|
1309
1283
|
} as AssembledBlockType<T>;
|
|
1310
1284
|
|
|
1311
|
-
|
|
1285
|
+
// `parentState` is the un-applied production state; `computeNewStateRoot` re-applies the parent
|
|
1286
|
+
// payload during state transition, so it must not receive the already-applied state
|
|
1287
|
+
const {newStateRoot, proposerReward} = computeNewStateRoot(this.metrics, parentState, block);
|
|
1312
1288
|
block.stateRoot = newStateRoot;
|
|
1313
1289
|
const blockRoot =
|
|
1314
1290
|
produceResult.type === BlockType.Full
|
|
@@ -23,6 +23,7 @@ export enum ExecutionPayloadBidErrorCode {
|
|
|
23
23
|
PROPOSER_PREFERENCES_GAS_LIMIT_MISMATCH = "EXECUTION_PAYLOAD_BID_ERROR_PROPOSER_PREFERENCES_GAS_LIMIT_MISMATCH",
|
|
24
24
|
INCLUSION_LIST_BITS_NOT_INCLUSIVE = "EXECUTION_PAYLOAD_BID_ERROR_INCLUSION_LIST_BITS_NOT_INCLUSIVE",
|
|
25
25
|
BEFORE_INCLUSION_LIST_DEADLINE = "EXECUTION_PAYLOAD_BID_ERROR_BEFORE_INCLUSION_LIST_DEADLINE",
|
|
26
|
+
BEFORE_PAYLOAD_ATTESTATION_DEADLINE = "EXECUTION_PAYLOAD_BID_ERROR_BEFORE_PAYLOAD_ATTESTATION_DEADLINE",
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export type ExecutionPayloadBidErrorType =
|
|
@@ -99,6 +100,11 @@ export type ExecutionPayloadBidErrorType =
|
|
|
99
100
|
builderIndex: BuilderIndex;
|
|
100
101
|
slot: Slot;
|
|
101
102
|
}
|
|
103
|
+
| {
|
|
104
|
+
code: ExecutionPayloadBidErrorCode.BEFORE_PAYLOAD_ATTESTATION_DEADLINE;
|
|
105
|
+
builderIndex: BuilderIndex;
|
|
106
|
+
slot: Slot;
|
|
107
|
+
}
|
|
102
108
|
| {
|
|
103
109
|
code: ExecutionPayloadBidErrorCode.PROPOSER_PREFERENCES_GAS_LIMIT_MISMATCH;
|
|
104
110
|
builderIndex: BuilderIndex;
|
|
@@ -20,6 +20,7 @@ export enum ExecutionPayloadEnvelopeErrorCode {
|
|
|
20
20
|
INCORRECT_TIMESTAMP = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INCORRECT_TIMESTAMP",
|
|
21
21
|
EMPTY_TRANSACTION = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_EMPTY_TRANSACTION",
|
|
22
22
|
WITHDRAWALS_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_WITHDRAWALS_MISMATCH",
|
|
23
|
+
INVALID_BLOCK_HASH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_BLOCK_HASH",
|
|
23
24
|
INVALID_SIGNATURE = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_SIGNATURE",
|
|
24
25
|
PAYLOAD_ENVELOPE_INPUT_MISSING = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_PAYLOAD_ENVELOPE_INPUT_MISSING",
|
|
25
26
|
}
|
|
@@ -112,6 +113,13 @@ export type ExecutionPayloadEnvelopeErrorType =
|
|
|
112
113
|
envelopeWithdrawalsRoot: RootHex;
|
|
113
114
|
expectedWithdrawalsRoot: RootHex;
|
|
114
115
|
}
|
|
116
|
+
| {
|
|
117
|
+
code: ExecutionPayloadEnvelopeErrorCode.INVALID_BLOCK_HASH;
|
|
118
|
+
slot: Slot;
|
|
119
|
+
root: RootHex;
|
|
120
|
+
blockHash: RootHex;
|
|
121
|
+
computedBlockHash: RootHex;
|
|
122
|
+
}
|
|
115
123
|
| {code: ExecutionPayloadEnvelopeErrorCode.INVALID_SIGNATURE; slot: Slot; root: RootHex}
|
|
116
124
|
| {code: ExecutionPayloadEnvelopeErrorCode.PAYLOAD_ENVELOPE_INPUT_MISSING; blockRoot: RootHex};
|
|
117
125
|
|