-
Notifications
You must be signed in to change notification settings - Fork 1k
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
ApplicationLogs and Neo3 GAS transfer notification results #1252
Comments
I just noticed that this only occurred when sending all of the remaining GAS from the wallet - on an earlier transfer of 1 GAS, the fee paid was not subtracted from the amount the recipient received and the transfer notification was correct. |
Maybe this will be fixed with #1248 |
I think this is another problem, I'll check it. |
@hal0x2328
|
I got the point, there is no bug. I think the two addresses:
As you can see, the tx's sender is
|
This transaction only sent part of So if AHpP2cbWfUDBuH2UVKbmLsc6AHEYYG92Vn now sends the entire current balance of 49995.919995 GAS to another address, the fee must be subtracted from the 49995.919995 - the receiving address will get the remainder which will be some amount less than 49995.919995. This behavior is expected and correct even if it makes it a bit unpredictable to the sender as to the final amount the recipient will receive. The issue I saw is that the |
I will have a try, but I think the tx will fail as |
I see it will be possible with Neo3 to have "dust" GAS in an account that can't be transferred out because the transaction fee is more than the amount it would cost to send it. They could transfer in more GAS and send the properly calculated amount + fee to leave the amount at exactly zero but it's going to lead to confusion either way - wallets will need to be smart about handling it. |
This was fixed in #1248. It works fine my latest version What surprised me was that the transaction with insufficient balance will execute successfully |
The application log for a GAS transfer shows only the from/to/amount transfer notification for GAS transfers - but GAS is a special case, since the system and network fee is subtracted from that amount, so any trackers using transfer notifications to tally balances or confirm transfer amounts for a dApp will end up with incorrect results.
There is the
gas_consumed
property of the application log, but it doesn't reflect the system fee, network fee (or the sum of both) either so it can't be used to arrive at the correct result.The only way currently to correctly calculate the amount of the GAS transfer from address A to address B is to also request the raw transaction and subtract the fees shown there.
Example on Neo3 TestNet, a transfer of 1.9770058 GAS:
The resulting log:
From the application log, it looks like 16699c1a5374ec7b5ce880449e14e7c99ef3fd24 received 1.97700580 GAS but there was actually a combined fee of 1.0340366 GAS subtracted so actually in the end 16699c1a5374ec7b5ce880449e14e7c99ef3fd24's balance only increased by 0.9429692 GAS.
The text was updated successfully, but these errors were encountered: