linera-execution 0.4.1

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
application-id: func() -> application-id
application-parameters: func() -> list<u8>
read-system-balance: func() -> amount
read-system-timestamp: func() -> timestamp

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

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

load: func() -> list<u8>
load-and-lock: func() -> option<list<u8>>
store-and-unlock: func(value: list<u8>) -> bool

resource lock {
    static new: func() -> lock
    poll: func() -> poll-lock
}

variant poll-lock {
    pending,
    ready-locked,
    ready-not-locked,
}

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

try-call-session: func(
    authenticated: bool,
    session: session-id,
    argument: list<u8>,
    forwarded-sessions: list<session-id>,
) -> call-result

record call-result {
    value: list<u8>,
    sessions: list<session-id>,
}

record session-id {
    application-id: application-id,
    index: u64,
}

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

type bytecode-id = message-id

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

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

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

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