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

extend faucet package support for other transactions #1380

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

p4u
Copy link
Member

@p4u p4u commented Sep 4, 2024

Faucet package can now be used on NewProcess, SetAccount, SetProcess and SetSik related transactions.

@p4u p4u requested a review from altergui September 4, 2024 15:23
@p4u p4u force-pushed the f/extend_faucet_package_usage branch 3 times, most recently from 5ef52f8 to 37e269c Compare September 4, 2024 17:38
@coveralls
Copy link

coveralls commented Sep 5, 2024

Pull Request Test Coverage Report for Build 10735680045

Details

  • 112 of 197 (56.85%) changed or added relevant lines in 5 files are covered.
  • 5 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.07%) to 62.382%

Changes Missing Coverage Covered Lines Changed/Added Lines %
vochain/state/account.go 9 11 81.82%
cmd/end2endtest/account.go 3 7 42.86%
vochain/transaction/vochaintx/vochaintx.go 4 16 25.0%
vochain/transaction/transaction.go 92 159 57.86%
Files with Coverage Reduction New Missed Lines %
vochain/transaction/admin_tx.go 2 48.81%
vochain/transaction/transaction.go 3 58.57%
Totals Coverage Status
Change from base Build 10703279624: -0.07%
Covered Lines: 16802
Relevant Lines: 26934

💛 - Coveralls

Copy link
Contributor

@altergui altergui left a comment

Choose a reason for hiding this comment

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

LGTM, added a couple tests and a small refactor as fixup commits, please do git rebase -i main before merging

Comment on lines +509 to +517
// should work, try using a faucet package for a set account info tx
// first create the account (and check balance is 0, because tx cost 200)
faucetPkg, err = GenerateFaucetPackage(signers[0], signers[9].Address(), 200)
qt.Assert(t, err, qt.IsNil)
qt.Assert(t, testSetAccountTx(t,
signers[9], signers[9].Address(), faucetPkg, app, "", uint32(0), true),
qt.IsNil,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe it would be interesting to include as well 199, so the faucet would not produce enough balance to actually execute the transaction. this might trigger weird bugs, not now (due to the canPayForTx check 🙌) but the test would catch future regressions

Copy link
Contributor

Choose a reason for hiding this comment

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

i added this test i mentioned, and also another corner case test, where none of the current balance OR the faucet are enough to cover the txcost, but combined they do.

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

@altergui altergui force-pushed the f/extend_faucet_package_usage branch from e4ba715 to 02e6e13 Compare September 5, 2024 15:19
@altergui altergui marked this pull request as draft September 6, 2024 07:48
@altergui
Copy link
Contributor

altergui commented Sep 6, 2024

found a small bug, fixing it

@p4u
Copy link
Member Author

p4u commented Sep 6, 2024

ok, feel free to merge it yourself when ready

@altergui
Copy link
Contributor

altergui commented Sep 6, 2024

i pushed the fix, i'm still extending and readapting the tests, will merge as soon as i finish

vochain/state/account.go Outdated Show resolved Hide resolved
Faucet package can now be used on NewProcess, SetAccount,
SetProcess and SetSik related transactions.

Signed-off-by: p4u <[email protected]>
@altergui altergui force-pushed the f/extend_faucet_package_usage branch from 559b0fe to 4e9a11e Compare September 6, 2024 09:09
@altergui altergui marked this pull request as ready for review September 6, 2024 09:09
@altergui altergui merged commit 4e9a11e into main Sep 6, 2024
14 checks passed
@altergui altergui deleted the f/extend_faucet_package_usage branch September 6, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants