美文网首页
“using tx.orgin would allow mali

“using tx.orgin would allow mali

作者: 马克_唐卡 | 来源:发表于2021-07-05 22:34 被阅读0次

问题:
“using tx.orgin would allow malign contracts to destroy your contract without your permission.”

摘录来自: Andreas M. Antonopoulos. “Mastering Ethereum。” Apple Books.
原因:
调用链:用户-> 合约A -> 合约B。
用户调用合约A,可能只是想普通调用,并不想销毁合约B(假如合约B是由用户创建)。但这时,如果使用 tx.origin 则会返回用户地址,那么合约A 就可以销毁合约B。假如使用 msg.sender, 则返回合约A的地址,这时合约A想销毁合约B是销毁不了的。

相关文章

网友评论

      本文标题:“using tx.orgin would allow mali

      本文链接:https://www.haomeiwen.com/subject/ktcwultx.html