entropyxyz / entropy-core

Protocol and cryptography development.
https://docs.entropy.xyz/
GNU Affero General Public License v3.0
11 stars 2 forks source link

Add test helper function which stores a program and registers a user #1036

Closed ameba23 closed 2 months ago

ameba23 commented 2 months ago

Now that we no longer have pre-registered accounts, in order to test signing we need to first store a program and register a user. To reduce boilerplate in our siging tests, this adds a test helper function which stores a default program and registers a user using that program.

I've also made a change to the get_sign_tx_data test helper function. It now takes the verifying key as an argument, rather than defaulting to DAVE_VERIFYING_KEY, and sets the block number to the current block number rather than defaulting to zero.

One unrelated thing i noticed: We have a test called signature_request_with_derived_account_works which looks to me like it doesn't test anything extra than our other signing tests - it is left over from when we had two different signing flows. Do yous think we can get rid of it? https://github.com/entropyxyz/entropy-core/blob/624b37d3bad1acdee74f724c7a2cf2a3e2ab0159/crates/threshold-signature-server/src/user/tests.rs#L320