monorepo icon indicating copy to clipboard operation
monorepo copied to clipboard

Remove external eth_calls by using a JS-based EVM interpreter

Open snario opened this issue 5 years ago • 17 comments

Calling eth_call for every applyAction and resolve sucks. It is slow.

We can use a JS-based EVM interpreter instead. https://github.com/ethereumjs/ethereumjs-vm offers a runCode method we could use.

There is a subtle problem which is that for some specific apps we allow view functions (e.g., ETHBalanceRefundApp to observe address(multisigAddress).balance). So, those ones need to use eth_call. Maybe you can observe the ABI of the contract and conditionally use eth_call for those.

snario avatar Mar 05 '19 13:03 snario

@ricmoo how's this coming along with ethers? @pkieltyka any ideas?

snario avatar Mar 05 '19 13:03 snario

Still trying to get v5 into public beta, then I’ll start making the EVM public through its experimental package.

ricmoo avatar Mar 05 '19 17:03 ricmoo

Sweet.

snario avatar Mar 05 '19 20:03 snario

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 750.0 DAI (750.0 USD @ $1.0/DAI) attached to it.

gitcoinbot avatar Mar 11 '19 11:03 gitcoinbot

@snario Is this open?

If so, I'd like to take this up.

vyomshm avatar Mar 13 '19 14:03 vyomshm

Yeah, I'd like to specify it better though. Our ideal scenario is that we can take an ethers.Contract and call .functions.<blah> on that object and if blah is a pure function then compute the result locally. @ricmoo mentioned he was working on this, though.

snario avatar Mar 13 '19 18:03 snario

@snario It shows open on Gitcoin. Is it actually open? If it is, I'd like to take it up.

sounak98 avatar Mar 16 '19 13:03 sounak98

Hey @ricmoo can you apply for work on this one since you're already working on it :)

spm32 avatar Mar 19 '19 21:03 spm32

What is the desired timeline for this task? Keep in mind the ABI would require a runtime bytecode in it to use this feature; I’ve been trying to think of a way to integrate pure functions into the ABI for a while.

One other concern I have is any bug in the VM can result in consensus forks between a channel and the chain. What type of operations will be marked pure?

ricmoo avatar Mar 19 '19 22:03 ricmoo

@ricmoo It is non-blocking for us but a big win for the entire Layer 2 ecosystem.

I think a bug in the VM would be just that, a software error that would cause the state channel states to have been signed incorrectly. I think this is the same problem as a a software error in geth or parity VMs right?

Specifically the interface we care most about is function foo(bytes memory, bytes memory) pure returns (bytes memory) however this feature should support function foo(<anything>...) pure returns (<anything>...).

snario avatar Mar 20 '19 15:03 snario

Hey @ricmoo are you still up for taking this one?

spm32 avatar Apr 07 '19 01:04 spm32

Potentially useful: https://github.com/armaniferrante/pure-evm

snario avatar Apr 19 '19 09:04 snario

@snario Any luck with ethereumjs-vm runCall? It should be reliable and kept up-to-date, as its also used by ganache.

subtly avatar Apr 25 '19 04:04 subtly

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 4 months, 3 weeks ago. Please review their action plans below:

1) stevenjnpearce has been approved to start work.

I've already got an implementation working; will write some tests for it and submit.

Learn more on the Gitcoin Issue Details page.

gitcoinbot avatar May 23 '19 20:05 gitcoinbot

@snario I've opened a pull request with an implementation.

StevenJNPearce avatar May 24 '19 01:05 StevenJNPearce

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 750.0 DAI (750.0 USD @ $1.0/DAI) has been submitted by:

  1. @stevenjnpearce

@ceresstation please take a look at the submitted work:

  • PR by @StevenJNPearce

gitcoinbot avatar May 24 '19 18:05 gitcoinbot

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 750.0 DAI (750.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @StevenJNPearce.

Thanks to @hosseinnzmi for their crowdfunded contributions to this bounty.

gitcoinbot avatar Aug 31 '19 06:08 gitcoinbot