This release culminates a half-year effort to improve the Cadence storage layer, i.e. how Cadence values are stored in accounts, in particular arrays, dictionaries, and composite values. @fxamacker and @ramtinms designed and implemented completely new array and ordered map data structures, resulting in atree. These data structures are fast and scalable: they allow efficient access and allow efficient modifications to arrays and dictionaries with very large number of elements. @turbolent and @SupunS integrated this new library into Cadence. This new storage layer also fixed a bug in the resource owner
field. Please see the breaking changes section for more details.
In addition, this release saw several feature and documentation contributions by new community members. Thank you!
💥 Breaking Changes
-
With the storage layer update, the
owner
field of resources is now implemented correctly, as originally designed:
The field is only non-nil
if the resource is currently in storage, and is alwaysnil
if the resource is on the stack.
This breaking change is actually a bug fix, as theowner
field was previously implemented incorrectly: After a resource was moved out of storage onto the stack, theowner
field was still referring to the account the resource was stored in.Please ensure your Cadence programs do not rely on the broken behaviour and update them if needed.
For example, in a function that is passed a resource as an argument, the resource's
owner
field will always benil
:pub fun deposit(token: @NonFungibleToken.NFT) { // token.owner is always nil! // ... }
⭐ Features
- Add
Path.toString()
with tests and documentation. (#1141) @rheaplex - Adding
toLower()
toString
type (#1176) @bjartek - Add
isSubtype
function for runtime values (#1189) @dsainati1
🛠 Improvements
- Introduce
TokenStream
interface (#1113) @jsatdapr - Remove obsolete script/transaction parameter check (#1114) @SupunS
- Add static type to host functions (#1144) @SupunS
- Infer RHS of nil-coalescing operator to have non-optional type of LHS (#1154) @turbolent
- Use new atree library for arrays, dictionaries, and composite values (#1156) @turbolent
- Limit error line lengths (#1165) @turbolent
- Add dynamic sub-typing for function types (#1172) @SupunS
- Remove
CompositeDeclarations
check fromFunctionEntryPointDeclaration
(#1175) @janezpodhostnik - Check slab and account storage health (#1193) @turbolent
🐞 Bug Fixes
- Fix export errors by properly wrapping in runtime errors (#1139) @SupunS
- Fix array function member type creation (#1146) @SupunS
- Add missing function type for
Path.toString
(#1150) @turbolent - Consider constant-sized type's size when checking dynamic array type (#1158) @turbolent
- Fix move operator on empty resource collections (#1159) @SupunS
- Fix block ID static type (#1168) @turbolent
- Reintroduce and fix
stringAtreeValue
(#1174) @turbolent - Fix reference uses after moves (#1180) @turbolent
📖 Documentation
- Core events documentation (#1110) @sideninja
- Migrate remaining docs from docs site. (#1155) @10thfloor
- Fix bad link in Cadence tutorial page 01 (#1167) @kerrywei
- Fixing typo (#1182) @sovietspy2
- Fix units on storageUsed and storageCapacity data members (bytes) (#1184) @Giners
- Fix typos (#1187, #1188, #1191, #1194) @markstrefford
🙌 New Contributors
Thank you to all new contributors: