This repository has been archived by the owner on Oct 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Implement SSTORE net gas metering in aleth-interpreter #5238
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule evmc
updated
22 files
+1 −1 | .bumpversion.cfg | |
+6 −0 | CHANGELOG.md | |
+3 −3 | CMakeLists.txt | |
+2 −2 | appveyor.yml | |
+2 −2 | bindings/go/evmc/evmc.go | |
+81 −3 | bindings/go/evmc/host.c | |
+4 −4 | bindings/go/evmc/host.go | |
+2 −2 | circle.yml | |
+2 −2 | cmake/HunterConfig.cmake | |
+28 −5 | examples/CMakeLists.txt | |
+0 −218 | examples/capi.c | |
+58 −0 | examples/example.c | |
+36 −13 | examples/example_host.cpp | |
+18 −0 | examples/example_host.h | |
+14 −10 | examples/example_vm.c | |
+1 −1 | examples/example_vm.h | |
+0 −22 | examples/examplevm/CMakeLists.txt | |
+22 −24 | include/evmc/evmc.h | |
+8 −7 | include/evmc/loader.h | |
+15 −17 | lib/loader/loader.c | |
+2 −2 | test/vmtester/CMakeLists.txt | |
+10 −4 | test/vmtester/tests.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of simplicity I got rid of the trick to charge
sstoreSetGas before
set_storage`.To keep it I think we would need to handle pre-Constantinople as an additional special case. In Constantinople we can't know before actually calling
set_storage
whether the change will require DB write, or will be just a dirty write (unless we decide to provide access to "original storage values" to EVM)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I'm not sure if this is much simpler because it turns out we still need to handle Constantinople here differently (difference in the cost of X->X)
Here's the version with Constantinople as a separate case and keeping the old optimization: #5240
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think to be safe we should charge more/less the SLOAD cost, so
sstoreUnchangedGas
is good candidate and handles both pre and post Constantinople cases.We want to make sure the
sstoreUnchangedGas
is the smallest from all SSTORE possible costs. Would be nice to usestd::min
here but it started be aconstexpr
function in C++14.