-
-
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: change the blob txs encoding assumption to be opaque rlp (#5569)
* feat: change the blob txs encoding assumption to be opaque rlp * add dummy blob txs * fix build
- Loading branch information
Showing
12 changed files
with
95 additions
and
231 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
17 changes: 2 additions & 15 deletions
17
packages/beacon-node/src/chain/produceBlock/validateBlobsAndKzgCommitments.ts
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,28 +1,15 @@ | ||
import {verifyKzgCommitmentsAgainstTransactions} from "@lodestar/state-transition"; | ||
import {allForks, deneb} from "@lodestar/types"; | ||
import {toHex} from "@lodestar/utils"; | ||
import {allForks} from "@lodestar/types"; | ||
import {BlobsBundle} from "../../execution/index.js"; | ||
import {byteArrayEquals} from "../../util/bytes.js"; | ||
import {ckzg} from "../../util/kzg.js"; | ||
|
||
/** | ||
* Optionally sanity-check that the KZG commitments match the versioned hashes in the transactions | ||
* https://github.com/ethereum/consensus-specs/blob/11a037fd9227e29ee809c9397b09f8cc3383a8c0/specs/eip4844/validator.md#blob-kzg-commitments | ||
*/ | ||
export function validateBlobsAndKzgCommitments(payload: allForks.ExecutionPayload, blobsBundle: BlobsBundle): void { | ||
verifyKzgCommitmentsAgainstTransactions(payload.transactions, blobsBundle.commitments); | ||
|
||
// Optionally sanity-check that the KZG commitments match the blobs (as produced by the execution engine) | ||
// sanity-check that the KZG commitments match the blobs (as produced by the execution engine) | ||
if (blobsBundle.blobs.length !== blobsBundle.commitments.length) { | ||
throw Error( | ||
`Blobs bundle blobs len ${blobsBundle.blobs.length} != commitments len ${blobsBundle.commitments.length}` | ||
); | ||
} | ||
|
||
for (let i = 0; i < blobsBundle.blobs.length; i++) { | ||
const kzg = ckzg.blobToKzgCommitment(blobsBundle.blobs[i]) as deneb.KZGCommitment; | ||
if (!byteArrayEquals(kzg, blobsBundle.commitments[i])) { | ||
throw Error(`Wrong KZG[${i}] ${toHex(blobsBundle.commitments[i])} expected ${toHex(kzg)}`); | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.