Skip to content

test: add deployment of connector V2 to e2e test #3975

Merged
kingpinXD merged 10 commits intodevelopfrom
connector-v2-setup
Jun 18, 2025
Merged

test: add deployment of connector V2 to e2e test #3975
kingpinXD merged 10 commits intodevelopfrom
connector-v2-setup

Conversation

@kingpinXD
Copy link
Member

@kingpinXD kingpinXD commented Jun 12, 2025

Description

Closes #3974

This is the intial PR for a set of PR to migrate to V2 Connector contracts

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • New Features

    • Added support for deploying and initializing a new native connector contract in the end-to-end (E2E) test suite.
    • Introduced a new command-line flag to enable v2 connector migration tests in local E2E runs.
  • Bug Fixes

    • Improved error reporting for protocol version 2 transactions by including specific revert errors in outbound validation.
  • Tests

    • Documented the addition of v2 connector deployment in the E2E test suite under a new "Test" section in the changelog.
  • Chores

    • Updated protocol contract dependencies to the latest version.
    • Refined import statements and minor formatting for consistency.

@kingpinXD kingpinXD changed the title test : add deployment of connector V2 to e2e test test: add deployment of connector V2 to e2e test Jun 12, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 12, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The changes introduce deployment and initialization of the ZetaConnectorNative contract within the end-to-end (e2e) test suite. This includes updates to configuration structures, runner logic, contract deployment routines, and related imports. Additionally, a new test flag is added for v2 connector migration tests, and the changelog is updated to reflect these test enhancements.

Changes

Files/Paths Change Summary
e2e/runner/setup_evm.go, e2e/runner/runner.go, cmd/zetae2e/config/contracts.go Added deployment, initialization, and configuration for ZetaConnectorNative contract in E2E runner.
e2e/config/config.go Added ConnectorNativeAddr field to EVM contracts configuration struct.
cmd/zetae2e/local/local.go Introduced new flag for v2 connector migration tests; placeholder for test logic.
go.mod Updated protocol-contracts dependency; made gjson a direct dependency.
contrib/rpctest/main.go, e2e/runner/legacy_setup_evm.go Refactored import statements to remove aliases for protocol contract packages.
e2e/e2etests/e2etests.go Minor formatting cleanup (removed extraneous newline).
x/crosschain/keeper/cctx_orchestrator_validate_outbound.go Improved error reporting by passing actual error to error message generator.
x/fungible/keeper/evm_gateway.go Changed called contract method from depositAndRevert to depositAndRevert0.
changelog.md Added entry for new test feature: deployment of v2 connector in e2e tests.

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner
    participant EVM
    participant ZetaConnectorNative
    participant Proxy

    TestRunner->>EVM: Deploy ZetaConnectorNative implementation
    EVM-->>TestRunner: Return deployment receipt & ABI
    TestRunner->>EVM: Encode initializer data (gateway, ZetaETH, TSS, account)
    TestRunner->>EVM: Deploy ERC1967 proxy with initializer data
    EVM-->>TestRunner: Return proxy deployment receipt
    TestRunner->>Proxy: Bind contract instance at proxy address
    TestRunner->>TestRunner: Store ConnectorNativeAddr and ConnectorNative instance
Loading

Assessment against linked issues

Objective Addressed Explanation
Add deployment of the connector native into the current e2e test (#3974)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Improved error reporting in processFailedOutboundObservers (x/crosschain/keeper/cctx_orchestrator_validate_outbound.go) This change is unrelated to the deployment of the connector native in e2e tests.
Changed contract method call from depositAndRevert to depositAndRevert0 (x/fungible/keeper/evm_gateway.go) This update is not part of the connector native deployment objective.
Updated protocol-contracts dependency and made gjson direct (go.mod) Dependency updates are not specified in the linked issue and are out of scope.
Minor formatting cleanup (e2e/e2etests/e2etests.go) Formatting changes are unrelated to the stated objective.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kingpinXD kingpinXD marked this pull request as ready for review June 12, 2025 02:51
@kingpinXD kingpinXD requested a review from a team as a code owner June 12, 2025 02:51
Copy link
Contributor

@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: 3

🧹 Nitpick comments (8)
go.mod (1)

260-260: Run go mod tidy after promoting gjson to a direct dependency

github.com/tidwall/gjson v1.14.4 moved from indirect → direct.
To keep go.sum minimal and reproducible, please run:

go mod tidy

and commit any resulting diff.

x/fungible/keeper/evm_gateway.go (1)

239-243: Verify that depositAndRevert0 exists in the deployed Gateway contract

The selector changed from depositAndRevertdepositAndRevert0. If the on-chain Gateway you invoke does not expose the suffixed version, every revert workflow will fail at the EVM level.

  1. Ensure the new protocol-contracts tag truly renames the method.
  2. Make sure existing migrations redeploy Gateway with the new ABI before this code reaches production.

Optionally extract method names into typed constants to avoid silent typos:

-       "depositAndRevert0",
+       gatewayMethodDepositAndRevert0,

where const gatewayMethodDepositAndRevert0 = "depositAndRevert0".

changelog.md (1)

22-24: Header wording / spacing inconsistent with the rest of the changelog

Other sections use ### Tests; this entry introduces ### Test (singular, trailing space).
For consistency and better Markdown rendering, consider:

-### Test 
+### Tests
e2e/config/config.go (1)

169-178: Add ConnectorNativeAddr to default config (and docs) for completeness

The new field is missing from DefaultConfig() and therefore from the auto-generated contracts.toml produced by WriteConfig.
Including a placeholder (empty string is fine) avoids silent "" YAML drops and helps users discover the option.

@@
 		EVM: EVM{
 			ERC20: "0xff3135df4F2775f4091b81f4c7B6359CfA07862a",
+			ConnectorNativeAddr: "",
 		},
e2e/runner/runner.go (1)

32-35: Suspicious triple-n alias ‑ likely a typo

zetaconnnectornative (3 × “n”) is easy to mis-type and inconsistent with the package name zetaconnectornative.
While legal, it reduces greppability and deviates from the aliasing style used elsewhere (zetaconnectoreth, connectorzevm, …).

-import zetaconnnectornative "github.com/zeta-chain/protocol-contracts/pkg/zetaconnectornative.sol"
+import zetaconnectornative "github.com/zeta-chain/protocol-contracts/pkg/zetaconnectornative.sol"

Remember to update the references below (zetaconnnectornative.ZetaConnectorNativezetaconnectornative.ZetaConnectorNative).

cmd/zetae2e/config/contracts.go (1)

170-178: Happy path looks good – consider early-return guard

The block cleanly instantiates the native connector when present.
Optionally, add a short-circuit if conf.Contracts.EVM.ConnectorNativeAddr == "" {} early in the function (similar to other setters) to keep the main path lean; not blocking.

e2e/runner/setup_evm.go (2)

12-13: Alias typo hinders readability
zetaconnnectornative (three “n”) is easy to mis-type later. Prefer a deliberate alias, e.g. connectornative, to reduce cognitive load.


121-154: Verbose variable names & duplicate “n” – propose cleanup

The new block deploys the native connector but introduces highly repetitive names and a triple-n spelling that propagates through every identifier.

-	zetaConnnectorNativeAddress, txZetaConnnectorNativeHash, _, err := zetaconnnectornative.DeployZetaConnectorNative(
+	connectorNativeImpl, txConnectorNative, _, err := connectornative.DeployZetaConnectorNative(

…and downstream:

-	zetaConnnectorNativeABI, err := zetaconnnectornative.ZetaConnectorNativeMetaData.GetAbi()
+	connectorNativeABI, err := connectornative.ZetaConnectorNativeMetaData.GetAbi()

Adopting concise names (connectorNativeImpl, connectorNativeProxy) makes the section far easier to scan without altering functionality.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d69ef1 and 21172b3.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (12)
  • changelog.md (1 hunks)
  • cmd/zetae2e/config/contracts.go (2 hunks)
  • cmd/zetae2e/local/local.go (4 hunks)
  • contrib/rpctest/main.go (1 hunks)
  • e2e/config/config.go (1 hunks)
  • e2e/e2etests/e2etests.go (0 hunks)
  • e2e/runner/legacy_setup_evm.go (1 hunks)
  • e2e/runner/runner.go (2 hunks)
  • e2e/runner/setup_evm.go (2 hunks)
  • go.mod (2 hunks)
  • x/crosschain/keeper/cctx_orchestrator_validate_outbound.go (1 hunks)
  • x/fungible/keeper/evm_gateway.go (1 hunks)
💤 Files with no reviewable changes (1)
  • e2e/e2etests/e2etests.go
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.go`: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

**/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

  • contrib/rpctest/main.go
  • x/fungible/keeper/evm_gateway.go
  • x/crosschain/keeper/cctx_orchestrator_validate_outbound.go
  • e2e/runner/legacy_setup_evm.go
  • e2e/runner/runner.go
  • e2e/config/config.go
  • cmd/zetae2e/config/contracts.go
  • e2e/runner/setup_evm.go
  • cmd/zetae2e/local/local.go
🧬 Code Graph Analysis (1)
cmd/zetae2e/config/contracts.go (1)
e2e/config/config.go (2)
  • Contracts (128-134)
  • EVM (168-178)
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: build-zetanode
  • GitHub Check: test-sim-after-import / sim
  • GitHub Check: test-sim-import-export / sim
  • GitHub Check: test-sim-fullappsimulation / sim
  • GitHub Check: test-sim-nondeterminism / sim
  • GitHub Check: lint
  • GitHub Check: gosec
  • GitHub Check: build-and-test
  • GitHub Check: analyze (go)
  • GitHub Check: build
🔇 Additional comments (7)
go.mod (1)

53-54: Confirm contract-interface compatibility after the protocol-contracts upgrade

The jump to v1.0.2-athens3.0.20250603154140-a2b6c07814ed likely carries new ABIs (e.g. the recently-added depositAndRevert0/depositAndCall0 entry points).
Please compile the full node, run the E2E suite, and double-check that:

  1. All keeper calls (CallDepositAndCallZRC20, CallDepositAndRevert, …) map to existing functions in the generated Go bindings.
  2. Event topics used elsewhere remain unchanged.

Failing to do so will surface only at runtime with cryptic “function selector not found” reverts.

contrib/rpctest/main.go (1)

20-21: Alias removal looks good

Dropping the explicit zetaeth alias keeps the reference identifier unchanged (package name is already zetaeth), so compilation behaviour is identical while reducing noise.

e2e/runner/legacy_setup_evm.go (1)

11-12: Alias removal is fine – nothing to flag.
The import path change compiles and improves consistency with the rest of the codebase.

x/crosschain/keeper/cctx_orchestrator_validate_outbound.go (1)

240-241: Good catch – revert error is now propagated.

Surfacing the concrete err instead of nil greatly improves observability when debugging failed V2 reverts.

cmd/zetae2e/local/local.go (2)

58-59: Flag constant looks good
The addition of flagTestV2ConnectorMigration is consistent with the existing naming pattern.


102-103: Flag is registered correctly
The flag is wired into Cobra with a precise help string.

e2e/runner/setup_evm.go (1)

170-172: Missing receipt check after uncommenting SetConnector

When the call above is restored, add:

ensureTxReceipt(txSetConnector, "Set connector in Gateway failed")

@codecov
Copy link

codecov bot commented Jun 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.82%. Comparing base (1c26283) to head (63613a0).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3975      +/-   ##
===========================================
+ Coverage    64.74%   64.82%   +0.08%     
===========================================
  Files          474      474              
  Lines        34809    34809              
===========================================
+ Hits         22536    22566      +30     
+ Misses       11223    11192      -31     
- Partials      1050     1051       +1     
Files with missing lines Coverage Δ
...hain/keeper/cctx_orchestrator_validate_outbound.go 88.41% <100.00%> (ø)
x/fungible/keeper/evm_gateway.go 51.16% <100.00%> (+17.44%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kingpinXD kingpinXD requested a review from lumtis June 12, 2025 17:37
Copy link
Contributor

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

Looks good

@kingpinXD kingpinXD requested a review from ws4charlie June 13, 2025 14:52
@kingpinXD kingpinXD enabled auto-merge June 13, 2025 15:17
@kingpinXD kingpinXD added this pull request to the merge queue Jun 13, 2025
@github-actions github-actions bot added the MERGE_FAILED Merge Queue CI failed label Jun 13, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 13, 2025
@kingpinXD kingpinXD enabled auto-merge June 17, 2025 17:00
@kingpinXD kingpinXD added this pull request to the merge queue Jun 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 17, 2025
@kingpinXD kingpinXD added this pull request to the merge queue Jun 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 17, 2025
@kingpinXD kingpinXD enabled auto-merge June 17, 2025 20:02
@kingpinXD kingpinXD added this pull request to the merge queue Jun 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 17, 2025
@kingpinXD kingpinXD added this pull request to the merge queue Jun 17, 2025
Merged via the queue into develop with commit 5a10a4c Jun 18, 2025
47 checks passed
@kingpinXD kingpinXD deleted the connector-v2-setup branch June 18, 2025 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking:cli MERGE_FAILED Merge Queue CI failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add deployment of connector native into the current e2e tests

4 participants