10多年的软件开发经验,包括大数据、AI等领域,熟悉Go、Java、Python等语言使用,最近学习rust语言,目前从事技术管理、架构师相关工作

Subscribe to web3zoom


<100 subscribers
<100 subscribers
描述:
在合约继承时,子合约忽视父合约中的“隐藏的”状态变量或者函数逻辑,导致合约整体的执行漏洞。例如,覆盖父合约中的“隐藏变量”, 包含不安全的“隐藏函数”,都可能引起合约系统严重的安全问题。
隐藏变量:
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
contract Parent{
string public status = "Contract Parent";
function getStatus() public view returns(string memory){
return status;
}
}
contract Child is Parent {
string public status = "Contract Child";
}
在solidity 0.5.17 版本中, 子合约继承父合约的status的状态变量。在0.6 版本之上变量隐藏不被允许,编译无法通过。
描述:
在合约继承时,子合约忽视父合约中的“隐藏的”状态变量或者函数逻辑,导致合约整体的执行漏洞。例如,覆盖父合约中的“隐藏变量”, 包含不安全的“隐藏函数”,都可能引起合约系统严重的安全问题。
隐藏变量:
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
contract Parent{
string public status = "Contract Parent";
function getStatus() public view returns(string memory){
return status;
}
}
contract Child is Parent {
string public status = "Contract Child";
}
在solidity 0.5.17 版本中, 子合约继承父合约的status的状态变量。在0.6 版本之上变量隐藏不被允许,编译无法通过。
Share Dialog
Share Dialog
No activity yet