cadence icon indicating copy to clipboard operation
cadence copied to clipboard

Add path fields to `AuthAccount` and `PublicAccount`

Open dsainati1 opened this issue 2 years ago • 2 comments

Implementation of part of https://github.com/onflow/cadence/issues/208

Description

This adds new fields to AuthAccount and PublicAccount, containing the paths associated with that account in an array that can be interated upon. Both composites have the new publicPaths field with type [PublicPath] that contains all the public-domain things on the account. However, AuthAccount also has privatePaths and storagePaths, with types [PrivatePath] and [StoragePath] respectively, that contain all the private-domain and storage-domain paths.


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

dsainati1 avatar Jul 25 '22 18:07 dsainati1

Cadence Benchstat comparison

This branch with compared with the base branch onflow:master commit 674324f72f84fa87829928a3ac7a79725dd80885 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-2135µs ± 1%136µs ± 2%~(p=0.097 n=7+7)
ContractInterfaceFungibleToken-240.1µs ± 1%40.4µs ± 2%~(p=0.366 n=7+6)
InterpretRecursionFib-23.75ms ± 0%3.62ms ± 0%−3.43%(p=0.004 n=5+6)
NewInterpreter/new_interpreter-21.18µs ± 0%1.18µs ± 1%~(p=0.133 n=6+7)
NewInterpreter/new_sub-interpreter-22.47µs ± 1%2.47µs ± 1%~(p=1.000 n=6+7)
ParseArray-28.81ms ± 5%8.66ms ± 2%~(p=0.620 n=7+7)
ParseDeploy/byte_array-213.1ms ± 2%13.2ms ± 2%~(p=0.394 n=6+6)
ParseDeploy/decode_hex-21.14ms ± 1%1.14ms ± 1%~(p=0.937 n=6+6)
ParseFungibleToken/With_memory_metering-2208µs ± 1%210µs ± 2%~(p=0.445 n=6+7)
ParseFungibleToken/Without_memory_metering-2160µs ± 1%161µs ± 2%~(p=0.366 n=6+7)
ParseInfix-27.74µs ± 2%7.72µs ± 1%~(p=0.628 n=7+6)
QualifiedIdentifierCreation/One_level-22.34ns ± 0%2.34ns ± 0%~(p=0.779 n=7+6)
QualifiedIdentifierCreation/Three_levels-2144ns ± 3%140ns ± 1%−3.01%(p=0.001 n=7+6)
RuntimeFungibleTokenTransfer-2930µs ±24%991µs ±22%~(p=0.620 n=7+7)
RuntimeResourceDictionaryValues-26.45ms ± 2%6.24ms ± 3%−3.15%(p=0.004 n=7+7)
ValueIsSubtypeOfSemaType-290.7ns ± 1%100.3ns ± 1%+10.61%(p=0.001 n=7+7)
 
alloc/opdelta
CheckContractInterfaceFungibleTokenConformance-262.4kB ± 0%62.4kB ± 0%~(p=1.000 n=7+7)
ContractInterfaceFungibleToken-224.4kB ± 0%24.4kB ± 0%~(all equal)
InterpretRecursionFib-21.51MB ± 0%1.51MB ± 0%−0.00%(p=0.021 n=7+7)
NewInterpreter/new_interpreter-2928B ± 0%928B ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-21.46kB ± 0%1.46kB ± 0%~(all equal)
ParseArray-22.77MB ± 0%2.79MB ± 2%~(p=0.108 n=6+7)
ParseDeploy/byte_array-24.42MB ± 3%4.45MB ± 3%~(p=0.932 n=7+7)
ParseDeploy/decode_hex-2214kB ± 0%214kB ± 0%~(p=0.828 n=7+7)
ParseFungibleToken/With_memory_metering-236.3kB ± 0%36.3kB ± 0%−0.03%(p=0.013 n=7+7)
ParseFungibleToken/Without_memory_metering-236.3kB ± 0%36.3kB ± 0%~(p=0.853 n=7+7)
ParseInfix-22.17kB ± 0%2.17kB ± 0%~(p=0.054 n=7+7)
QualifiedIdentifierCreation/One_level-20.00B 0.00B ~(all equal)
QualifiedIdentifierCreation/Three_levels-264.0B ± 0%64.0B ± 0%~(all equal)
RuntimeFungibleTokenTransfer-2184kB ± 0%185kB ± 1%~(p=0.053 n=7+7)
RuntimeResourceDictionaryValues-22.23MB ± 0%2.23MB ± 0%~(p=0.383 n=7+7)
ValueIsSubtypeOfSemaType-248.0B ± 0%48.0B ± 0%~(all equal)
 
allocs/opdelta
CheckContractInterfaceFungibleTokenConformance-21.03k ± 0%1.03k ± 0%~(all equal)
ContractInterfaceFungibleToken-2428 ± 0%428 ± 0%~(all equal)
InterpretRecursionFib-233.5k ± 0%33.5k ± 0%~(all equal)
NewInterpreter/new_interpreter-213.0 ± 0%13.0 ± 0%~(all equal)
NewInterpreter/new_sub-interpreter-242.0 ± 0%42.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=0.091 n=7+5)
ParseDeploy/decode_hex-277.0 ± 0%77.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-23.48k ± 0%3.49k ± 0%+0.18%(p=0.001 n=7+7)
RuntimeResourceDictionaryValues-237.1k ± 0%37.1k ± 0%+0.01%(p=0.001 n=7+7)
ValueIsSubtypeOfSemaType-21.00 ± 0%1.00 ± 0%~(all equal)
 

github-actions[bot] avatar Jul 25 '22 18:07 github-actions[bot]

Codecov Report

Merging #1845 (d95465b) into master (674324f) will increase coverage by 0.02%. The diff coverage is 95.38%.

@@            Coverage Diff             @@
##           master    #1845      +/-   ##
==========================================
+ Coverage   77.72%   77.75%   +0.02%     
==========================================
  Files         294      294              
  Lines       62193    62258      +65     
==========================================
+ Hits        48340    48408      +68     
+ Misses      12129    12125       -4     
- Partials     1724     1725       +1     
Flag Coverage Δ
unittests 77.75% <95.38%> (+0.02%) :arrow_up:

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

Impacted Files Coverage Δ
runtime/interpreter/account.go 88.88% <75.00%> (-1.19%) :arrow_down:
runtime/interpreter/interpreter.go 89.63% <100.00%> (+0.09%) :arrow_up:
runtime/interpreter/storagemap.go 83.21% <100.00%> (+4.69%) :arrow_up:
runtime/sema/authaccount_type.go 100.00% <100.00%> (ø)
runtime/sema/publicaccount_type.go 100.00% <100.00%> (ø)

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

codecov[bot] avatar Jul 25 '22 18:07 codecov[bot]