1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
Copyright © 2023, ParallelChain Lab
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
//! ParallelChain Mainnet Runtime is a **State Transition Function** to transit from an input state of the blockchain to next state.
//! It is also the sole system component to handle Smart Contract that is primarily built from Rust code by using
//! ParallelChain Smart Contract Development Kit (SDK).
//!
//! ```text
//! f(WS, BD, TX) -> (WS', R)
//!
//! WS = World state represented by set of key-value pairs
//! BD = Blockchain Data
//! TX = Transaction, which is essentially a sequence of Commands
//! R = Receipt, which is a sequence of Command Receipts correspondingly.
//! ```
//!
//! ### Example
//!
//! ```rust
//! // prepare world state (ws), transaction (tx), and blockchain data (bd),
//! // and call transition.
//! let result = pchain_runtime::Runtime::new().transition(ws, tx, bd);
//! ```
//!
//! In summary, a state [transition] function intakes Transaction, Blockchain and World State to [execute](execution),
//! and output transition result which could be a success result or an [error]. The transition follows
//! the data [types] definitions of ParallelChain Mainnet and the [formulas] in this library.
//! When transiting the state by executing smart [contract], it uses [wasmer] as underlying WebAssembly runtime,
//! which is gas-metered, and the [gas] [cost] incurred will be set to transaction receipt.
pub use TransitionError;
pub use ;
pub use ;
pub use crateCache;