_Before filing a new issue, please provide the following information._
I'm running:
- Which Parity version?: 1.11.8
- Which operating system?: Linux
- How installed?: docker
- Are you fully synchronized?: yes
- Which network are you connected to?: private
- Did you try to restart the node?: yes
I have a contract with migration mechanism that allows to fix bugs without affecting existing clients. The entire contract:
pragma solidity ^0.4.23;
contract SeasonFactory {
address[] public seasons;
address public newVersionAddress;
function migrateToNewVersion(address newVersionAddress_) public {
require (newVersionAddress == 0);
require (newVersionAddress_ != address(this));
newVersionAddress = newVersionAddress_;
}
function addSeason(address season) public {
if (newVersionAddress != 0) {
SeasonFactory newVersion = SeasonFactory(newVersionAddress);
newVersion.addSeason(season);
return;
}
seasons.push(season);
}
function getLastSeason() public view returns(address) {
if (newVersionAddress != 0) {
SeasonFactory newVersion = SeasonFactory(newVersionAddress);
return newVersion.getLastSeason();
}
return seasons[seasons.length - 1];
}
}
I also have a test:
[Fact]
public async Task Should_MigrateFactory()
{
var factory = await TestHelper.GetFactoryAsync(_output);
await factory.CreateSeasonAsync(TestSeasonAddress);
var newVersion = await TestHelper.GetFactoryAsync(_output);
await factory.MigrateToNewVersionAsync(newVersion.Address);
var lastSeason = await factory.GetLastSeasonAsync();
Assert.Null(lastSeason);
}
It's as C# test but it's quite clear what it does and it completely reprodusable via geth or something similar.
Test pass
Nethereum.JsonRpc.Client.RpcResponseException : VM execution error.
at Nethereum.JsonRpc.Client.RpcClient.HandleRpcError
when calling getLastSeason
This test fails, but only on 1.11.x + (I've checked 1.11.0, 1.11.1, 1.11.8, 2.0.1)
When I change parity version to 1.10.7 it works without any issues.
Thanks for the report. Would you mind testing on v2 ?
@Tbaut Yep, I can confirm that I have the same error on 2.0.1
I also confirm.
False alarm, I was testing without the proper params in my chain. @Pzixel did your private network json contains "eip211Transition": "0x0", under "params" ?
Here is an entire JSON
"params": {
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID": "0x2323",
"gasLimitBoundDivisor": "0x400",
"eip155Transition": 0,
"eip140Transition": 0,
"eip211Transition": 0,
"eip214Transition": 0,
"eip658Transition": 0,
"wasmActivationTransition": 0
}
so it does. Maybe it could be some combination of parameters, such as wasmActivationTransition?
You can run docker-compose up -d on this repo, deploy the contract and see results. It's 100% reproducible. Parity version may be modified via .env file in the repo root.
Nice work on those dockers. I forgot that I modified your contract to run it : switching
return seasons[seasons.length - 1];
to
if (seasons.length > 0) {
return seasons[seasons.length - 1];
} else {
return 0;
}
Indeed when going back to your version it breaks (when thinking about the way solc compile those array it should probably not, but I got to check a bit more).
Same behaviour with remix ide, solidity generate an evm check on lower bound, so I believe my code change makes sense. Can you test with my code change ?
Oh my god, it's indeed off-by-one error. Sorry for botherin you, guys.
So it's the opposite: the old parity VM was accepting the invalid code that new version handles and properly throws an exception. Thank you for your time.
No problem at all :) , I was happy to help (and do a bit of solidity).
Most helpful comment
No problem at all :) , I was happy to help (and do a bit of solidity).