Git Product home page Git Product logo

Comments (9)

LayneHaber avatar LayneHaber commented on June 18, 2024 1

Awesome, thanks!

from pure-evm.

armaniferrante avatar armaniferrante commented on June 18, 2024

pure-evm can only execute evm bytecode that computes pure functions, so the code being executed should never read from or modify state.

Are you trying to read contract storage (considering it's a view function)?

from pure-evm.

LayneHaber avatar LayneHaber commented on June 18, 2024

No, the contract storage isn't being read or modified. It could be a pure function, but it would break the interface we are inheriting.

However, this problem persisted even when I used a pure function. Using ethers v5 and solidity 0.6.4 if that helps

from pure-evm.

armaniferrante avatar armaniferrante commented on June 18, 2024

Please attach a minimum reproducible example and I'll take a look.

from pure-evm.

armaniferrante avatar armaniferrante commented on June 18, 2024

Without looking at your code, it seems the problem is that the depth() externality is being called by your code (which would result in the given error, as expected).

I took a quick look at the parity-ethereum/open-ethereum codebase and it looks like it's only called on contract creation or cross contract calls.

So I would guess your bytecode has at least one of those opcodes in it, i.e.,instructions::CREATE | instructions::CREATE2, instructions::CALL | instructions::CALLCODE | instructions::DELEGATECALL | instructions::STATICCALL.

from pure-evm.

LayneHaber avatar LayneHaber commented on June 18, 2024

Sure, here is a simple reproduction. Just install, build, and test and you should see the same failure.

That's interesting. Was chatting with @HeikoFisch about it on our side, and we were thinking it might be due to the usage of sha256 or recover within the pure or view function

from pure-evm.

armaniferrante avatar armaniferrante commented on June 18, 2024

If I recall correctly, all Ethereum "builtin" functions like sha256 and recover execute as cross contract calls at builtin addresses, which would explain the error you're receiving.

from pure-evm.

LayneHaber avatar LayneHaber commented on June 18, 2024

Yeah, they would appear as contract calls in the compiled code.

So even though this is accepted as pure by the EVM it doesn't look like it will work within this library, bummer! Do you have any plans on supporting these precompile calls in the future?

from pure-evm.

armaniferrante avatar armaniferrante commented on June 18, 2024

There's currently no plans for feature development on this project, but I filed a new issue to track this feature request. See #7.

from pure-evm.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.