github gear-tech/gear v1.1.0

latest releases: build, v1.6.2, v1.6.1...
9 months ago

Release v1.1.0 changes

  • Crates versions bumped to "v1.1.0", runtime spec version bumped to 1100 (#3679);
  • Weights of extrinsic and WASM calls updated, schedule version bumped to 1100 (#3677).

Update requirements

Name Character
JS clients 🔴 Required
Programs 🟡🔴 Recommended / Required
Node bin ⚪ Insubstantial

User-space libraries

* New syscall gr_env_vars() that allows to query some actual blockchain parameters added (#3403);

Tip

Check out following gstd API snapshot:

use gstd::exec;

let vars = exec::env_vars();

// Current multiplier percent recommended to use with explicit gas amounts.
let _ = vars.performance_multiplier;

// Current value of existential deposit (minimum balance).
let _ = vars.existential_deposit;

// Current value of mailbox threshold (minimum gas applied for message to user to be inserted into `Mailbox`).
let _ = vars.mailbox_threshold;

// Current value of gas multiplier (how much value, where value is 10^(-12) Token, is in a single gas).
let _ = vars.gas_multiplier;

* Crate level documentation added for gtest (#3419, #3511);


* Public gsdk API functions that returns WS subscriptions were renamed (#3456);

Tip

blocks and finalized_blocks changed to subscribe_blocks and subscribe_finalized_blocks accordingly:
Check out following gsdk API snapshot:

use gsdk::Api;

let api = Api::new(None).await?;
- let blocks = api.blocks().await?;
+ let blocks = api.subscribe_blocks().await?; 
     
while let Ok(block) = blocks.next().await {
     // .. // 
}

* All usages of Rust nightly's features moved under each own gstd feature, general feature "nightly" that enables all of the others added as well (#3470);

Warning

It may break compilation: please, doublecheck your features set of gstd import according to latest docs.
As well as It mayn't cause users due to changes about compiling below.


* Recommended nightly toolchain is downgraded to nightly-2023-09-05 (#3536);

Note

It won't cause users due to changes about compiling below.


* Added ability to pre-process out binary in gear-wasm-builder if not shortcuts used (#3538);


* New syscall free_range that allows to free multiple pages at once added (#3467);

Note

This syscall is now used in lates versions of default galloc allocator for gear programs, so its usage become cheaper (#3611).


* Added ability to derive custom CLI applications based on gcli commands (#3573);


* Logging for uploaded program id added in gcli (#3568);


* Added dbg! macro for gstd (#3610);

Note

Its usage is identical to Rust std one: link


* Time-limited wait of programs now will be handled and processed by gtest (#3605);


* Timestamp increase for each block for gtest set same as for real chain: 3 sec per block (#3516);


* gstd now has critical hooks: the code guaranteed to be executed even if panic occurs (#3503);

Tip

This API allows to revert state changes applied if something went wrong with business process.
Check out a small demo and dive into gstds module docs for more info:

use gstd::{critical, msg};

#[gstd::async_main]
async fn main() {
    let source = msg::source();

    critical::set_hook(move || {
        msg::send(source, "I failed :c", 0).expect("Failed to send emergency message");
    });

    let reply = msg::send_for_reply(source, "Say my name", 0, 0)
        .expect("Failed to send message")
        .await
        .expect("Received error reply");

    // here goes "reply" processing //

    // processing ends panicking,
    // but user guaranteed to receive emergency message.
}

🥳 Stable compiler

* Several panic handler verbose modes introduced through gstd features, allowing to optimally extract panic message even without nightly features, moreover panic handler no longer depend on compile mode or "debug" feature (#3527)

Tip

gstd panic format: panicked with '{message}'[ at '{location}']: location is optional. Note that resulting error reply with panic will have prefix Panic occurred: as well. This formatting is similar to Rust defaults.

gstd panic handler lvls:

  • panic-handler: message <unknown> without location;
  • panic-message: message from panic info without location; (!) [NEW gstd DEFAULT]
  • panic-location: message and location from panic info.

Nightly features optimise panic message extracting, but are no longer required.

Important

This changes allow building gear programs with Rust stable toolchain!


* Usage of actual toolchain for building with gear-wasm-builder added (#3459).

Important

Previously compilation of program using gear-wasm-builder were forcing using nightly toolchain from your system. It caused a lot of limitations, problems and legacy code. Even if you were building your crate as cargo +nightly-z-y-x build it called just cargo +nightly build etc.
Now it will compile with toolchain that you specify in your cargo command. Furthermore, since gear programs are compiled with stable toolchain: this method is now strongly recommended! Don't forget to adjust your scripts and actions.

Note

gear_wasm_builder::build() uses your given toolchain: (!) [NEW gear_wasm_builder DEFAULT]
gear_wasm_builder::recommended_nightly() uses your given toolchain but checks if it matches recommended nightly: for cases if you use nightly features and want to keep toolchain on recommended by core.

🥳 Crates.io

All of gear programs user-space libraries now published on crates.io (#3103, #3515, #3594, #3629).

Tip

Now it's possible to import these packages as any other Rust ones in your toml. Say no to GitHub refs!

[dependencies]
galloc = "1.1.0"
gcli = "1.1.0"
gclient = "1.1.0"
gcore = "1.1.0"
gear-wasm-builder = "1.1.0"
gmeta = "1.1.0"
gsdk = "1.1.0"
gstd = "1.1.0"
gtest = "1.1.0"

Runtime

* Program memory pages storage are now represented as triple map (#3166);

Warning

It causes ProgramStorage as well as MemoryPages storage: keeping relations changed from program id -> page number to program id -> session id -> page number
It may brake your JS code!


* Stack limitations are precised for more stable behaviour of the system (#3462);


* Added create Numerated as initial step of road to 4GB memory limitation for programs (#3471);


* Codes with non-empty WASM functions inputs and outputs of gear entry points are now rejected by the system on upload (#3559);

Note

Such WASMs may be produced by the aim only, common recommended flow is correct.


* Added StakingAdmin origin for pallet-staking to be used from governance (#3633);


* Current rent functionality is now removed (#3590);

Note

Keeping programs on-chain is now totally free in order to implement more optimal solution proposal.


* Added revokable functionality for vouchers (#3606);

Important

It may break your JS code!

  • Previous flow was deprecated and APIs removed.
  • Check out new extrinsics and their docs at pallet-gear-voucher.
  • Previously issued voucher couldn't be revoked and is still supported: it's recommended to finish them until upcoming releases.
  • Vouchers now can be used for Gear::upload_code as well (#3672).

* Removed support for syscall gr_pay_program_rent, since program rent is removed (#3664);

Important

It invalidates any uploaded program that uses this syscall - they won't be able to execute! Make sure to migrate them until runtime upgrade to current release.

🥳 Calculate gas RPC calls bug fixes

* Fixed bug of incorrect calculations for rare waiting cases (#3609);


* <wasm:stripped> is no longer returned: extrinsic errors are printed properly with dedicated format (#3655);

Tip

Check out details in pull request description.


* Gas calculation doesn't return error in any case for zero-balanced accounts (as well as for vouchers) (#3653);

Note

No new calls implemented. To calculate gas for voucher call use default gear api with your origin.


* Return error instead of invalid huge gas in case of failing init as well as for traps in handle (#3674).

Full Changelog: v1.0.5...v1.1.0

Don't miss a new gear release

NewReleases is sending notifications on new releases.