Skip to content

feat(e2e): gateway E2E test infrastructure#28

Open
gilbertsahumada wants to merge 18 commits intoChaosChain:mainfrom
gilbertsahumada:feat/e2e-infrastructure
Open

feat(e2e): gateway E2E test infrastructure#28
gilbertsahumada wants to merge 18 commits intoChaosChain:mainfrom
gilbertsahumada:feat/e2e-infrastructure

Conversation

@gilbertsahumada
Copy link
Copy Markdown
Contributor

@gilbertsahumada gilbertsahumada commented Feb 7, 2026

Summary

End-to-end testing infrastructure that deploys the full ChaosChain stack (Anvil + PostgreSQL + Gateway) via Docker Compose and runs real workflow submissions against actual smart contracts.

For detailed documentation on running tests, environment setup, test accounts, and endpoint coverage, see packages/gateway/test/e2e/README.md.

What's included

  • Dockerized E2E environment: Anvil local blockchain, PostgreSQL, Gateway with real EthersChainAdapter and mock Arweave
  • Setup script (e2e/setup.ts): deploys all contracts, creates a studio, registers 5 agents (3 workers + 2 verifiers)
  • 37 gateway E2E tests across 4 test files covering:
    • Work submission (single-agent and multi-agent with DKG evidence)
    • Score submission (direct mode + commit-reveal mode with Anvil time manipulation)
    • Input validation and error handling
    • On-chain state verification
    • Public API endpoints (work, evidence, studio, reputation, history)
    • Admin API (key lifecycle, seed-demo)
  • Admin signer for registerWork/registerValidatorresolves Question: Gateway workflow design vs contract access control (E2E finding) #26

Bug fixes

  • Workflow engine initial step: WorkflowEngine.createWorkflow() always overwrote record.step with definition.initialStep, ignoring the per-workflow step set by createScoreSubmissionWorkflow(). This prevented commit-reveal mode from working. Fix: record.step = record.step || definition.initialStep
  • RegisterValidatorStep precondition: accepted score_confirmed (direct mode) in addition to reveal_confirmed (commit-reveal mode)
  • Docker timing: docker compose up -d replaced with --wait to prevent setup race conditions

Scope

In scope (tested):

  • All workflow endpoints: work-submission, score-submission (both modes)
  • All public API read endpoints: work, evidence, studio/work, agent/reputation, agent/history, health
  • Admin API: key CRUD lifecycle, seed-demo
  • On-chain verification (getWorkSubmitter, getScoreVectorsForWorker)
  • Commit-reveal with time window manipulation (anvil_impersonateAccount + evm_increaseTime)

Out of scope:

  • API key gating on write endpoints (CHAOSCHAIN_API_KEYS intentionally not set)
  • Rate limiting burst tests
  • Close-epoch in main suite (OOM — works standalone, see README)
  • SDK E2E tests (SDK still on threadRoot/evidenceRoot format)

Observations for future consideration:

  • API key roles (verifier/agent/internal) are stored but not enforced
  • Rate limiting is per-IP only, not per-key
  • POST /admin/seed-demo has no unit tests (covered by E2E only)
  • In-memory key cache means multi-instance deployments won't sync revocations until restart

E2E Results

Suite Tests Passed Skipped
e2e.test.ts 11 11 0
public-api.test.ts 15 15 0
admin-api.test.ts 11 11 0
close-epoch.test.ts 1 0 1
Total 38 37 1

Unit tests: 366 passed, 13 skipped — 54.44% stmts, 72.72% branches, 80.76% functions

Test Plan

cd packages/gateway
yarn e2e:down && yarn e2e:up && yarn e2e:setup && yarn test:e2e
yarn test --coverage

- Introduced docker-compose.e2e.yml for E2E testing environment.
- Added anvil-entrypoint.sh to run Anvil with deterministic accounts.
- Created gateway-entrypoint.sh to wait for addresses.json and run migrations.
- Implemented setup.ts to deploy contracts and write addresses.json.
- Added vitest.e2e.config.ts for E2E test configuration.
- Created E2E tests in packages/gateway/test/e2e for workflow submissions and health checks.
- Updated package.json scripts for E2E testing commands.
- Added .dockerignore and Dockerfile for the gateway package.
- Included helpers.ts for common E2E test functions.
- Added conftest.py and test_e2e.py for Python SDK E2E tests.
…nd update E2E tests for full workflow completion
…te admin signer address handling in GatewayConfig
@SumeetChougule
Copy link
Copy Markdown
Contributor

SumeetChougule commented Feb 11, 2026

What works well
Single E2E environment: one Docker stack + e2e/setup.ts + addresses.json used by both gateway and Python SDK tests.
Admin signer for registerWork / registerValidator (fixes #26) is implemented correctly; agents still sign their own work/score txs.
Direct-mode precondition fix (reveal_confirmed vs score_confirmed) for RegisterValidatorStep is correct.
Coverage is clear: 8 gateway (vitest) + 9 Python SDK (pytest) tests, with e2e/README.md explaining what’s in and out of scope.

@gilbertsahumada gilbertsahumada changed the title Feat/e2e infrastructure feat(e2e): comprehensive E2E test infrastructure with DKG evidence and Public API coverage Mar 4, 2026
@gilbertsahumada gilbertsahumada changed the title feat(e2e): comprehensive E2E test infrastructure with DKG evidence and Public API coverage feat(e2e): comprehensive E2E test infrastructure — 37 tests across workflows, public API, and admin API Mar 7, 2026
@gilbertsahumada gilbertsahumada changed the title feat(e2e): comprehensive E2E test infrastructure — 37 tests across workflows, public API, and admin API feat(e2e): gateway E2E test infrastructure Mar 7, 2026
@gilbertsahumada gilbertsahumada marked this pull request as ready for review March 7, 2026 15:10
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.

Question: Gateway workflow design vs contract access control (E2E finding)

2 participants