github onflow/cadence v0.16.0

πŸ’₯ Breaking Changes

  • Add new crypto features (#852) @SupunS

    Renamed the ECDSA_Secp256k1 signature algorithm to ECDSA_secp256k1.

    Please update existing contracts, transactions, and scripts to use the new name.

  • Remove the high-level storage API (#877) @turbolent

    The internal interface's SetCadenceValue function was removed.

    This change does not affect Cadence programs (contracts, transactions, scripts).

⭐ Features

  • Add non-local type inference for expressions (#875) @SupunS

    The type of most declarations and expressions is now inferred in a uni-directional way, instead of only locally.

    For example, this allows the following declarations to type-check without having to add static casts:

    let numbers: [Int8] = [1, 2, 3]
    let nestedNumbers: [[Int8]] = [[1, 2], [3, 4]]
    let numberNames: {Int64: String} = {0: "zero", 1: "one"}
    let sum: Int8 = 1 + 2
  • Add new crypto features (#852) @SupunS

    Hash Algorithms

    Signature Algorithms

    PublicKey Type

    • Added the field let isValid: Bool. For example:

      let publicKey = PublicKey(publicKey: [], signatureAlgorithm: SignatureAlgorithm.ECDSA_P256)
      
      let valid = publicKey.isValid
    • Added the function verify, which allows validating signatures:

      pub fun verify(
          signature: [UInt8],
          signedData: [UInt8],
          domainSeparationTag: String,
          hashAlgorithm: HashAlgorithm
      ): Bool

      For example:

      let valid = publicKey.verify(
          signature: [],
          signedData: [],
          domainSeparationTag: "something",
          hashAlgorithm: HashAlgorithm.SHA2_256
      )
    • Added the function hashWithTag, which allows hashing with a tag:

      pub fun hashWithTag(
          _ data: [UInt8],
          tag: string,
          algorithm: HashAlgorithm
      ): [UInt8]
  • Direct contract function invoke (#878) @janezpodhostnik

    Cadence now supports an additional function to allow the host environment to call contract functions directly.

  • Language Server: Add support for access check mode (#868) @turbolent

  • Record variable declaration ranges (#880) @turbolent

⚑️ Performance

The performance of decoding and encoding values was significantly improved by @fxamacker and @SupunS:

  • Optimize encoding by using CBOR lib's StreamEncoder (#830) @fxamacker
  • Optimize decoding by using CBOR StreamDecoder (#885) @fxamacker
  • Add deferred decoding for array values (#871) @SupunS
  • Add deferred decoding support for composite values (#896) @SupunS
  • Pre-allocate and reuse value-path for encoding (#858) @fxamacker
  • Pre-allocate and reuse value-path for decoding (#869) @turbolent
  • Optimize Address.Bytes() to inline fast path (#848) @fxamacker
  • Remove call to Valid() during encoding to boost speed by about 13-18% (#857) @fxamacker
  • Directly create int subtype value at interpreter (#913) @SupunS

πŸ›  Improvements

πŸ”’ Security

This release contains major security fixes:

🐞 Bug Fixes

πŸ§ͺ Tests

πŸ“– Documentation

πŸ— Chores

Don't miss a new cadence release

NewReleases is sending notifications on new releases.