Skip to content

v1.5.0

Compare
Choose a tag to compare
@breathx breathx released this 11 Aug 17:47
· 228 commits to master since this release

Release v1.5.0 changes

  • Crates versions bumped to "v1.5.0", runtime spec version bumped to 1500 (#4114);
  • Weights of extrinsic and WASM calls WERE updated (#4136), schedule version bumped to 1500 (#4114).

Important

πŸ“– With this release requirement to minimal stable rust version to compile gear crates (such as gstd) was bumped from v1.73 to v1.80 (#4124).

πŸ“– Moreover, wasm-proc crate is now published on crates-io so could be installed with native cargo interface instead of git dependency (#4124).

Note

While depending on crates-io source of gear packages is recommended way, if you prefer specifying git (and your revision is before #4124), without stable update you may run into following error of gsys crate compilation:

error[E0425]: cannot find function `size_of` in this scope

Tip

To update your stable compiler, run rustup update stable.

Update requirements

Name Character
JS clients βšͺ Insubstantial / πŸ”΄ Required (depending on your application's logic)
Programs βšͺ Insubstantial / 🟑 Recommended (testing code)
Node bin 🟑 Recommended

Userspace

πŸ“– Interface of gtest's mailbox was refactor to match on-chain one (#4010);

Tip

Check out following code snippet how mailbox interactions work now:

/* some testing code */

// Executing some message.
let res = some_program.send(/* args */);

// Asserting execution didn't fail.
assert!(!res.main_failed());

// Asserting some log exists.
assert!(res.contains(&some_log));

// Querying mailbox.
let mailbox = system.get_mailbox(/* some log destination (user) */);

// Asserting mailbox contains the log.
assert!(mailbox.contains(&some_log));

// Sending and executing reply.
let res = mailbox
    .reply(some_log, Calls::default(), 0)
    .expect("sending reply failed: didn't find message in mailbox");

// Asserting reply execution result.
assert!(!res.main_failed());

/* some testing code */

πŸ“– gtest now supports message sending with custom gas limit (#4039);

Note

Previously it was only possible to send message to program with maximal gas limit, so new api was added for gtest's programs:

some_program.send_with_gas(/* usual args */, gas_limit)

πŸ“š Bug of incorrect behavior of gstd::dbg! macros causing compilation failures without debug feature was fixed (#4044);


πŸ“– Added ability to apply custom hook for processing replies on gstd's "*_for_reply" functions (#4046);

Tip

This hook could be used to perform some custom calculations on reply receiving inside handle_reply entry. Note, that it requires non-zero reply deposit to be applied to message's reply future. This functionality could also be used to handle outdated (timed out) replies that you no longer wait, but have to make refund or something.

use gstd::msg;

/* some code */

let _reply = msg::send_for_reply(dest, payload, value, non_zero_reply_deposit)
    .expect("Failed to send message")
    .up_to(Some(5))
    .expect("Failed to set timeout")
    .handle_reply(|| {
        // Imagine that we've receive reply after 1_000 blocks (already outdated,
        // because 5 blocks timeout set above), but this still called.

        debug!("Reply (to `message_id`) payload: {:?}", msg::load_bytes());

        msg::send(msg::source(), "Mate, I got your reply, but it's 955 blocks late", 0);
    })
    .expect("Failed to set reply hook")
    .await
    .expect("Received error reply or timed out");

/* some code */

Important

  1. The hook applies to only one reply.
  2. The hook may be specified just once, as well as will be executed just once.
  3. If you panic in the hook, your reply won't be recorded so initial future will end up with timeout error.

πŸ“– Logic dependent on system signals (e.g. handle_signal entry or critical sections) could now be properly tested with gtest (#4075);


πŸ“š Fixed a huge gasp between on-chain gas consumption and gtest ones (#4088);

Note

Consumed gas inside gtest now pretty close to real one but still can differ.


πŸ“– Logic dependent on reservations could now be properly tested with gtest (#4089);


πŸ“š Added ability to create sails template from cargo-gbuild (#4096).

Tip

That's how you could call it:

cargo-gbuild new <PATH>

Runtime

πŸ“š Substrate version bumped from v1.3.0 to v1.4.0 (#3934);

Important

Make sure to update your JS code according to Substrate's release notes.


πŸ“– Value inheriting logic was redesigned (#3949);

Note

Once program exits (it also specifies some inheritor address) or fails it's initialisation (deployer address), the "grave" is left in storage associated with program's address. On such terminations all balance of the program is transferred to inheritor.

Previously, all other funds that could be transferred (or unlocked) to the program, were automatically transferred to inheritor, what's now no longer actual. From this release, all incoming funds will remain on program's balance until ANYBODY call extrinsic of pallet_gear - claim_value_to_inheritor(program_id). This call transfers all the available funds to inheritor (not the caller) if program is terminated, otherwise returns error.


πŸ“– New invariant has been added to runtime and programs messaging (#4060);

Note

All gasless sending from gear programs now "charges" mailbox inclusion fee within the execution, so could always cover sending into user, otherwise freed.

In other words, gasless messages (non-replies) are always put in user's mailbox, what was different previously and was dependent on remaining message's gas balance.


πŸ“– Similarly to invariant above, all reservation-provisioned messages sent to user are also always inserted in mailbox (#4102).

Key features of the release

πŸ“– Primary executor for gear programs Wasmer has been updated to major v4 from major v2 (#4037).

Note

A lot of bugs and optimisations were applied within the update. Stability and security has been verified due to lots of tests and implementing specific fuzzer based on gear common ones, but aimed to catch executor errors in memory management and codes compilation (#4005).

πŸ”₯πŸ“– New builtin actor, that implements pallet-staking functionality has been implemented (#3843);

Tip

Now programs are able to manage staking bonding/unbonding operations within the internal logic. This is great update in terms of flexibility of programs logic and improved funds-management and DeFi experience. Checkout gbuiltin-staking crate for details.

πŸ”₯πŸ“– Memory limit for gear programs has been increased to 2GB (of 4GB theoretically possible) (#3954);

Note

To implement this, a lot of PRs and logic adjustments has been implemented in latest releases. In this one, allocations tree was moved into separate storage, so if you query them from external code (e.g. JS clients), make sure to perform updates. This limit is totally safe and tested, but some gap has been left for future changes, so 4GB will be set in observable future.

πŸ”₯πŸ“– An interface of upcoming bridge has been added into Vara Network Testnet only (#4015);

Note

pallet-gear-eth-bridge will be tested and in future moved to mainnet with monitoring from trustless relayer, once testing from testnet-to-testnet and audit are finished.

Full Changelog: v1.4.2...v1.5.0