Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Transactions for invalid transfers #775

@imanov

Description

@imanov

Summary or problem description
I have the following issue. When we run a transaction for a certain Nep17 token, which sends tokens from one wallet to another, but the amount is more than the current balance, the transaction does not return an error. A transaction with the returned hash is successfully stored inside a block, but it actually do not transfer any tokens (because the Transfer method of the token contract returned false).
When I get the state of the transaction through RPC call, it returns same data as a successful one.

Do you have any solution you want to propose?

There are 2 things which I found during this research and think they are problems which should be resolved:

CreateTransferTxAsync in NEP17Api.cs creates a script for "transfer" method, which does not add ASSERT at the end (in order to check the boolean result from Transfer method of the token contract). The implementation of MakeTransaction in Wallet.cs in Neo project does it this way, so I'd trust its implementation more and I think it is just a bug in the code of the RpcClient module.

The next strange step is TransactionManagerFactory -> MakeTransactionAsync. It does a test invoke of the transaction script, but totally ignores the result from it. In my case, if I add the ASSERT from 1), the invocation result here is FAULT. I think that this method should check that before creating a transaction and returning it. Probably throw an exception or return a result of (RpcInvokeResult, Transaction).
This way the code that calls MakeTransactionAsync can decide whether to send the raw transaction or return an error or something like that. In my case if I add the ASSERT and still execute the SendRawTransaction, it also ignores the FAULT code and stores the "invalid" transfer transaction in a block successfully.

What do you think about these issues? Are they things that has to be fixed or there is a reason to create the script without ASSERT and not checking the test-invoke state before sending the raw transaction ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions