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
Verify p2 delegated conditions signatures #17054
Verify p2 delegated conditions signatures #17054
Conversation
Thanks @MarvinQuevedo, the change looks good to me. We'll need a test added for this case. I think Note that the test has simulated requests and responses starting at https://github.com/Chia-Network/chia-blockchain/blob/main/tests/wallet/rpc/test_wallet_rpc.py#L2097, so it should be fairly simple to add another request/response case for the p2 delegated conditions signing scheme. Thanks for the addition! |
Pull Request Test Coverage Report for Build 7224443800Warning: This coverage report may be inaccurate.We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
💛 - Coveralls |
Hi @paninaro I just added the test data, I test using the wallet UI and everything seems to be going well |
@paninaro I fixed the error message in the unit test for the invalid signature |
I just refactor the param type because it break the build process |
I just reformatter the files with back formatter, If It need any other change, please tell me about, thanks! |
Imports sorted |
I will to continue checking why in some cases don't pass the test |
@paninaro I found the error, I fixed the test data and It would be ok now with the signatures test, thanks! |
@paninaro only has a error with the core test, It's ok or need to pull the main to try to obtain all test passed? |
@MarvinQuevedo thanks for working through the test errors. This last issue doesn't appear to be related to your PR so I'll just re-run it to see if it passes. This looks good to me now. I did spend a bit of time yesterday trying to work through the test failures. The challenge I ran into is that it's not trivial to create a signature using this scheme. It would be nice if |
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.
lgtm and thanks!
Yes, the problem It's that for default ChiaWallet are not using this puzzle, the idea of have at least the verification it's can have a oficial way to check this signatures, for these dAPP can verify the Tangem Signatures and with it the Tangem Card can join the most completely posible in the Chia Blockchain ecosystem an can verify theirs NFT, DID and new features that can develop later. Thanks for all your time too! |
Refactor the
/verify_signature
API endpoint to support the verification process for signatures generated with Tangem Cards. Tangem Cards utilize a distinct puzzle. When crafting a signature with this hardware wallet, the synthetic_public_key is not employed. Consequently, when a developer attempts to verify the signature, the initial BLS signature verification step is successful. However, challenges arise when attempting to recreate the puzzle for comparing the PuzzleHash, as they are not equal. Now, if it is a Tangem Signature, the code recreates the Puzzle with the PublicKey using the p2_delegated_conditions puzzle, which is equivalent to the TangemCard puzzle, It allow verify correctly the signature maked with a Tangem Card.Introduce a new SigningMode to identify signatures produced with Tangem Cards using CHIP_002:
CHIP_0002_P2_DELEGATED_CONDITIONS = "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_AUG:CHIP-0002_P2_DELEGATED_PUZZLE"