Ganache-cli: Upgrade to Byzantium

Created on 16 Oct 2017  路  6Comments  路  Source: trufflesuite/ganache-cli

The EVM used in TestRPC should be updated to Byzantium.

Expected Behavior

TestRPC should support the new opcodes such as REVERT, RETURNDATACOPY and RETURNDATASIZE. Also it should use the new transaction receipt structure.

Current Behavior

Currently it still uses the previous protocol version.

Possible Solution

Upgrade to the new release of ethereumjs-vm.

Context

Right now we cannot test contract code using new features of Byzantium.
This is also especially bad when testing for revert() as geth and TestRPC now have different behaviour.
This means you need separate checks for TestRPC (exception with "invalid opcode") and geth (no exception but status in receipt 1). Ideally the same test code should run on both.

Most helpful comment

New opcodes added by upgrading to ethereumjs-vm v2.3.1 here: trufflesuite/ganache-core#19
Test maintenance for latest solc-js & vm update is here: trufflesuite/ganache-core#27
Addition of status flag in tx receipt is here: trufflesuite/ganache-core#28

The first one has found its way into testrpc v5.0.1 (in NPM under the beta tag, as it hasn't been fully vetted). I'm going to look into @riordant's comment above to see what, if anything, we need to do there. I'll likely release 5.0.2 (again, as a beta) with the status flag, and if other things need to be done for precompiled contracts, I'll push out a 5.0.3.

Finally, once I get a chance to sit down and audit TestRPC for compliance w/ the Byzantium changes, assuming we've covered them all, I'll close this issue.

All 6 comments

Receipt should also contain a status property that indicates whether the transaction succeeded or a throw/revert bubbled up and rolled back the transaction. 0 means failed (state changes rolled back) and 1 means succeeded (state changes retained).

Right now I'm using geth with --dev flag to test locally. https://gist.github.com/eduardonunesp/ec5c88609586988d01c35ebf51756e85

And include support for new precompiled contracts - modexp, alt_bn128_G1_add, alt_bn128_G1_mul & alt_bn128_pairing_product.

New opcodes added by upgrading to ethereumjs-vm v2.3.1 here: trufflesuite/ganache-core#19
Test maintenance for latest solc-js & vm update is here: trufflesuite/ganache-core#27
Addition of status flag in tx receipt is here: trufflesuite/ganache-core#28

The first one has found its way into testrpc v5.0.1 (in NPM under the beta tag, as it hasn't been fully vetted). I'm going to look into @riordant's comment above to see what, if anything, we need to do there. I'll likely release 5.0.2 (again, as a beta) with the status flag, and if other things need to be done for precompiled contracts, I'll push out a 5.0.3.

Finally, once I get a chance to sit down and audit TestRPC for compliance w/ the Byzantium changes, assuming we've covered them all, I'll close this issue.

@riordant it appears that these contracts are already supported in the v5.0.1 beta, thanks to ethereumjs-vm 2.3.1, so no further work is necessary for TestRPC to include this.

That said, I'm going to defer the release formerly known as 5.0.2 until I have a chance to review/accept trufflesuite/ganache-core#21 (shoutout to @mjkoo for his diligence on this one!). This PR comes with a few breaking changes, so this will wind up being 6.0.0, and with any luck I'll have it reviewed & merged to trufflesuite/ganache-core today.

I'll likely also bump ethereumjs-vm 2.3.1 to 2.3.2 in this release as well, as it's said to contain some bugfixes/optimizations. @jwasinger - please pipe up if you feel this would be a mistake.

As for when it'll be released, that's a bit less certain. I'll be traveling a bit tomorrow, but even still I will likely be able to get a TestRPC 6.0.0 out before the end of the week.

I've just released ganache-core 2.0.0, and I expect to be getting TestRPC 6.0.0 out to npm tomorrow morning, EDT. With that in mind, I'm closing this one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lastperson picture lastperson  路  4Comments

mariam-crissi picture mariam-crissi  路  6Comments

kumavis picture kumavis  路  3Comments

axic picture axic  路  5Comments

zatsepinvl picture zatsepinvl  路  5Comments