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

Differentate invalidated resource use errors #1706

Merged

Conversation

turbolent
Copy link
Member

Closes dapperlabs/cadence-private-issues#55

Description

Differentiate between use after destruction (user error) and use after invalidation (internal error)


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@turbolent turbolent self-assigned this Jun 7, 2022
@codecov
Copy link

codecov bot commented Jun 7, 2022

Codecov Report

Merging #1706 (8187b93) into master (ec9fb29) will increase coverage by 0.09%.
The diff coverage is 61.53%.

@@            Coverage Diff             @@
##           master    #1706      +/-   ##
==========================================
+ Coverage   76.63%   76.72%   +0.09%     
==========================================
  Files         292      292              
  Lines       61195    61185      -10     
==========================================
+ Hits        46898    46946      +48     
+ Misses      12684    12626      -58     
  Partials     1613     1613              
Flag Coverage Δ
unittests 76.72% <61.53%> (+0.09%) ⬆️

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

Impacted Files Coverage Δ
runtime/interpreter/errors.go 21.89% <0.00%> (-0.22%) ⬇️
runtime/interpreter/value.go 72.19% <75.00%> (+0.27%) ⬆️
runtime/interpreter/interpreter.go 89.53% <100.00%> (-0.01%) ⬇️
encoding/json/encode.go 94.44% <0.00%> (-0.26%) ⬇️
runtime/convertValues.go 78.18% <0.00%> (-0.03%) ⬇️
runtime/runtime.go 86.51% <0.00%> (ø)
runtime/interpreter/primitivestatictype.go 84.61% <0.00%> (+0.76%) ⬆️
runtime/interpreter/storage.go 70.63% <0.00%> (+1.58%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec9fb29...8187b93. Read the comment docs.

@github-actions
Copy link

github-actions bot commented Jun 7, 2022

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit 3484a89
The command for i in {1..N}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done was used.
Bench tests were run a total of 7 times on each branch.

Results

old.txtnew.txt
time/opdelta
CheckContractInterfaceFungibleTokenConformance-2132µs ± 2%133µs ± 1%~(p=0.181 n=7+6)
ContractInterfaceFungibleToken-241.6µs ± 2%41.9µs ± 1%~(p=0.073 n=7+7)
InterpretRecursionFib-23.01ms ± 1%3.06ms ± 2%+1.73%(p=0.002 n=7+7)
NewInterpreter/new_interpreter-21.05µs ± 2%1.05µs ± 1%~(p=0.361 n=7+7)
NewInterpreter/new_sub-interpreter-22.34µs ± 1%2.35µs ± 2%~(p=0.559 n=7+7)
ParseArray-28.25ms ± 1%8.35ms ± 2%~(p=0.051 n=7+6)
ParseDeploy/byte_array-212.5ms ± 3%12.6ms ± 2%~(p=0.318 n=7+7)
ParseDeploy/decode_hex-21.14ms ± 1%1.13ms ± 0%~(p=0.234 n=6+7)
ParseFungibleToken/With_memory_metering-2200µs ± 1%201µs ± 1%~(p=0.310 n=6+6)
ParseFungibleToken/Without_memory_metering-2154µs ± 1%155µs ± 0%+0.72%(p=0.001 n=7+7)
ParseInfix-27.52µs ± 1%7.74µs ± 6%+2.86%(p=0.002 n=6+7)
QualifiedIdentifierCreation/One_level-22.41ns ± 0%2.41ns ± 0%~(p=0.323 n=6+6)
QualifiedIdentifierCreation/Three_levels-2122ns ± 1%122ns ± 1%~(p=0.199 n=6+6)
RuntimeFungibleTokenTransfer-21.07ms ±22%1.09ms ±21%~(p=0.456 n=7+7)
RuntimeResourceDictionaryValues-26.07ms ± 2%6.13ms ± 4%~(p=0.318 n=7+7)
Transfer-286.3ns ± 3%84.6ns ± 1%−1.97%(p=0.001 n=7+7)
 
alloc/opdelta
CheckContractInterfaceFungibleTokenConformance-266.3kB ± 0%66.3kB ± 0%~(p=0.462 n=7+7)
ContractInterfaceFungibleToken-226.7kB ± 0%26.7kB ± 0%~(all equal)
InterpretRecursionFib-21.25MB ± 0%1.25MB ± 0%~(p=1.000 n=7+7)
NewInterpreter/new_interpreter-2872B ± 0%872B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-21.38kB ± 0%1.38kB ± 0%~(all equal)
ParseArray-22.79MB ± 2%2.79MB ± 2%~(p=0.474 n=7+7)
ParseDeploy/byte_array-24.41MB ± 3%4.44MB ± 2%~(p=0.434 n=7+7)
ParseDeploy/decode_hex-2214kB ± 0%214kB ± 0%~(p=0.811 n=7+7)
ParseFungibleToken/With_memory_metering-236.3kB ± 0%36.3kB ± 0%~(p=1.000 n=7+7)
ParseFungibleToken/Without_memory_metering-236.3kB ± 0%36.3kB ± 0%~(p=0.409 n=7+7)
ParseInfix-22.17kB ± 0%2.17kB ± 0%~(p=0.564 n=7+7)
QualifiedIdentifierCreation/One_level-20.00B 0.00B ~(all equal)
QualifiedIdentifierCreation/Three_levels-264.0B ± 0%64.0B ± 0%~(all equal)
RuntimeFungibleTokenTransfer-2237kB ± 1%237kB ± 0%~(p=0.535 n=7+7)
RuntimeResourceDictionaryValues-22.25MB ± 0%2.25MB ± 0%~(p=0.259 n=7+7)
Transfer-248.0B ± 0%48.0B ± 0%~(all equal)
 
allocs/opdelta
CheckContractInterfaceFungibleTokenConformance-21.07k ± 0%1.07k ± 0%~(all equal)
ContractInterfaceFungibleToken-2460 ± 0%460 ± 0%~(all equal)
InterpretRecursionFib-223.8k ± 0%23.8k ± 0%~(all equal)
NewInterpreter/new_interpreter-212.0 ± 0%12.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-240.0 ± 0%40.0 ± 0%~(all equal)
ParseArray-270.0k ± 0%70.0k ± 0%~(p=1.000 n=7+7)
ParseDeploy/byte_array-2105k ± 0%105k ± 0%~(p=1.000 n=7+7)
ParseDeploy/decode_hex-278.0 ± 0%78.0 ± 0%~(all equal)
ParseFungibleToken/With_memory_metering-21.06k ± 0%1.06k ± 0%~(all equal)
ParseFungibleToken/Without_memory_metering-21.06k ± 0%1.06k ± 0%~(all equal)
ParseInfix-266.0 ± 0%66.0 ± 0%~(all equal)
QualifiedIdentifierCreation/One_level-20.00 0.00 ~(all equal)
QualifiedIdentifierCreation/Three_levels-22.00 ± 0%2.00 ± 0%~(all equal)
RuntimeFungibleTokenTransfer-24.52k ± 0%4.52k ± 0%~(p=1.000 n=7+7)
RuntimeResourceDictionaryValues-237.6k ± 0%37.6k ± 0%~(p=0.306 n=7+7)
Transfer-21.00 ± 0%1.00 ± 0%~(all equal)
 

@turbolent turbolent requested a review from SupunS June 7, 2022 22:27
@turbolent turbolent merged commit 836aa6f into master Jun 7, 2022
@turbolent turbolent deleted the bastian/make-invalidated-resource-error-internal-error branch June 7, 2022 22:42
Copy link
Member

@SupunS SupunS left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

2 participants