10 releases (5 major breaking)
6.0.0 | Sep 9, 2024 |
---|---|
5.0.0 | Mar 25, 2024 |
4.0.0 | Jan 22, 2024 |
3.1.0 | Oct 18, 2023 |
1.0.1 | Mar 20, 2023 |
#6 in #v0
377 downloads per month
Used in 3 crates
(2 directly)
1.5MB
27K
SLoC
concordium-smart-contract-engine
A library that provides an implementation of execution of smart contracts on top
of the concordium-wasm
library that implements the underlying Wasm execution.
In particular this library is used by the Concordium node to execute both V0 and V1 smart contracts. It is also used by other Concordium tools, such as cargo-concordium, to provide build and test functionality.
Versioning
This crate follows semantic versioning guidelines. Change in minimum supported rust version will be accompanied by a minor version increase.
lib.rs
:
This library provides functionality that builds on top of the Wasm engine and adds high-level functions for executing smart contracts on the Concordium chain.
Concordium supports two versions of smart contracts, the legacy [v0
]
version and the [v1
] version. The latter is essentially better in
every way. They differ in two main ways
- [
v0
] uses message passing for inter-contract communication, and has a flat state. The state is limited to 16kB and the entire state is written every time a contract update is done. - [
v1
] uses synchronous calls for inter-contract communication, and its state is a trie-based structure, which supports efficient partial state updates. The trie is implemented in thev1::trie
module.
Both [v0
] and [v1
] modules are structured similarly. The main
entrypoints used by users of this library are v0::invoke_init
(resp.
v1::invoke_init
) and v0::invoke_receive
(resp.
v1::invoke_receive
) functions, and their variants.
The respective modules provide more details on the data types involved, and any specifics of the different versions.
Features
This crate has the following features. None are enabled by default.
display-state
This feature exposes the function
display_tree
for displaying the
V1 contract state in a reasonably readable format. This is useful for deep
inspection of smart contract state, and debugging.
async
Exposes construction of smart contract state from streams of key-value pairs, such as those received from the node's API. See
enable-ffi
This enables foreign function exports. This is an internal feature and there are no guarantees about the stability of foreign exports.
fuzz-coverage
and fuzz
These features are also internal and exist to support fuzzing. They are used to derive Arbitrary instances and to disable inlining, the latter is necessary since the fuzzer used has bugs which prevent the coverage report being generated when functions are inlined.
Dependencies
~16MB
~232K SLoC