-
Notifications
You must be signed in to change notification settings - Fork 41
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
[R4R] fix account may have currency with zero balance #679
Conversation
plugins/dex/order/keeper.go
Outdated
Plus(sdk.Coins{sdk.NewCoin(tran.outAsset, tran.unlock-tran.out)})) | ||
accountCoin := account.GetCoins(). | ||
Plus(sdk.Coins{sdk.NewCoin(tran.inAsset, tran.in)}) | ||
if tran.unlock-tran.out > 0 || !sdk.IsUpgrade(upgrade.FixZeroBalance) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if remain := tran.unlock-tran.out; remain > 0 || !sdk.IsUpgrade... {
accountCoin = accountCoin.Plus(sdk.Coins{sdk.NewCoin(tran.outAsset, remain)})
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure whether we want clean up historical data at a specific height......
Amazing, this is better in performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not this:
if tran.unlock>tran.out || !sdk.IsUpgrade... {
not sure whether we want clean up historical data at a specific height...... |
emm, this may stop the world for a while, I am not sure either. @yutianwu @HaoyangLiu @darren-liu @rickyyangz any suggest? |
it seems acceptable if we clean the accounts in prod for there are only 300k accounts in prod. and there are 700k in testnet. we can test how long will it take to clean the accounts. |
we need to find out how many accounts that have such case to estimate the cost. I think there should not be too many and then it may be acceptable to handle it in one height. |
I will sync the prod data and try how many time it takes. |
@rickyyangz @ackratos @HaoyangLiu @yutianwu Please see the test and statistics info in #684. The time may be acceptable, but during writing the algorithm that deletes the |
I prefer just leave them alone. Doing this has no obvious gain but take big risk. |
ok, just let it go, and record this issue just in case we need to update the accounts. or we can just airdrop some tokens to addresses affected, lol |
agree |
* hardfork: fix possible zero currency balance * add change log * fix review suggest
* hardfork: fix possible zero currency balance * add change log * fix review suggest
* hardfork: fix possible zero currency balance * add change log * fix review suggest
* hardfork: fix possible zero currency balance * add change log * fix review suggest
* hardfork: fix possible zero currency balance * add change log * fix review suggest
* hardfork: fix possible zero currency balance * add change log * fix review suggest
* hardfork: fix possible zero currency balance * add change log * fix review suggest
* hardfork: fix possible zero currency balance * add change log * fix review suggest
* hardfork: fix possible zero currency balance * add change log * fix review suggest
* hardfork: fix possible zero currency balance * add change log * fix review suggest
Description
resolve issue #677
Rationale
Some consideration for the fixing:
Plus
function forCoins
.May need check every currency value of the coin, may hurt the performance.
Plus
may have such issue?Swap
,Freeze
,Timelock
,Send
,Mint
,Burn
,Issue
have checked the coins to be positive, this only happend when add an currency which is possiable to be zero, for now only trade will involved.Example
add an example CLI or API response...
Changes
Notable changes:
Preflight checks
make build
)make test
)make integration_test
)Already reviewed by
...
Related issues
#667