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

Upgrade EVM for better compatibility with ETH ecosystem #548

Closed
hayeah opened this issue Apr 20, 2018 · 11 comments
Closed

Upgrade EVM for better compatibility with ETH ecosystem #548

hayeah opened this issue Apr 20, 2018 · 11 comments
Labels
P2-NiceToHave Not anything absolutely needed, but is a good task that'd be nice to complete requires-fork Doing this requires a soft or hard fork to the Qtum blockchain
Milestone

Comments

@hayeah
Copy link
Contributor

hayeah commented Apr 20, 2018

The popular OpenZeppelin contracts can't run on QTUM's EVM. Two instructions are missing:

  • returndatasize
  • returndatacopy

There are also upcoming "revert with reason" instruction (EIP 140) that would help a lot with debugging. Toolchains and Solidity will soon have support for this.

@mahuaibo
Copy link

mahuaibo commented May 2, 2018

I have the same problem.
1)returndatasize
2)returndatacopy
The contract does not work properly.

@hayeah
Copy link
Contributor Author

hayeah commented May 2, 2018

Just to add more detail to this problem. returndatasize and returndatacopy are used when a contract calls another contract's method, and uses the return value.

contract A {
  B b;
  function callBar() returns(uint256) {
    return b.bar();
  }
}

contract B {
  function bar() returns(uint256) {
    return 2;
  }
}

@hayeah
Copy link
Contributor Author

hayeah commented May 7, 2018

To follow up further on this issue, we can work around this problem by asking solc to emit code for homestead instead of byzantium:

solc --bin --asm --evm-version homestead Foo.sol

The generated code would avoid using returndatacopy and returndatasize.

Also, beware of the return value truncation issue:

image

bytes, int256, small structs should be ok.

@dwalintukan
Copy link

👍 for upgrading the EVM.

Just tried deploying my compiled contracts which was compiled with the newest solc 0.4.24, but it results in throwing a BadInstruction error.

It compiles and deploys fine on Remix though.

@Earlz
Copy link
Contributor

Earlz commented Jun 1, 2018

An upgraded EVM is planned to be included in the x86 hard fork

@Earlz Earlz added P1-Important Should be completed soon, but no absolute rush requires-fork Doing this requires a soft or hard fork to the Qtum blockchain P2-NiceToHave Not anything absolutely needed, but is a good task that'd be nice to complete and removed P1-Important Should be completed soon, but no absolute rush labels Jun 1, 2018
@Earlz Earlz added this to the x86-Hardfork milestone Jun 1, 2018
@ethgamble
Copy link

ethgamble commented Aug 14, 2018

use my fork of solar, added --evm-version homestead by default

go get -u github.com/ethgamble/solar/cli/solar

@paulofelipe84
Copy link

paulofelipe84 commented Nov 7, 2018

Hi, I just wanted to confirm if I got it right:

As of now, isn't there any way of calling a contract function from another contract in qtum?

@qtum-neil
Copy link
Contributor

Hi, I just wanted to confirm if I got it right:

As of now, isn't there any way of calling a contract function from another contract in qtum?

You can call other contract's functions in Qtum, make sure to compile both contracts with --evm-version homestead

@paulofelipe84
Copy link

Thanks! Is there a way of compiling for that version using Remix?

@paulofelipe84
Copy link

Thanks! Is there a way of compiling for that version using Remix?

Just replying that question, using Remix's compiler version 0.4.21 will do it.

@qtum-neil
Copy link
Contributor

Fixed here: #736

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2-NiceToHave Not anything absolutely needed, but is a good task that'd be nice to complete requires-fork Doing this requires a soft or hard fork to the Qtum blockchain
Projects
None yet
Development

No branches or pull requests

7 participants