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: refactor incorrect cucumber test on burn funds via cli #4679

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
388cb9c
add burn funds to console wallet
jorgeantonio21 Sep 9, 2022
92090f5
Merge branch 'development' into ja_add_burn_funds_on_wallet
jorgeantonio21 Sep 9, 2022
017c164
Merge branch 'development' into ja_add_burn_funds_on_wallet
jorgeantonio21 Sep 12, 2022
bd428ed
rename BurnFunds to BurnTari
jorgeantonio21 Sep 12, 2022
56898f9
Merge branch 'ja_add_burn_funds_on_wallet' of github.com:jorgeantonio…
jorgeantonio21 Sep 12, 2022
81700a6
Merge branch 'development' into ja_add_burn_funds_on_wallet
jorgeantonio21 Sep 12, 2022
22abb29
add cucumber tests for burn via cli
jorgeantonio21 Sep 13, 2022
db8671e
Merge branch 'development' into ja_add_burn_funds_on_wallet
jorgeantonio21 Sep 13, 2022
6f91452
Merge branch 'ja_add_burn_funds_on_wallet' of github.com:jorgeantonio…
jorgeantonio21 Sep 13, 2022
dcd90fe
refactor cucumbers
jorgeantonio21 Sep 13, 2022
4f541a1
Update integration_tests/features/WalletCli.feature
stringhandler Sep 14, 2022
c9ab8cb
add changes
jorgeantonio21 Sep 14, 2022
964e358
Merge branch 'ja_add_burn_funds_on_wallet' of github.com:jorgeantonio…
jorgeantonio21 Sep 14, 2022
ee3db55
add local changes
jorgeantonio21 Sep 14, 2022
5e89d19
add changes
jorgeantonio21 Sep 14, 2022
846a6dd
refactor cucumber test for burn funds
jorgeantonio21 Sep 14, 2022
0912b2c
add test
jorgeantonio21 Sep 14, 2022
ad2744a
refactor test
jorgeantonio21 Sep 15, 2022
31965a0
Merge branch 'development' into ja_add_burn_funds_on_wallet
jorgeantonio21 Sep 15, 2022
c5161b6
Merge branch 'development' into ja_add_burn_funds_on_wallet
jorgeantonio21 Sep 16, 2022
01ab4d6
Update integration_tests/features/WalletCli.feature
stringhandler Sep 16, 2022
98fbe8f
Merge branch 'development' into ja_add_burn_funds_on_wallet
jorgeantonio21 Sep 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions integration_tests/features/WalletCli.feature
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,22 @@ Feature: Wallet CLI
And mining node MINE mines 5 blocks
Then I wait for wallet RECEIVER to have at least 1000000 uT


@critical
Scenario: As a user I want to burn tari via command line
Given I have a seed node SEED
And I have a base node BASE connected to seed SEED
And I have wallet WALLET_A connected to base node BASE
And I have wallet WALLET_B connected to base node BASE
And I have mining node MINER_A connected to base node BASE and wallet WALLET_A
And I have mining node MINER_B connected to base node BASE and wallet WALLET_B
And mining node MINER_A mines 15 blocks
And I have wallet WALLET connected to base node BASE
And I have mining node MINER connected to base node BASE and wallet WALLET
And mining node MINER mines 12 blocks
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could probably mine fewer blocks to make the calculations easier

Then I mine 3 blocks on BASE
Then all nodes are at height 15
When I wait for wallet WALLET_A to have at least 55000000000 uT
When I create a burn transaction of 45000000000 uT from WALLET_A via command line
Then I have mining node MINER_B mines 10 blocks
Then I get balance of wallet WALLET_A is at least 10000000000 uT via command line
When I wait for wallet WALLET to have at least 221552530060 uT
When I create a burn transaction of 201552500000 uT from WALLET via command line
Copy link
Contributor

Choose a reason for hiding this comment

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

This line currently does not spend all UTXOs in the wallet, but it shoud.

The average coinbase for the 1st 12 blocks is 18 462 710 838 uT. This amount should be large enough to utilize all available UTXOs in the transaction with expected change less than one coinbase worth, for example
221 552 530 060 uT - 205 089 819 222 uT = 16 462 710 838 uT. This will result in an empty wallet until the change UTXO is received.

Suggested change
When I create a burn transaction of 201552500000 uT from WALLET via command line
When I create a burn transaction of 205089819222 uT from WALLET via command line
And I restart wallet WALLET
Then wallet WALLET detects all transactions are at least Broadcast
Then I wait for wallet WALLET to have less than 1 uT

We can also restart the wallet here as waiting for the change UTXO to be received and confirmed does not need to be via the command line

When I mine 5 blocks on BASE
Then all nodes are at height 20
# Then I wait for wallet WALLET to have at least 100 uT
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Then I wait for wallet WALLET to have at least 100 uT
Then I wait for wallet WALLET to have at least 100 uT

This line is important to ensure the wallet received the change UTXO (worth 16 462 710 838 uT in this example)

Then I get balance of wallet WALLET is at most 18462621580 uT via command line
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Then I get balance of wallet WALLET is at most 18462621580 uT via command line
Then I get balance of wallet WALLET is at most 16462710838 uT via command line

# TODO: verify the actual burned kernel

@long-running
Scenario: As a user I want to send one-sided via command line
Expand Down
12 changes: 12 additions & 0 deletions integration_tests/features/support/wallet_cli_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ Then(
}
);

Then(
"I get balance of wallet {word} is at most {int} uT via command line",
{ timeout: 180 * 1000 },
async function (name, amount) {
let wallet = this.getWallet(name);
let output = await wallet_run_command(wallet, "get-balance", 180);
let parse = output.buffer.match(/Available balance: (\d*.\d*) T/);
expect(parse, "Parsing the output buffer failed").to.not.be.null;
expect(parseFloat(parse[1])).to.be.lessThanOrEqual(amount / 1000000);
}
);

When(
"I send {int} uT from {word} to {word} via command line",
{ timeout: 180 * 1000 },
Expand Down