Skip to content

DAPI returns "state transition already in chain" on invalid transactions #2261

Closed

Description

@pshenmic

Expected Behavior

DAPI should return a specific and human readable reason why the transaction was rejected

Current Behavior

When you are broadcast invalid state transition through broadcastStateTransition GRPC query, I always see state transition already in chain error

However, if you check the transaction with check_tx query of the Tenderdash RPC, we can see that transaction invalid, and the reason why it is failing

Possible Solution

Steps to Reproduce (for bugs)

  1. Create invalid transaction (for example change nonce)
  2. Try to broadcast it via GRPC broadcastStateTransition
  3. state transition already in chain error returns in the response

Context

Your Environment

  • Version used:
  • Environment name and version (e.g. Chrome 39, node.js 5.4):
  • Operating System and version (desktop, server, or mobile):
  • Link to your project:

Activity

  1. added
    bug
    on Oct 21, 2024
  2. changed the title [-]DAPI returns "state transition already in chain" on broadcastStateTransition[/-] [+]DAPI returns "state transition already in chain" on invalid transactions[/+] on Oct 21, 2024
  3. shumkov commented on Oct 22, 2024

    @shumkov
    Collaborator

    Here is a combination of two problems:

    1. A bug in DAPI client retry logic was introduced in feat(sdk)!: detect stale nodes #2254: it retires when it is not supposed to retry. I will provide a fix soon.
    2. If we broadcast an invalid ST a second time we are getting just state transition already in cache and there is no way to see validation errors on the client side. This happens because of invalid tx cache. I remember we enabled it because of some invalid tx ghosts jumping between node mempools forever.

    @lklimek @QuantumExplorer I see two solutions for the second problem:

    1. Disabling invalid tx cache and adding tx expiration period instead.
    2. Storing tx result in the tx cache so instead of state transition already in cache for both invalid and valid txs we will get the tx result and pass it back to the user.

    I prefer the second solution.

  4. shumkov commented on Oct 22, 2024

    @shumkov
    Collaborator

    @lklimek, do you propose to call check_tx in DAPI if we get state transition already in cache form broadcast_tx? Unfortunately, It won't help because if the tx was already committed, you will get a new error due to invalid nounces. If it was invalidated, then there is a chance that it was invalidated by block processing with additional validations, so check tx will say, ' Everything is fine. '

    Here is the PR for the first problem #2261

  5. shumkov commented on Oct 22, 2024

    @shumkov
    Collaborator

    @lklimek have you deleted your comment? :)))

  6. lklimek commented on Oct 22, 2024

    @lklimek
    Contributor

    @lklimek have you deleted your comment :)))

    Yep, I didn't think you have already seen it. Sorry. I realized check tx is not solution.

  7. moved this to In Progress in Platform teamon Oct 22, 2024
  8. moved this from In Progress to Todo in Platform teamon Oct 22, 2024
  9. shumkov commented on Oct 22, 2024

    @shumkov
    Collaborator

    @pshenmic we are working on defining a solution for this problem. I will let you know when we have something.

  10. shumkov commented on Oct 29, 2024

    @shumkov
    Collaborator

    The problem is fixed #2270. We still need to switch to new unconfirmed txs filter when dashpay/tenderdash#963 is done

  11. moved this from Done to In Progress in Platform teamon Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions