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

feat: add pre-mine spend #6442

Merged

Conversation

hansieodendaal
Copy link
Contributor

Description

Added pre-mine spend with improved logging for fault finding

Motivation and Context

Pre-mine spending did not work.

How Has This Been Tested?

A new esmeralda genesis block that includes pre-mine with a 2-of-3 scheme and a backup spending wallet was created, utilizing 4x ledger console wallets. Those wallets were then used to spend the 1st pre-mine UTXO. The UTXO was successfully mined and imported into the target wallet.

Leader's ledger console wallet console:

PS C:\Users\pluto\.tari-Hansie\node_01> .\minotari_console_wallet.exe --base-path . --network esmeralda --config $pwd"\config\config.toml" --log-config $pwd"\config\log4rs_console_wallet.yml" pre-mine-spend-session-info --fee-per-gram 5 --output-index 0 --recipient-address f27jozcSQjY2QfopvAeuNMDJX5z9T6vThdBRSteaanwecG1F31ez7vUUCVCihFL6UrJHLVY9EPxkRrgHJLwdPJNxtz4 --verify-unspent-outputs
Initializing logging according to "C:\\Users\\pluto\\.tari-Hansie\\node_01\\config\\log4rs_console_wallet.yml"
Minotari Console Wallet running... (Command mode started)
==============
Command Runner
==============

1. PreMineSpendSessionInfo(PreMineSpendSessionInfoArgs { fee_per_gram: MicroMinotari(5), output_index: 0, recipient_address: Dual(DualAddress { network: Esmeralda, features: TariAddressFeatures(1), public_view_key: 4c5b2793fc2504965138bebf97862af0865ff249e3b8e69b06d441dab0f70346, public_spend_key: b492d5ddf85688c452765180b6e18cc31a0a3ee401ec275d67118145d97cbd67 }), verify_unspent_outputs: true })


Concluded step 1 'pre-mine-generate-session-info'
Your session ID is:                 '8Tj5eMbr7Z3NXUs3'
Your session's output directory is: 'C:\Users\pluto\Documents\tari_pre_mine\spend\8Tj5eMbr7Z3NXUs3'
Session info saved to:              'C:\Users\pluto\Documents\tari_pre_mine\spend\8Tj5eMbr7Z3NXUs3\step_1_session_info.json'
Send 'step_1_session_info.json' to parties for step 2

Minotari Console Wallet running... (Command mode completed)

Shutting down wallet... Done.
PS C:\Users\pluto\.tari-Hansie\node_01> .\minotari_console_wallet.exe --base-path . --network esmeralda --config $pwd"\config\config.toml" --log-config $pwd"\config\log4rs_console_wallet.yml" pre-mine-spend-encumber-aggregate-utxo --session-id 8Tj5eMbr7Z3NXUs3 --input-file-names=step_2_for_leader_from_carol.json
Initializing logging according to "C:\\Users\\pluto\\.tari-Hansie\\node_01\\config\\log4rs_console_wallet.yml"
Minotari Console Wallet running... (Command mode started)
==============
Command Runner
==============

1. PreMineSpendEncumberAggregateUtxo(PreMineSpendEncumberAggregateUtxoArgs { session_id: "8Tj5eMbr7Z3NXUs3", input_file_names: ["step_2_for_leader_from_carol.json"] })


Concluded step 3 'pre-mine-encumber-aggregate-utxo'
Send 'step_3_for_parties.json' to parties for step 4

Minotari Console Wallet running... (Command mode completed)

Shutting down wallet... Done.
PS C:\Users\pluto\.tari-Hansie\node_01> .\minotari_console_wallet.exe --base-path . --network esmeralda --config $pwd"\config\config.toml" --log-config $pwd"\config\log4rs_console_wallet.yml" pre-mine-spend-aggregate-transaction --session-id 8Tj5eMbr7Z3NXUs3 --input-file-names=step_4_for_leader_from_carol.json
Initializing logging according to "C:\\Users\\pluto\\.tari-Hansie\\node_01\\config\\log4rs_console_wallet.yml"
Minotari Console Wallet running... (Command mode started)
==============
Command Runner
==============

1. PreMineSpendAggregateTransaction(PreMineSpendAggregateTransactionArgs { session_id: "8Tj5eMbr7Z3NXUs3", input_file_names: ["step_4_for_leader_from_carol.json"] })


Concluded step 5 'pre-mine-spend-aggregate-utxo'

Minotari Console Wallet running... (Command mode completed)

Shutting down wallet... Done.
PS C:\Users\pluto\.tari-Hansie\node_01>

Party member's ledger console wallet console:

PS C:\Users\pluto\.tari-Hansie\node_03> .\minotari_console_wallet.exe --base-path . --network esmeralda --config $pwd"\config\config.toml" --log-config $pwd"\config\log4rs_console_wallet.yml" pre-mine-spend-party-details --alias carol --output-index 0 --input-file "C:\Users\pluto\Documents\tari_pre_mine\spend\8Tj5eMbr7Z3NXUs3\step_1_session_info.json"
Initializing logging according to "C:\\Users\\pluto\\.tari-Hansie\\node_03\\config\\log4rs_console_wallet.yml"
Minotari Console Wallet running... (Command mode started)
==============
Command Runner
==============

1. PreMineSpendPartyDetails(PreMineSpendPartyDetailsArgs { input_file: "C:\\Users\\pluto\\Documents\\tari_pre_mine\\spend\\8Tj5eMbr7Z3NXUs3\\step_1_session_info.json", output_index: 0, alias: "carol" })


Concluded step 2 'pre-mine-create-party-details'
Your session's output directory is 'C:\Users\pluto\Documents\tari_pre_mine\spend\8Tj5eMbr7Z3NXUs3'
Send 'step_2_for_leader_from_carol.json' to leader for step 3

Minotari Console Wallet running... (Command mode completed)

Shutting down wallet... Done.
PS C:\Users\pluto\.tari-Hansie\node_03> .\minotari_console_wallet.exe --base-path . --network esmeralda --config $pwd"\config\config.toml" --log-config $pwd"\config\log4rs_console_wallet.yml" pre-mine-spend-input-output-sigs --session-id 8Tj5eMbr7Z3NXUs3
Initializing logging according to "C:\\Users\\pluto\\.tari-Hansie\\node_03\\config\\log4rs_console_wallet.yml"
Minotari Console Wallet running... (Command mode started)
==============
Command Runner
==============

1. PreMineSpendInputOutputSigs(PreMineSpendInputOutputSigArgs { session_id: "8Tj5eMbr7Z3NXUs3" })


Concluded step 4 'pre-mine-create-input-output-sigs'
Send 'step_4_for_leader_from_carol.json' to leader for step 5

Minotari Console Wallet running... (Command mode completed)

Shutting down wallet... Done.
PS C:\Users\pluto\.tari-Hansie\node_03>

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

Code review
System-level testing

Breaking Changes

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

Added pre-mine spend with improved logging for fault finding
@hansieodendaal hansieodendaal requested a review from a team as a code owner August 2, 2024 08:32
Copy link

github-actions bot commented Aug 2, 2024

Test Results (Integration tests)

 2 files  + 2   1 errors  9 suites  +9   11m 24s ⏱️ + 11m 24s
19 tests +19  18 ✅ +18  0 💤 ±0  1 ❌ +1 
20 runs  +20  19 ✅ +19  0 💤 ±0  1 ❌ +1 

For more details on these parsing errors and failures, see this check.

Results for commit c1eb2ed. ± Comparison against base commit af1f451.

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

github-actions bot commented Aug 2, 2024

Test Results (CI)

    3 files    123 suites   42m 7s ⏱️
1 299 tests 1 298 ✅ 0 💤 1 ❌
3 892 runs  3 891 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit c1eb2ed.

♻️ This comment has been updated with latest results.

Copy link
Collaborator

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

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

Key manager should not impose limitations on which keys it must use where.
That must be decided by the calling logic.
The key manager should look at the key type and decide what to do.

base_layer/core/src/transactions/key_manager/inner.rs Outdated Show resolved Hide resolved
base_layer/core/src/transactions/key_manager/inner.rs Outdated Show resolved Hide resolved
base_layer/core/src/transactions/key_manager/inner.rs Outdated Show resolved Hide resolved
base_layer/core/src/transactions/key_manager/inner.rs Outdated Show resolved Hide resolved
base_layer/core/src/transactions/key_manager/inner.rs Outdated Show resolved Hide resolved
base_layer/core/src/transactions/key_manager/inner.rs Outdated Show resolved Hide resolved
base_layer/core/src/transactions/key_manager/inner.rs Outdated Show resolved Hide resolved
base_layer/core/src/transactions/key_manager/inner.rs Outdated Show resolved Hide resolved
SWvheerden
SWvheerden previously approved these changes Aug 2, 2024
@brianp
Copy link
Contributor

brianp commented Aug 2, 2024

I haven't reviewed the changes yet but it is functional:

All scenarios produce spendable outputs.
✅ One-sided: Ledger -> Ledger
✅ One-sided: Ledger -> Software
✅ One-sided: Coinbase -> Ledger
✅ One-sided: Software -> Ledger
✅ Interactive: Software -> Ledger

@SWvheerden SWvheerden merged commit 0018126 into tari-project:development Aug 5, 2024
14 of 17 checks passed
@hansieodendaal hansieodendaal deleted the ho_pre_mine_spend branch August 5, 2024 07:34
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