From 9bd778d72872ad3992496fd3cf3b51c0f5073ce6 Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Thu, 3 Dec 2020 22:33:58 +0100 Subject: [PATCH] Make msg.sender and tx.origin have type address Previously both of them had type address payable. The idea is that anything that is not know to be payable should be non-payable. --- docs/cheatsheet.rst | 4 ++-- libsolidity/ast/Types.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/cheatsheet.rst b/docs/cheatsheet.rst index ef24ebcbd..22ca5cc8e 100644 --- a/docs/cheatsheet.rst +++ b/docs/cheatsheet.rst @@ -90,10 +90,10 @@ Global Variables - ``block.timestamp`` (``uint``): current block timestamp - ``gasleft() returns (uint256)``: remaining gas - ``msg.data`` (``bytes``): complete calldata -- ``msg.sender`` (``address payable``): sender of the message (current call) +- ``msg.sender`` (``address``): sender of the message (current call) - ``msg.value`` (``uint``): number of wei sent with the message - ``tx.gasprice`` (``uint``): gas price of the transaction -- ``tx.origin`` (``address payable``): sender of the transaction (full call chain) +- ``tx.origin`` (``address``): sender of the transaction (full call chain) - ``assert(bool condition)``: abort execution and revert state changes if condition is ``false`` (use for internal error) - ``require(bool condition)``: abort execution and revert state changes if condition is ``false`` (use for malformed input or error in external component) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index e85ff5157..e409e6aa1 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -3838,7 +3838,7 @@ MemberList::MemberMap MagicType::nativeMembers(ASTNode const*) const }); case Kind::Message: return MemberList::MemberMap({ - {"sender", TypeProvider::payableAddress()}, + {"sender", TypeProvider::address()}, {"gas", TypeProvider::uint256()}, {"value", TypeProvider::uint256()}, {"data", TypeProvider::array(DataLocation::CallData)}, @@ -3846,7 +3846,7 @@ MemberList::MemberMap MagicType::nativeMembers(ASTNode const*) const }); case Kind::Transaction: return MemberList::MemberMap({ - {"origin", TypeProvider::payableAddress()}, + {"origin", TypeProvider::address()}, {"gasprice", TypeProvider::uint256()} }); case Kind::ABI: