Skip to content
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

fix: update second_sign method to use schnorr #106

Merged
merged 10 commits into from
Feb 5, 2020

Conversation

galperins4
Copy link
Contributor

Summary

Update the second sign function to use Schnorr

The current code is broken. First sign is Schnorr and second sign was ECSDA which led transactions having issues being verified since they were not correct

Updated a single function in base.py

Checklist

  • Documentation (if necessary)
  • Tests (if necessary)
  • Ready to be merged

@ghost
Copy link

ghost commented Jan 26, 2020

Thanks for submitting this pull request! A maintainer will review this in the next few days and explicitly select labels so you know what's going on.

If no reviewer appears after a week, a reminder will be sent out.

@ghost ghost added the Complexity: Low Less than 64 lines changed. label Jan 26, 2020
@faustbrian faustbrian changed the title fix - update secondsign to use schnorr fix: update second_sign method to use schnorr Jan 26, 2020
@ItsANameToo
Copy link
Member

Can you add a test that includes the second signature so this gets caught in any future versions? Just for transfer will suffice for now.

Copy link
Member

@ItsANameToo ItsANameToo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additionally, it requires a fix in transactions/serializer.py. You'll have to change elif self.transaction.get('signSignature'): to if not skip_second_signature and self.transaction.get('signSignature'):

crypto/transactions/builder/base.py Outdated Show resolved Hide resolved
@@ -162,6 +162,16 @@ def verify_schnorr(self):

return is_valid

def verify_schnorr_secondsig(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires a secondPublicKey parameter

crypto/transactions/transaction.py Outdated Show resolved Hide resolved
crypto/transactions/transaction.py Outdated Show resolved Hide resolved
@ItsANameToo
Copy link
Member

After that you can add a tests in tests/transactions/builder/test_transfer.py that is similar to the existing transfer test, but will now have a second passphrase added and verified (for verifying you can use something like transaction.schnorr_verify_second(PublicKey.from_passphrase('this is a top secret passphrase too'), just make sure it matches the passphrase you used to second sign with)

@galperins4
Copy link
Contributor Author

@ItsANameToo I made all the changes suggested and added the extra test. Feel free to re-review.

crypto/transactions/builder/base.py Outdated Show resolved Hide resolved
tests/transactions/builder/test_transfer.py Outdated Show resolved Hide resolved
@galperins4
Copy link
Contributor Author

All updated. I think this is ready now.

@ghost ghost added the Status: Member Approved The pull request has been approved by a member. label Feb 5, 2020
@ghost
Copy link

ghost commented Feb 5, 2020

A member has approved this PR. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait.

Thank you for your contribution!

@ItsANameToo ItsANameToo added the Bounty: Tier 4 Awarded for small features, refactorings, improvements. This is valued at 20 USD. label Feb 5, 2020
@ItsANameToo ItsANameToo merged commit 5fff385 into ArkEcosystem:develop Feb 5, 2020
@ghost
Copy link

ghost commented Feb 5, 2020

Your pull request has been merged and marked as tier 4. It will earn you $20 USD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bounty: Tier 4 Awarded for small features, refactorings, improvements. This is valued at 20 USD. Complexity: Low Less than 64 lines changed. Status: Member Approved The pull request has been approved by a member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants