# Changelog¶

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

## 0.43.0 - 2019-08-19¶

• Ontology backend to sic that emits as JSON the intermediate contract descriptor used by the sic emitters.

### Changed¶

• The sic-generated Kotlin code does not generate an interface with *Impl class implementations, but just the class implementations directly without the *Impl suffix.
• The structure in multi-file deon-projects is now more closely reflected in sic-generated TypeScript/Kotlin code.
• Both the TypeScript and Kotlin code generated by sic introduces an addDeclaration function for putting a CSL declaration on the ledger. The instantiation classes now require a declaration id in their constructors.
• When sic outputs the JSON-representation of an AST to standard out it does not include the separator strings that are invalid JSON.

### Fixed¶

• Corrected a bug in the build setup that rendered the Maven-published JAR of deon-api-client unusable.

## 0.42.0 - 2019-08-05¶

• The LSP server now supports go to definition.
• Added an endpoint contracts/<contractID>/events to get the event that have been applied to a contract.

### Changed¶

• sic now writes multiple files instead of merging everything into one file. Dependencies on sic generated files will have to be updated accordingly: For TypeScript, the files are renamed; and for Kotlin projects, the generated namespace has changed.
• The helper functions for serialisation/deserialisation generated by TypeScript backend in sic have been refactored, so sic users will need to make a few changes to their TypeScript code. Instead of mkXValue and getX there are now methods X.toValue and X.fromValue. Also getAgent has been replaced by Agent.fromValue.

### Fixed¶

• Corrected the code that converts StateTree based residual contracts to their abstract syntax form.

## 0.41.0 - 2019-07-10¶

• The Visual Studio Code plugin now shows type information on mouse hover.

### Fixed¶

• Made sure the Gradle plugin for generating CorDapps includes everything needed to generate them correctly.
• Fixed a bug in the TypeScript emitter of sic where records using TypeScript keywords as field names would not function properly.

## 0.40.0 - 2019-06-28¶

• Initial version of the new Datalog-inspired query language.
• Gradle plugin to generate self-contained CorDapps directly from CSL code.
• A new backend to sic that emits parsed and compiled CSL syntax as a JSON-file.

### Changed¶

• Upgraded Kotlin runtime to 1.2.

### Removed¶

• The generic Corda ledger backend has been removed.
• The Hyperledger Fabric ledger backend has been removed.
• The special treatment of Evidence records has been removed from the Corda backend.
• The example oracle implementations have been deleted.
• The InMemory backend has been removed. It’s superseded by the DbLedger backend.

### Fixed¶

• Fixed an issue where the service would fail in an unexpected way when fed with certain invalid DateTimes.
• Fixed an issue where in some cases the type checker would not report error messages in expressions involving records.

## 0.39.0 - 2019-04-26¶

### Changed¶

• Added support for simple simplifications of contracts. The simplifications are used for the contracts presented in the webapp in the “Actions” and “Viewer” tab.

### Fixed¶

• Fixed an issue where lists in events (records) constructed from the webapp would not be handled correctly.
• Fixed an issue where the type checker would allow complex patterns at top-level. This is no longer allowed as it was in the old type checker.

## 0.38.0 - 2019-04-11¶

### Fixed¶

• Fixed an issue with floating point equality where numbers were not normalized.
• Functions can now be serialized which makes it possible to call templates with functions as arguments.

### Changed¶

• Contracts are now represented more efficiently on the ledger.
• The evaluator uses a new approach with a global environment instead of closures.

## 0.37.0 - 2019-04-10¶

### Fixed¶

• Fixed an issue with floating point arithmetic operations where they would not use decimal128 rounding.

## 0.36.0 - 2019-04-09¶

### Fixed¶

• Fixed an issue where the type checker would crash instead of reporting an error when a constructor pattern missed an argument.
• Fixed an issue where the language server would report errors in the wrong file.

### Changed¶

• The underlying representation of floating point numbers was changed to decimal128 from binary64, allowing more exact financial calculations.

## 0.35.0 - 2019-04-05¶

### Fixed¶

• Fixed an issue where a unary minus was not pretty printed correctly.
• Fixed an issue with applying events to contracts with inner lets

### Changed¶

• sic for TypeScript now generates classes instead of type aliases for records.

### Removed¶

• Removed the corda-light ledger backend. It was not being used and was obstructing further developments and randomly failing CI.

## 0.34.0 - 2019-03-21¶

### Fixed¶

• Fixed an issue in the new type checker where record projection, upcast and type case did not work as expected in certain cases.

