@lodestar/validator 1.44.0-rc.3 → 1.45.0-dev.05395cd726
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.
|
@@ -10,7 +10,10 @@ import { ValidatorStore } from "./validatorStore.js";
|
|
|
10
10
|
* dependent root for an epoch shifts (e.g. after a reorg) — detected by comparing the cached
|
|
11
11
|
* `dependentRoot` reported by `BlockDutiesService` against the one we last submitted under.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* Proposers should broadcast their preferences before the fork so the proposer preference caches
|
|
14
|
+
* of beacon nodes and builders are warm for the first Gloas slots. We start submitting
|
|
15
|
+
* as soon as a duty's proposal slot is in Gloas, which is up to `SUBMIT_BEFORE_PROPOSAL_SLOTS`
|
|
16
|
+
* before the fork, so only the first few Gloas slots are affected by this pre-fork submission.
|
|
14
17
|
*/
|
|
15
18
|
export declare class ProposerPreferencesService {
|
|
16
19
|
private readonly config;
|
|
@@ -21,5 +24,7 @@ export declare class ProposerPreferencesService {
|
|
|
21
24
|
private readonly submitted;
|
|
22
25
|
constructor(config: ChainForkConfig, logger: LoggerVc, api: ApiClient, clock: IClock, validatorStore: ValidatorStore, blockDutiesService: BlockDutiesService, _metrics: Metrics | null);
|
|
23
26
|
private runProposerPreferencesTask;
|
|
27
|
+
/** Drop tracking for past epochs; only currentEpoch and currentEpoch + 1 are ever processed. */
|
|
28
|
+
private pruneSubmitted;
|
|
24
29
|
}
|
|
25
30
|
//# sourceMappingURL=proposerPreferences.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposerPreferences.d.ts","sourceRoot":"","sources":["../../src/services/proposerPreferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAKjD,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAgBnD
|
|
1
|
+
{"version":3,"file":"proposerPreferences.d.ts","sourceRoot":"","sources":["../../src/services/proposerPreferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAKjD,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAgBnD;;;;;;;;;;GAUG;AACH,qBAAa,0BAA0B;IAInC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAEpB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IARrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsC;IAEhE,YACmB,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,QAAQ,EAChB,GAAG,EAAE,SAAS,EAC/B,KAAK,EAAE,MAAM,EACI,cAAc,EAAE,cAAc,EAC9B,kBAAkB,EAAE,kBAAkB,EACvD,QAAQ,EAAE,OAAO,GAAG,IAAI,EAIzB;IAED,OAAO,CAAC,0BAA0B,CA8EhC;IAEF,gGAAgG;IAChG,OAAO,CAAC,cAAc,CAMpB;CACH"}
|
|
@@ -17,7 +17,10 @@ const SUBMIT_BEFORE_PROPOSAL_SLOTS = Math.floor(SLOTS_PER_EPOCH / 4);
|
|
|
17
17
|
* dependent root for an epoch shifts (e.g. after a reorg) — detected by comparing the cached
|
|
18
18
|
* `dependentRoot` reported by `BlockDutiesService` against the one we last submitted under.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* Proposers should broadcast their preferences before the fork so the proposer preference caches
|
|
21
|
+
* of beacon nodes and builders are warm for the first Gloas slots. We start submitting
|
|
22
|
+
* as soon as a duty's proposal slot is in Gloas, which is up to `SUBMIT_BEFORE_PROPOSAL_SLOTS`
|
|
23
|
+
* before the fork, so only the first few Gloas slots are affected by this pre-fork submission.
|
|
21
24
|
*/
|
|
22
25
|
export class ProposerPreferencesService {
|
|
23
26
|
config;
|
|
@@ -33,9 +36,13 @@ export class ProposerPreferencesService {
|
|
|
33
36
|
this.validatorStore = validatorStore;
|
|
34
37
|
this.blockDutiesService = blockDutiesService;
|
|
35
38
|
clock.runEverySlot(this.runProposerPreferencesTask);
|
|
39
|
+
clock.runEveryEpoch(this.pruneSubmitted);
|
|
36
40
|
}
|
|
37
41
|
runProposerPreferencesTask = async (slot) => {
|
|
38
|
-
|
|
42
|
+
// Start running once the submission window (`slot + SUBMIT_BEFORE_PROPOSAL_SLOTS`) reaches
|
|
43
|
+
// Gloas, i.e. already in the epoch before the fork. This allows builders to prepare and
|
|
44
|
+
// submit bids for the first Gloas slots.
|
|
45
|
+
if (!isForkPostGloas(this.config.getForkName(slot + SUBMIT_BEFORE_PROPOSAL_SLOTS))) {
|
|
39
46
|
return;
|
|
40
47
|
}
|
|
41
48
|
const currentEpoch = computeEpochAtSlot(slot);
|
|
@@ -68,6 +75,8 @@ export class ProposerPreferencesService {
|
|
|
68
75
|
continue;
|
|
69
76
|
if (duty.slot > slot + SUBMIT_BEFORE_PROPOSAL_SLOTS)
|
|
70
77
|
continue;
|
|
78
|
+
if (!isForkPostGloas(this.config.getForkName(duty.slot)))
|
|
79
|
+
continue;
|
|
71
80
|
if (submission.slots.has(duty.slot))
|
|
72
81
|
continue;
|
|
73
82
|
try {
|
|
@@ -97,5 +106,13 @@ export class ProposerPreferencesService {
|
|
|
97
106
|
this.logger.error("Error submitting signed proposer preferences", { count: batch.length }, e);
|
|
98
107
|
}
|
|
99
108
|
};
|
|
109
|
+
/** Drop tracking for past epochs; only currentEpoch and currentEpoch + 1 are ever processed. */
|
|
110
|
+
pruneSubmitted = async (epoch) => {
|
|
111
|
+
for (const trackedEpoch of this.submitted.keys()) {
|
|
112
|
+
if (trackedEpoch < epoch) {
|
|
113
|
+
this.submitted.delete(trackedEpoch);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
100
117
|
}
|
|
101
118
|
//# sourceMappingURL=proposerPreferences.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposerPreferences.js","sourceRoot":"","sources":["../../src/services/proposerPreferences.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAE,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAC,OAAO,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAMrD;;;;;;;;GAQG;AACH,MAAM,4BAA4B,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC;AAKrE
|
|
1
|
+
{"version":3,"file":"proposerPreferences.js","sourceRoot":"","sources":["../../src/services/proposerPreferences.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAE,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAC,OAAO,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAMrD;;;;;;;;GAQG;AACH,MAAM,4BAA4B,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC;AAKrE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,0BAA0B;IAIlB,MA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C,MAAM,CAAC,YAAY,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;IAAA,CACF,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lodestar/validator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.45.0-dev.05395cd726",
|
|
4
4
|
"description": "A Typescript implementation of the validator client",
|
|
5
5
|
"author": "ChainSafe Systems",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -50,21 +50,21 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@chainsafe/blst": "^2.2.0",
|
|
52
52
|
"@chainsafe/ssz": "^1.4.0",
|
|
53
|
-
"@lodestar/api": "^1.
|
|
54
|
-
"@lodestar/config": "^1.
|
|
55
|
-
"@lodestar/db": "^1.
|
|
56
|
-
"@lodestar/params": "^1.
|
|
57
|
-
"@lodestar/state-transition": "^1.
|
|
58
|
-
"@lodestar/types": "^1.
|
|
59
|
-
"@lodestar/utils": "^1.
|
|
53
|
+
"@lodestar/api": "^1.45.0-dev.05395cd726",
|
|
54
|
+
"@lodestar/config": "^1.45.0-dev.05395cd726",
|
|
55
|
+
"@lodestar/db": "^1.45.0-dev.05395cd726",
|
|
56
|
+
"@lodestar/params": "^1.45.0-dev.05395cd726",
|
|
57
|
+
"@lodestar/state-transition": "^1.45.0-dev.05395cd726",
|
|
58
|
+
"@lodestar/types": "^1.45.0-dev.05395cd726",
|
|
59
|
+
"@lodestar/utils": "^1.45.0-dev.05395cd726",
|
|
60
60
|
"strict-event-emitter-types": "^2.0.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@lodestar/logger": "^1.
|
|
64
|
-
"@lodestar/spec-test-util": "^1.
|
|
65
|
-
"@lodestar/test-utils": "^1.
|
|
63
|
+
"@lodestar/logger": "^1.45.0-dev.05395cd726",
|
|
64
|
+
"@lodestar/spec-test-util": "^1.45.0-dev.05395cd726",
|
|
65
|
+
"@lodestar/test-utils": "^1.45.0-dev.05395cd726",
|
|
66
66
|
"@vekexasia/bigint-buffer2": "^1.1.1",
|
|
67
67
|
"rimraf": "^4.4.1"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "ff1c0f307b1483d9e9b024899cb1faee113918ca"
|
|
70
70
|
}
|
|
@@ -29,7 +29,10 @@ type SubmittedAtEpoch = {dependentRoot: RootHex; slots: Set<Slot>};
|
|
|
29
29
|
* dependent root for an epoch shifts (e.g. after a reorg) — detected by comparing the cached
|
|
30
30
|
* `dependentRoot` reported by `BlockDutiesService` against the one we last submitted under.
|
|
31
31
|
*
|
|
32
|
-
*
|
|
32
|
+
* Proposers should broadcast their preferences before the fork so the proposer preference caches
|
|
33
|
+
* of beacon nodes and builders are warm for the first Gloas slots. We start submitting
|
|
34
|
+
* as soon as a duty's proposal slot is in Gloas, which is up to `SUBMIT_BEFORE_PROPOSAL_SLOTS`
|
|
35
|
+
* before the fork, so only the first few Gloas slots are affected by this pre-fork submission.
|
|
33
36
|
*/
|
|
34
37
|
export class ProposerPreferencesService {
|
|
35
38
|
private readonly submitted = new Map<Epoch, SubmittedAtEpoch>();
|
|
@@ -44,10 +47,14 @@ export class ProposerPreferencesService {
|
|
|
44
47
|
_metrics: Metrics | null
|
|
45
48
|
) {
|
|
46
49
|
clock.runEverySlot(this.runProposerPreferencesTask);
|
|
50
|
+
clock.runEveryEpoch(this.pruneSubmitted);
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
private runProposerPreferencesTask = async (slot: Slot): Promise<void> => {
|
|
50
|
-
|
|
54
|
+
// Start running once the submission window (`slot + SUBMIT_BEFORE_PROPOSAL_SLOTS`) reaches
|
|
55
|
+
// Gloas, i.e. already in the epoch before the fork. This allows builders to prepare and
|
|
56
|
+
// submit bids for the first Gloas slots.
|
|
57
|
+
if (!isForkPostGloas(this.config.getForkName(slot + SUBMIT_BEFORE_PROPOSAL_SLOTS))) {
|
|
51
58
|
return;
|
|
52
59
|
}
|
|
53
60
|
|
|
@@ -82,6 +89,7 @@ export class ProposerPreferencesService {
|
|
|
82
89
|
for (const duty of dutiesAtEpoch.data) {
|
|
83
90
|
if (duty.slot <= slot) continue;
|
|
84
91
|
if (duty.slot > slot + SUBMIT_BEFORE_PROPOSAL_SLOTS) continue;
|
|
92
|
+
if (!isForkPostGloas(this.config.getForkName(duty.slot))) continue;
|
|
85
93
|
if (submission.slots.has(duty.slot)) continue;
|
|
86
94
|
|
|
87
95
|
try {
|
|
@@ -121,4 +129,13 @@ export class ProposerPreferencesService {
|
|
|
121
129
|
this.logger.error("Error submitting signed proposer preferences", {count: batch.length}, e as Error);
|
|
122
130
|
}
|
|
123
131
|
};
|
|
132
|
+
|
|
133
|
+
/** Drop tracking for past epochs; only currentEpoch and currentEpoch + 1 are ever processed. */
|
|
134
|
+
private pruneSubmitted = async (epoch: Epoch): Promise<void> => {
|
|
135
|
+
for (const trackedEpoch of this.submitted.keys()) {
|
|
136
|
+
if (trackedEpoch < epoch) {
|
|
137
|
+
this.submitted.delete(trackedEpoch);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
124
141
|
}
|