Skip to content

WIP: migrate flow to V4 interpreter + soldeer + reusable workflows#475

Draft
thedavidmeister wants to merge 12 commits into
mainfrom
2026-06-06-v4-soldeer-reusable
Draft

WIP: migrate flow to V4 interpreter + soldeer + reusable workflows#475
thedavidmeister wants to merge 12 commits into
mainfrom
2026-06-06-v4-soldeer-reusable

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

Draft / WIP — tracks #474. Do not merge.

Starts flow's migration onto the current rain stack. Committed so far: the soldeer de-submodule groundwork (foundry.toml [dependencies] + remappings replacing lib/ submodules).

Remaining (fully specified in #474, file-level):

  • Interpreter V2 → V4 (eval4): Flow.sol, LibFlow.sol, new IFlowV6 — store EvaluableV4{interpreter,store,bytecode}, drop the deployer/LibEncodedDispatch, stack uint256StackItem. Security semantics per upstream RaindexV6 (eval-time, no deploy-time integrity check).
  • Deterministic script/Deploy.sol + pointers; reusable rainix-sol / rainix-manual-sol-artifacts / rainix-copy-artifacts.
  • Test rewrite (~10 files).

CI here is the build-verify loop. Expect red until the V4 eval-path rewrite lands — the unchanged Flow.sol still references the now-removed LibEncodedDispatch.

Closes #474 when complete.

First step of the flow V2->V4 + soldeer + reusables migration tracked in #474.
Replaces lib/ submodules with soldeer [dependencies] (OZ 4.9.6, forge-std,
rain-factory/interpreter-interface/math-fixedpoint/solmem) + remappings-only
mapping of the existing import roots. The eval-path V4 rewrite (Flow.sol/LibFlow/
IFlowV6) + tests follow per #474; CI on the draft PR is the build-verify loop.

Refs #474
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1d2d974f-8120-4245-bd78-9fee221354e2

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 2026-06-06-v4-soldeer-reusable

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.

Flow.sol: EvaluableV2->EvaluableV4, eval2->eval4(EvalV4), drop deployer +
LibEncodedDispatch + io integrity check (eval-time validation per RaindexV6),
StackItem stack via assembly cast. New IFlowV6. LibFlow: store V2->V3, kvs
bytes32[]. Deprecated V2 interface imports across other flow interfaces
rewritten to their relocated deprecated/v1|v2 soldeer paths.

Build advancing past imports; remaining = transitive soldeer deps (rain-lib-hash
+ OZ 4.9.6/5.6.1 split where rain deps pull OZ5) + then test rewrite. Refs #474
Per 'track latest', flow targets OZ 5.6.1 (not 4.9.6) — aligns flow with the
rain deps that already pull OZ5. Requires flow's own OZ import paths + code to
move 4->5 (see #474). Adds rain-lib-hash/math-float/metadata/lib-typecast.
Refs #474
OZ 4->5 for flow: holders/ECDSA/ReentrancyGuard moved to the non-upgradeable
package (stateless, no __init); MulticallUpgradeable kept; @openzeppelin/contracts
bridge remap added. Clean soldeer reinstall (OZ 5.6.1 + rain-lib-hash/math-float).
Old flow interface EvaluableV2 imports repointed to deprecated/v1. src/ now builds;
remaining errors are all in test/ (the V4+OZ5 test rewrite). Refs #474
…reen

Rewrote the test harness to V4: InterpreterMockTest mocks eval4 (no deployer/
EncodedDispatch); FlowTest builds EvaluableV4{interpreter,store,bytecode} directly
with the evaluable bytecode derived from the expression so distinct flows hash
distinctly. Migrated all concrete tests: drop LibEncodedDispatch dispatch args,
uint256[]->StackItem[]/bytes32[] casts at flow()/stackToFlow() call sites, store
mocks IInterpreterStoreV2->V3, Context->ContextV2 event, OZ5 MessageHashUtils +
code.length (no Address.isContract). Multicall uses a sequential eval4 mock.
Dropped the obsolete deploy-time integrity-check construction tests (V4 validates
at eval time per RaindexV6). forge fmt applied. All suites pass locally. Refs #474
CI -> rainlanguage/rainix reusable rainix-sol (static/legal/test). Fix .gitignore
(dependencies/ + node_modules were not ignored due to a missing trailing newline)
and untrack the soldeer dependencies/ tree; add soldeer.lock + remappings.txt to
REUSE.toml. Local: slither 0 results, reuse 58/58 compliant, all tests pass.
Move the two-flow stack build + sequential eval4 mock into a helper to reduce
live locals in testFlowBasicMulticallFlows; nightly forge (no via-ir) hit stack
too deep on the inlined form.
…inistic Flow)

flow's deploy was vestigial (no Deploy.sol). Add deterministic Zoltu deploy of
the Flow implementation: script/Deploy.sol (DEPLOYMENT_SUITE=flow) +
BuildPointers.sol + committed src/generated/Flow.pointers.sol (idempotent).
foundry.toml gains rain-deploy/rain-sol-codegen, fs_permissions, rpc_endpoints +
etherscan. manual-sol-artifacts -> reusable rainix-manual-sol-artifacts;
git-clean -> reusable rainix-copy-artifacts. Flow deterministic address
0x502DcAb53948f43af1Fc3a63D14A47daC44C2992 (requires a deploy run to go live).
@thedavidmeister

Copy link
Copy Markdown
Contributor Author

🤖 ai:producer
Producer note: 3d QUEUED (next run) — this draft WIP (V4 interpreter + soldeer + reusable workflows, 56 files incl. submodule removals) went CONFLICTING against main. First merge-update attempt is planned for the next producer run: merge main in (never rebase), keep the union of tests, regenerate Flow.pointers.sol, build-verify before push. Deferred this run in favour of the fleet's smaller reds/conflicts.

Union resolution of the V4-interpreter migration branch against current main:
- Flow.sol: kept V6 semantics (EvaluableV4, no deploy-time integrity) with
  main's improved NatSpec adapted to the V6 surface; import set covers the
  BadMinStackLength guard main relocated into ErrFlow.
- Construction tests: ported main's initialize-overload/once-only tests to
  V6 forms (OZ5 InvalidInitialization custom error replaces the v4 string);
  the deployer-io guard tests cover a code path V4 removes and are retired
  with the in-file note.
- Reentrancy helpers + tests from main translated to V6 types; store helper
  matches IInterpreterStoreV3.set(StateNamespace, bytes32[]) so the guard
  path is actually exercised.
- signedContext/transfer/preview tests: main's bounded-key and renamed
  assertions kept, V6 types applied; IFlowV5.t.sol keeps main's V5
  re-export pins (V5 interface still ships on this branch).
- Flow.pointers.sol regenerated for the merged bytecode.

Co-Authored-By: Claude <noreply@anthropic.com>
@thedavidmeister

Copy link
Copy Markdown
Contributor Author

🤖 ai:producer
Producer note: 3d merge-update DONE (as queued last run) — merged origin/main into this branch (db227f9). Five files conflicted; resolution kept the V4-migration semantics and translated main's post-divergence additions into the V6 world: main's new initialize-overload/once-only construction tests ported (OZ5 InvalidInitialization replaces the v4 revert string), main's reentrancy helpers+tests retyped to EvaluableV4/bytes32 with the store helper matched to IInterpreterStoreV3.set so the guard path actually fires, bounded-key signed-context logic kept. The V5-era deployer-io guard tests (UnsupportedFlowInputs/InsufficientFlowOutputs) cover a code path V4 removes and are retired with an in-file note. Flow.pointers.sol regenerated. Local: forge build + full forge test green. PR should now show MERGEABLE.

@thedavidmeister

Copy link
Copy Markdown
Contributor Author

🤖 ai:producer
Producer note: 3d merge-update DONE — merged origin/main (6b2dc7e, PR #485 nix-cachix CI adoption) into this branch. One conflict: .github/workflows/manual-sol-artifacts.yaml — kept this PR's rainix reusable-workflow call (rainix-manual-sol-artifacts.yaml@main), which already opens with the same nix-cachix-setup composite main adopted inline, so main's newer CI shape is fully subsumed. No source/test/pointer changes were involved (merge tree-diff vs previous head is empty), so no Flow.pointers.sol regen needed. Local verify: forge soldeer install + full forge test green (55 passed, 0 failed), matching the pre-merge all-green CI baseline. Pushed cea9445; PR shows MERGEABLE.

…d.sol

The org-wide rainix copy-artifacts gate requires the codegen script for
committed src/generated/ sources to be exactly script/Build.sol; it runs
forge script ./script/Build.sol and then asserts the regenerated files
match the committed ones. Rename the existing pointers codegen script
(and its contract, matching the sibling rain.erc4626.words template) so
the gate finds and runs it. Regeneration reproduces the committed
src/generated/Flow.pointers.sol byte-for-byte.

Co-Authored-By: Claude <noreply@anthropic.com>
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.

Migrate flow to V4 interpreter (eval4) + soldeer + reusable workflows

1 participant