fip | title | author | discussions-to | status | type | category | created | review-period-end | spec-sections | |
---|---|---|---|---|---|---|---|---|---|---|
0020 |
Add Return Value to WithdrawBalance |
Steven Li (@steven004), Zenground0 (@Zenground0) |
Final |
Technical Core |
Core |
2021-06-06 |
2021-10-11 |
|
Add a return value to market and miner withdraw methods to indicate the actual withdrawn amount
WithdrawBalance methods can succeed even when withdrawing less than the specified amount in message arguments. To resolve this ambiguity the return value should specify the amount withdrawn.
Both miner and market actors have WithdrawBalance methods. Both methods are an attempt to withdraw a specified amount, but return success even when the available balance is less than the withdrawal amount specified. So the actual amount withdrawn is equal to or less than the amount specified in the method parameters, and the method always return nil. Therefore there is no way to know how much FIL is actually withdrawn by only checking the chain status and message info e.g. from node CLI or an explorer.
Adding return values specifying the withdrawn amount will improve the visibility and traceability of FIL flow. This is important especially for miners who need to have a very clear balance sheet and financial report.
Add abi.TokenAmount
return values to market and miner WithdrawBalance
methods and return the amount withdrawn.
The design is trivial.
This proposal requires a breaking change in actor method signatures and therefore a new actors version.
For both miner and market actors
- WithdrawBalance with an amount that can be withdrawn => the specified amount is returned
- WithdrawBalance with an amount greater than that which can be withdrawn => the actual amount withdrawn is returned
This only changes return value behavior so has no security implications.
This only changes return value behavior so has no incentive implications.
This has a positive product consideration for miners and storage clients. Most existing tools should still work since it is unlikely tools depend on the empty return value of withdraw balance. Tools can be improved and adapted to make use of the return value.
specs-actors PR: filecoin-project/specs-actors#1476
Copyright and related rights waived via CC0.