From c9134c4ecf9bdbf82c3966e76f28c403db10f317 Mon Sep 17 00:00:00 2001 From: harkamal Date: Tue, 23 May 2023 13:10:27 +0530 Subject: [PATCH 1/4] fix test --- packages/beacon-node/test/utils/mocks/db.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/beacon-node/test/utils/mocks/db.ts b/packages/beacon-node/test/utils/mocks/db.ts index cdfba8873ec1..443c71933033 100644 --- a/packages/beacon-node/test/utils/mocks/db.ts +++ b/packages/beacon-node/test/utils/mocks/db.ts @@ -19,6 +19,7 @@ import { // TODO DENEB: cleanup following blob repos post full migration BlobsSidecarRepository, BlobsSidecarArchiveRepository, + BLSToExecutionChangeRepository, } from "../../../src/db/repositories/index.js"; import {PreGenesisState, PreGenesisStateLastProcessedBlock} from "../../../src/db/single/index.js"; From c9e99308a06e7b4d536a8831d782b33d41f772c7 Mon Sep 17 00:00:00 2001 From: harkamal Date: Tue, 23 May 2023 13:43:00 +0530 Subject: [PATCH 2/4] lint --- packages/beacon-node/test/utils/mocks/db.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/beacon-node/test/utils/mocks/db.ts b/packages/beacon-node/test/utils/mocks/db.ts index 443c71933033..cdfba8873ec1 100644 --- a/packages/beacon-node/test/utils/mocks/db.ts +++ b/packages/beacon-node/test/utils/mocks/db.ts @@ -19,7 +19,6 @@ import { // TODO DENEB: cleanup following blob repos post full migration BlobsSidecarRepository, BlobsSidecarArchiveRepository, - BLSToExecutionChangeRepository, } from "../../../src/db/repositories/index.js"; import {PreGenesisState, PreGenesisStateLastProcessedBlock} from "../../../src/db/single/index.js"; From 61ad3c6fe6ba5ea12ab9d2f0a0361e98c3bfffdb Mon Sep 17 00:00:00 2001 From: harkamal Date: Tue, 23 May 2023 13:36:58 +0530 Subject: [PATCH 3/4] feat: enable deneb spec tests --- .../test/spec/presets/index.test.ts | 2 -- packages/types/src/deneb/sszTypes.ts | 21 +++++++++++++++++++ packages/types/src/deneb/types.ts | 4 ++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/packages/beacon-node/test/spec/presets/index.test.ts b/packages/beacon-node/test/spec/presets/index.test.ts index db7afce6fc3e..0ff8eefcd977 100644 --- a/packages/beacon-node/test/spec/presets/index.test.ts +++ b/packages/beacon-node/test/spec/presets/index.test.ts @@ -30,8 +30,6 @@ import {transition} from "./transition.js"; // ], // ``` const skipOpts: SkipOpts = { - // To be enabled in decouple blobs PR: https://github.com/ChainSafe/lodestar/pull/5181 - skippedForks: ["deneb"], // TODO: capella // BeaconBlockBody proof in lightclient is the new addition in v1.3.0-rc.2-hotfix // Skip them for now to enable subsequently diff --git a/packages/types/src/deneb/sszTypes.ts b/packages/types/src/deneb/sszTypes.ts index 864415a7c07d..dd987eb4679f 100644 --- a/packages/types/src/deneb/sszTypes.ts +++ b/packages/types/src/deneb/sszTypes.ts @@ -4,6 +4,7 @@ import { FIELD_ELEMENTS_PER_BLOB, MAX_BLOBS_PER_BLOCK, MAX_REQUEST_BLOCKS, + MAX_REQUEST_BLOB_SIDECARS, BYTES_PER_FIELD_ELEMENT, BLOCK_BODY_EXECUTION_PAYLOAD_DEPTH as EXECUTION_PAYLOAD_DEPTH, EPOCHS_PER_SYNC_COMMITTEE_PERIOD, @@ -84,6 +85,26 @@ export const PolynomialAndCommitment = new ContainerType( // ReqResp types // ============= +export const BlobSidecarsByRangeRequest = new ContainerType( + { + startSlot: Slot, + count: UintNum64, + }, + {typeName: "BlobSidecarsByRangeRequest", jsonCase: "eth2"} +); + +export const BlobIdentifier = new ContainerType( + { + blockRoot: Root, + index: BlobIndex, + }, + {typeName: "BlobIdentifier", jsonCase: "eth2"} +); + +export const BlobSidecarsByRootRequest = new ListCompositeType(BlobIdentifier, MAX_REQUEST_BLOB_SIDECARS); + +// TODO DENEB: cleanup the following types once blob migration is complete + export const BlobsSidecarsByRangeRequest = new ContainerType( { startSlot: Slot, diff --git a/packages/types/src/deneb/types.ts b/packages/types/src/deneb/types.ts index aaec10874006..c804fef02f5c 100644 --- a/packages/types/src/deneb/types.ts +++ b/packages/types/src/deneb/types.ts @@ -22,6 +22,10 @@ export type Polynomial = ValueOf; export type PolynomialAndCommitment = ValueOf; export type BLSFieldElement = ValueOf; +export type BlobIdentifier = ValueOf; +export type BlobSidecarsByRangeRequest = ValueOf; +export type BlobSidecarsByRootRequest = ValueOf; +// TODO DENEB: cleanup the following old blobs types once the migration is complete export type BlobsSidecarsByRangeRequest = ValueOf; export type BeaconBlockAndBlobsSidecarByRootRequest = ValueOf; From 24aaed533cbf49615b67ee58d0349446a73420ee Mon Sep 17 00:00:00 2001 From: harkamal Date: Wed, 24 May 2023 14:23:51 +0530 Subject: [PATCH 4/4] some comment improvs --- packages/beacon-node/src/api/impl/beacon/blocks/index.ts | 2 +- packages/beacon-node/src/db/repositories/blobSidecars.ts | 4 ++-- .../beacon-node/src/db/repositories/blobSidecarsArchive.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/beacon-node/src/api/impl/beacon/blocks/index.ts b/packages/beacon-node/src/api/impl/beacon/blocks/index.ts index 0ef866962477..49273a96981a 100644 --- a/packages/beacon-node/src/api/impl/beacon/blocks/index.ts +++ b/packages/beacon-node/src/api/impl/beacon/blocks/index.ts @@ -275,7 +275,7 @@ export function getBeaconBlockApi({ } if (!blobSidecars) { - throw Error("Not found in db"); + throw Error(`blobSidecars not found in db for slot=${block.message.slot} root=${toHexString(blockRoot)}`); } return { executionOptimistic, diff --git a/packages/beacon-node/src/db/repositories/blobSidecars.ts b/packages/beacon-node/src/db/repositories/blobSidecars.ts index 9f90e2dc63ed..ade9597ac29c 100644 --- a/packages/beacon-node/src/db/repositories/blobSidecars.ts +++ b/packages/beacon-node/src/db/repositories/blobSidecars.ts @@ -19,9 +19,9 @@ export const BLOB_SIDECARS_IN_WRAPPER_INDEX = 44; export const BLOBSIDECAR_FIXED_SIZE = 131256; /** - * blobSidecarsWrapper by block root (= hash_tree_root(SignedBeaconBlockAndBlobsSidecar.beacon_block.message)) + * blobSidecarsWrapper by block root (= hash_tree_root(SignedBeaconBlock.message)) * - * Used to store unfinalized BlobsSidecar + * Used to store unfinalized BlobSidecars */ export class BlobSidecarsRepository extends Repository { constructor(config: ChainForkConfig, db: Db) { diff --git a/packages/beacon-node/src/db/repositories/blobSidecarsArchive.ts b/packages/beacon-node/src/db/repositories/blobSidecarsArchive.ts index d834708cd2c6..9bfb55641a3a 100644 --- a/packages/beacon-node/src/db/repositories/blobSidecarsArchive.ts +++ b/packages/beacon-node/src/db/repositories/blobSidecarsArchive.ts @@ -8,7 +8,7 @@ import {blobSidecarsWrapperSsz, BlobSidecarsWrapper} from "./blobSidecars.js"; /** * blobSidecarsWrapper by slot * - * Used to store unfinalized BlobsSidecar + * Used to store finalized BlobSidecars */ export class BlobSidecarsArchiveRepository extends Repository { constructor(config: ChainForkConfig, db: Db) {