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

Fix ledger rpc getTransactions bug #417

Closed
theochap opened this issue Jun 16, 2023 · 1 comment
Closed

Fix ledger rpc getTransactions bug #417

theochap opened this issue Jun 16, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@theochap
Copy link
Contributor

theochap commented Jun 16, 2023

Context

The PR #403 designs a series of fuzzing tests for ledger rpc using the protest API. A fuzzing test fails on CI (and not locally) probably due to concurrency issues.

How to reproduce the error

In test_rpc.rs in the test proptest_get_batches, the following test fails on CI but not locally

// TODO: Solve this test 
TestExpect{
       data: format!(r#"{{"jsonrpc":"2.0","method":"ledger_getBatches","params":[[{random_batch_num}], "Full"],"id":1}}"#),
       expected: format!(r#"{{"jsonrpc":"2.0","result":[{{"hash":"0x{batch_hash}","tx_range":{{"start":{first_tx_num},"end":{last_tx_num}}},"txs":[{tx_full_data}],"custom_receipt":{batch_receipt}}}],"id":1}}"#)},

Possible causes

It is pretty hard to track down the cause of failure for this test. The CI fails randomly a variable number of test cases, this test also randomly passes.
The failure is due to the fact that the list of transaction hashes expected does not match the list of transaction hashes delivered by rpc. The order of the transactions is modified and sometimes new hashes appear randomly to the transaction list.
It seems that this is probably a concurrency issue in the way rpc handles incoming transactions concurrently. The handlers and the code for the test are all mono threaded. It may also be an error related to CI configuration. This test sends a significant number of requests concurrently to RPC.

@neysofu
Copy link
Member

neysofu commented Jul 5, 2023

Fixed by #443.

@neysofu neysofu closed this as completed Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants