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

refactor transaction invoker normal execution path out of Process #3366

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

pattyshack
Copy link
Contributor

I've made a few cosmetic changes to logExecutionIntensities, and switch fees deduction and storage check to use RunWithAllLimitsDisabled, but everything is basically identical to the original version.

common.TransactionLocation(proc.ID))

// This will be used to charge fees.
computationUsed = env.ComputationUsed()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note that i've also move these two line to up, before checking for execution error, since we need the computationUsed for fees deduction on the error path.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 11, 2022

FVM Benchstat comparison

This branch with compared with the base branch onflow:master commit 4cd3c83

The command (for i in {1..10}; do go test ./fvm ./engine/execution/computation --bench . --tags relic -shuffle=on --benchmem --run ^$; done) was used.

Collapsed results for better readability

old.txtnew.txt
time/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/get_account_and_get_available_balance-2262ms ± 2%266ms ± 3%+1.43%(p=0.043 n=10+10)
RuntimeTransaction/transfer_tokens-2198ms ± 2%201ms ± 2%+1.28%(p=0.019 n=9+9)
RuntimeTransaction/reference_tx-226.8ms ± 7%25.8ms ±15%~(p=0.143 n=10+10)
RuntimeTransaction/convert_int_to_string-229.6ms ± 6%29.7ms ±11%~(p=0.436 n=10+10)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-231.6ms ± 9%30.9ms ±10%~(p=0.436 n=10+10)
RuntimeTransaction/get_signer_address-227.1ms ±13%27.1ms ±10%~(p=0.971 n=10+10)
RuntimeTransaction/get_public_account-231.1ms ±11%30.5ms ± 7%~(p=0.278 n=10+9)
RuntimeTransaction/get_account_and_get_balance-2289ms ± 3%291ms ± 2%~(p=0.321 n=9+8)
RuntimeTransaction/get_account_and_get_storage_used-233.9ms ± 6%33.8ms ± 8%~(p=1.000 n=10+9)
RuntimeTransaction/get_account_and_get_storage_capacity-2233ms ± 3%232ms ± 4%~(p=0.604 n=9+10)
RuntimeTransaction/get_signer_vault-236.1ms ± 7%35.3ms ± 9%~(p=0.436 n=10+10)
RuntimeTransaction/get_signer_receiver-245.9ms ±13%46.0ms ± 7%~(p=0.684 n=10+10)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-234.6ms ±13%34.7ms ± 5%~(p=0.912 n=10+10)
RuntimeTransaction/load_and_save_long_string_on_signers_address-276.1ms ± 4%76.1ms ± 5%~(p=0.912 n=10+10)
RuntimeTransaction/create_new_account-2837ms ± 2%842ms ± 5%~(p=0.853 n=10+10)
RuntimeTransaction/call_empty_contract_function-229.4ms ± 9%30.5ms ±11%~(p=0.165 n=10+10)
RuntimeTransaction/emit_event-243.0ms ± 7%42.6ms ± 6%~(p=0.529 n=10+10)
RuntimeTransaction/borrow_array_from_storage-2130ms ± 2%130ms ± 2%~(p=0.684 n=10+10)
RuntimeTransaction/copy_array_from_storage-2132ms ± 5%134ms ± 4%~(p=0.353 n=10+10)
RuntimeNFTBatchTransfer-2114ms ±14%112ms ± 3%~(p=0.604 n=10+9)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-24.82s ± 3%4.86s ± 4%~(p=0.481 n=10+10)
 
computationdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-2202 ± 0%202 ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-2502 ± 0%502 ± 0%~(all equal)
RuntimeTransaction/get_signer_address-2302 ± 0%302 ± 0%~(all equal)
RuntimeTransaction/get_public_account-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_balance-21.00k ± 0%1.00k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_available_balance-22.60k ± 0%2.60k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_used-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_capacity-21.30k ± 0%1.30k ± 0%~(all equal)
RuntimeTransaction/get_signer_vault-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/get_signer_receiver-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/transfer_tokens-23.50k ± 0%3.50k ± 0%~(all equal)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/create_new_account-2202 ± 0%202 ± 0%~(all equal)
RuntimeTransaction/call_empty_contract_function-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/emit_event-2602 ± 0%602 ± 0%~(all equal)
RuntimeTransaction/borrow_array_from_storage-22.60k ± 0%2.60k ± 0%~(all equal)
RuntimeTransaction/copy_array_from_storage-22.60k ± 0%2.60k ± 0%~(all equal)
 
interactionsdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/get_signer_address-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/get_public_account-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_balance-216.7M ± 0%16.7M ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_available_balance-25.13M ± 0%5.13M ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_used-244.3k ± 0%44.3k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_capacity-25.13M ± 0%5.13M ± 0%~(all equal)
RuntimeTransaction/get_signer_vault-244.5k ± 0%44.5k ± 0%~(all equal)
RuntimeTransaction/get_signer_receiver-244.9k ± 0%44.9k ± 0%~(all equal)
RuntimeTransaction/transfer_tokens-245.2k ± 0%45.2k ± 0%~(all equal)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-244.4k ± 0%44.4k ± 0%~(all equal)
RuntimeTransaction/load_and_save_long_string_on_signers_address-247.2k ± 0%47.2k ± 0%~(all equal)
RuntimeTransaction/create_new_account-28.39M ± 0%8.39M ± 0%~(all equal)
RuntimeTransaction/call_empty_contract_function-244.5k ± 0%44.5k ± 0%~(all equal)
RuntimeTransaction/emit_event-244.5k ± 0%44.5k ± 0%~(all equal)
RuntimeTransaction/borrow_array_from_storage-249.7k ± 0%49.7k ± 0%~(all equal)
RuntimeTransaction/copy_array_from_storage-249.7k ± 0%49.7k ± 0%~(all equal)
 
alloc/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/transfer_tokens-283.1MB ± 4%85.1MB ± 2%+2.36%(p=0.023 n=10+10)
RuntimeTransaction/reference_tx-237.2MB ± 8%35.5MB ± 8%~(p=0.075 n=10+10)
RuntimeTransaction/convert_int_to_string-237.6MB ± 6%38.0MB ± 9%~(p=0.579 n=10+10)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-238.3MB ± 6%37.3MB ± 9%~(p=0.247 n=10+10)
RuntimeTransaction/get_signer_address-235.7MB ±12%36.2MB ± 9%~(p=0.684 n=10+10)
RuntimeTransaction/get_public_account-239.0MB ± 9%38.2MB ± 4%~(p=0.165 n=10+10)
RuntimeTransaction/get_account_and_get_available_balance-2109MB ± 3%110MB ± 2%~(p=0.353 n=10+10)
RuntimeTransaction/get_account_and_get_storage_used-239.0MB ± 8%39.1MB ± 6%~(p=0.968 n=10+9)
RuntimeTransaction/get_account_and_get_storage_capacity-2105MB ± 6%105MB ± 3%~(p=0.780 n=10+9)
RuntimeTransaction/get_signer_vault-239.5MB ±10%38.5MB ± 7%~(p=0.280 n=10+10)
RuntimeTransaction/get_signer_receiver-242.1MB ± 7%42.3MB ± 6%~(p=0.971 n=10+10)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-238.9MB ± 7%38.1MB ± 7%~(p=0.182 n=9+10)
RuntimeTransaction/create_new_account-2196MB ± 3%197MB ± 0%~(p=0.875 n=10+6)
RuntimeTransaction/call_empty_contract_function-236.3MB ± 7%37.6MB ±11%~(p=0.063 n=10+10)
RuntimeTransaction/emit_event-240.4MB ± 6%40.2MB ± 5%~(p=0.739 n=10+10)
RuntimeTransaction/borrow_array_from_storage-268.7MB ± 5%68.6MB ± 5%~(p=0.631 n=10+10)
RuntimeTransaction/copy_array_from_storage-281.0MB ± 2%79.9MB ± 4%~(p=0.353 n=10+10)
RuntimeNFTBatchTransfer-257.6MB ± 3%57.2MB ± 4%~(p=0.605 n=9+9)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-21.28GB ± 1%1.28GB ± 1%~(p=0.912 n=10+10)
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/load_and_save_long_string_on_signers_address-256.1MB ± 1%55.5MB ± 1%−1.02%(p=0.003 n=9+7)
RuntimeTransaction/get_account_and_get_balance-2130MB ± 1%128MB ± 3%−1.60%(p=0.022 n=9+10)
 
allocs/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/get_account_and_get_available_balance-21.34M ± 0%1.34M ± 0%~(p=0.108 n=10+9)
RuntimeTransaction/transfer_tokens-2848k ± 0%848k ± 0%~(p=0.271 n=10+10)
RuntimeTransaction/create_new_account-22.55M ± 0%2.55M ± 0%~(p=0.796 n=10+10)
RuntimeNFTBatchTransfer-2280k ± 0%280k ± 0%~(p=0.912 n=10+10)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-219.8M ± 0%19.8M ± 0%~(p=0.278 n=9+10)
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/get_account_and_get_storage_capacity-21.21M ± 0%1.21M ± 0%−0.00%(p=0.023 n=10+10)
RuntimeTransaction/get_account_and_get_balance-21.50M ± 0%1.50M ± 0%−0.00%(p=0.009 n=10+10)
RuntimeTransaction/copy_array_from_storage-2289k ± 0%289k ± 0%−0.01%(p=0.028 n=10+10)
RuntimeTransaction/borrow_array_from_storage-2333k ± 0%332k ± 0%−0.02%(p=0.000 n=10+10)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2221k ± 0%221k ± 0%−0.02%(p=0.000 n=10+10)
RuntimeTransaction/get_signer_receiver-2190k ± 0%190k ± 0%−0.02%(p=0.000 n=10+9)
RuntimeTransaction/call_empty_contract_function-290.4k ± 0%90.4k ± 0%−0.03%(p=0.000 n=10+10)
RuntimeTransaction/get_account_and_get_storage_used-2121k ± 0%121k ± 0%−0.04%(p=0.000 n=10+10)
RuntimeTransaction/emit_event-2129k ± 0%129k ± 0%−0.04%(p=0.000 n=10+10)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2119k ± 0%119k ± 0%−0.04%(p=0.000 n=9+10)
RuntimeTransaction/get_signer_vault-2118k ± 0%118k ± 0%−0.04%(p=0.000 n=10+10)
RuntimeTransaction/convert_int_to_string-287.7k ± 0%87.6k ± 0%−0.04%(p=0.000 n=10+10)
RuntimeTransaction/get_public_account-2101k ± 0%101k ± 0%−0.04%(p=0.000 n=10+10)
RuntimeTransaction/get_signer_address-279.7k ± 0%79.6k ± 0%−0.05%(p=0.000 n=10+10)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-298.9k ± 0%98.9k ± 0%−0.05%(p=0.000 n=10+10)
RuntimeTransaction/reference_tx-275.5k ± 0%75.4k ± 0%−0.07%(p=0.000 n=10+10)
 
us/txdelta
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-22.35k ± 3%2.37k ± 4%~(p=0.469 n=10+10)
 

fvm/environment/env.go Show resolved Hide resolved
Comment on lines +224 to +226
if !env.Logger().Debug().Enabled() {
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Much better, thanks!

@pattyshack
Copy link
Contributor Author

bors merge

bors bot added a commit that referenced this pull request Oct 13, 2022
3366: refactor transaction invoker normal execution path out of Process r=pattyshack a=pattyshack

I've made a few cosmetic changes to logExecutionIntensities, and switch fees deduction and storage check to use RunWithAllLimitsDisabled, but everything is basically identical to the original version.

3370: Avoid oppressive terminology r=turbolent a=turbolent

See e.g. https://datatracker.ietf.org/doc/draft-knodel-terminology/

3381: [Integration] Upgrading flow-emulator to v0.38.1 r=Tonix517 a=Tonix517

https://github.com/onflow/flow-emulator/releases/tag/v0.38.1

**Test**
- [X] `make test`
- [X] build and run load test to localnet

Co-authored-by: Patrick Lee <patrick.lee@dapperlabs.com>
Co-authored-by: Bastian Müller <bastian@axiomzen.co>
Co-authored-by: Tony Z <tony.zhang@dapperlabs.com>
@bors
Copy link
Contributor

bors bot commented Oct 13, 2022

Build failed (retrying...):

I've made a few cosmetic changes to logExecutionIntensities, and switch fees
deduction and storage check to use RunWithAllLimitsDisabled, but everything is
basically identical to the original version.
@pattyshack pattyshack force-pushed the patrick/refactor-normal-execution branch from f24682b to beb1ab2 Compare October 13, 2022 18:59
@bors
Copy link
Contributor

bors bot commented Oct 13, 2022

Canceled.

@pattyshack
Copy link
Contributor Author

bors merge

@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2022

Codecov Report

Merging #3366 (beb1ab2) into master (5a6646f) will decrease coverage by 0.61%.
The diff coverage is 55.10%.

@@            Coverage Diff             @@
##           master    #3366      +/-   ##
==========================================
- Coverage   55.00%   54.38%   -0.62%     
==========================================
  Files         734      663      -71     
  Lines       67341    60400    -6941     
==========================================
- Hits        37040    32850    -4190     
+ Misses      27264    24902    -2362     
+ Partials     3037     2648     -389     
Flag Coverage Δ
unittests 54.38% <55.10%> (-0.62%) ⬇️

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

Impacted Files Coverage Δ
admin/commands/common/get_identity.go 0.00% <0.00%> (ø)
cmd/execution_builder.go 0.00% <0.00%> (ø)
cmd/util/ledger/reporters/account_reporter.go 0.00% <0.00%> (ø)
cmd/verification_builder.go 0.00% <0.00%> (ø)
engine/access/ping/engine.go 0.00% <ø> (ø)
engine/access/rest/router.go 100.00% <ø> (ø)
engine/collection/compliance/core.go 77.72% <0.00%> (-1.18%) ⬇️
engine/common/follower/engine.go 51.29% <0.00%> (-0.51%) ⬇️
engine/common/synchronization/engine.go 73.30% <ø> (ø)
engine/consensus/compliance/core.go 74.30% <0.00%> (-0.90%) ⬇️
... and 189 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@bors bors bot merged commit 826d4ed into master Oct 13, 2022
@bors bors bot deleted the patrick/refactor-normal-execution branch October 13, 2022 19: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.

4 participants