Skip to content

[E2E] Tests: Bridge/relayer (deposit + withdrawal) #183

@sadiq1971

Description

@sadiq1971

Context

Second batch of E2E tests covering the bridge/relayer: PROMPT token deposits from Ethereum to Canton, withdrawals from Canton back to Ethereum, and edge cases.

Files to Create

All in tests/e2e/tests/bridge/, all with //go:build e2e.

main_test.go

//go:build e2e

package bridge_test

import (
    "os"
    "testing"

    "github.com/chainsafe/canton-middleware/tests/e2e/devstack/presets"
)

func TestMain(m *testing.M) {
    os.Exit(presets.DoMain(m))
}

deposit_test.go

Test Scenario
TestDeposit_PROMPT_EthereumToCanton Register User1; DSL.Deposit 100 PROMPT; DSL.WaitForCantonBalance(User1, "PROMPT", "100")
TestDeposit_TwoUsers_Independent Register User1 + User2; deposit different amounts; assert each has correct independent balance
TestDeposit_SmallAmount Deposit 1 wei (smallest unit); verify non-zero Canton balance appears

withdrawal_test.go

Test Scenario
TestWithdrawal_PROMPT_CantonToEthereum Deposit then withdraw; WaitForCantonBalance(0); verify Ethereum PROMPT balance restored
TestWithdrawal_PartialAmount Deposit 100, withdraw 40; verify Canton balance = 60, Ethereum balance increased by 40
TestWithdrawal_AfterTransfer Deposit to User1, transfer 50 to User2 (via api-server), User2 withdraws 50

Makefile update

test-e2e-bridge:
	go test -v -tags e2e -timeout 15m ./tests/e2e/tests/bridge/...

Acceptance Criteria

  • make test-e2e-bridge passes green against a running full stack.
  • WaitForCantonBalance uses 30s timeout; withdrawal Ethereum balance checks use Anvil.ERC20Balance directly.
  • Tests are idempotent when run against a fresh stack (no shared mutable state between tests).

Dependencies

Size

M (1 day)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions