Skip to content

ledger: provide starstream:std/cardano context to contracts - #255

Merged
rvolosatovs merged 1 commit into
mainfrom
roman/ledger/cardano-context
Oct 15, 2026
Merged

rvolosatovs merged 1 commit into
mainfrom
roman/ledger/cardano-context

Conversation

@rvolosatovs

Copy link
Copy Markdown
Contributor

Both the server and the client implemented block-height and current-slot with bail!("TODO"), so any contract reading them trapped, whether in a coordination script run by the client or in a UTXO method called over /rpc.

Port the approach of the original ledger draft (#182): a static CardanoCtx reported to every store. The node takes it from --cardano-block-height and --cardano-current-slot (default 0) and uses it both for /rpc UTXO method calls and for genesis scripts. ledger contract script call takes the same flags for the scripts it runs.

The values aren't recorded in the transaction or checked when it is submitted, so the client and the node can disagree.

Breaking: Ledger::new takes a CardanoCtx, and the client Ctx has a new public cardano field.

Both the server and the client implemented `block-height` and
`current-slot` with `bail!("TODO")`, so any contract reading them
trapped, whether in a coordination script run by the client or in a
UTXO method called over `/rpc`.

Port the approach of the original ledger draft (#182): a static
`CardanoCtx` reported to every store. The node takes it from
`--cardano-block-height` and `--cardano-current-slot` (default `0`)
and uses it both for `/rpc` UTXO method calls and for genesis scripts.
`ledger contract script call` takes the same flags for the scripts it
runs.

The values aren't recorded in the transaction or checked when it is
submitted, so the client and the node can disagree.

Breaking: `Ledger::new` takes a `CardanoCtx`, and the client `Ctx` has
a new public `cardano` field.

Assisted-by: anthropic:claude-opus-5-5
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
@rvolosatovs
rvolosatovs merged commit 91e8384 into main Oct 15, 2026
@rvolosatovs
rvolosatovs deleted the roman/ledger/cardano-context branch October 15, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants