Test gap: #63 opt-in semantics not covered for referral path or buyFor router path #77
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega#77
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found Monday 2026-04-27 during #63 source-level verification.
Summary
#63 added an opt-in plantWarBowFlag parameter to four buy entry points:
contracts/test/TimeCurve.t.sol covers items 1, 2, and 4 (plain buy unchanged, opt-in plant works, same holder plain follow-up preserves silence). But no test asserts opt-in semantics specifically on:
Why it matters
The contract logic is shared via _buy / _buyForExternal so the L250/L259 tests indirectly cover the parameter wiring. But explicit assertions would close the gap for future regressions where someone refactors _buy or one of its callers and breaks one entry point's parameter passthrough silently.
Suggested tests
Severity
LOW. Not a current bug, just a coverage gap. Worth adding pre-mainnet for regression safety.
Out of scope
#63 itself (closed), #76 browser walkthrough.
cc @PlasticDigits
mentioned in issue #63
mentioned in commit
a1f286d000Fixed on
main(commita1f286d)Implemented the four suggested Forge tests from this issue so referral
buy(charmWad, codeHash, plantWarBowFlag)and routerbuyFor(buyer, charmWad, plantWarBowFlag)cannot regress silently if_buy/ callers are refactored:test_referral_buy_with_plant_false_does_not_plantcontracts/test/TimeCurveReferral.t.soltest_referral_buy_with_plant_true_plantstest_buy_for_with_plant_false_does_not_plantcontracts/test/TimeCurve.t.soltest_buy_for_with_plant_true_plantsDocs / cross-links:
docs/testing/invariants-and-business-logic.md(Referral CHARM row + WarBow ladder bullet),skills/README.md,skills/play-timecurve-warbow/SKILL.md,.cursor/skills/yieldomega-guardrails/SKILL.md(item 16).CI-style verification run:
cd contracts && FOUNDRY_PROFILE=ci forge test— 196 passed.Checklist for @brouie
mainand confirm the four tests exist and pass locally (forge test --match-test 'test_referral_buy_with_plant|test_buy_for_with_plant').invariants-and-business-logic.md: WarBow bullet lists all four test names; Referral row cites #77.buyFortest assertscharmWeight(router)==0andwarbowPendingFlagOwner == buyer(not router) whenplant=true.Issue #63 behavior unchanged — coverage only.
@PlasticDigits verified on
a1f286d.Tests
cd contracts && FOUNDRY_PROFILE=ci forge test --match-contract 'TimeCurveTest|TimeCurveReferralTest':
All 4 suggested test names landed exactly
contracts/test/TimeCurve.t.sol:
contracts/test/TimeCurveReferral.t.sol:
Test shape spot-check (TimeCurve.t.sol L291, L305)
The buyFor tests cover the most important regression risk — buyer-vs-router attribution on the router path:
That's exactly the invariant I called out — would catch any future refactor of _buyForExternal that silently breaks pass-through OR attribution.
Closing #77.
mentioned in issue #76