linera-execution 0.10.0

Persistent data and the corresponding logics used by the Linera protocol for runtime and execution of smart contracts / applications.
Documentation
chain-id: func() -> chain-id
block-height: func() -> block-height
application-id: func() -> application-id
authenticated-signer: func() -> option<owner>
application-parameters: func() -> list<u8>
read-system-timestamp: func() -> timestamp

message-id: func() -> option<message-id>
message-is-bouncing: func() -> option<bool>
authenticated-caller-id: func() -> option<application-id>

read-chain-balance: func() -> amount
read-owner-balance: func(owner: owner) -> amount
transfer: func(source: option<owner>, destination: account, amount: amount)
claim: func(source: account, destination: account, amount: amount)

log: func(message: string, level: log-level)

enum log-level {
    trace,
    debug,
    info,
    warn,
    error,
}

send-message: func(message: send-message-request)
subscribe: func(chain: chain-id, channel: channel-name)
unsubscribe: func(chain: chain-id, channel: channel-name)

try-call-application: func(
    authenticated: bool,
    application: application-id,
    argument: list<u8>,
) -> list<u8>

open-chain: func(
    ownership: chain-ownership,
    balance: amount
) -> chain-id

close-chain: func() -> result<tuple<>, closechainerror>

variant closechainerror {
    not-permitted
}

chain-ownership: func() -> chain-ownership

record application-id {
    bytecode-id: bytecode-id,
    creation: message-id,
}

type owner = crypto-hash
type bytecode-id = message-id

record send-message-request {
    destination: destination,
    authenticated: bool,
    is-tracked: bool,
    resources: resources,
    message: list<u8>,
}

record resources {
    fuel: u64,
    read-operations: u32,
    write-operations: u32,
    bytes-to-read: u32,
    bytes-to-write: u32,
    messages: u32,
    message-size: u32,
    storage-size-delta: u32,
}

variant destination {
    recipient(chain-id),
    subscribers(channel-name),
}

record channel-name {
    name: list<u8>,
}

record message-id {
    chain-id: chain-id,
    height: block-height,
    index: u32,
}

type chain-id = crypto-hash
type block-height = u64
type timestamp = u64
type duration = u64

record public-key {
    part1: u64,
    part2: u64,
    part3: u64,
    part4: u64,
}

record crypto-hash {
    part1: u64,
    part2: u64,
    part3: u64,
    part4: u64,
}

record amount {
    lower-half: u64,
    upper-half: u64,
}

record account {
    chain-id: chain-id,
    owner: option<owner>,
}

record chain-ownership {
    super-owners: list<public-key>,
    owners: list<tuple<public-key, u64>>,
    multi-leader-rounds: u32,
    timeout-config: timeout-config,
}

record timeout-config {
    fast-round-duration-ms: option<duration>,
    base-timeout-ms: duration,
    timeout-increment-ms: duration,
}