Some notes: #4
Replies: 4 comments
-
|
Review Summary: • Test strategy solid: covers unit → integration → fuzz → adversarial → load/chaos → community. Fixes / Must-Add: •Replace Dec.TruncateInt64() → Dec.TruncateInt().Int64(). TL;DR: |
Beta Was this translation helpful? Give feedback.
-
|
Unit Test Corrections & Improvements Fixes for sample test:
scale := supplyLUNC.Quo(trillion) // sdk.Int
Patch (clamped math): trillion := sdk.NewInt(1_000_000_000_000) prpBlocks := blocksPerDay * (scale.Int64() + 1) Extra unit tests to add: • Fee routing math: 0.35% fee split 50/50 burn vs oracle, with clear rounding rules. |
Beta Was this translation helpful? Give feedback.
-
|
Integration Harness: • Prefer in-process network over shelling out (faster, deterministic). Property / Fuzz Tests: Adversarial / Exploits (assert explicit errors, no side-effects): Simulation & Artifacts (per run): Load / Bench: CI & Tooling: Community / Reporting: TL;DR (merge blockers) |
Beta Was this translation helpful? Give feedback.
-
|
This topic is not really readable. Please see https://github.com/orgs/Market-Module-2-0/discussions/1 for how it should be done for easier communication and handling. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
1 — High level test strategy (why these tests)
2 — Important invariants (things every test must assert)
Every test should also check final on-chain balances, events emitted, and storage state for these invariants.
3 — Unit test examples (Go / Cosmos SDK style)
Below are sample unit tests you can paste into
x/marketmodule/typesorx/marketmodule/keepertest folders. Adapt package names to match repo structure.Add tests for:
0.35%split and 50/50 burn/oracle)4 — Integration test harness (local sim app)
Create a
testutil/simnet/that runs a single-validator chain (or a 3-validator chain) and runs sequences of blocks, oracle votes, and swaps.Create
scripts/run_local_simnet.sh:Integration tests should:
5 — Property/fuzz tests (fuzz parameters to find corner cases)
Use
testing/quickorgo-fuzzto randomly vary:Example with
testing/quick:RunScenarioAndCheckInvariantsshould create a fresh app instance in memory, apply blocks, do swaps, and assert invariants.6 — Attack / adversarial scenarios (concrete sequences to try)
Below are high-value exploit tests and how to simulate them.
Oracle twist + fast front-run
Quorum outage then rapid rejoin
Pool drain via alternating swaps
Gas DOS / Reentrancy / State bloat
Time-warp / Block skip
Stable→stable bypass attempt
Epoch boundary race
For each attack, log full tx traces, keep account balances snapshots, and events emitted. If any assertion fails, produce a minimal reproduction script.
7 — Simulation scenarios (the scenarios from from Prop )
Implement a simulation harness that runs 30-day epoch examples and the three scenarios a/b/c mentioned in README. For each scenario produce:
Suggested outputs:
You can use Go to write these CSV/JSON tracegers. The simulation harness should be deterministic (seedable RNG).
8 — Load test and benchmarks
Example script (bash +
jq):Capture metrics from node logs.
9 — Testnet rollout checklist (when unfork modules are live)
Prepare a testnet branch with deterministic addresses and prefilled tax pools (so testers can reproduce).
Publish a clear guide for testers (how to run tests, sample transactions, expected events).
Launch a bounty sheet: reward for reproducible security bugs, economic exploits, or consensus/halting issues.
Provide a public dashboard that shows:
Provide a
npm/pythonor simple web UI for non-developer community members to execute common swap scenarios and report.10 — Community testing & bug report template
Provide a template
BUG_REPORT.md:11 — Example exploit test implementation (script)
A short Golang test that tries to exploit TWAP windows:
This reveals whether TWAP sanity clamps are effective.
12 — Reporting & artifacts
For each test run produce:
report-<timestamp>.zipcontaining:summary.mdwith “Did it pass invariants? yes/no” and notesFor failing cases: attach minimal reproduction steps and PR that adds a unit test reproducing the failure.
13 — community engagement :
Beta Was this translation helpful? Give feedback.
All reactions