@lodestar/beacon-node 1.45.0-dev.e10fb5e991 → 1.45.0-dev.f2645825a8
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/state/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/index.js +46 -3
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +11 -2
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +39 -3
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +4 -12
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +759 -2
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/api/impl/beacon/state/index.ts +52 -1
- package/src/api/impl/beacon/state/utils.ts +57 -4
- package/src/chain/produceBlock/produceBlockBody.ts +9 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topic.d.ts","sourceRoot":"","sources":["../../../src/network/gossip/topic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAEL,QAAQ,EAMT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,WAAW,EAAE,iBAAiB,EAAmB,MAAM,iBAAiB,CAAC;AAEjF,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAiB,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAEjH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC;CACzC;AAED,qBAAa,gBAAiB,YAAW,iBAAiB;IAG5C,OA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ACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,GAAG,WAAW,CAMjG;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,GAAG,iBAAiB,CAS7G;AAMD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,CA0D9G;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE;IAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAAC,wBAAwB,CAAC,EAAE,OAAO,CAAA;CAAC,GACxE,kBAAkB,CAAC,MAAM,kBAAkB,CAAC,EAAE,CA4DhD;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,aAAa,GAC3B,kBAAkB,CAAC,MAAM,kBAAkB,CAAC,EAAE,CAShD;AAgBD,eAAO,MAAM,sCAAsC,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,CAkB9E,CAAC"}
|
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.f2645825a8",
|
|
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.f2645825a8",
|
|
138
|
+
"@lodestar/config": "^1.45.0-dev.f2645825a8",
|
|
139
|
+
"@lodestar/db": "^1.45.0-dev.f2645825a8",
|
|
140
|
+
"@lodestar/fork-choice": "^1.45.0-dev.f2645825a8",
|
|
141
|
+
"@lodestar/logger": "^1.45.0-dev.f2645825a8",
|
|
142
|
+
"@lodestar/params": "^1.45.0-dev.f2645825a8",
|
|
143
|
+
"@lodestar/reqresp": "^1.45.0-dev.f2645825a8",
|
|
144
|
+
"@lodestar/state-transition": "^1.45.0-dev.f2645825a8",
|
|
145
|
+
"@lodestar/types": "^1.45.0-dev.f2645825a8",
|
|
146
|
+
"@lodestar/utils": "^1.45.0-dev.f2645825a8",
|
|
147
|
+
"@lodestar/validator": "^1.45.0-dev.f2645825a8",
|
|
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.f2645825a8",
|
|
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": "94199ee23742f72c06e81ead07cc14e283755345"
|
|
188
188
|
}
|
|
@@ -9,13 +9,15 @@ import {
|
|
|
9
9
|
isStatePostAltair,
|
|
10
10
|
isStatePostElectra,
|
|
11
11
|
isStatePostFulu,
|
|
12
|
+
isStatePostGloas,
|
|
12
13
|
} from "@lodestar/state-transition";
|
|
13
|
-
import {ValidatorIndex, getValidatorStatus, ssz} from "@lodestar/types";
|
|
14
|
+
import {ValidatorIndex, getBuilderStatus, getValidatorStatus, ssz} from "@lodestar/types";
|
|
14
15
|
import {ApiError} from "../../errors.js";
|
|
15
16
|
import {ApiModules} from "../../types.js";
|
|
16
17
|
import {assertUniqueItems} from "../../utils.js";
|
|
17
18
|
import {
|
|
18
19
|
filterStateValidatorsByStatus,
|
|
20
|
+
getStateBuilderIndex,
|
|
19
21
|
getStateResponseWithRegen,
|
|
20
22
|
getStateValidatorIndex,
|
|
21
23
|
toValidatorResponse,
|
|
@@ -143,6 +145,55 @@ export function getBeaconStateApi({
|
|
|
143
145
|
return this.getStateValidators(args, context);
|
|
144
146
|
},
|
|
145
147
|
|
|
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
|
+
|
|
146
197
|
async postStateValidatorIdentities({stateId, validatorIds = []}) {
|
|
147
198
|
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
148
199
|
const {pubkeyCache} = chain;
|
|
@@ -1,9 +1,18 @@
|
|
|
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, PubkeyCache} from "@lodestar/state-transition";
|
|
5
|
-
import {
|
|
6
|
-
|
|
4
|
+
import {IBeaconStateView, IBeaconStateViewGloas, PubkeyCache} from "@lodestar/state-transition";
|
|
5
|
+
import {
|
|
6
|
+
BLSPubkey,
|
|
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";
|
|
7
16
|
import {IBeaconChain} from "../../../../chain/index.js";
|
|
8
17
|
import {ApiError, ValidationError} from "../../errors.js";
|
|
9
18
|
|
|
@@ -78,6 +87,50 @@ export function toValidatorResponse(
|
|
|
78
87
|
};
|
|
79
88
|
}
|
|
80
89
|
|
|
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
|
+
|
|
81
134
|
export function filterStateValidatorsByStatus(
|
|
82
135
|
statuses: string[],
|
|
83
136
|
state: IBeaconStateView,
|
|
@@ -122,7 +175,7 @@ export function getStateValidatorIndex(
|
|
|
122
175
|
if (typeof id === "number") {
|
|
123
176
|
const validatorIndex = id;
|
|
124
177
|
// validator is invalid or added later than given stateId
|
|
125
|
-
if (!Number.isSafeInteger(validatorIndex)) {
|
|
178
|
+
if (!Number.isSafeInteger(validatorIndex) || validatorIndex < 0) {
|
|
126
179
|
return {valid: false, code: 400, reason: "Invalid validator index"};
|
|
127
180
|
}
|
|
128
181
|
if (validatorIndex >= state.validatorCount) {
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
ValidatorIndex,
|
|
44
44
|
Wei,
|
|
45
45
|
altair,
|
|
46
|
+
bellatrix,
|
|
46
47
|
capella,
|
|
47
48
|
deneb,
|
|
48
49
|
electra,
|
|
@@ -830,28 +831,19 @@ export function getPayloadAttributesForSSE(
|
|
|
830
831
|
feeRecipient,
|
|
831
832
|
});
|
|
832
833
|
|
|
833
|
-
|
|
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 = {
|
|
834
|
+
const ssePayloadAttributes = {
|
|
848
835
|
proposerIndex: prepareState.getBeaconProposer(prepareSlot),
|
|
849
836
|
proposalSlot: prepareSlot,
|
|
850
|
-
parentBlockNumber,
|
|
851
837
|
parentBlockRoot,
|
|
852
838
|
parentBlockHash,
|
|
853
839
|
payloadAttributes,
|
|
854
|
-
};
|
|
840
|
+
} as SSEPayloadAttributes;
|
|
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
|
+
|
|
855
847
|
return ssePayloadAttributes;
|
|
856
848
|
}
|
|
857
849
|
|