Add testcase for createAccessList when gasPrice is less than baseFee (default 875M)

This commit is contained in:
SangIlMo 2024-07-20 17:08:27 +09:00 committed by Martin Holst Swende
parent 9c08631bb0
commit 1280d75987
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -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) {