This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
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.
Doesn't it open up an attack vector then? The comment clearly states that only top level calls should be traced, currently the workaround is to just send 1 wei with them, which seems pretty cheap.
Also I would simplify it to:
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.
@tomusdrw I'm a little bit confused here: isn't CALL/CALLCODE always pays the opcode fee regardless whether it's precompiled contract or not? If gases are properly paid then it's probably not an attack vector any more?
I noticed the original line was written by Gavin Wood before the EIP150 and Homestead hard fork. Given that we fixed most of the CALL gas attack vectors in those two hard forks, and the reasoning above, I actually think we may want to consider remove the
depth == 0
check altogether.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.
Yeah the math also checks out. Consider
0x00..03
and0x00..ff
as two nonexisting accounts, usingbyzantium_test
config, we have:6000600060006000600160ff61fffff1
: CALL to0x00..ff
consumes32421
gases for toplevel (without finalization).60006000600060006001600361fffff1
: CALL to0x00..03
consumes33021
gases for toplevel (without finalization). The additional 600 gases are the base gas for RIPEMD160.So I think it's safe to remove
depth == 0
check altogether.