## 0.33.0 - 2019-03-21¶

### Changed¶

• The type checker was replaced. It reports multiple error messages and returns an AST annotated with types.

## 0.32.0 - 2019-03-15¶

### Changed¶

• The sic tool now shows warnings on the console when it cannot generate entrypoints.
• We now disallow shadowing of names in CSL. Shadowing is only disallowed within each name kind. That means value expression names cannot shadow other value expression names but contracts and values can still use the same name.

## 0.31.0 - 2019-03-12¶

### Fixed¶

• Fixed a bug that caused a significant slowdown when evaluating some reports.

### Changed¶

• Record types in sic-generated code implements the subtyping hierarchy of the CSL source with native target language constructs.

## 0.30.0 - 2019-03-07¶

### Fixed¶

• Fixed an issue that caused the project structure of deon-project files to not be respected in some scenarios.
• Fixed a bug in the webapp where it would crash when adding a boolean argument to a report.
• Fixed an issue in the webapp where the wrong declarations were used for instantiating contracts in certain cases.

### Changed¶

• The contract composer in the webapp has a new layout.

## 0.29.0 - 2019-02-26¶

• Added sic-support for deon-project files.

### Fixed¶

• Fixed a bug that caused type errors in sic-generated TypeScript code with tuples.
• Fixed a bug that caused /simplify to crash on certain combinations of contract-parameters and pseudo-syntactic values.
• Fixed a bug in the agent matching algorithm that made it problematic to have agents with numbers in their name, such as agent1 and agent2.
• Fixed a bug in the webapp that prevented instantiation of contracts with multiple contract ID parameters.
• Fixed a bug in the webapp that made it crash when attempting to provide a DateTime argument to a report.
• Fixed a bug in the webapp where the contents of AST nodes could overflow if it was too large - now the full content will only be visible when the mouse is hovering over the node.

### Changed¶

• Declarations are identified by content hashes (SHA-256) instead of UUIDs.
• Upgraded Fabric to version 1.4.
• The data model for check errors (type errors, parse errors, etc.) has changed. See OpenAPI specification for the new model.

## 0.28.0 - 2019-01-15¶

• Add support for heterogeneous tuple values in CSL.
• Added support for event tags in sic. Kotlin sic users will need small adjustments to their code.

### Fixed¶

• Fixed an issue with serialization of websocket values.
• Fixed a performance issue in the /contracts endpoint that caused it to compute a lot of unnecessary data.

### Changed¶

• Updated the cache policy for static resources such as documentation and examples to prevent browsers from showing outdated versions.
• Updated webapp to react 16.7.0
• Changed default database backend from H2 to SQLite for the DBLedger.

## 0.27.0 - 2018-12-13¶

### Fixed¶

• Fixed duplications of agents on agent list on Fabric.
• Fixed too liberal type checking of signed data.

### Changed¶

• Upgraded Corda to version 3.3.
• Removed dependency on Jackson and improved performance of JSON serialization.

## 0.26.0 - 2018-12-03¶

• Added support for signing of structured data.

### Fixed¶

• Fixed an issue with instantiation with pseudo-syntactic values in records or lists.

### Changed¶

• Updated API specification to OpenAPI 3 format. The specification endpoint is changed from /v2/api-docs to /openapi.json.

## 0.25.1 - 2018-11-23¶

### Fixed¶

• Fixed a rendering issue with contract ids in the instantiation UI.

## 0.25.0 - 2018-11-22¶

• Added the power and square root functions; Math::pow and Math::sqrt to the standard library.

### Fixed¶

• sic: Fixed a bug in the conversion of values in the TypeScript backend.
• Fixed broken link to PDF language guide in the HTML language guide.
• Corrected an error in the UI Actions tab.

## 0.24.0 - 2018-11-19¶

### Changed¶

• sic: It is no longer necessary to wrap contract ids in the Kotlin interface for reports and event application.
• Changed layout of instantiation screen to handle templates with many arguments in the UI.

### Fixed¶

• Fixed a bug that caused the Kotlin API client to break when it was initialized with a request timeout.
• Fixed a bug when serializing durations with jackson.

## 0.23.0 - 2018-11-07¶

### Changed¶

• sic: Event application functions in Kotlin and TypeScript are no longer lower-cased but follow the capitalization of their CSL types.

### Fixed¶

• Fixed a bug in the TypeScript backend to sic that caused reports that return Pair or Maybe values to fail at runtime.
• Fixed a bug with event application that would sometimes cause a “variable not found in environment” error.
• Fixed a bug in the Kotlin backend to sic where the result would not compile when agents were compared.

