Skip to content

feat: rework root#317

Open
kp2pml30 wants to merge 124 commits into
v0.3-devfrom
feat/rework-root
Open

feat: rework root#317
kp2pml30 wants to merge 124 commits into
v0.3-devfrom
feat/rework-root

Conversation

@kp2pml30

Copy link
Copy Markdown
Member

No description provided.

@kp2pml30 kp2pml30 self-assigned this Jun 25, 2026
@github-actions github-actions Bot changed the base branch from main to v0.3-dev June 25, 2026 12:52
@github-actions

Copy link
Copy Markdown
Contributor

👋 This PR targeted main, so I've retargeted it to the latest dev branch v0.3-dev.

main is protected and is only an alias of the latest release branch (v0.3.x), kept in lockstep automatically. Active v0.3 work lands on v0.3-dev, which reaches v0.3.x through the standing release-gate PR once the cross-repo E2E matrix is green.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ecb64f7c-f36e-4ceb-ad6d-16d44f32ae7b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rework-root

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

kp2pml30 added 25 commits June 25, 2026 22:36
kp2pml30 added 20 commits June 25, 2026 22:36
GetTimestamp returns the transaction timestamp in deterministic mode and the real wall-clock time in non-deterministic mode; Yield is a reserved no-op for future waiting loops.
A deploying contract's code was cached under the same `chain:<addr>:a:<slot>`
canonical key a `:a` (accepted) chain runner read resolves to, so a
self-`CallContract` during `__init__` saw its own uncommitted code instead of
erroring.

Introduce `runners::ChainState` (Accepted | Finalized | Deploy) in place of
`StorageType` in the runner `Id`. `Deploy` is never parsed from a runner id; the
deploy VM resolves its own runner to it, and the archive is pre-populated into
the runner cache at deploy time. A self/`:a` read of a contract mid-deploy now
misses the cache, falls through to the (empty) host state, and fails with
`invalid_contract`.
…g ♻️

Replace `Config.code_slot` with `Config.topmost_runner_id: runners::Id` so a VM
carries the fully-resolved id of the runner it loads, not just a slot. Split
`resolve_runner` into `resolve_runner_id` (str -> Id) plus a `Resolved` wrapper;
`load_runner`/`map_runner_file` now take an already-resolved id. `Id` gains
`Clone`/`Serialize`/`Encode`.

Check the contract major *before* trusting the host-read code-slot pointer: add
`Storage::check_major_and_resolve_code_slot`, used by both the top-level call
and `CallContract`. A VMError raised while preparing the top-level contract (bad
code, major mismatch, missing slot) is now surfaced as a VMError result via
`FullResult::empty_from` instead of bubbling up as an internal error.

Add a test for running a registered custom runner inside a sandbox. It is
test-first: the sandbox `runner` parameter that drives it is not wired yet, so
it stays red until that lands.
Add a mandatory `runner` field to the `Sandbox` gl_call. The sandbox VM now
resolves it relative to the caller and loads it as its `topmost_runner_id`
instead of always reusing the contract's own code: `contract` (the python
default) keeps the current behavior, while a `custom:<hash>`/`name:hash`/`chain:`
id runs that runner instead. Python `spawn_sandbox(runner=...)` defaults to
`contract`.

The integration test registers a custom runner and runs it inside a sandbox: the
runner maps its own code to /contract.py, prints a marker proving it ran, then
execs the bootloader to handle the sandbox entry (which returns the lambda's
result).
balance/balance_eth did a self-`CallContract` (`get_at(self).view().nested()`)
in `__init__`, which now correctly fails: a contract's code is not visible as an
on-chain runner mid-deploy. Move the body into a `main()` write method (empty
`__init__`) and turn both cases into deploy-then-call, so the self-view runs once
the code is committed.
Replace the single major_mismatch case with a major-mismatch/ subdir that
exercises every place a stale contract major is read:

- top_level: a top-level call to a contract whose stored major != node major
  (the run_with_impl code-slot resolution check)
- call: a CallContract into such a contract
- map_file: a `chain:` runner map_file pointing at such a contract (the get_arch
  chain-load check)

The target contract persists major=5 in its own storage during deploy, so no
host/manager lying is needed; the deploy succeeds and every later read of its
runner is rejected with `invalid_contract major_mismatch`.
Collapse the three per-entry-point jsonnets into a single major_mismatch.jsonnet
with three indexed entries (top-level call / CallContract / map_file), sharing
target.py and caller.py. `util.mapGraph` stamps `stable_hash: false` across every
step. Same coverage, far fewer files.
@kp2pml30

kp2pml30 commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

GenVM PR actions

Tick a box to run it (the box unticks itself when handled). Actions only run while the PR has the ci-safe label.

  • Force run full tests
  • Rerun full tests
  • Merge into dev

Full GenVM CI runs only when rtm or run-full-tests is set — "Force run full tests" is a sticky toggle for run-full-tests. Adding rtm marks the PR ready-to-merge and also runs full tests. Merge requires: rtm, green full tests, green E2E, and the branch 0 commits behind.

@kp2pml30

Copy link
Copy Markdown
Member Author

/run-e2e core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant