Reduce StreamCore deployment size#90
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
📝 WalkthroughWalkthroughRefactors StreamCore to delegate metadata/escaping to a new StreamMetadataRenderer library, removes ERC721Enumerable while tracking live supply, adds a production-only forge size gate across CI/Makefile/scripts, and updates tests, docs, and operational records to reflect interface and size changes. ChangesStreamCore refactoring and metadata renderer extraction
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@ops/ROADMAP.md`:
- Line 66: Update the Static analysis table row in ops/ROADMAP.md so the Low
findings count matches ops/SLITHER_BASELINE.md (change the "92 Low" value to "93
Low" in the Static analysis evidence cell), ensuring the row labeled "Static
analysis" and its accompanying evidence text (`slither . --config-file
slither.config.json --foundry-compile-all`, `ops/SLITHER_BASELINE.md`, and
`docs/vendored-libraries.md`) remain unchanged otherwise so totals (717, 4 High,
19 Medium) still reconcile exactly with the baseline.
In `@smart-contracts/StreamMetadataRenderer.sol`:
- Around line 75-94: The JSON assembly embeds schemaVersion and metadataState
without escaping, risking malformed JSON if they contain quotes or backslashes;
update the JSON construction in StreamMetadataRenderer.sol to call
escapeJsonString on both schemaVersion and metadataState (e.g., use
escapeJsonString(schemaVersion) and escapeJsonString(metadataState) in the
abi.encodePacked sequence) so those fields are safely escaped before being
concatenated into the returned string.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8f5939d7-10b9-4550-b5ba-2262c78adeb6
📒 Files selected for processing (17)
.github/workflows/ci.ymlMakefileREADME.mddocs/adr/0006-metadata-freeze.mddocs/known-blockers.mddocs/metadata.mddocs/status.mddocs/tooling.mdops/AUTONOMOUS_RUN.mdops/ROADMAP.mdops/SLITHER_BASELINE.mdscripts/check.ps1scripts/check.shsmart-contracts/StreamCore.solsmart-contracts/StreamMetadataRenderer.soltest/README.mdtest/StreamMetadataEvents.t.sol
Summary
StreamMetadataRendererlibraryStreamCorewhile preserving a livetotalSupply()view and ERC-4906 supportmake check, Linux/Windows check scripts, and CI:forge build --sizes --via-ir --skip test --forceCloses #89.
Size Evidence
Before this work,
StreamCorewas 35,696 runtime bytes, 11,120 bytes over the EIP-170 runtime limit.The production gate now passes:
The generic all-artifact
forge build --sizesremains diagnostic because test-only invariant handlers can exceed initcode limits. The release gate is the explicit skip-test, IR-optimized production profile above.Validation
make checkpassedpowershell -ExecutionPolicy Bypass -File scripts\check.ps1passed$env:Path="$HOME\.foundry\bin;$env:Path"; forge fmt --check smart-contracts\StreamCore.sol smart-contracts\StreamMetadataRenderer.sol test\StreamMetadataEvents.t.solpassedforge fmt --check smart-contracts\StreamMetadataRenderer.sol test\StreamMetadataEscaping.t.solpassed after CodeRabbit fixesforge test --match-contract 'StreamMetadata(Escaping|Golden|Events)Test' -vvvpassed with 26 tests after CodeRabbit fixesgit diff --checkpassedforge build --sizes --via-ir --skip test --forcepassedarbitrary-send-eth,reentrancy-eth,weak-prng,uninitialized-state, andencode-packed-collisionNotes
StreamCore; docs now call out thattokenByIndexandtokenOfOwnerByIndexare not part of the current release surface.