Skip to content

test(contracts): add bridge integration test against supersim#46

Merged
iap merged 1 commit into
devfrom
test/bridge-integration
May 8, 2026
Merged

test(contracts): add bridge integration test against supersim#46
iap merged 1 commit into
devfrom
test/bridge-integration

Conversation

@iap
Copy link
Copy Markdown
Contributor

@iap iap commented May 8, 2026

Summary

Adds the first integration test for MARKBridgeAdapter. Unit tests mock SuperchainTokenBridge — this test exercises the real predeploy on two supersim L2 forks to verify tokens actually move cross-chain.

Tests added

  • testBridgeToTransfersTokensCrossChain: deploys RYLA + adapter on chain A, calls bridgeTo, verifies tokens burned on A and received on B via supersim auto-relay
  • testBridgeToEnforcesMaxPerTxOnLiveFork: verifies rate limits work against the live bridge

How to run

pnpm dev:supersim  # in a separate terminal
CHAIN_A_RPC_URL=http://127.0.0.1:9545 \
CHAIN_B_RPC_URL=http://127.0.0.1:9546 \
FOUNDRY_PROFILE=integration forge test --match-path 'test/integration/**/*.t.sol' -vv

Scope

  • contracts

Risk

None — test-only addition. Integration tests are excluded from the default Foundry profile and do not run in standard CI.

Summary by CodeRabbit

  • Tests
    • Added integration tests for cross-chain token bridging functionality
    • Tests validate token transfers between chains and transaction limit enforcement on bridge operations

Exercises MARKBridgeAdapter against live SuperchainTokenBridge predeploy
on two supersim L2 forks. Verifies tokens are burned on chain A and
received on chain B via auto-relay, and that rate limits are enforced
on a live fork.

Run with:
  CHAIN_A_RPC_URL=http://127.0.0.1:9545   CHAIN_B_RPC_URL=http://127.0.0.1:9546   FOUNDRY_PROFILE=integration forge test --match-path 'test/integration/**/*.t.sol' -vv
@iap iap requested a review from a team as a code owner May 8, 2026 10:37
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 8, 2026

Review Change Stack

Walkthrough

This PR adds integration tests for the MARKBridgeAdapter contract that validate cross-chain token bridging behavior against live supersim chain forks. The test contract sets up dual-chain forked environments, deploys the RYLA token and bridge adapter, and verifies both successful cross-chain token transfers with burn/receipt assertions and enforcement of per-transaction bridging limits.

Changes

Cross-chain Bridge Integration Tests

Layer / File(s) Summary
Test Harness & Fork Configuration
contracts/test/integration/bridge/MARKBridgeIntegration.t.sol
Environment-based RPC configuration creates forks for two chains, deploys RYLA token and MARKBridgeAdapter on chain A, sets operator permissions, and grants unlimited token allowance to the adapter.
Cross-chain Token Transfer Validation
contracts/test/integration/bridge/MARKBridgeIntegration.t.sol
Test invokes bridgeTo from operator on chain A, verifies operator balance and total supply decrease by the bridged amount, switches to chain B fork, and asserts recipient receives tokens at the same address.
Bridge Limit Enforcement
contracts/test/integration/bridge/MARKBridgeIntegration.t.sol
Test configures maxPerTx limit on chain A and asserts that bridging above the limit reverts with MaxPerTxExceeded().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • trade/mark#24: Modifies MARKBridgeAdapter.bridgeTo behavior (try/catch, BridgeFailed error, approval reset); these integration tests exercise the bridgeTo call path including token burn behavior.
  • trade/mark#26: Adds unit tests for setBridgeLimits and epoch state reset; this integration test configures bridge limits and validates maxPerTx enforcement across forked chains.

Poem

🐰 Two forks dance across the chain,
Tokens leap without refrain,
Limits hold the flood at bay,
Bridges tested—hip hooray! 🌉✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description covers the summary, tests added, scope, and risk assessment. However, it omits several template sections: Verification checklist items, Risk Review checklist items, Governance checklist items, and Linked Context. Complete the PR description by filling out the remaining checklist sections from the template, particularly Verification and Governance items, to fully comply with the repository's standards.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding a bridge integration test against supersim. It is directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/bridge-integration

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@contracts/test/integration/bridge/MARKBridgeIntegration.t.sol`:
- Around line 74-79: Before asserting recipient balance on chain B, confirm the
token contract is actually deployed there: after vm.selectFork(forkB) compute
the token address (tokenOnB / address(token)) and assert its code size > 0
(e.g., using address.code.length or extcodesize) so the test fails clearly if
the token is missing; then proceed to call RYLA(tokenOnB).balanceOf(recipient)
and assert equality with amount. Ensure the assertion message names the
token/address and explains the deployment check (e.g., "token contract not
deployed on chain B at tokenOnB").
- Around line 19-31: Introduce a new state variable destChainId in the test
contract and initialize it once inside setUp() instead of reading it from the
environment multiple times; update setUp() to read the environment variable once
and assign to destChainId, then remove the duplicate env reads in the test
functions (replace any direct env reads with the destChainId variable) so tests
use the single source of truth; locate usages around MARKBridgeIntegration tests
referencing destChainId and adjust them to use the new state variable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f4db0f57-335f-4770-8c00-f6983cdf7568

📥 Commits

Reviewing files that changed from the base of the PR and between 79a9295 and cdca393.

📒 Files selected for processing (1)
  • contracts/test/integration/bridge/MARKBridgeIntegration.t.sol

Comment thread contracts/test/integration/bridge/MARKBridgeIntegration.t.sol
Comment thread contracts/test/integration/bridge/MARKBridgeIntegration.t.sol
@iap iap merged commit d3ea0f5 into dev May 8, 2026
19 checks passed
@iap iap deleted the test/bridge-integration branch May 8, 2026 10:45
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