@lodestar/beacon-node 1.46.0-dev.8b30182711 → 1.46.0-dev.8bab23d909
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 +37 -15
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- 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 +3 -1
- package/lib/api/impl/config/constants.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +15 -6
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +3 -3
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +3 -4
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +6 -0
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.js +31 -25
- package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
- package/lib/chain/blocks/utils/polarBearBanner.d.ts +2 -0
- package/lib/chain/blocks/utils/polarBearBanner.d.ts.map +1 -0
- package/lib/chain/blocks/utils/polarBearBanner.js +51 -0
- package/lib/chain/blocks/utils/polarBearBanner.js.map +1 -0
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +21 -1
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/chain.d.ts +5 -0
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +55 -0
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +6 -0
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +5 -0
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/interface.d.ts +2 -0
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/options.d.ts +2 -0
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -0
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +107 -29
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +16 -7
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/seenCache/seenBlockProposers.d.ts +20 -4
- package/lib/chain/seenCache/seenBlockProposers.d.ts.map +1 -1
- package/lib/chain/seenCache/seenBlockProposers.js +49 -2
- package/lib/chain/seenCache/seenBlockProposers.js.map +1 -1
- package/lib/chain/validation/block.d.ts +4 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +32 -18
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +21 -16
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +1 -1
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +14 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +38 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/core/networkCore.d.ts.map +1 -1
- package/lib/network/core/networkCore.js +12 -1
- package/lib/network/core/networkCore.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.js +20 -3
- package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +661 -16
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +3 -3
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/network.d.ts +1 -0
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +11 -1
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +8 -0
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/reqresp/score.d.ts.map +1 -1
- package/lib/network/reqresp/score.js +20 -3
- package/lib/network/reqresp/score.js.map +1 -1
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +14 -2
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/util/clock.d.ts +2 -7
- package/lib/util/clock.d.ts.map +1 -1
- package/lib/util/clock.js +2 -7
- package/lib/util/clock.js.map +1 -1
- package/lib/util/workerEvents.d.ts +7 -1
- package/lib/util/workerEvents.d.ts.map +1 -1
- package/lib/util/workerEvents.js +17 -5
- package/lib/util/workerEvents.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/beacon/blocks/index.ts +65 -16
- package/src/api/impl/config/constants.ts +4 -0
- package/src/api/impl/validator/index.ts +19 -6
- package/src/chain/blocks/importBlock.ts +3 -2
- package/src/chain/blocks/importExecutionPayload.ts +8 -4
- package/src/chain/blocks/index.ts +7 -0
- package/src/chain/blocks/utils/chainSegment.ts +35 -28
- package/src/chain/blocks/utils/polarBearBanner.ts +50 -0
- package/src/chain/blocks/verifyBlock.ts +28 -2
- package/src/chain/chain.ts +60 -0
- package/src/chain/emitter.ts +7 -0
- package/src/chain/interface.ts +3 -0
- package/src/chain/options.ts +3 -0
- package/src/chain/prepareNextSlot.ts +140 -39
- package/src/chain/produceBlock/produceBlockBody.ts +23 -6
- package/src/chain/seenCache/seenBlockProposers.ts +72 -5
- package/src/chain/validation/block.ts +41 -19
- package/src/chain/validation/dataColumnSidecar.ts +27 -17
- package/src/chain/validation/executionPayloadBid.ts +1 -1
- package/src/metrics/metrics/lodestar.ts +39 -0
- package/src/network/core/networkCore.ts +13 -1
- package/src/network/core/networkCoreWorkerHandler.ts +18 -3
- package/src/network/gossip/topic.ts +4 -2
- package/src/network/network.ts +16 -1
- package/src/network/processor/gossipHandlers.ts +7 -0
- package/src/network/reqresp/score.ts +22 -3
- package/src/sync/range/batch.ts +19 -2
- package/src/util/clock.ts +2 -7
- package/src/util/workerEvents.ts +18 -6
package/src/sync/range/batch.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {LodestarError, byteArrayEquals, prettyPrintIndices, toRootHex} from "@lo
|
|
|
5
5
|
import {isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
|
|
6
6
|
import {IBlockInput} from "../../chain/blocks/blockInput/types.js";
|
|
7
7
|
import {isDaOutOfRange} from "../../chain/blocks/blockInput/utils.js";
|
|
8
|
+
import {PayloadError, PayloadErrorCode} from "../../chain/blocks/importExecutionPayload.js";
|
|
8
9
|
import {PayloadEnvelopeInput} from "../../chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js";
|
|
9
10
|
import {BlockError, BlockErrorCode} from "../../chain/errors/index.js";
|
|
10
11
|
import {ZERO_HASH} from "../../constants/constants.js";
|
|
@@ -702,7 +703,7 @@ export class Batch {
|
|
|
702
703
|
throw new BatchError(this.wrongStatusErrorType(BatchStatus.Processing));
|
|
703
704
|
}
|
|
704
705
|
|
|
705
|
-
if (err
|
|
706
|
+
if (isExecutionEngineError(err)) {
|
|
706
707
|
this.onExecutionEngineError(this.state.attempt);
|
|
707
708
|
} else {
|
|
708
709
|
this.onProcessingError(this.state.attempt);
|
|
@@ -717,7 +718,7 @@ export class Batch {
|
|
|
717
718
|
throw new BatchError(this.wrongStatusErrorType(BatchStatus.AwaitingValidation));
|
|
718
719
|
}
|
|
719
720
|
|
|
720
|
-
if (err
|
|
721
|
+
if (isExecutionEngineError(err)) {
|
|
721
722
|
this.onExecutionEngineError(this.state.attempt);
|
|
722
723
|
} else {
|
|
723
724
|
this.onProcessingError(this.state.attempt);
|
|
@@ -787,3 +788,19 @@ type BatchErrorMetadata = {
|
|
|
787
788
|
};
|
|
788
789
|
|
|
789
790
|
export class BatchError extends LodestarError<BatchErrorType & BatchErrorMetadata> {}
|
|
791
|
+
|
|
792
|
+
function isExecutionEngineError(err: Error): boolean {
|
|
793
|
+
if (!(err instanceof BlockError)) {
|
|
794
|
+
return false;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
if (err.type.code === BlockErrorCode.EXECUTION_ENGINE_ERROR) {
|
|
798
|
+
return true;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
return (
|
|
802
|
+
err.type.code === BlockErrorCode.BEACON_CHAIN_ERROR &&
|
|
803
|
+
err.type.error instanceof PayloadError &&
|
|
804
|
+
err.type.error.type.code === PayloadErrorCode.EXECUTION_ENGINE_ERROR
|
|
805
|
+
);
|
|
806
|
+
}
|
package/src/util/clock.ts
CHANGED
|
@@ -94,10 +94,7 @@ export class Clock extends EventEmitter implements IClock {
|
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* If it's too close to next slot given MAXIMUM_GOSSIP_CLOCK_DISPARITY, return currentSlot + 1.
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* Spec: phase0/p2p-interface.md - gossip validation uses `current_time + MAXIMUM_GOSSIP_CLOCK_DISPARITY < message_time`
|
|
100
|
-
* to reject future messages (strict `<`), so the boundary (exactly equal) is accepted, hence `<=` here.
|
|
97
|
+
* Spec: phase0/p2p-interface.md rejects future messages with strict `<`, hence `<=` here.
|
|
101
98
|
*/
|
|
102
99
|
get currentSlotWithGossipDisparity(): Slot {
|
|
103
100
|
const currentSlot = this.currentSlot;
|
|
@@ -123,9 +120,7 @@ export class Clock extends EventEmitter implements IClock {
|
|
|
123
120
|
|
|
124
121
|
/**
|
|
125
122
|
* Check if a slot is current slot given MAXIMUM_GOSSIP_CLOCK_DISPARITY.
|
|
126
|
-
*
|
|
127
|
-
* Uses `<=` for disparity checks because the spec rejects with strict `<`
|
|
128
|
-
* (phase0/p2p-interface.md), meaning the boundary (exactly equal) is accepted.
|
|
123
|
+
* Spec: phase0/p2p-interface.md rejects future messages with strict `<`, hence `<=`.
|
|
129
124
|
*/
|
|
130
125
|
isCurrentSlotGivenGossipDisparity(slot: Slot): boolean {
|
|
131
126
|
const currentSlot = this.currentSlot;
|
package/src/util/workerEvents.ts
CHANGED
|
@@ -111,6 +111,12 @@ export function wireEventsOnMainThread<EventData>(
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Terminate a worker thread, bounded to `retryCount * retryMs`.
|
|
116
|
+
*
|
|
117
|
+
* @returns `false` if it could not be terminated, the worker thread is then still running and the
|
|
118
|
+
* caller has to decide how to proceed without it.
|
|
119
|
+
*/
|
|
114
120
|
export async function terminateWorkerThread({
|
|
115
121
|
worker,
|
|
116
122
|
retryMs,
|
|
@@ -121,7 +127,7 @@ export async function terminateWorkerThread({
|
|
|
121
127
|
retryMs: number;
|
|
122
128
|
retryCount: number;
|
|
123
129
|
logger?: Logger;
|
|
124
|
-
}): Promise<
|
|
130
|
+
}): Promise<boolean> {
|
|
125
131
|
const terminated = new Promise((resolve) => {
|
|
126
132
|
Thread.events(worker).subscribe((event) => {
|
|
127
133
|
if (event.type === "termination") {
|
|
@@ -131,13 +137,19 @@ export async function terminateWorkerThread({
|
|
|
131
137
|
});
|
|
132
138
|
|
|
133
139
|
for (let i = 0; i < retryCount; i++) {
|
|
134
|
-
|
|
135
|
-
|
|
140
|
+
// `Worker.terminate()` resolves only once the worker thread exits, and the thread can spin
|
|
141
|
+
// forever in `Environment::CleanupHandles()` when a libuv handle on its loop never closes, so
|
|
142
|
+
// it has to be raced too, otherwise `retryCount * retryMs` never applies.
|
|
143
|
+
const result = await Promise.race([
|
|
144
|
+
Thread.terminate(worker).then(() => terminated),
|
|
145
|
+
sleep(retryMs).then(() => false),
|
|
146
|
+
]);
|
|
136
147
|
|
|
137
|
-
if (result) return;
|
|
148
|
+
if (result) return true;
|
|
138
149
|
|
|
139
|
-
logger?.
|
|
150
|
+
logger?.debug("Worker thread failed to terminate, retrying...");
|
|
140
151
|
}
|
|
141
152
|
|
|
142
|
-
|
|
153
|
+
logger?.debug(`Worker thread failed to terminate in ${retryCount * retryMs}ms`);
|
|
154
|
+
return false;
|
|
143
155
|
}
|