Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add zetae2e serve-addresses #2393

Closed
wants to merge 1 commit into from
Closed

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Jun 27, 2024

Description

In order for the toolkit to be usable on localnet and developnet, we need to be able to export the contract/tss/zrc20 addresses in the format that is expected. These addresses are not stable between localnet deployments, so we cannot simply export the data once. Add zetae2e serve-addresses command which will serve this data in the correct format.

This PR is currently an POC for feedback. I will need help correctly mapping all the contract addresses from the e2e config format to the format expected by the toolkit. I will coordinate this change with changes across the networks and toolkit repo.

Another way of doing this is to just make all this info available via zetacored RPC or on-chain via EVM calls. That is more complex but is probably the better way to do it right @fadeev? I think we do have most of the info for zetachain already available (TSS, ZRC20), but not addresses of things deployed on external chains. Maybe related to this epic.

I think it would also be useful to add another endpoint which would serve the raw(ish) config to allow you to easily run zetae2e commands locally. So you could do zetae2e run --config http://localhost:9091/v1/zetae2econfig.

Current Output
➜  node git:(e2e-serve-addresses) curl -s localhost:9991/v1/addresses | jq -r
[
  {
    "address": "0xD28D6A0b8189305551a0A8bd247a6ECa9CE781Ca",
    "category": "messaging",
    "chain_id": 1337,
    "chain_name": "eth_localnet",
    "type": "connector"
  },
  {
    "address": "0xff3135df4F2775f4091b81f4c7B6359CfA07862a",
    "category": "omnichain",
    "chain_id": 1337,
    "chain_name": "eth_localnet",
    "type": "erc20Custody"
  },
  {
    "address": "0x239e96c8f17C85c30100AC26F635Ea15f23E9c67",
    "category": "messaging",
    "chain_id": 101,
    "chain_name": "zeta_localnet",
    "type": "connector"
  },
  {
    "address": "0x91d18e54DAf4F677cB28167158d6dd21F6aB3921",
    "category": "omnichain",
    "chain_id": 101,
    "chain_name": "zeta_localnet",
    "type": "systemContract"
  }
]

Relates to:

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Include instructions and any relevant details so others can reproduce.

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

Checklist:

  • TSS Addresses
  • ZRC20 Addresses
  • uniswap Addresses (although I'm not sure we deploy the uniswap contracts on localnet eth)

@gartnera gartnera added the no-changelog Skip changelog CI check label Jun 27, 2024
@gartnera gartnera requested a review from fadeev June 27, 2024 19:34
Copy link
Contributor

coderabbitai bot commented Jun 27, 2024

Important

Review skipped

Review was skipped due to path filters

Files ignored due to path filters (4)
  • cmd/zetae2e/root.go is excluded by none and included by none
  • cmd/zetae2e/serve_addresses.go is excluded by none and included by none
  • contrib/localnet/docker-compose.yml is excluded by none and included by none
  • contrib/localnet/orchestrator/start-zetae2e.sh is excluded by none and included by none

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


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @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.

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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@fadeev
Copy link
Member

fadeev commented Jun 28, 2024

@gartnera addresses.testnet.json is generated automatically by a script that accepts ZetaChain RPC endpoint (mainnet or testnet) and networks for connected chains' RPC. I see no reason why the same script cannot be used to fetch contract addresses for any other environment. We might need to tweak it a bit, but overall I think we should use it as auto-generation is generally more reliable than manually keeping a list up-to-date.

Basically the script first queries ZetaChain RPC for supported chain list, then fetches RPC for each supported chain from the networks package, then makes a bunch of requests to all these RPC to get contract addresses. The only addresses it cannot get dynamically are here.

@fadeev
Copy link
Member

fadeev commented Jun 28, 2024

We should consider storing all contract addresses in the upcoming Gateway contract, which will make this even more streamlined. Right now we're making at least 9 requests per chain to get all addresses.

@gartnera
Copy link
Member Author

gartnera commented Jun 28, 2024

I see no reason why the same script cannot be used to fetch contract addresses for any other environment.

@fadeev because the addresses are not stable on localnet and developnet. The addresses will be different for every copy of localnet. As it stands today, you'd need to do a new release of protocol-contracts and toolkit to update the addresses right?

We should consider storing all contract addresses in the upcoming Gateway contract

I think the new ChainInfo might be the best spot, so long as we only need it via RPC and not EVM.

@fadeev
Copy link
Member

fadeev commented Jun 28, 2024

I think the new ChainInfo might be the best spot, so long as we only need it via RPC and not EVM.

@gartnera from an off-chain program point of view, sure, but if you have a contract on Ethereum that needs to know ZETA token address or something, they can't make a query to an API, so having these addresses on EVM is important.

@fadeev
Copy link
Member

fadeev commented Jun 28, 2024

The addresses will be different for every copy of localnet. As it stands today, you'd need to do a new release of protocol-contracts and toolkit to update the addresses right?

@gartnera we can deploy a nightly (tagged) version of protocol contracts on npm with the latest version of developnet addresses. And you can run this script manually to generate localnet addresses. And modify Toolkit to accept those.

@lumtis
Copy link
Member

lumtis commented Jun 30, 2024

I think the new ChainInfo might be the best spot, so long as we only need it via RPC and not EVM.

@gartnera from an off-chain program point of view, sure, but if you have a contract on Ethereum that needs to know ZETA token address or something, they can't make a query to an API, so having these addresses on EVM is important.

Overall, having a registry contract that the TSS can write into would make the most sense to me for this.

@kingpinXD
Copy link
Contributor

t the TSS can write into would make the most sense to me for this.

I think this is a good idea, but it would mean an additional tx/message on the Zeta core, which initiates this write . We should plan it accordingly .

@lumtis
Copy link
Member

lumtis commented Jul 15, 2024

@gartnera follow up regarding the conoversation with @fadeev

Is this PR still to be merged?

@gartnera gartnera closed this Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:cli no-changelog Skip changelog CI check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants