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

VM Exception While Processing Revert. #1

Open
droconnel22 opened this issue Mar 18, 2019 · 1 comment
Open

VM Exception While Processing Revert. #1

droconnel22 opened this issue Mar 18, 2019 · 1 comment

Comments

@droconnel22
Copy link

droconnel22 commented Mar 18, 2019

Hello, I am having trouble replicating your work, which overall is great.

I am using Truffle5 and Solc 0.4.23;

I am following along using a basic uint256 operations contract:

`
pragma solidity ^0.4.23;

import "../upgradeable/upgradeable.sol";

contract CalculatorV5 is Upgradeable {
uint256 internal _count;

constructor(uint256 count)public {
    _count = count;
}

function increment(uint256 amount)
    public
    returns (bool)
{
    require(amount > 0, "amount must be positive");
    _count = _count + amount;
    return true;
}

function getCount()
    external
    view
    returns(uint256)
{
    return _count;
}

}

For test using a .js type of tests (vs .sol):

const UpgradeableProxy = artifacts.require('./upgradeable.sol')
const CalculatorV5 = artifacts.require('./CalculatorV5.sol');
const CalculatorV6 = artifacts.require('./CalculatorV6.sol')
contract('Calculator', (accounts) => {
    beforeEach(async () => {     
        calcV5 = await CalculatorV5.new(100);    
        uproxy = await UpgradeableProxy.new(calcV5.address);
        calcV5Proxy =  await CalculatorV5.at(uproxy.address);
        await calcV5Proxy.initialize();
    });
   it('calc v5 should equal 100',async () => {
        let value = await calcV5Proxy.getCount({from:accounts[1]});
       // also tried  let value = await calcV5Proxy.getCount();
     // as well as  let value = await calcV5Proxy.getCount.call();
        assert.equal(value, 100);
    });

When I run it the before each works perfectly, emits the event Initalized, but fails on the test with this vague response:

Contract: Calculator
calc v5 should equal 100:
Error: Returned error: VM Exception while processing transaction: revert

Please let me know if you need more information. Thanks!

@droconnel22
Copy link
Author

Edit: Minor grammar and styling errors.

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

1 participant