From 93baf1e05e2b2d85297d52f3f0b93a8ab6fc5bcd Mon Sep 17 00:00:00 2001 From: Olexandr88 Date: Fri, 19 Dec 2025 12:32:07 +0200 Subject: [PATCH] Add test for DoCall when ApplyMessage returns nil --- go-ethereum | 1 + internal/ethapi/api_test.go | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 160000 go-ethereum diff --git a/go-ethereum b/go-ethereum new file mode 160000 index 0000000000..dd7daace9d --- /dev/null +++ b/go-ethereum @@ -0,0 +1 @@ +Subproject commit dd7daace9ddc5e02bd23aeb5fbced9fda20b1ab5 diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index 9639943227..068344986d 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -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) + } +} +