@lodestar/beacon-node 1.45.0-dev.85227cfbe5 → 1.45.0-dev.8d73a6a8cb
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/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +42 -2
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/index.js +3 -46
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +2 -11
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +3 -39
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +3 -37
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +12 -4
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/network/processor/gossipHandlers.js +2 -2
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/package.json +14 -14
- package/src/api/impl/beacon/pool/index.ts +52 -0
- package/src/api/impl/beacon/state/index.ts +1 -52
- package/src/api/impl/beacon/state/utils.ts +4 -57
- package/src/api/impl/validator/index.ts +2 -45
- package/src/chain/produceBlock/produceBlockBody.ts +17 -9
- package/src/network/processor/gossipHandlers.ts +1 -1
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.45.0-dev.
|
|
14
|
+
"version": "1.45.0-dev.8d73a6a8cb",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -134,17 +134,17 @@
|
|
|
134
134
|
"@libp2p/peer-id": "^6.0.4",
|
|
135
135
|
"@libp2p/prometheus-metrics": "^5.0.14",
|
|
136
136
|
"@libp2p/tcp": "^11.0.13",
|
|
137
|
-
"@lodestar/api": "^1.45.0-dev.
|
|
138
|
-
"@lodestar/config": "^1.45.0-dev.
|
|
139
|
-
"@lodestar/db": "^1.45.0-dev.
|
|
140
|
-
"@lodestar/fork-choice": "^1.45.0-dev.
|
|
141
|
-
"@lodestar/logger": "^1.45.0-dev.
|
|
142
|
-
"@lodestar/params": "^1.45.0-dev.
|
|
143
|
-
"@lodestar/reqresp": "^1.45.0-dev.
|
|
144
|
-
"@lodestar/state-transition": "^1.45.0-dev.
|
|
145
|
-
"@lodestar/types": "^1.45.0-dev.
|
|
146
|
-
"@lodestar/utils": "^1.45.0-dev.
|
|
147
|
-
"@lodestar/validator": "^1.45.0-dev.
|
|
137
|
+
"@lodestar/api": "^1.45.0-dev.8d73a6a8cb",
|
|
138
|
+
"@lodestar/config": "^1.45.0-dev.8d73a6a8cb",
|
|
139
|
+
"@lodestar/db": "^1.45.0-dev.8d73a6a8cb",
|
|
140
|
+
"@lodestar/fork-choice": "^1.45.0-dev.8d73a6a8cb",
|
|
141
|
+
"@lodestar/logger": "^1.45.0-dev.8d73a6a8cb",
|
|
142
|
+
"@lodestar/params": "^1.45.0-dev.8d73a6a8cb",
|
|
143
|
+
"@lodestar/reqresp": "^1.45.0-dev.8d73a6a8cb",
|
|
144
|
+
"@lodestar/state-transition": "^1.45.0-dev.8d73a6a8cb",
|
|
145
|
+
"@lodestar/types": "^1.45.0-dev.8d73a6a8cb",
|
|
146
|
+
"@lodestar/utils": "^1.45.0-dev.8d73a6a8cb",
|
|
147
|
+
"@lodestar/validator": "^1.45.0-dev.8d73a6a8cb",
|
|
148
148
|
"@multiformats/multiaddr": "^13.0.1",
|
|
149
149
|
"datastore-core": "^11.0.2",
|
|
150
150
|
"datastore-fs": "^11.0.2",
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"@libp2p/interface-internal": "^3.0.13",
|
|
168
168
|
"@libp2p/logger": "^6.2.2",
|
|
169
169
|
"@libp2p/utils": "^7.0.13",
|
|
170
|
-
"@lodestar/spec-test-util": "^1.45.0-dev.
|
|
170
|
+
"@lodestar/spec-test-util": "^1.45.0-dev.8d73a6a8cb",
|
|
171
171
|
"@types/js-yaml": "^4.0.5",
|
|
172
172
|
"@types/qs": "^6.9.7",
|
|
173
173
|
"@types/tmp": "^0.2.3",
|
|
@@ -184,5 +184,5 @@
|
|
|
184
184
|
"beacon",
|
|
185
185
|
"blockchain"
|
|
186
186
|
],
|
|
187
|
-
"gitHead": "
|
|
187
|
+
"gitHead": "0537390960812671bc4a513d0c47f5fe2ef1ae30"
|
|
188
188
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ApplicationMethods} from "@lodestar/api/server";
|
|
3
3
|
import {
|
|
4
|
+
ForkName,
|
|
4
5
|
ForkPostElectra,
|
|
5
6
|
ForkPreElectra,
|
|
6
7
|
SYNC_COMMITTEE_SUBNET_SIZE,
|
|
@@ -16,12 +17,15 @@ import {
|
|
|
16
17
|
GossipAction,
|
|
17
18
|
PayloadAttestationError,
|
|
18
19
|
PayloadAttestationErrorCode,
|
|
20
|
+
ProposerPreferencesError,
|
|
21
|
+
ProposerPreferencesErrorCode,
|
|
19
22
|
SyncCommitteeError,
|
|
20
23
|
} from "../../../../chain/errors/index.js";
|
|
21
24
|
import {validateApiAttesterSlashing} from "../../../../chain/validation/attesterSlashing.js";
|
|
22
25
|
import {validateApiBlsToExecutionChange} from "../../../../chain/validation/blsToExecutionChange.js";
|
|
23
26
|
import {toElectraSingleAttestation, validateApiAttestation} from "../../../../chain/validation/index.js";
|
|
24
27
|
import {validateApiPayloadAttestationMessage} from "../../../../chain/validation/payloadAttestationMessage.js";
|
|
28
|
+
import {validateGossipProposerPreferences} from "../../../../chain/validation/proposerPreferences.js";
|
|
25
29
|
import {validateApiProposerSlashing} from "../../../../chain/validation/proposerSlashing.js";
|
|
26
30
|
import {validateApiSyncCommittee} from "../../../../chain/validation/syncCommittee.js";
|
|
27
31
|
import {validateApiVoluntaryExit} from "../../../../chain/validation/voluntaryExit.js";
|
|
@@ -62,6 +66,54 @@ export function getBeaconPoolApi({
|
|
|
62
66
|
return {data: chain.payloadAttestationPool.getAll(slot), meta: {version: fork}};
|
|
63
67
|
},
|
|
64
68
|
|
|
69
|
+
async getPoolProposerPreferences({slot}) {
|
|
70
|
+
const fork = chain.config.getForkName(slot ?? chain.clock.currentSlot);
|
|
71
|
+
if (!isForkPostGloas(fork)) {
|
|
72
|
+
throw new ApiError(400, `Proposer preferences pool is not supported before Gloas fork=${fork}`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {data: chain.proposerPreferencesPool.getAll(slot), meta: {version: fork}};
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
async submitSignedProposerPreferences({signedProposerPreferences}) {
|
|
79
|
+
const failures: FailureList = [];
|
|
80
|
+
|
|
81
|
+
await Promise.all(
|
|
82
|
+
signedProposerPreferences.map(async (signed, i) => {
|
|
83
|
+
try {
|
|
84
|
+
await validateGossipProposerPreferences(chain, signed);
|
|
85
|
+
|
|
86
|
+
await network.publishProposerPreferences(signed);
|
|
87
|
+
chain.emitter.emit(routes.events.EventType.proposerPreferences, {
|
|
88
|
+
version: ForkName.gloas,
|
|
89
|
+
data: signed,
|
|
90
|
+
});
|
|
91
|
+
} catch (e) {
|
|
92
|
+
const logCtx = {
|
|
93
|
+
slot: signed.message.proposalSlot,
|
|
94
|
+
validatorIndex: signed.message.validatorIndex,
|
|
95
|
+
dependentRoot: toRootHex(signed.message.dependentRoot),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
if (e instanceof ProposerPreferencesError && e.type.code === ProposerPreferencesErrorCode.ALREADY_KNOWN) {
|
|
99
|
+
logger.debug("Ignoring known signed proposer preferences", logCtx);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
failures.push({index: i, message: (e as Error).message});
|
|
104
|
+
logger.verbose(`Error on submitSignedProposerPreferences [${i}]`, logCtx, e as Error);
|
|
105
|
+
if (e instanceof ProposerPreferencesError && e.action === GossipAction.REJECT) {
|
|
106
|
+
chain.persistInvalidSszValue(ssz.gloas.SignedProposerPreferences, signed, "api_reject");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
if (failures.length > 0) {
|
|
113
|
+
throw new IndexedError("Error processing signed proposer preferences", failures);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
|
|
65
117
|
async getPoolAttesterSlashingsV2() {
|
|
66
118
|
const fork = chain.config.getForkName(chain.clock.currentSlot);
|
|
67
119
|
return {data: chain.opPool.getAllAttesterSlashings(), meta: {version: fork}};
|
|
@@ -9,15 +9,13 @@ import {
|
|
|
9
9
|
isStatePostAltair,
|
|
10
10
|
isStatePostElectra,
|
|
11
11
|
isStatePostFulu,
|
|
12
|
-
isStatePostGloas,
|
|
13
12
|
} from "@lodestar/state-transition";
|
|
14
|
-
import {ValidatorIndex,
|
|
13
|
+
import {ValidatorIndex, getValidatorStatus, ssz} from "@lodestar/types";
|
|
15
14
|
import {ApiError} from "../../errors.js";
|
|
16
15
|
import {ApiModules} from "../../types.js";
|
|
17
16
|
import {assertUniqueItems} from "../../utils.js";
|
|
18
17
|
import {
|
|
19
18
|
filterStateValidatorsByStatus,
|
|
20
|
-
getStateBuilderIndex,
|
|
21
19
|
getStateResponseWithRegen,
|
|
22
20
|
getStateValidatorIndex,
|
|
23
21
|
toValidatorResponse,
|
|
@@ -145,55 +143,6 @@ export function getBeaconStateApi({
|
|
|
145
143
|
return this.getStateValidators(args, context);
|
|
146
144
|
},
|
|
147
145
|
|
|
148
|
-
async getStateBuilders({stateId, builderIds = [], statuses = []}) {
|
|
149
|
-
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
150
|
-
if (!isStatePostGloas(state)) {
|
|
151
|
-
throw new ApiError(400, `Builders are not supported for pre-gloas state fork=${state.forkName}`);
|
|
152
|
-
}
|
|
153
|
-
const finalizedEpoch = state.finalizedCheckpoint.epoch;
|
|
154
|
-
|
|
155
|
-
const builderResponses: routes.beacon.BuilderResponse[] = [];
|
|
156
|
-
if (builderIds.length) {
|
|
157
|
-
assertUniqueItems(builderIds, "Duplicate builder IDs provided");
|
|
158
|
-
|
|
159
|
-
for (const id of builderIds) {
|
|
160
|
-
const resp = getStateBuilderIndex(id, state);
|
|
161
|
-
if (resp.valid) {
|
|
162
|
-
const builderIndex = resp.builderIndex;
|
|
163
|
-
const builder = state.getBuilder(builderIndex);
|
|
164
|
-
const status = getBuilderStatus(builder, finalizedEpoch);
|
|
165
|
-
if (statuses.length && !statuses.includes(status)) {
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
builderResponses.push({index: builderIndex, status, builder});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
data: builderResponses,
|
|
173
|
-
meta: {executionOptimistic, finalized},
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (statuses.length) {
|
|
178
|
-
assertUniqueItems(statuses, "Duplicate statuses provided");
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const buildersLength = state.getBuildersLength();
|
|
182
|
-
for (let builderIndex = 0; builderIndex < buildersLength; builderIndex++) {
|
|
183
|
-
const builder = state.getBuilder(builderIndex);
|
|
184
|
-
const status = getBuilderStatus(builder, finalizedEpoch);
|
|
185
|
-
if (statuses.length && !statuses.includes(status)) {
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
builderResponses.push({index: builderIndex, status, builder});
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
return {
|
|
192
|
-
data: builderResponses,
|
|
193
|
-
meta: {executionOptimistic, finalized},
|
|
194
|
-
};
|
|
195
|
-
},
|
|
196
|
-
|
|
197
146
|
async postStateValidatorIdentities({stateId, validatorIds = []}) {
|
|
198
147
|
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
199
148
|
const {pubkeyCache} = chain;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {CheckpointWithHex, IForkChoice} from "@lodestar/fork-choice";
|
|
3
3
|
import {GENESIS_SLOT} from "@lodestar/params";
|
|
4
|
-
import {IBeaconStateView,
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
BuilderIndex,
|
|
8
|
-
Epoch,
|
|
9
|
-
RootHex,
|
|
10
|
-
Slot,
|
|
11
|
-
ValidatorIndex,
|
|
12
|
-
getValidatorStatus,
|
|
13
|
-
phase0,
|
|
14
|
-
} from "@lodestar/types";
|
|
15
|
-
import {byteArrayEquals, fromHex} from "@lodestar/utils";
|
|
4
|
+
import {IBeaconStateView, PubkeyCache} from "@lodestar/state-transition";
|
|
5
|
+
import {BLSPubkey, Epoch, RootHex, Slot, ValidatorIndex, getValidatorStatus, phase0} from "@lodestar/types";
|
|
6
|
+
import {fromHex} from "@lodestar/utils";
|
|
16
7
|
import {IBeaconChain} from "../../../../chain/index.js";
|
|
17
8
|
import {ApiError, ValidationError} from "../../errors.js";
|
|
18
9
|
|
|
@@ -87,50 +78,6 @@ export function toValidatorResponse(
|
|
|
87
78
|
};
|
|
88
79
|
}
|
|
89
80
|
|
|
90
|
-
type StateBuilderIndexResponse =
|
|
91
|
-
| {valid: true; builderIndex: BuilderIndex}
|
|
92
|
-
| {valid: false; code: number; reason: string};
|
|
93
|
-
|
|
94
|
-
export function getStateBuilderIndex(
|
|
95
|
-
id: routes.beacon.BuilderId | BLSPubkey,
|
|
96
|
-
state: IBeaconStateViewGloas
|
|
97
|
-
): StateBuilderIndexResponse {
|
|
98
|
-
if (typeof id === "string") {
|
|
99
|
-
// mutate `id` and fallthrough to below
|
|
100
|
-
if (id.startsWith("0x")) {
|
|
101
|
-
try {
|
|
102
|
-
id = fromHex(id);
|
|
103
|
-
} catch (_e) {
|
|
104
|
-
return {valid: false, code: 400, reason: "Invalid pubkey hex encoding"};
|
|
105
|
-
}
|
|
106
|
-
} else {
|
|
107
|
-
id = Number(id);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (typeof id === "number") {
|
|
112
|
-
const builderIndex = id;
|
|
113
|
-
// builder is invalid or added later than given stateId
|
|
114
|
-
if (!Number.isSafeInteger(builderIndex) || builderIndex < 0) {
|
|
115
|
-
return {valid: false, code: 400, reason: "Invalid builder index"};
|
|
116
|
-
}
|
|
117
|
-
if (builderIndex >= state.getBuildersLength()) {
|
|
118
|
-
return {valid: false, code: 404, reason: "Builder index from future state"};
|
|
119
|
-
}
|
|
120
|
-
return {valid: true, builderIndex};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// typeof id === Uint8Array
|
|
124
|
-
// There is no builder pubkey cache, linear scan over the registry
|
|
125
|
-
const buildersLength = state.getBuildersLength();
|
|
126
|
-
for (let builderIndex = 0; builderIndex < buildersLength; builderIndex++) {
|
|
127
|
-
if (byteArrayEquals(state.getBuilder(builderIndex).pubkey, id)) {
|
|
128
|
-
return {valid: true, builderIndex};
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return {valid: false, code: 404, reason: "Builder pubkey not found in state"};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
81
|
export function filterStateValidatorsByStatus(
|
|
135
82
|
statuses: string[],
|
|
136
83
|
state: IBeaconStateView,
|
|
@@ -175,7 +122,7 @@ export function getStateValidatorIndex(
|
|
|
175
122
|
if (typeof id === "number") {
|
|
176
123
|
const validatorIndex = id;
|
|
177
124
|
// validator is invalid or added later than given stateId
|
|
178
|
-
if (!Number.isSafeInteger(validatorIndex)
|
|
125
|
+
if (!Number.isSafeInteger(validatorIndex)) {
|
|
179
126
|
return {valid: false, code: 400, reason: "Invalid validator index"};
|
|
180
127
|
}
|
|
181
128
|
if (validatorIndex >= state.validatorCount) {
|
|
@@ -65,8 +65,6 @@ import {
|
|
|
65
65
|
AttestationError,
|
|
66
66
|
AttestationErrorCode,
|
|
67
67
|
GossipAction,
|
|
68
|
-
ProposerPreferencesError,
|
|
69
|
-
ProposerPreferencesErrorCode,
|
|
70
68
|
SyncCommitteeError,
|
|
71
69
|
SyncCommitteeErrorCode,
|
|
72
70
|
} from "../../../chain/errors/index.js";
|
|
@@ -76,7 +74,6 @@ import {BlockType, ProduceFullDeneb, ProduceFullGloas} from "../../../chain/prod
|
|
|
76
74
|
import {RegenCaller} from "../../../chain/regen/index.js";
|
|
77
75
|
import {CheckpointHex} from "../../../chain/stateCache/types.js";
|
|
78
76
|
import {validateApiAggregateAndProof} from "../../../chain/validation/index.js";
|
|
79
|
-
import {validateGossipProposerPreferences} from "../../../chain/validation/proposerPreferences.js";
|
|
80
77
|
import {validateSyncCommitteeGossipContributionAndProof} from "../../../chain/validation/syncCommitteeContributionAndProof.js";
|
|
81
78
|
import {ZERO_HASH} from "../../../constants/index.js";
|
|
82
79
|
import {BuilderStatus, NoBidReceived} from "../../../execution/builder/http.js";
|
|
@@ -1121,8 +1118,8 @@ export function getValidatorApi(
|
|
|
1121
1118
|
|
|
1122
1119
|
const block = chain.forkChoice.getCanonicalBlockAtSlot(slot);
|
|
1123
1120
|
if (!block) {
|
|
1124
|
-
// No
|
|
1125
|
-
|
|
1121
|
+
// No block is seen at slot. Return 404 so vc can skip casting payload attestation.
|
|
1122
|
+
throw new ApiError(404, `No canonical block found at slot=${slot}`);
|
|
1126
1123
|
}
|
|
1127
1124
|
|
|
1128
1125
|
const payloadInput = chain.seenPayloadEnvelopeInputCache.get(block.blockRoot);
|
|
@@ -1774,46 +1771,6 @@ export function getValidatorApi(
|
|
|
1774
1771
|
});
|
|
1775
1772
|
},
|
|
1776
1773
|
|
|
1777
|
-
async submitProposerPreferences({signedProposerPreferences}) {
|
|
1778
|
-
const failures: FailureList = [];
|
|
1779
|
-
|
|
1780
|
-
await Promise.all(
|
|
1781
|
-
signedProposerPreferences.map(async (signed, i) => {
|
|
1782
|
-
try {
|
|
1783
|
-
await validateGossipProposerPreferences(chain, signed);
|
|
1784
|
-
|
|
1785
|
-
chain.proposerPreferencesPool.add(signed);
|
|
1786
|
-
await network.publishProposerPreferences(signed);
|
|
1787
|
-
chain.emitter.emit(routes.events.EventType.proposerPreferences, {
|
|
1788
|
-
version: config.getForkName(signed.message.proposalSlot),
|
|
1789
|
-
data: signed,
|
|
1790
|
-
});
|
|
1791
|
-
} catch (e) {
|
|
1792
|
-
const logCtx = {
|
|
1793
|
-
slot: signed.message.proposalSlot,
|
|
1794
|
-
validatorIndex: signed.message.validatorIndex,
|
|
1795
|
-
dependentRoot: toRootHex(signed.message.dependentRoot),
|
|
1796
|
-
};
|
|
1797
|
-
|
|
1798
|
-
if (e instanceof ProposerPreferencesError && e.type.code === ProposerPreferencesErrorCode.ALREADY_KNOWN) {
|
|
1799
|
-
logger.debug("Ignoring known signed proposer preferences", logCtx);
|
|
1800
|
-
return;
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
failures.push({index: i, message: (e as Error).message});
|
|
1804
|
-
logger.verbose(`Error on submitProposerPreferences [${i}]`, logCtx, e as Error);
|
|
1805
|
-
if (e instanceof ProposerPreferencesError && e.action === GossipAction.REJECT) {
|
|
1806
|
-
chain.persistInvalidSszValue(ssz.gloas.SignedProposerPreferences, signed, "api_reject");
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
})
|
|
1810
|
-
);
|
|
1811
|
-
|
|
1812
|
-
if (failures.length > 0) {
|
|
1813
|
-
throw new IndexedError("Error processing signed proposer preferences", failures);
|
|
1814
|
-
}
|
|
1815
|
-
},
|
|
1816
|
-
|
|
1817
1774
|
async getExecutionPayloadEnvelope({slot, beaconBlockRoot}) {
|
|
1818
1775
|
const fork = config.getForkName(slot);
|
|
1819
1776
|
|
|
@@ -43,7 +43,6 @@ import {
|
|
|
43
43
|
ValidatorIndex,
|
|
44
44
|
Wei,
|
|
45
45
|
altair,
|
|
46
|
-
bellatrix,
|
|
47
46
|
capella,
|
|
48
47
|
deneb,
|
|
49
48
|
electra,
|
|
@@ -831,19 +830,28 @@ export function getPayloadAttributesForSSE(
|
|
|
831
830
|
feeRecipient,
|
|
832
831
|
});
|
|
833
832
|
|
|
834
|
-
|
|
833
|
+
let parentBlockNumber: number;
|
|
834
|
+
if (isForkPostGloas(fork)) {
|
|
835
|
+
const parentBlock = chain.forkChoice.getBlockHexAndBlockHash(
|
|
836
|
+
toRootHex(parentBlockRoot),
|
|
837
|
+
toRootHex(parentBlockHash)
|
|
838
|
+
);
|
|
839
|
+
if (parentBlock?.executionPayloadBlockHash == null) {
|
|
840
|
+
throw Error(`Parent block not found in fork choice root=${toRootHex(parentBlockRoot)}`);
|
|
841
|
+
}
|
|
842
|
+
parentBlockNumber = parentBlock.executionPayloadNumber;
|
|
843
|
+
} else {
|
|
844
|
+
parentBlockNumber = prepareState.payloadBlockNumber;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
const ssePayloadAttributes: SSEPayloadAttributes = {
|
|
835
848
|
proposerIndex: prepareState.getBeaconProposer(prepareSlot),
|
|
836
849
|
proposalSlot: prepareSlot,
|
|
850
|
+
parentBlockNumber,
|
|
837
851
|
parentBlockRoot,
|
|
838
852
|
parentBlockHash,
|
|
839
853
|
payloadAttributes,
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
if (!isForkPostGloas(fork)) {
|
|
843
|
-
// Removed in Gloas, builders can get the block number from the EL via the block hash if required
|
|
844
|
-
(ssePayloadAttributes as bellatrix.SSEPayloadAttributes).parentBlockNumber = prepareState.payloadBlockNumber;
|
|
845
|
-
}
|
|
846
|
-
|
|
854
|
+
};
|
|
847
855
|
return ssePayloadAttributes;
|
|
848
856
|
}
|
|
849
857
|
|
|
@@ -1274,7 +1274,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1274
1274
|
await validateGossipProposerPreferences(chain, signedProposerPreferences);
|
|
1275
1275
|
|
|
1276
1276
|
chain.emitter.emit(routes.events.EventType.proposerPreferences, {
|
|
1277
|
-
version:
|
|
1277
|
+
version: ForkName.gloas,
|
|
1278
1278
|
data: signedProposerPreferences,
|
|
1279
1279
|
});
|
|
1280
1280
|
},
|