fix(test): fix HD Wallet message signing tests#2474
Conversation
| // This should fail: signature was created with pubkey from m/49'/141'/0'/0/0, | ||
| // but we are now resolving address from m/84'/141'/0'/0/0 | ||
| assert!( | ||
| !verify_response.result.is_valid, | ||
| "Expected verification to fail due to derivation path mismatch" | ||
| verify_response.result.is_valid, |
There was a problem hiding this comment.
checked the CI. it fails. and is_valid = false.
let's forget about the CI/test failure/passing now and keep the notion around the is_valid variable.
imo, i think is_valid is supposed to be false. i.e. if is_valid were true then this is a bug.
i will say why is that my belief and please tell me yours @borngraced:
we signed a message using pubkey = m/49'/141'/0'/0/0, and we are trying to verify it with pubkey = m/84'/141'/0'/0/0. and one can not sign a message and verify that signature from two different pubkeys. so i expect is_valid to be false (i.e., i see no bug).
There was a problem hiding this comment.
actually I think I get your point 💯 and that's because of the flow of the test...I will modify and hope you understand better
There was a problem hiding this comment.
at this point tbh my head is spinning hard. i would much rather prefer u to answer my question/tell me ur pov rather than change the test again :(
There was a problem hiding this comment.
i will say why is that my belief and please tell me yours
I guess the test is too explicit and didn't capture what I wanted to portray in a dynamic way...
So the test is supposed to activate COIN, do some signing and verification which should work, then, deactivate theCOIN, and reactivate again with new derivation path(without stopping MM2).. do some signing and verification which should now fail assuming we reuse sam DB path in the test.
In conclusion, I think the test is not 100% doing what I want it to do.
|
@mariocynicys once all your comments are resolved plus this #2474 (comment) , please merge the PR after your approval. |
mariocynicys
left a comment
There was a problem hiding this comment.
that's a starter quick review. since the test was ignored in the same commit it was modified in, there is no CI test runs of it.
so will unignore and try it locally and continue the review 👍
| } | ||
|
|
||
| /// Needs attention after [issue #2470](https://github.com/KomodoPlatform/komodo-defi-framework/issues/2470) is resolved. | ||
| /// Should not fail after [issue #2470](https://github.com/KomodoPlatform/komodo-defi-framework/issues/2470) is resolved. |
There was a problem hiding this comment.
nit: let's reword this to "This test fails until issue ...... is resolved"
|
nvm my previous comment about signing. it exploits the bug without signing and verifying. |
It definitely makes more sense to write the test the same way it was discovered IMO..can just include assert_eq |
i don't think we have to encode a complicated history of how the bug was discovered into the test (any first eye would be confused why we signing. let alone i was super confused to get started with this bug and i am supposedly following from the beginning).
i think u mean |
mariocynicys
left a comment
There was a problem hiding this comment.
Thanks for fixing this!
LGTM!
shamardy
left a comment
There was a problem hiding this comment.
Thanks a lot @borngraced @mariocynicys !
* dev: feat(walletconnect): add WalletConnect v2 support for EVM and Cosmos (#2223) feat(ibc-routing-part-1): supporting entire Cosmos network for swaps (#2459) fix(test): fix HD Wallet message signing tests (#2474) improvement(builds): enable static CRT linking for MSVC builds (#2464) feat(wallet): implement HD multi-address support for message signing (#2432)
* lr-swap-wip: (37 commits) fix custom token error name fix getting chain_id from protocol_data refactor (review): use dedicated large error cfg, add new fn to FromApiValueError, fix TODO, use experimental namespace for lr rpc, more Ticker alias feat(walletconnect): add WalletConnect v2 support for EVM and Cosmos (GLEECBTC#2223) feat(ibc-routing-part-1): supporting entire Cosmos network for swaps (GLEECBTC#2459) fix(test): fix HD Wallet message signing tests (GLEECBTC#2474) improvement(builds): enable static CRT linking for MSVC builds (GLEECBTC#2464) feat(wallet): implement HD multi-address support for message signing (GLEECBTC#2432) fix(p2pk): validate expected pubkey correctly for p2pk inputs (GLEECBTC#2408) chore(docs): update old urls referencing atomicdex or old docs pages (GLEECBTC#2428) improvement(p2p): remove hardcoded seeds (GLEECBTC#2439) fix(evm-api): find enabled erc20 token using platform ticker (GLEECBTC#2445) chore(docs): add DeepWiki badge to README (GLEECBTC#2463) chore(core): organize deps using workspace.dependencies (GLEECBTC#2449) feat(db-arch): more dbdir to address_dir replacements (GLEECBTC#2398) chore(build-artifacts): remove duplicated mm2 build artifacts (GLEECBTC#2448) feat(pubkey-banning): expirable bans (GLEECBTC#2455) fix(eth-balance-events): serialize eth address using AddrToString (GLEECBTC#2440) chore(deps): remove base58 and replace it completely with bs58 (GLEECBTC#2427) feat(tron): initial groundwork for full TRON integration (GLEECBTC#2425) ...
* dev: (30 commits) chore(core): replace hash_raw_entry with stable entry() API (GLEECBTC#2473) chore(core): adapt `MmError` and usages for compatibility with new rustc versions (GLEECBTC#2443) feat(wallet): add `delete_wallet` RPC (GLEECBTC#2497) chore(release): add changelog entries for v2.5.0-beta (GLEECBTC#2494) chore(release): bump kdf version to 2.5.0-beta (GLEECBTC#2492) feat(tests): zcoin unit test to validate dex fee (GLEECBTC#2460) fix(zcoin): correctly track unconfirmed z-coin notes (GLEECBTC#2331) improvement(orders): remove BTC specific volume from min_trading_vol logic (GLEECBTC#2483) feat(ibc-routing-part-2): supporting entire Cosmos network for swaps (GLEECBTC#2476) fix(startup): don't initialize WalletConnect during startup (GLEECBTC#2485) fix(dns): better ip resolution (GLEECBTC#2487) improvement(event-streaming): strong type streamer IDs (GLEECBTC#2441) bump timed-map to `1.4.1` (GLEECBTC#2481) improvement(RPC): unified interface for legacy and current RPC interfaces (GLEECBTC#2450) improvement(tendermint): `tendermint_tx_internal_id` helper (GLEECBTC#2438) feat(walletconnect): add WalletConnect v2 support for EVM and Cosmos (GLEECBTC#2223) feat(ibc-routing-part-1): supporting entire Cosmos network for swaps (GLEECBTC#2459) fix(test): fix HD Wallet message signing tests (GLEECBTC#2474) improvement(builds): enable static CRT linking for MSVC builds (GLEECBTC#2464) feat(wallet): implement HD multi-address support for message signing (GLEECBTC#2432) ... # Conflicts: # mm2src/coins/qrc20.rs # mm2src/mm2_main/src/lp_swap/maker_swap.rs
No description provided.