forest: SignedMessage::new_from_part result in 'Secp signature verification failed' error because of Network value
Describe the bug
Cannot build SignedMessage using new_from_part because the recovered address has the wrong network.
See here : https://github.com/ChainSafe/forest/blob/main/crypto/src/signature.rs#L150
To Reproduce See this issue with the test case using testnet and mainnet address : https://github.com/Zondax/filecoin-signing-tools/issues/422
Expected behaviour I expect the recovered address to have the same network value than in the unsigned message.
Other information and links All the step https://github.com/ChainSafe/forest/blob/4eb74f908375d7ea0f97fa8e47a3da0e2e619357/vm/message/src/signed_message.rs#L29 https://github.com/ChainSafe/forest/blob/main/crypto/src/signature.rs#L105 https://github.com/ChainSafe/forest/blob/main/crypto/src/signature.rs#L136 https://github.com/ChainSafe/forest/blob/main/crypto/src/signature.rs#L150 https://github.com/ChainSafe/forest/blob/main/crypto/src/signature.rs#L187 https://github.com/ChainSafe/forest/blob/main/crypto/src/signature.rs#L200
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (13 by maintainers)
Commits related to this issue
- #1419 - fix signature verification fiasco — committed to ChainSafe/forest by LesnyRumcajs 2 years ago
- #1419 - fix signature verification fiasco (#1437) — committed to ChainSafe/forest by LesnyRumcajs 2 years ago
Hey, great discussion here!
tvsffor everything except UX. Lotus does this with one exception – the internal wallet keystore is indexed by the address string, including the network version (but this is fully internal and not consensus-relevant).posted this https://github.com/filecoin-project/FIPs/discussions/301 and proposed an FIP.
@q9f This is what a transaction looks like
If this is the case, we might want to bring this up during the next core dev call…
We are all new here 🤣
The problem is, as far as I understand it, that we default to mainnet in case we are not running a configured client/daemon.
How do the crypto crates function if they are only tasked to recover a signature? The TODO in the address crate suggests that someone stumbled upon that before us already and suggested there need to be more flexibility.
Hi @q9f
I verified the signature independently and it is a valid one. I tried then to get the recovered address and I had the same
payloadvalue but a differentnetwork.I also notice that. I am not sure what I did that would make it work for testnet but not mainnet. It does bug me.