@lodestar/validator 1.47.0-rc.0 → 1.48.0-dev.02b355c4db
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/services/block.js +3 -3
- package/lib/services/block.js.map +1 -1
- package/lib/services/builderPreferences.js +1 -1
- package/lib/services/builderPreferences.js.map +1 -1
- package/lib/services/prepareBeaconProposer.d.ts.map +1 -1
- package/lib/services/prepareBeaconProposer.js +5 -2
- package/lib/services/prepareBeaconProposer.js.map +1 -1
- package/lib/services/validatorStore.d.ts +5 -1
- package/lib/services/validatorStore.d.ts.map +1 -1
- package/lib/services/validatorStore.js +24 -20
- package/lib/services/validatorStore.js.map +1 -1
- package/lib/slashingProtection/attestation/attestationByTargetRepository.d.ts +2 -0
- package/lib/slashingProtection/attestation/attestationByTargetRepository.d.ts.map +1 -1
- package/lib/slashingProtection/attestation/attestationByTargetRepository.js +11 -0
- package/lib/slashingProtection/attestation/attestationByTargetRepository.js.map +1 -1
- package/lib/slashingProtection/attestation/errors.d.ts +10 -1
- package/lib/slashingProtection/attestation/errors.d.ts.map +1 -1
- package/lib/slashingProtection/attestation/errors.js +5 -0
- package/lib/slashingProtection/attestation/errors.js.map +1 -1
- package/lib/slashingProtection/attestation/index.d.ts.map +1 -1
- package/lib/slashingProtection/attestation/index.js +41 -2
- package/lib/slashingProtection/attestation/index.js.map +1 -1
- package/lib/slashingProtection/minMaxSurround/minMaxSurround.d.ts +3 -1
- package/lib/slashingProtection/minMaxSurround/minMaxSurround.d.ts.map +1 -1
- package/lib/slashingProtection/minMaxSurround/minMaxSurround.js +7 -2
- package/lib/slashingProtection/minMaxSurround/minMaxSurround.js.map +1 -1
- package/lib/validator.d.ts.map +1 -1
- package/lib/validator.js +14 -3
- package/lib/validator.js.map +1 -1
- package/package.json +13 -13
- package/src/services/block.ts +3 -3
- package/src/services/builderPreferences.ts +1 -1
- package/src/services/prepareBeaconProposer.ts +5 -2
- package/src/services/validatorStore.ts +33 -24
- package/src/slashingProtection/attestation/attestationByTargetRepository.ts +12 -0
- package/src/slashingProtection/attestation/errors.ts +10 -0
- package/src/slashingProtection/attestation/index.ts +43 -2
- package/src/slashingProtection/minMaxSurround/minMaxSurround.ts +9 -3
- package/src/validator.ts +28 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {BLSPubkey} from "@lodestar/types";
|
|
1
|
+
import {BLSPubkey, Epoch} from "@lodestar/types";
|
|
2
2
|
import {SurroundAttestationError, SurroundAttestationErrorCode} from "./errors.js";
|
|
3
3
|
import {DistanceEntry, IDistanceStore, IMinMaxSurround, MinMaxSurroundAttestation} from "./interface.js";
|
|
4
4
|
|
|
@@ -9,7 +9,8 @@ import {DistanceEntry, IDistanceStore, IMinMaxSurround, MinMaxSurroundAttestatio
|
|
|
9
9
|
* Number of epochs in the past to check for surrounding attestations.
|
|
10
10
|
*
|
|
11
11
|
* This value can be limited to a reasonable high amount as Lodestar does not solely rely on this strategy but also
|
|
12
|
-
*
|
|
12
|
+
* rejects any source epoch below `minSpanCoverageStart` of the latest recorded attestation, which is the minimal
|
|
13
|
+
* strategy (formally proven safe, https://github.com/michaelsproul/slashing-proofs) relaxed by this lookback.
|
|
13
14
|
*
|
|
14
15
|
* Limiting this value is required due to practical reasons as otherwise there would be a min-span DB read and write
|
|
15
16
|
* for each validator from current epoch until genesis which massively increases DB size and causes I/O lag, resulting in
|
|
@@ -30,6 +31,11 @@ export class MinMaxSurround implements IMinMaxSurround {
|
|
|
30
31
|
this.maxEpochLookback = options?.maxEpochLookback ?? DEFAULT_MAX_EPOCH_LOOKBACK;
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
/** Lowest epoch with a min-span entry after inserting an attestation with `sourceEpoch` */
|
|
35
|
+
minSpanCoverageStart(sourceEpoch: Epoch): Epoch {
|
|
36
|
+
return Math.max(0, sourceEpoch - 1 - this.maxEpochLookback);
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
async assertNoSurround(pubKey: BLSPubkey, attestation: MinMaxSurroundAttestation): Promise<void> {
|
|
34
40
|
await this.assertNotSurrounding(pubKey, attestation);
|
|
35
41
|
await this.assertNotSurrounded(pubKey, attestation);
|
|
@@ -45,7 +51,7 @@ export class MinMaxSurround implements IMinMaxSurround {
|
|
|
45
51
|
private async updateMinSpan(pubKey: BLSPubkey, attestation: MinMaxSurroundAttestation): Promise<void> {
|
|
46
52
|
await this.assertNotSurrounding(pubKey, attestation);
|
|
47
53
|
|
|
48
|
-
const untilEpoch =
|
|
54
|
+
const untilEpoch = this.minSpanCoverageStart(attestation.sourceEpoch);
|
|
49
55
|
|
|
50
56
|
const values: DistanceEntry[] = [];
|
|
51
57
|
for (let epoch = attestation.sourceEpoch - 1; epoch >= untilEpoch; epoch--) {
|
package/src/validator.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import {Clock, ClockOptions, IClock, computeEpochAtSlot, getCurrentSlot} from "@lodestar/state-transition";
|
|
10
10
|
import {BLSPubkey, phase0, ssz} from "@lodestar/types";
|
|
11
11
|
import {Genesis} from "@lodestar/types/phase0";
|
|
12
|
-
import {Logger, toPrintableUrl, toRootHex} from "@lodestar/utils";
|
|
12
|
+
import {Logger, prettyGweiToEth, toPrintableUrl, toRootHex} from "@lodestar/utils";
|
|
13
13
|
import {waitForGenesis} from "./genesis.js";
|
|
14
14
|
import {Metrics} from "./metrics.js";
|
|
15
15
|
import {MetaDataRepository} from "./repositories/metaDataRepository.js";
|
|
@@ -27,7 +27,14 @@ import {ProposerPreferencesService} from "./services/proposerPreferences.js";
|
|
|
27
27
|
import {PtcService} from "./services/ptc.js";
|
|
28
28
|
import {SyncCommitteeService} from "./services/syncCommittee.js";
|
|
29
29
|
import {SyncingStatusTracker} from "./services/syncingStatusTracker.js";
|
|
30
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
Signer,
|
|
32
|
+
ValidatorProposerConfig,
|
|
33
|
+
ValidatorStore,
|
|
34
|
+
defaultOptions,
|
|
35
|
+
getBuilderBoostFactor,
|
|
36
|
+
getDefaultBuilderSelection,
|
|
37
|
+
} from "./services/validatorStore.js";
|
|
31
38
|
import {ISlashingProtection, Interchange, InterchangeFormatVersion} from "./slashingProtection/index.js";
|
|
32
39
|
import {LodestarValidatorDatabaseController, ProcessShutdownCallback, PubkeyHex} from "./types.js";
|
|
33
40
|
import {getLoggerVc} from "./util/index.js";
|
|
@@ -369,8 +376,9 @@ export class Validator {
|
|
|
369
376
|
logger.info("Verified connected beacon node and validator have the same genesisValidatorRoot");
|
|
370
377
|
|
|
371
378
|
const {broadcastValidation = defaultOptions.broadcastValidation, valProposerConfig} = opts;
|
|
379
|
+
const gloasScheduled = config.GLOAS_FORK_EPOCH !== Infinity;
|
|
372
380
|
const defaultBuilderSelection =
|
|
373
|
-
valProposerConfig?.defaultConfig.builder?.selection ??
|
|
381
|
+
valProposerConfig?.defaultConfig.builder?.selection ?? getDefaultBuilderSelection(gloasScheduled);
|
|
374
382
|
const strictFeeRecipientCheck = valProposerConfig?.defaultConfig.strictFeeRecipientCheck ?? false;
|
|
375
383
|
const suggestedFeeRecipient = valProposerConfig?.defaultConfig.feeRecipient ?? defaultOptions.suggestedFeeRecipient;
|
|
376
384
|
|
|
@@ -383,6 +391,23 @@ export class Validator {
|
|
|
383
391
|
|
|
384
392
|
metrics?.defaultConfiguration.set({builderSelection: defaultBuilderSelection, broadcastValidation}, 1);
|
|
385
393
|
|
|
394
|
+
if (gloasScheduled) {
|
|
395
|
+
const defaultBuilderConfig = valProposerConfig?.defaultConfig.builder;
|
|
396
|
+
const defaultBuilders = defaultBuilderConfig?.builders ?? [];
|
|
397
|
+
|
|
398
|
+
logger.info("Builder config", {
|
|
399
|
+
builders: defaultBuilders.map((entry) => toPrintableUrl(entry.url)).join(",") || "p2p only",
|
|
400
|
+
boostFactor: getBuilderBoostFactor(
|
|
401
|
+
defaultBuilderSelection,
|
|
402
|
+
defaultBuilderConfig?.boostFactor ?? defaultOptions.builderBoostFactor
|
|
403
|
+
),
|
|
404
|
+
minBid: prettyGweiToEth(defaultBuilderConfig?.minBid ?? defaultOptions.builderMinBid),
|
|
405
|
+
maxExecutionPayment: prettyGweiToEth(
|
|
406
|
+
defaultBuilderConfig?.maxExecutionPayment ?? defaultOptions.builderMaxExecutionPayment
|
|
407
|
+
),
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
|
|
386
411
|
// Instantiates block and attestation services and runs them once the chain has been started.
|
|
387
412
|
return Validator.init(opts, genesis, metrics);
|
|
388
413
|
}
|