Skip to content

feat: [E2E] Layers 4/5/6 — System, DSL, and Presets#193

Merged
dhyaniarun1993 merged 33 commits intomainfrom
feat/e2e-layer4-5-6-system-dsl-presets
Apr 14, 2026
Merged

feat: [E2E] Layers 4/5/6 — System, DSL, and Presets#193
dhyaniarun1993 merged 33 commits intomainfrom
feat/e2e-layer4-5-6-system-dsl-presets

Conversation

@sadiq1971
Copy link
Copy Markdown
Member

@sadiq1971 sadiq1971 commented Apr 7, 2026

Summary

  • Adds system/system.go (Layer 4): composes all shims into a single System struct wired via New(ctx, t, manifest)
  • Adds dsl/dsl.go + dsl/helpers.go (Layer 5): high-level ops (RegisterUser, Deposit, ERC20Balance) and polling helpers (WaitForRelayerReady, WaitForCantonBalance, WaitForRelayerTransfer, WaitForIndexerEvent)
  • Adds presets/options.go + presets/presets.go (Layer 6): DoMain(m, opts...) for TestMain and NewFullStack(t) for per-test system access

Test plan

  • go build -tags e2e ./tests/e2e/... compiles cleanly
  • DoMain starts compose stack, resolves manifest, initialises system, runs m.Run(), tears down on exit
  • NewFullStack returns the shared system; fails immediately if DoMain was not called first

Closes #181

