Skip to content

Releases: demergent-labs/kybra

0.6.0

12 Apr 20:56
c04a410
Compare
Choose a tag to compare

This release focuses on removing the workarounds and necessary caveats in place because of the small Wasm binary limit implemented by the Internet Computer Protocol. This limit has been substantially lifted by the protocol itself, thus we were able to remove our workarounds. We've also made the initial installation process simpler and more robust.

New Features

  • ic-wasm has been removed
  • there is no longer a post_install step
  • memory ids 0, 1, 2, 252, 253, and 254 are no longer reserved
  • encrypted dfx identities are now supported
  • guard functions now only allowed on query and update methods
  • Wasm module hash caveat removed
  • ic.caller() now correct in init and post_upgrade
  • metadata is now defined by the developer in dfx.json, no Kybra version is exposed
  • init and post_upgrade caveats removed

Breaking Changes

The post_install canister property should no longer be used in the dfx.json file, and we now recommend a metadata canister property in the dfx.json file.

Example:

{
    "canisters": {
        "simple_erc20": {
            "type": "custom",
            "build": "python -m kybra simple_erc20 src/main.py src/main.did",
            "candid": "src/main.did",
            "wasm": ".kybra/simple_erc20/simple_erc20.wasm",
            "gzip": true,
            "metadata": [
                {
                    "name": "candid:service",
                    "path": "src/main.did"
                },
                {
                    "name": "cdk:name",
                    "content": "kybra"
                }
            ],
            "declarations": {
                "output": "test/dfx_generated/simple_erc20",
                "node_compatibility": true
            }
        }
    }
}

What's Changed

Full Changelog: 0.5.3...0.6.0

0.6.0rc5

12 Apr 20:31
e1033f5
Compare
Choose a tag to compare
0.6.0rc5 Pre-release
Pre-release
kybra-bot automated release 0.6.0rc5

0.6.0rc4

12 Apr 15:18
66f38bd
Compare
Choose a tag to compare
0.6.0rc4 Pre-release
Pre-release
kybra-bot automated release 0.6.0rc4

0.6.0rc3

12 Apr 14:23
a511fea
Compare
Choose a tag to compare
0.6.0rc3 Pre-release
Pre-release
kybra-bot automated release 0.6.0rc3

0.5.3

26 Mar 21:02
860882f
Compare
Choose a tag to compare

The main focus of this release is increasing the Kybra-internal Rust version to 1.77.0 to overcome ic-wasm installation issues.

What's Changed

  • Increasing dfx to 0.17.0, now using dfxvm, increasing node to 20 by @lastmjs in #462

Full Changelog: 0.5.2...0.5.3

0.5.2

22 Sep 19:58
d934d10
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.5.1...0.5.2

0.5.1

15 Sep 21:38
28310a8
Compare
Choose a tag to compare

What's Changed

  • add documentation by @lastmjs in #444
  • Refactored TryFromVmValue to return PyBaseExceptionRefs instead of CdkActTryFromVmValueErrors by @dansteren in #448
  • update rust version by @lastmjs in #450

Full Changelog: 0.5.0...0.5.1

0.5.0

13 Jul 22:09
3da1e94
Compare
Choose a tag to compare

New Features

  1. Broad stdlib support
  2. Greatly expanded Python source code size limit
  3. Various syntax changes that we hope improve the developer experience and solve various issues
  4. Guard functions
  5. Greatly improved error reporting
  6. match function

Breaking Changes

Please follow this breaking change guide to ensure a smoother transition from previous versions of Kybra to version 0.5.0.

It is recommended to do the following before starting a manual project migration:

  1. delete ~/.config/kybra
  2. delete your local venv
  3. delete your local .dfx directory
  4. delete your local .kybra directory

opt is now Opt

opt has been renamed to Opt

Vec

The Vec type has been introduced, and it must be used in place of list.

Variant casing

Variants now follow conventions from Rust enums. The first letter will be uppercase and the rest camel case. For example, for the Result types ok is now Ok and err is now Err.

void is now required on system methods

All canister methods must have an explicit return type. In the case of certain system methods like init and post_upgrade, you must explicitly return void.

candid:service metadata is gone

For the time being the candid:service metadata has been removed and Kybra relies on the __get_candid_interface_tmp_hack canister method.

dfx.json

All dfx.json files must add the following to the canister objects:

Add the post_install script path:

"post_install": ".kybra/canister_name/post_install.sh"

Add gzip true:

"gzip": true

Remove .gz from the Wasm path:

"wasm": ".kybra/canister_name/canister_name.wasm"

StableBTreeMap memory ids

StableBTreeMap memory ids 0, 1, 2, 252, 253, 254 are now reserved. If you are using one of these memory ids then your application will break. Remember that migrating StableBTreeMaps is not well supported, be careful with trying to upgrade an existing canister in production using a StableBTreeMap.

None is no longer a type

None is not a Candid type anymore. It has been replaced by null.

Canister is now Service

Canister has been renamed to Service.

method is now service_query or service_update

The method decorator is now service_query or service_update depending on if the Service method is a query or an update method.

CanisterResult is now CallResult

CanisterResult has been renamed to CallResult.

manual is now Manual

manual has been renamed to Manual.

tuple is now Tuple

tuple has been renamed to Tuple.

alias is now Alias

alias has been renamed to Alias.

init and post_upgrade params

When adding init and post_upgrade params you must manually edit the Candid service and add the params on the first deploy. For more information see The Kybra Book.

No encrypted dfx identities

Encrypted dfx identities are no longer supported. For more information see The Kybra Book.

Wasm module hash no longer useful

The Wasm module hash has been rendered unuseful. For more information see The Kybra Book.

ic.caller() in init and post_upgrade

When deploying with dfx, ic.caller() in init and post_upgrade will now be the canister's id and not the dfx identity's principal. For more information see The Kybra Book

init under-the-hood nuances

In order to allow for larger Kybra Wasm modules and to enable the Python stdlib, we had to introduce some trade-offs into the init and post_upgrade processes:

  1. The under-the-hood Rust init function of your application canister is never called directly, only the post_upgrade function. This function will call your Python init or post_upgrade function in a timer callback
  2. When deploying to a local replica, errors from your init or post_upgrade will be logged from your replica, not from the dfx deploy process
  3. When deploying to mainnet, errors from your init or post_upgrade will not be logged
  4. Your canister will go through the following main steps when deploying: first a deployer canister Wasm binary will be deployed to the canister, then your application Wasm binary will be chunk uploaded to the deployer canister along with the Python stdlib, and finally the deployer canister will call install_code on itself with the full application Wasm binary

What's Changed

Read more

0.4.0

24 Jan 23:30
f530a5d
Compare
Choose a tag to compare

TLDR

There is no more need to manually install Rust on your machine. Kybra will now install an encapsulated Rust environment inside of ~/.config/kybra per version of Kybra. You can also use a more flexible virtual environment setup. Composite queries are now supported for use in the local replica.

Breaking Changes

  1. Please delete your local .dfx directory before installing and deploying with the new version of Kybra
  2. Please follow the new directions in the README for setting up your virtual environment
  3. You should add .kybra to your .gitignore file

What's Changed

Full Changelog: 0.3.0...0.4.0

0.3.0

14 Jan 18:28
a6e023e
Compare
Choose a tag to compare

If you run into issues after an upgrade:

  1. Ensure all versions of dfx, Rust, and Python are exactly as described in the README
  2. Completely delete the .dfx directory and deploy again
  3. Run rustup update

TLDR

This release is all about introducing StableBTreeMap.

What's Changed

Full Changelog: 0.2.0...0.3.0