feat: rework root#317
Conversation
|
👋 This PR targeted
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
e7cc916 to
6bca73c
Compare
…ARGO_PKG_VERSION 🔧
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.
6bca73c to
bb04dc5
Compare
GenVM PR actionsTick a box to run it (the box unticks itself when handled). Actions only run while the PR has the
Full GenVM CI runs only when |
|
/run-e2e core |
No description provided.