Skip to content

Move the deployed contracts' logic into BaseRainlang* abstracts (#552 step 1) - #575

Merged
thedavidmeister merged 3 commits into
mainfrom
2026-09-06-base-rainlang-abstracts
Sep 7, 2026
Merged

thedavidmeister merged 3 commits into
mainfrom
2026-09-06-base-rainlang-abstracts

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

First step of the library / deploy split (#552, rainix#296): the logic of the five deployed contracts moves into src/abstract/BaseRainlang{Parser,Store,Interpreter,ExpressionDeployer,}.sol, and src/concrete/* become thin bindings of the generated tables and Zoltu addresses over them. This is the shape the .deploy repo needs from the rainlang package: it will carry only the thin concretes plus the pins.

  • BaseRainlangInterpreter binds opcodeFunctionPointers(); BaseRainlangParser binds parseMeta() / operandHandlerFunctionPointers() / literalParserFunctionPointers() (now view so a binding may read storage); BaseRainlangExpressionDeployer binds parser() / integrityFunctionPointers() / describedByMetaV1(); BaseRainlangStore and BaseRainlang bind nothing beyond IRainlang. PARSE_META_BUILD_DEPTH is a source constant on BaseRainlangParser rather than a value re-read from the generated file it parameterises.
  • test/concrete/Test*.sol are the bases built from current source with no generated tables: the parser builds its parse meta from LibAllStandardOps.authoringMetaV2() at construction, the pointer tables are read from LibAllStandardOps at runtime. test/lib/deploy/LibTestInterpreterDeploy.sol places them at fixed test addresses.
  • RainlangExpressionDeployerDeploymentTest types I_* as the bases and gets one hook, deployRainlang(), defaulting to the test concretes. The op / integrity / eval / parse tests now run against current source rather than the etched candidate record; the concrete-specific tests (*.pointers, *.meta, deployCheck, extrospect, Rainlang.t, LibInterpreterDeploy.t, Build.t, the deploy chain test) still exercise the real concretes and pins, and the deploy repo's OpTest will override the hook with etchRainlang.
  • Generated: the parser, store and interpreter bytecode are unchanged. RainlangExpressionDeployer is 15 bytes longer (the parser() / integrityFunctionPointers() hooks are internal calls the legacy optimizer does not inline), so its candidate address moves 0xb90c299a… → 0x146Fecd8…, and Rainlang, which embeds it, moves with it. The live 0.1.9 deployments are untouched; the next release needs the expression-deployer and rainlang suites deployed before its cut, which is the documented flow.

QA

  • Discriminating tests: the full suite, 1518 passed, 7 failed, where the 7 are the fork tests needing ARBITRUM_RPC_URL, the same set that fails locally on main. RainlangExpressionDeployer.meta.t.sol now asserts against new RainlangExpressionDeployer() because I_DEPLOYER is the source-built test concrete, which is the discriminating case for the hook: with the old binding it read the generated hash back from itself.
  • Mutations applied: n/a, a structural move with no new logic; the equivalence tests RainlangParser.pointers, RainlangInterpreter.pointers and RainlangExpressionDeployer.pointers pin generated tables == LibAllStandardOps-built tables for the concretes, and every op test now takes the LibAllStandardOps path directly through the test concretes.
  • Oracle: script/Build.sol run to a fixed point; src/generated/candidate/{RainlangParser,RainlangStore,RainlangInterpreter}.sol byte-identical to main, the two moved records regenerated by the script.
  • Category check: Split deploy half out of rainlang (rainix#296) #552 asks for the deploy half split out; this PR is the library-side prerequisite (logic in Base*, thin concretes, test harness independent of pins). The deploy repo, the slim and consumer migration follow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QyCCzi9WZPhuXcU1hwr2bq

Summary by CodeRabbit

  • Refactor

    • Consolidated shared Rainlang functionality into reusable base components for parsing, interpreting, expression deployment, storage, and interface detection.
    • Concrete Rainlang contracts now provide their configuration while inheriting consistent behavior from the shared implementations.
    • Existing parsing, evaluation, storage, metadata, and interface-support capabilities remain available with more consistent behavior across contracts.
  • Tests

    • Added dedicated test implementations and deployment utilities to improve coverage of shared Rainlang functionality.

First step of the library / deploy split (#552). The five deployed
contracts' logic moves into src/abstract/BaseRainlang{Parser,Store,
Interpreter,ExpressionDeployer,}.sol and src/concrete/* become thin
bindings of the generated tables and Zoltu addresses over them, which is
the shape the .deploy repo consumes from the package.

PARSE_META_BUILD_DEPTH is a source constant on BaseRainlangParser rather
than a value re-read from the generated file it parameterises.

test/concrete/Test*.sol are the bases built from current source with no
generated tables, placed at fixed test addresses by
test/lib/deploy/LibTestInterpreterDeploy.sol.
RainlangExpressionDeployerDeploymentTest types I_* as the bases and gets
one hook, deployRainlang(), defaulting to the test concretes, so the op,
integrity, eval and parse tests run against current source; the
concrete-specific tests keep exercising the real concretes and pins.

Parser, store and interpreter bytecode are unchanged.
RainlangExpressionDeployer is 15 bytes longer (the parser() and
integrityFunctionPointers() hooks are internal calls the legacy
optimizer does not inline), so its candidate address moves and Rainlang,
which embeds it, moves with it. The live 0.1.9 deployments are
untouched.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QyCCzi9WZPhuXcU1hwr2bq
@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: ad72ecae-0035-41e3-ae93-95ea208c8bb4

📥 Commits

Reviewing files that changed from the base of the PR and between e8e510f and 10a1af0.

📒 Files selected for processing (8)
  • crates/bindings/abi/Rainlang.json
  • crates/test_fixtures/abi/Rainlang.json
  • crates/test_fixtures/abi/RainlangExpressionDeployer.json
  • crates/test_fixtures/abi/RainlangInterpreter.json
  • test/concrete/TestRainlang.sol
  • test/concrete/TestRainlangExpressionDeployer.sol
  • test/concrete/TestRainlangInterpreter.sol
  • test/concrete/TestRainlangParser.sol

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: de6cfc7a-1ed9-4552-9cf9-993ec364e29e

📥 Commits

Reviewing files that changed from the base of the PR and between 86be118 and e8e510f.

⛔ Files ignored due to path filters (3)
  • src/generated/RainlangExpressionDeployerPointers.sol is excluded by !**/generated/**
  • src/generated/candidate/Rainlang.sol is excluded by !**/generated/**
  • src/generated/candidate/RainlangExpressionDeployer.sol is excluded by !**/generated/**
📒 Files selected for processing (23)
  • script/Build.sol
  • src/abstract/BaseRainlang.sol
  • src/abstract/BaseRainlangExpressionDeployer.sol
  • src/abstract/BaseRainlangInterpreter.sol
  • src/abstract/BaseRainlangParser.sol
  • src/abstract/BaseRainlangStore.sol
  • src/concrete/Rainlang.sol
  • src/concrete/RainlangExpressionDeployer.sol
  • src/concrete/RainlangInterpreter.sol
  • src/concrete/RainlangParser.sol
  • src/concrete/RainlangStore.sol
  • test/abstract/RainlangExpressionDeployerDeploymentTest.sol
  • test/concrete/TestRainlang.sol
  • test/concrete/TestRainlangExpressionDeployer.sol
  • test/concrete/TestRainlangInterpreter.sol
  • test/concrete/TestRainlangParser.sol
  • test/concrete/TestRainlangStore.sol
  • test/lib/deploy/LibTestInterpreterDeploy.sol
  • test/src/concrete/RainlangExpressionDeployer.meta.t.sol
  • test/src/concrete/RainlangParser.pointers.t.sol
  • test/src/lib/integrity/LibIntegrityCheck.multiSource.t.sol
  • test/src/lib/integrity/LibIntegrityCheck.stackMaxIndex.t.sol
  • test/src/lib/integrity/LibIntegrityCheck.zeroSource.t.sol

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change extracts shared Rainlang behavior into abstract base contracts. Concrete contracts now bind generated tables and deployed addresses. Test fixtures add runtime-bound implementations and fixed-address deployment support.

Changes

Rainlang base architecture

Layer / File(s) Summary
Shared base contracts
src/abstract/*
New base contracts implement Rainlang interface support, parsing, expression deployment, interpretation, and namespaced storage.
Concrete contract bindings
script/Build.sol, src/concrete/*
Concrete contracts inherit the new bases and retain generated pointer tables, parser bindings, integrity pointers, and component addresses.
Test implementations and deployment
test/abstract/..., test/concrete/*, test/lib/deploy/*
Tests add concrete base implementations and etch them at fixed addresses through LibTestInterpreterDeploy.
Test consumer updates
test/src/concrete/*, test/src/lib/integrity/*
Existing tests use the new deployments and shared parser references.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to e8e51

No actionable merge-blocking risk is established in the current change.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant RainlangExpressionDeployer
  participant RainlangParser
  participant LibIntegrityCheck
  Caller->>RainlangExpressionDeployer: parse2(data)
  RainlangExpressionDeployer->>RainlangParser: unsafeParse(data)
  RainlangParser-->>RainlangExpressionDeployer: bytecode and constants
  RainlangExpressionDeployer->>LibIntegrityCheck: integrityCheck2(serialized bytecode)
  LibIntegrityCheck-->>RainlangExpressionDeployer: integrity result
  RainlangExpressionDeployer-->>Caller: serialized bytecode
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: moving deployed contract logic into BaseRainlang abstract contracts. The step and issue reference provide useful context without making the t…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-09-06-base-rainlang-abstracts

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.

baku-ccron and others added 2 commits September 6, 2026 19:25
script/CopyArtifacts.sol output: the devdoc in the Rainlang, expression
deployer and interpreter artifacts follows the moved NatSpec.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QyCCzi9WZPhuXcU1hwr2bq
@thedavidmeister
thedavidmeister merged commit 5675aa7 into main Sep 7, 2026
8 checks passed
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment:

S/M/L PR Classification Guidelines:

This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed.

Small (S)

Characteristics:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

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.

1 participant