Gastronomy

A time-travel debugger for Cardano scripts.

It keeps the machine's state at every step, so you can walk a script forward, then back, and read each step against the Aiken that produced it.

A sample trace to step through

gastronomy-cli run check.uplc

Gastronomy Debugger (check.uplc)

Current: Compute

Budget: 128100 steps (+16000) 900 mem (+100)

Next: Return

Term

[ (lam r
    [ [ (builtin equalsInteger)
        [ [ (builtin addInteger) r ] (con integer 1) ] ]
      (con integer 42) ] )
  (con integer 41) ]

Source

fn check(r: Int) -> Bool {
  r + 1 == 42
}

Source Location

check.ak:2:5

Context

  1. [_ r]
  2. -> [_ (con integer 1)]
  3. -> [(builtin equalsInteger) _]
  4. -> [_ (con integer 42)]
  5. -> Root

Env

r ↦ (con integer 41)

The deepest point of the trace: four frames on the stack.

# check.uplc is a sample written for this page, and its budgets are illustrative. Drag the step bar, or press P and N.

Real transactions

cat ~/.gastronomyrc.toml

[blockfrost]
key = "mainnet…"

With a Blockfrost key, load a transaction instead of a script. Each script in it runs with the context the chain gave it. The key can live in BLOCKFROST_KEY instead.

Questions

# questions

  • Why can it step backwards?

    Cardano scripts are small, so keeping the machine's full state at every step is cheap. Stepping back reads the previous state; nothing is evaluated again.

  • Does it work with Aiken?

    Yes, through a fork of the Aiken compiler that emits source maps. Ask us in Discord for it.

  • What's planned?

    Bookmarks, speculative execution with a changed environment, a budget heat-map, and Plu-ts source maps. The README tracks each one.

  • Can I contribute?

    Yes. Source, issues, and releases live at SundaeSwap-finance/gastronomy on GitHub, and pull requests are welcome.

cd ~

Get the source

git clone https://github.com/SundaeSwap-finance/gastronomy

Copy the line above.

Open source, maintained by Sundae Labs. Issues and pull requests welcome.