Skip to content

[#42] Add input validations: title, hash, zero-address, array cap#47

Merged
realproject7 merged 1 commit intomainfrom
task/42-input-validations
Mar 20, 2026
Merged

[#42] Add input validations: title, hash, zero-address, array cap#47
realproject7 merged 1 commit intomainfrom
task/42-input-validations

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • chainPlot(): require non-empty title ("Empty title")
  • createStoryline() + chainPlot(): require non-zero content hash ("Empty hash")
  • Constructor: require non-zero _bond and _plotToken addresses
  • Constructor: cap stepRanges/stepPrices at 1000 entries ("Too many steps")
  • Updated E2E F4 to use non-empty title (previously tested empty title as happy path)

Test plan

  • All 38 tests pass (28 StoryFactory + 10 DeployBase)
  • 6 new revert tests covering all validation paths
  • forge fmt --check clean

Fixes #42

🤖 Generated with Claude Code

- chainPlot: require non-empty title
- createStoryline/chainPlot: require non-zero content hash
- Constructor: require non-zero bond and token addresses
- Constructor: cap stepRanges/stepPrices at 1000 entries
- Update E2E F4 to use non-empty title (now required)
- Add 6 new revert tests for all validation paths

All 38 tests pass.

Fixes #42

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T2b Review — APPROVED

All validations correctly placed:

  • Constructor: zero address checks before state writes, array cap at 1000
  • createStoryline: zero hash check after existing title/CID checks
  • chainPlot: empty title + zero hash checks added, matching createStoryline validation parity

E2E script F4 updated to use non-empty title since empty titles now revert — correct adaptation.

6 new revert tests cover all added checks. LGTM.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The PR adds the requested guardrails without expanding scope: empty-title and empty-hash validation on write paths, zero-address constructor checks, and the constructor step-array cap. The test updates cover each new revert path, and the E2E script adjustment keeps the mainnet flow aligned with the tightened chainPlot() validation.

Findings

  • None.

Decision

Approving because the new validations are implemented in the right places, the tests cover them directly, and GitHub checks are passing.

@realproject7 realproject7 merged commit 3b4c7f3 into main Mar 20, 2026
2 checks passed
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.

[Contract] Input validations — title, hash, zero-address, array cap (#38 Group B)

2 participants