Skip to content

Commit

Permalink
fix upgrade issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Jul 17, 2024
1 parent d537513 commit e164043
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions txbuilder/blob_encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
)

type BlobCommitment struct {
Blob kzg4844.Blob
Blob *kzg4844.Blob
Commitment kzg4844.Commitment
Proof kzg4844.Proof
VersionedHash common.Hash
}

func encodeBlobData(data []byte) kzg4844.Blob {
func encodeBlobData(data []byte) *kzg4844.Blob {
blob := kzg4844.Blob{}
fieldIndex := -1
for i := 0; i < len(data); i += 31 {
Expand All @@ -30,7 +30,7 @@ func encodeBlobData(data []byte) kzg4844.Blob {
}
copy(blob[fieldIndex*32+1:], data[i:max])
}
return blob
return &blob
}

func EncodeBlob(data []byte) (*BlobCommitment, error) {
Expand All @@ -57,6 +57,6 @@ func EncodeBlob(data []byte) (*BlobCommitment, error) {

// build versioned hash
blobCommitment.VersionedHash = sha256.Sum256(blobCommitment.Commitment[:])
blobCommitment.VersionedHash[0] = params.BlobTxHashVersion
blobCommitment.VersionedHash[0] = 0x01
return &blobCommitment, nil
}
2 changes: 1 addition & 1 deletion txbuilder/blobtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func parseBlobRefs(tx *types.BlobTx, blobRefs []string) error {
}

tx.BlobHashes = append(tx.BlobHashes, blobCommitment.VersionedHash)
tx.Sidecar.Blobs = append(tx.Sidecar.Blobs, blobCommitment.Blob)
tx.Sidecar.Blobs = append(tx.Sidecar.Blobs, *blobCommitment.Blob)
tx.Sidecar.Commitments = append(tx.Sidecar.Commitments, blobCommitment.Commitment)
tx.Sidecar.Proofs = append(tx.Sidecar.Proofs, blobCommitment.Proof)
return nil
Expand Down

0 comments on commit e164043

Please sign in to comment.