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

Improve gas interface #3428

Merged
merged 19 commits into from
Jul 24, 2024
Merged

Improve gas interface #3428

merged 19 commits into from
Jul 24, 2024

Conversation

grarco
Copy link
Contributor

@grarco grarco commented Jun 19, 2024

Describe your changes

Closes #3427.
Closes #3395.

Introduces a new WholeGas type to better distinguish between gas in subunits (for tracking) and gas in whole units (for events and fees).

Reduces the gas scale in the localnet genesis file and in tests by an order of magnitude to increase the gas cost of transactions which was too low.

Removes the redundant gas_used field of TxResult (since we already emit an attribute GasUsed) and collapse the previous BatchResults directly into TxResult.

Indicate on which release or other PRs this topic is based on

v0.40.0

Checklist before merging to draft

  • I have added a changelog
  • Git history is in acceptable state

Copy link

codecov bot commented Jun 19, 2024

Codecov Report

Attention: Patch coverage is 73.17073% with 44 lines in your changes missing coverage. Please review.

Project coverage is 53.46%. Comparing base (8479d38) to head (826c2fc).
Report is 4 commits behind head on main.

Files Patch % Lines
crates/node/src/bench_utils.rs 0.00% 13 Missing ⚠️
crates/namada/src/ledger/protocol/mod.rs 70.00% 9 Missing ⚠️
crates/gas/src/lib.rs 73.68% 5 Missing ⚠️
crates/sdk/src/rpc.rs 0.00% 5 Missing ⚠️
crates/tx/src/data/mod.rs 91.07% 5 Missing ⚠️
crates/tx/src/data/wrapper.rs 62.50% 3 Missing ⚠️
crates/node/src/shell/finalize_block.rs 87.50% 2 Missing ⚠️
crates/light_sdk/src/reading/asynchronous/tx.rs 0.00% 1 Missing ⚠️
crates/sdk/src/tx.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3428      +/-   ##
==========================================
- Coverage   53.48%   53.46%   -0.02%     
==========================================
  Files         320      320              
  Lines      110000   109974      -26     
==========================================
- Hits        58832    58803      -29     
- Misses      51168    51171       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

grarco added a commit that referenced this pull request Jun 20, 2024
@grarco grarco force-pushed the grarco/better-gas-interface branch from 8f4678c to 2e55958 Compare June 20, 2024 10:40
grarco added a commit that referenced this pull request Jun 20, 2024
@grarco grarco force-pushed the grarco/better-gas-interface branch from 2e55958 to 3d0b9cb Compare June 20, 2024 10:46
@grarco grarco marked this pull request as ready for review June 20, 2024 11:36
@grarco
Copy link
Contributor Author

grarco commented Jun 20, 2024

@yito88 Hermes tests failing again (sorry about that)

@grarco
Copy link
Contributor Author

grarco commented Jun 20, 2024

@yito88 Hermes tests failing again (sorry about that)

Ah actually I believe the failures come from #3391

@yito88
Copy link
Member

yito88 commented Jun 20, 2024

yeah, it seems that the parameter structure change in #3391 causes the failure.

grarco added a commit that referenced this pull request Jun 20, 2024
@grarco grarco force-pushed the grarco/better-gas-interface branch from 3d0b9cb to be85e27 Compare June 20, 2024 13:46
@grarco
Copy link
Contributor Author

grarco commented Jun 20, 2024

yeah, it seems that the parameter structure change in #3391 causes the failure.

Maybe not, I've just pushed a fix to that branch that was supposed to fix a failing ibc test (non-hermes) but it seems to have fixed all the e2e tests. So the issue might indeed come from this branch

@grarco grarco force-pushed the grarco/better-gas-interface branch from 7ea3a8b to 46dd71e Compare June 20, 2024 18:33
@grarco grarco force-pushed the grarco/better-gas-interface branch from 46dd71e to 1dd9399 Compare June 24, 2024 12:59
@brentstone
Copy link
Collaborator

do we still want this PR?

@brentstone brentstone mentioned this pull request Jul 7, 2024
@grarco
Copy link
Contributor Author

grarco commented Jul 8, 2024

do we still want this PR?

I think it would be nice if we could add it to the next release

@yito88
Copy link
Member

yito88 commented Jul 9, 2024

@grarco Looks good. e2e::ibc_tests::run_ledger_ibc failed without Hermes. It seems that the default gas limit isn't enough for tx_ibc.wasm.

@grarco
Copy link
Contributor Author

grarco commented Jul 9, 2024

@grarco Looks good. e2e::ibc_tests::run_ledger_ibc failed without Hermes. It seems that the default gas limit isn't enough for tx_ibc.wasm.

Thanks for catching it! Should be fixed in fb81246. I've also fixed the broken integration tests

crates/sdk/src/tx.rs Outdated Show resolved Hide resolved
Comment on lines -503 to +487
write!(f, "Transaction is valid. Gas used: {}", self.gas_used)
write!(f, "Transaction is valid.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

My opinion is that keeping this log is important if we are able to still.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've had a chat with @Fraccaman on this. The gas is already emitted as an event, so this field in the TxResult was essentially duplicated. I'll try to update the logs in the client to retrieve this piece of information from the events

Copy link
Contributor Author

@grarco grarco Jul 10, 2024

Choose a reason for hiding this comment

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

Brought back the logging of the gas used in 209da0c but directly in the SDK when fetching the tx events. It is no longer possible to log it directly in here since the gas isn't present here anymore

brentstone added a commit that referenced this pull request Jul 10, 2024
* grarco/better-gas-interface:
  Logs tx used gas
  Increases masp gas limit in genesis files and removes custom setup in integration tests
  update Hermes
  Returns `WholeGas` from `dry_run_tx`
  Adds conversion from `WholeGas` to `GasLimit`
  Updates gas in ibc e2e test
  Fixes gas payment in masp integration tests
  Updates gas limit in unit tests
  Changelog #3428
  Changelog #3428
  Removes misleading gas message
  Fixes ibc e2e test
  Fixes unit tests
  Clippy + fmt
  Compacts `BatchResults` into `TxResult`
  Remove gas from `TxResult`. Adjusts dry run result
  Reduces gas scale param in genesis
  Introduces `WholeGas` type
@grarco grarco mentioned this pull request Jul 12, 2024
2 tasks
@brentstone brentstone merged commit a575ba1 into main Jul 24, 2024
32 of 38 checks passed
@brentstone brentstone deleted the grarco/better-gas-interface branch July 24, 2024 22:59
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.

Improve usage of Gas type Change gas SCALE parameter
3 participants