Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0.3] Trace_API: Fix get_transaction_trace endpoint fails to return transaction trace if the initial block including the transaction forks out #966

Merged
merged 9 commits into from
Oct 23, 2024

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Oct 22, 2024

Trace_API's get_transaction_trace is supposed to return the transaction trace of a transaction. But the current implementation only finds any block whose block number matches the first block proposing the transaction; this block might not contains the transaction due to forking.

This PR

  • adds a test reproducing the problem and a test for normal case.
  • fixes the problem by not updating trx_block_num in get_trx_block_number if the block does not include the transaction.

Resolves #942

@linh2931 linh2931 added the bug The product is not working as was intended. label Oct 22, 2024
}

return has_trx;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't really tell for sure, but would a visit() + overloaded lambda be more concise or cleaner?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is no longer needed.

@linh2931 linh2931 requested a review from spoonincode October 22, 2024 22:02
@linh2931 linh2931 merged commit 33654f3 into release/1.0 Oct 23, 2024
36 checks passed
@linh2931 linh2931 deleted the fix_trace_api_get_trx_block_number branch October 23, 2024 13:30
@ericpassmore
Copy link
Contributor

Note:start
category: System Stability
component: Trace_API
summary: Properly handle case when initial block forks out and return transaction traces.
Note:end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The product is not working as was intended.
Projects
None yet
4 participants