Cargo Features

[dependencies]
gstd = { version = "1.7.0", default-features = false, features = ["panic-handler", "panic-message", "panic-location", "nightly", "oom-handler", "ethexe", "debug", "document-features"] }
default = panic-message

Default features:

  • panic-message
panic-handler panic-message = const_format

Panic handler profiles

We currently use the following format for panic messages from Rust code: panicked with '{message}'[ at '{location}']. Also Panic occurred: will be added to the beginning of the panic message by our core-backend.

So the final panic message looks like this: Panic occurred: panicked with '{message}'[ at '{location}'].

You can configure which panic handler profile you need by specifying one of the following functions:

When enabled, a minimal panic handler is provided by this crate. Instead of a panic message, <unknown> is displayed.

panic-message default panic-location? = arrayvec, panic-handler

When enabled, a panic handler will also display a panic message.

panic-location = panic-message

When enabled, a panic handler will also display a panic message and location.
This function is not recommended for use in production environment because it displays the code path.

nightly = oom-handler

For example, if you don't use the panic-location feature, the compiler will remove all locations such as /home/username/dapp/src/lib.rs:1:2 from the binary. The size of program will be reduced and /home/username/... information will not be included in the binary.

Nightly features

The final binary gets additional optimizations when using the nightly compiler.

Enables all features below. These features depend on unstable Rust API and require nightly toolchain.

oom-handler nightly?

When enabled, an OOM error handler is provided. Relies on [alloc_error_handler][rust-51540].

Affects handlers::oom

ethexe

Additional features

Disables unsupported syscalls and their calls for executing on ethexe.

Enables ethexe of gcore and gstd-codegen

debug

Enables debug logging; this heavily impacts gas cost and is therefore disabled by default.

Enables debug of galloc and gcore

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

arrayvec panic-message
const_format panic-handler?
document-features implicit feature

Enables document-features

document-features:

Extract documentation for the feature flags from comments in Cargo.toml