demergent-labs / kybra

Python CDK for the Internet Computer
MIT License
80 stars 15 forks source link

gzip and metadata #374

Closed lastmjs closed 6 months ago

lastmjs commented 1 year ago

This is mainly copied from the Azle issue: https://github.com/demergent-labs/azle/issues/1029

Kybra might have to wait longer considering that the binaries are much larger, thus a dependency on ic-cdk-optimizer/ic-wasm will probably be needed for longer, and ic-wasm is performing this task for now. It might still be nice to switch over to the metadata in dfx.json though.

Soon dfx will automatically gzip Wasm for us, allowing us to simply pass the regular .wasm file into dfx.json. Also, the metadata section of dfx.json will work for Azle at that point. Once this happens, we should use the metadata section in dfx.json to set candid:service and cdk:name.

Using the metadata section of dfx.json will be much more elegant than forcing ic-wasm as a dependency or using link sections in the code, candid:service I believe is done automatically if you just specify it, and cdk name should be easy...cdk version would be harder, but it's debatable whether or not that should be in there anyway.

Here's what I believe the metadata section should look like:

            "metadata": [
                {
                    "name": "candid:service"
                },
                {
                    "name": "cdk",
                    "contents": "azle"
                }
            ],
lastmjs commented 6 months ago

We now do gzipping and metadata from dfx.json