From 2b7d9fcb8006500a4eaf955223dd616cf468b5c3 Mon Sep 17 00:00:00 2001 From: SangIlMo Date: Tue, 23 Jul 2024 15:08:19 +0900 Subject: [PATCH] Add testcode for gasPrice is not specified --- ethclient/gethclient/gethclient_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ethclient/gethclient/gethclient_test.go b/ethclient/gethclient/gethclient_test.go index 6c5dac4447..9729cfd6ce 100644 --- a/ethclient/gethclient/gethclient_test.go +++ b/ethclient/gethclient/gethclient_test.go @@ -237,6 +237,27 @@ func testAccessList(t *testing.T, client *rpc.Client) { if al != nil { t.Fatalf("unexpected accesslist: %v", len(*al)) } + + // when gasPrice is not specified + msg = ethereum.CallMsg{ + From: testAddr, + To: &common.Address{}, + Gas: 21000, + Value: big.NewInt(1), + } + al, gas, vmErr, err = ec.CreateAccessList(context.Background(), msg) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if vmErr != "" { + t.Fatalf("unexpected vm error: %v", vmErr) + } + if gas != 21000 { + t.Fatalf("unexpected gas used: %v", gas) + } + if len(*al) != 0 { + t.Fatalf("unexpected length of accesslist: %v", len(*al)) + } } func testGetProof(t *testing.T, client *rpc.Client, addr common.Address) {