Skip to content

test: add E2E lifecycle tests and Robinhood fork tests - #21

Merged
RunTimeAdmin merged 2 commits into
masterfrom
cursor/e2e-fork-tests-c058
Sep 8, 2026
Merged

test: add E2E lifecycle tests and Robinhood fork tests#21
RunTimeAdmin merged 2 commits into
masterfrom
cursor/e2e-fork-tests-c058

Conversation

@RunTimeAdmin

Copy link
Copy Markdown
Owner

Summary

Closes the main testing gaps identified in the readiness review before mainnet:

  1. End-to-end path covering register → stake → attest → epoch → slash → zero-reputation
  2. Foundry fork tests against live Robinhood testnet state

Changes

E2E Integration Tests (test/E2E.t.sol)

Comprehensive lifecycle tests covering:

  • Full happy path: Register agent → deposit stake → propose/finalize reputation → initiate/execute slash → verify reputation zeroed
  • Slash dispute: Committee initiates slash → operator disputes within window → agent reinstated
  • Reputation challenge: Committee rejects bad oracle proposal during challenge window → original score preserved
  • Unbonding enforcement: Cannot claim withdrawal before period elapses
  • Slash sweeps queue: Slash confiscates funds even if operator tried to dodge by queuing withdrawal
  • Multiple epochs: Score evolution over time with progressive updates
  • Multiple agents: Independent lifecycle validation
  • Terminal slash: Slashed agents cannot be reactivated

Fork Tests (test/Fork.t.sol)

Validation against live Robinhood testnet (46630) deployment:

  • Verify deployed bytecode at addresses from deployments/46630.json
  • Interface validation (ERC20, Identity, Reputation, Staking)
  • Cross-contract role linkages (Staking has STAKING_CORE_ROLE on Identity/Reputation)
  • Read path smoke tests against live state
  • Simulated write paths using vm.prank without requiring mainnet keys
  • Graceful skip when FOUNDRY_FORK!=1 so CI stays green without external RPC

CI Updates (.github/workflows/ci.yml)

  • Added optional contracts-fork job that runs only when ROBINHOOD_RPC_URL secret is configured
  • External contributors' PRs skip fork tests (main test suite still runs)
  • Maintainers can enable fork validation by adding the secret

Documentation (README.md)

New "Testing" section documenting:

  • Unit tests (default forge test)
  • E2E integration tests (--match-contract E2EIntegrationTest)
  • Fork tests with instructions for running locally with different RPC options

How to Run

Unit + E2E Tests (no external network required)

forge test                        # all tests
forge test --match-contract E2EIntegrationTest -vvv  # just E2E

Fork Tests (requires Robinhood testnet RPC)

# Option 1: foundry.toml alias (rate-limited public RPC)
FOUNDRY_FORK=1 forge test --match-contract ForkTest --fork-url robinhood_testnet -vvv

# Option 2: Alchemy (higher rate limits)
FOUNDRY_FORK=1 forge test --match-contract ForkTest --fork-url https://robinhood-testnet.g.alchemy.com/v2/YOUR_KEY -vvv

Test Results

All 192 tests pass:

  • 9 E2E integration tests ✓
  • 12 fork tests (skipped gracefully without FOUNDRY_FORK=1) ✓
  • Existing unit test suite unchanged ✓
Ran 10 test suites: 192 tests passed, 0 failed, 0 skipped
Open in Web Open in Cursor 

cursoragent and others added 2 commits September 8, 2026 18:04
Add comprehensive test coverage for mainnet readiness:

E2E Integration Tests (test/E2E.t.sol):
- Full agent lifecycle: register → stake → attest → epoch → slash → zero-reputation
- Slash dispute path with agent reinstatement
- Reputation challenge (committee rejection during window)
- Unbonding period enforcement
- Slash sweeping unbonding queue (dodge prevention)
- Multiple epochs of score evolution
- Multiple independent agent lifecycles
- Terminal slash state enforcement

Fork Tests (test/Fork.t.sol):
- Validate deployed Robinhood testnet contracts (46630)
- Interface verification for Identity/Reputation/Staking
- Cross-contract role linkage validation
- Read/write path simulation with vm.prank
- Graceful skip when FOUNDRY_FORK!=1 (CI stays green)

CI/Documentation:
- Add optional contracts-fork job requiring ROBINHOOD_RPC_URL secret
- Document test tiers in README (unit/E2E/fork)
- Include running instructions for each test type

Closes testing gaps from readiness review.

Co-authored-by: DC <david@runtimeadmin.com>
GitHub Actions rejects workflows that compare secrets.* in job-level
if conditions. Fix by always running the contracts-fork job but
checking for ROBINHOOD_RPC_URL at step level via env var mapping.
Skips gracefully with a notice when the secret is unavailable.

Co-authored-by: DC <david@runtimeadmin.com>
@RunTimeAdmin
RunTimeAdmin marked this pull request as ready for review September 8, 2026 18:14
@RunTimeAdmin
RunTimeAdmin merged commit b30db21 into master Sep 8, 2026
4 checks passed
@RunTimeAdmin
RunTimeAdmin deleted the cursor/e2e-fork-tests-c058 branch September 8, 2026 18:14
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.

2 participants