Compact developer tools 0.3.0
Compact developer tools 0.3.0 release notes
Today we are releasing the Compact developer tools (devtools) 0.3.0.
It adds support for a new fixup subcommand which is capable of updating your contracts to new language versions in many cases.
This is not a breaking change and there are no other changes.
If you have an existing devtools installation, you can update it with the command compact self update.
If you do not have an existing devtools installation, you can install version 0.3.0 using the shell command shown on the release page.
New Features
The Compact fixup tool
This release enables the compact fixup subcommand.
Technically, the fixup tool is provided by the Compact toolchain, it is not a built-in devtools command.
The fixup tool was already shipped with Compact toolchain version 0.25.0 and the latest version 0.26.0.
This devtools 0.3.0 release simply enables it.
If you are using one of those versions you already have it and you do not need to update your toolchain.
If you are using a toolchain version 0.24.0 or earlier and you try to invoke fixup, you will see:
Error: fixup tool not available - please install a compiler version that includes fixup-compact
Remember, you can see which version of the toolchain you are using with the subcommand compact list,
which highlights the current version with an arrow,
or compact compile --version, which prints the version.
The fixup tool can be used to update your contracts to a new language version when we make language changes.
It is invoked with the subcommand compact fixup which takes a Compact source code file and writes the updated file to standard output.
As usual, you can get help with compact help fixup or compact fixup --help.
Some things to note:
-
The behavior of writing to standard output is different from the formatter's behavior, which is to overwrite the input file. If you want to fixup and overwrite, you can pass the flag
-ior--in-placetocompact fixup. We will likely provide a consistent interface for these two tools in a subsequent devtools release. -
fixupwill not change your contract if it has a language or compiler version pragma different from the one supported byfixupitself. If you try, you will see a message likelanguage version 0.19.0 mismatch, where 0.19.0 is the expected version (and similarly a message likecompiler version 0.26.0 mismatchif there is a compiler version mismatch). You can see the expected language version withcompact compile --language-versionand the expected compiler version is the same as the toolchain version. The reason for this behavior is that we want to ensure that we do not break your contract by "fixing" it. -
IMPORTANT: the above point means that to run the tool, you must first adjust any language or compiler version pragma in your contract. You don't need to make any other changes.
-
fixupwill use the formatter to format the code. The reason for this is that some of the changes it will make can break your formatting, so it will reformat the code. It will do this even if it has not made any changes, to ensure consistent behavior.
If your contracts are already "fixed up" for toolchain version 0.26.0, the tool will not be immediately useful.
If you just want to try it out, you can, for example, change a standard library circuit like persistentHash in your contract to the old persistent_hash spelling (from toolchain version 0.24.0).
The fixup tool will then rename that circuit back to the new spelling.