Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
deae574
fix(jsonrpc): omit Boost source_location suffix from error logs at no…
diegonehab Apr 22, 2026
3f00d53
fix: declare #address-cells on per-CPU interrupt-controller
diegonehab May 4, 2026
db430dd
fix: typo in cartesi-machine.lua cmio handling
diegonehab May 6, 2026
bc32cfe
fix: expose missing HTIF constants in cm.h
diegonehab May 14, 2026
bb8d915
fix: expose missing yield constants in cm.h
diegonehab May 14, 2026
f187770
feat: add get/set_revert_root_hash accessors across API layers
diegonehab May 15, 2026
99bdb9b
fix: expose PMA device ID constants in cm.h and Lua API
diegonehab May 15, 2026
78992c9
refactor: split DTB_BOOTARGS atoms into _PART macros
diegonehab May 16, 2026
066c80e
docs: copy machine docs to machine repo
diegonehab Apr 19, 2024
4b5f640
refactor: merge perpectives into single file
diegonehab May 22, 2024
a4b2318
docs: migrate pipeline from panpipe+JS driver to pandoc Lua filter
diegonehab May 22, 2024
9b881f9
docs: default README.md generation to playground container
diegonehab Apr 24, 2026
edc7fe4
docs: replace _build_all.sh orchestrator with Make-driven cache
diegonehab Apr 25, 2026
4aca04b
docs: replace cat-only pipe=sh blocks with cache= filter attribute
diegonehab Apr 25, 2026
7065060
docs: refactor recipe build system to gcc -MMD self-declaring deps
diegonehab Apr 26, 2026
af43394
docs: consolidate recipe boilerplate into lib.sh and docgen.lua
diegonehab Apr 26, 2026
0c10e90
docs: drive displayed commands from cache scripts via script= filter
diegonehab Apr 26, 2026
d7b1ab2
docs: convert ls/flash/templates-run/proofs-output-run to script= filter
diegonehab Apr 27, 2026
1857cae
docs: convert remaining hand-typed bash blocks to script= filter
diegonehab Apr 27, 2026
98958b8
docs: replace split-file recipes with inline-script build system
diegonehab Apr 28, 2026
8c31d71
docs: order-independent docgen and derived hashes in the template
diegonehab Apr 29, 2026
ec39637
docs: enforce identifier keys and verify declared outputs
diegonehab Apr 29, 2026
d7703c1
docs: unify replace=/subst= addressing, capture streams in PREAMBLE
diegonehab Apr 29, 2026
74759e4
docs: rename docgen.lua to replace.lua, add alerts.lua and language r…
diegonehab May 1, 2026
d0962c7
docs: rebase pipeline on local emulator, bootstrap 0.20 migration
diegonehab May 3, 2026
7871471
docs: port Initialization and Flash drives sections to emulator 0.20
diegonehab May 3, 2026
5313d00
docs: port Limiting execution and State hashes sections to emulator 0.20
diegonehab May 3, 2026
186c0e4
docs: port Persistent Cartesi Machines section to emulator 0.20
diegonehab May 3, 2026
c47db57
docs: update Progress feedback section for emulator 0.20
diegonehab May 4, 2026
216e793
docs: port Cartesi Machine templates section to emulator 0.20
diegonehab May 4, 2026
254eaea
docs: unify subst= and slim depends=, key-named docgen cache
diegonehab May 5, 2026
261c325
docs: simplify docgen runners and unify REPLACE_* env names
diegonehab May 6, 2026
2479440
docs: accept bare identifier as subst= shortcut for K->K
diegonehab May 6, 2026
ae29352
docs: port State value proofs section to emulator 0.20
diegonehab May 6, 2026
01b88cc
docs: port Remote Cartesi Machines section to emulator 0.20
diegonehab May 6, 2026
96a4d8a
docs: fix broken cross-references in README.md.template
diegonehab May 6, 2026
5d1f71e
docs: add cartesi-rollup-data helper for ABI rollup record encoding
diegonehab May 7, 2026
1f2456c
docs: port Cartesi Rollups section to emulator 0.20
diegonehab May 7, 2026
91808f0
docs: port Rarely used options section to emulator 0.20
diegonehab May 7, 2026
cb4cbc8
docs: port Remote Cartesi Machines (Lua interface) and add include= a…
diegonehab May 8, 2026
f7a1393
docs: port Rolling Cartesi Machines (Lua interface) to emulator 0.20
diegonehab May 8, 2026
78d6921
docs: truncate cache 'both' file at start of each docgen runner
diegonehab May 8, 2026
f9d7600
docs: port State transition proofs section to emulator 0.20
diegonehab May 8, 2026
560a22a
docs: anchor-based selectors and enable dormant config blocks
diegonehab May 8, 2026
9617bb2
docs: rename cycles_limit_exec to cycles_htif_putchar
diegonehab May 8, 2026
639b056
docs: port Lua interface front to 0.20
diegonehab May 9, 2026
f66628b
docs: port Lua interface (Loading/Persistent/Limiting/Progress) to 0.20
diegonehab May 9, 2026
42dc45f
docs: port Lua interface tail to 0.20 and drop recipes/config/
diegonehab May 9, 2026
7606a8d
docs: rename subst= attribute and subst.lua to vars= and vars.lua
diegonehab May 10, 2026
0127edd
docs: feed interactive shell with ^D so output ordering is natural
diegonehab May 10, 2026
b5e54bf
docs: rewrite Target perspective for the 0.20 custom rootfs flow
diegonehab May 11, 2026
a4b96b8
docs: rewrite Target perspective for the 0.20 custom rootfs flow
diegonehab May 11, 2026
aac312c
docs: port Target-perspective Flash drives, NVRAMs, Initialization to…
diegonehab May 12, 2026
b745285
docs: add generation of html as well
diegonehab May 12, 2026
2321b06
docs: drive rolling machines with puppet and ship rootfs-docs as defa…
diegonehab May 14, 2026
e9375d7
docs: fix stdout/stderr ordering where needed
diegonehab May 14, 2026
7a74444
docs: port System architecture (processor, board, HTIF, Yield) to 0.20
diegonehab May 14, 2026
471e6ea
docs: port System architecture (uarch, Rollup) to 0.20
diegonehab May 16, 2026
00ef4ec
docs: port System architecture (Linux setup) to 0.20
diegonehab May 16, 2026
e707da3
docs: refocus PMAs section and rename PMA "device id" to "driver id"
diegonehab May 16, 2026
b65b403
docs: extend include= with /region selector and marker stripping
diegonehab May 17, 2026
ecf7db5
docs: port Blockchain perspective to 0.20 and extract proof.lua module
diegonehab May 17, 2026
374e79b
docs: flip enabled= default to true and add globals/ pseudo-key
diegonehab May 17, 2026
1213265
docs: fix cross-links
diegonehab May 17, 2026
972f42d
docs: extract drive-slot constants and add inline span code=no
diegonehab May 17, 2026
6476565
docs: fix README inconsistencies and rename yield constants to HTIF_
diegonehab May 18, 2026
4730269
fix!: leaf size in cartesi-hash-tree-hash
diegonehab May 18, 2026
a048ebe
docs: edit-pass on host perspective
diegonehab May 18, 2026
e916fd6
fix: mount read-only flash drives with -o ro
diegonehab May 18, 2026
9179cac
docs: edit-pass on host perspective and add replace=globals/NAME
diegonehab May 18, 2026
8862b0d
docs: clarify uarch step verification flow and misc fixes
diegonehab May 19, 2026
d95eb51
feat: add bash completion for cartesi-machine
diegonehab May 19, 2026
d2e5293
docs: drop redundant /stdout in README template replace= attributes
diegonehab May 19, 2026
fe5b2ea
fix: record revert root hash before each advance-state input
diegonehab May 19, 2026
e477c2b
docs: refresh README examples and supporting tooling
diegonehab May 21, 2026
57fc60d
docs: align K-without-qualifier on /both and tighten template prereqs
diegonehab May 21, 2026
1371e7e
docs: add runner= override and dump cache/<key>/both on rule failure
diegonehab May 21, 2026
d88ff2d
docs: add sequential= attribute to auto-chain blocks sharing a resource
diegonehab May 21, 2026
520b8b7
docs: enable parallel make inside the docs container
diegonehab May 21, 2026
47df320
docs: collapse include= blocks to a single /both handle
diegonehab May 22, 2026
621d645
docs: harden jsonrpc snippets, edit-pass Lua interface up to state tr…
diegonehab May 24, 2026
e007bcb
docs: edit-pass Lua interface and state-transition proofs sections
diegonehab May 25, 2026
0e2c0e7
docs: rename "target" to "guest" and expand machine_config schema
diegonehab May 26, 2026
164de67
docs: assign distinct jsonrpc ports so server blocks can run in parallel
diegonehab May 26, 2026
ebc6e28
docs: add Default configuration section, harden block runners
diegonehab May 26, 2026
1afe2d4
ci: check that doc/README.md is in sync with its generator
diegonehab May 26, 2026
734b0ab
chore: parameterize Docker base images and carry run-as-host entrypoint
diegonehab May 28, 2026
ba6520d
feat: dump proofs as Lua tables or schema-validated JSON
diegonehab May 28, 2026
2e568dc
fix: add optional schema argument to cartesi.fromjson
diegonehab May 29, 2026
2ef11d2
docs: rework proof sections, render bitfields, document sha256
diegonehab May 28, 2026
0bbb50c
docs: simplify proof helpers and fix README correctness/consistency i…
diegonehab May 29, 2026
c688bc1
docs: make rootfs-docs.ext2 and the generated README reproducible
diegonehab May 29, 2026
ee5fe90
feat: let cartesi.tojson/fromjson take a user schema dictionary
diegonehab May 30, 2026
a0c657e
fix: resolve tojson/fromjson schema aliases to compound types
diegonehab Jun 1, 2026
cc15d4d
docs: add verification game implementation
diegonehab Jun 1, 2026
b2aaf50
docs: add verification game walkthrough and proof examples
diegonehab Jun 2, 2026
69c3e18
docs: restructure the verification game walkthrough
diegonehab Jun 2, 2026
ea73331
docs: add formatting/checking of code snippets
diegonehab Jun 2, 2026
d573f1b
feat: place auto-detected drives past RAM, aligned to their length
diegonehab Jun 8, 2026
115466b
feat: accept drive labels in proof CLI options
diegonehab Jun 8, 2026
0b28d6a
docs: track drive auto-placement and proof label options
diegonehab Jun 8, 2026
880532c
docs: convert HTML tables to Markdown, drop bitfield renderer
diegonehab Jun 9, 2026
0ce1982
docs: track rootfs-docs.ext2 in git-lfs and verify it in CI
diegonehab Jun 9, 2026
95ee27c
docs: pin apt snapshot via native --snapshot flag
diegonehab Jun 9, 2026
af715c5
feat: record revert root hash in send_cmio_response
diegonehab Jun 10, 2026
545def7
feat: revert to revert root hash when verifying rejected inputs
diegonehab Jun 10, 2026
64a2ab2
feat: substitute revert root hash when collecting hashes over rejecte…
diegonehab Jun 11, 2026
9d54e9b
docs: add license report for rootfs-docs.ext2
diegonehab Jun 12, 2026
3873596
feat: no-op advance-state responses without an rx-accepted manual yield
diegonehab Jun 12, 2026
374f152
ci: lock dependency resolution when installing rzup
diegonehab Jun 12, 2026
d07e2fa
feat: turn send_cmio_response failures into no-ops in log and verify
diegonehab Jun 12, 2026
240bc38
fix: align uarch accesses instead of rejecting misaligned ones
diegonehab Jun 13, 2026
bc58d10
test: add reset-uarch-accepted json log fixture
diegonehab Jun 15, 2026
236e38a
fix: make rootfs-docs license report reproducible
diegonehab Jun 15, 2026
978ed5a
refactor: rewrite cartesi-machine CLI option parsing
diegonehab Jun 16, 2026
9000286
refactor: assemble cartesi-machine CLI config in a single table
diegonehab Jun 17, 2026
a2ced62
feat: emit per-output proofs from --cmio-advance-state
diegonehab Jun 18, 2026
0bf9678
docs: document output-proofs feature and fix proof-module excerpts
diegonehab Jun 18, 2026
2b6d7a6
feat: default output proofs to Lua format and add format sub-option
diegonehab Jun 19, 2026
560be15
docs: restructure rollups walkthrough around the calculator example
diegonehab Jun 21, 2026
b94131e
fix: stamp docgen stream markers with an end-of-run mtime
diegonehab Jun 21, 2026
9657b8a
test: keep the output-proof format spec off the working directory
diegonehab Jun 21, 2026
6ccc882
feat: prove the output hashes root hash sits in the accepting state
diegonehab Jun 21, 2026
4fb7f81
feat: let --initial-hash and --final-hash write the hash to a file
diegonehab Jun 21, 2026
9bf8648
docs: document and verify output proofs
diegonehab Jun 21, 2026
d62b189
docs: split Merkle tree operations and harden verification-game ordering
diegonehab Jun 22, 2026
e7044f3
docs: illustrate the outputs tree with a frontier diagram
diegonehab Jun 23, 2026
0a958cf
feat: report per-range attributes from get_address_ranges
diegonehab Jun 23, 2026
ad3d8b9
docs: illustrate the state and outputs Merkle trees
diegonehab Jun 24, 2026
7e2dcf2
fix: stabilize rootfs-docs license source URIs
diegonehab Jun 25, 2026
09d1489
refactor: remove mark_dirty_page from the uarch and state-access inte…
diegonehab Jun 25, 2026
ac15391
docs: clarify the output hashes tree section and unify terminology
diegonehab Jun 26, 2026
ebab1f8
fix: rename --dump-address-ranges back to --dump-memory-ranges
diegonehab Jun 26, 2026
83e7187
docs: update the change log
diegonehab Jun 26, 2026
f2b493e
refactor: receive const_machine_hash_view in the machine verify API
diegonehab Jun 26, 2026
b1988c5
test: feed htif-console input through runtime buffer instead of host …
diegonehab Jun 26, 2026
835fc96
fix: mark write TLB dirty pages before overwriting shadow state
diegonehab Jun 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
**/*.deb

build
tests/build
tests/fuzz/corpus
tests/fuzz/corpus-config
tests/fuzz/seed-corpus
third-party/downloads
third-party/riscv-arch-test/riscv-test-stats
src/cartesi-jsonrpc-machine
src/cartesi-hash-tree-hash

doc/html
doc/api.md
doc/html/
doc/xml/
doc/

.git
.github
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
third-party/** linguist-vendored
tests/** linguist-vendored
doc/recipes/rootfs-docs.ext2 filter=lfs diff=lfs merge=lfs -text
96 changes: 94 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,101 @@ jobs:
run: |
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:sanitizer make sanitize=yes test-save-and-load test-machine test-lua test-jsonrpc test-c-api test-c-api-remote test-c-jsonrpc-api test-coverage-machine test-uarch-rv64ui test-uarch-interpreter test-coverage-uarch

docs:
name: Docs
needs: build
runs-on: ubuntu-latest-8-cores
steps:
- name: Checkout machine emulator source code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
lfs: true

- name: Setup variables
run: echo MACHINE_EMULATOR_VERSION=`make version` >> $GITHUB_ENV

- name: Install e2tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends e2tools

- name: Check rootfs-docs.ext2 is up to date
run: make -C doc check-rootfs-docs

- name: Ensure doc/recipes/rootfs-docs.licenses.md is tracked
run: |
if ! git ls-files --error-unmatch doc/recipes/rootfs-docs.licenses.md >/dev/null 2>&1; then
echo "::error::doc/recipes/rootfs-docs.licenses.md is not tracked in git. The sync check requires a committed baseline to diff against. Generate it with 'make -C doc build-rootfs-docs-license' and commit the result."
exit 1
fi

- name: Build rootfs-docs license report
run: make -C doc build-rootfs-docs-license

- name: Check rootfs-docs.licenses.md matches committed version
run: |
if git diff --quiet doc/recipes/rootfs-docs.licenses.md; then
exit 0
fi
git --no-pager diff doc/recipes/rootfs-docs.licenses.md
echo "::error::doc/recipes/rootfs-docs.licenses.md is out of sync with the generator. The diff above is what 'make -C doc build-rootfs-docs-license' produces vs the committed file. Check if changes were intended and, if so, regenerate locally and commit the result."
exit 1

- name: Login to Docker Hub
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Depot CLI
uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1

- name: Build machine-emulator docker image
uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0
with:
file: Dockerfile
context: .
platforms: linux/amd64
tags: cartesi/machine-emulator:devel
push: false
load: true
build-args: |
DEBUG=${{ (startsWith(github.ref, 'refs/tags/v') && 'no' || 'yes') }}
GIT_COMMIT=${GITHUB_SHA}
MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }}
project: ${{ vars.DEPOT_PROJECT }}
token: ${{ secrets.DEPOT_TOKEN }}

- name: Ensure doc/README.md is tracked
run: |
if ! git ls-files --error-unmatch doc/README.md >/dev/null 2>&1; then
echo "::error::doc/README.md is not tracked in git. The sync check requires a committed baseline to diff against. Generate it with 'make -C doc README.md' and commit the result."
exit 1
fi

- name: Build documentation
run: make -C doc README.md

- name: Check README.md matches committed version
run: |
if git diff --quiet doc/README.md; then
exit 0
fi
git --no-pager diff doc/README.md
echo "::error::doc/README.md is out of sync with the generator. The diff above is what 'make -C doc README.md' produces vs the committed file. Check if changes were intended and, if so, regenerate locally and commit the result."
exit 1

publish_artifacts:
name: Publish artifacts
needs: [build, lint, coverage, sanitize, test_amd64, test_arm64, risc0]
needs: [build, lint, coverage, sanitize, test_amd64, test_arm64, risc0, docs]
runs-on: ubuntu-latest
steps:
- name: Checkout emulator source code
Expand Down Expand Up @@ -862,7 +954,7 @@ jobs:

- name: Install rzup
run: |
cargo install --git https://github.com/risc0/risc0 rzup
cargo install --locked --git https://github.com/risc0/risc0 rzup
rzup install cargo-risczero 3.0.5
rzup install r0vm 3.0.5
rzup install cpp 2024.1.5
Expand Down
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ src/cartesi-jsonrpc-machine
src/cartesi-hash-tree-hash
src/tests/test-machine-c-api

doc/html
doc/api.md
doc/html/
doc/xml/
doc/doxygen/html
doc/recipes/cache

.clangd
.venv
Expand Down
43 changes: 37 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,63 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
## Added
- Added `--nvram` command line option and `nvram_configs` machine configuration for UIO-backed memory ranges, exposed to the guest via `generic-uio`
- Added `label` field to flash drive and nvram configurations, propagated to the guest through DTB properties
- Added optional directory argument to `--dump-memory-ranges` to support read-only install locations
- Added a user manual under `doc/`, generated from a template by a docgen pipeline that executes and verifies every code snippet against the locally built emulator
- Added `--nvram` command line option and `nvram` machine configuration for UIO-backed memory ranges, exposed to the guest as `/dev/uio*` via `generic-uio`
- Added a `label` field to memory range configurations, exposed to the guest through a standard DTB `/aliases` node (`flashdriveN`, `nvramN`, and any user label)
- Added recording of a revert root hash as a logged input of `send_cmio_response`, with `read_revert_root_hash`/`write_revert_root_hash` accessors across all API layers
- Added reversion to the recorded revert root hash for rollup inputs that end rejected, when logging steps, logging uarch resets, verifying, and collecting root hashes
- Added emission of per-output proofs from `--cmio-advance-state`
- Added an optional user schema dictionary argument to `cartesi.tojson`/`cartesi.fromjson` to name binary and compound fields of caller-defined message types
- Added a `cartesi.hash-tree` Lua module for hash-tree slice/splice verification and building the output-hashes frontier behind the output proofs
- Added `get_address_name` to resolve a physical address to a descriptive name, across the C, Lua, and JSON-RPC APIs
- Added the ability for `--initial-hash` and `--final-hash` to write the hash to a file
- Added an optional directory argument to `--dump-memory-ranges` to support read-only install locations
- Added decoding of RISC-V Zcb compressed instructions (required by kernels built with GCC 14)
- Added fallback to `read_reg` in the GDB stub so `monitor reg <name>` works for any named register
- Added `CM_FLASH_DRIVE_MAX`, `CM_NVRAM_MAX`, and `CM_MEMORY_RANGE_LABEL_MAX` constants to the public C API
- Added `--bash-completion` to print a bash completion script for `cartesi-machine`
- Added public C API constants `CM_FLASH_DRIVE_MAX`, `CM_NVRAM_MAX`, `CM_MEMORY_RANGE_LABEL_MAX`, `CM_RTC_FREQ_DIV`, and `CM_CMIO_LOG2_MAX_OUTPUT_COUNT`
- Added the peripheral `CM_AR_*` address range constants, the `CM_PMA_*_DID` driver id constants, the HTIF device, command, shift, and mask constants, and the `CM_DTB_BOOTARGS_*` macros to the public C API
- Added LuaCov-based coverage tracking for Lua code, integrated with the gcov report pipeline
- Added a JSON-RPC C API coverage suite and converted `test-cm-cli` and `test-evmu` to the lester spec format
- Added `spec-cm-cli.lua` covering every command-line option of `cartesi-machine.lua`

## Fixed
- Fixed leaf size in `cartesi-hash-tree-hash`, which was 8 instead of 32
- Fixed read-only flash drives not being mounted with `-o ro`, which trapped guest writes and panicked init
- Fixed missing `#address-cells` on the per-CPU `interrupt-controller` node in the DTB, silencing a `dtc` interrupt-provider lint warning
- Fixed firmware reserved region in the DTB being too small for OpenSBI built with GCC 14
- Fixed missing validation of memory range labels and of `replace_memory_range` arguments
- Fixed boolean merging in `merge_memory_range_opts` so options can be explicitly overridden to `false`
- Fixed `--no-root-flash-drive` bootargs substitution pattern
- Fixed `dump_pmas()` still calling the removed `get_memory_ranges()` method
- Fixed unanchored patterns matching `--quiet` and `--assert-rolling-template`
- Fixed `help()` internally calling `os.exit()`
- Fixed a typo in the `cartesi-machine.lua` cmio handling

## Changed
- Renamed `--dump-memory-ranges` to `--dump-address-ranges` for consistency with `get_address_ranges()`
- Renamed the yield constants in `cm.h` and the Lua API from `CM_CMIO_YIELD_*` to `CM_HTIF_YIELD_*` (and the command suffix from `COMMAND` to `CMD`)
- Renamed the PMA "device id" to "driver id" across the public API (`CM_PMA_*_DID` constants, `driver_id` in `get_address_ranges`)
- Changed `get_address_ranges` to report per-range attributes (`is_memory`, `is_device`, `is_readable`, `is_writeable`, `is_executable`, `is_read_idempotent`, `is_write_idempotent`, and `driver_id`)
- Replaced the `--store-json-config`/`--load-json-config` options with a `format:<lua|json>` sub-option on `--store-config`/`--load-config`, defaulting to the format inferred from the filename extension
- Changed `--initial-proof`/`--final-proof` to default to Lua tables and accept `format:<lua|json>` and `label:` sub-options, where before they were dumped only as JSON
- Reworked command-line option parsing so compound options such as `--volume` and `--port-forward` take `key:value` sub-options, and short options take a space-separated value (`-u <name>` instead of `-u=<name>`)
- Changed memory ranges with an unset start to be placed past the end of RAM, rounded up to a power of two and aligned to their length, with flash drives and nvrams drawn from a shared pool
- Changed `log_send_cmio_response` and `verify_send_cmio_response` to treat invalid responses and advance-state responses delivered outside an rx-accepted manual yield as no-ops, while the live `send_cmio_response` still rejects them as errors
- Changed the uarch state-access layer to align misaligned accesses down to their natural size instead of rejecting them
- Changed JSON-RPC error logs to omit the Boost `source_location` suffix at non-debug levels
- Renamed all C++ headers from `.h` to `.hpp`, and renamed `machine-c-api.{h,cpp}` to `cm.{h,cpp}`
- Bumped machine configuration archive version from 6 to 7 (for the new `nvram_configs` and `label` fields)
- Bumped machine configuration archive version from 6 to 7 (for the new `nvram` and `label` fields)
- Moved the `/run/cartesi/memoryranges/` sysfs setup from the DTB init script into `cartesi-init`
- Updated guest bootargs to bind `uio_pdrv_genirq` to generic-uio nodes
- Bumped test `linux.bin` and `rootfs.ext2` images

## Removed
- Removed the `--store-json-config` and `--load-json-config` options (folded into the `format:` sub-option of `--store-config`/`--load-config`)
- Removed the `--replace-flash-drive` option, subsumed by `--replace-memory-range`
- Removed `CM_ERROR_REGEX_ERROR` (covered by `CM_ERROR_RUNTIME_ERROR`) and `CM_ERROR_SYSTEM_ERROR`, and renumbered the error enum
- Removed `machine_reg_get_name` in favor of `get_address_name`
- Removed `mark_dirty_page` from the uarch and state-access interfaces

## [0.20.0] - 2026-04-09
## Added
- Added RISC0 zkVM integration for fraud proof verification, with C++, Rust, and Solidity implementations
Expand Down
18 changes: 15 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM debian:trixie-20250811 AS toolchain
ARG BUILD_BASE=debian:trixie-20250811
ARG RUNTIME_BASE=debian:trixie-20250811-slim

FROM $BUILD_BASE AS toolchain

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
Expand Down Expand Up @@ -56,15 +59,24 @@ FROM builder AS debian-packager
RUN make install-uarch debian-package DESTDIR=$PWD/_install

####################################################################################################
FROM debian:trixie-20250811-slim
FROM $RUNTIME_BASE
ARG TARGETARCH
ARG RUNTIME_BASE
LABEL io.cartesi.machine-emulator.base-image="$RUNTIME_BASE"

COPY --from=debian-packager /usr/src/emulator/machine-emulator_${TARGETARCH}.deb machine-emulator.deb
COPY tests/dependencies tests/dependencies.sha256 /usr/share/cartesi-machine/

RUN apt-get update && \
apt-get install -y ./machine-emulator.deb && \
apt-get install -y gosu ./machine-emulator.deb && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* machine-emulator.deb

# Carried but dormant (no ENTRYPOINT set here, so production behavior is
# unchanged): lets a derived dev image (e.g. doc/) opt into running as the host
# user by pointing ENTRYPOINT at this script. Needs gosu, installed above.
COPY tools/docker-entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

RUN groupadd --system --gid 102 cartesi && \
useradd --system --uid 102 --gid 102 --no-create-home --home /nonexistent --comment "cartesi user" --shell /bin/false cartesi

Expand Down
23 changes: 16 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ EMU_TO_BIN= src/cartesi-jsonrpc-machine src/cartesi-hash-tree-hash
EMU_TO_LIB= src/$(LIBCARTESI_SO) src/$(LIBCARTESI_SO_JSONRPC)
EMU_TO_LIB_A= src/libcartesi.a src/libcartesi_jsonrpc.a src/libluacartesi.a src/libluacartesi_jsonrpc.a
EMU_LUA_TO_BIN= src/cartesi-machine.lua src/cartesi-machine-stored-hash.lua
EMU_TO_LUA_PATH= src/cartesi/util.lua src/cartesi/gdbstub.lua src/cartesi/evmu.lua
EMU_TO_LUA_PATH= src/cartesi/util.lua src/cartesi/gdbstub.lua src/cartesi/evmu.lua src/cartesi/bash.lua src/cartesi/hash-tree.lua
EMU_TO_LUA_THIRD_PARTY_PATH= src/cartesi/third-party/bint.lua
EMU_TO_LUA_CPATH= src/cartesi.so
EMU_TO_LUA_CARTESI_CPATH= src/cartesi/jsonrpc.so
Expand Down Expand Up @@ -105,6 +105,12 @@ export UARCH_DEFS
TAG ?= devel
DEBIAN_IMG ?= cartesi/machine-emulator:$(TAG).deb

# Base images for the emulator Dockerfile. Single source of truth: passed as
# build-args and stamped into the image as a label so downstream images (e.g.
# doc/) can reuse the exact same base without duplicating these values.
BUILD_BASE ?= debian:trixie-20250811
RUNTIME_BASE ?= debian:trixie-20250811-slim

# Docker image platform
BUILD_PLATFORM ?=

Expand Down Expand Up @@ -247,11 +253,14 @@ test% coverage% build-tests%:

build-tests-misc-with-builder-image: build-emulator-builder-image

lint check-format format check-format-lua check-lua format-lua:
lint check-format format:
@$(MAKE) $@-src $@-tests

check-format-lua check-lua format-lua:
@$(MAKE) $@-src $@-tests $@-doc

lint-% check-format-% format-% check-format-lua-% check-lua-% format-lua-%:
@eval $$($(MAKE) -s --no-print-directory env); $(MAKE) -C $(if $(findstring -src,$@),src,tests) $(subst -src,,$(subst -tests,,$@))
@eval $$($(MAKE) -s --no-print-directory env); $(MAKE) -C $(if $(findstring -doc,$@),doc,$(if $(findstring -src,$@),src,tests)) $(subst -doc,,$(subst -src,,$(subst -tests,,$@)))

source-default:
@eval $$($(MAKE) -s --no-print-directory env); $(MAKE) -C $(SRCDIR)
Expand All @@ -269,13 +278,13 @@ $(SRCDIR)/interpret-jump-table.hpp:
@eval $$($(MAKE) -s --no-print-directory env); $(MAKE) -C $(SRCDIR) interpret-jump-table.hpp

build-emulator-builder-image:
docker build $(DOCKER_PLATFORM) --build-arg DEBUG=$(debug) --build-arg COVERAGE=$(coverage) --build-arg THREADS=$(threads) --build-arg SANITIZE=$(sanitize) --target builder -t cartesi/machine-emulator:builder -f Dockerfile .
docker build $(DOCKER_PLATFORM) --build-arg DEBUG=$(debug) --build-arg COVERAGE=$(coverage) --build-arg THREADS=$(threads) --build-arg SANITIZE=$(sanitize) --build-arg BUILD_BASE=$(BUILD_BASE) --target builder -t cartesi/machine-emulator:builder -f Dockerfile .

build-emulator-toolchain-image build-toolchain:
docker build $(DOCKER_PLATFORM) --target toolchain -t cartesi/machine-emulator:toolchain -f Dockerfile .
docker build $(DOCKER_PLATFORM) --build-arg BUILD_BASE=$(BUILD_BASE) --target toolchain -t cartesi/machine-emulator:toolchain -f Dockerfile .

build-emulator-image:
docker build $(DOCKER_PLATFORM) --build-arg DEBUG=$(debug) --build-arg COVERAGE=$(coverage) --build-arg THREADS=$(threads) --build-arg SANITIZE=$(sanitize) -t cartesi/machine-emulator:$(TAG) -f Dockerfile .
docker build $(DOCKER_PLATFORM) --build-arg DEBUG=$(debug) --build-arg COVERAGE=$(coverage) --build-arg THREADS=$(threads) --build-arg SANITIZE=$(sanitize) --build-arg BUILD_BASE=$(BUILD_BASE) --build-arg RUNTIME_BASE=$(RUNTIME_BASE) -t cartesi/machine-emulator:$(TAG) -f Dockerfile .

build-emulator-tests-image: build-emulator-builder-image build-emulator-image
docker build $(DOCKER_PLATFORM) --build-arg DEBUG=$(debug) --build-arg COVERAGE=$(coverage) --build-arg THREADS=$(threads) --build-arg SANITIZE=$(sanitize) --build-arg TAG=$(TAG) -t cartesi/machine-emulator:tests -f tests/Dockerfile .
Expand All @@ -284,7 +293,7 @@ build-emulator-tests-builder-image: build-emulator-builder-image
docker build $(DOCKER_PLATFORM) --target tests-builder --build-arg DEBUG=$(debug) --build-arg COVERAGE=$(coverage) --build-arg THREADS=$(threads) --build-arg SANITIZE=$(sanitize) --build-arg TAG=$(TAG) -t cartesi/machine-emulator:tests-builder -f tests/Dockerfile .

build-debian-package:
docker build $(DOCKER_PLATFORM) --target debian-packager --build-arg DEBUG=$(debug) --build-arg COVERAGE=$(coverage) --build-arg THREADS=$(threads) --build-arg SANITIZE=$(sanitize) -t $(DEBIAN_IMG) -f Dockerfile .
docker build $(DOCKER_PLATFORM) --target debian-packager --build-arg DEBUG=$(debug) --build-arg COVERAGE=$(coverage) --build-arg THREADS=$(threads) --build-arg SANITIZE=$(sanitize) --build-arg BUILD_BASE=$(BUILD_BASE) -t $(DEBIAN_IMG) -f Dockerfile .

build-tests-debian-packages: build-emulator-builder-image
docker build $(DOCKER_PLATFORM) --target tests-debian-packager --build-arg TAG=$(TAG) -t cartesi/machine-emulator:tests-debian-packager -f tests/Dockerfile .
Expand Down
6 changes: 6 additions & 0 deletions doc/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Makefile
README.md.template
doxygen
recipes/cache
recipes/*.ext2
!recipes/rootfs-docs.ext2
2 changes: 2 additions & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
recipes/rootfs-docs.inputs.sha256
recipes/rootfs-docs.inputs.sha256-have
16 changes: 16 additions & 0 deletions doc/.luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- alerts.lua and replace.lua are pandoc Lua filters: pandoc runs them inside
-- its own interpreter, which injects the `pandoc` module along with the
-- FORMAT and PANDOC_SCRIPT_FILE globals, and invokes the filter callbacks
-- (Div, Pandoc) that the filter defines at the top level. Declare that
-- environment so luacheck does not report the pandoc API as undefined or
-- non-standard globals.
--
-- The recipe scripts under recipes/ are ordinary lua5.4 programs and are left
-- under luacheck's default configuration, so genuine stray globals there are
-- still caught.
local pandoc_filter = {
read_globals = { "FORMAT", "PANDOC_SCRIPT_FILE", "pandoc" },
globals = { "Div", "Pandoc" },
}
files["alerts.lua"] = pandoc_filter
files["replace.lua"] = pandoc_filter
Loading
Loading