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

Improve transaction verifier clarity #3771

Merged
merged 1 commit into from
Jan 5, 2023
Merged

Improve transaction verifier clarity #3771

merged 1 commit into from
Jan 5, 2023

Conversation

pattyshack
Copy link
Contributor

As per Leo's suggestions.

Co-authored-by: Leo Zhang (zhangchiqing) zhangchiqing@gmail.com

@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 3745401

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/reference_tx-228.9ms ± 3%29.2ms ± 3%~(p=0.295 n=6+7)
RuntimeTransaction/convert_int_to_string-232.1ms ±15%30.1ms ± 3%~(p=0.101 n=7+6)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-232.3ms ± 1%31.9ms ± 4%~(p=0.792 n=5+6)
RuntimeTransaction/get_signer_address-230.7ms ±14%31.2ms ±23%~(p=0.805 n=7+7)
RuntimeTransaction/get_public_account-231.8ms ± 5%31.5ms ± 2%~(p=0.445 n=7+6)
RuntimeTransaction/get_account_and_get_balance-2261ms ± 3%259ms ± 3%~(p=0.620 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-2241ms ± 7%236ms ± 2%~(p=0.318 n=7+7)
RuntimeTransaction/get_account_and_get_storage_used-234.1ms ± 5%33.2ms ± 1%~(p=0.295 n=7+6)
RuntimeTransaction/get_account_and_get_storage_capacity-2214ms ± 3%214ms ± 3%~(p=1.000 n=7+7)
RuntimeTransaction/get_signer_vault-237.3ms ± 6%36.3ms ± 4%~(p=0.209 n=7+7)
RuntimeTransaction/get_signer_receiver-246.7ms ± 7%47.8ms ± 6%~(p=0.318 n=7+7)
RuntimeTransaction/transfer_tokens-2190ms ± 2%188ms ± 3%~(p=0.456 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-235.5ms ± 2%35.6ms ± 3%~(p=0.710 n=7+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-276.8ms ± 4%76.6ms ± 3%~(p=0.805 n=7+7)
RuntimeTransaction/create_new_account-2799ms ± 2%798ms ± 2%~(p=0.945 n=7+6)
RuntimeTransaction/call_empty_contract_function-232.1ms ± 5%31.9ms ± 4%~(p=0.710 n=7+7)
RuntimeTransaction/emit_event-245.4ms ± 4%46.7ms ± 6%~(p=0.209 n=7+7)
RuntimeTransaction/borrow_array_from_storage-2128ms ± 3%129ms ± 2%~(p=0.456 n=7+7)
RuntimeTransaction/copy_array_from_storage-2126ms ± 3%127ms ± 4%~(p=0.710 n=7+7)
RuntimeNFTBatchTransfer-2116ms ± 2%116ms ± 5%~(p=0.731 n=6+7)
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-24.30s ± 2%4.25s ± 1%~(p=0.073 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%~(all equal)
RuntimeTransaction/copy_array_from_storage-2336k ± 0%336k ± 0%~(all equal)
 
alloc/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-234.5MB ± 3%35.2MB ± 2%~(p=0.073 n=7+7)
RuntimeTransaction/convert_int_to_string-235.4MB ± 3%34.7MB ± 3%~(p=0.097 n=7+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-235.7MB ± 5%35.7MB ± 4%~(p=0.710 n=7+7)
RuntimeTransaction/get_signer_address-235.1MB ± 1%35.0MB ± 5%~(p=0.534 n=6+7)
RuntimeTransaction/get_public_account-235.4MB ± 4%36.0MB ± 1%~(p=0.534 n=7+6)
RuntimeTransaction/get_account_and_get_balance-2121MB ± 3%121MB ± 3%~(p=1.000 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-2106MB ± 3%106MB ± 2%~(p=1.000 n=7+7)
RuntimeTransaction/get_account_and_get_storage_used-236.7MB ± 5%36.1MB ± 1%~(p=0.445 n=7+6)
RuntimeTransaction/get_account_and_get_storage_capacity-2103MB ± 2%104MB ± 1%~(p=0.234 n=7+6)
RuntimeTransaction/get_signer_vault-237.0MB ± 2%36.6MB ± 4%~(p=0.456 n=7+7)
RuntimeTransaction/get_signer_receiver-240.5MB ± 5%41.0MB ± 4%~(p=0.535 n=7+7)
RuntimeTransaction/transfer_tokens-283.5MB ± 2%83.2MB ± 4%~(p=0.383 n=7+7)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-235.9MB ± 3%36.0MB ± 3%~(p=1.000 n=7+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-252.7MB ± 3%52.7MB ± 3%~(p=0.805 n=7+7)
RuntimeTransaction/create_new_account-2184MB ± 3%182MB ± 3%~(p=0.318 n=7+7)
RuntimeTransaction/call_empty_contract_function-235.4MB ± 3%35.4MB ± 2%~(p=0.805 n=7+7)
RuntimeTransaction/emit_event-240.3MB ± 5%41.2MB ± 6%~(p=0.209 n=7+7)
RuntimeTransaction/borrow_array_from_storage-269.6MB ± 4%70.8MB ± 4%~(p=0.318 n=7+7)
RuntimeTransaction/copy_array_from_storage-282.1MB ± 2%81.2MB ± 2%~(p=0.073 n=7+7)
RuntimeNFTBatchTransfer-254.8MB ± 5%54.6MB ± 6%~(p=0.902 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.20GB ± 0%~(p=0.535 n=7+7)
 
allocs/opdelta
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/reference_tx-282.3k ± 0%82.3k ± 0%~(p=0.925 n=7+7)
RuntimeTransaction/convert_int_to_string_and_concatenate_it-2106k ± 0%106k ± 0%~(p=0.559 n=7+7)
RuntimeTransaction/get_signer_address-286.5k ± 0%86.5k ± 0%~(p=0.736 n=7+7)
RuntimeTransaction/get_public_account-2109k ± 0%109k ± 0%~(p=0.928 n=7+7)
RuntimeTransaction/get_account_and_get_balance-21.30M ± 0%1.30M ± 0%~(p=0.365 n=7+7)
RuntimeTransaction/get_account_and_get_available_balance-21.23M ± 0%1.23M ± 0%~(p=0.833 n=7+7)
RuntimeTransaction/get_account_and_get_storage_used-2119k ± 0%119k ± 0%~(p=0.197 n=7+7)
RuntimeTransaction/get_account_and_get_storage_capacity-21.10M ± 0%1.10M ± 0%~(p=0.685 n=7+7)
RuntimeTransaction/get_signer_vault-2123k ± 0%123k ± 0%~(p=0.275 n=7+7)
RuntimeTransaction/get_signer_receiver-2197k ± 0%197k ± 0%~(p=0.403 n=7+7)
RuntimeTransaction/transfer_tokens-2842k ± 0%842k ± 0%~(p=0.422 n=7+6)
RuntimeTransaction/load_and_save_empty_string_on_signers_address-2121k ± 0%121k ± 0%~(p=0.711 n=7+7)
RuntimeTransaction/load_and_save_long_string_on_signers_address-2193k ± 0%193k ± 0%~(p=1.000 n=7+7)
RuntimeTransaction/create_new_account-22.27M ± 0%2.27M ± 0%~(p=0.135 n=7+7)
RuntimeTransaction/call_empty_contract_function-297.7k ± 0%97.7k ± 0%~(p=0.914 n=7+6)
RuntimeTransaction/emit_event-2137k ± 0%137k ± 0%~(p=0.366 n=7+6)
RuntimeTransaction/borrow_array_from_storage-2336k ± 0%336k ± 0%~(p=0.510 n=7+7)
RuntimeTransaction/copy_array_from_storage-2292k ± 0%292k ± 0%~(p=0.704 n=7+6)
RuntimeNFTBatchTransfer-2268k ± 1%268k ± 0%~(p=0.628 n=7+6)
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.456 n=7+7)
pkg:github.com/onflow/flow-go/fvm goos:linux goarch:amd64
RuntimeTransaction/convert_int_to_string-294.5k ± 0%94.4k ± 0%−0.01%(p=0.019 n=7+6)
 
us/txdelta
pkg:github.com/onflow/flow-go/engine/execution/computation goos:linux goarch:amd64
ComputeBlock/16/cols/128/txes-22.10k ± 2%2.08k ± 1%~(p=0.073 n=7+7)
 

// verifyAccountSignatures() is always called after getAccountKeys()
// (i.e., accountKey is always initialized by the time
// verifyAccountSignatures is called).
verified bool
Copy link
Contributor

Choose a reason for hiding this comment

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

verified=true reads as "signature was successfully verified" to me. Which is not what this is for. This is more like: "this signature already went through the verification step". Maybe a name like verificationDone would make that clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point. i'll update the name

As per Leo's suggestions.

Co-authored-by: Leo Zhang (zhangchiqing) <zhangchiqing@gmail.com>
@pattyshack
Copy link
Contributor Author

bors merge

@bors bors bot merged commit 810bed5 into master Jan 5, 2023
@bors bors bot deleted the patrick/leos-comments branch January 5, 2023 18:07
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