@lodestar/beacon-node 2.1.0-dev.7438ca57ce → 2.1.0-dev.76e8ca15f1
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/blocks/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +1 -3
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +8 -0
- 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 -2
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +1 -1
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/errors.d.ts +7 -0
- package/lib/api/impl/errors.d.ts.map +1 -1
- package/lib/api/impl/errors.js +9 -0
- package/lib/api/impl/errors.js.map +1 -1
- package/lib/api/impl/validator/index.js +1 -1
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/api/rest/base.d.ts.map +1 -1
- package/lib/api/rest/base.js +6 -3
- package/lib/api/rest/base.js.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.d.ts +3 -0
- package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js +3 -1
- package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
- package/lib/chain/GetBlobsTracker.d.ts +3 -0
- package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
- package/lib/chain/GetBlobsTracker.js +3 -1
- package/lib/chain/GetBlobsTracker.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +14 -5
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +4 -2
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +2 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
- package/lib/chain/chain.d.ts +2 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +29 -6
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/dataColumnSidecarError.d.ts +7 -0
- package/lib/chain/errors/dataColumnSidecarError.d.ts.map +1 -1
- package/lib/chain/errors/dataColumnSidecarError.js +1 -0
- package/lib/chain/errors/dataColumnSidecarError.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts +11 -2
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +180 -13
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/interface.d.ts +2 -1
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/opPools/opPool.d.ts +9 -3
- package/lib/chain/opPools/opPool.d.ts.map +1 -1
- package/lib/chain/opPools/opPool.js +22 -16
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -2
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/seenCache/index.d.ts +1 -0
- package/lib/chain/seenCache/index.d.ts.map +1 -1
- package/lib/chain/seenCache/index.js +1 -0
- package/lib/chain/seenCache/index.js.map +1 -1
- package/lib/chain/seenCache/seenBlockProposers.d.ts +3 -0
- package/lib/chain/seenCache/seenBlockProposers.d.ts.map +1 -1
- package/lib/chain/seenCache/seenBlockProposers.js +6 -2
- package/lib/chain/seenCache/seenBlockProposers.js.map +1 -1
- package/lib/chain/seenCache/seenDataColumnSidecars.d.ts +17 -0
- package/lib/chain/seenCache/seenDataColumnSidecars.d.ts.map +1 -0
- package/lib/chain/seenCache/seenDataColumnSidecars.js +61 -0
- package/lib/chain/seenCache/seenDataColumnSidecars.js.map +1 -0
- package/lib/chain/seenCache/seenGossipBlockInput.js +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +11 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +28 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +4 -2
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +20 -7
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +1 -1
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +5 -1
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/voluntaryExit.js +2 -2
- package/lib/chain/validation/voluntaryExit.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/network/core/networkCore.d.ts +1 -3
- package/lib/network/core/networkCore.d.ts.map +1 -1
- package/lib/network/core/networkCore.js +1 -3
- package/lib/network/core/networkCore.js.map +1 -1
- package/lib/network/forks.d.ts +2 -2
- package/lib/network/forks.d.ts.map +1 -1
- package/lib/network/forks.js +3 -3
- package/lib/network/forks.js.map +1 -1
- package/lib/network/gossip/scoringParameters.js +19 -14
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/network.d.ts +1 -6
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +16 -40
- package/lib/network/network.js.map +1 -1
- package/lib/network/options.d.ts +0 -1
- package/lib/network/options.d.ts.map +1 -1
- package/lib/network/options.js +0 -1
- package/lib/network/options.js.map +1 -1
- package/lib/network/peers/discover.d.ts +1 -0
- package/lib/network/peers/discover.d.ts.map +1 -1
- package/lib/network/peers/discover.js +44 -48
- package/lib/network/peers/discover.js.map +1 -1
- package/lib/network/peers/score/store.d.ts.map +1 -1
- package/lib/network/peers/score/store.js +1 -2
- package/lib/network/peers/score/store.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +85 -17
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +3 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +1 -0
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/range.d.ts.map +1 -1
- package/lib/sync/range/range.js +5 -1
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +14 -1
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +6 -0
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +17 -8
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +1 -1
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/sync/utils/pendingBlocksTree.d.ts.map +1 -1
- package/lib/sync/utils/pendingBlocksTree.js +6 -1
- package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
- package/lib/util/dataColumns.d.ts +2 -1
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +7 -2
- package/lib/util/dataColumns.js.map +1 -1
- package/lib/util/execution.d.ts +2 -1
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js +7 -2
- package/lib/util/execution.js.map +1 -1
- package/package.json +18 -21
- package/src/api/impl/beacon/blocks/index.ts +1 -5
- package/src/api/impl/beacon/pool/index.ts +11 -0
- package/src/api/impl/beacon/state/index.ts +3 -7
- package/src/api/impl/beacon/state/utils.ts +1 -1
- package/src/api/impl/errors.ts +10 -0
- package/src/api/impl/validator/index.ts +1 -1
- package/src/api/rest/base.ts +9 -3
- package/src/chain/ColumnReconstructionTracker.ts +5 -1
- package/src/chain/GetBlobsTracker.ts +5 -0
- package/src/chain/blocks/importBlock.ts +14 -7
- package/src/chain/blocks/importExecutionPayload.ts +4 -2
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +8 -1
- package/src/chain/chain.ts +34 -5
- package/src/chain/errors/dataColumnSidecarError.ts +8 -0
- package/src/chain/forkChoice/index.ts +233 -13
- package/src/chain/interface.ts +2 -0
- package/src/chain/opPools/opPool.ts +27 -16
- package/src/chain/options.ts +1 -2
- package/src/chain/seenCache/index.ts +1 -0
- package/src/chain/seenCache/seenBlockProposers.ts +12 -2
- package/src/chain/seenCache/seenDataColumnSidecars.ts +69 -0
- package/src/chain/seenCache/seenGossipBlockInput.ts +1 -1
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +28 -2
- package/src/chain/validation/attestation.ts +4 -2
- package/src/chain/validation/block.ts +19 -7
- package/src/chain/validation/dataColumnSidecar.ts +1 -1
- package/src/chain/validation/proposerSlashing.ts +5 -1
- package/src/chain/validation/voluntaryExit.ts +2 -2
- package/src/index.ts +1 -0
- package/src/network/core/networkCore.ts +1 -3
- package/src/network/forks.ts +7 -3
- package/src/network/gossip/scoringParameters.ts +23 -14
- package/src/network/network.ts +20 -44
- package/src/network/options.ts +0 -2
- package/src/network/peers/discover.ts +42 -52
- package/src/network/peers/score/store.ts +1 -2
- package/src/network/processor/gossipHandlers.ts +147 -25
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +4 -1
- package/src/sync/range/chain.ts +1 -0
- package/src/sync/range/range.ts +7 -1
- package/src/sync/unknownBlock.ts +20 -1
- package/src/sync/utils/downloadByRange.ts +30 -7
- package/src/sync/utils/downloadByRoot.ts +12 -9
- package/src/sync/utils/pendingBlocksTree.ts +6 -1
- package/src/util/dataColumns.ts +13 -1
- package/src/util/execution.ts +16 -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": "2.1.0-dev.
|
|
14
|
+
"version": "2.1.0-dev.76e8ca15f1",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -89,8 +89,6 @@
|
|
|
89
89
|
"test:e2e": "vitest run --project e2e --project e2e-sync --project e2e-mainnet",
|
|
90
90
|
"test:sim": "vitest run test/sim/**/*.test.ts",
|
|
91
91
|
"test:sim:blobs": "vitest run test/sim/4844-interop.test.ts",
|
|
92
|
-
"download-spec-tests": "node --import tsx test/spec/downloadTests.ts",
|
|
93
|
-
"download-comptests": "node --import tsx test/spec/downloadComptests.ts",
|
|
94
92
|
"test:comptest": "vitest run --project comptest",
|
|
95
93
|
"test:spec:bls": "vitest run --project spec-minimal test/spec/bls/",
|
|
96
94
|
"test:spec:general": "vitest run --project spec-minimal test/spec/general/",
|
|
@@ -105,10 +103,10 @@
|
|
|
105
103
|
"@chainsafe/enr": "^6.0.2",
|
|
106
104
|
"@chainsafe/libp2p-noise": "^17.0.0",
|
|
107
105
|
"@chainsafe/libp2p-quic": "^2.1.6",
|
|
108
|
-
"@chainsafe/persistent-merkle-tree": "^1.3.
|
|
106
|
+
"@chainsafe/persistent-merkle-tree": "^1.3.2",
|
|
109
107
|
"@chainsafe/prometheus-gc-stats": "^1.0.0",
|
|
110
108
|
"@chainsafe/snappy-wasm": "^0.5.2",
|
|
111
|
-
"@chainsafe/ssz": "^1.9.
|
|
109
|
+
"@chainsafe/ssz": "^1.9.3",
|
|
112
110
|
"@chainsafe/threads": "^1.11.3",
|
|
113
111
|
"@crate-crypto/node-eth-kzg": "0.9.1",
|
|
114
112
|
"@fastify/bearer-auth": "^10.0.1",
|
|
@@ -126,18 +124,18 @@
|
|
|
126
124
|
"@libp2p/prometheus-metrics": "^5.0.31",
|
|
127
125
|
"@libp2p/tcp": "^11.0.30",
|
|
128
126
|
"@libp2p/utils": "^7.4.6",
|
|
129
|
-
"@lodestar/api": "^2.1.0-dev.
|
|
130
|
-
"@lodestar/config": "^2.1.0-dev.
|
|
131
|
-
"@lodestar/db": "^2.1.0-dev.
|
|
132
|
-
"@lodestar/fork-choice": "^2.1.0-dev.
|
|
133
|
-
"@lodestar/logger": "^2.1.0-dev.
|
|
134
|
-
"@lodestar/native": "^2.1.0-dev.
|
|
135
|
-
"@lodestar/params": "^2.1.0-dev.
|
|
136
|
-
"@lodestar/reqresp": "^2.1.0-dev.
|
|
137
|
-
"@lodestar/state-transition": "^2.1.0-dev.
|
|
138
|
-
"@lodestar/types": "^2.1.0-dev.
|
|
139
|
-
"@lodestar/utils": "^2.1.0-dev.
|
|
140
|
-
"@lodestar/validator": "^2.1.0-dev.
|
|
127
|
+
"@lodestar/api": "^2.1.0-dev.76e8ca15f1",
|
|
128
|
+
"@lodestar/config": "^2.1.0-dev.76e8ca15f1",
|
|
129
|
+
"@lodestar/db": "^2.1.0-dev.76e8ca15f1",
|
|
130
|
+
"@lodestar/fork-choice": "^2.1.0-dev.76e8ca15f1",
|
|
131
|
+
"@lodestar/logger": "^2.1.0-dev.76e8ca15f1",
|
|
132
|
+
"@lodestar/native": "^2.1.0-dev.76e8ca15f1",
|
|
133
|
+
"@lodestar/params": "^2.1.0-dev.76e8ca15f1",
|
|
134
|
+
"@lodestar/reqresp": "^2.1.0-dev.76e8ca15f1",
|
|
135
|
+
"@lodestar/state-transition": "^2.1.0-dev.76e8ca15f1",
|
|
136
|
+
"@lodestar/types": "^2.1.0-dev.76e8ca15f1",
|
|
137
|
+
"@lodestar/utils": "^2.1.0-dev.76e8ca15f1",
|
|
138
|
+
"@lodestar/validator": "^2.1.0-dev.76e8ca15f1",
|
|
141
139
|
"@multiformats/multiaddr": "^13.0.1",
|
|
142
140
|
"datastore-core": "^12.0.1",
|
|
143
141
|
"datastore-level": "^13.0.1",
|
|
@@ -159,12 +157,11 @@
|
|
|
159
157
|
"@ethereumjs/rlp": "^10.1.3",
|
|
160
158
|
"@libp2p/interface-internal": "^3.2.3",
|
|
161
159
|
"@libp2p/logger": "^6.2.16",
|
|
162
|
-
"@lodestar/spec-test-util": "^2.1.0-dev.
|
|
163
|
-
"@lodestar/test-utils": "^2.1.0-dev.
|
|
160
|
+
"@lodestar/spec-test-util": "^2.1.0-dev.76e8ca15f1",
|
|
161
|
+
"@lodestar/test-utils": "^2.1.0-dev.76e8ca15f1",
|
|
164
162
|
"@types/js-yaml": "^4.0.5",
|
|
165
163
|
"@types/qs": "^6.9.7",
|
|
166
164
|
"@types/tmp": "^0.2.3",
|
|
167
|
-
"dotenv": "^16.4.5",
|
|
168
165
|
"js-yaml": "^4.1.0",
|
|
169
166
|
"tmp": "^0.2.1"
|
|
170
167
|
},
|
|
@@ -174,5 +171,5 @@
|
|
|
174
171
|
"beacon",
|
|
175
172
|
"blockchain"
|
|
176
173
|
],
|
|
177
|
-
"gitHead": "
|
|
174
|
+
"gitHead": "1601f3849fb46d9659e7d31b921c331c0f4f62ab"
|
|
178
175
|
}
|
|
@@ -542,11 +542,7 @@ export function getBeaconBlockApi(
|
|
|
542
542
|
})
|
|
543
543
|
);
|
|
544
544
|
return {
|
|
545
|
-
data: result.filter(
|
|
546
|
-
(item) =>
|
|
547
|
-
// skip if no slot filter
|
|
548
|
-
!(slot !== undefined && slot !== 0) || item.header.message.slot === slot
|
|
549
|
-
),
|
|
545
|
+
data: result.filter((item) => slot === undefined || item.header.message.slot === slot),
|
|
550
546
|
meta: {executionOptimistic, finalized},
|
|
551
547
|
};
|
|
552
548
|
}
|
|
@@ -200,12 +200,23 @@ export function getBeaconPoolApi({
|
|
|
200
200
|
const verifiedDomains = await validateApiAttesterSlashing(chain, attesterSlashing);
|
|
201
201
|
const fork = chain.config.getForkName(Number(attesterSlashing.attestation1.data.slot));
|
|
202
202
|
chain.opPool.insertAttesterSlashing(fork, attesterSlashing, verifiedDomains);
|
|
203
|
+
try {
|
|
204
|
+
chain.forkChoice.onAttesterSlashing(attesterSlashing);
|
|
205
|
+
} catch (e) {
|
|
206
|
+
logger.warn(
|
|
207
|
+
"Error processing AttesterSlashing from api",
|
|
208
|
+
{slot: attesterSlashing.attestation1.data.slot},
|
|
209
|
+
e as Error
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
chain.emitter.emit(routes.events.EventType.attesterSlashing, attesterSlashing);
|
|
203
213
|
await network.publishAttesterSlashing(attesterSlashing);
|
|
204
214
|
},
|
|
205
215
|
|
|
206
216
|
async submitPoolProposerSlashings({proposerSlashing}) {
|
|
207
217
|
const verifiedDomain = await validateApiProposerSlashing(chain, proposerSlashing);
|
|
208
218
|
chain.opPool.insertProposerSlashing(proposerSlashing, verifiedDomain);
|
|
219
|
+
chain.emitter.emit(routes.events.EventType.proposerSlashing, proposerSlashing);
|
|
209
220
|
await network.publishProposerSlashing(proposerSlashing);
|
|
210
221
|
},
|
|
211
222
|
|
|
@@ -114,16 +114,12 @@ export function getBeaconStateApi({
|
|
|
114
114
|
if (resp.valid) {
|
|
115
115
|
const validatorIndex = resp.validatorIndex;
|
|
116
116
|
const validator = state.getValidator(validatorIndex);
|
|
117
|
-
const
|
|
117
|
+
const balance = state.getBalance(validatorIndex);
|
|
118
|
+
const status = getValidatorStatus(validator, balance, currentEpoch);
|
|
118
119
|
if (statuses.length && !statuses.includes(status) && !statuses.includes(mapToGeneralStatus(status))) {
|
|
119
120
|
continue;
|
|
120
121
|
}
|
|
121
|
-
const validatorResponse = toValidatorResponse(
|
|
122
|
-
validatorIndex,
|
|
123
|
-
validator,
|
|
124
|
-
state.getBalance(validatorIndex),
|
|
125
|
-
currentEpoch
|
|
126
|
-
);
|
|
122
|
+
const validatorResponse = toValidatorResponse(validatorIndex, validator, balance, currentEpoch);
|
|
127
123
|
validatorResponses.push(validatorResponse);
|
|
128
124
|
}
|
|
129
125
|
}
|
|
@@ -109,7 +109,7 @@ export function toValidatorResponse(
|
|
|
109
109
|
): routes.beacon.ValidatorResponse {
|
|
110
110
|
return {
|
|
111
111
|
index,
|
|
112
|
-
status: getValidatorStatus(validator, currentEpoch),
|
|
112
|
+
status: getValidatorStatus(validator, balance, currentEpoch),
|
|
113
113
|
balance,
|
|
114
114
|
validator,
|
|
115
115
|
};
|
package/src/api/impl/errors.ts
CHANGED
|
@@ -28,6 +28,16 @@ export class NodeIsSyncing extends ApiError {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* A service that is not ready to serve the request yet, e.g. while it is starting up. Expected to happen for every
|
|
33
|
+
* request until it is ready, the REST API server logs it at debug instead of as a warning
|
|
34
|
+
*/
|
|
35
|
+
export class ServiceNotReady extends ApiError {
|
|
36
|
+
constructor(message: string) {
|
|
37
|
+
super(503, message);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
31
41
|
// Error thrown by beacon node APIs that are only supported by distributed validator middleware clients
|
|
32
42
|
// For example https://github.com/ethereum/beacon-APIs/blob/f087fbf2764e657578a6c29bdf0261b36ee8db1e/apis/validator/beacon_committee_selections.yaml
|
|
33
43
|
export class OnlySupportedByDVT extends ApiError {
|
|
@@ -2174,7 +2174,7 @@ export function getValidatorApi(
|
|
|
2174
2174
|
if (validatorIndex === null || validatorIndex >= headState.validatorCount) return false;
|
|
2175
2175
|
|
|
2176
2176
|
const validator = headState.getValidator(validatorIndex);
|
|
2177
|
-
const status = getValidatorStatus(validator, currentEpoch);
|
|
2177
|
+
const status = getValidatorStatus(validator, headState.getBalance(validatorIndex), currentEpoch);
|
|
2178
2178
|
return (
|
|
2179
2179
|
status === "active_exiting" ||
|
|
2180
2180
|
status === "active_ongoing" ||
|
package/src/api/rest/base.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {NUMBER_OF_COLUMNS} from "@lodestar/params";
|
|
|
7
7
|
import {ErrorAborted, Gauge, Histogram, Logger} from "@lodestar/utils";
|
|
8
8
|
import {GossipActionError} from "../../chain/errors/gossipValidation.js";
|
|
9
9
|
import {isLocalhostIP} from "../../util/ip.js";
|
|
10
|
-
import {ApiError, FailureList, IndexedError, NodeIsSyncing} from "../impl/errors.js";
|
|
10
|
+
import {ApiError, FailureList, IndexedError, NodeIsSyncing, ServiceNotReady} from "../impl/errors.js";
|
|
11
11
|
import {HttpActiveSocketsTracker, SocketMetrics} from "./activeSockets.js";
|
|
12
12
|
|
|
13
13
|
export type RestApiServerOpts = {
|
|
@@ -178,7 +178,9 @@ export class RestApiServer {
|
|
|
178
178
|
|
|
179
179
|
const operationId = getOperationId(req);
|
|
180
180
|
|
|
181
|
-
if (
|
|
181
|
+
if (err instanceof ServiceNotReady) {
|
|
182
|
+
this.logger.debug(`Req ${req.id} ${operationId} failed`, {reason: err.message});
|
|
183
|
+
} else if (
|
|
182
184
|
err instanceof ApiError ||
|
|
183
185
|
err instanceof GossipActionError ||
|
|
184
186
|
[INVALID_MEDIA_TYPE_CODE, SCHEMA_VALIDATION_ERROR_CODE].includes(err.code)
|
|
@@ -207,7 +209,11 @@ export class RestApiServer {
|
|
|
207
209
|
this.logger.warn("REST API server is exposed, ensure untrusted traffic cannot reach this API");
|
|
208
210
|
}
|
|
209
211
|
} catch (e) {
|
|
210
|
-
this.logger.error(
|
|
212
|
+
this.logger.error(
|
|
213
|
+
"Error starting REST api server",
|
|
214
|
+
{address: this.opts.address, port: this.opts.port},
|
|
215
|
+
e as Error
|
|
216
|
+
);
|
|
211
217
|
throw e;
|
|
212
218
|
}
|
|
213
219
|
}
|
|
@@ -8,6 +8,7 @@ import {JobItemQueue} from "../util/queue/index.js";
|
|
|
8
8
|
import {BlockInputColumns} from "./blocks/blockInput/index.js";
|
|
9
9
|
import {PayloadEnvelopeInput} from "./blocks/payloadEnvelopeInput/index.js";
|
|
10
10
|
import {ChainEventEmitter} from "./emitter.js";
|
|
11
|
+
import {SeenDataColumnSidecars} from "./seenCache/seenDataColumnSidecars.js";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Minimum time to wait before attempting reconstruction
|
|
@@ -31,6 +32,7 @@ export type ColumnReconstructionInput = BlockInputColumns | PayloadEnvelopeInput
|
|
|
31
32
|
export type ColumnReconstructionTrackerInit = {
|
|
32
33
|
logger: Logger;
|
|
33
34
|
emitter: ChainEventEmitter;
|
|
35
|
+
seenDataColumnSidecars: SeenDataColumnSidecars;
|
|
34
36
|
metrics: Metrics | null;
|
|
35
37
|
config: ChainForkConfig;
|
|
36
38
|
signal: AbortSignal;
|
|
@@ -44,6 +46,7 @@ export type ColumnReconstructionTrackerInit = {
|
|
|
44
46
|
export class ColumnReconstructionTracker {
|
|
45
47
|
logger: Logger;
|
|
46
48
|
emitter: ChainEventEmitter;
|
|
49
|
+
seenDataColumnSidecars: SeenDataColumnSidecars;
|
|
47
50
|
metrics: Metrics | null;
|
|
48
51
|
config: ChainForkConfig;
|
|
49
52
|
|
|
@@ -54,6 +57,7 @@ export class ColumnReconstructionTracker {
|
|
|
54
57
|
constructor(init: ColumnReconstructionTrackerInit) {
|
|
55
58
|
this.logger = init.logger;
|
|
56
59
|
this.emitter = init.emitter;
|
|
60
|
+
this.seenDataColumnSidecars = init.seenDataColumnSidecars;
|
|
57
61
|
this.metrics = init.metrics;
|
|
58
62
|
this.config = init.config;
|
|
59
63
|
this.signal = init.signal;
|
|
@@ -104,7 +108,7 @@ export class ColumnReconstructionTracker {
|
|
|
104
108
|
const logCtx = {slot: input.slot, root: input.blockRootHex};
|
|
105
109
|
this.logger.debug("Attempting data column sidecar reconstruction", logCtx);
|
|
106
110
|
try {
|
|
107
|
-
const result = await recoverDataColumnSidecars(input, this.emitter, this.metrics);
|
|
111
|
+
const result = await recoverDataColumnSidecars(input, this.emitter, this.seenDataColumnSidecars, this.metrics);
|
|
108
112
|
this.metrics?.recoverDataColumnSidecars.reconstructionResult.inc({result});
|
|
109
113
|
this.logger.debug("Data column sidecar reconstruction complete", {...logCtx, result});
|
|
110
114
|
} catch (e) {
|
|
@@ -8,6 +8,7 @@ import {DataColumnEngineResult, getDataColumnSidecarsFromExecution} from "../uti
|
|
|
8
8
|
import {IBlockInput, isBlockInputColumns} from "./blocks/blockInput/index.js";
|
|
9
9
|
import {PayloadEnvelopeInput} from "./blocks/payloadEnvelopeInput/index.js";
|
|
10
10
|
import {ChainEventEmitter} from "./emitter.js";
|
|
11
|
+
import {SeenDataColumnSidecars} from "./seenCache/seenDataColumnSidecars.js";
|
|
11
12
|
|
|
12
13
|
/** A `null` answer only changes if the EL receives the transactions later, so retries are few and spaced out */
|
|
13
14
|
export const MAX_GET_BLOBS_ATTEMPTS = 3;
|
|
@@ -18,6 +19,7 @@ export type GetBlobsTrackerInit = {
|
|
|
18
19
|
logger: Logger;
|
|
19
20
|
executionEngine: Pick<IExecutionEngine, "getBlobs">;
|
|
20
21
|
emitter: ChainEventEmitter;
|
|
22
|
+
seenDataColumnSidecars: SeenDataColumnSidecars;
|
|
21
23
|
metrics: Metrics | null;
|
|
22
24
|
config: ChainForkConfig;
|
|
23
25
|
};
|
|
@@ -29,6 +31,7 @@ export class GetBlobsTracker {
|
|
|
29
31
|
logger: Logger;
|
|
30
32
|
executionEngine: Pick<IExecutionEngine, "getBlobs">;
|
|
31
33
|
emitter: ChainEventEmitter;
|
|
34
|
+
seenDataColumnSidecars: SeenDataColumnSidecars;
|
|
32
35
|
metrics: Metrics | null;
|
|
33
36
|
config: ChainForkConfig;
|
|
34
37
|
activeReconstructions = new Set<string>();
|
|
@@ -42,6 +45,7 @@ export class GetBlobsTracker {
|
|
|
42
45
|
this.logger = init.logger;
|
|
43
46
|
this.executionEngine = init.executionEngine;
|
|
44
47
|
this.emitter = init.emitter;
|
|
48
|
+
this.seenDataColumnSidecars = init.seenDataColumnSidecars;
|
|
45
49
|
this.metrics = init.metrics;
|
|
46
50
|
this.config = init.config;
|
|
47
51
|
}
|
|
@@ -101,6 +105,7 @@ export class GetBlobsTracker {
|
|
|
101
105
|
this.config,
|
|
102
106
|
this.executionEngine,
|
|
103
107
|
this.emitter,
|
|
108
|
+
this.seenDataColumnSidecars,
|
|
104
109
|
input,
|
|
105
110
|
this.metrics,
|
|
106
111
|
this.blobsAndProofsBuffers[freeIndex].buffers
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
} from "@lodestar/types";
|
|
40
40
|
import {isErrorAborted, toRootHex} from "@lodestar/utils";
|
|
41
41
|
import {GENESIS_SLOT, ZERO_HASH_HEX} from "../../constants/index.js";
|
|
42
|
+
import {ExecutionPayloadStatus} from "../../execution/engine/interface.js";
|
|
42
43
|
import {callInNextEventLoop} from "../../util/eventLoop.js";
|
|
43
44
|
import {isOptimisticBlock} from "../../util/forkChoice.js";
|
|
44
45
|
import {isQueueErrorAborted} from "../../util/queue/index.js";
|
|
@@ -146,13 +147,19 @@ export async function importBlock(
|
|
|
146
147
|
dataAvailabilityStatus
|
|
147
148
|
);
|
|
148
149
|
} catch (e) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
e
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
if (e instanceof ForkChoiceError && e.type.code === ForkChoiceErrorCode.INVALID_BLOCK) {
|
|
151
|
+
// The parent can be invalidated by a forkchoiceUpdated verdict after verifyBlocksSanityChecks passed
|
|
152
|
+
if (e.type.err.code === InvalidBlockCode.PARENT_EXECUTION_INVALID) {
|
|
153
|
+
throw new BlockError(block, {code: BlockErrorCode.PARENT_EXECUTION_INVALID, parentRoot: e.type.err.root});
|
|
154
|
+
}
|
|
155
|
+
// A pre-Gloas block delivering a payload fork choice already invalidated
|
|
156
|
+
if (e.type.err.code === InvalidBlockCode.EXECUTION_INVALID) {
|
|
157
|
+
throw new BlockError(block, {
|
|
158
|
+
code: BlockErrorCode.EXECUTION_ENGINE_INVALID,
|
|
159
|
+
execStatus: ExecutionPayloadStatus.INVALID,
|
|
160
|
+
errorMessage: `payload ${e.type.err.hash} was invalidated in fork choice`,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
156
163
|
}
|
|
157
164
|
throw e;
|
|
158
165
|
}
|
|
@@ -368,11 +368,13 @@ export async function importExecutionPayload(
|
|
|
368
368
|
dataAvailabilityStatus
|
|
369
369
|
);
|
|
370
370
|
} catch (e) {
|
|
371
|
-
// The payload chain can be invalidated by a forkchoiceUpdated verdict while the engine was awaited
|
|
371
|
+
// The payload chain can be invalidated by a forkchoiceUpdated verdict while the engine was awaited, and the
|
|
372
|
+
// payload itself may already be invalidated through another block delivering it
|
|
372
373
|
if (
|
|
373
374
|
e instanceof ForkChoiceError &&
|
|
374
375
|
e.type.code === ForkChoiceErrorCode.INVALID_BLOCK &&
|
|
375
|
-
e.type.err.code === InvalidBlockCode.PARENT_EXECUTION_INVALID
|
|
376
|
+
(e.type.err.code === InvalidBlockCode.PARENT_EXECUTION_INVALID ||
|
|
377
|
+
e.type.err.code === InvalidBlockCode.EXECUTION_INVALID)
|
|
376
378
|
) {
|
|
377
379
|
throw new PayloadError(payloadInput, {code: PayloadErrorCode.BLOCK_EXECUTION_INVALID, blockRootHex});
|
|
378
380
|
}
|
|
@@ -22,9 +22,16 @@ export enum PayloadEnvelopeInputSource {
|
|
|
22
22
|
* - finalized: below the finalized slot
|
|
23
23
|
* - prune: explicit prune by root
|
|
24
24
|
* - cap: insertion-order backstop cap (MAX_PAYLOAD_ENVELOPE_INPUT_CACHE_SIZE)
|
|
25
|
+
* - capUnvalidated: cap eviction of an entry whose block is not validated and imported yet, evicted before the rest
|
|
25
26
|
* - invalid: the cached envelope failed import with a definitive invalid verdict
|
|
26
27
|
*/
|
|
27
|
-
export type PayloadEnvelopeInputPruneReason =
|
|
28
|
+
export type PayloadEnvelopeInputPruneReason =
|
|
29
|
+
| "belowParent"
|
|
30
|
+
| "finalized"
|
|
31
|
+
| "remove"
|
|
32
|
+
| "cap"
|
|
33
|
+
| "capUnvalidated"
|
|
34
|
+
| "invalid";
|
|
28
35
|
|
|
29
36
|
export type SourceMeta = {
|
|
30
37
|
source: PayloadEnvelopeInputSource;
|
package/src/chain/chain.ts
CHANGED
|
@@ -127,6 +127,7 @@ import {
|
|
|
127
127
|
SeenAttesters,
|
|
128
128
|
SeenBlockProposers,
|
|
129
129
|
SeenContributionAndProof,
|
|
130
|
+
SeenDataColumnSidecars,
|
|
130
131
|
SeenExecutionPayloadBids,
|
|
131
132
|
SeenPayloadAttesters,
|
|
132
133
|
SeenPayloadEnvelopeInput,
|
|
@@ -224,6 +225,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
224
225
|
readonly seenAggregatedAttestations: SeenAggregatedAttestations;
|
|
225
226
|
readonly seenExecutionPayloadBids = new SeenExecutionPayloadBids();
|
|
226
227
|
readonly seenBlockProposers = new SeenBlockProposers();
|
|
228
|
+
readonly seenDataColumnSidecars = new SeenDataColumnSidecars();
|
|
227
229
|
/** Proposer indexes with an in-flight proposer slashing production */
|
|
228
230
|
private readonly producingProposerSlashing = new Set<ValidatorIndex>();
|
|
229
231
|
readonly seenSyncCommitteeMessages = new SeenSyncCommitteeMessages();
|
|
@@ -501,12 +503,14 @@ export class BeaconChain implements IBeaconChain {
|
|
|
501
503
|
});
|
|
502
504
|
|
|
503
505
|
const anchorBlockSlot = anchorState.latestBlockHeader.slot;
|
|
504
|
-
|
|
506
|
+
const anchorBlockFork = config.getForkName(anchorBlockSlot);
|
|
507
|
+
// A pre-Gloas anchor in a state upgraded to Gloas carried its own payload, no envelope follows it
|
|
508
|
+
if (isStatePostGloas(anchorState) && anchorBlockSlot > 0 && isForkPostGloas(anchorBlockFork)) {
|
|
505
509
|
const anchorBid = anchorState.latestExecutionPayloadBid;
|
|
506
510
|
this.seenPayloadEnvelopeInputCache.addFromBid({
|
|
507
511
|
blockRootHex: toRootHex(checkpoint.root),
|
|
508
512
|
slot: anchorBlockSlot,
|
|
509
|
-
forkName:
|
|
513
|
+
forkName: anchorBlockFork,
|
|
510
514
|
proposerIndex: anchorState.latestBlockHeader.proposerIndex,
|
|
511
515
|
bid: anchorBid,
|
|
512
516
|
sampledColumns: this.custodyConfig.sampledColumns,
|
|
@@ -525,12 +529,14 @@ export class BeaconChain implements IBeaconChain {
|
|
|
525
529
|
logger,
|
|
526
530
|
executionEngine: this.executionEngine,
|
|
527
531
|
emitter,
|
|
532
|
+
seenDataColumnSidecars: this.seenDataColumnSidecars,
|
|
528
533
|
metrics,
|
|
529
534
|
config,
|
|
530
535
|
});
|
|
531
536
|
this.columnReconstructionTracker = new ColumnReconstructionTracker({
|
|
532
537
|
logger,
|
|
533
538
|
emitter,
|
|
539
|
+
seenDataColumnSidecars: this.seenDataColumnSidecars,
|
|
534
540
|
metrics,
|
|
535
541
|
config,
|
|
536
542
|
signal,
|
|
@@ -2037,9 +2043,18 @@ export class BeaconChain implements IBeaconChain {
|
|
|
2037
2043
|
|
|
2038
2044
|
const finalizedSlot = computeStartSlotAtEpoch(cp.epoch);
|
|
2039
2045
|
this.seenBlockProposers.prune(finalizedSlot);
|
|
2046
|
+
this.seenDataColumnSidecars.prune(finalizedSlot);
|
|
2040
2047
|
|
|
2041
2048
|
// Update validator custody to account for effective balance changes
|
|
2042
|
-
|
|
2049
|
+
try {
|
|
2050
|
+
await this.updateValidatorsCustodyRequirement(cp);
|
|
2051
|
+
} catch (e) {
|
|
2052
|
+
this.logger.warn(
|
|
2053
|
+
"Error updating validators custody requirement",
|
|
2054
|
+
{epoch: cp.epoch, root: cp.rootHex},
|
|
2055
|
+
e as Error
|
|
2056
|
+
);
|
|
2057
|
+
}
|
|
2043
2058
|
|
|
2044
2059
|
// TODO: Improve using regen here
|
|
2045
2060
|
const {blockRoot, stateRoot, slot} = this.forkChoice.getHead();
|
|
@@ -2050,7 +2065,19 @@ export class BeaconChain implements IBeaconChain {
|
|
|
2050
2065
|
}
|
|
2051
2066
|
|
|
2052
2067
|
if (headState) {
|
|
2053
|
-
|
|
2068
|
+
// The finalized checkpoint state may be loaded from disk, it is only needed to prune voluntary exits
|
|
2069
|
+
let finalizedState: IBeaconStateView | Uint8Array | null = null;
|
|
2070
|
+
if (this.opPool.voluntaryExitsSize > 0) {
|
|
2071
|
+
finalizedState = await this.regen.getCheckpointStateOrBytes({epoch: cp.epoch, rootHex: cp.rootHex});
|
|
2072
|
+
if (finalizedState === null) {
|
|
2073
|
+
// A newer finalization can prune this checkpoint state while this handler awaits, its handler prunes exits
|
|
2074
|
+
this.logger.debug("Finalized checkpoint state not available, skip pruning voluntary exits", {
|
|
2075
|
+
epoch: cp.epoch,
|
|
2076
|
+
root: cp.rootHex,
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
this.opPool.pruneAll(blockResult.block, headState, finalizedState);
|
|
2054
2081
|
}
|
|
2055
2082
|
|
|
2056
2083
|
if (headState === null) {
|
|
@@ -2133,7 +2160,9 @@ export class BeaconChain implements IBeaconChain {
|
|
|
2133
2160
|
if (stateOrBytes instanceof Uint8Array) {
|
|
2134
2161
|
effectiveBalances = getEffectiveBalancesFromStateBytes(this.config, stateOrBytes, validatorIndices);
|
|
2135
2162
|
} else {
|
|
2136
|
-
effectiveBalances = validatorIndices.map((index) =>
|
|
2163
|
+
effectiveBalances = validatorIndices.map((index) =>
|
|
2164
|
+
index < stateOrBytes.validatorCount ? stateOrBytes.getValidator(index).effectiveBalance : 0
|
|
2165
|
+
);
|
|
2137
2166
|
}
|
|
2138
2167
|
}
|
|
2139
2168
|
|
|
@@ -35,6 +35,7 @@ export enum DataColumnSidecarErrorCode {
|
|
|
35
35
|
|
|
36
36
|
// following errors are adapted from the block errors
|
|
37
37
|
ALREADY_KNOWN = "DATA_COLUMN_SIDECAR_ERROR_ALREADY_KNOWN",
|
|
38
|
+
REPEAT_PROPOSAL = "DATA_COLUMN_SIDECAR_ERROR_REPEAT_PROPOSAL",
|
|
38
39
|
FUTURE_SLOT = "DATA_COLUMN_SIDECAR_ERROR_FUTURE_SLOT",
|
|
39
40
|
WOULD_REVERT_FINALIZED_SLOT = "DATA_COLUMN_SIDECAR_ERROR_WOULD_REVERT_FINALIZED_SLOT",
|
|
40
41
|
PARENT_UNKNOWN = "DATA_COLUMN_SIDECAR_ERROR_PARENT_UNKNOWN",
|
|
@@ -79,6 +80,13 @@ export type DataColumnSidecarErrorType =
|
|
|
79
80
|
limit: number;
|
|
80
81
|
}
|
|
81
82
|
| {code: DataColumnSidecarErrorCode.ALREADY_KNOWN; columnIndex: number; slot: Slot}
|
|
83
|
+
| {
|
|
84
|
+
code: DataColumnSidecarErrorCode.REPEAT_PROPOSAL;
|
|
85
|
+
slot: Slot;
|
|
86
|
+
proposerIndex: number;
|
|
87
|
+
columnIndex: number;
|
|
88
|
+
root: RootHex;
|
|
89
|
+
}
|
|
82
90
|
| {code: DataColumnSidecarErrorCode.FUTURE_SLOT; blockSlot: Slot; currentSlot: Slot}
|
|
83
91
|
| {code: DataColumnSidecarErrorCode.WOULD_REVERT_FINALIZED_SLOT; blockSlot: Slot; finalizedSlot: Slot}
|
|
84
92
|
| {
|