@lodestar/beacon-node 1.44.0-dev.4ac6f45830 → 1.44.0-dev.4b91ba8c2f
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 +23 -28
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +0 -25
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/config/constants.d.ts +4 -0
- package/lib/api/impl/config/constants.d.ts.map +1 -1
- package/lib/api/impl/config/constants.js +5 -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 +28 -0
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +20 -27
- 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 -2
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +3 -3
- package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
- package/lib/chain/chain.d.ts +2 -2
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +9 -2
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +2 -1
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +0 -7
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +0 -3
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +12 -0
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadBid.js +2 -0
- package/lib/chain/errors/executionPayloadBid.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts +4 -4
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +10 -7
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/interface.d.ts +2 -2
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- 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/produceBlock/produceBlockBody.d.ts +2 -2
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +4 -4
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/validation/block.d.ts +5 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +4 -14
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +23 -1
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +1 -3
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/execution/engine/http.js +1 -1
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +2 -2
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/interface.js +6 -2
- package/lib/execution/engine/interface.js.map +1 -1
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +3 -5
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/types.d.ts +15 -7
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +47 -9
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +4 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +10 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +30 -767
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +9 -2
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.d.ts +2 -2
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +25 -23
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.d.ts.map +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js +1 -2
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
- package/lib/sync/types.d.ts +9 -1
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +9 -2
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +64 -30
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/sszBytes.js +1 -1
- package/package.json +15 -15
- package/src/api/impl/beacon/blocks/index.ts +27 -37
- package/src/api/impl/beacon/pool/index.ts +1 -41
- package/src/api/impl/config/constants.ts +8 -0
- package/src/api/impl/lodestar/index.ts +30 -0
- package/src/api/impl/validator/index.ts +29 -39
- package/src/chain/blocks/importBlock.ts +7 -5
- package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +3 -5
- package/src/chain/chain.ts +12 -4
- package/src/chain/emitter.ts +3 -2
- package/src/chain/errors/blockError.ts +0 -4
- package/src/chain/errors/executionPayloadBid.ts +14 -0
- package/src/chain/forkChoice/index.ts +13 -0
- package/src/chain/interface.ts +1 -2
- package/src/chain/options.ts +1 -0
- package/src/chain/produceBlock/produceBlockBody.ts +7 -7
- package/src/chain/validation/block.ts +12 -16
- package/src/chain/validation/executionPayloadBid.ts +25 -1
- package/src/chain/validation/executionPayloadEnvelope.ts +1 -3
- package/src/execution/engine/http.ts +1 -1
- package/src/execution/engine/interface.ts +12 -2
- package/src/execution/engine/mock.ts +6 -5
- package/src/execution/engine/types.ts +75 -14
- package/src/metrics/metrics/lodestar.ts +11 -0
- package/src/network/processor/gossipHandlers.ts +9 -2
- package/src/network/processor/index.ts +27 -27
- package/src/network/reqresp/utils/dataColumnResponseValidation.ts +1 -2
- package/src/sync/types.ts +11 -2
- package/src/sync/unknownBlock.ts +70 -31
- package/src/util/sszBytes.ts +1 -1
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
SLOTS_PER_HISTORICAL_ROOT,
|
|
12
12
|
isForkPostBellatrix,
|
|
13
13
|
isForkPostDeneb,
|
|
14
|
-
isForkPostElectra,
|
|
15
14
|
isForkPostFulu,
|
|
16
15
|
isForkPostGloas,
|
|
17
16
|
} from "@lodestar/params";
|
|
@@ -94,7 +93,7 @@ export function getBeaconBlockApi({
|
|
|
94
93
|
ApiModules,
|
|
95
94
|
"chain" | "config" | "metrics" | "network" | "db"
|
|
96
95
|
>): ApplicationMethods<routes.beacon.block.Endpoints> {
|
|
97
|
-
const
|
|
96
|
+
const publishBlockV2: ApplicationMethods<routes.beacon.block.Endpoints>["publishBlockV2"] = async (
|
|
98
97
|
{signedBlockContents, broadcastValidation},
|
|
99
98
|
_context,
|
|
100
99
|
opts: PublishBlockOpts = {}
|
|
@@ -406,8 +405,8 @@ export function getBeaconBlockApi({
|
|
|
406
405
|
}
|
|
407
406
|
};
|
|
408
407
|
|
|
409
|
-
const
|
|
410
|
-
{signedBlindedBlock},
|
|
408
|
+
const publishBlindedBlockV2: ApplicationMethods<routes.beacon.block.Endpoints>["publishBlindedBlockV2"] = async (
|
|
409
|
+
{signedBlindedBlock, broadcastValidation},
|
|
411
410
|
context,
|
|
412
411
|
opts: PublishBlockOpts = {}
|
|
413
412
|
) => {
|
|
@@ -437,7 +436,7 @@ export function getBeaconBlockApi({
|
|
|
437
436
|
);
|
|
438
437
|
|
|
439
438
|
chain.logger.info("Publishing assembled block", {slot, blockRoot, source});
|
|
440
|
-
return
|
|
439
|
+
return publishBlockV2({signedBlockContents, broadcastValidation}, {...context, sszBytes: null}, opts);
|
|
441
440
|
}
|
|
442
441
|
|
|
443
442
|
const source = ProducedBlockSource.builder;
|
|
@@ -463,7 +462,11 @@ export function getBeaconBlockApi({
|
|
|
463
462
|
//
|
|
464
463
|
// see: https://github.com/ChainSafe/lodestar/issues/5404
|
|
465
464
|
chain.logger.info("Publishing assembled block", {slot, blockRoot, source});
|
|
466
|
-
return
|
|
465
|
+
return publishBlockV2(
|
|
466
|
+
{signedBlockContents, broadcastValidation},
|
|
467
|
+
{...context, sszBytes: null},
|
|
468
|
+
{...opts, ignoreIfKnown: true}
|
|
469
|
+
);
|
|
467
470
|
}
|
|
468
471
|
};
|
|
469
472
|
|
|
@@ -598,23 +601,6 @@ export function getBeaconBlockApi({
|
|
|
598
601
|
};
|
|
599
602
|
},
|
|
600
603
|
|
|
601
|
-
async getBlockAttestations({blockId}) {
|
|
602
|
-
const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
|
|
603
|
-
const fork = config.getForkName(block.message.slot);
|
|
604
|
-
|
|
605
|
-
if (isForkPostElectra(fork)) {
|
|
606
|
-
throw new ApiError(
|
|
607
|
-
400,
|
|
608
|
-
`Use getBlockAttestationsV2 to retrieve block attestations for post-electra fork=${fork}`
|
|
609
|
-
);
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
return {
|
|
613
|
-
data: block.message.body.attestations,
|
|
614
|
-
meta: {executionOptimistic, finalized},
|
|
615
|
-
};
|
|
616
|
-
},
|
|
617
|
-
|
|
618
604
|
async getBlockAttestationsV2({blockId}) {
|
|
619
605
|
const {block, executionOptimistic, finalized} = await getBlockResponse(chain, blockId);
|
|
620
606
|
return {
|
|
@@ -662,16 +648,8 @@ export function getBeaconBlockApi({
|
|
|
662
648
|
};
|
|
663
649
|
},
|
|
664
650
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
async publishBlindedBlockV2(args, context, opts) {
|
|
669
|
-
await publishBlindedBlock(args, context, opts);
|
|
670
|
-
},
|
|
671
|
-
|
|
672
|
-
async publishBlockV2(args, context, opts) {
|
|
673
|
-
await publishBlock(args, context, opts);
|
|
674
|
-
},
|
|
651
|
+
publishBlockV2,
|
|
652
|
+
publishBlindedBlockV2,
|
|
675
653
|
|
|
676
654
|
async publishExecutionPayloadEnvelope({signedExecutionPayloadEnvelope}) {
|
|
677
655
|
const seenTimestampSec = Date.now() / 1000;
|
|
@@ -686,9 +664,20 @@ export function getBeaconBlockApi({
|
|
|
686
664
|
}
|
|
687
665
|
|
|
688
666
|
// TODO GLOAS: review checks, do we want to implement `broadcast_validation`?
|
|
689
|
-
|
|
667
|
+
let block = chain.forkChoice.getBlockHex(blockRootHex, PayloadStatus.EMPTY);
|
|
690
668
|
if (block === null) {
|
|
691
|
-
|
|
669
|
+
// Only wait if the envelope is for the current slot
|
|
670
|
+
if (chain.clock.isCurrentSlotGivenGossipDisparity(slot)) {
|
|
671
|
+
chain.logger.debug("Execution payload envelope received before block, waiting for block to be imported", {
|
|
672
|
+
blockRoot: blockRootHex,
|
|
673
|
+
slot,
|
|
674
|
+
});
|
|
675
|
+
await chain.waitForBlock(slot, blockRootHex);
|
|
676
|
+
block = chain.forkChoice.getBlockHex(blockRootHex, PayloadStatus.EMPTY);
|
|
677
|
+
}
|
|
678
|
+
if (block === null) {
|
|
679
|
+
throw new ApiError(404, `Block not found for beacon block root ${blockRootHex}`);
|
|
680
|
+
}
|
|
692
681
|
}
|
|
693
682
|
if (block.slot !== slot) {
|
|
694
683
|
throw new ApiError(400, `Envelope slot ${slot} does not match block slot ${block.slot}`);
|
|
@@ -735,10 +724,11 @@ export function getBeaconBlockApi({
|
|
|
735
724
|
await sleep(msToBlockSlot);
|
|
736
725
|
}
|
|
737
726
|
|
|
738
|
-
// TODO GLOAS: if block and payload are submitted in parallel, payloadInput may not yet exist.
|
|
739
|
-
// A queuing mechanism is needed to handle this case. See https://github.com/ChainSafe/lodestar/issues/8915
|
|
740
727
|
const payloadInput = chain.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
741
728
|
if (!payloadInput) {
|
|
729
|
+
// The block is awaited above (queuing if the envelope arrived first), and both the API and
|
|
730
|
+
// gossip import paths seed the PayloadEnvelopeInput before importing the block, so the input
|
|
731
|
+
// should exist here.
|
|
742
732
|
throw new ApiError(404, `PayloadEnvelopeInput not found for block root ${blockRootHex}`);
|
|
743
733
|
}
|
|
744
734
|
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
isForkPostGloas,
|
|
10
10
|
} from "@lodestar/params";
|
|
11
11
|
import {isStatePostAltair} from "@lodestar/state-transition";
|
|
12
|
-
import {
|
|
12
|
+
import {Epoch, SingleAttestation, isElectraAttestation, ssz, sszTypesFor} from "@lodestar/types";
|
|
13
13
|
import {toRootHex} from "@lodestar/utils";
|
|
14
14
|
import {
|
|
15
15
|
AttestationError,
|
|
@@ -40,25 +40,6 @@ export function getBeaconPoolApi({
|
|
|
40
40
|
network,
|
|
41
41
|
}: Pick<ApiModules, "chain" | "logger" | "metrics" | "network">): ApplicationMethods<routes.beacon.pool.Endpoints> {
|
|
42
42
|
return {
|
|
43
|
-
async getPoolAttestations({slot, committeeIndex}) {
|
|
44
|
-
// Already filtered by slot
|
|
45
|
-
let attestations: Attestation[] = chain.aggregatedAttestationPool.getAll(slot);
|
|
46
|
-
const fork = chain.config.getForkName(slot ?? chain.clock.currentSlot);
|
|
47
|
-
|
|
48
|
-
if (isForkPostElectra(fork)) {
|
|
49
|
-
throw new ApiError(
|
|
50
|
-
400,
|
|
51
|
-
`Use getPoolAttestationsV2 to retrieve pool attestations for post-electra fork=${fork}`
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (committeeIndex !== undefined) {
|
|
56
|
-
attestations = attestations.filter((attestation) => committeeIndex === attestation.data.index);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return {data: attestations};
|
|
60
|
-
},
|
|
61
|
-
|
|
62
43
|
async getPoolAttestationsV2({slot, committeeIndex}) {
|
|
63
44
|
// Already filtered by slot
|
|
64
45
|
let attestations = chain.aggregatedAttestationPool.getAll(slot);
|
|
@@ -134,19 +115,6 @@ export function getBeaconPoolApi({
|
|
|
134
115
|
}
|
|
135
116
|
},
|
|
136
117
|
|
|
137
|
-
async getPoolAttesterSlashings() {
|
|
138
|
-
const fork = chain.config.getForkName(chain.clock.currentSlot);
|
|
139
|
-
|
|
140
|
-
if (isForkPostElectra(fork)) {
|
|
141
|
-
throw new ApiError(
|
|
142
|
-
400,
|
|
143
|
-
`Use getPoolAttesterSlashingsV2 to retrieve pool attester slashings for post-electra fork=${fork}`
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return {data: chain.opPool.getAllAttesterSlashings()};
|
|
148
|
-
},
|
|
149
|
-
|
|
150
118
|
async getPoolAttesterSlashingsV2() {
|
|
151
119
|
const fork = chain.config.getForkName(chain.clock.currentSlot);
|
|
152
120
|
return {data: chain.opPool.getAllAttesterSlashings(), meta: {version: fork}};
|
|
@@ -164,10 +132,6 @@ export function getBeaconPoolApi({
|
|
|
164
132
|
return {data: chain.opPool.getAllBlsToExecutionChanges().map(({data}) => data)};
|
|
165
133
|
},
|
|
166
134
|
|
|
167
|
-
async submitPoolAttestations({signedAttestations}) {
|
|
168
|
-
await this.submitPoolAttestationsV2({signedAttestations});
|
|
169
|
-
},
|
|
170
|
-
|
|
171
135
|
async submitPoolAttestationsV2({signedAttestations}) {
|
|
172
136
|
const fork = chain.config.getForkName(chain.clock.currentSlot);
|
|
173
137
|
const seenTimestampSec = Date.now() / 1000;
|
|
@@ -247,10 +211,6 @@ export function getBeaconPoolApi({
|
|
|
247
211
|
}
|
|
248
212
|
},
|
|
249
213
|
|
|
250
|
-
async submitPoolAttesterSlashings({attesterSlashing}) {
|
|
251
|
-
await this.submitPoolAttesterSlashingsV2({attesterSlashing});
|
|
252
|
-
},
|
|
253
|
-
|
|
254
214
|
async submitPoolAttesterSlashingsV2({attesterSlashing}) {
|
|
255
215
|
await validateApiAttesterSlashing(chain, attesterSlashing);
|
|
256
216
|
const fork = chain.config.getForkName(Number(attesterSlashing.attestation1.data.slot));
|
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
BASE_REWARDS_PER_EPOCH,
|
|
6
6
|
BLOB_TX_TYPE,
|
|
7
7
|
BLS_WITHDRAWAL_PREFIX,
|
|
8
|
+
BUILDER_DEPOSIT_REQUEST_TYPE,
|
|
9
|
+
BUILDER_EXIT_REQUEST_TYPE,
|
|
8
10
|
BUILDER_INDEX_FLAG,
|
|
9
11
|
BUILDER_INDEX_SELF_BUILD,
|
|
10
12
|
BUILDER_PAYMENT_THRESHOLD_DENOMINATOR,
|
|
@@ -21,6 +23,7 @@ import {
|
|
|
21
23
|
DOMAIN_BEACON_BUILDER,
|
|
22
24
|
DOMAIN_BEACON_PROPOSER,
|
|
23
25
|
DOMAIN_BLS_TO_EXECUTION_CHANGE,
|
|
26
|
+
DOMAIN_BUILDER_DEPOSIT,
|
|
24
27
|
DOMAIN_CONTRIBUTION_AND_PROOF,
|
|
25
28
|
DOMAIN_DEPOSIT,
|
|
26
29
|
DOMAIN_PROPOSER_PREFERENCES,
|
|
@@ -38,6 +41,7 @@ import {
|
|
|
38
41
|
JUSTIFICATION_BITS_LENGTH,
|
|
39
42
|
MAX_CONCURRENT_REQUESTS,
|
|
40
43
|
NODE_ID_BITS,
|
|
44
|
+
PAYLOAD_BUILDER_VERSION,
|
|
41
45
|
PROPOSER_WEIGHT,
|
|
42
46
|
SYNC_COMMITTEE_SUBNET_COUNT,
|
|
43
47
|
SYNC_REWARD_WEIGHT,
|
|
@@ -140,6 +144,10 @@ export const specConstants = {
|
|
|
140
144
|
BUILDER_INDEX_SELF_BUILD,
|
|
141
145
|
BUILDER_PAYMENT_THRESHOLD_NUMERATOR,
|
|
142
146
|
BUILDER_PAYMENT_THRESHOLD_DENOMINATOR,
|
|
147
|
+
PAYLOAD_BUILDER_VERSION,
|
|
148
|
+
DOMAIN_BUILDER_DEPOSIT,
|
|
149
|
+
BUILDER_DEPOSIT_REQUEST_TYPE: toHexByte(BUILDER_DEPOSIT_REQUEST_TYPE),
|
|
150
|
+
BUILDER_EXIT_REQUEST_TYPE: toHexByte(BUILDER_EXIT_REQUEST_TYPE),
|
|
143
151
|
};
|
|
144
152
|
|
|
145
153
|
/** Convert single-byte numbers to hex strings for API spec compliance */
|
|
@@ -280,6 +280,36 @@ export function getLodestarApi({
|
|
|
280
280
|
};
|
|
281
281
|
},
|
|
282
282
|
|
|
283
|
+
async getFastConfirmationInfo() {
|
|
284
|
+
const confirmedRoot = chain.forkChoice.getConfirmedRoot();
|
|
285
|
+
const confirmedBlock = chain.forkChoice.getConfirmedBlock();
|
|
286
|
+
const justifiedCheckpoint = chain.forkChoice.getJustifiedCheckpoint();
|
|
287
|
+
const finalizedCheckpoint = chain.forkChoice.getFinalizedCheckpoint();
|
|
288
|
+
const headRoot = chain.forkChoice.getHeadRoot();
|
|
289
|
+
const head = chain.forkChoice.getHead();
|
|
290
|
+
|
|
291
|
+
return {
|
|
292
|
+
data: {
|
|
293
|
+
confirmed: {
|
|
294
|
+
rootHex: confirmedRoot,
|
|
295
|
+
slot: confirmedBlock?.slot ?? null,
|
|
296
|
+
},
|
|
297
|
+
head: {
|
|
298
|
+
rootHex: headRoot,
|
|
299
|
+
slot: head.slot,
|
|
300
|
+
},
|
|
301
|
+
justifiedCheckpoint: {
|
|
302
|
+
rootHex: justifiedCheckpoint.rootHex,
|
|
303
|
+
epoch: justifiedCheckpoint.epoch,
|
|
304
|
+
},
|
|
305
|
+
finalizedCheckpoint: {
|
|
306
|
+
rootHex: finalizedCheckpoint.rootHex,
|
|
307
|
+
epoch: finalizedCheckpoint.epoch,
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
},
|
|
312
|
+
|
|
283
313
|
async getAttesterSlashingsFromBlocks({signedBlocks}) {
|
|
284
314
|
const attestations = new Map<Epoch, Attestation[]>();
|
|
285
315
|
|
|
@@ -1207,7 +1207,10 @@ export function getValidatorApi(
|
|
|
1207
1207
|
const isPostFulu = isForkPostFulu(config.getForkName(startSlot));
|
|
1208
1208
|
const maxFutureEpoch = isPostFulu && nearNextEpoch && opts?.v2 ? nextEpoch + 1 : nextEpoch;
|
|
1209
1209
|
if (currentEpoch >= 0 && epoch > maxFutureEpoch) {
|
|
1210
|
-
throw new ApiError(
|
|
1210
|
+
throw new ApiError(
|
|
1211
|
+
400,
|
|
1212
|
+
`Requested epoch ${epoch} must not be more than ${maxFutureEpoch}, currentEpoch=${currentEpoch}, v2=${opts?.v2 ?? false}`
|
|
1213
|
+
);
|
|
1211
1214
|
}
|
|
1212
1215
|
|
|
1213
1216
|
const head = chain.forkChoice.getHead();
|
|
@@ -1291,17 +1294,35 @@ export function getValidatorApi(
|
|
|
1291
1294
|
duties.push({slot: startSlot + i, validatorIndex: indexes[i], pubkey: pubkeys[i]});
|
|
1292
1295
|
}
|
|
1293
1296
|
|
|
1294
|
-
//
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1297
|
+
// In v2 the dependent root is different after fulu due to deterministic proposer lookahead
|
|
1298
|
+
let dependentRoot = proposerShufflingDecisionRoot(
|
|
1299
|
+
opts?.v2 ? config.getForkName(startSlot) : ForkName.phase0,
|
|
1300
|
+
state,
|
|
1301
|
+
epoch
|
|
1302
|
+
);
|
|
1303
|
+
const logCtx = {
|
|
1304
|
+
epoch,
|
|
1305
|
+
stateSlot: state.slot,
|
|
1306
|
+
stateEpoch: state.epoch,
|
|
1307
|
+
v2: opts?.v2 ?? false,
|
|
1308
|
+
};
|
|
1309
|
+
if (dependentRoot === null) {
|
|
1310
|
+
// fallback to get_proposer_duties() v1, also in lodestar v1.43
|
|
1311
|
+
logger.verbose("Proposer duties decision root not in state, falling back to state epoch", logCtx);
|
|
1312
|
+
dependentRoot = proposerShufflingDecisionRoot(ForkName.phase0, state, state.epoch);
|
|
1313
|
+
}
|
|
1314
|
+
if (dependentRoot === null) {
|
|
1315
|
+
logger.verbose("Proposer duties decision root not in state, falling back to genesis block root", logCtx);
|
|
1316
|
+
dependentRoot = await getGenesisBlockRoot(state);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
const dependentRootHex = toRootHex(dependentRoot);
|
|
1320
|
+
logger.verbose("Computed proposer duties decision root", {...logCtx, dependentRoot: dependentRootHex});
|
|
1300
1321
|
|
|
1301
1322
|
return {
|
|
1302
1323
|
data: duties,
|
|
1303
1324
|
meta: {
|
|
1304
|
-
dependentRoot:
|
|
1325
|
+
dependentRoot: dependentRootHex,
|
|
1305
1326
|
executionOptimistic: isOptimisticBlock(head),
|
|
1306
1327
|
},
|
|
1307
1328
|
};
|
|
@@ -1480,33 +1501,6 @@ export function getValidatorApi(
|
|
|
1480
1501
|
};
|
|
1481
1502
|
},
|
|
1482
1503
|
|
|
1483
|
-
async getAggregatedAttestation({attestationDataRoot, slot}) {
|
|
1484
|
-
notWhileSyncing();
|
|
1485
|
-
|
|
1486
|
-
await waitForSlot(slot); // Must never request for a future slot > currentSlot
|
|
1487
|
-
|
|
1488
|
-
const dataRootHex = toRootHex(attestationDataRoot);
|
|
1489
|
-
const aggregate = chain.attestationPool.getAggregate(slot, dataRootHex, null);
|
|
1490
|
-
const fork = chain.config.getForkName(slot);
|
|
1491
|
-
|
|
1492
|
-
if (isForkPostElectra(fork)) {
|
|
1493
|
-
throw new ApiError(
|
|
1494
|
-
400,
|
|
1495
|
-
`Use getAggregatedAttestationV2 to retrieve aggregated attestations for post-electra fork=${fork}`
|
|
1496
|
-
);
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
if (!aggregate) {
|
|
1500
|
-
throw new ApiError(404, `No aggregated attestation for slot=${slot}, dataRoot=${dataRootHex}`);
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
metrics?.production.producedAggregateParticipants.observe(aggregate.aggregationBits.getTrueBitIndexes().length);
|
|
1504
|
-
|
|
1505
|
-
return {
|
|
1506
|
-
data: aggregate,
|
|
1507
|
-
};
|
|
1508
|
-
},
|
|
1509
|
-
|
|
1510
1504
|
async getAggregatedAttestationV2({attestationDataRoot, slot, committeeIndex}) {
|
|
1511
1505
|
notWhileSyncing();
|
|
1512
1506
|
|
|
@@ -1530,10 +1524,6 @@ export function getValidatorApi(
|
|
|
1530
1524
|
};
|
|
1531
1525
|
},
|
|
1532
1526
|
|
|
1533
|
-
async publishAggregateAndProofs({signedAggregateAndProofs}) {
|
|
1534
|
-
await this.publishAggregateAndProofsV2({signedAggregateAndProofs});
|
|
1535
|
-
},
|
|
1536
|
-
|
|
1537
1527
|
async publishAggregateAndProofsV2({signedAggregateAndProofs}) {
|
|
1538
1528
|
notWhileSyncing();
|
|
1539
1529
|
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "@lodestar/state-transition";
|
|
23
23
|
import {Attestation, BeaconBlock, altair, capella, electra, isGloasBeaconBlock, phase0, ssz} from "@lodestar/types";
|
|
24
24
|
import {isErrorAborted, toRootHex} from "@lodestar/utils";
|
|
25
|
-
import {ZERO_HASH_HEX} from "../../constants/index.js";
|
|
25
|
+
import {GENESIS_SLOT, ZERO_HASH_HEX} from "../../constants/index.js";
|
|
26
26
|
import {callInNextEventLoop} from "../../util/eventLoop.js";
|
|
27
27
|
import {isOptimisticBlock} from "../../util/forkChoice.js";
|
|
28
28
|
import {isQueueErrorAborted} from "../../util/queue/index.js";
|
|
@@ -189,10 +189,12 @@ export async function importBlock(
|
|
|
189
189
|
this.seenBlockAttesters.addIndices(blockEpoch, indexedAttestation.attestingIndices);
|
|
190
190
|
|
|
191
191
|
const correctHead = ssz.Root.equals(rootCache.getBlockRootAtSlot(attestation.data.slot), beaconBlockRoot);
|
|
192
|
-
const missedSlotVote =
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
const missedSlotVote =
|
|
193
|
+
attestation.data.slot > GENESIS_SLOT &&
|
|
194
|
+
ssz.Root.equals(
|
|
195
|
+
rootCache.getBlockRootAtSlot(attestation.data.slot - 1),
|
|
196
|
+
rootCache.getBlockRootAtSlot(attestation.data.slot)
|
|
197
|
+
);
|
|
196
198
|
this.validatorMonitor?.registerAttestationInBlock(
|
|
197
199
|
indexedAttestation,
|
|
198
200
|
parentBlockSlot,
|
|
@@ -61,10 +61,8 @@ 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 (
|
|
65
|
-
throw new Error(
|
|
66
|
-
`Gas limit mismatch between payload and bid payload=${payload.gasLimit} bid=${Number(bid.gasLimit)}`
|
|
67
|
-
);
|
|
64
|
+
if (bid.gasLimit !== payload.gasLimit) {
|
|
65
|
+
throw new Error(`Gas limit mismatch between payload and bid payload=${payload.gasLimit} bid=${bid.gasLimit}`);
|
|
68
66
|
}
|
|
69
67
|
if (!byteArrayEquals(bid.blockHash, payload.blockHash)) {
|
|
70
68
|
throw new Error(
|
|
@@ -74,7 +72,7 @@ export function verifyExecutionPayloadEnvelope(
|
|
|
74
72
|
// Verify execution_requests_root matches bid commitment.
|
|
75
73
|
// Can be skipped if already verified during gossip validation.
|
|
76
74
|
if (verifyExecutionRequestsRoot) {
|
|
77
|
-
const requestsRoot = ssz.
|
|
75
|
+
const requestsRoot = ssz.gloas.ExecutionRequests.hashTreeRoot(envelope.executionRequests);
|
|
78
76
|
if (!byteArrayEquals(requestsRoot, bid.executionRequestsRoot)) {
|
|
79
77
|
throw new Error(
|
|
80
78
|
`Execution requests root mismatch envelope=${toRootHex(requestsRoot)} bid=${toRootHex(bid.executionRequestsRoot)}`
|
package/src/chain/chain.ts
CHANGED
|
@@ -2,7 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import {PrivateKey} from "@libp2p/interface";
|
|
3
3
|
import {Type} from "@chainsafe/ssz";
|
|
4
4
|
import {BeaconConfig} from "@lodestar/config";
|
|
5
|
-
import {CheckpointWithHex, IForkChoice, ProtoBlock, UpdateHeadOpt} from "@lodestar/fork-choice";
|
|
5
|
+
import {CheckpointWithHex, ForkChoiceStateGetter, IForkChoice, ProtoBlock, UpdateHeadOpt} from "@lodestar/fork-choice";
|
|
6
6
|
import {LoggerNode} from "@lodestar/logger/node";
|
|
7
7
|
import {
|
|
8
8
|
EFFECTIVE_BALANCE_INCREMENT,
|
|
@@ -40,7 +40,6 @@ import {
|
|
|
40
40
|
ValidatorIndex,
|
|
41
41
|
Wei,
|
|
42
42
|
deneb,
|
|
43
|
-
electra,
|
|
44
43
|
gloas,
|
|
45
44
|
isBlindedBeaconBlock,
|
|
46
45
|
phase0,
|
|
@@ -382,6 +381,14 @@ export class BeaconChain implements IBeaconChain {
|
|
|
382
381
|
blockStateCache.setHeadState(anchorState);
|
|
383
382
|
checkpointStateCache.add(checkpoint, anchorState);
|
|
384
383
|
|
|
384
|
+
const forkChoiceStateGetter: ForkChoiceStateGetter = ({stateRoot, checkpoint}) => {
|
|
385
|
+
if (stateRoot) return blockStateCache.get(stateRoot);
|
|
386
|
+
|
|
387
|
+
if (checkpoint) return checkpointStateCache.get({epoch: checkpoint.epoch, rootHex: checkpoint.rootHex});
|
|
388
|
+
|
|
389
|
+
return null;
|
|
390
|
+
};
|
|
391
|
+
|
|
385
392
|
const forkChoice = initializeForkChoice(
|
|
386
393
|
config,
|
|
387
394
|
emitter,
|
|
@@ -390,6 +397,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
390
397
|
isAnchorStateFinalized,
|
|
391
398
|
opts,
|
|
392
399
|
this.justifiedBalancesGetter.bind(this),
|
|
400
|
+
forkChoiceStateGetter,
|
|
393
401
|
metrics,
|
|
394
402
|
logger
|
|
395
403
|
);
|
|
@@ -916,10 +924,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
916
924
|
async getParentExecutionRequests(
|
|
917
925
|
parentBlockSlot: Slot,
|
|
918
926
|
parentBlockRootHex: RootHex
|
|
919
|
-
): Promise<
|
|
927
|
+
): Promise<gloas.ExecutionRequests> {
|
|
920
928
|
// at the fork boundary, parent is pre-gloas
|
|
921
929
|
if (!isForkPostGloas(this.config.getForkName(parentBlockSlot))) {
|
|
922
|
-
return ssz.
|
|
930
|
+
return ssz.gloas.ExecutionRequests.defaultValue();
|
|
923
931
|
}
|
|
924
932
|
const envelope = await this.getExecutionPayloadEnvelope(parentBlockSlot, parentBlockRootHex);
|
|
925
933
|
if (envelope === null) {
|
package/src/chain/emitter.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {StrictEventEmitter} from "strict-event-emitter-types";
|
|
|
3
3
|
import {routes} from "@lodestar/api";
|
|
4
4
|
import {CheckpointWithHex} from "@lodestar/fork-choice";
|
|
5
5
|
import {IBeaconStateView} from "@lodestar/state-transition";
|
|
6
|
-
import {DataColumnSidecar, RootHex, deneb, phase0} from "@lodestar/types";
|
|
6
|
+
import {DataColumnSidecar, RootHex, Slot, deneb, phase0} from "@lodestar/types";
|
|
7
7
|
import {PeerIdStr} from "../util/peerId.js";
|
|
8
8
|
import {BlockInputSource, IBlockInput} from "./blocks/blockInput/types.js";
|
|
9
9
|
import {PayloadEnvelopeInput} from "./blocks/payloadEnvelopeInput/payloadEnvelopeInput.js";
|
|
@@ -94,7 +94,8 @@ export type ChainEventData = {
|
|
|
94
94
|
peer: PeerIdStr;
|
|
95
95
|
source: BlockInputSource;
|
|
96
96
|
};
|
|
97
|
-
|
|
97
|
+
// slot is the message slot, not necessarily the envelope's slot, but useful as a logging/prune hint
|
|
98
|
+
[ChainEvent.unknownEnvelopeBlockRoot]: {rootHex: RootHex; slot: Slot; peer?: PeerIdStr; source: BlockInputSource};
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
export type IChainEvents = ApiEvents & {
|
|
@@ -61,9 +61,6 @@ export enum BlockErrorCode {
|
|
|
61
61
|
TRANSACTIONS_TOO_BIG = "BLOCK_ERROR_TRANSACTIONS_TOO_BIG",
|
|
62
62
|
/** Execution engine is unavailable, syncing, or api call errored. Peers must not be downscored on this code */
|
|
63
63
|
EXECUTION_ENGINE_ERROR = "BLOCK_ERROR_EXECUTION_ERROR",
|
|
64
|
-
/** The attestation head block is too far behind the attestation slot, causing many skip slots.
|
|
65
|
-
This is deemed a DoS risk */
|
|
66
|
-
TOO_MANY_SKIPPED_SLOTS = "TOO_MANY_SKIPPED_SLOTS",
|
|
67
64
|
/** The blobs are unavailable */
|
|
68
65
|
DATA_UNAVAILABLE = "BLOCK_ERROR_DATA_UNAVAILABLE",
|
|
69
66
|
/** Block contains too many kzg commitments */
|
|
@@ -89,7 +86,6 @@ export type BlockErrorType =
|
|
|
89
86
|
| {code: BlockErrorCode.FUTURE_SLOT; blockSlot: Slot; currentSlot: Slot}
|
|
90
87
|
| {code: BlockErrorCode.STATE_ROOT_MISMATCH}
|
|
91
88
|
| {code: BlockErrorCode.GENESIS_BLOCK}
|
|
92
|
-
| {code: BlockErrorCode.TOO_MANY_SKIPPED_SLOTS; parentSlot: Slot; blockSlot: Slot}
|
|
93
89
|
| {code: BlockErrorCode.WOULD_REVERT_FINALIZED_SLOT; blockSlot: Slot; finalizedSlot: Slot}
|
|
94
90
|
| {code: BlockErrorCode.ALREADY_KNOWN; root: RootHex}
|
|
95
91
|
| {code: BlockErrorCode.REPEAT_PROPOSAL; proposerIndex: ValidatorIndex}
|
|
@@ -3,6 +3,7 @@ import {GossipActionError} from "./gossipValidation.js";
|
|
|
3
3
|
|
|
4
4
|
export enum ExecutionPayloadBidErrorCode {
|
|
5
5
|
BUILDER_NOT_ELIGIBLE = "EXECUTION_PAYLOAD_BID_ERROR_BUILDER_NOT_ELIGIBLE",
|
|
6
|
+
INVALID_BUILDER_VERSION = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_BUILDER_VERSION",
|
|
6
7
|
NON_ZERO_EXECUTION_PAYMENT = "EXECUTION_PAYLOAD_BID_ERROR_NON_ZERO_EXECUTION_PAYMENT",
|
|
7
8
|
BID_ALREADY_KNOWN = "EXECUTION_PAYLOAD_BID_ERROR_BID_ALREADY_KNOWN",
|
|
8
9
|
BID_TOO_LOW = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_LOW",
|
|
@@ -12,6 +13,7 @@ export enum ExecutionPayloadBidErrorCode {
|
|
|
12
13
|
UNKNOWN_PARENT_BLOCK_HASH = "EXECUTION_PAYLOAD_BID_ERROR_UNKNOWN_PARENT_BLOCK_HASH",
|
|
13
14
|
INVALID_SLOT = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_SLOT",
|
|
14
15
|
NOT_LATER_THAN_PARENT = "EXECUTION_PAYLOAD_BID_ERROR_NOT_LATER_THAN_PARENT",
|
|
16
|
+
INVALID_PREV_RANDAO = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_PREV_RANDAO",
|
|
15
17
|
INVALID_SIGNATURE = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_SIGNATURE",
|
|
16
18
|
NO_MATCHING_PROPOSER_PREFERENCES = "EXECUTION_PAYLOAD_BID_ERROR_NO_MATCHING_PROPOSER_PREFERENCES",
|
|
17
19
|
PROPOSER_PREFERENCES_FEE_RECIPIENT_MISMATCH = "EXECUTION_PAYLOAD_BID_ERROR_PROPOSER_PREFERENCES_FEE_RECIPIENT_MISMATCH",
|
|
@@ -20,6 +22,12 @@ export enum ExecutionPayloadBidErrorCode {
|
|
|
20
22
|
|
|
21
23
|
export type ExecutionPayloadBidErrorType =
|
|
22
24
|
| {code: ExecutionPayloadBidErrorCode.BUILDER_NOT_ELIGIBLE; builderIndex: BuilderIndex}
|
|
25
|
+
| {
|
|
26
|
+
code: ExecutionPayloadBidErrorCode.INVALID_BUILDER_VERSION;
|
|
27
|
+
builderIndex: BuilderIndex;
|
|
28
|
+
version: number;
|
|
29
|
+
expectedVersion: number;
|
|
30
|
+
}
|
|
23
31
|
| {
|
|
24
32
|
code: ExecutionPayloadBidErrorCode.NON_ZERO_EXECUTION_PAYMENT;
|
|
25
33
|
builderIndex: BuilderIndex;
|
|
@@ -43,6 +51,12 @@ export type ExecutionPayloadBidErrorType =
|
|
|
43
51
|
| {code: ExecutionPayloadBidErrorCode.UNKNOWN_PARENT_BLOCK_HASH; parentBlockHash: RootHex}
|
|
44
52
|
| {code: ExecutionPayloadBidErrorCode.INVALID_SLOT; builderIndex: BuilderIndex; slot: Slot}
|
|
45
53
|
| {code: ExecutionPayloadBidErrorCode.NOT_LATER_THAN_PARENT; parentSlot: Slot; slot: Slot}
|
|
54
|
+
| {
|
|
55
|
+
code: ExecutionPayloadBidErrorCode.INVALID_PREV_RANDAO;
|
|
56
|
+
builderIndex: BuilderIndex;
|
|
57
|
+
bidPrevRandao: string;
|
|
58
|
+
expectedPrevRandao: string;
|
|
59
|
+
}
|
|
46
60
|
| {code: ExecutionPayloadBidErrorCode.INVALID_SIGNATURE; builderIndex: BuilderIndex; slot: Slot}
|
|
47
61
|
| {
|
|
48
62
|
code: ExecutionPayloadBidErrorCode.NO_MATCHING_PROPOSER_PREFERENCES;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import {routes} from "@lodestar/api";
|
|
1
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
3
|
import {
|
|
3
4
|
ExecutionStatus,
|
|
4
5
|
ForkChoice,
|
|
6
|
+
ForkChoiceStateGetter,
|
|
5
7
|
ForkChoiceStore,
|
|
6
8
|
JustifiedBalancesGetter,
|
|
7
9
|
PayloadStatus,
|
|
@@ -45,6 +47,7 @@ export function initializeForkChoice(
|
|
|
45
47
|
isFinalizedState: boolean,
|
|
46
48
|
opts: ForkChoiceOpts,
|
|
47
49
|
justifiedBalancesGetter: JustifiedBalancesGetter,
|
|
50
|
+
stateGetter: ForkChoiceStateGetter,
|
|
48
51
|
metrics: Metrics | null,
|
|
49
52
|
logger?: Logger
|
|
50
53
|
): ForkChoice {
|
|
@@ -56,6 +59,7 @@ export function initializeForkChoice(
|
|
|
56
59
|
state,
|
|
57
60
|
opts,
|
|
58
61
|
justifiedBalancesGetter,
|
|
62
|
+
stateGetter,
|
|
59
63
|
metrics,
|
|
60
64
|
logger
|
|
61
65
|
)
|
|
@@ -66,6 +70,7 @@ export function initializeForkChoice(
|
|
|
66
70
|
state,
|
|
67
71
|
opts,
|
|
68
72
|
justifiedBalancesGetter,
|
|
73
|
+
stateGetter,
|
|
69
74
|
metrics,
|
|
70
75
|
logger
|
|
71
76
|
);
|
|
@@ -81,6 +86,7 @@ export function initializeForkChoiceFromFinalizedState(
|
|
|
81
86
|
state: IBeaconStateView,
|
|
82
87
|
opts: ForkChoiceOpts,
|
|
83
88
|
justifiedBalancesGetter: JustifiedBalancesGetter,
|
|
89
|
+
stateGetter: ForkChoiceStateGetter,
|
|
84
90
|
metrics: Metrics | null,
|
|
85
91
|
logger?: Logger
|
|
86
92
|
): ForkChoice {
|
|
@@ -112,9 +118,12 @@ export function initializeForkChoiceFromFinalizedState(
|
|
|
112
118
|
finalizedCheckpoint,
|
|
113
119
|
justifiedBalances,
|
|
114
120
|
justifiedBalancesGetter,
|
|
121
|
+
stateGetter,
|
|
115
122
|
{
|
|
116
123
|
onJustified: (cp) => emitter.emit(ChainEvent.forkChoiceJustified, cp),
|
|
117
124
|
onFinalized: (cp) => emitter.emit(ChainEvent.forkChoiceFinalized, cp),
|
|
125
|
+
onFastConfirmation: ({block, slot, currentSlot}) =>
|
|
126
|
+
emitter.emit(routes.events.EventType.fastConfirmation, {block, slot, currentSlot}),
|
|
118
127
|
}
|
|
119
128
|
),
|
|
120
129
|
|
|
@@ -172,6 +181,7 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
172
181
|
unfinalizedState: IBeaconStateView,
|
|
173
182
|
opts: ForkChoiceOpts,
|
|
174
183
|
justifiedBalancesGetter: JustifiedBalancesGetter,
|
|
184
|
+
stateGetter: ForkChoiceStateGetter,
|
|
175
185
|
metrics: Metrics | null,
|
|
176
186
|
logger?: Logger
|
|
177
187
|
): ForkChoice {
|
|
@@ -203,9 +213,12 @@ export function initializeForkChoiceFromUnfinalizedState(
|
|
|
203
213
|
finalizedCheckpoint,
|
|
204
214
|
justifiedBalances,
|
|
205
215
|
justifiedBalancesGetter,
|
|
216
|
+
stateGetter,
|
|
206
217
|
{
|
|
207
218
|
onJustified: (cp) => emitter.emit(ChainEvent.forkChoiceJustified, cp),
|
|
208
219
|
onFinalized: (cp) => emitter.emit(ChainEvent.forkChoiceFinalized, cp),
|
|
220
|
+
onFastConfirmation: ({block, slot, currentSlot}) =>
|
|
221
|
+
emitter.emit(routes.events.EventType.fastConfirmation, {block, slot, currentSlot}),
|
|
209
222
|
}
|
|
210
223
|
);
|
|
211
224
|
|
package/src/chain/interface.ts
CHANGED
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
altair,
|
|
19
19
|
capella,
|
|
20
20
|
deneb,
|
|
21
|
-
electra,
|
|
22
21
|
gloas,
|
|
23
22
|
phase0,
|
|
24
23
|
rewards,
|
|
@@ -236,7 +235,7 @@ export interface IBeaconChain {
|
|
|
236
235
|
blockSlot: Slot,
|
|
237
236
|
blockRootHex: string
|
|
238
237
|
): Promise<gloas.SignedExecutionPayloadEnvelope | null>;
|
|
239
|
-
getParentExecutionRequests(parentBlockSlot: Slot, parentBlockRootHex: RootHex): Promise<
|
|
238
|
+
getParentExecutionRequests(parentBlockSlot: Slot, parentBlockRootHex: RootHex): Promise<gloas.ExecutionRequests>;
|
|
240
239
|
|
|
241
240
|
produceCommonBlockBody(blockAttributes: BlockAttributes): Promise<CommonBlockBody>;
|
|
242
241
|
produceBlock(blockAttributes: BlockAttributes & {commonBlockBodyPromise: Promise<CommonBlockBody>}): Promise<{
|
package/src/chain/options.ts
CHANGED
|
@@ -105,6 +105,7 @@ export const defaultChainOptions: IChainOptions = {
|
|
|
105
105
|
proposerBoost: true,
|
|
106
106
|
proposerBoostReorg: true,
|
|
107
107
|
computeUnrealized: true,
|
|
108
|
+
fastConfirmation: false,
|
|
108
109
|
suggestedFeeRecipient: defaultValidatorOptions.suggestedFeeRecipient,
|
|
109
110
|
serveHistoricalState: false,
|
|
110
111
|
assertCorrectProgressiveBalances: false,
|