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

fix: Consider input bytes when calculating gas cost #10379

Merged
merged 10 commits into from Dec 11, 2023

Conversation

stoqnkpL
Copy link
Collaborator

@stoqnkpL stoqnkpL commented Dec 8, 2023

Description:
Take into consideration the input bytes' size from the evm transaction when calculating the intrinsic gas cost.

Related issue(s):

Fixes #9988

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
@stoqnkpL stoqnkpL added Bug An error that causes the feature to behave differently than what was expected based on design. Limechain Work planned for the LimeChain team labels Dec 8, 2023
@stoqnkpL stoqnkpL added this to the v0.45 milestone Dec 8, 2023
@stoqnkpL stoqnkpL self-assigned this Dec 8, 2023
@stoqnkpL stoqnkpL requested review from a team as code owners December 8, 2023 10:04
@stoqnkpL stoqnkpL changed the title Consider input bytes when calculating gas cost - mono service fix Fix: Consider input bytes when calculating gas cost - mono service fix Dec 8, 2023
Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
@stoqnkpL stoqnkpL changed the title Fix: Consider input bytes when calculating gas cost - mono service fix fix: Consider input bytes when calculating gas cost - mono service fix Dec 8, 2023
Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
@stoqnkpL stoqnkpL changed the title fix: Consider input bytes when calculating gas cost - mono service fix fix: Consider input bytes when calculating gas cost Dec 8, 2023
Copy link

github-actions bot commented Dec 8, 2023

Node: Unit Test Results

    2 293 files  ±0      2 293 suites  ±0   47m 25s ⏱️ -18s
118 429 tests +1  118 395 ✔️ +1  34 💤 ±0  0 ±0 
126 850 runs  +1  126 816 ✔️ +1  34 💤 ±0  0 ±0 

Results for commit e056434. ± Comparison against base commit d0e5885.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Dec 8, 2023

Node: HAPI Test (Token) Results

189 tests  ±0   189 ✔️ ±0   19m 19s ⏱️ +39s
  13 suites ±0       0 💤 ±0 
  13 files   ±0       0 ±0 

Results for commit e056434. ± Comparison against base commit d0e5885.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Dec 8, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d0e5885) 62.97% compared to head (e056434) 62.97%.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10379      +/-   ##
=============================================
- Coverage      62.97%   62.97%   -0.01%     
- Complexity     30794    30795       +1     
=============================================
  Files           3356     3356              
  Lines         135216   135219       +3     
  Branches       14076    14076              
=============================================
- Hits           85152    85149       -3     
- Misses         46728    46733       +5     
- Partials        3336     3337       +1     

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

Copy link

github-actions bot commented Dec 8, 2023

Node: HAPI Test (Crypto) Results

211 tests  ±0   201 ✔️ ±0   22m 2s ⏱️ + 4m 45s
  22 suites ±0     10 💤 ±0 
  22 files   ±0       0 ±0 

Results for commit e056434. ± Comparison against base commit d0e5885.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Dec 8, 2023

Node: E2E Test Results

    1 files  ±    0      1 suites  ±0   22m 35s ⏱️ + 22m 35s
311 tests +310  311 ✔️ +311  0 💤 ±0  0  - 1 
333 runs  +332  333 ✔️ +333  0 💤 ±0  0  - 1 

Results for commit e056434. ± Comparison against base commit d0e5885.

This pull request removes 1 and adds 311 tests. Note that renamed tests count towards both.
EndToEndTests ‑ initializationError
EndToEndTests ‑ ADDRESS_BOOK_CONTROLCanUpdateADDRESS_BOOK
EndToEndTests ‑ ADDRESS_BOOK_CONTROLCanUpdateNODE_DETAILS
EndToEndTests ‑ AccountsGetPayerRecordsIfSoConfigured
EndToEndTests ‑ Acct57CanMakeSmallChanges
EndToEndTests ‑ Acct57CantMakeLargeChanges
EndToEndTests ‑ AddingSignaturesToExecutedTxFails
EndToEndTests ‑ AddingSignaturesToExecutedTxFailsWithLongTermEnabled
EndToEndTests ‑ AddingSignaturesToNonExistingTxFails
EndToEndTests ‑ AddingSignaturesToNonExistingTxFailsWithLongTermEnabled
EndToEndTests ‑ AddressAliasIdFuzzing
…

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Dec 8, 2023

Node: HAPI Test (Time Consuming) Results

21 tests  ±0     9 ✔️ ±0   25m 11s ⏱️ +38s
  2 suites ±0   12 💤 ±0 
  2 files   ±0     0 ±0 

Results for commit e056434. ± Comparison against base commit d0e5885.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Dec 8, 2023

Node: HAPI Test (Misc) Results

420 tests  ±0   318 ✔️ +1   29m 0s ⏱️ + 5m 2s
  74 suites ±0   102 💤 ±0 
  74 files   ±0       0  - 1 

Results for commit e056434. ± Comparison against base commit d0e5885.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Dec 8, 2023

Node: Integration Test Results

279 tests  ±0   279 ✔️ ±0   28m 8s ⏱️ -17s
    5 suites ±0       0 💤 ±0 
    5 files   ±0       0 ±0 

Results for commit e056434. ± Comparison against base commit d0e5885.

♻️ This comment has been updated with latest results.

Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
Copy link

github-actions bot commented Dec 8, 2023

Node: HAPI Test (Smart Contract) Results

397 tests  ±0   356 ✔️ ±0   49m 40s ⏱️ + 3m 53s
  55 suites ±0     41 💤 ±0 
  55 files   ±0       0 ±0 

Results for commit e056434. ± Comparison against base commit d0e5885.

♻️ This comment has been updated with latest results.

Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
Copy link
Contributor

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

LG
One question

Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
…ut-bytes-for-gas-cost

Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
Copy link
Contributor

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

LG

Is there a way for us to describe the gas calculation so test readers can understand why the new numbers are correct e.g. 21k + x + y etc

Maybe not in this PR if it's a lot of overhead but something to consider to improve.
Maybe not as part of this PR

Copy link
Collaborator

@IvanKavaldzhiev IvanKavaldzhiev left a comment

Choose a reason for hiding this comment

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

LGTM

@lukelee-sl
Copy link
Member

Copy link
Collaborator

@tinker-michaelj tinker-michaelj left a comment

Choose a reason for hiding this comment

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

LGTM, tyvm @stoqnkpL !

Copy link
Member

@david-bakin-sl david-bakin-sl left a comment

Choose a reason for hiding this comment

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

LGTM.

@stoqnkpL
Copy link
Collaborator Author

Should we consider doing the same thing here for modularized smart contract service? Or in a separate pr? https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/gas/CustomGasCharging.java#L117

it's already resolved as part of this PR. Or do you think there's more logic that should be updated?

@stoqnkpL stoqnkpL merged commit 23a28ea into develop Dec 11, 2023
29 checks passed
@stoqnkpL stoqnkpL deleted the 09988-consider-input-bytes-for-gas-cost branch December 11, 2023 16:29
@lukelee-sl
Copy link
Member

Should we consider doing the same thing here for modularized smart contract service? Or in a separate pr? https://github.com/hashgraph/hedera-services/blob/develop/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/gas/CustomGasCharging.java#L117

it's already resolved as part of this PR. Or do you think there's more logic that should be updated?

No I missed that. Thanks for doing this!

Copy link
Member

@lukelee-sl lukelee-sl left a comment

Choose a reason for hiding this comment

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

LGTM

stoqnkpL added a commit that referenced this pull request Dec 11, 2023
Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
iwsimon pushed a commit that referenced this pull request Dec 12, 2023
Signed-off-by: Stoyan Panayotov <stoyan.panayotov@limechain.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An error that causes the feature to behave differently than what was expected based on design. Limechain Work planned for the LimeChain team
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Consider the input bytes when calculating Intrinsic Gas costs in the EVM
6 participants