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

Define vm interface in fvm instead of computer #3796

Merged
merged 1 commit into from
Jan 12, 2023
Merged

Conversation

pattyshack
Copy link
Contributor

Note that we can't simply redefine fvm.VirtualMachine from a struct into an interface since that breaks the emulator.

@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2023

Codecov Report

Merging #3796 (c03b50a) into master (54b48ce) will increase coverage by 4.53%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master    #3796      +/-   ##
==========================================
+ Coverage   53.18%   57.71%   +4.53%     
==========================================
  Files         618      734     +116     
  Lines       54183    66591   +12408     
==========================================
+ Hits        28815    38436    +9621     
- Misses      23034    25009    +1975     
- Partials     2334     3146     +812     
Flag Coverage Δ
unittests 57.71% <50.00%> (+4.53%) ⬆️

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

Impacted Files Coverage Δ
cmd/execution_builder.go 0.00% <0.00%> (ø)
cmd/util/ledger/reporters/account_reporter.go 0.00% <ø> (ø)
engine/execution/computation/computer/computer.go 86.60% <ø> (ø)
fvm/fvm.go 77.27% <ø> (ø)
engine/execution/computation/manager.go 79.42% <50.00%> (ø)
module/chunks/chunkVerifier.go 67.00% <100.00%> (ø)
cmd/bootstrap/cmd/genconfig.go 27.45% <0.00%> (-1.72%) ⬇️
model/flow/identity.go 51.88% <0.00%> (ø)
...sus/approvals/assignment_collector_statemachine.go 48.55% <0.00%> (ø)
utils/io/file_unix.go
... and 185 more

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 11, 2023

FVM Benchstat comparison

