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

functional_daemon_test does not pass on first test run on local setup #56

Closed
LeoNero opened this issue Jul 8, 2022 · 4 comments
Closed

Comments

@LeoNero
Copy link
Member

LeoNero commented Jul 8, 2022

functional_daemon_test, defined inside tests/rpc.rs does not pass when running cargo test the first time WHEN there are no blocks in the regtest network, but it works if there is.

Also, the test pass for the test workflow in the repository, probably because the tests run concurrently and the wallet test creates blocks before the daemon test runs.

As a solution, a block can first be created. Or, if the intention is to test a possible failure, then just test the Error returned.

This issue is related to #48


Error returned by cargo test --tests rpc:

'functional_daemon_test' panicked at 'called `Result::unwrap()` on an `Err` value: Server error: Requested block height: 1 greater than current top block height: 0

Line that causes the error is line 27 https://github.com/monero-ecosystem/monero-rpc-rs/blob/master/tests/rpc.rs#L27

@LeoNero
Copy link
Member Author

LeoNero commented Jul 9, 2022

I did more debugging and functional_daemon_test always pass on v0.17.3.2 but almost always does not pass on master.

@LeoNero
Copy link
Member Author

LeoNero commented Jul 9, 2022

Cool, on v0.17.3, it returns:

{
  "id": "0",
  "jsonrpc": "2.0",
  "result": "0000000000000000000000000000000000000000000000000000000000000000"
}

On master:

{                                                                                                                                   
    "error": {                                                                                                                      
        "code": -2,                                                                                                                 
        "message": "Requested block height: 1 greater than current top block height: 0"                                             
    },                                                                                                                             
    "id": "0",                                                                                                                     
    "jsonrpc": "2.0"                                                                                                               
}

Edit: looking at the code, it ends up to a call to BlockchainLMDB::height(), defined at master https://github.com/monero-project/monero/blob/8f48f464957c875af3183cd9d35769592e1aef48/src/blockchain_db/lmdb/db_lmdb.cpp#L2917 and v0.17.3.2 at https://github.com/monero-project/monero/blob/424e4de16b98506170db7b0d7d87a79ccf541744/src/blockchain_db/lmdb/db_lmdb.cpp#L2952

They are the same, so probably it was a change to lmdb's internals?

@LeoNero
Copy link
Member Author

LeoNero commented Jul 9, 2022

Ok, I saw what is going on. The last commit on master (8f48f464957c875af3183cd9d35769592e1aef48) has the same of v0.17.32 for the function core_rpc_server::on_getblockhash, but my local branch was at 9750e1fa103539b3e533455500610aae76e253a5 which has a different implementation.
See: https://github.com/monero-project/monero/blob/8f48f464957c875af3183cd9d35769592e1aef48/src/rpc/core_rpc_server.cpp#L1701, https://github.com/monero-project/monero/blob/424e4de16b98506170db7b0d7d87a79ccf541744/src/rpc/core_rpc_server.cpp#L1663, and https://github.com/monero-project/monero/blob/9750e1fa103539b3e533455500610aae76e253a5/src/rpc/core_rpc_server.cpp#L1706

Those changes are related to monero-project/monero#7936, monero-project/monero#7937, and monero-project/monero#8384

@LeoNero
Copy link
Member Author

LeoNero commented Jul 9, 2022

Closing now that the debug is over :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant