Skip to content

Account capabilities#2160

Merged
turbolent merged 23 commits into
masterfrom
bastian/authaccount-capability-2
Nov 29, 2022
Merged

Account capabilities#2160
turbolent merged 23 commits into
masterfrom
bastian/authaccount-capability-2

Conversation

@turbolent
Copy link
Copy Markdown
Member

Closes #2151

Description


  • 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 requested a review from a team November 24, 2022 02:33
@turbolent turbolent self-assigned this Nov 24, 2022
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 24, 2022

Codecov Report

Merging #2160 (6081795) into master (4be06e2) will decrease coverage by 0.11%.
The diff coverage is 64.85%.

@@            Coverage Diff             @@
##           master    #2160      +/-   ##
==========================================
- Coverage   77.69%   77.57%   -0.12%     
==========================================
  Files         308      309       +1     
  Lines       64302    64678     +376     
==========================================
+ Hits        49961    50176     +215     
- Misses      12605    12760     +155     
- Partials     1736     1742       +6     
Flag Coverage Δ
unittests 77.57% <64.85%> (-0.12%) ⬇️

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

Impacted Files Coverage Δ
runtime/common/memorykind_string.go 40.00% <ø> (ø)
runtime/common/metering.go 92.23% <ø> (ø)
runtime/interpreter/visitor.go 9.30% <0.00%> (-0.46%) ⬇️
runtime/format/capability.go 68.75% <16.66%> (-31.25%) ⬇️
runtime/interpreter/value_accountreference.go 35.07% <35.07%> (ø)
runtime/interpreter/decode.go 46.20% <58.62%> (+0.14%) ⬆️
runtime/interpreter/value.go 68.83% <60.26%> (-0.14%) ⬇️
runtime/runtime.go 85.84% <65.38%> (-1.63%) ⬇️
values.go 66.10% <70.00%> (ø)
runtime/interpreter/interpreter.go 89.17% <90.69%> (-0.02%) ⬇️
... and 13 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
Copy Markdown

github-actions Bot commented Nov 24, 2022

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit 4be06e2
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.

Collapsed results for better readability

old.txtnew.txt
time/opdelta
CheckContractInterfaceFungibleTokenConformance-2201µs ± 9%195µs ± 4%~(p=0.620 n=7+7)
ContractInterfaceFungibleToken-262.0µs ± 4%63.8µs ± 6%~(p=0.259 n=7+7)
InterpretRecursionFib-23.26ms ± 3%3.43ms ± 5%+5.03%(p=0.002 n=6+7)
NewInterpreter/new_interpreter-21.58µs ± 2%1.58µs ± 1%~(p=0.937 n=6+6)
NewInterpreter/new_sub-interpreter-2868ns ± 8%865ns ± 4%~(p=1.000 n=7+7)
ParseArray-211.2ms ± 3%11.4ms ± 8%~(p=0.445 n=6+7)
ParseDeploy/byte_array-216.7ms ± 4%16.8ms ± 2%~(p=0.945 n=6+7)
ParseDeploy/decode_hex-21.76ms ± 4%1.70ms ± 1%−3.48%(p=0.035 n=7+6)
ParseFungibleToken/With_memory_metering-2279µs ± 3%275µs ± 4%~(p=0.209 n=7+7)
ParseFungibleToken/Without_memory_metering-2216µs ± 1%219µs ± 1%+1.36%(p=0.010 n=5+7)
ParseInfix-29.50µs ± 5%9.56µs ± 4%~(p=0.805 n=7+7)
QualifiedIdentifierCreation/One_level-23.41ns ± 1%3.40ns ± 2%~(p=0.535 n=7+7)
QualifiedIdentifierCreation/Three_levels-2200ns ± 4%198ns ± 2%~(p=0.642 n=7+6)
RuntimeFungibleTokenTransfer-21.04ms ±19%0.96ms ±22%~(p=0.259 n=7+7)
RuntimeResourceDictionaryValues-27.96ms ± 2%7.87ms ± 6%~(p=0.343 n=5+7)
RuntimeScriptNoop-235.7µs ±31%34.9µs ±34%~(p=0.710 n=7+7)
SuperTypeInference/arrays-2444ns ± 1%448ns ± 4%~(p=0.456 n=7+7)
SuperTypeInference/composites-2173ns ± 3%174ns ± 2%~(p=0.902 n=7+7)
SuperTypeInference/integers-2122ns ± 4%121ns ± 0%~(p=0.750 n=7+5)
ValueIsSubtypeOfSemaType-2133ns ± 4%133ns ± 7%~(p=0.535 n=7+7)
 
alloc/opdelta
CheckContractInterfaceFungibleTokenConformance-249.7kB ± 0%49.7kB ± 0%~(p=0.122 n=7+7)
ContractInterfaceFungibleToken-224.0kB ± 0%24.0kB ± 0%~(all equal)
InterpretRecursionFib-21.00MB ± 0%1.00MB ± 0%~(p=0.245 n=6+7)
NewInterpreter/new_interpreter-2752B ± 0%768B ± 0%+2.13%(p=0.001 n=7+7)
NewInterpreter/new_sub-interpreter-2200B ± 0%200B ± 0%~(all equal)
ParseArray-22.73MB ± 5%2.77MB ± 7%~(p=0.318 n=7+7)
ParseDeploy/byte_array-24.20MB ± 4%4.20MB ± 4%~(p=0.710 n=7+7)
ParseDeploy/decode_hex-2214kB ± 0%214kB ± 0%~(p=0.936 n=7+7)
ParseFungibleToken/With_memory_metering-229.2kB ± 0%29.2kB ± 0%~(p=0.291 n=7+7)
ParseFungibleToken/Without_memory_metering-229.2kB ± 0%29.2kB ± 0%~(p=0.780 n=7+7)
ParseInfix-21.91kB ± 0%1.91kB ± 0%+0.06%(p=0.008 n=7+6)
QualifiedIdentifierCreation/One_level-20.00B 0.00B ~(all equal)
QualifiedIdentifierCreation/Three_levels-264.0B ± 0%64.0B ± 0%~(all equal)
RuntimeFungibleTokenTransfer-2103kB ± 1%103kB ± 1%~(p=0.383 n=7+7)
RuntimeResourceDictionaryValues-22.29MB ± 0%2.29MB ± 0%~(p=0.530 n=5+7)
RuntimeScriptNoop-28.46kB ± 1%8.45kB ± 1%~(p=0.684 n=7+7)
SuperTypeInference/arrays-296.0B ± 0%96.0B ± 0%~(all equal)
SuperTypeInference/composites-20.00B 0.00B ~(all equal)
SuperTypeInference/integers-20.00B 0.00B ~(all equal)
ValueIsSubtypeOfSemaType-248.0B ± 0%48.0B ± 0%~(all equal)
 
allocs/opdelta
CheckContractInterfaceFungibleTokenConformance-2815 ± 0%815 ± 0%~(all equal)
ContractInterfaceFungibleToken-2388 ± 0%388 ± 0%~(all equal)
InterpretRecursionFib-218.9k ± 0%18.9k ± 0%~(all equal)
NewInterpreter/new_interpreter-213.0 ± 0%13.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-24.00 ± 0%4.00 ± 0%~(all equal)
ParseArray-259.6k ± 0%59.6k ± 0%~(p=1.000 n=7+7)
ParseDeploy/byte_array-289.4k ± 0%89.4k ± 0%~(p=1.000 n=7+7)
ParseDeploy/decode_hex-264.0 ± 0%64.0 ± 0%~(all equal)
ParseFungibleToken/With_memory_metering-2779 ± 0%779 ± 0%~(all equal)
ParseFungibleToken/Without_memory_metering-2779 ± 0%779 ± 0%~(all equal)
ParseInfix-248.0 ± 0%48.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-21.99k ± 0%1.99k ± 0%+0.10%(p=0.001 n=7+7)
RuntimeResourceDictionaryValues-237.0k ± 0%37.0k ± 0%~(p=0.068 n=6+7)
RuntimeScriptNoop-2132 ± 0%132 ± 0%~(all equal)
SuperTypeInference/arrays-23.00 ± 0%3.00 ± 0%~(all equal)
SuperTypeInference/composites-20.00 0.00 ~(all equal)
SuperTypeInference/integers-20.00 0.00 ~(all equal)
ValueIsSubtypeOfSemaType-21.00 ± 0%1.00 ± 0%~(all equal)
 

Copy link
Copy Markdown
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.

Can you maybe add a brief description about this new feature to the PR description?
e.g: How to use the new linking API, What can be done with the returned account reference, etc.

Comment thread runtime/interpreter/decode.go Outdated
Comment thread runtime/interpreter/interpreter.go
Comment thread runtime/interpreter/interpreter.go Outdated
@turbolent
Copy link
Copy Markdown
Member Author

@SupunS Added more details about the feature to the issue #2151. See the linked Notion page for further details about use-cases and alternative solutions.

@turbolent turbolent merged commit 5d789a1 into master Nov 29, 2022
@turbolent turbolent deleted the bastian/authaccount-capability-2 branch November 29, 2022 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Capability for AuthAccount

4 participants