question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug when using `--hardfork istanbul`

See original GitHub issue

Expected Behavior

The code

array.push(variable);
array.push(variable);

should work for Istanbul.

Current Behavior

We have smart contracts with complex unit tests and use ganache-cli along with truffle. Everything works fine if we don’t use --hardfork istanbul even for 6.8.0-istanbul.0, but when we activate the istanbul, there is a pretty weird bug.

Steps to Reproduce

$ git clone -b ganache-istanbul-bug https://github.com/poanetwork/posdao-contracts
$ cd posdao-contracts
$ npm i
$ npm run test

After that, the unit tests are run. On the step staking epoch trufflesuite/ganache-cli#3 finished you will see revert failure:

image

This is the line in test/BlockRewardAuRa.js which calls BlockRewardAuRa.reward function which in turn calls ValidatorSetAuRa.newValidatorSet function.

The ValidatorSetAuRa.newValidatorSet function calls the internal _setPendingValidators function. And that _setPendingValidators reverts here:

// This reverts for some reason:
// _stakingAddresses.length == 4 here and gas is enough
for (uint256 i = 0; i < _stakingAddresses.length; i++) {
    _pendingValidators.push(_stakingAddresses[0]);
}

If we remove the --hardfork istanbul flag from our cli parameters, the test works fine as it should.

Please, take a look at these lines (and the comments there): https://github.com/poanetwork/posdao-contracts/blob/b0abf0cfd50bb78894b744f2f5fd6734054a476c/contracts/ValidatorSetAuRa.sol#L787-L808

It seems that the issue somehow relates to these lines which modificate the _pendingValidators array. The bug is only reproduced after those lines are executed in the same block.

Context

This issue doesn’t let us test our contracts for Istanbul.

Your Environment

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
s1nacommented, Nov 8, 2019

But EIP-2200 could only lead to an OOG error, right? That would have a different error message.

Unless there’s a bug. I thought EIP-2200 because that seems to be the only istanbul-relevant code that this contract snippet touches.

I recently started to make the VM pass the istanbul state tests in https://github.com/ethereumjs/ethereumjs-vm/pull/607. If there’s a bug in the VM it’ll most likely surface there.

0reactions
gnidancommented, May 5, 2021

Closing for issue maintenance. Let us know if you’re still running into this, and we’ll be happy to re-open. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Everything You Need to Know About The Istanbul Hard Fork
Istanbul is one of the many hard forks of Ethereum 1.x that will take place before Ethereum 2.0. Ethereum's transition from its current...
Read more >
Ethereum's Istanbul hard fork: what happened and why it matters
On December 8, the Istanbul hard fork upgrade was officially activated on the Ethereum blockchain. Here's what happens next.
Read more >
Ethereum's Istanbul Hard Fork Is Now Live - CoinDesk
Another iteration of Ethereum 1.x, Istanbul is the network's eighth hard fork overall with the first code changes being approved in June ...
Read more >
Istanbul Hardfork EIPs - Changing Gas Costs and More
Shortly before the previous Constantinople hardfork a bug was found in EIP-1283. EIP-1283 decreased the gas cost of writing to dirty storage slots...
Read more >
Istanbul Hard Fork — Everything you need to know - Medium
Ethereum co-founder Vitalik Buterin in an interview with The Star said “Scalability is a big bottleneck because the Ethereum blockchain is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found