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!: don't use the ledger unless both keys are for ledger #6492

Merged
merged 5 commits into from
Aug 21, 2024

Conversation

brianp
Copy link
Contributor

@brianp brianp commented Aug 21, 2024

Description

Correct the key requests coming from the key manager in the

Motivation and Context

  • Correct the sign_with_nonce_and_challenge code path to properly request ledger keys only when both keys are to be derived from the ledger, otherwise use the software key manage
  • Fix the tari script serialization on the metadata signature to produce proper sigs
  • Refactor the function to generate TariScripts on the ledger to be something a bit simpler
  • Refactor the metadata signature domain hashing. We were doing hash(hash(script) + hash(common)) but this can be simplified to hash(script + hash(common). There's no need to hash the script by itself, before hashing it alongside the common hash.

How Has This Been Tested?

One sided sends are borked from ledger. TX creation is requesting the wrong keys from ledger.
Metadata signature generation is wrong.

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

Breaking Changes

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

The change in hashing function causes the gen block, and faucets to no longer match. This hashing change is a breaking change for the purpose of simplification.

@brianp brianp requested a review from a team as a code owner August 21, 2024 10:34
Copy link

github-actions bot commented Aug 21, 2024

Test Results (CI)

    3 files    126 suites   36m 20s ⏱️
1 300 tests 1 299 ✅ 0 💤 1 ❌
3 898 runs  3 897 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit ed131a9.

♻️ 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 Aug 21, 2024
Copy link

Test Results (Integration tests)

37 tests   37 ✅  16m 9s ⏱️
11 suites   0 💤
 2 files     0 ❌

Results for commit 2889e23.

SWvheerden
SWvheerden previously approved these changes Aug 21, 2024
@SWvheerden SWvheerden changed the title fix: don't use the ledger unless both keys are for ledger fix!: don't use the ledger unless both keys are for ledger Aug 21, 2024
@ghpbot-tari-project ghpbot-tari-project removed the P-reviews_required Process - Requires a review from a lead maintainer to be merged label Aug 21, 2024
@brianp brianp force-pushed the bp-fix-one-sided-send branch from ac6d44e to cbe0617 Compare August 21, 2024 14:09
SWvheerden
SWvheerden previously approved these changes Aug 21, 2024
@ghpbot-tari-project ghpbot-tari-project added the P-conflicts Process - The PR has merge conflicts that need to be resolved label Aug 21, 2024
@brianp brianp force-pushed the bp-fix-one-sided-send branch from bfef129 to ed131a9 Compare August 21, 2024 15:28
@ghpbot-tari-project ghpbot-tari-project added P-reviews_required Process - Requires a review from a lead maintainer to be merged and removed P-conflicts Process - The PR has merge conflicts that need to be resolved labels Aug 21, 2024
@SWvheerden SWvheerden merged commit cfb0b58 into tari-project:development Aug 21, 2024
11 of 13 checks passed
Copy link
Contributor

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -46,6 +44,7 @@ mod test {
const NOP_IDENTIFIER: &str = "0173";
const PUSH_ONE_IDENTIFIER: &str = "017c";
const CHECK_SIG_VERIFY_IDENTIFIER: &str = "21ad";
const PUSH_PUBKEY_IDENTIFIER: &str = "217e";
Copy link
Contributor

Choose a reason for hiding this comment

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

@brianp, we should not re-declare this here, rather include minotari_ledger_wallet_common::PUSH_PUBKEY_IDENTIFIER

@brianp brianp deleted the bp-fix-one-sided-send branch August 21, 2024 18:04
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