sadiq1971 added 10 commits April 2, 2026 02:10
- Add `e2e-deploy` named volume to bootstrap container so the manifest survives until tests read it
- Write `/tmp/e2e-deploy.json` in docker-bootstrap.sh with contract addresses and issuer party IDs
- Add E2E test architecture design doc
…file targets (#178)

- Add tests/e2e/devstack/stack/interfaces.go: Anvil, Canton, APIServer,
  Relayer, Indexer, Postgres interfaces (build tag: e2e)
- Add tests/e2e/devstack/stack/types.go: ServiceManifest, Account,
  AnvilAccount0/1, all request/response/row types, indexer page types
- Add tests/e2e/docker-compose.e2e.yaml: thin include wrapper over root
  docker-compose.yaml; single entry point for E2E test runs
- Extend Makefile with test-e2e, test-e2e-api, test-e2e-bridge,
  test-e2e-indexer targets (stub: "not yet implemented")
Implements issue #181: wires all shims into a composed System, adds
high-level DSL operations (RegisterUser, Deposit, ERC20Balance, WaitFor*),
and provides DoMain/NewFullStack entry points for test packages.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new E2E testing framework for the devstack, providing a DSL for high-level test operations and a system abstraction to manage service shims. The review feedback highlights a critical bug where balance amounts are compared lexicographically and suggests refactoring resource management by removing testing.T dependencies in global setup to prevent leaks. Additionally, it recommends implementing signal-aware context handling to ensure the Docker stack is properly torn down during interruptions.

Comment thread tests/e2e/devstack/dsl/helpers.go Outdated
Comment thread tests/e2e/devstack/dsl/helpers.go
Comment thread tests/e2e/devstack/presets/presets.go
Comment thread tests/e2e/devstack/presets/presets.go Outdated
Comment thread tests/e2e/devstack/presets/presets.go Outdated
Comment thread tests/e2e/devstack/system/system.go
Comment thread tests/e2e/devstack/system/system.go
Comment thread tests/e2e/devstack/system/system.go Outdated
sadiq1971 added 13 commits April 8, 2026 16:59
Introduces NewIndexerStack and NewAPIStack preset constructors so that
test packages only initialise the shims they actually use. DoMain now
stores only the manifest; each New*Stack builds its own system with the
correct t.Cleanup lifecycle.
- helpers.go: fix lexicographic string comparison in WaitForCantonBalance;
  parse amounts as big.Float and compare with Cmp
- system.go: remove *testing.T from New/NewAPISystem; add closeFunc field
  and Close() method on System and APISystem for explicit resource management
- presets.go: use signal.NotifyContext for SIGINT/SIGTERM handling in DoMain;
  Stop with fresh context to avoid cancellation race; register t.Cleanup for
  Close() in NewFullStack and NewAPIStack
@sadiq1971
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request establishes an E2E test framework for the devstack, providing a DSL for test operations, Docker-based service discovery, and specialized stack presets. The review identifies opportunities to reduce code duplication by centralizing the signEIP191 utility and refactoring shared shim initialization logic in the system package. Furthermore, the feedback suggests using the Anvil shim's Close method directly for better encapsulation.

Comment thread tests/e2e/devstack/dsl/helpers.go Outdated
Comment thread tests/e2e/devstack/system/system.go Outdated
Comment thread tests/e2e/devstack/system/system.go Outdated
Comment thread tests/e2e/devstack/system/system.go
Comment thread tests/e2e/devstack/system/system.go Outdated
Comment thread tests/e2e/devstack/system/system.go Outdated
Comment thread tests/e2e/devstack/dsl/helpers.go Outdated
Copy link
Copy Markdown
Contributor

@salindne salindne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think theres something thats a bug, but I may be wrong, left a comment.

@sadiq1971 sadiq1971 requested a review from salindne April 13, 2026 06:23
Base automatically changed from feat/e2e-layer2-shim to main April 13, 2026 17:18
Comment thread tests/e2e/devstack/presets/presets.go Outdated
Comment thread tests/e2e/devstack/dsl/dsl.go
Copy link
Copy Markdown
Contributor

@salindne salindne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple small things, otherwise looks great

@sadiq1971 sadiq1971 requested a review from salindne April 13, 2026 20:22
@dhyaniarun1993 dhyaniarun1993 merged commit cebe089 into main Apr 14, 2026
3 checks passed
@dhyaniarun1993 dhyaniarun1993 deleted the feat/e2e-layer4-5-6-system-dsl-presets branch April 14, 2026 05:57
salindne added a commit that referenced this pull request Apr 15, 2026
* feat: [E2E] bootstrap writes deploy manifest for test discovery (#177)

- Add `e2e-deploy` named volume to bootstrap container so the manifest survives until tests read it
- Write `/tmp/e2e-deploy.json` in docker-bootstrap.sh with contract addresses and issuer party IDs
- Add E2E test architecture design doc

* feat: [E2E] Layer 1 — stack interfaces, types, compose override, Makefile targets (#178)

- Add tests/e2e/devstack/stack/interfaces.go: Anvil, Canton, APIServer,
  Relayer, Indexer, Postgres interfaces (build tag: e2e)
- Add tests/e2e/devstack/stack/types.go: ServiceManifest, Account,
  AnvilAccount0/1, all request/response/row types, indexer page types
- Add tests/e2e/docker-compose.e2e.yaml: thin include wrapper over root
  docker-compose.yaml; single entry point for E2E test runs
- Extend Makefile with test-e2e, test-e2e-api, test-e2e-bridge,
  test-e2e-indexer targets (stub: "not yet implemented")

* used existing types

* used existing types

* added per db dsn

* feat: docker discovry added

* feat: [E2E] Layer 2 — shim implementations

* resolved gemni comments

* removed unused db

* feat: [E2E] Layers 4/5/6 — System, DSL, and Presets

Implements issue #181: wires all shims into a composed System, adds
high-level DSL operations (RegisterUser, Deposit, ERC20Balance, WaitFor*),
and provides DoMain/NewFullStack entry points for test packages.

* feat: [E2E] add IndexerSystem and APISystem subset views

Introduces NewIndexerStack and NewAPIStack preset constructors so that
test packages only initialise the shims they actually use. DoMain now
stores only the manifest; each New*Stack builds its own system with the
correct t.Cleanup lifecycle.

* fix: address Gemini PR #193 review comments

- helpers.go: fix lexicographic string comparison in WaitForCantonBalance;
  parse amounts as big.Float and compare with Cmp
- system.go: remove *testing.T from New/NewAPISystem; add closeFunc field
  and Close() method on System and APISystem for explicit resource management
- presets.go: use signal.NotifyContext for SIGINT/SIGTERM handling in DoMain;
  Stop with fresh context to avoid cancellation race; register t.Cleanup for
  Close() in NewFullStack and NewAPIStack

* lint fixed

* api server to act as ethclient

* fix lint

* optimized

* optimized implementation

* lint fixed

* reolved gemini comments

* e2e test for middleware server

* resolved comments

* feat: [E2E] Layer 2 — token client, error-safe NewCanton, HTTPError, util refactor

* feat: [E2E] Layers 4/5/6 — Canton integration, token ops, WaitForAPIBalance, TestAccounts

* added missing tests

* addressed gemini comment

* party generation on registration

* resolve comment

---------

Co-authored-by: Sebastian Lindner <33971232+salindne@users.noreply.github.com>
salindne pushed a commit that referenced this pull request Apr 16, 2026
* feat: [E2E] bootstrap writes deploy manifest for test discovery (#177)

- Add `e2e-deploy` named volume to bootstrap container so the manifest survives until tests read it
- Write `/tmp/e2e-deploy.json` in docker-bootstrap.sh with contract addresses and issuer party IDs
- Add E2E test architecture design doc

* feat: [E2E] Layer 1 — stack interfaces, types, compose override, Makefile targets (#178)

- Add tests/e2e/devstack/stack/interfaces.go: Anvil, Canton, APIServer,
  Relayer, Indexer, Postgres interfaces (build tag: e2e)
- Add tests/e2e/devstack/stack/types.go: ServiceManifest, Account,
  AnvilAccount0/1, all request/response/row types, indexer page types
- Add tests/e2e/docker-compose.e2e.yaml: thin include wrapper over root
  docker-compose.yaml; single entry point for E2E test runs
- Extend Makefile with test-e2e, test-e2e-api, test-e2e-bridge,
  test-e2e-indexer targets (stub: "not yet implemented")

* used existing types

* used existing types

* added per db dsn

* feat: docker discovry added

* feat: [E2E] Layer 2 — shim implementations

* resolved gemni comments

* removed unused db

* feat: [E2E] Layers 4/5/6 — System, DSL, and Presets

Implements issue #181: wires all shims into a composed System, adds
high-level DSL operations (RegisterUser, Deposit, ERC20Balance, WaitFor*),
and provides DoMain/NewFullStack entry points for test packages.

* feat: [E2E] add IndexerSystem and APISystem subset views

Introduces NewIndexerStack and NewAPIStack preset constructors so that
test packages only initialise the shims they actually use. DoMain now
stores only the manifest; each New*Stack builds its own system with the
correct t.Cleanup lifecycle.

* fix: address Gemini PR #193 review comments

- helpers.go: fix lexicographic string comparison in WaitForCantonBalance;
  parse amounts as big.Float and compare with Cmp
- system.go: remove *testing.T from New/NewAPISystem; add closeFunc field
  and Close() method on System and APISystem for explicit resource management
- presets.go: use signal.NotifyContext for SIGINT/SIGTERM handling in DoMain;
  Stop with fresh context to avoid cancellation race; register t.Cleanup for
  Close() in NewFullStack and NewAPIStack

* lint fixed

* api server to act as ethclient

* fix lint

* optimized

* optimized implementation

* lint fixed

* reolved gemini comments

* e2e test for middleware server

* resolved comments

* feat: [E2E] Layer 2 — token client, error-safe NewCanton, HTTPError, util refactor

* feat: [E2E] Layers 4/5/6 — Canton integration, token ops, WaitForAPIBalance, TestAccounts

* added missing tests

* addressed gemini comment

* added test for relayer

* optimized tests

* resolved gemini comments

* resolve comment

* tk -> demoTk
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.

[E2E] Devstack: Layers 4/5/6 (System + DSL + Presets)

3 participants