tari-project / tari

The Tari protocol
https://tari.com
BSD 3-Clause "New" or "Revised" License
350 stars 218 forks source link

feat: add file-based input and output to faucet commands #6405

Closed hansieodendaal closed 3 months ago

hansieodendaal commented 3 months ago

Description

In this PR the following functionality were implemented:

The screen output running the m-of-n spend scenario is shown below.

Step 1 - FaucetGenerateSessionInfo

faucet-generate-session-info --fee-per-gram 5 --commitment b8b0ad44a4ac05d7c383ac6615c0ed7b14d0f25de42210e89f3191e605865361 
--output-hash 7018f30e8d6bbdce7d79709db9854589b0b645ed25624bc7a6b1be43a2eded26 
--recipient-address f48yg4or3d7AsKhVD5124wSzjEE7A1ZbANhyCsJJdmKF8jcfZCcoWiGRxeyauriwPPTMswxnpdUfdWtQ4qkaDgwPrsk 
--verify-unspent-outputs
Initializing logging according to "node_04\\config\\log4rs_console_wallet.yml"
Minotari Console Wallet running... (Command mode started)
==============
Command Runner
==============

1. FaucetGenerateSessionInfo(FaucetGenerateSessionInfoArgs { fee_per_gram: MicroMinotari(5), commitment: 
"b8b0ad44a4ac05d7c383ac6615c0ed7b14d0f25de42210e89f3191e605865361", output_hash: 
"7018f30e8d6bbdce7d79709db9854589b0b645ed25624bc7a6b1be43a2eded26", recipient_address: 
Dual(DualAddress { network: Esmeralda, features: TariAddressFeatures(3), public_view_key: 
5a658abfa39fb6828b3c267fdfabc4b764aab155d816dfac774649a83649071e, public_spend_key: 
7cf45a38904b23ca76ecd95aee5c1742fc1bf6fc0ef8cd6ee2ee28540f9edb40 }), verify_unspent_outputs: true })

Concluded step 1 'faucet-generate-session-info'
Your session ID is:                 'MakczWU9X2RgPXdz'
Your session's output directory is: '<user>\AppData\Local\tari_faucets\MakczWU9X2RgPXdz'
Session info saved to:              '<user>\AppData\Local\tari_faucets\MakczWU9X2RgPXdz\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.

Step 2 - FaucetCreatePartyDetails

faucet-create-party-details --input-file "<user>\AppData\Local\tari_faucets\step_1_session_info.json" --alias alice
Initializing logging according to "node_02\\config\\log4rs_console_wallet.yml"
Minotari Console Wallet running... (Command mode started)
==============
Command Runner
==============

1. FaucetCreatePartyDetails(FaucetCreatePartyDetailsArgs { session_id: "MakczWU9X2RgPXdz", input_file: "
<user>\\AppData\\Local\\tari_faucets\\step_1_session_info.json", alias: "alice" })

Concluded step 2 'faucet-create-party-details'
Your session's output directory is <user>\AppData\Local\tari_faucets\MakczWU9X2RgPXdz'
Session info file '<user>\AppData\Local\tari_faucets\step_1_session_info.json' moved to '<user>\AppData\Local\tari_faucets\MakczWU9X2RgPXdz\step_1_session_info.json'
Send 'step_2_for_leader_from_alice.json' to leader for step 3

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

Shutting down wallet... Done.

Step 3 - FaucetEncumberAggregateUtxo

faucet-encumber-aggregate-utxo --session-id MakczWU9X2RgPXdz --input-file-names=step_2_for_leader_from_alice.json
Initializing logging according to "node_04\\config\\log4rs_console_wallet.yml"
Minotari Console Wallet running... (Command mode started)
==============
Command Runner
==============

1. FaucetEncumberAggregateUtxo(FaucetEncumberAggregateUtxoArgs { session_id: "MakczWU9X2RgPXdz", input_file_names: ["step_2_for_leader_from_alice.json"] })

Concluded step 3 'faucet-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.

Step 4 - FaucetCreateInputOutputSigs

faucet-create-input-output-sigs --session-id MakczWU9X2RgPXdz
Initializing logging according to "node_02\\config\\log4rs_console_wallet.yml"
Minotari Console Wallet running... (Command mode started)
==============
Command Runner
==============

1. FaucetCreateInputOutputSigs(FaucetCreateInputOutputSigArgs { session_id: "MakczWU9X2RgPXdz" })

Concluded step 4 'faucet-create-input-output-sigs'
Send 'step_4_for_leader_from_alice.json' to leader for step 5

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

Shutting down wallet... Done.

Step 5 - FaucetSpendAggregateUtxo

faucet-spend-aggregate-utxo --session-id MakczWU9X2RgPXdz --input-file-names=step_4_for_leader_from_alice.json
Initializing logging according to "node_04\\config\\log4rs_console_wallet.yml"
Minotari Console Wallet running... (Command mode started)
==============
Command Runner
==============

1. FaucetSpendAggregateUtxo(FaucetSpendAggregateUtxoArgs { session_id: "MakczWU9X2RgPXdz", input_file_names: ["step_4_for_leader_from_alice.json"] })

Concluded step 5 'faucet-spend-aggregate-utxo'

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

Shutting down wallet... Done.

Motivation and Context

Manual inputs are cumbersome and prone to errors.

How Has This Been Tested?

System-level testing

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

Review code changes Perform system-level testing

Breaking Changes

github-actions[bot] commented 3 months ago

Test Results (CI)

    3 files    111 suites   35m 51s :stopwatch: 1 295 tests 1 294 :white_check_mark: 0 :zzz: 1 :x: 3 673 runs  3 672 :white_check_mark: 0 :zzz: 1 :x:

For more details on these failures, see this check.

Results for commit f9acc2cc.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 3 months ago

Test Results (Integration tests)

 2 files  + 2  11 suites  +11   15m 3s :stopwatch: + 15m 3s 35 tests +35  34 :white_check_mark: +34  0 :zzz: ±0  1 :x: +1  37 runs  +37  34 :white_check_mark: +34  0 :zzz: ±0  3 :x: +3 

For more details on these failures, see this check.

Results for commit f9acc2cc. ± Comparison against base commit 7d0281b7.

:recycle: This comment has been updated with latest results.