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

Update gas for storage occupation #3510

Merged
merged 24 commits into from
Jul 24, 2024
Merged

Conversation

grarco
Copy link
Contributor

@grarco grarco commented Jul 12, 2024

Describe your changes

Increases the gas cost component for storage occupation and ties this cost the other ones so that it's not free-floating anymore (which could cause a divergence if the other costs are changed).

Removes the redundant new_from_sub_limit constructor for TxGasMeter.

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

#3428 (diff for review: https://github.com/anoma/namada/pull/3510/files/209da0c6ad9cd456a5a6634ec25cc45408e0b72c..33a6cc9437692ccb1ef24e58f2536ac2dfdeb8f3)

Checklist before merging to draft

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

@grarco grarco marked this pull request as ready for review July 12, 2024 15:09
@grarco
Copy link
Contributor Author

grarco commented Jul 12, 2024

Let's wait for the CI to come back online before reviewing this cause there's a change we might have a few tests failing due to gas

@brentstone brentstone force-pushed the grarco/adjust-gas-for-payload branch from 569d43e to 96d685d Compare July 12, 2024 21:45
@grarco grarco mentioned this pull request Jul 12, 2024
Copy link

codecov bot commented Jul 15, 2024

Codecov Report

Attention: Patch coverage is 78.92377% with 47 lines in your changes missing coverage. Please review.

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

Files Patch % Lines
crates/node/src/bench_utils.rs 0.00% 14 Missing ⚠️
crates/namada/src/ledger/protocol/mod.rs 70.00% 9 Missing ⚠️
crates/gas/src/lib.rs 76.19% 5 Missing ⚠️
crates/sdk/src/rpc.rs 0.00% 5 Missing ⚠️
crates/tx/src/data/mod.rs 91.07% 5 Missing ⚠️
crates/node/src/shell/finalize_block.rs 83.33% 3 Missing ⚠️
crates/tx/src/data/wrapper.rs 62.50% 3 Missing ⚠️
crates/light_sdk/src/reading/asynchronous/tx.rs 0.00% 1 Missing ⚠️
crates/namada/src/ledger/mod.rs 90.00% 1 Missing ⚠️
crates/node/src/shell/governance.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3510      +/-   ##
==========================================
- Coverage   53.48%   53.46%   -0.02%     
==========================================
  Files         320      320              
  Lines      110000   109964      -36     
==========================================
- Hits        58832    58792      -40     
- Misses      51168    51172       +4     

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

@grarco
Copy link
Contributor Author

grarco commented Jul 16, 2024

Let's wait for the CI to come back online before reviewing this cause there's a change we might have a few tests failing due to gas

Ok I've fixed the broken tests, this PR is now ready for review

const STORAGE_OCCUPATION_GAS_PER_BYTE: u64 =
100_000 + PHYSICAL_STORAGE_LATENCY_PER_BYTE;
PHYSICAL_STORAGE_LATENCY_PER_BYTE * (1 + 10);
Copy link
Collaborator

@brentstone brentstone Jul 16, 2024

Choose a reason for hiding this comment

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

why did you write the argument as (1 + 10)? Do each of these numbers account for some different effect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They do: the 1 represent the actual cost of storage latency, the 10 component instead is just an arbitrary multiplier that I use to compute an actual storage occupation gas cost based on the storage latency. They are not really tied but we cannot leave the storage occupation gas cost free-floating because we'd end up with the same issue this Pr tries to solve. So we need a way to tie that cost to some other gas cost that is actually based on a benchmark and the storage latency is the closest one

Copy link
Collaborator

Choose a reason for hiding this comment

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

cool would you mind describing this a bit in a comment / docstring?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's described right above

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok I think I was having trouble understanding the comment at first and was seeking clarity, but I think it's fine now. Thanks.

Copy link
Collaborator

@brentstone brentstone left a comment

Choose a reason for hiding this comment

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

LGTM, modulo response to the (1 + 10) comment

brentstone added a commit that referenced this pull request Jul 19, 2024
* grarco/adjust-gas-for-payload:
  Removes redundant `new_from_sub_limit` for `TxGasMeter`
  Increases gas limit for wasm tests
  Increases gas limit for unit tests
  Changelog #3510
  Increases gas cost for storage and binds it to the other costs
@brentstone brentstone merged commit 320ca67 into main Jul 24, 2024
16 of 19 checks passed
@brentstone brentstone deleted the grarco/adjust-gas-for-payload branch July 24, 2024 22:59
@grarco grarco mentioned this pull request Sep 4, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants