-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Add implementation for gas charging to address balance #23682
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
crates/sui-types/src/transaction.rs
Outdated
} | ||
|
||
if self.gas_data().is_paid_from_address_balance() { | ||
let gas_withdraw = FundsWithdrawalArg::balance_from_sender( |
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.
Depending on the gas owner, this may or may not be the sender
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.
Added support for different gas owner and associated e2e test cases
c021999
to
7f9fb60
Compare
22324fc
to
904f053
Compare
7f9fb60
to
f962557
Compare
980c32b
to
67d0e7a
Compare
904f053
to
0a3cd7f
Compare
0a3cd7f
to
6e76eaa
Compare
); | ||
|
||
let delete_gas_summary = delete_effects.gas_cost_summary(); | ||
let _delete_gas_used = calculate_total_gas_cost(delete_gas_summary); |
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.
what is this for?
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.
were you trying to verify that there is a net gas rebate here? that does seem useful to test since there is an explicit branch in the code on +/- net 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.
Assert added
sender.hash(&mut hasher); | ||
gas_owner.hash(&mut hasher); | ||
"storage".hash(&mut hasher); | ||
let nonce = hasher.finish() as u32; |
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 do we need the nonce? the sender and gas_owner will already be committed to by the tx digest?
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.
Addressed
let WithdrawFrom::Sender = withdraw.withdraw_from; | ||
let account_address = match withdraw.withdraw_from { | ||
WithdrawFrom::Sender => self.sender(), | ||
WithdrawFrom::Sponsor => self.gas_owner(), |
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.
Should we ban explicit Sponsor withdrawals for now? Its a bit of an additional security burden on sponsor code that I'm not sure they are ready for.
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.
Addressed
6e76eaa
to
5f12b4b
Compare
Description
This PR charges gas to a transaction signer's account balance. Gated by protocol config; see referenced branch
Test plan
New e2e tests added
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.