Skip to content

Feat/audit vague3 mainnet app#8

Merged
louis14448 merged 2 commits into
mainfrom
feat/audit-vague3-mainnet-app
Jun 2, 2026
Merged

Feat/audit vague3 mainnet app#8
louis14448 merged 2 commits into
mainfrom
feat/audit-vague3-mainnet-app

Conversation

@louis14448

Copy link
Copy Markdown
Contributor

Add wave 3 — mainnet application security tests (3 e2e + 2 stress)

Adds five tests covering application-level security patterns critical for
mainnet realm authors, and node resilience under adversarial load.

E2E tests

e2e_access_control

Verifies that a guarded realm function correctly rejects calls after a state
lock, and that rejected calls leave state unchanged (callCount stays at 1).
Tests the most common realm pattern for DAOs and governance contracts.

e2e_cross_realm_callback

Verifies that a reentrant callback (a callback that re-enters the host realm)
produces consistent state. Host realm counter must equal 2 after a nested
IncrWithCallback — any other value indicates state corruption.

e2e_storage_metering

Verifies that persisting data consumes gas proportionally:

  • 100KB write with 100k gas → OOG
  • 100B write with 5M gas → success, stored length verified at 100

Without proportional storage metering, an attacker can bloat the state DB for
free.

Stress tests

sybil_oog_spam

N wallets fire 10 transactions each with gas-wanted=1000 (intentionally
insufficient) in parallel. All are rejected. A legitimate transaction must
succeed afterwards — verifying node liveness under rejection load.

sybil_panic_spam

N wallets fire 10 transactions each that trigger a Gno panic in parallel. All
are rejected. A legitimate transaction must succeed afterwards — verifying node
stability under panic-rejection load.

Notes

e2e_access_control uses a flag-based lock pattern instead of
std.GetOrigCaller()import "std" is not recognized on test-13. The
security property tested is identical: a guarded function rejects calls when
not authorized, and rejected calls do not mutate state.

Test results

All five pass on test-13.

…ess)

E2E tests:
- e2e_access_control.sh    — admin-only realm pattern: authorized call accepted,
                             transfer + unauthorized call rejected, state intact
- e2e_cross_realm_callback.sh — reentrant callback safety: counter == 2 after
                             nested IncrWithCallback, no state corruption
- e2e_storage_metering.sh  — storage gas proportional: 100KB OOGs at 100k gas,
                             100B succeeds at 5M gas

Stress tests:
- sybil_oog_spam.sh        — N wallets × 10 under-gassed txs in parallel;
                             legitimate tx succeeds afterwards (node alive)
- sybil_panic_spam.sh      — N wallets × 10 panic-triggering txs in parallel;
                             legitimate tx succeeds afterwards (node alive)
…path on test-13

Replace std.GetOrigCaller()-based admin check with a flag-based lock pattern.
Same security property tested: guarded function rejects calls when locked,
rejected calls don't mutate state (callCount stays at 1).
@louis14448
louis14448 merged commit 2163fbc into main Jun 2, 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.

1 participant