github onflow/cadence v0.6.0

latest releases: v1.2.2, v1.0.2, v1.2.1...
4 years ago

This is a small release with some bug fixes, internal improvements, and one breaking change for code that embeds Cadence.

💥 Breaking Changes

  • Removed the unused controller parameter from the storage interface methods:

    • func GetValue(owner, controller, key []byte) (value []byte, err error)
      func GetValue(owner, key []byte) (value []byte, err error)

    • SetValue(owner, controller, key, value []byte) (err error)
      SetValue(owner, key, value []byte) (err error)

    • ValueExists(owner, controller, key []byte) (exists bool, err error)
      ValueExists(owner, key []byte) (exists bool, err error)

    This is only a breaking change in the implementation of Cadence, i.e for code that embeds Cadence, not in the Cadence language, i.e. for users of Cadence.

⭐ Features

  • Added an optional callback for writes with high-level values to the interface:

    type HighLevelStorage interface {
    
        // HighLevelStorageEnabled should return true
        // if the functions of HighLevelStorage should be called,
        // e.g. SetCadenceValue
        HighLevelStorageEnabled() bool
    
        // SetCadenceValue sets a value for the given key in the storage, owned by the given account.
        SetCadenceValue(owner Address, key string, value cadence.Value) (err error)
    }

    This is a feature in the implementation of Cadence, i.e for code that embeds Cadence, not in the Cadence language, i.e. for users of Cadence.

🛠 Improvements

  • Don't report an error for a restriction with an invalid type
  • Record the occurrences of types. This enables the "Go to definition" feature for types in the language server
  • Parse member expressions without a name. This allows the checker to run. This will enable adding code completion support or members in the future.

🐞 Bug Fixes

  • Fixed a crash when checking the invocation of a function on an undeclared variable
  • Fixed handling of functions in composite values in the JSON-CDC encoding
  • Fixed a potential stack overflow when checking member storability

Don't miss a new cadence release

NewReleases is sending notifications on new releases.