### Removed¶

• The “Apply Event as Text” button has been removed from the webapp because it is no longer possible to construct an event value within the syntax of the language.

## 0.22.0 - 2018-10-10¶

• A new instantiation argument which resolves to the id of the instantiated contract has been added.
• The Visual Studio Code extension now supports projects spanning multiple CSL files (see the plugin’s README for more information).
• Tutorial section about the tool sic to the language guide.

### Fixed¶

• Fixed a bug that caused Corda nodes to fail when using lists in events.

### Changed¶

• Agents in contracts are no longer strings, but are abstract values issued by the ledger. Use the new /agents API to retrieve the available agent values.
• It is no longer possible to use the special variable events to refer to the events of the contract instance; use getEvents instead.
• Contracts::getEvents has been renamed to getEvents.
• It is no longer possible to redeclare top-level value bindings.
• Contract ids are no longer strings but instead abstract values of the type ContractId that cannot be constructed in syntax.

## 0.21.0 - 2018-09-21¶

• Web UI: Contract ID selector in “Reports” tab.
• It is now possible to specify a separate peers list for each contract instantiation in the code generated by sic.

### Fixed¶

• Fixed a bug where the webapp could not apply events containing data with qualified sum types.
• Fixed a bug in sic that caused empty CSL records to be handled wrong.

## 0.20.0 - 2018-09-14¶

• Lightweight implementation of Corda adapter where the notary is only used to ensure consensus on the ordering of events for contracts and not validity of the sequence of events.
• Added ISO 8601 compliant syntax for duration literals.
• Added built-ins and standard library functions for working with durations.

### Fixed¶

• Cucumber: ContractIDs are replaced in the expected results of Report tests.
• Fixed a bug in the scoping of event bindings in prefix expressions.

## 0.19.0 - 2018-08-31¶

• TypeScript backend to sic.
• Upgraded Corda to version 3.2.
• Upgraded Fabric to version 1.2.
• Added support for Fabric in deployment-tool.
• Support for batching in Kotlin-client.

### Changed¶

• It is now only possible to query Contracts::getEvents on contracts that are instantiated from the same declaration ID as the caller.
• Updated the formatting and structure of the CSL language guide and reference.

### Fixed¶

• Fixed a bug where agents represented by variables could be shadowed by bound event names.
• Fixed a bug in the serialization of contracts.
• Fixed a bug in sic that caused Kotlin code generated from CSL that used Floats to break.
• Fixed a bug in sic that caused it to generate invalid code due to keyword name clashes.
• Fixed a bug in the corda-adapter that could break the client-to-node communication under high load

## 0.18.0 - 2018-08-13¶

• Deployment tool.
• The code generation tool sic for automatically generating a Kotlin interface for a CSL contract.

### Changed¶

• Upgraded Corda to version 3.1.

### Fixed¶

• Fixed a bug that crashed the UI if the residual contract could not be computed.
• Fixed a bug where lists of events could not be converted from the internal to the external representation in some cases (like List::append events events).
• Fixed a bug in the web UI where events could not be applied as raw text.

## 0.17.0 - 2018-06-25¶

• The API methods /contracts and /contracts/{id} now return the instantiation time of the contract.
• The standard library now has a Maybe::bind function. See the documentation for details.
• A built-in function error : RuntimeError -> a has been added.

### Changed¶

• The API methods /contracts/report and /contracts/{id}/report now accept an optional list of Values that can be used as arguments for reports that take parameters.

### Removed¶

• The REST API clients have been moved to GitHub.

### Fixed¶

• A bug which caused the type checker to refuse references to previously declared templates from locally defined templates has been fixed.
• A bug where the simplifier would cause run-time errors to disappear has been fixed.
• Corrected a bug where server side errors could break the UI.

## 0.16.0 - 2018-06-05¶

### Changed¶

• The syntax for declaring contracts, templates and values has been changed. Recursive contract templates now have to be explicitly marked as so, and mutually recursive templates must be declared together. See the language guide for more information.
• The Add event button has been removed from the Viewer menu as it duplicates the functionality on Actions. Events can be added as raw text from Actions now.
• Removed the API method /parse-value that was equivalent to /report in taking an expression as string and returning a Value.
• Renamed the /contract/{id}/simplified endpoint to /contract/{id}/src endpoint and added an optional parameter simplified such that /contract/{id}/src?simplified=true returns the simplified residual contract and /contract/{id}/src returns the non-simplified residual contract.

### Fixed¶

