GithubHelp home page GithubHelp logo

call causes exponential gas explosion about klab HOT 9 CLOSED

mhhf avatar mhhf commented on June 11, 2024
call causes exponential gas explosion

from klab.

Comments (9)

livnev avatar livnev commented on June 11, 2024

I'm concerned that these can't be algebraically simplified because of the nonlinear / 64

from klab.

mhhf avatar mhhf commented on June 11, 2024

I disagree, see the structure of it and my proposed rule where:

A := (VGas - 17080)
B := 700
C := ((VGas - 17780) - ((VGas - 17780) / 64))
D := 636

the simplified version after the rule applied would be:

((VGas - 17080) - 700) - 636 

which would further simplify

similar stuff can be done to nested #if things.

mr. martin noted tho that we would get problems with the gas analyzer due to this lemma since the gas behaves non-monotonic. But We can recover this information (C) in a different way when we scan all #refund rules.
we need to spend some time on all this :/

from klab.

livnev avatar livnev commented on June 11, 2024

You're right, I didn't see that there was actually repetition there, so the expression can be simplified.

@MrChico is right that the gas analyser works by detecting these / 64 subexpressions and making sure they are all >= 0 to ensure there is no OOG inside of a call.

What if we keep this stuff unsimplified during a run but have the gas analyser apply this simplification to the post-gas, after it has already used the unsimplified / 64 subexpressions for solving?

How do you want to keep track of the #refund rules? I think we discussed once adding a cell to evm-semantics that tracks a list of ending gas expressions in every message call: that would be very useful here...

from klab.

mhhf avatar mhhf commented on June 11, 2024

What if we keep this stuff unsimplified during a run but have the gas analyser apply this simplification to the post-gas, after it has already used the unsimplified / 64 subexpressions for solving?

the whole point of this issue is to supply k with lemmas which reduce the gas DURING a run not after.

the #refund rules could be marked and gathered in the same way we do it with evm steps.
Then depending on what we need we would get either a list of them or a branching tree.

from klab.

livnev avatar livnev commented on June 11, 2024

@mhhf OK, then what we will need is every time the #refund rule is applied, with <gas> GAVAIL </gas>, save the GAVAIL into a list.

from klab.

mhhf avatar mhhf commented on June 11, 2024

@livnev how would you like to receive this?
is an array of json objects containing the arithmetic expression ok?

from klab.

livnev avatar livnev commented on June 11, 2024

@mhhf Yes. And you will keep them in json form right, without printing them?

from klab.

mhhf avatar mhhf commented on June 11, 2024

yep, raw json
looks like the pr is getting merged soon
i'll update klab and evm-semantics right after so you should be able to play around with it on thursday

from klab.

livnev avatar livnev commented on June 11, 2024

I believe we have resolved this with the new lemmas plus the improvements to the solver.

from klab.

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.