Running new function in upgraded contract causes revert in tutorial

Hi,

I am looking to convert the upgradeable contracts I have written to now be zos compatible.

For starters I am just simply following this tutorial to get familiar with the mechanics: https://docs.zeppelinos.org/docs/upgrading.html

For some reason when I try and run the new ‘increment’ function in the upgraded contract from the truffle console I get:

Error: Returned error: VM Exception while processing transaction: revert

I believe I have followed the tutorial exactly so not sure what is causing that issue?

Cheers
Rick

3 Likes

I ran through the tutorial and didn’t get the same issue that you are having when I ran myContract.increment()

Suggest you check the address that you specified in truffle console:

https://docs.zeppelinos.org/docs/upgrading.html
Make sure you replace with the address of the upgradeable instance your created of MyContract . This address was returned by the create command we ran in the previous section, which is the same as the one returned by the update command we ran above.

truffle(local)> myContract = await MyContract.at('<your-contract-address>')

Also when you setup the session, use a ganache account which isn’t the first one.

How to create an upgradeable smart contract using ZeppelinOS — example of fixing smart contract vulnerable to underflow/overflow attacks
npx zos session --network local --from 0x9ea26a91A3eF090498827989d17FC0E7eEA0987f --expires 3600
Remember to replace the address after --from flag with one of your Ganache accounts, but do not use the first one ( account[0] ). I usually choose the second ( accounts[1] ) or the last one (accounts[9]). You should also use network specified in your truffle-config.js (in our case it is local ).

1 Like

Hey @roy.batty. Can you try to set gas value to really high value? Also which versions of ganache-cli, zos and truffle do you use?

2 Likes

Thanks @abcoathup - I was using the Ganache first account. Switching to the second one fixed the issue. Can I suggest you add a note to the tutorial documentation as I am sure this would catch a few people out :slight_smile:

Cheers
Rick

1 Like

Thanks @ylv-io - changing the Ganache account fixed the issue, as suggested by @abcoathup

1 Like

Thanks @roy.batty I have created a new issue https://github.com/zeppelinos/zos/issues/898 for this.

The documentation is on GitHub, you are welcome to create issues for any improvements that can be made.

1 Like