Coder Social home page Coder Social logo

Comments (5)

tomw1808 avatar tomw1808 commented on May 18, 2024

I found what causes the difference between the values shown and the values calculated: MSTORE is marked as "W_verylow" in the Yellowpaper (3 gas), shows 3 gas in the remix debugger, but takes up 12 gas on chain. I have released a similar contract on rinkeby, its's the third instruction and pretty obvious: http://rinkeby.etherscan.io/remix?txhash=0xb837a742727706e9b8f57f33477d3b5dfd3959f705f15f041c1ed6357178917b

I'd be very happy if someone can explain it to me before closing the issue. Thank you.

from remix-project.

yann300 avatar yann300 commented on May 18, 2024

That's a bug in Remix:
The cost of MSTORE is 3 gas, but the general cost if the step can be higher if the memory needs to be extended.

from remix-project.

seandotau avatar seandotau commented on May 18, 2024

Thanks for this @yann300 . Could you elaborate under what situation would the memory need to be extended? Is it a linear increase as well? Just curious.

from remix-project.

yann300 avatar yann300 commented on May 18, 2024

this is has been fixed for sometimes.
Sorry for not responding here.
you'll find the information here: https://github.com/wolflo/evm-opcodes/blob/main/gas.md#a0-1-memory-expansion
The following opcodes incur a memory expansion cost in addition to their otherwise static gas cost: RETURN, REVERT, MLOAD, MSTORE, MSTORE8.

from remix-project.

tomw1808 avatar tomw1808 commented on May 18, 2024

@yann300 appreciate it. I already forgot about the issue, been 5 years. Again, really appreciate getting back to it and referencing more information here.

from remix-project.

Related Issues (20)

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.