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(tariscript): multisig ordered signatures and pubkeys #5961

Merged
merged 8 commits into from
Nov 17, 2023

Conversation

brianp
Copy link
Contributor

@brianp brianp commented Nov 16, 2023

Description

Update the multisig op code checks to care about the order of keys and signatures. This is to assist with reducing the amount of iterations and processing a node is required to perform to validate a collection.

Motivation and Context

Low/Minor audit issue to reduce processing for nodes.

Closes: #5806

How Has This Been Tested?

Test suite / CI

What process can a PR reviewer use to test or verify this change?

Look at the test additions. They make it more clear what the effects of the changes are.

Breaking Changes

  • None
  • Requires data directory on base node to be deleted
  • Requires hard fork
  • Other - Please specify

Copy link

github-actions bot commented Nov 16, 2023

Test Results (CI)

1 254 tests   1 254 ✔️  13m 10s ⏱️
     39 suites         0 💤
       1 files           0

Results for commit 1217093.

♻️ This comment has been updated with latest results.

@ghpbot-tari-project ghpbot-tari-project added P-acks_required Process - Requires more ACKs or utACKs P-reviews_required Process - Requires a review from a lead maintainer to be merged labels Nov 16, 2023
Copy link

github-actions bot commented Nov 16, 2023

Test Results (Integration tests)

31 tests   31 ✔️  15m 3s ⏱️
11 suites    0 💤
  2 files      0

Results for commit 1217093.

♻️ This comment has been updated with latest results.

infrastructure/tari_script/src/script.rs Outdated Show resolved Hide resolved
infrastructure/tari_script/src/script.rs Outdated Show resolved Hide resolved
infrastructure/tari_script/src/script.rs Outdated Show resolved Hide resolved
}

for pk in pub_keys.by_ref() {
if !sig_set.contains(s) && s.verify_raw_canonical(pk, &message) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The use of verify_raw_canonical means that message must safely bind the public key. In this case, it is identical across the full set of allowed public keys, which technically breaks Fiat-Shamir. In practice, it means that a forger would need to target any one of the public keys, the complexity of which depends on the number of public keys in the set.

Copy link
Collaborator

Choose a reason for hiding this comment

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

See #5817 for a related issue.

Require the ordering of the pubkeys and signatures to matter. If the
signatures or pubkeys are out of order the likelyhood of passing
decreases.
Remove the check that a key has been validated previously. With ordered
sigs and keys a key will only ever be checked once so we don't need to
confirm if it's already provided a valid sig.

It's also confusing because Alice can provide two sigs against her pub
key but she has to provide the pubkey twice. The language here made that
a litle confusing.
@SWvheerden SWvheerden merged commit 14e334a into tari-project:development Nov 17, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-acks_required Process - Requires more ACKs or utACKs P-reviews_required Process - Requires a review from a lead maintainer to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Malicious script makes validators waste computations
4 participants