Skip to content

Commit

Permalink
fix the blob sidecars transmisssion
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Nov 20, 2023
1 parent 06386fd commit 8174dbf
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/beacon-node/src/chain/blocks/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ type BlockInputCacheType = {
};

const MAX_GOSSIPINPUT_CACHE = 5;
// ssz.deneb.BlobSidecars.elementType.fixedSize;
const BLOBSIDECAR_FIXED_SIZE = 131256;
// preset dependant size with mainnet being 131928
const BLOBSIDECAR_FIXED_SIZE = ssz.deneb.BlobSidecar.fixedSize ?? 131928;

export const getBlockInput = {
blockInputCache: new Map<RootHex, BlockInputCacheType>(),
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/chain/validation/blobSidecar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,5 @@ function validateBlobsAndProofs(
}

function validateInclusionProof(_blobSidecar: deneb.BlobSidecar): void {
throw Error("Not Implemented");
// TODO PR: Implement validation
}
4 changes: 2 additions & 2 deletions packages/beacon-node/src/db/repositories/blobSidecars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export const blobSidecarsWrapperSsz = new ContainerType(
export type BlobSidecarsWrapper = ValueOf<typeof blobSidecarsWrapperSsz>;

export const BLOB_SIDECARS_IN_WRAPPER_INDEX = 44;
// ssz.deneb.BlobSidecars.elementType.fixedSize;
export const BLOBSIDECAR_FIXED_SIZE = 131256;
// preset dependent size with mainnet being 131928
export const BLOBSIDECAR_FIXED_SIZE = ssz.deneb.BlobSidecar.fixedSize ?? 131928;

/**
* blobSidecarsWrapper by block root (= hash_tree_root(SignedBeaconBlock.message))
Expand Down
2 changes: 1 addition & 1 deletion packages/params/src/presets/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const minimalPreset: BeaconPreset = {
// DENEB
///////////
// https://github.com/ethereum/consensus-specs/blob/dev/presets/minimal/eip4844.yaml
FIELD_ELEMENTS_PER_BLOB: 4,
FIELD_ELEMENTS_PER_BLOB: 4096,
MAX_BLOB_COMMITMENTS_PER_BLOCK: 16,
MAX_BLOBS_PER_BLOCK: 6,
KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 9,
Expand Down
14 changes: 11 additions & 3 deletions packages/state-transition/src/util/blindedBlock.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import {ChainForkConfig} from "@lodestar/config";
import {ForkSeq} from "@lodestar/params";
import {allForks, phase0, Root, deneb, isBlindedBeaconBlock, isExecutionPayloadAndBlobsBundle} from "@lodestar/types";
import {
allForks,
phase0,
Root,
deneb,
isBlindedBeaconBlock,
isExecutionPayloadAndBlobsBundle,
ssz,
} from "@lodestar/types";

import {executionPayloadToPayloadHeader} from "./execution.js";
import {blockToHeader} from "./blockRoot.js";
Expand Down Expand Up @@ -108,8 +116,8 @@ export function computeInclusionProof(
_signedBlock: allForks.SignedBeaconBlock,
_blobsData: {blob: deneb.Blob; kzgProof: deneb.KZGProof; kzgCommitment: deneb.KZGCommitment}
): deneb.KzgCommitmentInclusionProof {
// TODO correctly implement the inclusion proof
throw Error("computeInclusionProof not implemented");
// TODO PR correctly implement the inclusion proof
return ssz.deneb.KzgCommitmentInclusionProof.defaultValue();
}

export function computeBlobSidecars(
Expand Down

0 comments on commit 8174dbf

Please sign in to comment.