@lodestar/beacon-node 1.46.0-dev.e00bf67333 → 1.46.0-dev.fcf0b94a96
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GENESIS_SLOT, MIN_SEED_LOOKAHEAD, SLOTS_PER_EPOCH } from "@lodestar/params";
|
|
1
|
+
import { GENESIS_EPOCH, GENESIS_SLOT, MIN_SEED_LOOKAHEAD, SLOTS_PER_EPOCH } from "@lodestar/params";
|
|
2
2
|
import { computeEpochAtSlot, computeStartSlotAtEpoch, createSingleSignatureSetFromComponents, getProposerPreferencesSigningRoot, } from "@lodestar/state-transition";
|
|
3
3
|
import { toRootHex } from "@lodestar/utils";
|
|
4
4
|
import { GossipAction, ProposerPreferencesError, ProposerPreferencesErrorCode } from "../errors/index.js";
|
|
@@ -11,9 +11,10 @@ export async function validateGossipProposerPreferences(chain, signedProposerPre
|
|
|
11
11
|
const { proposalSlot, validatorIndex, dependentRoot } = preferences;
|
|
12
12
|
const dependentRootHex = toRootHex(dependentRoot);
|
|
13
13
|
const proposalEpoch = computeEpochAtSlot(proposalSlot);
|
|
14
|
-
// [IGNORE] `preferences.proposal_slot` is within the proposer lookahead
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
// [IGNORE] `preferences.proposal_slot` is within the proposer lookahead,
|
|
15
|
+
// allowing for `MAXIMUM_GOSSIP_CLOCK_DISPARITY`.
|
|
16
|
+
const currentEpoch = computeEpochAtSlot(chain.clock.currentSlotWithGossipDisparity);
|
|
17
|
+
if (proposalEpoch > currentEpoch + MIN_SEED_LOOKAHEAD) {
|
|
17
18
|
throw new ProposerPreferencesError(GossipAction.IGNORE, {
|
|
18
19
|
code: ProposerPreferencesErrorCode.INVALID_EPOCH,
|
|
19
20
|
proposalSlot,
|
|
@@ -22,12 +23,11 @@ export async function validateGossipProposerPreferences(chain, signedProposerPre
|
|
|
22
23
|
}
|
|
23
24
|
// [IGNORE] `preferences.proposal_slot` has not already passed, i.e. `proposal_slot > current_slot`,
|
|
24
25
|
// allowing for `MAXIMUM_GOSSIP_CLOCK_DISPARITY`.
|
|
25
|
-
|
|
26
|
-
if (proposalSlot <= currentSlot) {
|
|
26
|
+
if (chain.clock.msFromSlot(proposalSlot) > chain.config.MAXIMUM_GOSSIP_CLOCK_DISPARITY) {
|
|
27
27
|
throw new ProposerPreferencesError(GossipAction.IGNORE, {
|
|
28
28
|
code: ProposerPreferencesErrorCode.PROPOSAL_SLOT_PASSED,
|
|
29
29
|
proposalSlot,
|
|
30
|
-
currentSlot,
|
|
30
|
+
currentSlot: chain.clock.currentSlot,
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
// [IGNORE] The block with root `dependent_root` has been seen by the node.
|
|
@@ -39,7 +39,7 @@ export async function validateGossipProposerPreferences(chain, signedProposerPre
|
|
|
39
39
|
dependentRoot: dependentRootHex,
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
const dependentEpoch = proposalEpoch - MIN_SEED_LOOKAHEAD;
|
|
42
|
+
const dependentEpoch = Math.max(GENESIS_EPOCH, proposalEpoch - MIN_SEED_LOOKAHEAD);
|
|
43
43
|
const dependentRootSlot = getDependentRootSlot(dependentEpoch);
|
|
44
44
|
// [REJECT] The slot of the block with root `preferences.dependent_root` is strictly less than
|
|
45
45
|
// `compute_start_slot_at_epoch(compute_epoch_at_slot(preferences.proposal_slot) - MIN_SEED_LOOKAHEAD)`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposerPreferences.js","sourceRoot":"","sources":["../../../src/chain/validation/proposerPreferences.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"proposerPreferences.js","sourceRoot":"","sources":["../../../src/chain/validation/proposerPreferences.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,E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ACtD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,6BAA6B,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;QACvF,IAAI,KAAK,CAAC,IAAI,IAAI,cAAc,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,cAAc,CAAC,SAAS,KAAK,UAAU,CAAC,WAAW,EAAE,CAAC;AAAA,CAC9D;AAED,uFAAuF;AACvF,SAAS,oBAAoB,CAAC,KAAY,EAAQ;IAChD,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,uBAAuB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAAA,CACnE"}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.46.0-dev.
|
|
14
|
+
"version": "1.46.0-dev.fcf0b94a96",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -126,17 +126,17 @@
|
|
|
126
126
|
"@libp2p/peer-id": "^6.0.4",
|
|
127
127
|
"@libp2p/prometheus-metrics": "^5.0.14",
|
|
128
128
|
"@libp2p/tcp": "^11.0.13",
|
|
129
|
-
"@lodestar/api": "^1.46.0-dev.
|
|
130
|
-
"@lodestar/config": "^1.46.0-dev.
|
|
131
|
-
"@lodestar/db": "^1.46.0-dev.
|
|
132
|
-
"@lodestar/fork-choice": "^1.46.0-dev.
|
|
133
|
-
"@lodestar/logger": "^1.46.0-dev.
|
|
134
|
-
"@lodestar/params": "^1.46.0-dev.
|
|
135
|
-
"@lodestar/reqresp": "^1.46.0-dev.
|
|
136
|
-
"@lodestar/state-transition": "^1.46.0-dev.
|
|
137
|
-
"@lodestar/types": "^1.46.0-dev.
|
|
138
|
-
"@lodestar/utils": "^1.46.0-dev.
|
|
139
|
-
"@lodestar/validator": "^1.46.0-dev.
|
|
129
|
+
"@lodestar/api": "^1.46.0-dev.fcf0b94a96",
|
|
130
|
+
"@lodestar/config": "^1.46.0-dev.fcf0b94a96",
|
|
131
|
+
"@lodestar/db": "^1.46.0-dev.fcf0b94a96",
|
|
132
|
+
"@lodestar/fork-choice": "^1.46.0-dev.fcf0b94a96",
|
|
133
|
+
"@lodestar/logger": "^1.46.0-dev.fcf0b94a96",
|
|
134
|
+
"@lodestar/params": "^1.46.0-dev.fcf0b94a96",
|
|
135
|
+
"@lodestar/reqresp": "^1.46.0-dev.fcf0b94a96",
|
|
136
|
+
"@lodestar/state-transition": "^1.46.0-dev.fcf0b94a96",
|
|
137
|
+
"@lodestar/types": "^1.46.0-dev.fcf0b94a96",
|
|
138
|
+
"@lodestar/utils": "^1.46.0-dev.fcf0b94a96",
|
|
139
|
+
"@lodestar/validator": "^1.46.0-dev.fcf0b94a96",
|
|
140
140
|
"@multiformats/multiaddr": "^13.0.1",
|
|
141
141
|
"datastore-core": "^11.0.2",
|
|
142
142
|
"datastore-level": "^12.0.2",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"@libp2p/interface-internal": "^3.0.13",
|
|
159
159
|
"@libp2p/logger": "^6.2.2",
|
|
160
160
|
"@libp2p/utils": "^7.0.13",
|
|
161
|
-
"@lodestar/spec-test-util": "^1.46.0-dev.
|
|
161
|
+
"@lodestar/spec-test-util": "^1.46.0-dev.fcf0b94a96",
|
|
162
162
|
"@types/js-yaml": "^4.0.5",
|
|
163
163
|
"@types/qs": "^6.9.7",
|
|
164
164
|
"@types/tmp": "^0.2.3",
|
|
@@ -175,5 +175,5 @@
|
|
|
175
175
|
"beacon",
|
|
176
176
|
"blockchain"
|
|
177
177
|
],
|
|
178
|
-
"gitHead": "
|
|
178
|
+
"gitHead": "19226b8d273400d2ef9155f5e9738aa78ca69c8c"
|
|
179
179
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {IForkChoice, ProtoBlock} from "@lodestar/fork-choice";
|
|
2
|
-
import {GENESIS_SLOT, MIN_SEED_LOOKAHEAD, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
2
|
+
import {GENESIS_EPOCH, GENESIS_SLOT, MIN_SEED_LOOKAHEAD, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
3
3
|
import {
|
|
4
4
|
computeEpochAtSlot,
|
|
5
5
|
computeStartSlotAtEpoch,
|
|
@@ -24,9 +24,10 @@ export async function validateGossipProposerPreferences(
|
|
|
24
24
|
const dependentRootHex = toRootHex(dependentRoot);
|
|
25
25
|
const proposalEpoch = computeEpochAtSlot(proposalSlot);
|
|
26
26
|
|
|
27
|
-
// [IGNORE] `preferences.proposal_slot` is within the proposer lookahead
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
// [IGNORE] `preferences.proposal_slot` is within the proposer lookahead,
|
|
28
|
+
// allowing for `MAXIMUM_GOSSIP_CLOCK_DISPARITY`.
|
|
29
|
+
const currentEpoch = computeEpochAtSlot(chain.clock.currentSlotWithGossipDisparity);
|
|
30
|
+
if (proposalEpoch > currentEpoch + MIN_SEED_LOOKAHEAD) {
|
|
30
31
|
throw new ProposerPreferencesError(GossipAction.IGNORE, {
|
|
31
32
|
code: ProposerPreferencesErrorCode.INVALID_EPOCH,
|
|
32
33
|
proposalSlot,
|
|
@@ -36,12 +37,11 @@ export async function validateGossipProposerPreferences(
|
|
|
36
37
|
|
|
37
38
|
// [IGNORE] `preferences.proposal_slot` has not already passed, i.e. `proposal_slot > current_slot`,
|
|
38
39
|
// allowing for `MAXIMUM_GOSSIP_CLOCK_DISPARITY`.
|
|
39
|
-
|
|
40
|
-
if (proposalSlot <= currentSlot) {
|
|
40
|
+
if (chain.clock.msFromSlot(proposalSlot) > chain.config.MAXIMUM_GOSSIP_CLOCK_DISPARITY) {
|
|
41
41
|
throw new ProposerPreferencesError(GossipAction.IGNORE, {
|
|
42
42
|
code: ProposerPreferencesErrorCode.PROPOSAL_SLOT_PASSED,
|
|
43
43
|
proposalSlot,
|
|
44
|
-
currentSlot,
|
|
44
|
+
currentSlot: chain.clock.currentSlot,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -55,7 +55,7 @@ export async function validateGossipProposerPreferences(
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
const dependentEpoch = proposalEpoch - MIN_SEED_LOOKAHEAD;
|
|
58
|
+
const dependentEpoch = Math.max(GENESIS_EPOCH, proposalEpoch - MIN_SEED_LOOKAHEAD);
|
|
59
59
|
const dependentRootSlot = getDependentRootSlot(dependentEpoch);
|
|
60
60
|
|
|
61
61
|
// [REJECT] The slot of the block with root `preferences.dependent_root` is strictly less than
|