From 81aac9cb35f79d6a02a2ed719484b14115b6deb5 Mon Sep 17 00:00:00 2001 From: baku-ccron Date: Wed, 16 Sep 2026 13:23:47 +0000 Subject: [PATCH] chore: apply pre-commit formatting to main Exactly what `pre-commit run --all-files` writes on unmodified main: no hand edits. `denofmt` rewraps `README.md` and `CLAUDE.md` to 80 columns and adds the missing trailing newline to `README.md`. `yamlfmt` drops the blank line before `jobs:` in `.github/workflows/pr-assessment.yaml`. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01V8ViHcKLVk2YoS2joH4HdN --- .github/workflows/pr-assessment.yaml | 1 - CLAUDE.md | 64 +++++++++++++++++++--------- README.md | 9 ++-- 3 files changed, 50 insertions(+), 24 deletions(-) diff --git a/.github/workflows/pr-assessment.yaml b/.github/workflows/pr-assessment.yaml index 71c5461..18e484f 100644 --- a/.github/workflows/pr-assessment.yaml +++ b/.github/workflows/pr-assessment.yaml @@ -3,7 +3,6 @@ on: pull_request: types: - closed - jobs: assess-pr-size-on-merge: uses: rainlanguage/github-chore/.github/workflows/pr-assessment.yml@main diff --git a/CLAUDE.md b/CLAUDE.md index f2ce77b..83706b8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,16 +1,21 @@ # CLAUDE.md -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. +This file provides guidance to Claude Code (claude.ai/code) when working with +code in this repository. ## Project Overview -Solidity interfaces for the Rainlang interpreter and utility libraries for implementing them. Part of the Rain Protocol ecosystem for onchain interpreted compute. +Solidity interfaces for the Rainlang interpreter and utility libraries for +implementing them. Part of the Rain Protocol ecosystem for onchain interpreted +compute. -License: DecentraLicense 1.0 (DCL-1.0). REUSE 3.2 compliant — all files need SPDX headers and copyright notices. +License: DecentraLicense 1.0 (DCL-1.0). REUSE 3.2 compliant — all files need +SPDX headers and copyright notices. ## Build & Development -Requires the Nix package manager. **Only use the nix version of Foundry**, not a system-installed one. +Requires the Nix package manager. **Only use the nix version of Foundry**, not a +system-installed one. ```bash nix develop # Enter dev shell @@ -20,9 +25,11 @@ rainix-sol-static # Static analysis (Slither) rainix-sol-legal # License/REUSE compliance check ``` -Compiler: Solidity 0.8.25, EVM target: cancun, optimizer enabled (1M runs). Fuzz tests run 2048 iterations. +Compiler: Solidity 0.8.25, EVM target: cancun, optimizer enabled (1M runs). Fuzz +tests run 2048 iterations. -All reverts use custom errors — no `revert("string")` or `require()` with string messages. +All reverts use custom errors — no `revert("string")` or `require()` with string +messages. ## Architecture @@ -30,24 +37,35 @@ All reverts use custom errors — no `revert("string")` or `require()` with stri The current interface set (all in `src/interface/`): -- **IInterpreterV4** — Evaluates Rainlang bytecode. Stateless: returns stack results and state writes without persisting anything itself. -- **IInterpreterStoreV3** — Key-value state storage with namespace isolation per caller. `set()` for bulk writes, `get()` for reads. -- **IInterpreterCallerV4** — Defines `EvaluableV4` struct (interpreter + store + bytecode). Contracts that call the interpreter implement this. +- **IInterpreterV4** — Evaluates Rainlang bytecode. Stateless: returns stack + results and state writes without persisting anything itself. +- **IInterpreterStoreV3** — Key-value state storage with namespace isolation per + caller. `set()` for bulk writes, `get()` for reads. +- **IInterpreterCallerV4** — Defines `EvaluableV4` struct (interpreter + store + + bytecode). Contracts that call the interpreter implement this. - **IParserV2** — Converts Rainlang source text to bytecode (`parse2()`). - **ISubParserV4** — Extension point for custom literals and words in parsers. - **IInterpreterExternV4** — External function dispatch with integrity checking. - **IParserPragmaV1** — Pragma support (e.g. `usingWordsFrom`). -Deprecated v1/v2 interfaces live in `src/interface/deprecated/`. Deprecated interfaces should not be modified unless undeprecating (moving back to `src/interface/`). +Deprecated v1/v2 interfaces live in `src/interface/deprecated/`. Deprecated +interfaces should not be modified unless undeprecating (moving back to +`src/interface/`). ### Libraries (`src/lib/`) -- **LibBytecode** (`bytecode/`) — Parse and validate Rainlang bytecode structure (source counts, offsets, stack allocation, OOB checks). -- **LibContext** (`caller/`) — Build execution context arrays with signature verification (uses OZ SignatureChecker). Base context = `[msg.sender, calling_contract]`. +- **LibBytecode** (`bytecode/`) — Parse and validate Rainlang bytecode structure + (source counts, offsets, stack allocation, OOB checks). +- **LibContext** (`caller/`) — Build execution context arrays with signature + verification (uses OZ SignatureChecker). Base context = + `[msg.sender, calling_contract]`. - **LibEvaluable** (`caller/`) — Hash utility for `EvaluableV4` structs. -- **LibNamespace** (`ns/`) — Qualifies state namespaces by hashing with sender address for caller isolation. -- **LibParseMeta** (`parse/`) — Bloom filter + fingerprint-based word lookup for parser metadata. -- **LibGenParseMeta** (`codegen/`) — Code generation for optimized parse metadata constants. +- **LibNamespace** (`ns/`) — Qualifies state namespaces by hashing with sender + address for caller isolation. +- **LibParseMeta** (`parse/`) — Bloom filter + fingerprint-based word lookup for + parser metadata. +- **LibGenParseMeta** (`codegen/`) — Code generation for optimized parse + metadata constants. ### Key Types @@ -55,19 +73,27 @@ Deprecated v1/v2 interfaces live in `src/interface/deprecated/`. Deprecated inte - `OperandV2` — `bytes32`, opcode operands - `StateNamespace` / `FullyQualifiedNamespace` — `bytes32`, state isolation - `SourceIndexV2` — `bytes32`, index into bytecode sources -- `EvaluableV4` — struct containing interpreter address, store address, and bytecode +- `EvaluableV4` — struct containing interpreter address, store address, and + bytecode ### Security Model -Interpreters must be resilient to malicious expressions. Eval is read-only; state changes go through a separate `set()` call. Namespace qualification ensures caller isolation. If eval reverts, no state changes persist. +Interpreters must be resilient to malicious expressions. Eval is read-only; +state changes go through a separate `set()` call. Namespace qualification +ensures caller isolation. If eval reverts, no state changes persist. ## Tests -Tests are in `test/src/lib/` mirroring the `src/lib/` structure. Test files use `.t.sol` suffix. Reference implementations used in differential testing append `Slow` to the library name, with no separating dot: `LibNamespaceSlow.sol`, `LibBytecodeSlow.sol`. +Tests are in `test/src/lib/` mirroring the `src/lib/` structure. Test files use +`.t.sol` suffix. Reference implementations used in differential testing append +`Slow` to the library name, with no separating dot: `LibNamespaceSlow.sol`, +`LibBytecodeSlow.sol`. ## Dependencies -Soldeer, installed into `dependencies/`. Imports carry the package version in the path (`rain-solmem-0.1.3/src/...`), so a version bump rewrites every import of that package. +Soldeer, installed into `dependencies/`. Imports carry the package version in +the path (`rain-solmem-0.1.3/src/...`), so a version bump rewrites every import +of that package. ## Branch Naming diff --git a/README.md b/README.md index a002496..9b43486 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,8 @@ CI usage. ## Legal stuff -Everything is under DecentraLicense 1.0 (DCL-1.0) which can be found in `LICENSES/`. +Everything is under DecentraLicense 1.0 (DCL-1.0) which can be found in +`LICENSES/`. This is basically `CAL-1.0` which is an open source license https://opensource.org/license/cal-1-0 @@ -33,8 +34,8 @@ to those users as relevant, and that private keys remain private. Roughly it's "not your keys, not your coins" aware, as close as we could get in legalese. -This is the default situation on permissionless blockchains, so shouldn't require -any additional effort by dev-users to adhere to the license terms. +This is the default situation on permissionless blockchains, so shouldn't +require any additional effort by dev-users to adhere to the license terms. This repo is REUSE 3.2 compliant https://reuse.software/spec-3.2/ and compatible with `reuse` tooling (also available in the nix shell here). @@ -47,4 +48,4 @@ nix develop -c rainix-sol-legal Contributions are welcome **under the same license** as above. -Contributors agree and warrant that their contributions are compliant. \ No newline at end of file +Contributors agree and warrant that their contributions are compliant.