-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[FA] remove withdraw event when burn #15357
Conversation
⏱️ 40m total CI duration on this PR
|
aptos-move/framework/aptos-framework/sources/fungible_asset.move
Outdated
Show resolved
Hide resolved
@@ -1057,8 +1069,6 @@ module aptos_framework::fungible_asset { | |||
assert!(store.balance >= amount, error::invalid_argument(EINSUFFICIENT_BALANCE)); | |||
store.balance = store.balance - amount; | |||
}; | |||
|
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.
weren't folks complaining that there wasn't a Withdraw before? after migration now it is consistently to be always there?
also changing this after migration has started seems even more confusing? maybe we should create WithdrawForGas event and emit that one instead, so callers can choose what to do with it?
@movekevin for thoughts
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.
Part of the reason I break so many tests is due to this new event.
I don't know who complained there was not a withdraw before.
cc @kent-white @gregnazario for your thoughts as well.
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.
It seems mint_and_refund also has a deposit event... I am not sure whether we should have this PR now.
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.
can the caller know when (or how much) of the gas fee has been paid by coin (as so has no event) vs fa (and so has this event).
If that cannot be distinguished, then users cannot appropriately adjust the balances. so we should try to address that, in the cleanest way possible
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.
coin gas fee is implicit. I think we can only know from FeeStatement
.
4760bba
to
ab06352
Compare
I create two events to presents gas burnt and gas refunded. |
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.
cc @runtian-zhou for thoughts here, as you are changing these files for permissions as well
separation here also makes a permission checks more clearer - _for_gas methods have a different permission check (all the way in transaction_validation), and other methods have permission check here. And events here also then distinguish the permission needed, which is cool
cc @movekevin and @davidiw for thoughts on this, as this is pretty big change logically
@@ -779,9 +779,12 @@ module aptos_framework::coin { | |||
burn(coin_to_burn, burn_cap); | |||
}; | |||
if (fa_amount_to_burn > 0) { | |||
fungible_asset::burn_from( | |||
fungible_asset::address_burn_from_for_gas( |
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.
burn_from is a public function that might be called from anywhere? we would need separate public(friend) for_gas variant and leave the public to emit regular events?
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.
address_burn_from_for_gas is the separate friend function.
Now burn function does not emit events.
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.
no I meant coin::burn_from
if some other coin type has BurnCapability and calls this, it will emit wrong event.
aptos-move/framework/aptos-framework/sources/fungible_asset.move
Outdated
Show resolved
Hide resolved
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.
I don't think this would help the permissions? As there were no signers involved at all. Seems to me a purely functional change for FA
aptos-move/framework/aptos-framework/sources/fungible_asset.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/aptos-framework/sources/fungible_asset.move
Outdated
Show resolved
Hide resolved
looks like this could be very expensive perf wise -- are we unable to compute this? why do we need this? |
it will have signers. I will refactor a little bit after AA code. |
Also, an exchange asked us how they can tell the difference between migration txn depositing FA or transfer depositing FA. I think this PR can solve their issue. |
a8d769c
to
565ab43
Compare
565ab43
to
09dd0bb
Compare
09dd0bb
to
311023e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ac1b2de
to
b03ae01
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
b03ae01
to
1706bf1
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1706bf1
to
46f38b6
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
46f38b6
to
f002e32
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
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.
@runtian-zhou can you review as well, and also check how it interacts with your permissions PRs?
Description
We don't emit event when burn APT coin, neither should APT FA.
Now each txn burn gas fee from APT FA, we see a withdraw event for this.
We first remove this event to facilitate the exchanges to recognize deposit.
How Has This Been Tested?
simple refactoring.
Type of Change
Which Components or Systems Does This Change Impact?