fix: view mutability, return names, meta description, and eval-order comments - #186
fix: view mutability, return names, meta description, and eval-order comments#186thedavidmeister wants to merge 6 commits into
Conversation
… and eval-order comments - IGoverned.governanceSettings(): add missing `view` mutability (#101) - IDineroFlrEth: rename ethAmount/tokenAmount returns to ethPerFlreth18/flrethPerEth18 to reflect ratio semantics (#100) - LibFlareFtsoSubParser sflr-exchange-rate meta: specify 0 inputs and clarify sFLR-per-FLR direction with example value (#95, #104) - LibOpFtsoCurrentPricePair.run: add inline comments explaining the index-shuffle evaluation order (symbolB fetched first, then symbolA) to prevent future inversion during maintenance (#103) Closes #95 Closes #100 Closes #101 Closes #103 Closes #104 Co-Authored-By: Claude <noreply@anthropic.com>
WalkthroughThe changes rename two interface return variables, clarify FTSO price-pair assembly comments, and expand sFLR exchange-rate authoring metadata. The encoded metadata payload and its expected test description are updated to match the revised wording. ChangesAudit Clarifications
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
…oducible locally; retrigger)
|
Producer note: HAND-OFF on red |
|
🤖 ai:producer |
|
🤖 ai:vetter |
|
🤖 ai:producer |
|
👤 human |
|
Rework note This PR is not blocked on infrastructure. It is 83 commits behind Your one permitted Do it in this order:
This counts as a fresh attempt — the back-off from the earlier try does not apply, because the earlier try was against a base that no longer exists. If |
Merge origin/main (83 commits) into the PR branch. Sole textual conflict: src/lib/parse/LibFlareFtsoSubParser.sol, where both sides independently expanded the `sflr-exchange-rate` authoring meta description. Resolved by integrating both: keeps main's "self-reported by the Sceptre staked FLR contract" attribution and its "a value less than 1 means 1 FLR yields fewer than 1 sFLR share" reading, plus the branch's Rain Float framing, the ~0.877 example and the reciprocal conversion guidance. main also landed testAuthoringMetaContent, which pins the full description string by exact equality. That assertion is updated in lockstep to the integrated string — it stays an exact-equality pin, it is not loosened. Note main already landed the IGoverned.governanceSettings() `view` mutability fix (issue #101) independently, so that hunk of this branch is now a no-op against main. Co-Authored-By: Claude <noreply@anthropic.com>
Regenerate the committed artifacts from the build on the post-merge tree,
rather than text-merging them. Recipe is the repo's own `script/build.sh`,
which delegates to the `rain-flare-prelude` nix task (flake.nix):
forge script --silent ./script/BuildAuthoringMeta.sol
rain meta build -i <(cat meta/FlareFtsoSubParserAuthoringMeta.rain.meta) \
-m authoring-meta-v2 -t cbor -e deflate -l none \
-o meta/FlareFtsoWords.rain.meta
forge script --silent ./script/Build.sol
forge fmt
This is the same recipe the rainix copy-artifacts reusable runs.
What changed and why: the merge integrated a new `sflr-exchange-rate`
authoring meta description, which flows into both meta blobs and, through
keccak256 of meta/FlareFtsoWords.rain.meta, into DESCRIBED_BY_META_HASH.
FlareFtsoWords.describedByMetaHash() returns that constant, so it is part
of the deployed bytecode, so BYTECODE_HASH moves with it:
meta/FlareFtsoSubParserAuthoringMeta.rain.meta 1536 -> 1664 bytes
meta/FlareFtsoWords.rain.meta 521 -> 595 bytes
DESCRIBED_BY_META_HASH 0x4ccb316f... -> 0x1bff202a...
BYTECODE_HASH 0x69ffc416... -> 0x358d8e81...
Because DESCRIBED_BY_META_HASH is compiled into the contract whose codehash
becomes BYTECODE_HASH, converging from the merged tree takes two prelude
passes; a third pass is a no-op, so this is a genuine fixed point and the
copy-artifacts diff check is stable.
Verified the regeneration is not a silent no-op: BYTECODE_HASH was set to
0xdeadbeef...deadbeef and the prelude restored it to
0x358d8e811b035af26e4cf1bd71f901057474799487777603aaa6ac620842bcf0.
Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lib/op/LibOpFtsoCurrentPricePair.sol (1)
53-55: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winCorrect the virtual-array index in the assembly comment.
After the pointer shift and length rewrite, the virtual array contains
symbolBatinputs[0]andtimeoutatinputs[1]. The current comment placessymbolBatinputs[1], which can mislead future changes to this memory-truncation logic.Proposed fix
- // Advance the pointer past the length slot so the virtual 2-element - // array starts at inputs[1]=symbolB. Save symbolA so it can be + // Advance the pointer past the length slot. The virtual 2-element + // array then contains symbolB at inputs[0] and timeout at inputs[1]. + // Save symbolA so it can be🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/op/LibOpFtsoCurrentPricePair.sol` around lines 53 - 55, Update the assembly comment near the pointer shift and length rewrite to state that the virtual two-element array contains symbolB at inputs[0] and timeout at inputs[1]. Keep the surrounding memory-truncation logic and symbolA restoration behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/lib/op/LibOpFtsoCurrentPricePair.sol`:
- Around line 53-55: Update the assembly comment near the pointer shift and
length rewrite to state that the virtual two-element array contains symbolB at
inputs[0] and timeout at inputs[1]. Keep the surrounding memory-truncation logic
and symbolA restoration behavior unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0f89eb38-0972-4747-b5a4-79a523a3114f
⛔ Files ignored due to path filters (1)
src/generated/FlareFtsoWords.pointers.solis excluded by!**/generated/**
📒 Files selected for processing (5)
meta/FlareFtsoSubParserAuthoringMeta.rain.metameta/FlareFtsoWords.rain.metasrc/lib/op/LibOpFtsoCurrentPricePair.solsrc/lib/parse/LibFlareFtsoSubParser.soltest/src/concrete/FlareFtsoWords.pointers.t.sol
|
🤖 ai:producer Merged What the merge brought in — 83 commits ( Regen recipe — the repo's own What moved (
Because No-op verification — passed. copy-artifacts state — pass, 7m34s. The Full check state on |
|
🤖 ai:producer |
|
🤖 ai:producer |
|
🤖 ai:producer |
|
🤖 ai:producer |
|
🤖 ai:producer |
Body now carries the QA-GUIDE section 8 evidence block. Closes narrowed to issue 100 only: issues 95, 101, 103 and 104 were fixed independently on main before this branch merged it and are already closed, so their Closes were weakened to Refs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Summary
Five related interface/documentation fixes:
viewmutability — the function is a pure getter that does not mutate state; omittingviewincorrectly blocked callers from using it insideviewfunctions or viastaticcallethAmount→ethPerFlreth18andtokenAmount→flrethPerEth18to reflect that both values are 1e18-scaled ratios, not absolute balances; eliminates the unit-confusion hazard that would produce 1e18× pricing errors"Returns the current exchange rate of FLR to SFLR."to state: 0 inputs, explicit sFLR-per-FLR direction, example value (~0.877), and how to convert FLR-per-sFLR (take reciprocal)Refs #95
Closes #100
Refs #101
Refs #103
Refs #104
Test plan
forge test --no-match-test fork— 60 tests passed, 0 failedCo-Authored-By: Claude noreply@anthropic.com
Summary by CodeRabbit
Documentation
Refactor
Chores
QA
FlareFtsoWordsPointersTest.testAuthoringMetaContent(pins thesflr-exchange-ratedescription by exact string equality) andLibOpFtsoCurrentPricePairTest.testRunPairDerivationExact/testRunPairZeroBaseIsZero/testRunPairZeroQuoteReverts(pin the symbolA/symbolB ratio orientation the new eval-order comments assert) — each verified by killing a mutant below, not by reading the assertion. Baseline on this head: 47 passed, 0 failed (the 16 not run needFLARE_RPC_URLand are fork tests).src/lib/parse/LibFlareFtsoSubParser.soldescriptionsFLR-per-FLR→FLR-per-sFLR→ killed bytestAuthoringMetaContent(7 passed, 1 failed); (2)src/lib/op/LibOpFtsoCurrentPricePair.solnumeratorPrice.div(denominatorPrice)→denominatorPrice.div(numeratorPrice)→ killed bytestRunPairDerivationExact,testRunPairZeroBaseIsZeroandtestRunPairZeroQuoteReverts(12 passed, 3 failed); (3)BYTECODE_HASH→0xdeadbeef…thennix develop -c rain-flare-prelude→ restored to the committed0x358d8e81…, proving the regen recipe rewrites the file rather than silently skipping. TheIDineroFlrEthreturn-parameter rename has no mutant: return-parameter identifiers are not observable to any test, only to the emitted ABI JSON.test/prod/FlareInterfacesProd.t.sol::testFlrEthInterfaceProd, which assertsLSTPerToken()(renamed here toethPerFlreth18) returns a value in (1e18, 2e18) andtokensPerLST()(renamed toflrethPerEth18) returns one in (0.5e18, 1e18). An accruing LST has ETH-per-LST > 1 and LST-per-ETH < 1, so the chain — not the interface's own comments — fixes the direction of both renames. Thesflr-exchange-ratedirection is fixed the same way bygetSharesByPooledFlr(1e18)semantics plustestSFlrInterfaceProdasserting the rate is below 1e18.IDineroFlrEthreturn identifiers stop reading as absolute balances and convey a 1e18-scaled ratio; both are renamed, in the direction the chain confirms, so [F49] [LOW] Return param name 'ethAmount'/'tokenAmount' is a misnomer for a unitless ratio and risks scale confusion #100 is covered and remains the onlyCloses. [F44] [LOW] sflr-exchange-rate meta omits the input count while the other two words document it #95, [F50] [LOW] governanceSettings() missing view mutability, contradicting Flare's IGovernedBase and the sibling governance() getter #101, [F52] [LOW] priceA/priceB variable naming is inverted relative to call order, obscuring the index-shuffle logic #103 and [F53] [LOW] sflr-exchange-rate meta description is ambiguous about direction and omits that it returns sFLR-per-FLR #104 were independently fixed onmainbefore this branch merged it and are already closed, so theirCloseswere weakened toRefs: this PR's remaining content on those lines (a longersflr-exchange-ratedescription, extra eval-order comments) is additive polish on top of fixesmainalready landed, not the fix that resolved them.