Releases: onflow/cadence
v0.23.1
π Improvements
- Extend subtyping rule for restricted type by @turbolent in #1480
Full Changelog: v0.23.0...v0.23.1
v0.23.0
π₯ Breaking Changes
-
Remove
PublicKey.isValid
by @robert-e-davidson3 in #1273, #1454The
PublicKey
constructor now validates the public key data and aborts the program if it is invalid.
TheisValid
field was removed.
β Features
-
Add converter functions to produce path values from strings by @dsainati1 in #1437, #1211
Paths can now be constructed at run-time. The following path constructors were added:
fun PublicPath(identifier: string): PublicPath? fun PrivatePath(identifier: string): PrivatePath? fun StoragePath(identifier: string): StoragePath?
Each of these functions take an identifier and produce a path of the appropriate domain.
For example, to construct a public path from a string:let pathID = "foo" let path = PublicPath(identifier: pathID) // is /public/foo
For more information, see https://docs.onflow.org/cadence/language/accounts/#path-functions
-
Add RLP decoding utility methods by @ramtinms in #1397, #1456
Cadence now provides RLP decoding functions through the built-in contract
RLP
.
It provides the following functions for decoding strings and lists:fun decodeString(_ input: [UInt8]): [UInt8] fun decodeList(_ input: [UInt8]): [[UInt8]]
For more information, see https://docs.onflow.org/cadence/language/built-in-functions/#rlp
-
Add index to for loop by @dsainati1 in #1216, #1452
For-loops may now declare an indexing variable:
for index, element in array { // ... }
-
Add BLS-specific crypto functions by @dsainati1 in #1236, #1250, #1430
PublicKey
gained a new function to verify a proof-of-possession:fun verifyPoP(_ proof: [UInt8]): Bool
Cadence now provides BLS-specific functions through the built-in contract
BLS
.
It provides the following functions:fun aggregateSignatures(_ signatures: [[UInt8]]): [UInt8]? fun aggregatePublicKeys(_ publicKeys: [PublicKey]): PublicKey?
For more information, see https://docs.onflow.org/cadence/language/crypto/#bls
π Improvements
-
Refactor account storage to use atree ordered maps by @turbolent in #1248, #1404 #1391
This storage format change will allow adding a storage querying API in the future.
-
Expand interpreter tracing for composite, array and dictionary types by @ramtinms in #1450, #1468
-
Bump onflow/atree to v0.2.0 by @fxamacker in #1470
This updates Cadence to the latest version of atree.
-
Improve BLS API by @turbolent in #1417
-
Improve RLP API by @turbolent in #1423
π Bug Fixes
- Make error reporting in contract update validation deterministic by @turbolent in #1420, #1428
π New Contributors
Thank you to our new contributor, @robert-e-davidson3!
Full Changelog: v0.21.3...v0.23.0
v0.21.3
π Bug Fixes
- Fix resource field nesting check for enum raw value field by @turbolent in #1462
- Fix resource checking by @turbolent in #1463
Full Changelog: v0.21.2...v0.21.3
v0.21.2
π Bug Fixes
- Require static types for all host function values by @turbolent in #1407
- Fix boxing in casts by @turbolent in #1408
- Fix EOF emission in lexer by @turbolent in #1409
- Consider halting when determining definite invalidation by @turbolent in #1411
- Fix acceptance of buffered errors by @turbolent in #1410
- Make error reporting in contract update validation deterministic by @turbolent in #1427
Full Changelog: v0.21.1...v0.21.2
v0.21.1
v0.21.0
β Features
- Add Keccak256 hash to Cadence (#1327) @zhiqiangxu
π Bug Fixes
- Gracefully handle Cadence crashes/panics (#1364) @SupunS
- Ownership of nested resources is inconsistent, breaks backwards compatibility (#1320) @turbolent
- Fix resource loss analysis and definite initialization analysis (#1332) @turbolent
- Fix integer conversion (#1208) @turbolent
- Always check address overflow (#1349) @turbolent
v0.20.0
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:
Changelog
v0.19.1
v0.19.0
π₯ Breaking Changes
- Fix export of values (#1067) @turbolent
- Add encoding/decoding for array value static type (#1035) @SupunS
β Features
- Add public account contracts (#1090) @SupunS
- Add
names
field to auth account contracts (#1089) @SupunS - Report a hint when casting to a same type as the expected type (#1056) @SupunS
- Add encoding/decoding for array value static type (#1035) @SupunS
- Add walker for values (#1037) @turbolent
- Add encoding/decoding dictionary static type info (#1036) @SupunS
- Store static type in array/dictionary values (#1041) @SupunS
- Infer static-type from imported array/dictionary values (#1052) @SupunS
π Improvements
- Add type inferring for func-args when there are no generics (#1033) @SupunS
- Add container static types (#1125) @SupunS
- Add container mutation check for arrays and dictionaries (#1103) @SupunS
- flow-go sync tweaks (#1104) @janezpodhostnik
- Return a dedicated error when decoding fails due to an unsupported CBOR tag (#1064) @turbolent
- Remove obsolete fields (#1053) @turbolent
- Include and consider static types of arrays and dictionaries (#1043) @turbolent
- Infer array and dictionary static types from expected type during import (#1038) @turbolent
- Finish storage format changes (#1042) @turbolent
- Add static types to array values and dictionary values (#1034) @turbolent
- FlowKit API Update (#1028) @sideninja
- Produce valid Cadence string literals when formatting strings (#1023) @turbolent
- Directly declare base values in activation without interpreter (#1022) @turbolent
- Reuse base activation across all interpreters (#1018) @SupunS
- Extend the source compatibility suite (#980) @turbolent
- Update the language server to the latest Cadence version (#1015) @turbolent
- Convert the maps in the type file to simple arrays (#1086) @jwinkler2083233
- Update Security to point to website (#1074) @jkan2
- Gracefully handle the optional-chaining invocation on non-optional member (#1071) @turbolent
- Add static type sanity check for imported values (#1048) @SupunS
- Add tests for decoding from old format and encoding in new format (#1046) @SupunS
- Add more tests for imported array/dictionary value type conformance (#1045) @SupunS
- Add encoder/decoder v5 (#1039) @SupunS
- Remove additional check for builtin values during import resolving (#1026) @SupunS
- Update NPM packages (#1011) @turbolent
π Bug Fixes
- Cointainer variances fixes (#1087) @turbolent
- Check member reads and writes (#1085) @turbolent
- Include receiver in function type and check it in invocations (#1084) @turbolent
- Fix race condition in hash and sign algorithm values (#1096) @SupunS
- Check run-time type of the argument of getCapability calls (#1083) @turbolent
- Fix interpretation of optional binding with second value (#1082) @turbolent
- Check resource construction (#1081) @turbolent
- Fix address conversion (#1080) @turbolent
- Gracefully handle errors during transaction and script argument validation (#1070) @turbolent
- Fix map keys (#1069) @turbolent
- Fix import of values (#1068) @turbolent
- Fix export of values (#1067) @turbolent
- Fix get and revoke key functions (#1065) @turbolent
- Finish storage format changes (#1042) @turbolent
- Fix close-brace for struct definition docs in docgen tool (#1019) @SupunS
- Don't check missing program (#1013) @turbolent
π Documentation
- Give Resources their own page. (#1130) @10thfloor
- Fix and improve documentation (#1122) @turbolent
- Add presentation "Programming Language Implementation / Cadence Implementation" (#990) @turbolent
- Remove Crypto contract status callouts (#1012) @turbolent
- Improve the documentation for dictionaries and arrays (#1020) @turbolent
- Fix operator documentation (#1017) @turbolent
- Updating broken links in ReadMe (#1097) @kimcodeashian
v0.18.0
π₯ Breaking Changes
- Add HashAlgorithm hash and hashWithTag functions (#1002) @turbolent
- Update the Crypto contract (#999) @turbolent
β Features
- Add HashAlgorithm hash and hashWithTag functions (#1002) @turbolent
- Add npm package for the docgen-tool (#1008) @SupunS
- Add wasm generation for docgen tool (#1005) @SupunS
π Improvements
- Make
PublicKey
type importable (#995) @SupunS - Update the Crypto contract (#999) @turbolent
- Add dynamic type importability check for arguments (#1007) @SupunS
- Language Server NPM package: Add support for Node environment, add tests (#1006) @turbolent
- Embed markdown templates to docgen tool at compile time (#1004) @SupunS
- No need for checking resource loss when function definitely halted (#1000) @turbolent
- Remove the result declaration kind (#1001) @turbolent
- Update for changes in Flowkit API (#962) @sideninja
- Add Supun as code owner (#997) @turbolent
- Disable the wasmtime VM for now (#991) @turbolent
π Bug Fixes
- Add dynamic type importability check for arguments (#1007) @SupunS
- Fix dictionary deferred owner (#992) @turbolent
- Fix AST walk for transaction declaration (#998) @turbolent