• Fixed an issue in the (Kotlin) implementation of apply that could result in a crash from a stack overflow.

## 0.15.0 - 2018-05-28¶

• The UI now displays the current version number.

### Changed¶

• Performance of the CSL parser has been improved.
• Performance of report and expression evaluation has been improved.
• The endpoints /check, /check-expression, and /parse-value will now run type check on successfully parsed declaration parts even if there is a parse error later.

### Fixed¶

• Fixed a bug where the Visual Studio Code plugin was not in contact with the parser and type checker.

## 0.14.0 - 2018-05-17¶

• The standard library now has List::isEmpty function.

### Fixed¶

• The in-memory ledger and database-backed ledger backend now correctly handle tagged event application.

### Changed¶

• The Node.JS and web REST clients now support optional tags for applyEvent.
• Performance of the /checkEvent endpoint has been improved.

## 0.13.0 - 2018-05-14¶

• Events are now type checked before being applied to contracts.
• The web editor now supports comment toggling with Cmd-/ or Ctrl-/.
• Standard library function DateTime::dayOfWeek that gives the day of week (DateTime::DayOfWeek) for a DateTime.

## 0.12.0 - 2018-05-07¶

• The ontology for a CSL program now includes sum types in addition to record types.
• New event input form in “Actions” tab.
• New database-backed ledger backend with support for H2 and SQLite.
• Node.js REST client.
• Added new endpoints to submit contracts and events in batches for faster execution
• Convenience function to JavaScript SDK for handling Value objects as JSON data.

### Fixed¶

• Fixed a bug where applying many events to a contract could cause an exception.
• Fixed some bugs where a couple of endpoints in the API client NPM package did not work.
• Fixed bug where contract instantiation would result in an illegal contract due to a bug in the implementation of scoping.

### Changed¶

• Moved endpoint to simulate events, and added the possibility to simulate events across multiple contracts.
• When running reports, the optional parameter for declaration id is now an optional path parameter. The client SDK has been updated to reflect this.

## 0.11.0 - 2018-04-24¶

• Shorthand syntax for DateTime literals in CSL. The following all denote the same point in time: #2018#, #2018-01#, #2018-01-01#, #2018-01-01T00#, #2018-01-01T00:00#, #2018-01-01T00:00:00#, and #2018-01-01T00:00:00Z#.
• Added “guardedness check” to ensure that contracts do not contain infinite recursion.
• Support for unary minus.

### Fixed¶

• Fixed a bug where the UI’s pretty printing of DateTime values were not syntactically valid.
• Fixed bug where contract instances in the web app AST view were not simplified.
• Fixed bug where the order of arguments to constructors were reversed when converting from value to expression.

## 0.10.0 - 2018-04-18¶

• Contract abbreviations can now be defined in let blocks and top-level definitions.
• Contract templates with no contract parameters can now also be defined using the template keyword.
• CSL extension to Visual Studio Code.
• Node.js package with an API client.
• Contract examples are now available in the UI.
• Report examples in the language guide.
• Added type checking to contract instantiation, preventing you from passing illegal arguments to contracts.
• Added the possibility to run a simulation of event application without modifying a contract on the ledger.

### Fixed¶

• Fixed an issue where contract names and module names could be in conflict, thus causing bugs when applying events to those contracts.
• Changed the parser such that ranges of tokens don’t include trailing whitespace.

### Changed¶

• It is no longer possible to do comparison of strings like "a" > "b".
• Locations in error messages have been improved to be more specific.

## 0.9.0 - 2018-03-21¶

• Standard library extended with Int::toString function.

### Changed¶

• The /contracts/{id}/next-events and /contracts/{id}/tree endpoints will no longer surround agent matcher with < and >.

### Fixed¶

• Fixed an issue where result values from report evaluation were not rendered correctly.
• Fixed an issue where cross origin resource sharing (CORS) headers were not included in the webservice HTTP responses.
• Local contract and template declarations would not overwrite global ones in the type checker.

## 0.8.0 - 2018-03-13¶

• The UI now has a link to the OpenAPI (Swagger) documentation for the webservice API.
• Added GET /declarations/{id} endpoint to the webservice API.
• Reports and values are now type checked.
• Evaluation of reports independently of specific contract instances:
• Added POST /contracts/report endpoint to the webservice API for evaluating reports.
• “Reports” tab in UI has been updated with option to evaluate reports independently.
• The standard library now has String::append function.

### Changed¶

• The webservice API has been refactored and documented:
• Input/output models have new names, e.g. Declaration and Contract instead of NamedCSL and NamedContract.
• Contracts can only be instantiated with a declaration ID - not with a CSL string.
• Contract AST are now retrieved through /contracts/{id}/tree.
• Next events for contracts are now retrieved through /contracts/{id}/next-events.
• Endpoints now return HTTP codes 4XX when the input is invalid, e.g., 404 for invalid ID’s, 400 for failed type checking, etc.
• Input bodies are always objects with named fields.
• /templates endpoints are now /declarations endpoints.
• /peers and /ledgerInfo have been merged to /node-info.
• /csl is now /csl/check.
• /parseReport is now /csl/check-expression.
• /value is now /csl/parse-value.
• /{id}/ontology is now /declarations/{id}/ontology.
• /contract/{id}/report is now /contracts/{id}/report.
• OpenAPI (Swagger) documentation has been updated with examples and data models.
• Qualified named for Records, Lists, types are now sent as structured objects instead of strings, e.g. A::a is now {qualifier: ["A"], name: "a"}.
• The UI now refers to “declarations” instead of “templates”.

### Removed¶

• The DELETE endpoints /contracts/{id} and /templates/{id} have been removed from the webservice API.

### Fixed¶

• Fixed an issue where a contract could not be instantiated if a type with the same name is present.
• Fixed an encoding issue where some characters could not be used in CSL.
• Fixed a bug in the type checker where sum type constructors inside modules where globally scoped.

## 0.7.1 - 2018-03-12¶

### Fixed¶

• Fixed concurrency issue in InMemory-ledger.

## 0.7.0 - 2018-03-06¶

• Structural equality relations for lists of base types added to standard library.
• List shorthand: [1,2,3] is shorthand for Cons 1 (Cons 2 (Cons 3 Nil)).
• Upcast annotation (:>) for records, telling the type checker to consider a record expression as a super record, e.g. DeliveryEvent {...} :> Event.

### Fixed¶

• Fixed issues in relation to expansion of templates. template[c] Foo() = (<*> E then success) then c would not work as expected.
• Fixed issue where ((<*> E then success) or success) then C would accept C and become ((<*> E then success) or success) then success but it should have become simply success.

## 0.6.0 - 2018-02-23¶

• The UI now has a link to the language guide.
• The UI now has a link to the change log (this document).
• The language guide now contains a grammar for CSL.

### Changed¶

• Changed keyword fail to failure for consistency with success. Both success and failure are nouns.
• Prefix contracts do not include the then keyword. Therefore, the following two are now equivalent <*> E and <*> E then success.

### Fixed¶

• Fix a serialization issue between FabricLedgerService and chaincode.
• Removed argument field names at instantiation.

## 0.5.0 - 2018-02-13¶

• Support for the submission of event subtypes from the web UI if the contract’s ontology specifies them.
• Added new ledger service FabricLedgerService that supports CSL runtime on Hyperledger Fabric.
• Serve language-guide with webservice (http://webservice:8080/docs/guide.html).
• Parse and type errors are now highlighted in the web UI.

### Changed¶

• The Order type in the standard library has been renamed to Ordering.

### Fixed¶

• Significantly improve the speed with which contract source code is printed (roughly ~100x). This should improve the performance of cucumber tests.
• Fix a bug that made it impossible to instantiate contracts with DateTime parameters in the web UI.

## 0.4.0 - 2018-02-06¶

### Changed¶

• Updated the CSL standard library to version 0.2, with the following changes:
• Renamed module Time to DateTime, and Time::TimeComponents to DateTime::Components.
• Added DateTime::addDays.
• Added general combinators: id, const, flip.
• Added Pair, and projection functions fst, snd.
• Added Maybe with functions maybe, fromMaybe, Maybe::map, Maybe::isDefined, Maybe::any, Maybe::all.
• Added compareInt, compareFloat, and compareDateTime.
• Added the following functions to List module: head, headOrDefault, tail, length, map, mapMaybe, filter, zipWith, any, all, first, last, append, concat, reverse, take, drop.
• Indentation and formatting.
• The value parser now uses CSL2 syntax. This means events should be entered in CSL2 syntax with uppercase constructors e.g. True False Nil and Cons.

### Removed¶

• The CSL1 language level.

### Fixed¶

• Fix a bug that caused the ontology viewer to not be shown when a record type explicitly specified Record as its parent.

## 0.3.0 - 2018-02-05¶

• In com.deondigital.api a ConstructorValue is now available to create and read CSL-constructors applied to argument values.
• The reports tab would report an error when the result of a report contained any constructor which was not True, False, Nil or Cons.