flow-go
flow-go copied to clipboard
Allow `COA.withdraw` call to run when there is a possible rounding error
Closes https://github.com/onflow/flow-go/issues/6856
In this case, we perform the withdrawal, by simply truncating the remainder that cannot fit in a Flow token vault. When the attoFlow balance is too small to fit in a Flow vault, we panic with a dedicated error message.
cc @sisyphusSmiling Can you take a look at this approach, and the added test cases?
Codecov Report
Attention: Patch coverage is 76.47059% with 4 lines in your changes missing coverage. Please review.
Project coverage is 40.27%. Comparing base (
6e6c6cd) to head (4669999).
| Files with missing lines | Patch % | Lines |
|---|---|---|
| fvm/evm/types/balance.go | 0.00% | 2 Missing :warning: |
| utils/unittest/execution_state.go | 0.00% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #6877 +/- ##
==========================================
- Coverage 41.31% 40.27% -1.05%
==========================================
Files 2164 2020 -144
Lines 189596 180524 -9072
==========================================
- Hits 78337 72701 -5636
+ Misses 104735 101793 -2942
+ Partials 6524 6030 -494
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 40.27% <76.47%> (-1.05%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Thanks for the changes @m-Peter! The test cases and behavior look good to me, just left one question.