github OffchainLabs/stylus-sdk-rs v0.2.1
Stylus SDK 0.2.1

latest releases: v0.6.0, v0.4.3, v0.4.2...
12 months ago

This patch includes backward-compatible changes introducing new features.

Fixed Storage Arrays

You may now use fixed-length storage arrays when declaring contract storage.

pub struct Arrays {
    string[4] strings;
    uint8[2][4] matrix;
    int96[4][] vector;
    int96[][4] vectors;
    Struct[3] structs;
}

Eager Storage Access

You may now opt-out of Stylus's optimal storage-caching algo by disabling the default storage-cache feature like so.

stylus-sdk = { version = "0.2.1", default-features = false }

This will replace the StorageCache type with EagerStorage, which has identical methods but doesn't employ caching. Most users won't want to do this, but it may help in shrinking binary sizes or hand-optimizing.

Host I/O Caching

Repeated access to EVM affordances is now cheaper due to caching. This means msg::value and similar may be called more than once without paying VM costs.

Cache management for RawCall and RawDeploy

RawCall and RawDeploy have new methods for managing the storage cache.

let data = RawCall::new_delegate()   // configure a delegate call
    .gas(2100)                       // supply 2100 gas
    .limit_return_data(0, 32)        // only read the first 32 bytes back
    .flush_storage_cache()           // flush the storage cache before the call
    .call(contract, calldata)?;      // do the call

Don't miss a new stylus-sdk-rs release

NewReleases is sending notifications on new releases.