This branch with compared with the base branch onflow:master commit 6f10fa0

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
RuntimeTransaction/transfer_tokens-2202ms ± 1%205ms ± 1%+1.36%(p=0.015 n=6+6)
RuntimeNFTBatchTransfer-2114ms ± 4%115ms ± 3%~(p=0.628 n=7+6)
RuntimeTransaction/reference_tx-233.8ms ±15%33.3ms ± 3%~(p=0.710 n=7+7)
RuntimeTransaction/convert_int_to_string-234.8ms ± 4%34.5ms ± 4%~(p=0.731 n=7+6)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-236.8ms ± 6%37.9ms ±16%~(p=0.836 n=6+7)
RuntimeTransaction/get_signer_address-234.3ms ± 6%35.4ms ±15%~(p=0.456 n=7+7)
RuntimeTransaction/get_public_account-236.0ms ± 4%36.3ms ± 4%~(p=0.620 n=7+7)
RuntimeTransaction/get_account_and_get_balance-2298ms ± 1%300ms ± 1%~(p=0.534 n=6+7)
RuntimeTransaction/get_account_and_get_available_balance-2276ms ± 3%276ms ± 2%~(p=0.945 n=6+7)
RuntimeTransaction/get_account_and_get_storage_used-237.9ms ± 5%37.7ms ± 4%~(p=0.836 n=6+7)
RuntimeTransaction/get_account_and_get_storage_capacity-2247ms ± 2%247ms ± 3%~(p=0.731 n=7+6)
RuntimeTransaction/get_signer_vault-240.3ms ± 6%41.0ms ± 4%~(p=0.535 n=7+7)
RuntimeTransaction/get_signer_receiver-251.5ms ± 6%49.8ms ± 6%~(p=0.128 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-238.9ms ± 2%39.7ms ± 3%~(p=0.073 n=6+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-279.0ms ± 2%78.6ms ± 5%~(p=1.000 n=7+7)
RuntimeTransaction/create_new_account-2820ms ± 2%821ms ± 1%~(p=0.710 n=7+7)
RuntimeTransaction/call_empty_contract_function-235.4ms ± 3%35.7ms ± 6%~(p=0.383 n=7+7)
RuntimeTransaction/emit_event-249.6ms ± 6%49.9ms ± 3%~(p=0.456 n=7+7)
RuntimeTransaction/borrow_array_from_storage-2135ms ± 1%136ms ± 1%~(p=0.731 n=6+7)
RuntimeTransaction/copy_array_from_storage-2139ms ± 3%139ms ± 1%~(p=0.710 n=7+7)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-24.63s ± 1%4.63s ± 1%~(p=0.836 n=7+6)
 
alloc/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeNFTBatchTransfer-253.2MB ± 4%53.7MB ± 4%~(p=0.383 n=7+7)
RuntimeTransaction/reference_tx-234.6MB ± 3%34.9MB ± 1%~(p=0.755 n=7+5)
RuntimeTransaction/convert_int_to_string-235.3MB ± 3%35.1MB ± 3%~(p=0.620 n=7+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-235.3MB ± 4%35.5MB ± 5%~(p=0.902 n=7+7)
RuntimeTransaction/get_signer_address-235.1MB ± 4%35.0MB ± 3%~(p=0.902 n=7+7)
RuntimeTransaction/get_public_account-236.0MB ± 3%36.5MB ± 5%~(p=0.318 n=7+7)
RuntimeTransaction/get_account_and_get_balance-2121MB ± 2%122MB ± 2%~(p=0.710 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-2105MB ± 3%106MB ± 2%~(p=0.295 n=7+6)
RuntimeTransaction/get_account_and_get_storage_used-236.1MB ± 5%35.8MB ± 4%~(p=0.620 n=7+7)
RuntimeTransaction/get_account_and_get_storage_capacity-2102MB ± 2%102MB ± 2%~(p=0.805 n=7+7)
RuntimeTransaction/get_signer_vault-236.4MB ± 3%36.8MB ± 7%~(p=0.259 n=7+7)
RuntimeTransaction/get_signer_receiver-241.7MB ± 5%40.1MB ± 6%~(p=0.053 n=7+7)
RuntimeTransaction/transfer_tokens-283.1MB ± 5%82.8MB ± 2%~(p=0.902 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-235.5MB ± 3%35.7MB ± 3%~(p=0.620 n=7+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-251.7MB ± 3%51.2MB ± 4%~(p=0.534 n=7+6)
RuntimeTransaction/create_new_account-2181MB ± 1%183MB ± 2%~(p=0.073 n=7+7)
RuntimeTransaction/call_empty_contract_function-235.1MB ± 3%35.7MB ± 4%~(p=0.456 n=7+7)
RuntimeTransaction/emit_event-240.3MB ± 5%40.1MB ± 6%~(p=0.805 n=7+7)
RuntimeTransaction/borrow_array_from_storage-269.9MB ± 5%69.7MB ± 3%~(p=1.000 n=7+7)
RuntimeTransaction/copy_array_from_storage-281.8MB ± 3%81.6MB ± 1%~(p=0.710 n=7+7)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-21.20GB ± 1%1.19GB ± 0%~(p=0.138 n=7+6)
 
allocs/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeNFTBatchTransfer-2268k ± 1%268k ± 1%~(p=0.436 n=7+7)
RuntimeTransaction/reference_tx-282.7k ± 0%82.7k ± 0%~(p=0.784 n=7+7)
RuntimeTransaction/convert_int_to_string-294.9k ± 0%94.9k ± 0%~(p=0.345 n=6+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-2106k ± 0%106k ± 0%~(p=0.971 n=7+7)
RuntimeTransaction/get_signer_address-286.9k ± 0%86.9k ± 0%~(p=0.513 n=7+7)
RuntimeTransaction/get_public_account-2109k ± 0%109k ± 0%~(p=0.312 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-21.23M ± 0%1.23M ± 0%~(p=1.000 n=7+7)
RuntimeTransaction/get_account_and_get_storage_used-2119k ± 0%119k ± 0%~(p=0.138 n=7+6)
RuntimeTransaction/get_account_and_get_storage_capacity-21.11M ± 0%1.11M ± 0%~(p=0.901 n=7+7)
RuntimeTransaction/get_signer_vault-2123k ± 0%123k ± 0%~(p=0.977 n=7+6)
RuntimeTransaction/transfer_tokens-2842k ± 0%842k ± 0%~(p=0.314 n=6+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2122k ± 0%122k ± 0%~(p=0.558 n=7+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2194k ± 0%194k ± 0%~(p=0.917 n=6+7)
RuntimeTransaction/create_new_account-22.27M ± 0%2.27M ± 0%~(p=0.259 n=7+7)
RuntimeTransaction/call_empty_contract_function-298.2k ± 0%98.2k ± 0%~(p=0.881 n=7+7)
RuntimeTransaction/emit_event-2138k ± 0%138k ± 0%~(p=0.878 n=7+7)
RuntimeTransaction/borrow_array_from_storage-2336k ± 0%336k ± 0%~(p=0.477 n=7+7)
RuntimeTransaction/copy_array_from_storage-2293k ± 0%293k ± 0%~(p=0.642 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.805 n=7+7)
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/get_account_and_get_balance-21.30M ± 0%1.30M ± 0%−0.01%(p=0.005 n=7+6)
RuntimeTransaction/get_signer_receiver-2198k ± 0%198k ± 0%−0.01%(p=0.002 n=6+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%~(all equal)
RuntimeTransaction/copy_array_from_storage-2336k ± 0%336k ± 0%~(all equal)
 
us/txdelta
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-22.26k ± 1%2.26k ± 1%~(p=0.809 n=7+6)
 

fvm/fvm.go Outdated Show resolved Hide resolved
Note that we can't simply redefine fvm.VirtualMachine from a struct into an
interface since that breaks the emulator.
@pattyshack
Copy link
Contributor Author

bors merge

@bors bors bot merged commit 08a11c3 into master Jan 12, 2023
@bors bors bot deleted the patrick/vm-interface branch January 12, 2023 18:06
This pull request was closed.
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