Problems deploying to Kovan, crash and not asking for initialize function

Hi guys,

Trying to deploy a contract via openzeppelin create i get:

    > Artifacts written to /Users/raul/Development/gitrepos/EthicHub/platform-contracts/build/contracts
    > Compiled successfully using:
       - solc: 0.5.13+commit.5b0b510c.Emscripten.clang
    ? Pick a contract to instantiate EthicHubDepositManager
    ? Pick a network kovan
    Error while validating contract EthicHubDepositManager: Error: Cannot find source data for contract Context (base contract of EthicHubDepositManager). This often happens because either:
    - An incremental compilation step went wrong. Clear your build folder and recompile.
    - There is more than one contract named Context in your project (including dependencies). Make sure all contracts have a unique name, and that you are not importing dependencies with duplicated contract names (for example, openzeppelin-eth and openzeppelin-solidity).
    ✓ Linked dependency @openzeppelin/contracts-ethereum-package 2.3.0
    ✓ Contract EthicHubDepositManager deployed
    All contracts have been deployed
    No AST nodes of type ContractDefinition with id 6122 found.

So it actually deploys a contract to kovan, but does not prompt for initialize function (which we need). This would be less fun in mainnet, since it would spend some Eth.

I tried deleting build folder, even .openzeppelin/kovan.json, same thing happens.

The contract is a GSNRecipient, which I guess is where the Context thing comes

pragma solidity 0.5.13;

import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNRecipient.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IContributionTarget.sol";
import "../storage/EthicHubStorageInterface.sol";

contract EthicHubDepositManager is Initializable, Ownable, GSNRecipient {

Afterwards, since I noted there is an entry with a contract and an address in .openzeppelin/kovan.json
{
“contracts”: {
“EthicHubDepositManager”: {
“address”: “0xD2e9036f4367416958E621bdF96be41C8ef38178”,
“constructorCode”: “60806040526116df806100136000396000f3fe”,
“bodyBytecodeHash”: “d1fca208461a31df0ad1c1508fc820a60c010334f571a8391017eea94aca6f46”,
“localBytecodeHash”: “5051b1f479e5f5255d1a0ca992f0a8fe9878876929dfcadad7b71507ca4a39a2”,
“deployedBytecodeHash”: “5051b1f479e5f5255d1a0ca992f0a8fe9878876929dfcadad7b71507ca4a39a2”,
“types”: null,
“storage”: null
}
},
“solidityLibs”: {},
“proxies”: {},
“manifestVersion”: “2.2”,
“version”: “0.1.7”,
“dependencies”: {
@openzeppelin/contracts-ethereum-package”: {
“package”: “0xB6F8F11b166D526932ee04ffe4D25B810f619E34”,
“version”: “2.3.0”
}
}
}

I tried to use send-tx to call initialize:

➜ platform-contracts git:(test/upgradeability) openzeppelin send-tx
? Pick a network kovan
A contract address must be specified.

Ok, no helpful prompts this time?

Tried with arguments:
➜ platform-contracts git:(test/upgradeability) openzeppelin send-tx --to 0xD2e9036f4367416958E621bdF96be41C8ef38178 --method initialize --args 0x33...,0x022.. -n kovan
Proxy at address 0xD2e9036f4367416958E621bdF96be41C8ef38178 not found.
Which I guess makes sense because the proxy object is empty in kovan.json

Project in:

Any ideas on what is happening?

Thanks in advance!

PS: quick feedback, earlier when trying to deploy it failed silently after picking network in the create prompt. Turns out my dumb ass was using an incorrect Infura URL, but adding a “Network Error” message or similar in the cli would help.

1 Like

Hi @ethicraul,

Looking at your project, it has both:

    "@openzeppelin/contracts": "^2.4.0",
    "@openzeppelin/contracts-ethereum-package": "^2.3.0",

Upgradeable contracts need to use @openzeppelin/contracts-ethereum-package rather than @openzeppelin/contracts.

Also we should use OpenZeppelin Contracts Ethereum Package v2.4 (There was an issue: https://github.com/OpenZeppelin/openzeppelin-contracts-ethereum-package/issues/70 with 2.3)

I suggest:

  • uninstalling @openzeppelin/contracts
  • upgrading to the latest version (2.4) of @openzeppelin/contracts-ethereum-package
  • modify the projects contracts to import from @openzeppelin/contracts-ethereum-package
  • remove build directory and kovan.json

The problem with this is only one contract (EthicHubDepositManager) is upgradeable at the moment, the rest are already deployed as regular old contracts. We are going to migrate the whole thing eventually but wanted to start with this.

Changing the packages forces the other contracts to inherit from

contract Ownable is Initializable, Context {

Which as I understand won’t work with what we have now, since we have to change all constructors to initializes?

Is there a way to keep both?

1 Like

Hi @ethicraul,

OpenZeppelin SDK currently supports upgradeable contracts only.

You may be better off creating a separate project just for the upgradeable contract(s) along with interfaces that you can call the non-upgradeable contracts.

Thanks, we will work around this

1 Like

Please see https://github.com/OpenZeppelin/openzeppelin-sdk/issues/997#issuecomment-565616894 :frowning:

1 Like

Hi @ethicraul,

Support for both upgradeable and non-upgradeable contracts is being worked on, and hoping to have it ready by the end of the year. https://github.com/OpenZeppelin/openzeppelin-sdk/issues/802

1 Like

Hi @ethicraul,

The CLI now supports deploying regular (non-upgradeable) contracts in the release candidate of OpenZeppelin CLI 2.8

Would appreciate if you could give the release candidate a try and let us know what you think!

A post was split to a new topic: Are upgradable and non upgradable contracts in the same truffle project supported?