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

Witness charging order with limits #502

Merged
merged 38 commits into from
Oct 24, 2024

Conversation

gballet
Copy link
Owner

@gballet gballet commented Sep 24, 2024

This is another take on #495, which doesn't pass the gas usage function as a parameter, but the total amount of gas available. This approach has two advantages:

  1. it doesn't require removing the verkle gas functions, which should simplify mainlining the PR
  2. it returns the gas to be consumed at the call site, which helps with readability (incidentally, there is a change to the UseGas function signature in master for the live tracer, which will make it trickier to handle

The difficulty was distinguishing the gas that is to be charged (consumed), from the gas that is requested (wanted). If wanted > charged then it is known that the contract ran out of gas.

In order to do so

  • The touch* functions are changed to return the consumed and wanted gas. Locations will only be added to the witness if consumed == wanted.
  • The Touch functions change to only return the wanted gas, so that the gas* functions can return it (in order to let the interpreter loop know that the dynamic gas is too much, while only adding locations that were fully paid for to the witness.
  • Calls and contract creation use the consumed < wanted comparison to figure out if the subcall ran out of gas.

@gballet gballet force-pushed the witness-charging-order-with-limits branch 2 times, most recently from caa00f3 to f7db43f Compare September 24, 2024 17:10
@gballet gballet changed the base branch from kaustinen-with-shapella to jsign-witness-fix September 27, 2024 13:20
@gballet gballet force-pushed the witness-charging-order-with-limits branch 2 times, most recently from e220c74 to f2b8d24 Compare October 11, 2024 13:48
@jsign jsign force-pushed the jsign-witness-fix branch from b4b1ff0 to 9635cc1 Compare October 15, 2024 19:06
@gballet gballet force-pushed the witness-charging-order-with-limits branch from 17fd37d to 032e1ab Compare October 22, 2024 11:31
@gballet gballet changed the base branch from jsign-witness-fix to kaustinen-with-shapella October 22, 2024 11:56
@jsign jsign added this to the verkle-gen-devnet-7 milestone Oct 23, 2024
jsign added 20 commits October 23, 2024 17:11
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
.
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
jsign and others added 16 commits October 23, 2024 17:11
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
* ci: new workflows for testing

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* nit

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* ci: fix stable consumption

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* fix

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* more fixes

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* more fixes

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* update tag

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

---------

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Ignacio Hagopian <jsign.uy@gmail.com>

Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
… + system contracts

Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
* fix makeCallVariantGasEIP4762

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* fix

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* fix

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* fix

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* ci: target v0.0.6

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* improve fix

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* add witness gas to "old" gas upon error

Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>

* workflow: remove target branch from list of branches

---------

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
@jsign jsign force-pushed the witness-charging-order-with-limits branch from 5b01f99 to 87408a7 Compare October 23, 2024 20:11
jsign and others added 2 commits October 23, 2024 17:13
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
* fix selfdestruct

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* extcodecopy witness fix

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* blockhash fix

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* run ci

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>

* Apply suggestions from code review

remove diff used for test

* same thing in other file

---------

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
@gballet gballet merged commit 89330e4 into kaustinen-with-shapella Oct 24, 2024
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants