-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
device/trezor: integration tests #4977
Conversation
After going through the PR again I am seriously thinking about small refactoring, namely:
What do you think @moneromooo-monero ? |
It will take me a bit to have an opinion, given 3k lines. |
36fd6fa
to
3fd9c5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. I've not looked at the test stuff yet.
m_features = client_exchange<messages::management::Features>(msg); | ||
} | ||
|
||
void device_trezor_base::load_device(const std::string & mnemonic, const std::string & pin, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wipeable_string ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is applicable only with debugging Trezor firmware, basically with an emulator for integration tests. It cannot be used on production so I thought normal strings would do the job here.
Thanks for the review. I am a bit slammed at the moment but I will get to that on 28th Jan. |
Tests: this is pretty chunky, but it seems OK overall, though I read through quickly. Feel free to do whatever cleanup you mentioned, but overall this seems fine. Some explanations of the main changes to the core test machinery would be nice, the core test code is hard to understand (for me anyway). |
6bb5728
to
575eea2
Compare
I am working on getting tests back running after the rebase. I will ping once it's done. |
OK tests are passing again |
I've added chain serialization/deserialization so the initial blockchain that is required for subsequent payment tests is not generated with each test run. The argument The #5122 is required for chain save/load work correctly. @moneromooo-monero I've updated PR description to better explain what is going on in the tests. |
That seems odd. There are rct and BP core tests, and they pass. |
I mean, the transactions in the tests are constructed manually (the transaction is constructed in quite a detailed way, setting inputs and so on). My motivation for changes was to add an easy way to create various transaction types on the chain for the further testing.
With the modifications I made to the chaingen it is easy to generate various transactions on the chain (like using subaddresses, RCTv2), example of the chain generation: https://github.com/ph4r05/monero/blob/271272f91bd13a8e85ff2fd066cc7fbf53e2f65a/tests/trezor/trezor_tests.cpp#L696 Then tests make use of various transactions present on the blockchain so the TX signature test covers more code paths. |
Ah, OK, that might be true. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm fine with it generally. I don't like wallet2.h being included in the chaingen.h though, I see it wants transfer_details now, anything else ? If not, given transfer_details is not wallet specific, maybe it could be moved in cryptonote_core somewhere. It'd also please endogenic I think :)
f8a806b
to
2f0ebfb
Compare
Wallet2 is quite used in the I've added another commit to this PR which separates wallet code from the If you think this new approach is more clean I can squash it then. |
I think it makes more sense, yes. Thanks. |
I like it more like this also. Squashed. |
Anyone else planning to review this ? |
@moneromooo-monero I noticed a discussion on the IRC and I think these tests could be easily modified to support also Ledger. The core could be the same, just the transaction signature would go to the Ledger instead of the Trezor. |
Are you saying you're willing to do that ? If so that's great :) This is probably going to get merged soon, since I kinda doubt anyone is really going to review as well, so another PR on top would be best, unless you think a lot of shuffling around is needed first. |
Well... I can certainly help with that but I am busy to do it on my own 😅 Regarding the shuffling - I think this is OK for now. The heavy changes has been made in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, let it be approved for now, and it'll get merge soon unless someone else wants to review asap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed
5ea1790 device/trezor: debugging features, trezor tests (Dusan Klinec)
This PR adds integration tests with the Trezor emulator.
How it works
tools::wallet2
for this.I needed to get RCT and Bulletproof transaction working with
chaingen.cpp
functions so I had to do some overhaul of thechaingen
. The changes can either stay as they are or I can move this modified version ofchaingen
to the trezor tests directory. Depends on the reviews.The common blockchain created at the beginning of the Trezor tests can be saved to a file so the it is not generated with each test run. The argument
--chain_path
provides path where to save/load the common chain. The #5122 is required for chain save/load work correctly.Testing
You first need to get Trezor emulator running. Ideally follow official building documentation.
Emulator can run in the Docker. I will add instructions later.
Summary for Trezor emulator build:
To build and run Monero integration tests: