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

Report proper computation for EVM.encodeABI & EVM.decodeABI methods #5146

Merged
merged 6 commits into from
Dec 19, 2023

Conversation

m-Peter
Copy link
Collaborator

@m-Peter m-Peter commented Dec 14, 2023

Follow-up for: #4937

  • The computation metering for EVM.encodeABI proactively calculates the length of the [UInt8] resulting array, based on the [AnyStruct] array of Cadence values. Dynamic & static variables are accounted for separately.
  • The computation metering for EVM.decodeABI is the length of the [UInt8] array that is passed in.

Decoding a [UInt8] array that was previously encoded with EVM.encodeABI, takes up the exact same computation as the encoding.

@sideninja sideninja requested a review from turbolent December 14, 2023 18:06
@codecov-commenter
Copy link

codecov-commenter commented Dec 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9dfe842) 56.43% compared to head (b01b1f3) 49.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5146      +/-   ##
==========================================
- Coverage   56.43%   49.51%   -6.92%     
==========================================
  Files         981      185     -796     
  Lines       93068    15605   -77463     
==========================================
- Hits        52519     7727   -44792     
+ Misses      36661     7355   -29306     
+ Partials     3888      523    -3365     
Flag Coverage Δ
unittests 49.51% <ø> (-6.92%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Nice!

fvm/environment/meter.go Show resolved Hide resolved
fvm/evm/stdlib/contract.go Show resolved Hide resolved
fvm/evm/stdlib/contract.go Show resolved Hide resolved
fvm/evm/stdlib/contract.go Show resolved Hide resolved
fvm/evm/stdlib/contract.go Outdated Show resolved Hide resolved
fvm/evm/stdlib/contract_test.go Outdated Show resolved Hide resolved
fvm/evm/stdlib/contract_test.go Outdated Show resolved Hide resolved
@m-Peter m-Peter force-pushed the abi-encoding-decoding-computation branch from 32e6b6f to 7863c84 Compare December 15, 2023 10:59
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Great work!

@turbolent turbolent requested a review from sideninja December 15, 2023 18:33
@m-Peter m-Peter force-pushed the abi-encoding-decoding-computation branch from a952d66 to dc6e35d Compare December 16, 2023 10:43
@turbolent turbolent enabled auto-merge December 16, 2023 21:03
@turbolent turbolent added this pull request to the merge queue Dec 16, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 16, 2023
@turbolent turbolent added this pull request to the merge queue Dec 17, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 17, 2023
@m-Peter m-Peter force-pushed the abi-encoding-decoding-computation branch from dc6e35d to b01b1f3 Compare December 19, 2023 16:19
@sideninja sideninja enabled auto-merge December 19, 2023 16:23
@sideninja sideninja added this pull request to the merge queue Dec 19, 2023
Merged via the queue into onflow:master with commit d0b0ef2 Dec 19, 2023
51 checks passed
@m-Peter m-Peter deleted the abi-encoding-decoding-computation branch December 20, 2023 09:13
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.

4 participants