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(core): remove implicit change in protocol for partial/full signatures #5488

Conversation

sdbondi
Copy link
Member

@sdbondi sdbondi commented Jun 22, 2023

Description

Removes check for an invalid signature, presumed to be a partial signature, which results in partial signature aggregation being skipped if a valid signature is passed in.

Motivation and Context

This check validates the receiver signature to determine if the signature is sent is partial or full. If partial we aggregate the sender and receiver partial signatures. A partial signature and an invalid signature run the same code path ( if received_output.verify_metadata_signature().is_err() {) This code branch is executed as part of every normal Tari transaction.

It is not possible for the (non-local) receiver to unilaterally produce a correct signature and "bypass" aggregation as they do not possess the required secrets. The primary reason for this check is to allow the protocol to be shortcut when the sender and receiver are the same party and therefore can produce a valid signature (sign_as_sender_and_receiver). This PR implements this shortcut explicitly by adding a separate call for this case add_presigned_recipient_info.

How Has This Been Tested?

Existing transaction tests.

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

Send a normal and send-to-self transaction

Breaking Changes

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

@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 Jun 22, 2023
@sdbondi sdbondi marked this pull request as draft June 22, 2023 15:33
@github-actions
Copy link

github-actions bot commented Jun 22, 2023

Test Results (Integration tests)

26 tests  +26   26 ✔️ +26   1h 41m 58s ⏱️ + 1h 41m 58s
11 suites +11     0 💤 ±  0 
  2 files   +  2     0 ±  0 

Results for commit 7a12c6c. ± Comparison against base commit 36d8b76.

♻️ This comment has been updated with latest results.

@sdbondi sdbondi force-pushed the core-tx-protocol-remove-full-sig-check branch from 9e6c71a to ca62aee Compare June 23, 2023 07:30
@sdbondi sdbondi force-pushed the core-tx-protocol-remove-full-sig-check branch from ca62aee to 7a12c6c Compare June 23, 2023 07:37
@sdbondi sdbondi marked this pull request as ready for review June 23, 2023 07:38
@sdbondi sdbondi changed the title fix(core): remove codepath for invalid signature fix(core): remove implicit partial signature check Jun 23, 2023
@github-actions
Copy link

Test Results (CI)

1 170 tests   1 170 ✔️  27m 7s ⏱️
     37 suites         0 💤
       1 files           0

Results for commit 7a12c6c.

@sdbondi sdbondi changed the title fix(core): remove implicit partial signature check fix(core): remove implicit change in protocol for partial/full signatures Jun 23, 2023
@SWvheerden SWvheerden merged commit fef701e into tari-project:development Jun 23, 2023
let received_output = &rec.output;
// we need to make sure we use our values here and not the received values.
let metadata_message = TransactionOutput::metadata_signature_message_from_parts(
&received_output.version,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible for a downgrade or other version mismatch to arise if the received output's version is not what the sender expected?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is now an issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks - completely agree there needs to be an explicit check for supported versions on both sides. FWIW currently, we have 1 enumerated version so I believe this can't be exploited.

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.

4 participants