-
-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor and unit test getDataColumnSidecars (#7072)
* refactor: getDataColumnSidecars * test: unit test getDataColumnSidecars with mocks from c-kzg library * refactor: use fromHex util * chore: update numbering on mocks * chore: update c-kzg to latest version * chore: fix type export syntax * test: add verification for cells from sidecars * test: add verification to DataColumnSidecars tests * refactor: getDataColumnSidecars for PR comments * feat: narrow type and remove unnecessary conditional * fix: getDataColumnSidecars param type * refactor: rename to computeDataColumnSidecars
- Loading branch information
1 parent
4ec7aff
commit a33303f
Showing
13 changed files
with
1,666 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
258 changes: 258 additions & 0 deletions
258
packages/beacon-node/test/fixtures/blobsAndCells/0.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
258 changes: 258 additions & 0 deletions
258
packages/beacon-node/test/fixtures/blobsAndCells/1.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
258 changes: 258 additions & 0 deletions
258
packages/beacon-node/test/fixtures/blobsAndCells/2.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
258 changes: 258 additions & 0 deletions
258
packages/beacon-node/test/fixtures/blobsAndCells/3.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
258 changes: 258 additions & 0 deletions
258
packages/beacon-node/test/fixtures/blobsAndCells/4.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
258 changes: 258 additions & 0 deletions
258
packages/beacon-node/test/fixtures/blobsAndCells/5.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import fs from "node:fs"; | ||
import path from "node:path"; | ||
import yaml from "js-yaml"; | ||
import {Blob, Cell, KZGProof} from "c-kzg"; | ||
import {fromHex} from "@lodestar/utils"; | ||
|
||
interface BlobCellAndProofMock { | ||
blob: Blob; | ||
cells: Cell[]; | ||
proofs: KZGProof[]; | ||
} | ||
|
||
interface BlobCellAndProofYamlFormat { | ||
input: { | ||
blob: string; | ||
}; | ||
//output: [Cell[], KZGProof[]] | ||
output: [string[], string[]]; | ||
} | ||
|
||
export function getBlobCellAndProofs(): BlobCellAndProofMock[] { | ||
const mocks = [] as BlobCellAndProofMock[]; | ||
const mocksDir = path.resolve(__dirname, "..", "fixtures", "blobsAndCells"); | ||
for (const file of fs.readdirSync(mocksDir)) { | ||
const filepath = path.resolve(mocksDir, file); | ||
if (fs.statSync(filepath).isFile()) { | ||
const { | ||
input: {blob}, | ||
output: [cells, proofs], | ||
} = yaml.load(fs.readFileSync(filepath, "utf-8")) as BlobCellAndProofYamlFormat; | ||
mocks.push({ | ||
blob: fromHex(blob), | ||
cells: cells.map(fromHex), | ||
proofs: proofs.map(fromHex), | ||
}); | ||
} | ||
} | ||
return mocks; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./types.js"; | ||
export * as ts from "./types.js"; | ||
export * as ssz from "./sszTypes.js"; | ||
import * as ts from "./types.js"; | ||
import * as ssz from "./sszTypes.js"; | ||
export {ts, ssz}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4693,9 +4693,9 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-8.1.1.tgz#3424608c62d59de5bfda05d31e0313c6174842ae" | ||
integrity sha512-tUkzZWK0M/qdoLEqikxBWe4kumyuwjl3HO6zHTr4yEI23EojPtLYXdG1+AQY7MN0cGyNDvEaJ8wiYQm6P2bPxg== | ||
|
||
c-kzg@matthewkeil/c-kzg-4844#13aa01464479aa7c1ccafa64d52cbc17699ffa07: | ||
c-kzg@matthewkeil/c-kzg-4844#853b22fa416d4eac376678a36bfba0bccb59dd78: | ||
version "4.0.0-alpha.0" | ||
resolved "https://codeload.github.com/matthewkeil/c-kzg-4844/tar.gz/13aa01464479aa7c1ccafa64d52cbc17699ffa07" | ||
resolved "https://codeload.github.com/matthewkeil/c-kzg-4844/tar.gz/853b22fa416d4eac376678a36bfba0bccb59dd78" | ||
|
||
cac@^6.7.14: | ||
version "6.7.14" | ||
|