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

Ensure the same runtime config is used #3768

Merged
merged 2 commits into from
Jan 4, 2023
Merged

Conversation

turbolent
Copy link
Member

Various places create Cadence runtime.Configs, e.g. NewReusableCadenceRuntime creates an empty one, even when the runtime was potentially created using a different one (e.g. by ReusableCadenceRuntimePool.newCustomRuntime).

Propagate the runtime configuration, so it is consistently the same everywhere in ReusableCadenceRuntimePool and ReusableCadenceRuntime.

@turbolent turbolent requested a review from m4ksio as a code owner January 4, 2023 18:29
@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2023

Codecov Report

Merging #3768 (bdcf630) into master (8ff3253) will increase coverage by 0.00%.
The diff coverage is 62.50%.

@@           Coverage Diff           @@
##           master    #3768   +/-   ##
=======================================
  Coverage   55.36%   55.37%           
=======================================
  Files         768      768           
  Lines       70191    70194    +3     
=======================================
+ Hits        38861    38868    +7     
+ Misses      28148    28145    -3     
+ Partials     3182     3181    -1     
Flag Coverage Δ
unittests 55.37% <62.50%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
fvm/runtime/reusable_cadence_runtime.go 41.59% <62.50%> (+0.68%) ⬆️
ledger/complete/wal/checkpoint_v6_reader.go 59.01% <0.00%> (-1.23%) ⬇️
consensus/hotstuff/eventloop/event_loop.go 74.82% <0.00%> (ø)
ledger/complete/wal/checkpointer.go 67.89% <0.00%> (+0.44%) ⬆️
fvm/environment/contract_updater.go 67.54% <0.00%> (+0.65%) ⬆️
engine/access/apiproxy/access_api_proxy.go 17.07% <0.00%> (+1.62%) ⬆️

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

FVM Benchstat comparison

This branch with compared with the base branch onflow:master commit 8ff3253

