ion icon indicating copy to clipboard operation
ion copied to clipboard

No Contract Code after deployment

Open Singh48 opened this issue 4 years ago • 5 comments

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

Singh48 avatar Mar 22 '21 06:03 Singh48

@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

maxrobot avatar Mar 22 '21 10:03 maxrobot

@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);
    }

Singh48 avatar Mar 23 '21 19:03 Singh48

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.

Shirikatsu avatar Mar 26 '21 11:03 Shirikatsu

@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.

Singh48 avatar Mar 26 '21 16:03 Singh48

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

Shirikatsu avatar Apr 03 '21 16:04 Shirikatsu