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

No Contract Code after deployment #186

Open
Singh48 opened this issue Mar 22, 2021 · 5 comments
Open

No Contract Code after deployment #186

Singh48 opened this issue Mar 22, 2021 · 5 comments

Comments

@Singh48
Copy link

Singh48 commented Mar 22, 2021

I was following the steps mentioned in the ethereum to ethereum architecture section in the wiki at this link

I was able to deploy Ion.sol as well as the validation.sol but EthereumStore.sol on deployment shows "no code after deployment".
image

I have used a local geth blockchain and ion-cli to carry out the following procedures:

  • connected ion-cli to the local blockchain
connectToClient http://localhost:<port no.>
addAccount acc <path to keystore>
addContractInstance ion <path to Ion.sol>
deployContract ion acc 1000000
  • on doing the above it asks for parameter id, to which I provide the chain id of the blockchain as mentioned in the wiki and the address of the deployed contract is returned.
  • providing the above address while deploying the EthereumStore.sol contract gives the message "no contract code after deployment"
    image

please help @Shirikatsu

@maxrobot
Copy link
Contributor

@Singh48

"no code after deployment".

I think this might be caused by the deployment exceeding the block gas limit or running out of gas.

Consider,

  1. using ganache with very high block gas limit
  2. increasing the amount of gas you send with the transaction

@Singh48
Copy link
Author

Singh48 commented Mar 23, 2021

@maxrobot thanks for the quick response. Following your advice, I modified my genesis.js file, increasing the gas limit to 1012 and supplying 107 amount of gas while deploying the EthereumStorage.sol from the ion-cli and was successful in doing so.

Next, Help needed:
Can you please let me know a way to call the functions of the validation contract (Clique.sol) from the ion-cli itself. The functions being the next steps (Step 3,4) in setting up the receiving end of the interoperating blockchains, namely:

function register() public returns (bool) {
        ion.registerValidationModule();
        return true;
    }

and

function RegisterChain(bytes32 _chainId, address[] memory _validators, bytes32 _genesisBlockHash, address _storeAddr) public {
        require( _chainId != ion.chainId(), "Cannot add this chain id to chain register" );

        if (chains[_chainId]) {
            require( !m_blockhashes[_chainId][_genesisBlockHash], "Chain already exists with identical genesis" );
        } else {
            chains[_chainId] = true;
            ion.addChain(_storeAddr, _chainId);
        }

        setGenesisBlock(_chainId, _validators, _genesisBlockHash);
    }

@Shirikatsu
Copy link
Contributor

https://github.com/clearmatics/ion-cli

Take a look at the docs here.

What you're looking for is the addContractInstance command that allows you to compile an instance of a contract which then allows you to call functions.

@Singh48
Copy link
Author

Singh48 commented Mar 26, 2021

@Shirikatsu, thanks for the reply.
I have added the contract instances of the contracts following the steps provided in ion-cli's repo, which I have mentioned in my issue statement.
I wanted to know whether calling functions from the ion-cli itself is possible or not after the required contract has been added and deployed.
If yes how?
Thanks in advance.

@Shirikatsu
Copy link
Contributor

Use the transactionMessage command in the ion-cli to do this.

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

No branches or pull requests

3 participants