-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Implement REVERT (EIP140) #1661
Conversation
I guess it makes sense to make the reversion explicit (in contrast to |
I didn't intend to change |
As per the weekly meeting: |
1c4d1c1
to
82814a5
Compare
This is actually not a breaking change, since |
Haha, you are right! Can you change the documentation about throw and about exceptions (we just modified that some days ago...)? |
f7588ae
to
5707db7
Compare
docs/control-structures.rst
Outdated
@@ -396,7 +396,7 @@ Currently, Solidity automatically generates a runtime exception in the following | |||
#. If your contract receives Ether via a public getter function. | |||
#. If you call a zero-initialized variable of internal function type. | |||
|
|||
Internally, Solidity performs an "invalid jump" when a user-provided exception is thrown. In contrast, it performs an invalid operation | |||
Internally, Solidity performs a revert operation (instruction ``0xfd``) when a user-provided exception is thrown. In contrast, it performs an invalid operation |
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 we shouldn't mention that it won't consume all gas yet. Would need to update documentation after the HF.
Work for future PR:
|
char const* sourceCode = R"( | ||
contract C { | ||
function f() { | ||
revert(); |
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.
Please perform state changes here and check that they are not applied. Otherwise, the test would also succeed for the case where revert
does nothing.
@@ -65,7 +65,9 @@ m_magicVariables(vector<shared_ptr<MagicVariableDeclaration const>>{make_shared< | |||
make_shared<MagicVariableDeclaration>("ecrecover", | |||
make_shared<FunctionType>(strings{"bytes32", "uint8", "bytes32", "bytes32"}, strings{"address"}, FunctionType::Location::ECRecover)), | |||
make_shared<MagicVariableDeclaration>("ripemd160", | |||
make_shared<FunctionType>(strings(), strings{"bytes20"}, FunctionType::Location::RIPEMD160, true))}) | |||
make_shared<FunctionType>(strings(), strings{"bytes20"}, FunctionType::Location::RIPEMD160, true)), | |||
make_shared<MagicVariableDeclaration>("revert", |
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.
Perhaps we should already provide the second overload now?
I'd prefer to merge #1678 first and then update this PR. |
See ethereum/EIPs#206.