这是麦斯的输出
==== Exception State ====
SWC ID: 110
Severity: Medium
Contract: XXXXXXX
Function name: recipients(uint256)
PC address: 2067
Estimated Gas Usage: 1089 - 1184
An assertion violation was triggered.
It is possible to trigger an assertion violation. Note that Solidity assert() statements should only be used to check invariants. Review the transaction trace generated for this issue and either make sure your program logic is correct, or use require() instead of assert() if your goal is to constrain user inputs or enforce preconditions. Remember to validate inputs from both callers (for instance, via passed arguments) and callees (for instance, via return values).
--------------------
In file: something.sol:42
address payable[] public recipients
--------------------
Initial State:
Account: [CREATOR], balance: 0x0, nonce:0, storage:{}
Account: [ATTACKER], balance: 0x0, nonce:0, storage:{}
Account: [SOMEGUY], balance: 0x0, nonce:0, storage:{}
Transaction Sequence:
Caller: [CREATOR], calldata: , value: 0x0
Caller: [ATTACKER], function: recipients(uint256), txdata: 0xd1bc76a10000000000000000000000000000000000000000000000000000000000000000, value: 0x0以下是相关代码:
address payable[] public recipients;
...
modifier onlyOwner {
require(
msg.sender == owner,
"Only the contract owner can call this function"
);
_;
}
function addRecipient(address payable payee) public onlyOwner {
recipients.push(payee);
}有人能解释为什么调用recipients导致异常吗?我听不懂。我唯一能理解的就是用类型地址给0x0000000000000000000000000000000000000000解码tx数据,这是相关的吗?
发布于 2021-04-14 15:00:21
根据这个问题,应该是假阳性。
https://ethereum.stackexchange.com/questions/96978
复制相似问题