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

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

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

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

variant poll-load {
    pending,
    ready(result<list<u8>, string>),
}

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

variant poll-lock {
    pending,
    ready(result<unit, string>),
}

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

variant poll-unlock {
    pending,
    ready(result<unit, string>),
}

resource read-key-bytes {
    static new: func(key: list<u8>) -> read-key-bytes
    poll: func() -> poll-read-key-bytes
}

variant poll-read-key-bytes {
    pending,
    ready(result<option<list<u8>>, string>),
}

resource find-keys {
    static new: func(prefix: list<u8>) -> find-keys
    poll: func() -> poll-find-keys
}

variant poll-find-keys {
    pending,
    ready(result<list<list<u8>>, string>),
}

resource find-key-values {
    static new: func(prefix: list<u8>) -> find-key-values
    poll: func() -> poll-find-key-values
}

variant poll-find-key-values {
    pending,
    ready(result<list<tuple<list<u8>,list<u8>>>, string>),
}

resource try-query-application {
    static new: func(
        application: application-id,
        query: list<u8>,
    ) -> try-query-application

    poll: func() -> poll-load
}

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

type bytecode-id = effect-id

record effect-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 balance {
    lower-half: u64,
    upper-half: u64,
}