From e26eceee77b1a7b1dec79f1535960bb5981cf46c Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Thu, 10 Apr 2025 01:00:50 +0800 Subject: [PATCH] add 0xef0001 || accounts[0].addr unit test back --- internal/ethapi/api_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index 7a40643823..52bbc8b47a 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -850,6 +850,17 @@ func TestEstimateGas(t *testing.T) { }, want: 46000, }, + // Should retrieve the code of 0xef0001 || accounts[0].addr and return an invalid opcode error. + { + blockNumber: rpc.LatestBlockNumber, + call: TransactionArgs{ + From: &accounts[0].addr, + To: &accounts[0].addr, + Value: (*hexutil.Big)(big.NewInt(0)), + AuthorizationList: []types.SetCodeAuthorization{setCodeAuthorization}, + }, + expectErr: errors.New("invalid opcode: opcode 0xef not defined"), + }, // SetCodeTx with empty authorization list should fail. { blockNumber: rpc.LatestBlockNumber, @@ -881,7 +892,7 @@ func TestEstimateGas(t *testing.T) { continue } if !errors.Is(err, tc.expectErr) { - if !reflect.DeepEqual(err, tc.expectErr) { + if err.Error() != tc.expectErr.Error() { t.Errorf("test %d: error mismatch, want %v, have %v", i, tc.expectErr, err) } }