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

Gasless contract using gas as normal contract #77

Open
ledanghuy1811 opened this issue Mar 4, 2025 · 2 comments
Open

Gasless contract using gas as normal contract #77

ledanghuy1811 opened this issue Mar 4, 2025 · 2 comments
Assignees

Comments

@ledanghuy1811
Copy link

Context

From v0.50.x, we set gasless for some contracts but when we executes functions of these contracts, gas used of these txs is larger than we expected

To Reproduce

Steps to reproduce the behavior:

  1. Create a set-gasless contract proposal
  2. Wait for proposal pass
  3. Try to execute one of functions of contract
  4. See error

Expected behavior

Gas used of this tx is smaller than usual

@ledanghuy1811 ledanghuy1811 self-assigned this Mar 4, 2025
@ledanghuy1811
Copy link
Author

The error that txs of these contracts still use more gas is because in function execute of wasm keeper, we check if contract is gasless contract then we set gas = 0 for context by WithGasMeter function. This function return new context for execution but after execute function is end, it seem like the process of execution still use old context, this lead to gas still large

Image

@ledanghuy1811
Copy link
Author

To fix this issue, we use RefundGas function to reduce gas used for gasless contract, this function doesn't return new context then after execution, the gas used is decreased for gasless contract

Image

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

No branches or pull requests

1 participant