Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Add musig tests #106

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

alanorwick
Copy link

No description provided.

messageDigest: "0000000000000000000000000000000000000000000000000000000000000000",
signature: "b75dea1788881b057ff2a2d5c2847a7bebbfe8d8f9c0d3e76caa7ac462f065780b979f9f782580dc8c410105eda618e3334236428a1522e58c1cb9bdf058a308",
expectedResult: false,
},
Copy link
Member

Choose a reason for hiding this comment

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

I believe the verifier should reject pubkey==generator, right? Need a test for that


// Encode the modified signature back to hex format
modifiedSigHex := hex.EncodeToString(signatureBytes)
t.Log("Modified Signature: ", modifiedSigHex)
Copy link
Member

Choose a reason for hiding this comment

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

You build the modified sig, but then you don't check it against expected result

Copy link
Author

Choose a reason for hiding this comment

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

Used this to generate it for the test case above, likely should be considered dead code.


// Encode the modified signature back to hex format
modifiedSigHex := hex.EncodeToString(signatureBytes)
t.Log("Modified Signature: ", modifiedSigHex)
Copy link
Member

Choose a reason for hiding this comment

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

again, computed sig is not verified

Copy link
Author

Choose a reason for hiding this comment

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

Same as above

// Encode the modified signature back to hex format
modifiedSigHex := hex.EncodeToString(signatureBytes)
t.Log("Modified Signature: ", modifiedSigHex)
}
Copy link
Member

Choose a reason for hiding this comment

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

There are no tests here for pubkey/signature aggregation

@@ -80,45 +71,33 @@ func TestSingleSigner(t *testing.T) {
}
Copy link
Member

Choose a reason for hiding this comment

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

single signer should use musig, not schnorr

@@ -80,45 +71,33 @@ func TestSingleSigner(t *testing.T) {
}

func TestMultiSigners(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

please build these into test vectors, like you do for the test below.

e.g. provide a list of pubkeys with different corner cases (generator, off the curve, etc), and provide expected results.

What you have right now doesn't exercise failures due to combining invalid keys, etc

Copy link
Member

@wizeguyy wizeguyy left a comment

Choose a reason for hiding this comment

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

please squash your commits

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants