mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
Add testcase for createAccessList when gasPrice is less than baseFee (default 875M)
This commit is contained in:
parent
9c08631bb0
commit
1280d75987
1 changed files with 23 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"math/big"
|
"math/big"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
|
@ -214,6 +215,28 @@ func testAccessList(t *testing.T, client *rpc.Client) {
|
||||||
if (*al)[0].StorageKeys[0] != common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000081") {
|
if (*al)[0].StorageKeys[0] != common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000081") {
|
||||||
t.Fatalf("unexpected storage key: %v", (*al)[0].StorageKeys[0])
|
t.Fatalf("unexpected storage key: %v", (*al)[0].StorageKeys[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// error when gasPrice is less than baseFee
|
||||||
|
msg = ethereum.CallMsg{
|
||||||
|
From: testAddr,
|
||||||
|
To: &common.Address{},
|
||||||
|
Gas: 21000,
|
||||||
|
GasPrice: big.NewInt(1), // less than baseFee
|
||||||
|
Value: big.NewInt(1),
|
||||||
|
}
|
||||||
|
al, gas, vmErr, err = ec.CreateAccessList(context.Background(), msg)
|
||||||
|
if errors.Is(err, core.ErrBlobFeeCapTooLow) {
|
||||||
|
t.Fatalf("unexpected error: %v", err)
|
||||||
|
}
|
||||||
|
if vmErr != "" {
|
||||||
|
t.Fatalf("unexpected vm error: %v", vmErr)
|
||||||
|
}
|
||||||
|
if gas != 0 {
|
||||||
|
t.Fatalf("unexpected gas used: %v", gas)
|
||||||
|
}
|
||||||
|
if al != nil {
|
||||||
|
t.Fatalf("unexpected accesslist: %v", len(*al))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testGetProof(t *testing.T, client *rpc.Client, addr common.Address) {
|
func testGetProof(t *testing.T, client *rpc.Client, addr common.Address) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue