Add test for DoCall when ApplyMessage returns nil

This commit is contained in:
Olexandr88 2025-12-19 12:32:07 +02:00
parent ebe1ab2b54
commit 93baf1e05e
No known key found for this signature in database
2 changed files with 21 additions and 3 deletions

1
go-ethereum Submodule

@ -0,0 +1 @@
Subproject commit dd7daace9ddc5e02bd23aeb5fbced9fda20b1ab5

View file

@ -175,6 +175,23 @@ func (m *mockBackend) EVM(ctx context.Context, msg Message, state *state.StateDB
}
func TestDoCall_ApplyMessageReturnsNil(t *testing.T) {
backend := &mockBackend{
evmResult: nil,
evmError:
backend := &mockBackend{
evmResult: nil,
evmError: nil,
}
api := NewPublicEthereumAPI(backend)
ctx := context.Background()
// Викликаємо DoCall
result, err := api.DoCall(ctx, CallArgs{}, rpc.BlockNumberOrHash{})
if err == nil {
t.Error("expected error when ApplyMessage returns nil, got nil")
}
if result != (hexutil.Bytes{}) {
t.Errorf("expected empty result, got %v", result)
}
}