add 0xef0001 || accounts[0].addr unit test back

This commit is contained in:
colinlyguo 2025-04-10 01:00:50 +08:00
parent d82bb03d98
commit e26eceee77
No known key found for this signature in database
GPG key ID: 82E123BE1B68288B

View file

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