Skip to content
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

use flat vm fee #4607

Merged
merged 20 commits into from
Oct 12, 2022
Merged

use flat vm fee #4607

merged 20 commits into from
Oct 12, 2022

Conversation

oxade
Copy link
Contributor

@oxade oxade commented Sep 13, 2022

This adds the flat fee for VM gas logic

The fee itself is subject to change
Finding the right number took a few iterations and will probably take a lot more once folks start using the new feature

@oxade oxade marked this pull request as ready for review September 13, 2022 20:55
@oxade
Copy link
Contributor Author

oxade commented Sep 13, 2022

simtest failure is unrelated

@oxade oxade marked this pull request as draft September 13, 2022 23:30
@oxade oxade marked this pull request as ready for review September 14, 2022 02:27
@oxade oxade requested a review from lxfind September 14, 2022 16:02
@oxade oxade enabled auto-merge (squash) September 14, 2022 17:35
Comment on lines 126 to 132
if single_tx.uses_vm() {
// Charge gas for this VM execution
if let Err(e) = gas_status.charge_vm_gas() {
result = Err(e);
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just move this into the match arms for the items that call the VM? Are we also flat feeing publishing with the same flat fee? I imagine we don't want to but it looks like we are here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just move this into the match arms for the items that call the VM?

Because code duplication. I also think it's clearer to flag that we're charging for VM use.

Are we also flat feeing publishing with the same flat fee? I imagine we don't want to but it looks like we are here?

Publishing can invoke VM as part of init

break;
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would imagine calls for this inside the various match arms, where you can say

let move_gas = match gas_status.charge_vm_gas() {
  Ok(ff_move_gas) => ff_move_gas,
  Err(e) => { result = Err(e); break }
}

@oxade oxade disabled auto-merge September 14, 2022 20:01
@oxade
Copy link
Contributor Author

oxade commented Sep 14, 2022

@tnowacki
I spoke to @srinath-mysten
We decided to combine gas estimation with this PR to minimize friction for devs who might find their gas budgets are no longer sufficient. Hence feel free to approve, but not merge this PR.

@oxade
Copy link
Contributor Author

oxade commented Sep 14, 2022

@tnowacki I spoke to @srinath-mysten We decided to combine gas estimation with this PR to minimize friction for devs who might find their gas budgets are no longer sufficient. Hence feel free to approve, but not merge this PR.

Moving PR to draft while we add estimation logic

@oxade oxade marked this pull request as draft September 14, 2022 20:03
@lxfind
Copy link
Contributor

lxfind commented Sep 14, 2022

Another way to reduce dev friction is to ship estimation logic first by using the flat fee here.

@oxade oxade marked this pull request as ready for review October 3, 2022 23:02
@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2022

💳 Wallet Extension has been built, you can download the packaged extension here: https://github.com/MystenLabs/sui/actions/runs/3232781121#artifacts

@oxade
Copy link
Contributor Author

oxade commented Oct 10, 2022

Tests are failing due to unrelated Narwhal issues. Waiting for fix.

@oxade
Copy link
Contributor Author

oxade commented Oct 10, 2022

Another way to reduce dev friction is to ship estimation logic first by using the flat fee here.

This is done

@@ -101,7 +101,7 @@ impl FaucetClient for LocalFaucetClient {
async fn request_sui_coins(&self, request_address: SuiAddress) -> FaucetResponse {
let receipt = self
.simple_faucet
.send(Uuid::new_v4(), request_address, &[50000; 5])
.send(Uuid::new_v4(), request_address, &[100000; 5])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is 50k insufficient in some case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it was. But generally we increased the faucet amount in devnet so it makes sense here too

@@ -25,7 +25,7 @@ use move_binary_format::{
};

/// VM flat fee
pub const VM_FLAT_FEE: Gas = Gas::new(1_000);
pub const VM_FLAT_FEE: Gas = Gas::new(2_000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this might need to tuned, maybe its better to put the number in some config or env files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this leads to a potential for each validator to start with different values.
Also if we use cfg files here, why not do it for all values in the cost table?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this constant is a good place to tune this.

In the future, we might need to change this as the software upgrades, but we will need to sort out that whole problem at a later date.

@github-actions
Copy link
Contributor

⚠️ 🦋 Changesets Warning: This PR has changes to public npm packages, but does not contain a changeset. You can create a changeset easily by running pnpm changeset, and following the prompts. If your change does not need a changeset (e.g. a documentation-only change), you can ignore this message. This warning will be removed when a changeset is added to this pull request.

Learn more about Changesets.

@oxade oxade merged commit 8f57610 into main Oct 12, 2022
@oxade oxade deleted the flat_vm_fee branch October 12, 2022 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants