Skip to content

feature(emulator): bump emulator (v0.21.0), rootfs (v0.18.0), linux (6.5.13-ctsi-2-uio-test1-v0.21.0)#791

Open
mpolitzer wants to merge 2 commits into
next/2.0from
feature/bump-emulator-v0.21.0
Open

feature(emulator): bump emulator (v0.21.0), rootfs (v0.18.0), linux (6.5.13-ctsi-2-uio-test1-v0.21.0)#791
mpolitzer wants to merge 2 commits into
next/2.0from
feature/bump-emulator-v0.21.0

Conversation

@mpolitzer

@mpolitzer mpolitzer commented Jul 20, 2026

Copy link
Copy Markdown

Changes:

  • header files got renamed
  • defines renamed: CM_CMIO_* -> CM_HTIF_*; UARCH_HALT_FLAG -> UARCH_HALT
  • SendCmioResponse got a new parameter: revertRootHash. Checkpoint is now done "automatically" from it.
  • A decision needs to be made on pkg/machine/implementation.go:348 about where revertRootHash value will come from. Currently done via a call to GetRootHash right there.
  • Need final versions of dependencies: emulator, rootfs and linux.

bumps:

  • machine-emulator: 0.21.0
  • machine-guest-tools: 0.18.0
  • linux: 6.5.13-ctsi-2-uio-test1-v0.21.0

@mpolitzer mpolitzer self-assigned this Jul 20, 2026
@mpolitzer
mpolitzer force-pushed the feature/bump-emulator-v0.21.0 branch 8 times, most recently from 6f9e2f3 to 3e8ec67 Compare July 22, 2026 13:03
@mpolitzer mpolitzer changed the title (WIP) feature(emulator): bump emulator (v0.21.0) and rootfs (v0.18.0) feature(emulator): bump emulator (v0.21.0), rootfs (v0.18.0), linux (6.5.13-ctsi-2-uio-test1-v0.21.0) Jul 23, 2026
@mpolitzer
mpolitzer marked this pull request as ready for review July 23, 2026 17:40
@mpolitzer
mpolitzer requested a review from vfusco July 23, 2026 17:40
@vfusco
vfusco requested a review from Copilot July 24, 2026 10:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the rollups-node integration to newer Cartesi machine components (emulator/rootfs/linux) and adapts the Go/Lua tooling and machine abstractions to upstream API changes (renamed headers/defines, new CMIO response contract, and updated hash-collection entrypoints).

Changes:

  • Bump emulator/rootfs/linux dependency pins (Dockerfile + test download helpers + packaging constraints).
  • Update emulator CGo bindings and machine backend interfaces for renamed HTIF/CMIO constants and the new SendCmioResponse(revertRootHash, ...) API.
  • Remove explicit checkpoint-hash writing and adjust replay/proof tooling for renamed flags and base64/hex hash formats.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
test/dependencies.sha256 Updates SHA256s for test kernel/rootfs downloads.
test/dependencies Updates test dependency download URLs (kernel/rootfs).
pkg/machine/machine.go Removes WriteCheckpointHash from the Machine interface.
pkg/machine/machine_test.go Updates mock machine to reflect interface removal.
pkg/machine/libcartesi.go Adapts libcartesi backend for new CMIO response signature and adds new root-hash collection path.
pkg/machine/libcartesi_test.go Updates mocks/tests for new libcartesi interface methods and signatures.
pkg/machine/implementation.go Uses GetRootHash and passes revertRootHash into SendCmioResponse; removes checkpoint write method.
pkg/machine/implementation_test.go Updates tests to mock GetRootHash + new SendCmioResponse signature; removes checkpoint-hash tests.
pkg/machine/backend.go Updates Backend interface SendCmioResponse signature.
pkg/machine/backend_test.go Updates backend mock helpers to include GetRootHash + new SendCmioResponse signature.
pkg/emulator/types.go Switches to new headers and renames CMIO constants to HTIF equivalents.
pkg/emulator/remote.go Switches JSON-RPC header include to new name.
pkg/emulator/machine.go Switches core emulator header include, updates C bindings for new APIs and CMIO response signature.
pkg/emulator/emulator.go Switches JSON-RPC header include to new name.
Makefile Updates test dependency download target to include rootfs and new kernel artifact name.
internal/manager/instance.go Removes pre-processing checkpoint write before advance.
internal/manager/instance_test.go Removes checkpoint-write error path tests and mock fields.
Dockerfile Bumps emulator version used in build image and updates SHA256s.
control.template Updates required emulator version range for the Debian package.
cmd/cartesi-rollups-machine-tool/replay_dave.lua Updates Dave replay script to new CMIO API and HTIF constants.
cmd/cartesi-rollups-machine-tool/main.go Renames flags and converts proof hashes from base64 to hex.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/machine/libcartesi.go
Comment on lines +268 to +274

// v0.21 API expects log2(mcycle_period) instead of the raw period value
// Use exact integer arithmetic: for powers of 2, log2 = position of highest set bit
log2Period := uint64(bits.Len64(state.Period) - 1)
if (1 << log2Period != state.Period) {
return Failed, fmt.Errorf("period must be a power of 2, got %v.", state.Period)
}
Comment thread pkg/machine/libcartesi.go
Comment on lines +276 to +279
rawResult, err := e.inner.CollectMCycleRootHashes(mcycleEnd, log2Period, state.Phase, state.BundleLog2, "")
if err != nil {
return Failed, err
}
Comment thread pkg/machine/libcartesi.go
Comment on lines +287 to +305
err = json.Unmarshal(rawResult, &result)
if err != nil {
return Failed, errors.New("failed to unmarshal CollectMCycleRootHashes result")
}

// convert from base64
for i, base64Hash := range result.RootHashes {
rawHash, err := base64.StdEncoding.DecodeString(base64Hash)
if err != nil {
return Failed, err
}
if len(rawHash) != HashSize {
return Failed, fmt.Errorf("received an invalid hash during RunAndCollectRootHashes at index %v, with value: %v.", i, base64Hash)
}
state.Hashes = append(state.Hashes, (Hash)(rawHash))

}
return decodeBreakReason(result.BreakReason), nil
}
Comment thread pkg/machine/libcartesi.go
Comment on lines +259 to +261
return e.RunAndCollectRootHashesNew(mcycleEnd, state, timeout)
//return e.RunAndCollectRootHashesOld(mcycleEnd, state, timeout)
}
Comment on lines +500 to +506
func base64ToHex(s string) (string, error) {
raw, err := base64.StdEncoding.DecodeString(s)
if err != nil {
return "", fmt.Errorf("expected %s to be a hash in base64. %w", s, err)
}
return common.Hash(raw).Hex(), nil
}
Comment thread Dockerfile
# syntax=docker.io/docker/dockerfile:1

ARG EMULATOR_VERSION=0.20.0
ARG EMULATOR_VERSION=0.21.0-test6
Comment thread test/dependencies
Comment on lines +1 to +2
https://github.com/cartesi/image-kernel/releases/download/v0.21.0-test1/linux-6.5.13-ctsi-2-uio-test1-v0.21.0.bin
https://github.com/cartesi/machine-guest-tools/releases/download/v0.18.0-test7/rootfs-tools.ext2
Comment thread Makefile
@shasum -ca 256 test/dependencies.sha256
@cd $(DOWNLOADS_DIR) && ln -s rootfs-tools.ext2 rootfs.ext2
@cd $(DOWNLOADS_DIR) && ln -s linux-6.5.13-ctsi-1-v0.20.0.bin linux.bin
@cd $(DOWNLOADS_DIR) && ln -s linux-6.5.13-ctsi-2-uio-test1-v0.21.0.bin linux.bin
Comment thread pkg/emulator/machine.go Outdated
@mpolitzer
mpolitzer force-pushed the feature/bump-emulator-v0.21.0 branch from 927f913 to 69822b4 Compare July 24, 2026 14:54
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