The command (for i in {1..7}; 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
RuntimeNFTBatchTransfer-2152ms ±10%151ms ± 4%~(p=0.836 n=7+6)
RuntimeTransaction/reference_tx-242.8ms ± 2%42.4ms ± 2%~(p=0.394 n=6+6)
RuntimeTransaction/convert_int_to_string-245.4ms ± 8%44.6ms ± 2%~(p=0.836 n=7+6)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-246.8ms ± 6%46.1ms ± 5%~(p=0.534 n=7+6)
RuntimeTransaction/get_signer_address-245.3ms ±20%44.4ms ± 8%~(p=0.620 n=7+7)
RuntimeTransaction/get_public_account-246.5ms ± 5%46.3ms ± 5%~(p=0.945 n=7+6)
RuntimeTransaction/get_account_and_get_balance-2413ms ± 6%413ms ± 2%~(p=0.620 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-2385ms ± 3%390ms ± 5%~(p=0.710 n=7+7)
RuntimeTransaction/get_account_and_get_storage_used-248.3ms ± 4%49.6ms ± 4%~(p=0.128 n=7+7)
RuntimeTransaction/get_account_and_get_storage_capacity-2342ms ± 3%347ms ± 5%~(p=0.535 n=7+7)
RuntimeTransaction/get_signer_vault-252.4ms ± 4%52.0ms ± 5%~(p=0.535 n=7+7)
RuntimeTransaction/get_signer_receiver-269.7ms ± 5%69.8ms ± 5%~(p=0.902 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-250.6ms ± 3%51.0ms ± 4%~(p=0.710 n=7+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2100ms ± 3%100ms ± 3%~(p=0.902 n=7+7)
RuntimeTransaction/create_new_account-21.07s ± 2%1.07s ± 5%~(p=0.710 n=7+7)
RuntimeTransaction/call_empty_contract_function-246.9ms ± 3%46.7ms ± 1%~(p=0.731 n=7+6)
RuntimeTransaction/emit_event-265.3ms ± 3%63.5ms ± 6%~(p=0.165 n=7+7)
RuntimeTransaction/borrow_array_from_storage-2172ms ± 4%173ms ± 2%~(p=0.383 n=7+7)
RuntimeTransaction/copy_array_from_storage-2177ms ± 5%173ms ± 2%~(p=0.097 n=7+7)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-26.56s ± 2%6.49s ± 2%~(p=0.128 n=7+7)
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/transfer_tokens-2293ms ± 2%288ms ± 2%−2.01%(p=0.038 n=7+7)
 
alloc/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/get_account_and_get_storage_used-236.0MB ± 5%37.3MB ± 3%+3.57%(p=0.026 n=7+7)
RuntimeNFTBatchTransfer-252.7MB ± 4%52.8MB ± 7%~(p=1.000 n=7+7)
RuntimeTransaction/reference_tx-234.7MB ± 3%35.3MB ± 4%~(p=0.318 n=7+7)
RuntimeTransaction/convert_int_to_string-235.2MB ± 3%34.9MB ± 4%~(p=0.535 n=7+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-235.5MB ± 6%36.5MB ± 3%~(p=0.181 n=7+6)
RuntimeTransaction/get_signer_address-235.1MB ± 4%34.9MB ± 4%~(p=0.902 n=7+7)
RuntimeTransaction/get_public_account-236.3MB ± 3%36.2MB ± 7%~(p=0.902 n=7+7)
RuntimeTransaction/get_account_and_get_balance-2121MB ± 5%122MB ± 1%~(p=0.209 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-2106MB ± 2%107MB ± 2%~(p=0.902 n=7+7)
RuntimeTransaction/get_account_and_get_storage_capacity-2103MB ± 2%103MB ± 4%~(p=0.620 n=7+7)
RuntimeTransaction/get_signer_vault-236.9MB ± 5%36.4MB ± 5%~(p=0.902 n=7+7)
RuntimeTransaction/get_signer_receiver-241.1MB ± 7%41.5MB ± 9%~(p=0.620 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-236.3MB ± 3%36.4MB ± 5%~(p=1.000 n=7+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-251.4MB ± 3%51.7MB ± 3%~(p=0.805 n=7+7)
RuntimeTransaction/create_new_account-2182MB ± 3%180MB ± 3%~(p=0.165 n=7+7)
RuntimeTransaction/call_empty_contract_function-235.6MB ± 5%36.0MB ± 3%~(p=0.456 n=7+7)
RuntimeTransaction/emit_event-241.1MB ± 7%40.1MB ± 4%~(p=0.165 n=7+7)
RuntimeTransaction/borrow_array_from_storage-271.3MB ± 4%69.2MB ± 7%~(p=0.128 n=7+7)
RuntimeTransaction/copy_array_from_storage-281.1MB ± 4%81.7MB ± 0%~(p=0.639 n=7+5)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-21.20GB ± 1%1.20GB ± 0%~(p=0.366 n=7+6)
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/transfer_tokens-283.8MB ± 1%82.3MB ± 4%−1.87%(p=0.011 n=7+7)
 
allocs/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeNFTBatchTransfer-2263k ± 0%263k ± 1%~(p=0.436 n=7+7)
RuntimeTransaction/reference_tx-282.2k ± 0%82.2k ± 0%~(p=0.397 n=7+7)
RuntimeTransaction/convert_int_to_string-294.3k ± 0%94.3k ± 0%~(p=0.619 n=7+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-2106k ± 0%106k ± 0%~(p=0.730 n=7+7)
RuntimeTransaction/get_signer_address-286.3k ± 0%86.3k ± 0%~(p=0.265 n=7+7)
RuntimeTransaction/get_public_account-2109k ± 0%109k ± 0%~(p=0.921 n=7+7)
RuntimeTransaction/get_account_and_get_balance-21.30M ± 0%1.30M ± 0%~(p=0.620 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-21.23M ± 0%1.23M ± 0%~(p=0.828 n=7+7)
RuntimeTransaction/get_account_and_get_storage_used-2119k ± 0%119k ± 0%~(p=0.219 n=7+7)
RuntimeTransaction/get_account_and_get_storage_capacity-21.10M ± 0%1.10M ± 0%~(p=0.197 n=7+7)
RuntimeTransaction/get_signer_vault-2123k ± 0%123k ± 0%~(p=0.687 n=7+7)
RuntimeTransaction/get_signer_receiver-2197k ± 0%197k ± 0%~(p=1.000 n=7+7)
RuntimeTransaction/transfer_tokens-2841k ± 0%841k ± 0%~(p=0.620 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2121k ± 0%121k ± 0%~(p=0.646 n=7+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2193k ± 0%193k ± 0%~(p=0.597 n=7+7)
RuntimeTransaction/create_new_account-22.27M ± 0%2.27M ± 0%~(p=0.836 n=7+6)
RuntimeTransaction/call_empty_contract_function-297.6k ± 0%97.6k ± 0%~(p=0.258 n=7+7)
RuntimeTransaction/emit_event-2137k ± 0%137k ± 0%~(p=0.736 n=7+7)
RuntimeTransaction/borrow_array_from_storage-2336k ± 0%336k ± 0%~(p=0.976 n=7+7)
RuntimeTransaction/copy_array_from_storage-2292k ± 0%292k ± 0%~(p=0.558 n=7+7)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-217.2M ± 0%17.2M ± 0%~(p=0.902 n=7+7)
 
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-23.10k ± 0%3.10k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_used-2402 ± 0%402 ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_capacity-21.70k ± 0%1.70k ± 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-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/get_signer_address-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/get_public_account-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_balance-224.3M ± 0%24.3M ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_available_balance-25.64M ± 0%5.64M ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_used-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/get_account_and_get_storage_capacity-25.64M ± 0%5.64M ± 0%~(all equal)
RuntimeTransaction/get_signer_vault-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/get_signer_receiver-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/transfer_tokens-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2334k ± 0%334k ± 0%~(all equal)
RuntimeTransaction/create_new_account-212.3M ± 0%12.3M ± 0%~(all equal)
RuntimeTransaction/call_empty_contract_function-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/emit_event-2331k ± 0%331k ± 0%~(all equal)
RuntimeTransaction/borrow_array_from_storage-2336k ± 0%336k ± 0%~(p=0.286 n=7+7)
RuntimeTransaction/copy_array_from_storage-2336k ± 0%336k ± 0%~(p=1.000 n=7+7)
 
us/txdelta
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-23.20k ± 2%3.17k ± 2%~(p=0.128 n=7+7)
 

@turbolent turbolent closed this Jan 4, 2023
@turbolent turbolent reopened this Jan 4, 2023
@turbolent
Copy link
Member Author

bors merge

@bors bors bot merged commit e96e36c into master Jan 4, 2023
@bors bors bot deleted the bastian/propagate-runtime-config branch January 4, 2023 19:43
bors bot added a commit that referenced this pull request Apr 5, 2023
4126: Add an extra parameter for runtime config in `NewCustomReusableCadenceRuntimePool` constructor r=janezpodhostnik a=m-Peter

Prior to this change, an empty `runtime.Config{}` was used and there was no way to set a custom config.

A similar improvement was done in this PR #3768

Co-authored-by: Ardit Marku <markoupetr@gmail.com>
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.

4 participants