mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
func docs
This commit is contained in:
parent
d62853e103
commit
ba596bc635
1 changed files with 2 additions and 8 deletions
|
|
@ -86,18 +86,12 @@ func (sc *BlobTxSidecar) encodedSize() uint64 {
|
||||||
return rlp.ListSize(blobs) + rlp.ListSize(commitments) + rlp.ListSize(proofs)
|
return rlp.ListSize(blobs) + rlp.ListSize(commitments) + rlp.ListSize(proofs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ValidateBlobCommitmentHashes checks whether the given hashes correspond to the
|
||||||
|
// commitments in the sidecar
|
||||||
func (sc *BlobTxSidecar) ValidateBlobCommitmentHashes(hashes []common.Hash) error {
|
func (sc *BlobTxSidecar) ValidateBlobCommitmentHashes(hashes []common.Hash) error {
|
||||||
if len(sc.Blobs) != len(hashes) {
|
|
||||||
return fmt.Errorf("invalid number of %d blobs compared to %d blob hashes", len(sc.Blobs), len(hashes))
|
|
||||||
}
|
|
||||||
if len(sc.Commitments) != len(hashes) {
|
if len(sc.Commitments) != len(hashes) {
|
||||||
return fmt.Errorf("invalid number of %d blob commitments compared to %d blob hashes", len(sc.Commitments), len(hashes))
|
return fmt.Errorf("invalid number of %d blob commitments compared to %d blob hashes", len(sc.Commitments), len(hashes))
|
||||||
}
|
}
|
||||||
if len(sc.Proofs) != len(hashes) {
|
|
||||||
return fmt.Errorf("invalid number of %d blob proofs compared to %d blob hashes", len(sc.Proofs), len(hashes))
|
|
||||||
}
|
|
||||||
// Blob quantities match up, validate that the provers match with the
|
|
||||||
// transaction hash before getting to the cryptography
|
|
||||||
hasher := sha256.New()
|
hasher := sha256.New()
|
||||||
for i, vhash := range hashes {
|
for i, vhash := range hashes {
|
||||||
computed := kzg4844.CalcBlobHashV1(hasher, &sc.Commitments[i])
|
computed := kzg4844.CalcBlobHashV1(hasher, &sc.Commitments[i])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue