Post-#138 hygiene: WarBow constant rename + persist_decoded_log autocommit naming #148
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#148
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?
two low-priority hygiene items spotted while doing the #131/#138 children verification pass. neither is a correctness bug — both are naming/convention follow-ups that would help future reviewers. filed as one issue since they're both low and small.
Finding 1 —
WARBOW_MAX_STEALS_PER_VICTIM_PER_DAYconstant name is stale post-#134contracts/src/TimeCurve.sol:76declares:post-#134 the constant is now used for BOTH the per-victim cap (L630) AND the per-attacker cap (L631):
behaviorally correct — both caps share threshold of 3. but the name says "PER_VICTIM" and reads as misleading on the attacker branch. anyone modifying the attacker cap independently in the future has to remember to either rename or duplicate the constant.
mitigation: rename to
WARBOW_MAX_STEALS_PER_DAY(drops the misleading "PER_VICTIM"), or split into two constantsWARBOW_MAX_STEALS_PER_VICTIM_PER_DAY+WARBOW_MAX_STEALS_PER_ATTACKER_PER_DAYif the cap thresholds might diverge later.note for context: the related event field
bypassedVictimDailyLimitis similarly stale post-#134, but is already disclosed in NatSpec at L213 as "historical naming" with explicit cross-link to #134, so that's not in scope of this ticket.Finding 2 —
persist_decoded_log(public pool wrapper) is autocommit, not transactionalindexer/src/persist.rs:1356-1358exposes:acquires a connection from pool, calls
_connvariant — but without wrapping in a transaction. each call is autocommit per-event.production ingestion (
indexer/src/ingestion.rsL150-180) uses_conninsidepool.begin()so production is fine. risk is forward-looking: a future caller (test, ad-hoc tool, batch script) might usepersist_decoded_logfor batch work and lose the atomic per-block invariant from #140 / INV-INDEXER-146.mitigation: rename the public wrapper to
persist_decoded_log_autocommitto make the semantic explicit, OR add a doc comment on the function declaring it single-event only and pointing at_connfor batch use.cc @PlasticDigits
mentioned in issue #149
mentioned in commit
3f204678baGitLab #148 — implemented on main (
245b70b)Summary
WARBOW_MAX_STEALS_PER_VICTIM_PER_DAY→WARBOW_MAX_STEALS_PER_DAY(shared UTC-day cap semantics unchanged from #134/#138; naming aligned with behavior).persist_decoded_log→persist_decoded_log_autocommitwith explicit autocommit semantics; updated ingestion/reorg call sites and integration tests.docs/testing/invariants-and-business-logic.md(INV-WARBOW-148-CONST,INV-INDEXER-148-AUTOCOMMIT, anchor#post-138-hygiene-naming-gitlab-148),docs/indexer/design.md,.cursor/skills/yieldomega-guardrails/SKILL.md,skills/README.md,skills/play-timecurve-warbow/SKILL.md.Verification (please confirm)
contracts:FOUNDRY_PROFILE=ci forge test --match-contract TimeCurveTestpasses; on-chain reads useWARBOW_MAX_STEALS_PER_DAY().indexer:cargo clippy --all-targets -- -D warningsandcargo testpass; no remaining references to the old helper name in ingestion paths.frontend:npm ci && npm run typecheck && npm testpass; arena/protocol UI still shows the steal cap label correctly./cc @brouie — please verify when you have a moment. Leaving this issue open until you sign off.
Agent handoff: submodule init may be needed in fresh worktrees (
git submodule update --init contracts/lib/prb-math) beforeforge test.mentioned in commit
e12ddab4bc@PlasticDigits — verification PASS on
e12ddab(245b70b+ thee12ddabdoc follow-up). walked your checklist:forge test --match-contract TimeCurveTest: 116/116 PASS, 0 failures, 0 skipped — includestest_warbow_steal_attacker_daily_limit_fourth_needs_bypassexercising the renamedWARBOW_MAX_STEALS_PER_DAYon both victim AND attacker cap branches at TimeCurve.sol L630-631.cargo testindexer: 31/31 PASS (29 unit + 2 integration).integration_stage2postgres tests pass clean —postgres_gitlab146_block_transaction_all_or_nothing_for_shared_tx_hash+postgres_stage2_persist_all_events_and_rollback_after. no remainingpersist_decoded_log(sans suffix) call sites in ingestion/reorg paths.cargo clippy --all-targets -- -D warnings: clean.tsc -b: clean.vitest run: 281/281 PASS across 46 files includingwalletBuySessionGuard(7 tests), all timeCurve / warbow / referral suites.#post-138-hygiene-naming-gitlab-148+INV-WARBOW-148-CONST+INV-INDEXER-148-AUTOCOMMITcross-links resolve. arena/protocol UI label paths inTimeCurveProtocolPage.tsxanduseTimeCurveArenaModel.tsxupdated to the new getter.constant rename from
WARBOW_MAX_STEALS_PER_VICTIM_PER_DAY→WARBOW_MAX_STEALS_PER_DAYmatches behavior across both #134 cap branches. autocommit suffix onpersist_decoded_log_autocommitmakes the per-event semantic explicit at the type/name level — production ingestion still uses_conninsidepool.begin()per #140/#146 invariant.ready for close on your side.
mentioned in issue #129
mentioned in issue #113
mentioned in issue #151
mentioned in commit
00114ed338mentioned in commit
1fbe68a17a