avoid blob-tx in errors

This commit is contained in:
Sina Mahmoodi 2024-01-16 19:13:41 +03:30
parent 402313ca85
commit a93ab47a02
3 changed files with 4 additions and 4 deletions

View file

@ -922,7 +922,7 @@ func TestCall(t *testing.T) {
blockOverrides: BlockOverrides{Number: (*hexutil.Big)(big.NewInt(11))}, blockOverrides: BlockOverrides{Number: (*hexutil.Big)(big.NewInt(11))},
want: "0x000000000000000000000000000000000000000000000000000000000000000b", want: "0x000000000000000000000000000000000000000000000000000000000000000b",
}, },
// Invalid blob-tx // Invalid blob tx
{ {
blockNumber: rpc.LatestBlockNumber, blockNumber: rpc.LatestBlockNumber,
call: TransactionArgs{ call: TransactionArgs{
@ -1039,7 +1039,7 @@ func TestSignBlobTransaction(t *testing.T) {
_, err = api.SignTransaction(context.Background(), argsFromTransaction(res.Tx, b.acc.Address)) _, err = api.SignTransaction(context.Background(), argsFromTransaction(res.Tx, b.acc.Address))
if err == nil { if err == nil {
t.Fatalf("should fail on blob-tx") t.Fatalf("should fail on blob transaction")
} }
if !errors.Is(err, errBlobTxNotSupported) { if !errors.Is(err, errBlobTxNotSupported) {
t.Errorf("error mismatch. Have: %v, want: %v", err, errBlobTxNotSupported) t.Errorf("error mismatch. Have: %v, want: %v", err, errBlobTxNotSupported)

View file

@ -102,7 +102,7 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error {
return errors.New(`blob transactions cannot have the form of a create transaction`) return errors.New(`blob transactions cannot have the form of a create transaction`)
} }
if args.BlobHashes != nil && len(args.BlobHashes) == 0 { if args.BlobHashes != nil && len(args.BlobHashes) == 0 {
return errors.New(`need at least 1 blob for a blob-tx`) return errors.New(`need at least 1 blob for a blob transaction`)
} }
if args.To == nil && len(args.data()) == 0 { if args.To == nil && len(args.data()) == 0 {
return errors.New(`contract creation without any data provided`) return errors.New(`contract creation without any data provided`)

View file

@ -222,7 +222,7 @@ func TestSetFeeDefaults(t *testing.T) {
errors.New("maxFeePerGas and maxPriorityFeePerGas and maxFeePerBlobGas are not valid before London is active"), errors.New("maxFeePerGas and maxPriorityFeePerGas and maxFeePerBlobGas are not valid before London is active"),
}, },
{ {
"set gas price and maxFee for blob-tx", "set gas price and maxFee for blob transaction",
"cancun", "cancun",
&TransactionArgs{GasPrice: fortytwo, MaxFeePerGas: maxFee, BlobHashes: []common.Hash{}}, &TransactionArgs{GasPrice: fortytwo, MaxFeePerGas: maxFee, BlobHashes: []common.Hash{}},
nil, nil,