diff --git a/core/types/data_blob.go b/core/types/data_blob.go index 34bcae513f93..87f37dd2abd4 100644 --- a/core/types/data_blob.go +++ b/core/types/data_blob.go @@ -292,15 +292,18 @@ func (blobs Blobs) copy() Blobs { return cpy } -func (blobs Blobs) ComputeCommitments() (commitments []KZGCommitment, ok bool) { +// Return KZG commitments and versioned hashes that correspond to these blobs +func (blobs Blobs) ComputeCommitments() (commitments []KZGCommitment, versionedHashes []common.Hash, ok bool) { commitments = make([]KZGCommitment, len(blobs)) + versionedHashes = make([]common.Hash, len(blobs)) for i, blob := range blobs { commitments[i], ok = blob.ComputeCommitment() if !ok { - return nil, false + return nil, nil, false } + versionedHashes[i] = commitments[i].ComputeVersionedHash() } - return commitments, true + return commitments, versionedHashes, true } type BlobTxWrapper struct { diff --git a/core/types/transaction.go b/core/types/transaction.go index 67ee2d5999a2..1c3bf14e689e 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -230,7 +230,7 @@ func (tx *Transaction) UnmarshalBinary(b []byte) error { if err != nil { return err } - tx.setDecoded(inner, len(b)) + tx.setDecoded(inner, 0) tx.wrapData = wrapData return nil } diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index 0b71ad6098ea..6d7cad3e6cd3 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -92,7 +92,8 @@ func LatestSignerForChainID(chainID *big.Int) Signer { if chainID == nil { return HomesteadSigner{} } - return NewLondonSigner(chainID) + return NewDankSigner(chainID) + } // SignTx signs the transaction using the given signer and private key. diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index 20cf4a1eec95..cfaf44b3a590 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -267,12 +267,14 @@ func (args *TransactionArgs) toTransaction() *types.Transaction { msg.Value.SetFromBig((*big.Int)(args.Value)) msg.Data = args.data() msg.AccessList = types.AccessListView(al) - kzgs, ok := types.Blobs(args.Blobs).ComputeCommitments() - if ok { // if blobs are invalid we will omit the wrap-data + commitments, versionedHashes, ok := types.Blobs(args.Blobs).ComputeCommitments() + // XXX if blobs are invalid we will omit the wrap-data (and an error will pop-up later) + if ok { opts = append(opts, types.WithTxWrapData(&types.BlobTxWrapData{ - BlobKzgs: kzgs, + BlobKzgs: commitments, Blobs: args.Blobs, })) + msg.BlobVersionedHashes = versionedHashes } data = &types.SignedBlobTx{Message: msg} case args.MaxFeePerGas != nil: