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

Error: Failed to create portal config while running zkstack ecosystem init --dev #3349

Closed
yasmuru opened this issue Dec 1, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@yasmuru
Copy link

yasmuru commented Dec 1, 2024

πŸ› Bug Report

πŸ“ Description

I'm trying to create a custom zk chain, but after creating the ecosystem and trying to initialise the chain, I'm getting the following error.

● Initializing chain xxx
β”‚
β–  Failed to create portal config
β”‚
β–² 0: Invalid name: please ensure the contract and method you're calling exist! failed to decode empty bytes. if you're using jsonrpc this is likely due to jsonrpc returning 0x in case contract or method don't exist
β”‚
β”” Failed to run command

πŸ”„ Reproduction Steps

I have followed the steps from here https://code.zksync.io/tutorials/custom-zk-chain to create a custom chain.

πŸ€” Expected Behavior

The ecosystem should deploy the contracts

😯 Current Behavior

Getting above error

πŸ–₯️ Environment

Ubuntu 22.04

πŸ“‹ Additional Context

Add any other context about the problem here. If applicable, add screenshots to help explain.

πŸ“Ž Log Output

zkstack ecosystem init --dev

β”Œ   ZK Stack CLI 
β”‚
●  Initializing ecosystem
β”‚  
●  Era observability already setup
β”‚  
β—‡  Installing and building dependencies... done in 27.567574292 secs
β”‚
β—‡  Deploying ecosystem contracts... done in 12.258236448 secs
β”‚
β—‡  Accepting governance... done in 0.755145787 secs
β”‚
β—‡  Accepting governance... done in 0.780022489 secs
β”‚
β—‡  Accepting governance... done in 0.75739115 secs
β”‚
β—‡  Accepting governance... done in 1.068025893 secs
β”‚
β—‡  Accepting governance... done in 0.773003693 secs
β”‚
β—‡  Accepting governance... done in 0.795428637 secs
β”‚
●  Deploying ERC20 contracts
β”‚  
β—‡  Deploying ERC20 contracts... done in 0.808529998 secs
β”‚
●  Initializing chain xxxx
β”‚  
β–   Failed to create portal config
β”‚  
β–²    0: Invalid name: please ensure the contract and method you're calling exist! failed to decode empty bytes. if you're using jsonrpc this is likely due to jsonrpc returning `0x` in case contract or method don't exist
β”‚  
β””  Failed to run command
@yasmuru yasmuru added the bug Something isn't working label Dec 1, 2024
@sanekmelnikov
Copy link
Collaborator

Thank you for reporting an issue!

The error you encountered occurs when specifying a base token address that doesn't exist on L1. This likely happened when you ran zkstack ecosystem create and selected "Custom token" as your base token. Since you were running against a clean reth with no ERC20 tokens deployed, ETH was the only valid base token option.

Here's the easiest way to start a chain with a custom base token:

  1. First create an ecosystem with ETH as base token:
    zkstack ecosystem create (make sure to select ETH as the base token)
  2. Initialize the ecosystem in dev mode to deploy test tokens:
    zkstack ecosystem init --dev
  3. Create a new chain with custom base token:
    zkstack chain create
    (Select your desired custom base token from the automatically shown deployed addresses, and set this chain as default)
  4. Initialize the new chain:
    zkstack chain init

And definitely agree that the error message could have been more descriptive :)

@brucewhine
Copy link

I'm also facing similar issue, how to deploy test tokens in the L1 to make it custom token on the L2. Should I include ERC20 contract in the ecosystem configs ? If so, where shall I add it ?

@yasmuru
Copy link
Author

yasmuru commented Dec 2, 2024

Thanks @sanekmelnikov, that works if we set ETH as base token. For setting up the custom token I've followed this doc: https://code.zksync.io/tutorials/custom-zk-chain/customizing-your-chain.

I've used the governer wallet to deploy the token contract on L1 and used the same address while creating the chain, but when doing
zkstack chain init
getting an insufficient balance error from a different address other than the governor account.

If I send the balance to that account and try again, getting BridgeHubAlreadyRegistered Error

@yasmuru
Copy link
Author

yasmuru commented Dec 6, 2024

@sanekmelnikov Can you help me with this?

@sanekmelnikov
Copy link
Collaborator

sanekmelnikov commented Dec 7, 2024

I went through the tutorial and noticed a confusing part. The issue is that it instructs you to put the ecosystem governor's private key in WALLET_PRIVATE_KEY, but then asks to confirm that the deployer's address (0x36615Cf349d7F6344891B1e7CA7C72883F5dc049) is funded.

The correct wallet to fund is the ecosystem governor's wallet.
Its address is 0x8002cD98Cfb563492A6fB3E7C8243b7B9Ad4cc92
Its private key can be found in my_elastic_chain/configs/wallets.yaml
Not to be confused with the chain's governor, which is located inside my_elastic_chain/chains/....

To check the balance after deploying the token, use the following command:
cast balance --erc20 <0xYOUR_TOKEN_ADDRESS> 0x8002cD98Cfb563492A6fB3E7C8243b7B9Ad4cc92 --rpc-url http://localhost:8545

Also keep in mind that Customizing Your ZK Chain is a continuation of Getting Started with ZK Chains, so all steps from the latter must be completed first.

@yasmuru
Copy link
Author

yasmuru commented Dec 20, 2024

Works. Thanks @sanekmelnikov

@yasmuru yasmuru closed this as completed Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants