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

Check the Gas Free function during the compilation of the Move module. #886

Merged
merged 10 commits into from
Oct 25, 2023

Conversation

stevenlaw123
Copy link
Contributor

This is part of #839

Check the Gas Free function during the compilation of the Move module.

TODO:

  1. Verify the correctness of the Gas Free function information in the module's metadata during module publishing.
  2. Deduct gas fees by reading and executing the Gas Fee function information from the metadata.

@vercel
Copy link

vercel bot commented Sep 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Oct 25, 2023 7:56am

@jolestar
Copy link
Contributor

Wait the v0.2 to release

examples/gas_free/sources/gas_free.move Outdated Show resolved Hide resolved
moveos/moveos-verifier/src/metadata.rs Outdated Show resolved Hide resolved
moveos/moveos/src/moveos.rs Outdated Show resolved Hide resolved
moveos/moveos/src/moveos.rs Outdated Show resolved Hide resolved
@jolestar
Copy link
Contributor

How do we test if the Gas is paid by contract, not the sender?

Copy link
Contributor

@jolestar jolestar left a comment

Choose a reason for hiding this comment

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

I will merge this PR first. We can discuss the solution and refactor it later.

true
}

fun gas_charge_post_function(_ctx: &mut Context, _gas_used: u128): bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why _gas_used at here is u128?

}
}
}
}

fn execute_gas_validate(
&self,
session: &mut MoveOSSession<'_, '_, MoveOSResolverProxy<MoveOSStore>, MoveOSGasMeter>,
Copy link
Contributor

Choose a reason for hiding this comment

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

gas_validate should be a read-only function, so the session also should &MoveOSSession

let mut can_pay_gas = None;
let action_opt_cloned = action_opt.clone();
if let Some(action) = action_opt {
can_pay_gas = self.execute_gas_validate(&mut session, &action)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

execute_gas_validate should execute in the validate stage, not in the execution_cleanup stage. We need to redesign the gas-free solution and refactor it.

&self,
session: &mut MoveOSSession<'_, '_, MoveOSResolverProxy<MoveOSStore>, MoveOSGasMeter>,
action: &VerifiedMoveAction,
) -> VMResult<Option<bool>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function always returns None.

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.

None yet

2 participants