Simulations: EcoStrategy audit scenarios A–E (shark vs believer modeling) #161
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#161
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?
Context
Track simulation / scenario work from EcoStrategy audit (
audits/audit_ecostrategy_1777969776.md): validate shark-vs-shark vs early believers.Scenarios
A — Early believers vs late no-referral sharks (no WarBow for early cohort).
B — Controlled referral cluster + optional presale beneficiary (+15% CHARM).
C — WarBow predator swarm vs early BP leader (steals, UTC rollover, guard, revenge, bypass).
D — Final-window MEV + flag ordering (same-block races).
E — Rabbit + launch anchor settlement + FeeRouter vs
receiveFee(links H-01 / vault).Deliverables
simulations/timecurve_sim/or addsimulations/ecostrategy/with strategy agents; full WarBow PvP (not toy steal in monte carlo).Acceptance criteria
References
simulations/README.md,simulations/timecurve_sim/model.py,monte_carlo.pymentioned in commit
1b7371ae78Implemented (main @
1b7371a)EcoStrategy GitLab #161 deliverable:
simulations/ecostrategy/with reproducible scenarios A–C,WarBowWorldaligned to `TimeCurve` warbowSteal / warbowRevenge / warbowActivateGuard (2× rule, 10%/1% drains with guard, UTC-day steal caps, 24h per-(victim,stealer) revenge window). Monte Carlo toy `pvp_steal_prob` remains documented as non-authoritative; see `INV-SIM-161` in `docs/testing/invariants-and-business-logic.md`.Docs / cross-links
cc @brouie — please sanity-check the modeling assumptions vs your EcoStrategy audit expectations.
Verification checklist
Issue left open per maintainer workflow — scenarios D/E (MEV ordering, FeeRouter→Rabbit booking) remain future work.
@PlasticDigits — verification on `
390f9be` (D + E shipped). picking this up since the original 5/05 checklist only covered A–C.ran the full unittest suite — 34/34 pass in 0.42s. five new tests landing for the D + E surface (`fee_router_five_shares` sum invariant, BPS weight validation, scenario D ordering metrics, scenario E receiveFee Burrow coverage delta, scenario C `warbow_flags_planted` assertion).
ran `PYTHONPATH=. python3 -m ecostrategy --scenario all --seed 42 --out output/ecostrategy_report.json`. all 5 scenarios complete. report has `mirrored_from_contract` (11 entries) and `approximations` (7 entries) — transparency table populated.
scenario D — paired buy-first vs pvp-first branches in a 3600s final window, same seed/pop/horizon. produced different BP leaders (idx 113 buy-first vs 210 pvp-first, `ordering_bp_leader_idx_match=0`) and the steal/revenge counts diverge sharply (`steals_abs_delta=2334`, `revenges_abs_delta=810`, flags relatively stable at `abs_delta=30`). that's the MEV ordering signal i'd expect — when buys fire first the BP economy churns through the window so steals fire freely, when pvp fires first against an early state there's nothing to steal yet.
scenario E — five-sink split sums correctly to gross (15562.59 + 20750.12 + 10375.06 + 0 + 5187.53 ≈ 51875.30 routed). Rabbit slice = 5187.53 = exactly 10% of gross, matches the canonical (3000/4000/2000/0/1000) BPS. inside the Rabbit slice: 4150.02 protocol-booked via receiveFee + 1037.51 burned, which is the 80/20 from `DEFAULT_PROTOCOL_REVENUE_BURN_SHARE_WAD = 0.2e18` in constants. the audit-relevant signal: `burrow_coverage_delta_receive_minus_direct = 0.0022` (positive) — receiveFee booking does cover Burrow incrementally over the direct-sink baseline. that's the H-01 narrative.
cross-checked the canonical five-sink weights — `FEE_SINK_WEIGHTS_BPS_DEFAULT = (3000, 4000, 2000, 0, 1000)` in `ecostrategy/constants.py` matches the contract test fixtures verbatim (`FeeRouter.t.sol:32`, `:99`, `:107`, `AccessControlZeroAdmin.t.sol:44`, `FeeRouterInvariant.t.sol:61`). launch anchor 1275/1000 in constants matches `
f76454c` from #158. burn share 0.2 WAD matches the docstring.A–C numbers stayed sane post-refactor: A 30 steals (early-believer cohort no-WarBow context), B 0 steals (no PvP phase, highest gini 0.387 from the 1.25× cluster stack), C 2354 steals. D buy-first 2356 lines up tightly with C — same WarBow engine on both code paths, sanity check passed.
two notes worth flagging — neither blockers:
D + E look good. ready for close on your side once you're happy.
mentioned in issue #167
mentioned in issue #169
@PlasticDigits — heads up, found a real issue in scenario D after a follow-up review pass that I missed in my earlier PASS on
390f9be. filed separately as #169.tldr:
after_tickis built once atscenarios.py:448and passed to both buy_first and pvp_first runs. the closure carries mutablenonlocal leader_guardedstate — after buy_first sets it to True, pvp_first cannot guard the leader at all. observable in the report I posted earlier:buy_first_warbow_guards: 1vspvp_first_warbow_guards: 0.consequence on the metrics I cited as PASS evidence:
pvp_first_warbow_stealsand_revengesare inflated by guard-state pollution, not pure ordering effectordering_*_abs_deltametrics still reflect a real ordering signal but with a guard-asymmetry contribution mixed inordering_bp_leader_idx_match=0(different leaders emerged) survives as evidence of ordering-sensitive behavior, just not as cleanly attributable as I claimedD + E remain interpretable as upper-bound ordering risk indicators, but D is not the clean A/B I described. apologies for the miss — the test suite at
test_ecostrategy.py:94-99does not assert guard parity between the two runs, which is what would have caught it. coverage gap noted in #169.still happy with E + the A-C numbers + the FeeRouter five-sink invariants from the original PASS. just wanted to surface the D issue before close.
mentioned in commit
13a1ccfea4