@lodestar/beacon-node 1.48.0-dev.b0ce010779 → 1.48.0-dev.b0ddac0ac2
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/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +39 -39
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.js +12 -1
- package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +0 -13
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.d.ts +1 -1
- package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.js +10 -1
- package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
- package/lib/chain/chain.d.ts +5 -0
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +67 -38
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +1 -1
- package/lib/chain/emitter.js +1 -1
- package/lib/chain/errors/blockError.d.ts +3 -5
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +2 -2
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +0 -11
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +0 -2
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/prepareNextSlot.js +13 -13
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +46 -64
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +9 -50
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +0 -29
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts +7 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +22 -5
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +4 -1
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/network/gossip/encoding.d.ts.map +1 -1
- package/lib/network/gossip/encoding.js +0 -6
- package/lib/network/gossip/encoding.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +2 -1
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +4 -20
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/reqresp/protocols.d.ts.map +1 -1
- package/lib/network/reqresp/protocols.js +6 -22
- package/lib/network/reqresp/protocols.js.map +1 -1
- package/lib/network/reqresp/rateLimit.js +2 -1
- package/lib/network/reqresp/rateLimit.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/validator/index.ts +44 -43
- package/src/chain/archiveStore/historicalState/metrics.ts +14 -1
- package/src/chain/blocks/importBlock.ts +0 -13
- package/src/chain/blocks/utils/chainSegment.ts +10 -1
- package/src/chain/chain.ts +74 -46
- package/src/chain/emitter.ts +1 -1
- package/src/chain/errors/blockError.ts +3 -3
- package/src/chain/errors/executionPayloadEnvelope.ts +0 -9
- package/src/chain/prepareNextSlot.ts +16 -16
- package/src/chain/produceBlock/produceBlockBody.ts +50 -71
- package/src/chain/validation/block.ts +9 -66
- package/src/chain/validation/executionPayloadEnvelope.ts +0 -37
- package/src/chain/validatorMonitor.ts +24 -7
- package/src/execution/engine/mock.ts +4 -1
- package/src/network/gossip/encoding.ts +0 -6
- package/src/network/gossip/topic.ts +3 -25
- package/src/network/reqresp/protocols.ts +7 -24
- package/src/network/reqresp/rateLimit.ts +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocols.d.ts","sourceRoot":"","sources":["../../../src/network/reqresp/protocols.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"protocols.d.ts","sourceRoot":"","sources":["../../../src/network/reqresp/protocols.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAC,iBAAiB,EAA0E,MAAM,YAAY,CAAC;AAEtH,eAAO,MAAM,OAAO,SA2IJ,QAAQ,UAAU,YAAY,KAAG,iBAAiB,AAvIhE,CAAC;AAEH,eAAO,MAAM,QAAQ,SAqIL,QAAQ,UAAU,YAAY,KAAG,iBAAiB,AAjIhE,CAAC;AAEH,eAAO,MAAM,UAAU,SA+HP,QAAQ,UAAU,YAAY,KAAG,iBAAiB,AA3HhE,CAAC;AAEH,eAAO,MAAM,UAAU,SAyHP,QAAQ,UAAU,YAAY,KAAG,iBAAiB,AArHhE,CAAC;AAEH,eAAO,MAAM,IAAI,SAmHD,QAAQ,UAAU,YAAY,KAAG,iBAAiB,AA/GhE,CAAC;AAEH,eAAO,MAAM,MAAM,SA6GH,QAAQ,UAAU,YAAY,KAAG,iBAAiB,AAzGhE,CAAC;AAEH,eAAO,MAAM,QAAQ,SAuGL,QAAQ,UAAU,YAAY,KAAG,iBAAiB,AAnGhE,CAAC;AAEH,eAAO,MAAM,mBAAmB,SAiGhB,QAAQ,UAAU,YAAY,KAAG,iBAAiB,AA7FhE,CAAC;AAEH,eAAO,MAAM,qBAAqB,SA2FlB,QAAQ,UAAU,YAAY,KAA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p";
|
|
3
2
|
import { rateLimitQuotas } from "./rateLimit.js";
|
|
4
3
|
import { ReqRespMethod, Version, requestSszTypeByMethod, responseSszTypeByMethod } from "./types.js";
|
|
@@ -121,32 +120,17 @@ function toProtocol(protocol) {
|
|
|
121
120
|
encoding: Encoding.SSZ_SNAPPY,
|
|
122
121
|
contextBytes: toContextBytes(protocol.contextBytesType, config),
|
|
123
122
|
inboundRateLimits: rateLimitQuotas(fork, config)[protocol.method],
|
|
124
|
-
requestSizes: requestType === null ? null : clampTypeSizes(requestType,
|
|
125
|
-
responseSizes: (fork) => clampTypeSizes(responseSszTypeByMethod[protocol.method](fork, protocol.version),
|
|
123
|
+
requestSizes: requestType === null ? null : clampTypeSizes(requestType, config),
|
|
124
|
+
responseSizes: (fork) => clampTypeSizes(responseSszTypeByMethod[protocol.method](fork, protocol.version), config),
|
|
126
125
|
};
|
|
127
126
|
};
|
|
128
127
|
}
|
|
129
128
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* The length-prefix must be within the size bounds derived from the payload SSZ type or `MAX_PAYLOAD_SIZE`,
|
|
134
|
-
* whichever is smaller, see
|
|
135
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.12/specs/phase0/p2p-interface.md#encoding-strategies.
|
|
136
|
-
* Type-specific SSZ bounds supersede the bounds derived from the SSZ type, see
|
|
137
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.12/specs/gloas/p2p-interface.md#type-specific-ssz-bounds.
|
|
129
|
+
* Length-prefix must be within the SSZ type bounds or MAX_PAYLOAD_SIZE, whichever is smaller
|
|
130
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.12/specs/phase0/p2p-interface.md#encoding-strategies
|
|
138
131
|
*/
|
|
139
|
-
function clampTypeSizes(type,
|
|
140
|
-
|
|
141
|
-
if (isForkPostGloas(fork)) {
|
|
142
|
-
switch (method) {
|
|
143
|
-
case ReqRespMethod.DataColumnSidecarsByRange:
|
|
144
|
-
case ReqRespMethod.DataColumnSidecarsByRoot:
|
|
145
|
-
typeSpecificBound = MAX_DATA_COLUMN_SIDECAR_SIZE;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return { minSize: type.minSize, maxSize: Math.min(type.maxSize, typeSpecificBound) };
|
|
132
|
+
function clampTypeSizes(type, config) {
|
|
133
|
+
return { minSize: type.minSize, maxSize: Math.min(type.maxSize, config.MAX_PAYLOAD_SIZE) };
|
|
150
134
|
}
|
|
151
135
|
function toContextBytes(type, config) {
|
|
152
136
|
switch (type) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocols.js","sourceRoot":"","sources":["../../../src/network/reqresp/protocols.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"protocols.js","sourceRoot":"","sources":["../../../src/network/reqresp/protocols.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,gBAAgB,EAAE,QAAQ,EAAY,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAoB,aAAa,EAAE,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAC,MAAM,YAAY,CAAC;AAEtH,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC,OAAO;IAC7B,OAAO,EAAE,OAAO,CAAC,EAAE;IACnB,gBAAgB,EAAE,gBAAgB,CAAC,KAAK;CACzC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;IACjC,MAAM,EAAE,aAAa,CAAC,QAAQ;IAC9B,OAAO,EAAE,OAAO,CAAC,EAAE;IACnB,gBAAgB,EAAE,gBAAgB,CAAC,KAAK;CACzC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;IACnC,MAAM,EAAE,aAAa,CAAC,QA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"}
|
|
@@ -97,7 +97,8 @@ function getRequestCountFn(fork, config, method, fn) {
|
|
|
97
97
|
const type = requestSszTypeByMethod(fork, config)[method];
|
|
98
98
|
return (reqData) => {
|
|
99
99
|
try {
|
|
100
|
-
|
|
100
|
+
// A schema-valid request can cost 0 tokens; floor to 1 so it stays charged and bannable, not free.
|
|
101
|
+
return Math.max(1, (type && fn(type.deserialize(reqData))) ?? 1);
|
|
101
102
|
}
|
|
102
103
|
catch (_e) {
|
|
103
104
|
return 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rateLimit.js","sourceRoot":"","sources":["../../../src/network/reqresp/rateLimit.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,gCAAgC,EAAE,eAAe,EAAE,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAEhH,OAAO,EAAC,aAAa,EAAuB,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAEtF,MAAM,CAAC,MAAM,eAAe,GAA2F,CACrH,IAAI,EACJ,MAAM,EACN,EAAE,CAAC,CAAC;IACJ,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;QACtB,sJAAsJ;QACtJ,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAC;KACxC;IACD,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QACvB,sJAAsJ;QACtJ,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAC;KACxC;IACD,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;QACpB,sJAAsJ;QACtJ,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAC;KACxC;IACD,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE;QACxB,sJAAsJ;QACtJ,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,EAAC;KACvC;IACD,gBAAgB;IAChB,CAAC,aAAa,CA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AE,EAAC,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,EAAC;KACxC;CACF,CAAC,CAAC;AAEH,+CAA+C;AAC/C,SAAS,iBAAiB,CACxB,IAAc,EACd,MAAoB,EACpB,MAAS,EACT,EAA2C;IAE3C,MAAM,IAAI,GAAG,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1D,OAAO,CAAC,OAAmB,EAAE,EAAE;QAC7B,IAAI,CAAC;YACH,mGAAmG;YACnG,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC,CAAC;AACJ,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.48.0-dev.
|
|
14
|
+
"version": "1.48.0-dev.b0ddac0ac2",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"@chainsafe/persistent-merkle-tree": "^1.3.1",
|
|
110
110
|
"@chainsafe/prometheus-gc-stats": "^1.0.0",
|
|
111
111
|
"@chainsafe/snappy-wasm": "^0.5.0",
|
|
112
|
-
"@chainsafe/ssz": "^1.
|
|
112
|
+
"@chainsafe/ssz": "^1.7.0",
|
|
113
113
|
"@chainsafe/threads": "^1.11.3",
|
|
114
114
|
"@crate-crypto/node-eth-kzg": "0.9.1",
|
|
115
115
|
"@fastify/bearer-auth": "^10.0.1",
|
|
@@ -126,17 +126,17 @@
|
|
|
126
126
|
"@libp2p/peer-id": "^6.0.15",
|
|
127
127
|
"@libp2p/prometheus-metrics": "^5.0.28",
|
|
128
128
|
"@libp2p/tcp": "^11.0.27",
|
|
129
|
-
"@lodestar/api": "^1.48.0-dev.
|
|
130
|
-
"@lodestar/config": "^1.48.0-dev.
|
|
131
|
-
"@lodestar/db": "^1.48.0-dev.
|
|
132
|
-
"@lodestar/fork-choice": "^1.48.0-dev.
|
|
133
|
-
"@lodestar/logger": "^1.48.0-dev.
|
|
134
|
-
"@lodestar/params": "^1.48.0-dev.
|
|
135
|
-
"@lodestar/reqresp": "^1.48.0-dev.
|
|
136
|
-
"@lodestar/state-transition": "^1.48.0-dev.
|
|
137
|
-
"@lodestar/types": "^1.48.0-dev.
|
|
138
|
-
"@lodestar/utils": "^1.48.0-dev.
|
|
139
|
-
"@lodestar/validator": "^1.48.0-dev.
|
|
129
|
+
"@lodestar/api": "^1.48.0-dev.b0ddac0ac2",
|
|
130
|
+
"@lodestar/config": "^1.48.0-dev.b0ddac0ac2",
|
|
131
|
+
"@lodestar/db": "^1.48.0-dev.b0ddac0ac2",
|
|
132
|
+
"@lodestar/fork-choice": "^1.48.0-dev.b0ddac0ac2",
|
|
133
|
+
"@lodestar/logger": "^1.48.0-dev.b0ddac0ac2",
|
|
134
|
+
"@lodestar/params": "^1.48.0-dev.b0ddac0ac2",
|
|
135
|
+
"@lodestar/reqresp": "^1.48.0-dev.b0ddac0ac2",
|
|
136
|
+
"@lodestar/state-transition": "^1.48.0-dev.b0ddac0ac2",
|
|
137
|
+
"@lodestar/types": "^1.48.0-dev.b0ddac0ac2",
|
|
138
|
+
"@lodestar/utils": "^1.48.0-dev.b0ddac0ac2",
|
|
139
|
+
"@lodestar/validator": "^1.48.0-dev.b0ddac0ac2",
|
|
140
140
|
"@multiformats/multiaddr": "^13.0.1",
|
|
141
141
|
"datastore-core": "^12.0.1",
|
|
142
142
|
"datastore-level": "^13.0.1",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"@libp2p/interface-internal": "^3.1.12",
|
|
159
159
|
"@libp2p/logger": "^6.2.13",
|
|
160
160
|
"@libp2p/utils": "^7.4.0",
|
|
161
|
-
"@lodestar/spec-test-util": "^1.48.0-dev.
|
|
161
|
+
"@lodestar/spec-test-util": "^1.48.0-dev.b0ddac0ac2",
|
|
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": "fcd0494c4012c5756427bf6c40d3092d068256d6"
|
|
179
179
|
}
|
|
@@ -133,40 +133,37 @@ type BidCandidate = {
|
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* p2p bid, and the earlier received bid between builder api bids.
|
|
136
|
+
* Ranking value of a bid, the boosted total payment scaled by 100 as `boostFactor` is a percentage.
|
|
137
|
+
* Kept scaled so bids that differ by less than a percent are not truncated into a tie.
|
|
139
138
|
*/
|
|
140
|
-
function
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (candidateIsMaxBoost !== bestIsMaxBoost) {
|
|
152
|
-
if (candidateIsMaxBoost) {
|
|
153
|
-
best = candidate;
|
|
154
|
-
}
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
const candidateValue = boostedValue(candidate);
|
|
158
|
-
const bestValue = boostedValue(best);
|
|
159
|
-
if (candidateValue > bestValue) {
|
|
160
|
-
best = candidate;
|
|
161
|
-
} else if (
|
|
162
|
-
candidateValue === bestValue &&
|
|
163
|
-
// A tie prefers a builder api bid over the p2p bid, and the earlier received bid otherwise
|
|
164
|
-
(best.url === undefined || (candidate.url !== undefined && candidate.receivedMs < best.receivedMs))
|
|
165
|
-
) {
|
|
166
|
-
best = candidate;
|
|
167
|
-
}
|
|
139
|
+
function getBoostedTotalScaled({totalGwei, boostFactor}: BidCandidate): bigint {
|
|
140
|
+
return boostFactor * totalGwei;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Order bid candidates by preference, best first, used to select a bid and to log the ranking */
|
|
144
|
+
function compareBidCandidates(a: BidCandidate, b: BidCandidate): number {
|
|
145
|
+
// Preserve max boost preference before comparing bid values
|
|
146
|
+
const aIsMaxBoost = a.boostFactor === MAX_BUILDER_BOOST_FACTOR;
|
|
147
|
+
const bIsMaxBoost = b.boostFactor === MAX_BUILDER_BOOST_FACTOR;
|
|
148
|
+
if (aIsMaxBoost !== bIsMaxBoost) {
|
|
149
|
+
return aIsMaxBoost ? -1 : 1;
|
|
168
150
|
}
|
|
169
|
-
|
|
151
|
+
|
|
152
|
+
const aBoostedTotal = getBoostedTotalScaled(a);
|
|
153
|
+
const bBoostedTotal = getBoostedTotalScaled(b);
|
|
154
|
+
if (aBoostedTotal !== bBoostedTotal) {
|
|
155
|
+
return aBoostedTotal > bBoostedTotal ? -1 : 1;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// A tie prefers a builder api bid over the p2p bid
|
|
159
|
+
const aIsBuilderApi = a.url !== undefined;
|
|
160
|
+
const bIsBuilderApi = b.url !== undefined;
|
|
161
|
+
if (aIsBuilderApi !== bIsBuilderApi) {
|
|
162
|
+
return aIsBuilderApi ? -1 : 1;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// and the earlier received bid between builder api bids
|
|
166
|
+
return a.receivedMs - b.receivedMs;
|
|
170
167
|
}
|
|
171
168
|
|
|
172
169
|
type ProduceBlockContentsRes = {executionPayloadValue: Wei; consensusBlockValue: Wei} & {
|
|
@@ -1049,20 +1046,24 @@ export function getValidatorApi(
|
|
|
1049
1046
|
});
|
|
1050
1047
|
}
|
|
1051
1048
|
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1049
|
+
if (candidates.length === 0) {
|
|
1050
|
+
return null;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
const rankedCandidates = candidates.toSorted(compareBidCandidates);
|
|
1054
|
+
for (const [index, candidate] of rankedCandidates.entries()) {
|
|
1055
|
+
logger.debug("Builder bid candidate", {
|
|
1055
1056
|
slot,
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1057
|
+
rank: index + 1,
|
|
1058
|
+
source: candidate.url !== undefined ? toPrintableUrl(candidate.url) : "p2p",
|
|
1059
|
+
builder: candidate.signedBid.message.builderIndex,
|
|
1060
|
+
total: prettyGweiToEth(candidate.totalGwei),
|
|
1061
|
+
boost: candidate.boostFactor,
|
|
1062
|
+
boosted: prettyGweiToEth(getBoostedTotalScaled(candidate) / 100n),
|
|
1063
|
+
receivedMs: candidate.receivedMs,
|
|
1063
1064
|
});
|
|
1064
1065
|
}
|
|
1065
|
-
return
|
|
1066
|
+
return rankedCandidates[0];
|
|
1066
1067
|
})();
|
|
1067
1068
|
|
|
1068
1069
|
const commonBlockBodyPromise = chain.produceCommonBlockBody({
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {ForkName} from "@lodestar/params";
|
|
2
2
|
import {
|
|
3
3
|
BeaconStateTransitionMetrics,
|
|
4
|
+
BlockProcessStep,
|
|
4
5
|
EpochTransitionStep,
|
|
6
|
+
ProcessOperationsStep,
|
|
5
7
|
ProposerRewardType,
|
|
6
8
|
StateCloneSource,
|
|
7
9
|
StateHashTreeRootSource,
|
|
@@ -70,10 +72,21 @@ export function createHistoricalStateTransitionMetrics(
|
|
|
70
72
|
processBlockTime: metricsRegister.histogram({
|
|
71
73
|
name: "lodestar_historical_state_stfn_process_block_seconds",
|
|
72
74
|
help: "Time to process a single block in seconds",
|
|
73
|
-
// TODO: Add metrics for each step
|
|
74
75
|
// Block processing can take 5-40ms, 100ms max
|
|
75
76
|
buckets: [0.005, 0.01, 0.02, 0.05, 0.1, 1],
|
|
76
77
|
}),
|
|
78
|
+
processBlockStepTime: metricsRegister.histogram<{step: BlockProcessStep}>({
|
|
79
|
+
name: "lodestar_historical_state_stfn_process_block_step_seconds",
|
|
80
|
+
help: "Time to call each step of process block in seconds",
|
|
81
|
+
labelNames: ["step"],
|
|
82
|
+
buckets: [0.001, 0.005, 0.01, 0.025, 0.05, 0.1],
|
|
83
|
+
}),
|
|
84
|
+
processOperationsStepTime: metricsRegister.histogram<{step: ProcessOperationsStep}>({
|
|
85
|
+
name: "lodestar_historical_state_stfn_process_operations_step_seconds",
|
|
86
|
+
help: "Time to call each step of process operations in seconds",
|
|
87
|
+
labelNames: ["step"],
|
|
88
|
+
buckets: [0.001, 0.005, 0.01, 0.025, 0.05, 0.1],
|
|
89
|
+
}),
|
|
77
90
|
processBlockCommitTime: metricsRegister.histogram({
|
|
78
91
|
name: "lodestar_historical_state_stfn_process_block_commit_seconds",
|
|
79
92
|
help: "Time to call commit after process a single block in seconds",
|
|
@@ -524,19 +524,6 @@ export async function importBlock(
|
|
|
524
524
|
this.metrics?.previousJustifiedEpoch.set(checkpointState.previousJustifiedCheckpoint.epoch);
|
|
525
525
|
this.metrics?.currentJustifiedEpoch.set(justifiedCheckpoint.epoch);
|
|
526
526
|
}
|
|
527
|
-
const finalizedCheckpoint = checkpointState.finalizedCheckpoint;
|
|
528
|
-
const finalizedEpoch = finalizedCheckpoint.epoch;
|
|
529
|
-
const preFinalizedEpoch = parentBlockSummary.finalizedEpoch;
|
|
530
|
-
if (finalizedEpoch > preFinalizedEpoch) {
|
|
531
|
-
this.emitter.emit(routes.events.EventType.finalizedCheckpoint, {
|
|
532
|
-
block: toRootHex(finalizedCheckpoint.root),
|
|
533
|
-
epoch: finalizedCheckpoint.epoch,
|
|
534
|
-
state: toRootHex(checkpointState.hashTreeRoot()),
|
|
535
|
-
executionOptimistic: false,
|
|
536
|
-
});
|
|
537
|
-
this.logger.verbose("Checkpoint finalized", toCheckpointHex(finalizedCheckpoint));
|
|
538
|
-
this.metrics?.finalizedEpoch.set(finalizedCheckpoint.epoch);
|
|
539
|
-
}
|
|
540
527
|
}
|
|
541
528
|
}
|
|
542
529
|
|
|
@@ -22,7 +22,7 @@ export type ChainSegmentResult = {warnings: OrphanedPayloadEnvelope[] | null};
|
|
|
22
22
|
* - Verifies parent root + slot linearity
|
|
23
23
|
* - For gloas: verifies bid.parentBlockHash matches the tracked execution hash; if not, the
|
|
24
24
|
* previous FULL envelope is treated as orphaned (segment continues as if previous slot was EMPTY)
|
|
25
|
-
* - If an envelope exists for this slot: verifies it references this block's root
|
|
25
|
+
* - If an envelope exists for this slot (or the parent's slot): verifies it references this block's root
|
|
26
26
|
* - Advances the tracked execution hash (FULL if envelope present, EMPTY if not)
|
|
27
27
|
*/
|
|
28
28
|
export function assertLinearChainSegment(
|
|
@@ -48,6 +48,15 @@ export function assertLinearChainSegment(
|
|
|
48
48
|
if (parentBlock !== null) {
|
|
49
49
|
const parentPayloadInput = payloadEnvelopes?.get(parentBlock.slot);
|
|
50
50
|
if (parentPayloadInput?.hasPayloadEnvelope()) {
|
|
51
|
+
// Envelopes are served by slot, the one at the parent's slot must reference the parent block. Without this
|
|
52
|
+
// check an envelope of a sibling block is taken as orphaned and only fails downstream in the payload import
|
|
53
|
+
if (parentPayloadInput.blockRootHex !== parentBlock.blockRoot) {
|
|
54
|
+
throw new BlockError(blocks[0].getBlock(), {
|
|
55
|
+
code: BlockErrorCode.ENVELOPE_BLOCK_ROOT_MISMATCH,
|
|
56
|
+
envelopeBlockRoot: parentPayloadInput.blockRootHex,
|
|
57
|
+
blockRoot: parentBlock.blockRoot,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
51
60
|
const parentPayloadBlockHash = parentPayloadInput.getBlockHashHex();
|
|
52
61
|
if (currentExecHash === parentPayloadBlockHash) {
|
|
53
62
|
// Checkpoint-sync first batch: the anchor is stored PENDING with the inherited (grandparent)
|
package/src/chain/chain.ts
CHANGED
|
@@ -1271,59 +1271,65 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1271
1271
|
try {
|
|
1272
1272
|
const prevHead = this.forkChoice.getHead();
|
|
1273
1273
|
const head = this.forkChoice.updateAndGetHead({mode: UpdateHeadOpt.GetCanonicalHead}).head;
|
|
1274
|
+
this.emitHeadEvents(prevHead, head);
|
|
1275
|
+
return head;
|
|
1276
|
+
} catch (e) {
|
|
1277
|
+
this.metrics?.forkChoice.errors.inc({entrypoint: UpdateHeadOpt.GetCanonicalHead});
|
|
1278
|
+
throw e;
|
|
1279
|
+
} finally {
|
|
1280
|
+
timer?.();
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1274
1283
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1284
|
+
/**
|
|
1285
|
+
* Emit `head` and `head_v2` when the fork choice head differs between two observations. Every caller that
|
|
1286
|
+
* can move the head, `updateAndGetHead()` and `updateTime()`, must capture the head before and pass both.
|
|
1287
|
+
*/
|
|
1288
|
+
private emitHeadEvents(prevHead: ProtoBlock, head: ProtoBlock): void {
|
|
1289
|
+
const headRootChanged = head.blockRoot !== prevHead.blockRoot;
|
|
1280
1290
|
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
const epochTransition = computeStartSlotAtEpoch(computeEpochAtSlot(head.slot)) === head.slot;
|
|
1285
|
-
const executionOptimistic = isOptimisticBlock(head);
|
|
1286
|
-
|
|
1287
|
-
if (headRootChanged) {
|
|
1288
|
-
this.emitter.emit(routes.events.EventType.head, {
|
|
1289
|
-
block: head.blockRoot,
|
|
1290
|
-
epochTransition,
|
|
1291
|
-
slot: head.slot,
|
|
1292
|
-
state: head.stateRoot,
|
|
1293
|
-
previousDutyDependentRoot,
|
|
1294
|
-
currentDutyDependentRoot,
|
|
1295
|
-
executionOptimistic,
|
|
1296
|
-
});
|
|
1297
|
-
}
|
|
1291
|
+
if (!headRootChanged && prevHead.payloadStatus === head.payloadStatus) {
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1298
1294
|
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1295
|
+
try {
|
|
1296
|
+
const previousDutyDependentRoot = this.forkChoice.getDependentRoot(head, EpochDifference.previous);
|
|
1297
|
+
const currentDutyDependentRoot = this.forkChoice.getDependentRoot(head, EpochDifference.current);
|
|
1298
|
+
const epochTransition = computeStartSlotAtEpoch(computeEpochAtSlot(head.slot)) === head.slot;
|
|
1299
|
+
const executionOptimistic = isOptimisticBlock(head);
|
|
1300
|
+
|
|
1301
|
+
if (headRootChanged) {
|
|
1302
|
+
this.emitter.emit(routes.events.EventType.head, {
|
|
1303
|
+
block: head.blockRoot,
|
|
1304
|
+
epochTransition,
|
|
1305
|
+
slot: head.slot,
|
|
1306
|
+
state: head.stateRoot,
|
|
1307
|
+
previousDutyDependentRoot,
|
|
1308
|
+
currentDutyDependentRoot,
|
|
1309
|
+
executionOptimistic,
|
|
1311
1310
|
});
|
|
1312
|
-
} catch (e) {
|
|
1313
|
-
// getDependentRoot() may fail with error: "No block for root" as we can see in holesky non-finality issue
|
|
1314
|
-
this.logger.debug(
|
|
1315
|
-
"Error emitting head/head_v2 event",
|
|
1316
|
-
{slot: head.slot, root: head.blockRoot, headRootChanged},
|
|
1317
|
-
e as Error
|
|
1318
|
-
);
|
|
1319
1311
|
}
|
|
1320
1312
|
|
|
1321
|
-
|
|
1313
|
+
this.emitter.emit(routes.events.EventType.headV2, {
|
|
1314
|
+
version: this.config.getForkName(head.slot),
|
|
1315
|
+
data: {
|
|
1316
|
+
slot: head.slot,
|
|
1317
|
+
block: head.blockRoot,
|
|
1318
|
+
state: head.stateRoot,
|
|
1319
|
+
payloadStatus: head.payloadStatus === PayloadStatus.FULL ? "full" : "empty",
|
|
1320
|
+
epochTransition,
|
|
1321
|
+
currentEpochDependentRoot: previousDutyDependentRoot,
|
|
1322
|
+
nextEpochDependentRoot: currentDutyDependentRoot,
|
|
1323
|
+
executionOptimistic,
|
|
1324
|
+
},
|
|
1325
|
+
});
|
|
1322
1326
|
} catch (e) {
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
+
// getDependentRoot() may fail with error: "No block for root" as we can see in holesky non-finality issue
|
|
1328
|
+
this.logger.debug(
|
|
1329
|
+
"Error emitting head/head_v2 event",
|
|
1330
|
+
{slot: head.slot, root: head.blockRoot, headRootChanged},
|
|
1331
|
+
e as Error
|
|
1332
|
+
);
|
|
1327
1333
|
}
|
|
1328
1334
|
}
|
|
1329
1335
|
|
|
@@ -1612,7 +1618,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1612
1618
|
this.processShutdownCallback(this.forkChoice.irrecoverableError);
|
|
1613
1619
|
}
|
|
1614
1620
|
|
|
1621
|
+
// updateTime() recomputes the head on epoch-boundary checkpoint pull-up and under fast confirmation
|
|
1622
|
+
const prevHead = this.forkChoice.getHead();
|
|
1615
1623
|
this.forkChoice.updateTime(slot);
|
|
1624
|
+
this.emitHeadEvents(prevHead, this.forkChoice.getHead());
|
|
1616
1625
|
this.metrics?.clockSlot.set(slot);
|
|
1617
1626
|
|
|
1618
1627
|
this.attestationPool.prune(slot);
|
|
@@ -1670,6 +1679,25 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1670
1679
|
|
|
1671
1680
|
private async onForkChoiceFinalized(this: BeaconChain, cp: CheckpointWithHex): Promise<void> {
|
|
1672
1681
|
this.logger.verbose("Fork choice finalized", {epoch: cp.epoch, root: cp.rootHex});
|
|
1682
|
+
this.metrics?.finalizedEpoch.set(cp.epoch);
|
|
1683
|
+
const finalizedBlock = this.forkChoice.getBlockHexDefaultStatus(cp.rootHex);
|
|
1684
|
+
if (finalizedBlock) {
|
|
1685
|
+
// The callback runs synchronously inside fork choice checkpoint updates, defer writing to subscribers
|
|
1686
|
+
callInNextEventLoop(() => {
|
|
1687
|
+
this.emitter.emit(routes.events.EventType.finalizedCheckpoint, {
|
|
1688
|
+
block: cp.rootHex,
|
|
1689
|
+
epoch: cp.epoch,
|
|
1690
|
+
state: finalizedBlock.stateRoot,
|
|
1691
|
+
executionOptimistic: isOptimisticBlock(finalizedBlock),
|
|
1692
|
+
});
|
|
1693
|
+
});
|
|
1694
|
+
} else {
|
|
1695
|
+
this.logger.debug("Finalized block not found in fork choice, skip finalized_checkpoint event", {
|
|
1696
|
+
epoch: cp.epoch,
|
|
1697
|
+
root: cp.rootHex,
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1673
1701
|
const finalizedSlot = computeStartSlotAtEpoch(cp.epoch);
|
|
1674
1702
|
this.seenBlockProposers.prune(finalizedSlot);
|
|
1675
1703
|
|
package/src/chain/emitter.ts
CHANGED
|
@@ -33,7 +33,7 @@ export enum ChainEvent {
|
|
|
33
33
|
/**
|
|
34
34
|
* This event signals that the fork choice store has been updated.
|
|
35
35
|
*
|
|
36
|
-
* This event is guaranteed to be triggered whenever the fork choice
|
|
36
|
+
* This event is guaranteed to be triggered whenever the fork choice finalized checkpoint is updated. This is either in response to a newly processed block or a new clock tick.
|
|
37
37
|
*/
|
|
38
38
|
forkChoiceFinalized = "forkChoice:finalized",
|
|
39
39
|
/**
|
|
@@ -78,8 +78,8 @@ export enum BlockErrorCode {
|
|
|
78
78
|
TOO_MANY_KZG_COMMITMENTS = "BLOCK_ERROR_TOO_MANY_KZG_COMMITMENTS",
|
|
79
79
|
/** Bid parent block root does not match block parent root */
|
|
80
80
|
BID_PARENT_ROOT_MISMATCH = "BLOCK_ERROR_BID_PARENT_ROOT_MISMATCH",
|
|
81
|
-
/** A block
|
|
82
|
-
|
|
81
|
+
/** A block contains deposits where none are allowed */
|
|
82
|
+
NON_ZERO_DEPOSITS = "BLOCK_ERROR_NON_ZERO_DEPOSITS",
|
|
83
83
|
/** The parent block's execution payload has been verified as invalid */
|
|
84
84
|
PARENT_EXECUTION_INVALID = "BLOCK_ERROR_PARENT_EXECUTION_INVALID",
|
|
85
85
|
/**
|
|
@@ -153,7 +153,7 @@ export type BlockErrorType =
|
|
|
153
153
|
| {code: BlockErrorCode.DATA_UNAVAILABLE}
|
|
154
154
|
| {code: BlockErrorCode.TOO_MANY_KZG_COMMITMENTS; blobKzgCommitmentsLen: number; commitmentLimit: number}
|
|
155
155
|
| {code: BlockErrorCode.BID_PARENT_ROOT_MISMATCH; bidParentRoot: RootHex; blockParentRoot: RootHex}
|
|
156
|
-
| {code: BlockErrorCode.
|
|
156
|
+
| {code: BlockErrorCode.NON_ZERO_DEPOSITS; count: number}
|
|
157
157
|
| {code: BlockErrorCode.PARENT_EXECUTION_INVALID; parentRoot: RootHex}
|
|
158
158
|
| {code: BlockErrorCode.PARENT_PAYLOAD_UNKNOWN; parentRoot: RootHex; parentBlockHash: RootHex}
|
|
159
159
|
| {code: BlockErrorCode.NON_LINEAR_PAYLOAD_ROOTS; parentBlockHash: RootHex; expectedBlockHash: RootHex};
|
|
@@ -12,8 +12,6 @@ export enum ExecutionPayloadEnvelopeErrorCode {
|
|
|
12
12
|
BUILDER_INDEX_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BUILDER_INDEX_MISMATCH",
|
|
13
13
|
BLOCK_HASH_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_BLOCK_HASH_MISMATCH",
|
|
14
14
|
EXECUTION_REQUESTS_ROOT_MISMATCH = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_EXECUTION_REQUESTS_ROOT_MISMATCH",
|
|
15
|
-
EXECUTION_REQUESTS_COUNT_EXCEEDED = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_EXECUTION_REQUESTS_COUNT_EXCEEDED",
|
|
16
|
-
WITHDRAWALS_COUNT_EXCEEDED = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_WITHDRAWALS_COUNT_EXCEEDED",
|
|
17
15
|
INVALID_SIGNATURE = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_INVALID_SIGNATURE",
|
|
18
16
|
PAYLOAD_ENVELOPE_INPUT_MISSING = "EXECUTION_PAYLOAD_ENVELOPE_ERROR_PAYLOAD_ENVELOPE_INPUT_MISSING",
|
|
19
17
|
}
|
|
@@ -44,13 +42,6 @@ export type ExecutionPayloadEnvelopeErrorType =
|
|
|
44
42
|
envelopeRequestsRoot: RootHex;
|
|
45
43
|
bidRequestsRoot: RootHex;
|
|
46
44
|
}
|
|
47
|
-
| {
|
|
48
|
-
code: ExecutionPayloadEnvelopeErrorCode.EXECUTION_REQUESTS_COUNT_EXCEEDED;
|
|
49
|
-
name: string;
|
|
50
|
-
count: number;
|
|
51
|
-
limit: number;
|
|
52
|
-
}
|
|
53
|
-
| {code: ExecutionPayloadEnvelopeErrorCode.WITHDRAWALS_COUNT_EXCEEDED; count: number; limit: number}
|
|
54
45
|
| {code: ExecutionPayloadEnvelopeErrorCode.INVALID_SIGNATURE}
|
|
55
46
|
| {code: ExecutionPayloadEnvelopeErrorCode.PAYLOAD_ENVELOPE_INPUT_MISSING; blockRoot: RootHex};
|
|
56
47
|
|
|
@@ -243,6 +243,22 @@ export class PrepareNextSlotScheduler {
|
|
|
243
243
|
parentBlockHash = preparedState.latestExecutionPayloadHeader.blockHash;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
+
// If emitPayloadAttributes is true emit a SSE payloadAttributes event for
|
|
247
|
+
// every slot. Without the flag, only emit the event if we are proposing in the next slot.
|
|
248
|
+
if (
|
|
249
|
+
(feeRecipient || this.chain.opts.emitPayloadAttributes === true) &&
|
|
250
|
+
this.chain.emitter.listenerCount(routes.events.EventType.payloadAttributes)
|
|
251
|
+
) {
|
|
252
|
+
const data = getPayloadAttributesForSSE(fork as ForkPostBellatrix, this.chain, {
|
|
253
|
+
prepareState: stateAfterParentPayload,
|
|
254
|
+
prepareSlot,
|
|
255
|
+
parentBlockRoot: fromHex(updatedHead.blockRoot),
|
|
256
|
+
parentBlockHash,
|
|
257
|
+
feeRecipient: feeRecipient ?? "0x0000000000000000000000000000000000000000",
|
|
258
|
+
});
|
|
259
|
+
this.chain.emitter.emit(routes.events.EventType.payloadAttributes, {data, version: fork});
|
|
260
|
+
}
|
|
261
|
+
|
|
246
262
|
if (feeRecipient) {
|
|
247
263
|
const preparationTime =
|
|
248
264
|
computeTimeAtSlot(this.config, prepareSlot, this.chain.genesisTime) - Date.now() / 1000;
|
|
@@ -273,22 +289,6 @@ export class PrepareNextSlotScheduler {
|
|
|
273
289
|
}
|
|
274
290
|
|
|
275
291
|
this.computeStateHashTreeRoot(preparedState, isEpochTransition);
|
|
276
|
-
|
|
277
|
-
// If emitPayloadAttributes is true emit a SSE payloadAttributes event for
|
|
278
|
-
// every slot. Without the flag, only emit the event if we are proposing in the next slot.
|
|
279
|
-
if (
|
|
280
|
-
(feeRecipient || this.chain.opts.emitPayloadAttributes === true) &&
|
|
281
|
-
this.chain.emitter.listenerCount(routes.events.EventType.payloadAttributes)
|
|
282
|
-
) {
|
|
283
|
-
const data = getPayloadAttributesForSSE(fork as ForkPostBellatrix, this.chain, {
|
|
284
|
-
prepareState: stateAfterParentPayload,
|
|
285
|
-
prepareSlot,
|
|
286
|
-
parentBlockRoot: fromHex(updatedHead.blockRoot),
|
|
287
|
-
parentBlockHash,
|
|
288
|
-
feeRecipient: feeRecipient ?? "0x0000000000000000000000000000000000000000",
|
|
289
|
-
});
|
|
290
|
-
this.chain.emitter.emit(routes.events.EventType.payloadAttributes, {data, version: fork});
|
|
291
|
-
}
|
|
292
292
|
} else {
|
|
293
293
|
// Pre-bellatrix only reaches here at an epoch transition to precompute the next epoch state
|
|
294
294
|
const preparedState = await this.chain.regen.getBlockSlotState(
|