@lodestar/beacon-node 1.49.0-dev.3f33d73d55 → 1.49.0-dev.4631f9fe5a
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 +13 -4
- 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 +4 -2
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +3 -1
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts +1 -2
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +5 -8
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.js +5 -6
- package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts +11 -2
- package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +46 -28
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts +2 -2
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js +1 -0
- package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +13 -0
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/chain.d.ts +10 -0
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +85 -16
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/envelopeReconstructionError.d.ts +23 -0
- package/lib/chain/errors/envelopeReconstructionError.d.ts.map +1 -0
- package/lib/chain/errors/envelopeReconstructionError.js +13 -0
- package/lib/chain/errors/envelopeReconstructionError.js.map +1 -0
- package/lib/chain/errors/index.d.ts +1 -0
- package/lib/chain/errors/index.d.ts.map +1 -1
- package/lib/chain/errors/index.js +1 -0
- package/lib/chain/errors/index.js.map +1 -1
- package/lib/chain/errors/payloadAttestation.d.ts +4 -0
- package/lib/chain/errors/payloadAttestation.d.ts.map +1 -1
- package/lib/chain/errors/payloadAttestation.js +1 -0
- package/lib/chain/errors/payloadAttestation.js.map +1 -1
- package/lib/chain/interface.d.ts +6 -1
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/options.d.ts +2 -4
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +4 -2
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +8 -1
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/db/beacon.d.ts +1 -2
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +1 -3
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/buckets.d.ts +0 -1
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +1 -1
- package/lib/db/buckets.js.map +1 -1
- package/lib/db/interface.d.ts +1 -2
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
- package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
- package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts +21 -9
- package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts.map +1 -1
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js +32 -12
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -1
- package/lib/db/repositories/index.d.ts +1 -2
- package/lib/db/repositories/index.d.ts.map +1 -1
- package/lib/db/repositories/index.js +1 -2
- package/lib/db/repositories/index.js.map +1 -1
- package/lib/execution/engine/disabled.d.ts +1 -0
- package/lib/execution/engine/disabled.d.ts.map +1 -1
- package/lib/execution/engine/disabled.js +3 -0
- package/lib/execution/engine/disabled.js.map +1 -1
- package/lib/execution/engine/http.d.ts +2 -1
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +7 -1
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +3 -1
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/mock.d.ts +1 -0
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +14 -2
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/types.d.ts +11 -0
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +10 -0
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +9 -0
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +16 -0
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +21 -11
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +48 -23
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/metrics/metrics.d.ts +3 -1
- package/lib/metrics/metrics.d.ts.map +1 -1
- package/lib/metrics/metrics.js +2 -2
- package/lib/metrics/metrics.js.map +1 -1
- package/lib/network/processor/index.d.ts +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +42 -21
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +47 -34
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +23 -4
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/index.js +20 -4
- package/lib/network/reqresp/handlers/index.js.map +1 -1
- package/lib/node/nodejs.d.ts +2 -7
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +2 -22
- package/lib/node/nodejs.js.map +1 -1
- package/lib/sync/interface.d.ts +1 -2
- package/lib/sync/interface.d.ts.map +1 -1
- package/lib/sync/options.d.ts +0 -6
- package/lib/sync/options.d.ts.map +1 -1
- package/lib/sync/options.js +0 -2
- package/lib/sync/options.js.map +1 -1
- package/lib/sync/types.d.ts +18 -3
- package/lib/sync/types.d.ts.map +1 -1
- package/lib/sync/types.js +19 -3
- package/lib/sync/types.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +19 -0
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +184 -15
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/execution.d.ts +42 -0
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js +123 -2
- package/lib/util/execution.js.map +1 -1
- package/lib/util/headerEnvelope.d.ts +17 -0
- package/lib/util/headerEnvelope.d.ts.map +1 -0
- package/lib/util/headerEnvelope.js +43 -0
- package/lib/util/headerEnvelope.js.map +1 -0
- package/lib/util/shuffle.d.ts +0 -4
- package/lib/util/shuffle.d.ts.map +1 -1
- package/lib/util/shuffle.js +0 -8
- package/lib/util/shuffle.js.map +1 -1
- package/package.json +16 -16
- package/src/api/impl/beacon/blocks/index.ts +16 -3
- package/src/api/impl/beacon/pool/index.ts +6 -2
- package/src/api/impl/validator/index.ts +3 -1
- package/src/chain/archiveStore/archiveStore.ts +6 -9
- package/src/chain/archiveStore/historicalState/metrics.ts +5 -7
- package/src/chain/archiveStore/utils/archiveBlocks.ts +54 -32
- package/src/chain/archiveStore/utils/pruneHistory.ts +4 -2
- package/src/chain/blocks/importExecutionPayload.ts +14 -0
- package/src/chain/chain.ts +96 -20
- package/src/chain/errors/envelopeReconstructionError.ts +22 -0
- package/src/chain/errors/index.ts +1 -0
- package/src/chain/errors/payloadAttestation.ts +2 -0
- package/src/chain/interface.ts +6 -1
- package/src/chain/options.ts +3 -5
- package/src/chain/produceBlock/computeNewStateRoot.ts +9 -2
- package/src/chain/validation/payloadAttestationMessage.ts +9 -0
- package/src/db/beacon.ts +0 -5
- package/src/db/buckets.ts +2 -2
- package/src/db/interface.ts +0 -3
- package/src/db/repositories/executionPayloadEnvelopeArchive.ts +43 -13
- package/src/db/repositories/index.ts +6 -2
- package/src/execution/engine/disabled.ts +4 -0
- package/src/execution/engine/http.ts +12 -0
- package/src/execution/engine/interface.ts +4 -1
- package/src/execution/engine/mock.ts +22 -2
- package/src/execution/engine/types.ts +25 -0
- package/src/metrics/metrics/beacon.ts +16 -0
- package/src/metrics/metrics/lodestar.ts +58 -26
- package/src/metrics/metrics.ts +7 -2
- package/src/network/processor/index.ts +51 -22
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +57 -39
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +27 -5
- package/src/network/reqresp/handlers/index.ts +49 -5
- package/src/node/nodejs.ts +0 -27
- package/src/sync/interface.ts +1 -2
- package/src/sync/options.ts +0 -8
- package/src/sync/types.ts +19 -3
- package/src/sync/unknownBlock.ts +192 -14
- package/src/util/execution.ts +175 -2
- package/src/util/headerEnvelope.ts +76 -0
- package/src/util/shuffle.ts +0 -9
- package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts +0 -20
- package/lib/chain/archiveStore/utils/updateBackfillRange.d.ts.map +0 -1
- package/lib/chain/archiveStore/utils/updateBackfillRange.js +0 -40
- package/lib/chain/archiveStore/utils/updateBackfillRange.js.map +0 -1
- package/lib/db/repositories/backfilledRanges.d.ts +0 -18
- package/lib/db/repositories/backfilledRanges.d.ts.map +0 -1
- package/lib/db/repositories/backfilledRanges.js +0 -26
- package/lib/db/repositories/backfilledRanges.js.map +0 -1
- package/lib/sync/backfill/backfill.d.ts +0 -169
- package/lib/sync/backfill/backfill.d.ts.map +0 -1
- package/lib/sync/backfill/backfill.js +0 -686
- package/lib/sync/backfill/backfill.js.map +0 -1
- package/lib/sync/backfill/errors.d.ts +0 -30
- package/lib/sync/backfill/errors.d.ts.map +0 -1
- package/lib/sync/backfill/errors.js +0 -15
- package/lib/sync/backfill/errors.js.map +0 -1
- package/lib/sync/backfill/index.d.ts +0 -2
- package/lib/sync/backfill/index.d.ts.map +0 -1
- package/lib/sync/backfill/index.js +0 -2
- package/lib/sync/backfill/index.js.map +0 -1
- package/lib/sync/backfill/verify.d.ts +0 -18
- package/lib/sync/backfill/verify.d.ts.map +0 -1
- package/lib/sync/backfill/verify.js +0 -36
- package/lib/sync/backfill/verify.js.map +0 -1
- package/src/chain/archiveStore/utils/updateBackfillRange.ts +0 -50
- package/src/db/repositories/backfilledRanges.ts +0 -29
- package/src/sync/backfill/backfill.ts +0 -916
- package/src/sync/backfill/errors.ts +0 -23
- package/src/sync/backfill/index.ts +0 -1
- package/src/sync/backfill/verify.ts +0 -58
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headerEnvelope.js","sourceRoot":"","sources":["../../src/util/headerEnvelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAUpC,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,gDAAgD,CAAC;AAWxD,MAAM,EAAC,YAAY,EAAE,WAAW,EAAE,eAAe,EAAC,GAAG,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC;AAEvF,gGAAgG;AAChG,MAAM,UAAU,gBAAgB,CAAC,QAAkC;IACjE,MAAM,EAAC,OAAO,EAAE,GAAG,cAAc,EAAC,GAAG,QAAQ,CAAC;IAC9C,MAAM,EAAC,YAAY,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,GAAG,OAAO,EAAC,GAAG,OAAO,CAAC;IACxF,OAAO;QACL,GAAG,cAAc;QACjB,aAAa,EAAE;YACb,GAAG,OAAO;YACV,gBAAgB,EAAE,YAAY,CAAC,YAAY,CAAC,GAAG,CAAC;YAChD,eAAe,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC;YAC9C,mBAAmB,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG,CAAC;SACvD;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAAwC;IAC7E,OAAO,EAAC,OAAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAC,CAAC;AACtF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,cAAoD,EACpD,MAA8B;IAE9B,MAAM,EAAC,aAAa,EAAE,GAAG,cAAc,EAAC,GAAG,cAAc,CAAC,OAAO,CAAC;IAClE,MAAM,EAAC,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,GAAG,OAAO,EAAC,GAAG,aAAa,CAAC;IAC3F,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC;IAEhC,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,gBAAgB,EAAE,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IACvG,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;IACnG,cAAc,CAAC,iBAAiB,EAAE,IAAI,EAAE,mBAAmB,EAAE,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;IAEnH,OAAO;QACL,OAAO,EAAE,EAAC,GAAG,cAAc,EAAE,OAAO,EAAE,EAAC,GAAG,OAAO,EAAE,GAAG,MAAM,EAAC,EAAC;QAC9D,SAAS,EAAE,cAAc,CAAC,SAAS;KACpC,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAgC,EAAE,IAAY,EAAE,MAAkB,EAAE,OAAmB;IAC7G,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,2BAA2B,CACnC,EAAC,IAAI,EAAE,+BAA+B,CAAC,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAC,EACvE,iBAAiB,KAAK,uBAAuB,IAAI,WAAW,SAAS,CAAC,MAAM,CAAC,YAAY,SAAS,CAAC,OAAO,CAAC,EAAE,CAC9G,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/lib/util/shuffle.d.ts
CHANGED
|
@@ -3,8 +3,4 @@
|
|
|
3
3
|
* Note: Uses Math.random() as entropy source, use for non-critical stuff
|
|
4
4
|
*/
|
|
5
5
|
export declare function shuffle<T>(arr: T[]): T[];
|
|
6
|
-
/**
|
|
7
|
-
* Return one random item from array
|
|
8
|
-
*/
|
|
9
|
-
export declare function shuffleOne<T>(arr: T[]): T | undefined;
|
|
10
6
|
//# sourceMappingURL=shuffle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shuffle.d.ts","sourceRoot":"","sources":["../../src/util/shuffle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAOxC
|
|
1
|
+
{"version":3,"file":"shuffle.d.ts","sourceRoot":"","sources":["../../src/util/shuffle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAOxC"}
|
package/lib/util/shuffle.js
CHANGED
|
@@ -10,12 +10,4 @@ export function shuffle(arr) {
|
|
|
10
10
|
}
|
|
11
11
|
return _arr;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Return one random item from array
|
|
15
|
-
*/
|
|
16
|
-
export function shuffleOne(arr) {
|
|
17
|
-
if (arr.length === 0)
|
|
18
|
-
return undefined;
|
|
19
|
-
return arr[Math.floor(Math.random() * arr.length)];
|
|
20
|
-
}
|
|
21
13
|
//# sourceMappingURL=shuffle.js.map
|
package/lib/util/shuffle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shuffle.js","sourceRoot":"","sources":["../../src/util/shuffle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAI,GAAQ;IACjC,MAAM,IAAI,GAAQ,CAAC,GAAG,GAAG,CAAC,CAAC;IAC3B,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC
|
|
1
|
+
{"version":3,"file":"shuffle.js","sourceRoot":"","sources":["../../src/util/shuffle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAI,GAAQ;IACjC,MAAM,IAAI,GAAQ,CAAC,GAAG,GAAG,CAAC,CAAC;IAC3B,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,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.49.0-dev.
|
|
14
|
+
"version": "1.49.0-dev.4631f9fe5a",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"@fastify/swagger-ui": "^5.0.1",
|
|
119
119
|
"@libp2p/bootstrap": "^12.0.30",
|
|
120
120
|
"@libp2p/crypto": "^5.1.23",
|
|
121
|
-
"@libp2p/gossipsub": "^17.1.
|
|
121
|
+
"@libp2p/gossipsub": "^17.1.2",
|
|
122
122
|
"@libp2p/identify": "^4.1.13",
|
|
123
123
|
"@libp2p/interface": "^3.3.0",
|
|
124
124
|
"@libp2p/mdns": "^12.0.30",
|
|
@@ -127,17 +127,17 @@
|
|
|
127
127
|
"@libp2p/prometheus-metrics": "^5.0.28",
|
|
128
128
|
"@libp2p/tcp": "^11.0.27",
|
|
129
129
|
"@libp2p/utils": "^7.4.0",
|
|
130
|
-
"@lodestar/api": "^1.49.0-dev.
|
|
131
|
-
"@lodestar/config": "^1.49.0-dev.
|
|
132
|
-
"@lodestar/db": "^1.49.0-dev.
|
|
133
|
-
"@lodestar/fork-choice": "^1.49.0-dev.
|
|
134
|
-
"@lodestar/logger": "^1.49.0-dev.
|
|
135
|
-
"@lodestar/params": "^1.49.0-dev.
|
|
136
|
-
"@lodestar/reqresp": "^1.49.0-dev.
|
|
137
|
-
"@lodestar/state-transition": "^1.49.0-dev.
|
|
138
|
-
"@lodestar/types": "^1.49.0-dev.
|
|
139
|
-
"@lodestar/utils": "^1.49.0-dev.
|
|
140
|
-
"@lodestar/validator": "^1.49.0-dev.
|
|
130
|
+
"@lodestar/api": "^1.49.0-dev.4631f9fe5a",
|
|
131
|
+
"@lodestar/config": "^1.49.0-dev.4631f9fe5a",
|
|
132
|
+
"@lodestar/db": "^1.49.0-dev.4631f9fe5a",
|
|
133
|
+
"@lodestar/fork-choice": "^1.49.0-dev.4631f9fe5a",
|
|
134
|
+
"@lodestar/logger": "^1.49.0-dev.4631f9fe5a",
|
|
135
|
+
"@lodestar/params": "^1.49.0-dev.4631f9fe5a",
|
|
136
|
+
"@lodestar/reqresp": "^1.49.0-dev.4631f9fe5a",
|
|
137
|
+
"@lodestar/state-transition": "^1.49.0-dev.4631f9fe5a",
|
|
138
|
+
"@lodestar/types": "^1.49.0-dev.4631f9fe5a",
|
|
139
|
+
"@lodestar/utils": "^1.49.0-dev.4631f9fe5a",
|
|
140
|
+
"@lodestar/validator": "^1.49.0-dev.4631f9fe5a",
|
|
141
141
|
"@multiformats/multiaddr": "^13.0.1",
|
|
142
142
|
"datastore-core": "^12.0.1",
|
|
143
143
|
"datastore-level": "^13.0.1",
|
|
@@ -156,10 +156,10 @@
|
|
|
156
156
|
"xxhash-wasm": "1.0.2"
|
|
157
157
|
},
|
|
158
158
|
"devDependencies": {
|
|
159
|
-
"@chainsafe/swap-or-not-shuffle": "^1.2.1",
|
|
160
159
|
"@libp2p/interface-internal": "^3.1.12",
|
|
161
160
|
"@libp2p/logger": "^6.2.13",
|
|
162
|
-
"@lodestar/spec-test-util": "^1.49.0-dev.
|
|
161
|
+
"@lodestar/spec-test-util": "^1.49.0-dev.4631f9fe5a",
|
|
162
|
+
"@lodestar/test-utils": "^1.49.0-dev.4631f9fe5a",
|
|
163
163
|
"@types/js-yaml": "^4.0.5",
|
|
164
164
|
"@types/qs": "^6.9.7",
|
|
165
165
|
"@types/tmp": "^0.2.3",
|
|
@@ -174,5 +174,5 @@
|
|
|
174
174
|
"beacon",
|
|
175
175
|
"blockchain"
|
|
176
176
|
],
|
|
177
|
-
"gitHead": "
|
|
177
|
+
"gitHead": "fcd6576bc6eaeebf302046ab7600f70cce4a4a99"
|
|
178
178
|
}
|
|
@@ -47,6 +47,8 @@ import {
|
|
|
47
47
|
BlockError,
|
|
48
48
|
BlockErrorCode,
|
|
49
49
|
BlockGossipError,
|
|
50
|
+
EnvelopeReconstructionError,
|
|
51
|
+
EnvelopeReconstructionErrorCode,
|
|
50
52
|
ExecutionPayloadEnvelopeError,
|
|
51
53
|
ExecutionPayloadEnvelopeErrorCode,
|
|
52
54
|
} from "../../../../chain/errors/index.js";
|
|
@@ -1109,9 +1111,20 @@ export function getBeaconBlockApi({
|
|
|
1109
1111
|
const blockRoot = config.getForkTypes(slot).BeaconBlock.hashTreeRoot(block.message);
|
|
1110
1112
|
const blockRootHex = toRootHex(blockRoot);
|
|
1111
1113
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1114
|
+
let data: Uint8Array | gloas.SignedExecutionPayloadEnvelope | null;
|
|
1115
|
+
try {
|
|
1116
|
+
data = context?.returnBytes
|
|
1117
|
+
? await chain.getSerializedExecutionPayloadEnvelope(slot, blockRootHex)
|
|
1118
|
+
: await chain.getExecutionPayloadEnvelope(slot, blockRootHex);
|
|
1119
|
+
} catch (e) {
|
|
1120
|
+
if (e instanceof EnvelopeReconstructionError) {
|
|
1121
|
+
throw new ApiError(
|
|
1122
|
+
e.type.code === EnvelopeReconstructionErrorCode.ENGINE_UNAVAILABLE ? 503 : 500,
|
|
1123
|
+
`Failed to reconstruct execution payload envelope: ${e.message}`
|
|
1124
|
+
);
|
|
1125
|
+
}
|
|
1126
|
+
throw e;
|
|
1127
|
+
}
|
|
1115
1128
|
|
|
1116
1129
|
if (!data) {
|
|
1117
1130
|
throw new ApiError(404, `Execution payload envelope not found for slot=${slot}, blockRoot=${blockRootHex}`);
|
|
@@ -39,7 +39,7 @@ export function getBeaconPoolApi({
|
|
|
39
39
|
return {
|
|
40
40
|
async getPoolAttestationsV2({slot, committeeIndex}) {
|
|
41
41
|
// Already filtered by slot
|
|
42
|
-
let attestations = chain.aggregatedAttestationPool.getAll(slot);
|
|
42
|
+
let attestations = [...chain.aggregatedAttestationPool.getAll(slot), ...chain.attestationPool.getAll(slot)];
|
|
43
43
|
const fork = chain.config.getForkName(slot ?? attestations[0]?.data.slot ?? chain.clock.currentSlot);
|
|
44
44
|
const isPostElectra = isForkPostElectra(fork);
|
|
45
45
|
|
|
@@ -48,7 +48,11 @@ export function getBeaconPoolApi({
|
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
if (committeeIndex !== undefined) {
|
|
51
|
-
attestations = attestations.filter((attestation) =>
|
|
51
|
+
attestations = attestations.filter((attestation) =>
|
|
52
|
+
isElectraAttestation(attestation)
|
|
53
|
+
? attestation.committeeBits.get(committeeIndex)
|
|
54
|
+
: committeeIndex === attestation.data.index
|
|
55
|
+
);
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
return {data: attestations, meta: {version: fork}};
|
|
@@ -1057,6 +1057,8 @@ export function getValidatorApi(
|
|
|
1057
1057
|
rank: index + 1,
|
|
1058
1058
|
source: candidate.url !== undefined ? toPrintableUrl(candidate.url) : "p2p",
|
|
1059
1059
|
builder: candidate.signedBid.message.builderIndex,
|
|
1060
|
+
value: prettyGweiToEth(candidate.signedBid.message.value),
|
|
1061
|
+
executionPayment: prettyGweiToEth(candidate.signedBid.message.executionPayment),
|
|
1060
1062
|
total: prettyGweiToEth(candidate.totalGwei),
|
|
1061
1063
|
boost: candidate.boostFactor,
|
|
1062
1064
|
boosted: prettyGweiToEth(getBoostedTotalScaled(candidate) / 100n),
|
|
@@ -2104,7 +2106,7 @@ export function getValidatorApi(
|
|
|
2104
2106
|
auth: entry.auth,
|
|
2105
2107
|
});
|
|
2106
2108
|
} catch (e) {
|
|
2107
|
-
failures.push({index: i, message: (e as Error).message});
|
|
2109
|
+
failures.push({index: i, message: `${builder}: ${(e as Error).message}`});
|
|
2108
2110
|
logger.verbose(
|
|
2109
2111
|
`Error on submitBuilderPreferences [${i}]`,
|
|
2110
2112
|
{slot: entry.auth.message.slot, builder},
|
|
@@ -16,7 +16,6 @@ import {ArchiveMode, ArchiveStoreOpts, StateArchiveStrategy} from "./interface.j
|
|
|
16
16
|
import {FrequencyStateArchiveStrategy} from "./strategies/frequencyStateArchiveStrategy.js";
|
|
17
17
|
import {archiveBlocks} from "./utils/archiveBlocks.js";
|
|
18
18
|
import {pruneHistory} from "./utils/pruneHistory.js";
|
|
19
|
-
import {updateBackfillRange} from "./utils/updateBackfillRange.js";
|
|
20
19
|
|
|
21
20
|
type ArchiveStoreModules = {
|
|
22
21
|
chain: IBeaconChain;
|
|
@@ -37,7 +36,6 @@ export enum ArchiveStoreTask {
|
|
|
37
36
|
OnFinalizedCheckpoint = "on_finalized_checkpoint",
|
|
38
37
|
MaybeArchiveState = "maybe_archive_state",
|
|
39
38
|
ForkchoicePrune = "forkchoice_prune",
|
|
40
|
-
UpdateBackfillRange = "update_backfill_range",
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
/**
|
|
@@ -105,7 +103,7 @@ export class ArchiveStore {
|
|
|
105
103
|
if (this.opts.pruneHistory) {
|
|
106
104
|
// prune ALL stale data before starting
|
|
107
105
|
this.logger.info("Pruning historical data");
|
|
108
|
-
await callFnWhenAwait(
|
|
106
|
+
const blockCutoffSlot = await callFnWhenAwait(
|
|
109
107
|
pruneHistory(
|
|
110
108
|
this.chain.config,
|
|
111
109
|
this.db,
|
|
@@ -118,6 +116,7 @@ export class ArchiveStore {
|
|
|
118
116
|
30_000,
|
|
119
117
|
this.signal
|
|
120
118
|
);
|
|
119
|
+
this.chain.earliestAvailableSlot = Math.max(this.chain.earliestAvailableSlot, blockCutoffSlot);
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
if (this.opts.serveHistoricalState) {
|
|
@@ -230,13 +229,14 @@ export class ArchiveStore {
|
|
|
230
229
|
isNodeSynced,
|
|
231
230
|
this.archiveDataEpochs,
|
|
232
231
|
this.chain.opts.persistOrphanedBlocks,
|
|
233
|
-
this.chain.opts.persistOrphanedBlocksDir
|
|
232
|
+
this.chain.opts.persistOrphanedBlocksDir,
|
|
233
|
+
this.chain.opts.dedupePayloads
|
|
234
234
|
);
|
|
235
235
|
timer?.({source: ArchiveStoreTask.ArchiveBlocks});
|
|
236
236
|
|
|
237
237
|
if (this.opts.pruneHistory) {
|
|
238
238
|
timer = this.metrics?.processFinalizedCheckpoint.durationByTask.startTimer();
|
|
239
|
-
await pruneHistory(
|
|
239
|
+
const blockCutoffSlot = await pruneHistory(
|
|
240
240
|
this.chain.config,
|
|
241
241
|
this.db,
|
|
242
242
|
this.logger,
|
|
@@ -244,6 +244,7 @@ export class ArchiveStore {
|
|
|
244
244
|
finalizedEpoch,
|
|
245
245
|
this.chain.clock.currentEpoch
|
|
246
246
|
);
|
|
247
|
+
this.chain.earliestAvailableSlot = Math.max(this.chain.earliestAvailableSlot, blockCutoffSlot);
|
|
247
248
|
timer?.({source: ArchiveStoreTask.PruneHistory});
|
|
248
249
|
}
|
|
249
250
|
|
|
@@ -261,10 +262,6 @@ export class ArchiveStore {
|
|
|
261
262
|
const prunedBlocks = this.chain.forkChoice.prune(finalized.rootHex);
|
|
262
263
|
timer?.({source: ArchiveStoreTask.ForkchoicePrune});
|
|
263
264
|
|
|
264
|
-
timer = this.metrics?.processFinalizedCheckpoint.durationByTask.startTimer();
|
|
265
|
-
await updateBackfillRange({chain: this.chain, db: this.db, logger: this.logger}, finalized);
|
|
266
|
-
timer?.({source: ArchiveStoreTask.UpdateBackfillRange});
|
|
267
|
-
|
|
268
265
|
this.logger.verbose("Finish processing finalized checkpoint", {
|
|
269
266
|
epoch: finalizedEpoch,
|
|
270
267
|
rootHex: finalized.rootHex,
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
ProcessOperationsStep,
|
|
7
7
|
ProposerRewardType,
|
|
8
8
|
StateCloneSource,
|
|
9
|
-
StateHashTreeRootSource,
|
|
10
9
|
} from "@lodestar/state-transition";
|
|
11
10
|
import {Gauge, Histogram} from "@lodestar/utils";
|
|
12
11
|
import {RegistryMetricCreator} from "../../../metrics/index.js";
|
|
@@ -92,12 +91,6 @@ export function createHistoricalStateTransitionMetrics(
|
|
|
92
91
|
help: "Time to call commit after process a single block in seconds",
|
|
93
92
|
buckets: [0.005, 0.01, 0.02, 0.05, 0.1, 1],
|
|
94
93
|
}),
|
|
95
|
-
stateHashTreeRootTime: metricsRegister.histogram<{source: StateHashTreeRootSource}>({
|
|
96
|
-
name: "lodestar_historical_state_stfn_hash_tree_root_seconds",
|
|
97
|
-
help: "Time to compute the hash tree root of a post state in seconds",
|
|
98
|
-
buckets: [0.05, 0.1, 0.2, 0.5, 1, 1.5],
|
|
99
|
-
labelNames: ["source"],
|
|
100
|
-
}),
|
|
101
94
|
numEffectiveBalanceUpdates: metricsRegister.gauge({
|
|
102
95
|
name: "lodestar_historical_state_stfn_num_effective_balance_updates_count",
|
|
103
96
|
help: "Count of effective balance updates in epoch transition",
|
|
@@ -163,6 +156,11 @@ export function createHistoricalStateTransitionMetrics(
|
|
|
163
156
|
name: "lodestar_historical_state_stfn_attestations_per_block_total",
|
|
164
157
|
help: "Count of attestations per block",
|
|
165
158
|
}),
|
|
159
|
+
progressiveBalancesMismatches: metricsRegister.counter<{target: "current" | "previous"}>({
|
|
160
|
+
name: "lodestar_historical_state_stfn_progressive_balances_mismatches_total",
|
|
161
|
+
help: "Total count of progressive balance cache mismatches by target balance",
|
|
162
|
+
labelNames: ["target"],
|
|
163
|
+
}),
|
|
166
164
|
proposerRewards: metricsRegister.gauge<{type: ProposerRewardType}>({
|
|
167
165
|
name: "lodestar_historical_state_stfn_proposer_rewards_total",
|
|
168
166
|
help: "Proposer reward by type per block",
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
3
|
import {KeyValue} from "@lodestar/db";
|
|
4
|
-
import {CheckpointWithHex, IForkChoice, PayloadStatus, ProtoBlock} from "@lodestar/fork-choice";
|
|
4
|
+
import {CheckpointWithHex, ExecutionStatus, IForkChoice, PayloadStatus, ProtoBlock} from "@lodestar/fork-choice";
|
|
5
5
|
import {ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
6
6
|
import {computeEpochAtSlot, computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
|
7
7
|
import {Epoch, Slot} from "@lodestar/types";
|
|
8
8
|
import {Logger, fromAsync, fromHex, prettyPrintIndices, toRootHex} from "@lodestar/utils";
|
|
9
9
|
import {IBeaconDb} from "../../../db/index.js";
|
|
10
|
-
import {BlockArchiveBatchPutBinaryItem} from "../../../db/repositories/index.js";
|
|
10
|
+
import {BlockArchiveBatchPutBinaryItem, encodeArchivedHeaderEnvelope} from "../../../db/repositories/index.js";
|
|
11
11
|
import {Metrics} from "../../../metrics/metrics.js";
|
|
12
12
|
import {ensureDir, writeIfNotExist} from "../../../util/file.js";
|
|
13
|
+
import {toSignedHeaderEnvelope} from "../../../util/headerEnvelope.js";
|
|
13
14
|
import {BlockRootHex} from "../../../util/sszBytes.js";
|
|
14
15
|
import {LightClientServer} from "../../lightClient/index.js";
|
|
15
16
|
|
|
@@ -69,7 +70,8 @@ export async function archiveBlocks(
|
|
|
69
70
|
isNodeSynced: boolean,
|
|
70
71
|
archiveDataEpochs?: number,
|
|
71
72
|
persistOrphanedBlocks?: boolean,
|
|
72
|
-
persistOrphanedBlocksDir?: string
|
|
73
|
+
persistOrphanedBlocksDir?: string,
|
|
74
|
+
dedupePayloads = true
|
|
73
75
|
): Promise<void> {
|
|
74
76
|
// Use fork choice to determine the blocks to archive and delete.
|
|
75
77
|
// `ancestors` is the canonical walk back from the finalized root, including the previous finalized
|
|
@@ -156,7 +158,8 @@ export async function archiveBlocks(
|
|
|
156
158
|
config,
|
|
157
159
|
db,
|
|
158
160
|
logger,
|
|
159
|
-
finalizedCanonicalBlocks
|
|
161
|
+
finalizedCanonicalBlocks,
|
|
162
|
+
dedupePayloads
|
|
160
163
|
);
|
|
161
164
|
logger.verbose("Migrated executionPayloadEnvelopes from hot DB to cold DB", {
|
|
162
165
|
...logCtx,
|
|
@@ -475,49 +478,68 @@ async function migrateDataColumnSidecarsFromHotToColdDb(
|
|
|
475
478
|
/**
|
|
476
479
|
* Post-gloas given a finalized checkpoint at a block root, payload of that block root
|
|
477
480
|
* is not considered finalized, hence they are archived in the next run.
|
|
481
|
+
*
|
|
482
|
+
* With `dedupePayloads` (default), execution-valid envelopes are archived as header envelopes. Envelopes of
|
|
483
|
+
* still-optimistic blocks are archived in full, since the EL may not serve their bodies, and are not
|
|
484
|
+
* converted later. Archive put + hot delete are one atomic db batch.
|
|
478
485
|
*/
|
|
479
|
-
async function migrateExecutionPayloadEnvelopesFromHotToColdDb(
|
|
486
|
+
export async function migrateExecutionPayloadEnvelopesFromHotToColdDb(
|
|
480
487
|
config: ChainForkConfig,
|
|
481
488
|
db: IBeaconDb,
|
|
482
489
|
logger: Logger,
|
|
483
|
-
canonicalBlocks: ProtoBlock[]
|
|
490
|
+
canonicalBlocks: ProtoBlock[],
|
|
491
|
+
dedupePayloads: boolean
|
|
484
492
|
): Promise<Slot[]> {
|
|
485
493
|
const payloadBlocks = canonicalBlocks.filter(
|
|
486
|
-
(block) => config.getForkSeq(block.slot)
|
|
494
|
+
(block) => config.getForkSeq(block.slot) >= ForkSeq.gloas && block.payloadStatus === PayloadStatus.FULL
|
|
487
495
|
);
|
|
488
496
|
if (payloadBlocks.length === 0) return [];
|
|
489
|
-
const blocks = payloadBlocks.map((block) => ({slot: block.slot, root: fromHex(block.blockRoot)}));
|
|
490
497
|
|
|
491
|
-
const
|
|
492
|
-
const migratedRoots: Uint8Array[] = [];
|
|
498
|
+
const migratedSlots: Slot[] = [];
|
|
493
499
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
)
|
|
500
|
+
// Process in chunks to bound memory: after a long non-finality period the ancestor walk can span
|
|
501
|
+
// thousands of blocks, and each full envelope is a few hundred KB when deserialized.
|
|
502
|
+
for (let i = 0; i < payloadBlocks.length; i += BLOCK_BATCH_SIZE) {
|
|
503
|
+
const batch = payloadBlocks.slice(i, i + BLOCK_BATCH_SIZE);
|
|
504
|
+
// Only header envelopes need deserializing; full ones are copied as bytes
|
|
505
|
+
const archivedBytesArray = await Promise.all(
|
|
506
|
+
batch.map(async (block) => {
|
|
507
|
+
const root = fromHex(block.blockRoot);
|
|
508
|
+
if (dedupePayloads && block.executionStatus === ExecutionStatus.Valid) {
|
|
509
|
+
const envelope = await db.executionPayloadEnvelope.get(root);
|
|
510
|
+
return envelope === null ? null : encodeArchivedHeaderEnvelope(toSignedHeaderEnvelope(envelope));
|
|
511
|
+
}
|
|
512
|
+
return db.executionPayloadEnvelope.getBinary(root);
|
|
513
|
+
})
|
|
514
|
+
);
|
|
515
|
+
|
|
516
|
+
const entries: {slot: Slot; archivedBytes: Uint8Array; hotKey: Uint8Array}[] = [];
|
|
517
|
+
for (let j = 0; j < batch.length; j++) {
|
|
518
|
+
const block = batch[j];
|
|
519
|
+
const archivedBytes = archivedBytesArray[j];
|
|
520
|
+
if (archivedBytes === null) {
|
|
521
|
+
logger.debug("ExecutionPayloadEnvelope in forkchoice but missing in hot db, could be already archived", {
|
|
522
|
+
slot: block.slot,
|
|
523
|
+
root: block.blockRoot,
|
|
524
|
+
});
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
497
527
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
migratedRoots.push(blocks[i].root);
|
|
503
|
-
} else {
|
|
504
|
-
logger.debug("ExecutionPayloadEnvelope in forkchoice but missing in hot db, could be already archived", {
|
|
505
|
-
slot: blocks[i].slot,
|
|
506
|
-
root: toRootHex(blocks[i].root),
|
|
528
|
+
entries.push({
|
|
529
|
+
slot: block.slot,
|
|
530
|
+
archivedBytes,
|
|
531
|
+
hotKey: db.executionPayloadEnvelope.encodeKey(fromHex(block.blockRoot)),
|
|
507
532
|
});
|
|
533
|
+
migratedSlots.push(block.slot);
|
|
508
534
|
}
|
|
509
|
-
}
|
|
510
535
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
db.executionPayloadEnvelope.batchDelete(migratedRoots),
|
|
516
|
-
]);
|
|
536
|
+
if (entries.length > 0) {
|
|
537
|
+
await db.executionPayloadEnvelopeArchive.batchArchiveAndDeleteHot(entries);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
517
540
|
|
|
518
|
-
//
|
|
519
|
-
|
|
520
|
-
return envelopeEntries.map((entry) => entry.key).sort((a, b) => a - b);
|
|
541
|
+
// Ancestor walk is newest to oldest; sort ascending so `prettyPrintIndices` renders cleanly.
|
|
542
|
+
return migratedSlots.sort((a, b) => a - b);
|
|
521
543
|
}
|
|
522
544
|
|
|
523
545
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {ChainConfig} from "@lodestar/config";
|
|
2
2
|
import {computeStartSlotAtEpoch} from "@lodestar/state-transition";
|
|
3
|
-
import {Epoch} from "@lodestar/types";
|
|
3
|
+
import {Epoch, Slot} from "@lodestar/types";
|
|
4
4
|
import {Logger, prettyPrintIndices} from "@lodestar/utils";
|
|
5
5
|
import {IBeaconDb} from "../../../db/interface.js";
|
|
6
6
|
import {Metrics} from "../../../metrics/index.js";
|
|
@@ -12,7 +12,7 @@ export async function pruneHistory(
|
|
|
12
12
|
metrics: Metrics | null | undefined,
|
|
13
13
|
finalizedEpoch: Epoch,
|
|
14
14
|
currentEpoch: Epoch
|
|
15
|
-
): Promise<
|
|
15
|
+
): Promise<Slot> {
|
|
16
16
|
const blockCutoffEpoch = Math.min(
|
|
17
17
|
// set by config, with underflow protection
|
|
18
18
|
Math.max(currentEpoch - config.MIN_EPOCHS_FOR_BLOCK_REQUESTS, 0),
|
|
@@ -63,4 +63,6 @@ export async function pruneHistory(
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
metrics?.pruneHistory.pruneCount.inc();
|
|
66
|
+
|
|
67
|
+
return blockCutoffSlot;
|
|
66
68
|
}
|
|
@@ -12,6 +12,7 @@ import {isQueueErrorAborted} from "../../util/queue/index.js";
|
|
|
12
12
|
import {BeaconChain} from "../chain.js";
|
|
13
13
|
import {RegenCaller} from "../regen/interface.js";
|
|
14
14
|
import {PayloadEnvelopeInput} from "../seenCache/seenPayloadEnvelopeInput.js";
|
|
15
|
+
import {PayloadEnvelopeInputSource} from "./payloadEnvelopeInput/index.js";
|
|
15
16
|
import {ImportPayloadOpts} from "./types.js";
|
|
16
17
|
import {
|
|
17
18
|
verifyExecutionPayloadEnvelope,
|
|
@@ -172,6 +173,9 @@ export async function importExecutionPayload(
|
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
// 4a. Run EL and signature verification in parallel
|
|
176
|
+
const logCtx = {slot, root: blockRootHex, executionBlock: envelope.payload.blockNumber};
|
|
177
|
+
this.logger.debug("Call engine api newPayload", logCtx);
|
|
178
|
+
const verifyStartSec = Date.now() / 1000;
|
|
175
179
|
const [execResult, signatureValid] = await Promise.all([
|
|
176
180
|
this.executionEngine.notifyNewPayload(
|
|
177
181
|
fork,
|
|
@@ -191,6 +195,8 @@ export async function importExecutionPayload(
|
|
|
191
195
|
this.bls
|
|
192
196
|
),
|
|
193
197
|
]);
|
|
198
|
+
this.logger.debug("Receive engine api newPayload result", {...logCtx, status: execResult.status});
|
|
199
|
+
this.metrics?.engineNotifyNewPayloadResult.inc({result: execResult.status});
|
|
194
200
|
|
|
195
201
|
// 4b. Check signature verification result
|
|
196
202
|
if (!signatureValid) {
|
|
@@ -223,6 +229,14 @@ export async function importExecutionPayload(
|
|
|
223
229
|
});
|
|
224
230
|
}
|
|
225
231
|
|
|
232
|
+
const {source, seenTimestampSec} = payloadInput.getPayloadEnvelopeSource();
|
|
233
|
+
if (execResult.status === ExecutionPayloadStatus.VALID && source === PayloadEnvelopeInputSource.gossip) {
|
|
234
|
+
const nowSec = Date.now() / 1000;
|
|
235
|
+
this.metrics?.gossipExecutionPayloadEnvelope.executionPayload.recvToValidation.observe(nowSec - seenTimestampSec);
|
|
236
|
+
// same metric as pre-gloas, it tracks EL verification time regardless of fork
|
|
237
|
+
this.metrics?.gossipBlock.executionPayload.validationTime.observe(nowSec - verifyStartSec);
|
|
238
|
+
}
|
|
239
|
+
|
|
226
240
|
// 5. Persist payload envelope to hot DB. Wait for write-queue space here to apply backpressure
|
|
227
241
|
// on the import pipeline during sync, then perform the write asynchronously to avoid blocking.
|
|
228
242
|
await this.unfinalizedPayloadEnvelopeWrites.waitForSpace();
|
package/src/chain/chain.ts
CHANGED
|
@@ -61,6 +61,7 @@ import {ProcessShutdownCallback} from "@lodestar/validator";
|
|
|
61
61
|
import {GENESIS_EPOCH, ZERO_HASH} from "../constants/index.js";
|
|
62
62
|
import {IBeaconDb} from "../db/index.js";
|
|
63
63
|
import {BLOB_SIDECARS_IN_WRAPPER_INDEX} from "../db/repositories/blobSidecars.js";
|
|
64
|
+
import {decodeArchivedEnvelope} from "../db/repositories/index.js";
|
|
64
65
|
import {BuilderApiClient, BuilderApiClientOpts} from "../execution/builder/apiClient.js";
|
|
65
66
|
import {BuilderStatus} from "../execution/builder/http.js";
|
|
66
67
|
import {IExecutionBuilder, IExecutionEngine} from "../execution/index.js";
|
|
@@ -70,6 +71,7 @@ import {BufferPool} from "../util/bufferPool.js";
|
|
|
70
71
|
import {Clock, ClockEvent, IClock} from "../util/clock.js";
|
|
71
72
|
import {CustodyConfig, getValidatorsCustodyRequirement} from "../util/dataColumns.js";
|
|
72
73
|
import {callInNextEventLoop} from "../util/eventLoop.js";
|
|
74
|
+
import {ReconstructMismatchPolicy, isRebuildMiss, reconstructExecutionPayloadEnvelopes} from "../util/execution.js";
|
|
73
75
|
import {ensureDir, writeIfNotExist} from "../util/file.js";
|
|
74
76
|
import {isOptimisticBlock} from "../util/forkChoice.js";
|
|
75
77
|
import {JobItemQueue} from "../util/queue/itemQueue.js";
|
|
@@ -926,21 +928,71 @@ export class BeaconChain implements IBeaconChain {
|
|
|
926
928
|
}
|
|
927
929
|
|
|
928
930
|
async getSerializedExecutionPayloadEnvelope(blockSlot: Slot, blockRootHex: string): Promise<Uint8Array | null> {
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
931
|
+
const [bytes] = await this.getSerializedExecutionPayloadEnvelopes([{blockSlot, blockRootHex}]);
|
|
932
|
+
return bytes;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* Batch variant: archived header envelopes are rebuilt 32 per EL round-trip. Aligned with `requests`.
|
|
937
|
+
* A body root mismatch is a local inconsistency: `"throw"` surfaces it, `"omit"` logs it and
|
|
938
|
+
* returns null for that entry, for peer-facing paths where the spec allows omission.
|
|
939
|
+
*/
|
|
940
|
+
async getSerializedExecutionPayloadEnvelopes(
|
|
941
|
+
requests: {blockSlot: Slot; blockRootHex: RootHex}[],
|
|
942
|
+
onMismatch: ReconstructMismatchPolicy = "throw"
|
|
943
|
+
): Promise<(Uint8Array | null)[]> {
|
|
944
|
+
const out: (Uint8Array | null)[] = new Array(requests.length).fill(null);
|
|
945
|
+
const headerEnvelopes: gloas.SignedExecutionPayloadHeaderEnvelope[] = [];
|
|
946
|
+
const headerEnvelopeIdxs: number[] = [];
|
|
947
|
+
|
|
948
|
+
for (let i = 0; i < requests.length; i++) {
|
|
949
|
+
const {blockSlot, blockRootHex} = requests[i];
|
|
950
|
+
|
|
951
|
+
const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
952
|
+
if (payloadInput?.hasPayloadEnvelope()) {
|
|
953
|
+
const envelope = payloadInput.getPayloadEnvelope();
|
|
954
|
+
out[i] = this.serializedCache.get(envelope) ?? ssz.gloas.SignedExecutionPayloadEnvelope.serialize(envelope);
|
|
955
|
+
continue;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
const hot = await this.db.executionPayloadEnvelope.getBinary(fromHex(blockRootHex));
|
|
959
|
+
if (hot !== null) {
|
|
960
|
+
out[i] = hot;
|
|
961
|
+
continue;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
const archivedBytes = await this.db.executionPayloadEnvelopeArchive.getBinary(blockSlot);
|
|
965
|
+
if (archivedBytes === null) continue;
|
|
966
|
+
|
|
967
|
+
const archived = decodeArchivedEnvelope(archivedBytes);
|
|
968
|
+
if (archived.envelopeBytes !== undefined) {
|
|
969
|
+
out[i] = archived.envelopeBytes;
|
|
970
|
+
continue;
|
|
971
|
+
}
|
|
972
|
+
headerEnvelopes.push(archived.headerEnvelope);
|
|
973
|
+
headerEnvelopeIdxs.push(i);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
if (headerEnvelopes.length > 0) {
|
|
977
|
+
const rebuilt = await reconstructExecutionPayloadEnvelopes(this.executionEngine, this.metrics, headerEnvelopes);
|
|
978
|
+
for (let j = 0; j < rebuilt.length; j++) {
|
|
979
|
+
const result = rebuilt[j];
|
|
980
|
+
if (isRebuildMiss(result)) {
|
|
981
|
+
if (result.reason === "mismatch") {
|
|
982
|
+
if (onMismatch === "throw") throw result.error;
|
|
983
|
+
this.logger.debug(
|
|
984
|
+
"Archived envelope failed body root check against EL bodies",
|
|
985
|
+
{slot: result.slot},
|
|
986
|
+
result.error
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
continue;
|
|
990
|
+
}
|
|
991
|
+
out[headerEnvelopeIdxs[j]] = ssz.gloas.SignedExecutionPayloadEnvelope.serialize(result);
|
|
935
992
|
}
|
|
936
|
-
return ssz.gloas.SignedExecutionPayloadEnvelope.serialize(envelope);
|
|
937
993
|
}
|
|
938
994
|
|
|
939
|
-
return
|
|
940
|
-
(await this.db.executionPayloadEnvelope.getBinary(fromHex(blockRootHex))) ??
|
|
941
|
-
(await this.db.executionPayloadEnvelopeArchive.getBinary(blockSlot)) ??
|
|
942
|
-
null
|
|
943
|
-
);
|
|
995
|
+
return out;
|
|
944
996
|
}
|
|
945
997
|
|
|
946
998
|
async getExecutionPayloadEnvelope(
|
|
@@ -952,11 +1004,23 @@ export class BeaconChain implements IBeaconChain {
|
|
|
952
1004
|
return payloadInput.getPayloadEnvelope();
|
|
953
1005
|
}
|
|
954
1006
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
);
|
|
1007
|
+
const hot = await this.db.executionPayloadEnvelope.get(fromHex(blockRootHex));
|
|
1008
|
+
if (hot !== null) return hot;
|
|
1009
|
+
|
|
1010
|
+
const archivedBytes = await this.db.executionPayloadEnvelopeArchive.getBinary(blockSlot);
|
|
1011
|
+
if (archivedBytes === null) return null;
|
|
1012
|
+
const archived = decodeArchivedEnvelope(archivedBytes);
|
|
1013
|
+
if (archived.envelopeBytes !== undefined) {
|
|
1014
|
+
return ssz.gloas.SignedExecutionPayloadEnvelope.deserialize(archived.envelopeBytes);
|
|
1015
|
+
}
|
|
1016
|
+
const [result] = await reconstructExecutionPayloadEnvelopes(this.executionEngine, this.metrics, [
|
|
1017
|
+
archived.headerEnvelope,
|
|
1018
|
+
]);
|
|
1019
|
+
if (isRebuildMiss(result)) {
|
|
1020
|
+
if (result.reason === "mismatch") throw result.error;
|
|
1021
|
+
return null;
|
|
1022
|
+
}
|
|
1023
|
+
return result;
|
|
960
1024
|
}
|
|
961
1025
|
|
|
962
1026
|
async getParentExecutionRequests(
|
|
@@ -967,11 +1031,23 @@ export class BeaconChain implements IBeaconChain {
|
|
|
967
1031
|
if (!isForkPostGloas(this.config.getForkName(parentBlockSlot))) {
|
|
968
1032
|
return ssz.gloas.ExecutionRequests.defaultValue();
|
|
969
1033
|
}
|
|
970
|
-
|
|
971
|
-
|
|
1034
|
+
// executionRequests is kept in the header envelope, so read it without reconstructing
|
|
1035
|
+
const payloadInput = this.seenPayloadEnvelopeInputCache.get(parentBlockRootHex);
|
|
1036
|
+
if (payloadInput?.hasPayloadEnvelope()) {
|
|
1037
|
+
return payloadInput.getPayloadEnvelope().message.executionRequests;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
const hot = await this.db.executionPayloadEnvelope.get(fromHex(parentBlockRootHex));
|
|
1041
|
+
if (hot !== null) return hot.message.executionRequests;
|
|
1042
|
+
|
|
1043
|
+
const archivedBytes = await this.db.executionPayloadEnvelopeArchive.getBinary(parentBlockSlot);
|
|
1044
|
+
if (archivedBytes === null) {
|
|
972
1045
|
throw Error(`Parent execution payload envelope not found slot=${parentBlockSlot}, root=${parentBlockRootHex}`);
|
|
973
1046
|
}
|
|
974
|
-
|
|
1047
|
+
const archived = decodeArchivedEnvelope(archivedBytes);
|
|
1048
|
+
return archived.envelopeBytes !== undefined
|
|
1049
|
+
? ssz.gloas.SignedExecutionPayloadEnvelope.deserialize(archived.envelopeBytes).message.executionRequests
|
|
1050
|
+
: archived.headerEnvelope.message.executionRequests;
|
|
975
1051
|
}
|
|
976
1052
|
|
|
977
1053
|
async getDataColumnSidecars(blockSlot: Slot, blockRootHex: string): Promise<DataColumnSidecar[]> {
|