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

[Sync] Sync master to feature/dynamic-protocol-state #4578

Conversation

durkmurder
Copy link
Member

No description provided.

UlyanaAndrukhiv and others added 15 commits July 20, 2023 22:18
4572: `scriptExecutor` should populate env values even when the script errors r=janezpodhostnik a=m-Peter

While working on Flow Emulator, trying to aggregate `computationUsed` and `memoryEstimate` metrics for scripts & transactions, I stumbled upon something that seems like a bug. When a script is reverted, e.g. due to exceeding computation limit, the `ProcedureOutput` is not properly populated.

**Before:** `computationUsed` & `memoryEstimate` are both `0`
![reverted-script-before](https://github.com/onflow/flow-go/assets/1778965/96ad1ae6-f563-4ce3-85a5-e9ac01490831)

**After:** `computationUsed` & `memoryEstimate` are both set
![reverted-script-after](https://github.com/onflow/flow-go/assets/1778965/70c274b4-f45b-4f77-af8d-2d8faf22b1d5)

This is due to the fact that `scriptExecutor.executeScript()` returns early when it errors, and never calls `executor.output.PopulateEnvironmentValues(executor.env)`

**Note:** I can complement with a relevant test case, if you can point me to the most appropriate test file. I was not able to find a fitting place for this test case.


Co-authored-by: Ardit Marku <markoupetr@gmail.com>
Co-authored-by: Janez Podhostnik <67895329+janezpodhostnik@users.noreply.github.com>
@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2023

Codecov Report

Merging #4578 (b53dd43) into feature/dynamic-protocol-state (2528190) will increase coverage by 0.58%.
The diff coverage is 45.94%.

@@                        Coverage Diff                         @@
##           feature/dynamic-protocol-state    #4578      +/-   ##
==================================================================
+ Coverage                           56.25%   56.83%   +0.58%     
==================================================================
  Files                                 653      494     -159     
  Lines                               64699    44194   -20505     
==================================================================
- Hits                                36396    25119   -11277     
+ Misses                              25362    17183    -8179     
+ Partials                             2941     1892    -1049     
Flag Coverage Δ
unittests 56.83% <45.94%> (+0.58%) ⬆️

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

Impacted Files Coverage Δ
fvm/environment/env.go 100.00% <ø> (ø)
model/flow/identifierList.go 22.36% <0.00%> (+0.84%) ⬆️
model/verification/chunkDataPackRequest.go 43.75% <0.00%> (-6.25%) ⬇️
network/p2p/inspector/internal/cache/cache.go 64.70% <ø> (ø)
network/p2p/middleware/middleware.go 1.71% <0.00%> (ø)
network/p2p/p2pbuilder/libp2pNodeBuilder.go 0.00% <0.00%> (ø)
network/p2p/test/fixtures.go 30.28% <0.00%> (ø)
state/protocol/badger/snapshot.go 62.77% <ø> (ø)
storage/badger/cleaner.go 0.00% <0.00%> (ø)
utils/unittest/chain_suite.go 0.00% <0.00%> (ø)
... and 23 more

... and 344 files with indirect coverage changes

Copy link
Contributor

@janezpodhostnik janezpodhostnik left a comment

Choose a reason for hiding this comment

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

rubber stamp

@durkmurder durkmurder merged commit fffb613 into feature/dynamic-protocol-state Jul 24, 2023
@durkmurder durkmurder deleted the yurii/sync-master-to-dynamic-protocol-state branch July 24, 2023 16:46
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.