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

Implemented tests and validation for P2MS #257

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

Conversation

supreme2580
Copy link
Contributor

  • issue #
  • follows contribution guide
  • code change includes tests

Closes: #248

Copy link

vercel bot commented Oct 10, 2024

@supreme2580 is attempting to deploy a commit to the keep-starknet-strange Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@b-j-roberts b-j-roberts left a comment

Choose a reason for hiding this comment

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

Nice work so far!

}
}

// #[test]
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is currently not running, I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will confirm this and get back to you

}

#[test]
fn test_p2ms_edge_cases() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Which transaction is this testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@b-j-roberts This is to test cases of 1 of 1 multisig, 1 of 2 multisig with one of the keys being invalid and 2-of-3 multisig with maximum allowed public keys (20)

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add the txids to the script? If they are 3 separate transactions, they should all be different tests too and run validate 3 times ( one for each ).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will split asap

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@b-j-roberts I have split the edge cases into individual tests


#[test]
fn test_p2ms_1of1() {
// Test case for 1-of-1 multisig
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add the txid to this like the other tests above? Trying to verify this test


#[test]
fn test_p2ms_1of2_invalid_pubkey() {
// Test case for 1-of-2 multisig with an invalid public key
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add the txid to this as well?


let res = validate::validate_p2ms(@transaction, 0, utxo_hints);
assert!(res.is_err(), "P2MS 1-of-2 with invalid public key should fail validation");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There is also a 2-of-3 ms example and a 20-of-20 example that would be good to have tests for if you can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] Implement P2MS tests / features
2 participants