From 0ed27369c7d08e837723834324cde4e3ae3dc66f Mon Sep 17 00:00:00 2001 From: Bernhard Mueller Date: Mon, 26 Nov 2018 22:21:54 +0700 Subject: [PATCH] Pretty-print tests --- .../outputs_expected/calls.sol.o.json | 67 +++- .../outputs_expected/environments.sol.o.json | 68 ++-- .../outputs_expected/ether_send.sol.o.json | 2 +- .../outputs_expected/exceptions.sol.o.json | 104 +++--- .../kinds_of_calls.sol.o.json | 104 +++--- .../multi_contracts.sol.o.json | 32 +- .../outputs_expected/nonascii.sol.o.json | 6 +- .../outputs_expected/origin.sol.o.json | 32 +- .../outputs_expected/overflow.sol.o.json | 31 +- .../outputs_expected/returnvalue.sol.o.json | 19 +- .../outputs_expected/rubixi.sol.o.json | 328 +++++++++--------- .../outputs_expected/suicide.sol.o.json | 19 +- .../outputs_expected/underflow.sol.o.json | 31 +- .../outputs_expected/weak_random.sol.o.json | 88 ++--- 14 files changed, 542 insertions(+), 389 deletions(-) diff --git a/tests/testdata/outputs_expected/calls.sol.o.json b/tests/testdata/outputs_expected/calls.sol.o.json index 874dd89d..1856cba1 100644 --- a/tests/testdata/outputs_expected/calls.sol.o.json +++ b/tests/testdata/outputs_expected/calls.sol.o.json @@ -1 +1,66 @@ -{"error": null, "issues": [{"address": 666, "contract": "Unknown", "debug": "", "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", "function": "thisisfine()", "max_gas_used": 35963, "min_gas_used": 1352, "swc-id": "104", "title": "Unchecked CALL return value", "type": "Informational"}, {"address": 784, "contract": "Unknown", "debug": "", "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", "function": "callstoredaddress()", "max_gas_used": 36007, "min_gas_used": 1396, "swc-id": "104", "title": "Unchecked CALL return value", "type": "Informational"}, {"address": 871, "contract": "Unknown", "debug": "", "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", "function": "_function_0xe11f493e", "max_gas_used": 61043, "min_gas_used": 6432, "swc-id": "104", "title": "Unchecked CALL return value", "type": "Informational"}, {"address": 912, "contract": "Unknown", "debug": "", "description": "This contract executes a message call to an address provided as a function argument. Generally, it is not recommended to call user-supplied addresses using Solidity's call() construct. Note that attackers might leverage reentrancy attacks to exploit race conditions or manipulate this contract's state.", "function": "calluseraddress(address)", "max_gas_used": 616, "min_gas_used": 335, "swc-id": "107", "title": "Message call to external contract", "type": "Warning"}, {"address": 918, "contract": "Unknown", "debug": "", "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", "function": "calluseraddress(address)", "max_gas_used": 35327, "min_gas_used": 1046, "swc-id": "104", "title": "Unchecked CALL return value", "type": "Informational"}], "success": true} \ No newline at end of file +{ + "error": null, + "issues": [ + { + "address": 666, + "contract": "Unknown", + "debug": "", + "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", + "function": "thisisfine()", + "max_gas_used": 35963, + "min_gas_used": 1352, + "swc-id": "104", + "title": "Unchecked CALL return value", + "type": "Informational", + }, + { + "address": 784, + "contract": "Unknown", + "debug": "", + "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", + "function": "callstoredaddress()", + "max_gas_used": 36007, + "min_gas_used": 1396, + "swc-id": "104", + "title": "Unchecked CALL return value", + "type": "Informational", + }, + { + "address": 871, + "contract": "Unknown", + "debug": "", + "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", + "function": "_function_0xe11f493e", + "max_gas_used": 61043, + "min_gas_used": 6432, + "swc-id": "104", + "title": "Unchecked CALL return value", + "type": "Informational", + }, + { + "address": 912, + "contract": "Unknown", + "debug": "", + "description": "This contract executes a message call to an address provided as a function argument. Generally, it is not recommended to call user-supplied addresses using Solidity's call() construct. Note that attackers might leverage reentrancy attacks to exploit race conditions or manipulate this contract's state.", + "function": "calluseraddress(address)", + "max_gas_used": 616, + "min_gas_used": 335, + "swc-id": "107", + "title": "Message call to external contract", + "type": "Warning", + }, + { + "address": 918, + "contract": "Unknown", + "debug": "", + "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", + "function": "calluseraddress(address)", + "max_gas_used": 35327, + "min_gas_used": 1046, + "swc-id": "104", + "title": "Unchecked CALL return value", + "type": "Informational", + }, + ], + "success": true, +} diff --git a/tests/testdata/outputs_expected/environments.sol.o.json b/tests/testdata/outputs_expected/environments.sol.o.json index c5a4b1cd..5cd8f4db 100644 --- a/tests/testdata/outputs_expected/environments.sol.o.json +++ b/tests/testdata/outputs_expected/environments.sol.o.json @@ -1,36 +1,36 @@ { - "error": null, - "issues": [ - { - "address": 158, - "contract": "Unknown", - "debug": "", - "description": "The arithmetic operation can result in integer overflow.\n", - "function": "_function_0x83f12fec", - "swc-id": "101", - "title": "Integer Overflow", - "type": "Warning" - }, - { - "address": 278, - "contract": "Unknown", - "debug": "", - "description": "The arithmetic operation can result in integer overflow.\n", - "function": "_function_0x83f12fec", - "swc-id": "101", - "title": "Integer Overflow", - "type": "Warning" - }, - { - "address": 378, - "contract": "Unknown", - "debug": "", - "description": "The substraction can result in an integer underflow.\n", - "function": "_function_0x83f12fec", - "swc-id": "101", - "title": "Integer Underflow", - "type": "Warning" - } - ], - "success": true + "error": null, + "issues": [ + { + "address": 158, + "contract": "Unknown", + "debug": "", + "description": "The arithmetic operation can result in integer overflow.\n", + "function": "_function_0x83f12fec", + "swc-id": "101", + "title": "Integer Overflow", + "type": "Warning", + }, + { + "address": 278, + "contract": "Unknown", + "debug": "", + "description": "The arithmetic operation can result in integer overflow.\n", + "function": "_function_0x83f12fec", + "swc-id": "101", + "title": "Integer Overflow", + "type": "Warning", + }, + { + "address": 378, + "contract": "Unknown", + "debug": "", + "description": "The substraction can result in an integer underflow.\n", + "function": "_function_0x83f12fec", + "swc-id": "101", + "title": "Integer Underflow", + "type": "Warning", + }, + ], + "success": true, } diff --git a/tests/testdata/outputs_expected/ether_send.sol.o.json b/tests/testdata/outputs_expected/ether_send.sol.o.json index 237b1c1e..84a01045 100644 --- a/tests/testdata/outputs_expected/ether_send.sol.o.json +++ b/tests/testdata/outputs_expected/ether_send.sol.o.json @@ -1 +1 @@ -{"error": null, "issues": [], "success": true} \ No newline at end of file +{"error": null, "issues": [], "success": true} diff --git a/tests/testdata/outputs_expected/exceptions.sol.o.json b/tests/testdata/outputs_expected/exceptions.sol.o.json index 35e82238..639bad6c 100644 --- a/tests/testdata/outputs_expected/exceptions.sol.o.json +++ b/tests/testdata/outputs_expected/exceptions.sol.o.json @@ -1,54 +1,54 @@ { - "error": null, - "issues": [ - { - "address": 446, - "contract": "Unknown", - "debug": "", - "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. Note that explicit `assert()` should only be used to check invariants. Use `require()` for regular input checking.", - "function": "assert3(uint256)", - "swc-id": "110", - "min_gas_used": 206, - "max_gas_used": 301, - "title": "Exception state", - "type": "Informational" - }, - { - "address": 484, - "contract": "Unknown", - "debug": "", - "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. Note that explicit `assert()` should only be used to check invariants. Use `require()` for regular input checking.", - "function": "arrayaccess(uint256)", - "swc-id": "110", - "min_gas_used": 256, - "max_gas_used": 351, - "title": "Exception state", - "type": "Informational" - }, - { - "address": 506, - "contract": "Unknown", - "debug": "", - "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. Note that explicit `assert()` should only be used to check invariants. Use `require()` for regular input checking.", - "function": "divisionby0(uint256)", - "swc-id": "110", - "min_gas_used": 272, - "max_gas_used": 367, - "title": "Exception state", - "type": "Informational" - }, - { - "address": 531, - "contract": "Unknown", - "debug": "", - "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. Note that explicit `assert()` should only be used to check invariants. Use `require()` for regular input checking.", - "function": "assert1()", - "swc-id": "110", - "min_gas_used": 268, - "max_gas_used": 363, - "title": "Exception state", - "type": "Informational" - } - ], - "success": true + "error": null, + "issues": [ + { + "address": 446, + "contract": "Unknown", + "debug": "", + "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. Note that explicit `assert()` should only be used to check invariants. Use `require()` for regular input checking.", + "function": "assert3(uint256)", + "swc-id": "110", + "min_gas_used": 206, + "max_gas_used": 301, + "title": "Exception state", + "type": "Informational", + }, + { + "address": 484, + "contract": "Unknown", + "debug": "", + "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. Note that explicit `assert()` should only be used to check invariants. Use `require()` for regular input checking.", + "function": "arrayaccess(uint256)", + "swc-id": "110", + "min_gas_used": 256, + "max_gas_used": 351, + "title": "Exception state", + "type": "Informational", + }, + { + "address": 506, + "contract": "Unknown", + "debug": "", + "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. Note that explicit `assert()` should only be used to check invariants. Use `require()` for regular input checking.", + "function": "divisionby0(uint256)", + "swc-id": "110", + "min_gas_used": 272, + "max_gas_used": 367, + "title": "Exception state", + "type": "Informational", + }, + { + "address": 531, + "contract": "Unknown", + "debug": "", + "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. Note that explicit `assert()` should only be used to check invariants. Use `require()` for regular input checking.", + "function": "assert1()", + "swc-id": "110", + "min_gas_used": 268, + "max_gas_used": 363, + "title": "Exception state", + "type": "Informational", + }, + ], + "success": true, } diff --git a/tests/testdata/outputs_expected/kinds_of_calls.sol.o.json b/tests/testdata/outputs_expected/kinds_of_calls.sol.o.json index 3674dde9..d6372b4c 100644 --- a/tests/testdata/outputs_expected/kinds_of_calls.sol.o.json +++ b/tests/testdata/outputs_expected/kinds_of_calls.sol.o.json @@ -1,54 +1,54 @@ { - "error": null, - "issues": [ - { - "address": 626, - "contract": "Unknown", - "debug": "", - "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", - "function": "_function_0x141f32ff", - "swc-id": "104", - "min_gas_used": 1104, - "max_gas_used": 35856, - "title": "Unchecked CALL return value", - "type": "Informational" - }, - { - "address": 857, - "contract": "Unknown", - "debug": "", - "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", - "function": "_function_0x9b58bc26", - "swc-id": "104", - "min_gas_used": 1167, - "max_gas_used": 35919, - "title": "Unchecked CALL return value", - "type": "Informational" - }, - { - "address": 1038, - "contract": "Unknown", - "debug": "", - "description": "This contract executes a message call to an address provided as a function argument. Generally, it is not recommended to call user-supplied addresses using Solidity's call() construct. Note that attackers might leverage reentrancy attacks to exploit race conditions or manipulate this contract's state.", - "function": "_function_0xeea4c864", - "swc-id": "107", - "min_gas_used": 477, - "max_gas_used": 1229, - "title": "Message call to external contract", - "type": "Warning" - }, - { - "address": 1046, - "contract": "Unknown", - "debug": "", - "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", - "function": "_function_0xeea4c864", - "swc-id": "104", - "min_gas_used": 1192, - "max_gas_used": 35944, - "title": "Unchecked CALL return value", - "type": "Informational" - } - ], - "success": true + "error": null, + "issues": [ + { + "address": 626, + "contract": "Unknown", + "debug": "", + "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", + "function": "_function_0x141f32ff", + "swc-id": "104", + "min_gas_used": 1104, + "max_gas_used": 35856, + "title": "Unchecked CALL return value", + "type": "Informational", + }, + { + "address": 857, + "contract": "Unknown", + "debug": "", + "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", + "function": "_function_0x9b58bc26", + "swc-id": "104", + "min_gas_used": 1167, + "max_gas_used": 35919, + "title": "Unchecked CALL return value", + "type": "Informational", + }, + { + "address": 1038, + "contract": "Unknown", + "debug": "", + "description": "This contract executes a message call to an address provided as a function argument. Generally, it is not recommended to call user-supplied addresses using Solidity's call() construct. Note that attackers might leverage reentrancy attacks to exploit race conditions or manipulate this contract's state.", + "function": "_function_0xeea4c864", + "swc-id": "107", + "min_gas_used": 477, + "max_gas_used": 1229, + "title": "Message call to external contract", + "type": "Warning", + }, + { + "address": 1046, + "contract": "Unknown", + "debug": "", + "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", + "function": "_function_0xeea4c864", + "swc-id": "104", + "min_gas_used": 1192, + "max_gas_used": 35944, + "title": "Unchecked CALL return value", + "type": "Informational", + }, + ], + "success": true, } diff --git a/tests/testdata/outputs_expected/multi_contracts.sol.o.json b/tests/testdata/outputs_expected/multi_contracts.sol.o.json index c4d6e54c..891f0203 100644 --- a/tests/testdata/outputs_expected/multi_contracts.sol.o.json +++ b/tests/testdata/outputs_expected/multi_contracts.sol.o.json @@ -1,18 +1,18 @@ { - "error": null, - "issues": [ - { - "address": 142, - "contract": "Unknown", - "debug": "", - "description": "Arbitrary senders other than the contract creator can withdraw ETH from the contract account without previously having sent an equivalent amount of ETH to it. This is likely to be a vulnerability.", - "function": "transfer()", - "max_gas_used": 467, - "min_gas_used": 186, - "swc-id": "105", - "title": "Ether thief", - "type": "Warning" - } - ], - "success": true + "error": null, + "issues": [ + { + "address": 142, + "contract": "Unknown", + "debug": "", + "description": "Arbitrary senders other than the contract creator can withdraw ETH from the contract account without previously having sent an equivalent amount of ETH to it. This is likely to be a vulnerability.", + "function": "transfer()", + "max_gas_used": 467, + "min_gas_used": 186, + "swc-id": "105", + "title": "Ether thief", + "type": "Warning", + } + ], + "success": true, } diff --git a/tests/testdata/outputs_expected/nonascii.sol.o.json b/tests/testdata/outputs_expected/nonascii.sol.o.json index 179ed787..84a01045 100644 --- a/tests/testdata/outputs_expected/nonascii.sol.o.json +++ b/tests/testdata/outputs_expected/nonascii.sol.o.json @@ -1,5 +1 @@ -{ - "error": null, - "issues": [], - "success": true -} +{"error": null, "issues": [], "success": true} diff --git a/tests/testdata/outputs_expected/origin.sol.o.json b/tests/testdata/outputs_expected/origin.sol.o.json index bcfd5e84..4f756563 100644 --- a/tests/testdata/outputs_expected/origin.sol.o.json +++ b/tests/testdata/outputs_expected/origin.sol.o.json @@ -1,18 +1,18 @@ { - "error": null, - "issues": [ - { - "address": 317, - "contract": "Unknown", - "debug": "", - "description": "The function `transferOwnership(address)` retrieves the transaction origin (tx.origin) using the ORIGIN opcode. Use msg.sender instead.\nSee also: https://solidity.readthedocs.io/en/develop/security-considerations.html#tx-origin", - "function": "transferOwnership(address)", - "swc-id": "115", - "min_gas_used": 626, - "max_gas_used": 1051, - "title": "Use of tx.origin", - "type": "Warning" - } - ], - "success": true + "error": null, + "issues": [ + { + "address": 317, + "contract": "Unknown", + "debug": "", + "description": "The function `transferOwnership(address)` retrieves the transaction origin (tx.origin) using the ORIGIN opcode. Use msg.sender instead.\nSee also: https://solidity.readthedocs.io/en/develop/security-considerations.html#tx-origin", + "function": "transferOwnership(address)", + "swc-id": "115", + "min_gas_used": 626, + "max_gas_used": 1051, + "title": "Use of tx.origin", + "type": "Warning", + } + ], + "success": true, } diff --git a/tests/testdata/outputs_expected/overflow.sol.o.json b/tests/testdata/outputs_expected/overflow.sol.o.json index e1a4b9b3..a6a780cb 100644 --- a/tests/testdata/outputs_expected/overflow.sol.o.json +++ b/tests/testdata/outputs_expected/overflow.sol.o.json @@ -1 +1,30 @@ -{"error": null, "issues": [{"address": 567, "contract": "Unknown", "debug": "", "description": "The subtraction can result in an integer underflow.\n", "function": "sendeth(address,uint256)", "max_gas_used": 1035, "min_gas_used": 750, "swc-id": "101", "title": "Integer Underflow", "type": "Warning"}, {"address": 649, "contract": "Unknown", "debug": "", "description": "The subtraction can result in an integer underflow.\n", "function": "sendeth(address,uint256)", "max_gas_used": 1758, "min_gas_used": 1283, "swc-id": "101", "title": "Integer Underflow", "type": "Warning"}], "success": true} \ No newline at end of file +{ + "error": null, + "issues": [ + { + "address": 567, + "contract": "Unknown", + "debug": "", + "description": "The subtraction can result in an integer underflow.\n", + "function": "sendeth(address,uint256)", + "max_gas_used": 1035, + "min_gas_used": 750, + "swc-id": "101", + "title": "Integer Underflow", + "type": "Warning", + }, + { + "address": 649, + "contract": "Unknown", + "debug": "", + "description": "The subtraction can result in an integer underflow.\n", + "function": "sendeth(address,uint256)", + "max_gas_used": 1758, + "min_gas_used": 1283, + "swc-id": "101", + "title": "Integer Underflow", + "type": "Warning", + }, + ], + "success": true, +} diff --git a/tests/testdata/outputs_expected/returnvalue.sol.o.json b/tests/testdata/outputs_expected/returnvalue.sol.o.json index 8678a03f..f6be6a1e 100644 --- a/tests/testdata/outputs_expected/returnvalue.sol.o.json +++ b/tests/testdata/outputs_expected/returnvalue.sol.o.json @@ -1 +1,18 @@ -{"error": null, "issues": [{"address": 290, "contract": "Unknown", "debug": "", "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", "function": "callnotchecked()", "max_gas_used": 35941, "min_gas_used": 1330, "swc-id": "104", "title": "Unchecked CALL return value", "type": "Informational"}], "success": true} \ No newline at end of file +{ + "error": null, + "issues": [ + { + "address": 290, + "contract": "Unknown", + "debug": "", + "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", + "function": "callnotchecked()", + "max_gas_used": 35941, + "min_gas_used": 1330, + "swc-id": "104", + "title": "Unchecked CALL return value", + "type": "Informational", + } + ], + "success": true, +} diff --git a/tests/testdata/outputs_expected/rubixi.sol.o.json b/tests/testdata/outputs_expected/rubixi.sol.o.json index a135559e..bac935c7 100644 --- a/tests/testdata/outputs_expected/rubixi.sol.o.json +++ b/tests/testdata/outputs_expected/rubixi.sol.o.json @@ -1,166 +1,166 @@ { - "success": true, - "error": null, - "issues": [ - { - "title": "Ether send", - "description": "In the function `_function_0x4229616d` a non-zero amount of Ether is sent to an address taken from storage slot 5.\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\n\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.", - "function": "_function_0x4229616d", - "type": "Warning", - "address": 1599, - "debug": "" - }, - { - "title": "Ether send", - "description": "In the function `_function_0xb4022950` a non-zero amount of Ether is sent to an address taken from storage slot 5.\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\n\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.", - "function": "_function_0xb4022950", - "type": "Warning", - "address": 1940, - "debug": "" - }, - { - "title": "Ether send", - "description": "In the function `_function_0xb4022950` a non-zero amount of Ether is sent to an address taken from storage slot 5.\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\n\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.", - "function": "_function_0xb4022950", - "type": "Warning", - "address": 2582, - "debug": "" - }, - { - "title": "Exception state", - "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. This is acceptable in most situations. Note however that `assert()` should only be used to check invariants. Use `require()` for regular input checking. ", - "function": "_function_0x57d4021b", - "type": "Informational", - "address": 1653, - "debug": "" - }, - { - "title": "Exception state", - "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. This is acceptable in most situations. Note however that `assert()` should only be used to check invariants. Use `require()` for regular input checking. ", - "function": "_function_0x9dbc4f9b", - "type": "Informational", - "address": 2085, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "fallback", - "type": "Informational", - "address": 3111, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "fallback", - "type": "Informational", - "address": 3140, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "fallback", - "type": "Informational", - "address": 2950, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "fallback", - "type": "Informational", - "address": 1268, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "_function_0x09dfdc71", - "type": "Informational", - "address": 310, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "_function_0x09dfdc71", - "type": "Informational", - "address": 1316, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "_function_0x253459e3", - "type": "Informational", - "address": 1375, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "_function_0x4229616d", - "type": "Informational", - "address": 1511, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "_function_0x57d4021b", - "type": "Informational", - "address": 1679, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "_function_0x6fbaaa1e", - "type": "Informational", - "address": 618, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "_function_0x8a5fb3ca", - "type": "Informational", - "address": 805, - "debug": "" - }, - { - "title": "Invariant branch condition", - "description": "Found a conditional jump which always follows the same branch", - "function": "_function_0x9dbc4f9b", - "type": "Informational", - "address": 2187, - "debug": "" - }, - { - "title": "Unchecked CALL return value", - "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", - "function": "_function_0x4229616d", - "type": "Informational", - "address": 1599, - "debug": "" - }, - { - "title": "Unchecked CALL return value", - "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", - "function": "_function_0xb4022950", - "type": "Informational", - "address": 1940, - "debug": "" - }, - { - "title": "Unchecked CALL return value", - "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", - "function": "_function_0xb4022950", - "type": "Informational", - "address": 2582, - "debug": "" - } - ] + "success": true, + "error": null, + "issues": [ + { + "title": "Ether send", + "description": "In the function `_function_0x4229616d` a non-zero amount of Ether is sent to an address taken from storage slot 5.\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\n\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.", + "function": "_function_0x4229616d", + "type": "Warning", + "address": 1599, + "debug": "", + }, + { + "title": "Ether send", + "description": "In the function `_function_0xb4022950` a non-zero amount of Ether is sent to an address taken from storage slot 5.\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\n\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.", + "function": "_function_0xb4022950", + "type": "Warning", + "address": 1940, + "debug": "", + }, + { + "title": "Ether send", + "description": "In the function `_function_0xb4022950` a non-zero amount of Ether is sent to an address taken from storage slot 5.\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\n\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.\nThere is a check on storage index 5. This storage slot can be written to by calling the function `_function_0x67f809e9`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.", + "function": "_function_0xb4022950", + "type": "Warning", + "address": 2582, + "debug": "", + }, + { + "title": "Exception state", + "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. This is acceptable in most situations. Note however that `assert()` should only be used to check invariants. Use `require()` for regular input checking. ", + "function": "_function_0x57d4021b", + "type": "Informational", + "address": 1653, + "debug": "", + }, + { + "title": "Exception state", + "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. This is acceptable in most situations. Note however that `assert()` should only be used to check invariants. Use `require()` for regular input checking. ", + "function": "_function_0x9dbc4f9b", + "type": "Informational", + "address": 2085, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "fallback", + "type": "Informational", + "address": 3111, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "fallback", + "type": "Informational", + "address": 3140, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "fallback", + "type": "Informational", + "address": 2950, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "fallback", + "type": "Informational", + "address": 1268, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "_function_0x09dfdc71", + "type": "Informational", + "address": 310, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "_function_0x09dfdc71", + "type": "Informational", + "address": 1316, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "_function_0x253459e3", + "type": "Informational", + "address": 1375, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "_function_0x4229616d", + "type": "Informational", + "address": 1511, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "_function_0x57d4021b", + "type": "Informational", + "address": 1679, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "_function_0x6fbaaa1e", + "type": "Informational", + "address": 618, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "_function_0x8a5fb3ca", + "type": "Informational", + "address": 805, + "debug": "", + }, + { + "title": "Invariant branch condition", + "description": "Found a conditional jump which always follows the same branch", + "function": "_function_0x9dbc4f9b", + "type": "Informational", + "address": 2187, + "debug": "", + }, + { + "title": "Unchecked CALL return value", + "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", + "function": "_function_0x4229616d", + "type": "Informational", + "address": 1599, + "debug": "", + }, + { + "title": "Unchecked CALL return value", + "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", + "function": "_function_0xb4022950", + "type": "Informational", + "address": 1940, + "debug": "", + }, + { + "title": "Unchecked CALL return value", + "description": "The return value of an external call is not checked. Note that execution continue even if the called contract throws.", + "function": "_function_0xb4022950", + "type": "Informational", + "address": 2582, + "debug": "", + }, + ], } diff --git a/tests/testdata/outputs_expected/suicide.sol.o.json b/tests/testdata/outputs_expected/suicide.sol.o.json index ebcb11d2..ca43c488 100644 --- a/tests/testdata/outputs_expected/suicide.sol.o.json +++ b/tests/testdata/outputs_expected/suicide.sol.o.json @@ -1 +1,18 @@ -{"error": null, "issues": [{"address": 146, "contract": "Unknown", "debug": "", "description": "Anyone can kill this contract and withdraw its balance to their own account.", "function": "kill(address)", "max_gas_used": 263, "min_gas_used": 168, "swc-id": "106", "title": "Unchecked SUICIDE", "type": "Warning"}], "success": true} \ No newline at end of file +{ + "error": null, + "issues": [ + { + "address": 146, + "contract": "Unknown", + "debug": "", + "description": "Anyone can kill this contract and withdraw its balance to their own account.", + "function": "kill(address)", + "max_gas_used": 263, + "min_gas_used": 168, + "swc-id": "106", + "title": "Unchecked SUICIDE", + "type": "Warning", + } + ], + "success": true, +} diff --git a/tests/testdata/outputs_expected/underflow.sol.o.json b/tests/testdata/outputs_expected/underflow.sol.o.json index e1a4b9b3..a6a780cb 100644 --- a/tests/testdata/outputs_expected/underflow.sol.o.json +++ b/tests/testdata/outputs_expected/underflow.sol.o.json @@ -1 +1,30 @@ -{"error": null, "issues": [{"address": 567, "contract": "Unknown", "debug": "", "description": "The subtraction can result in an integer underflow.\n", "function": "sendeth(address,uint256)", "max_gas_used": 1035, "min_gas_used": 750, "swc-id": "101", "title": "Integer Underflow", "type": "Warning"}, {"address": 649, "contract": "Unknown", "debug": "", "description": "The subtraction can result in an integer underflow.\n", "function": "sendeth(address,uint256)", "max_gas_used": 1758, "min_gas_used": 1283, "swc-id": "101", "title": "Integer Underflow", "type": "Warning"}], "success": true} \ No newline at end of file +{ + "error": null, + "issues": [ + { + "address": 567, + "contract": "Unknown", + "debug": "", + "description": "The subtraction can result in an integer underflow.\n", + "function": "sendeth(address,uint256)", + "max_gas_used": 1035, + "min_gas_used": 750, + "swc-id": "101", + "title": "Integer Underflow", + "type": "Warning", + }, + { + "address": 649, + "contract": "Unknown", + "debug": "", + "description": "The subtraction can result in an integer underflow.\n", + "function": "sendeth(address,uint256)", + "max_gas_used": 1758, + "min_gas_used": 1283, + "swc-id": "101", + "title": "Integer Underflow", + "type": "Warning", + }, + ], + "success": true, +} diff --git a/tests/testdata/outputs_expected/weak_random.sol.o.json b/tests/testdata/outputs_expected/weak_random.sol.o.json index 630fdb0d..681f8544 100644 --- a/tests/testdata/outputs_expected/weak_random.sol.o.json +++ b/tests/testdata/outputs_expected/weak_random.sol.o.json @@ -1,46 +1,46 @@ { - "success": true, - "error": null, - "issues": [ - { - "title": "Dependence on predictable environment variable", - "description": "In the function `_function_0xe9874106` the following predictable state variables are used to determine Ether recipient:\n- block.coinbase\n", - "function": "_function_0xe9874106", - "type": "Warning", - "address": 1285, - "debug": "" - }, - { - "title": "Ether send", - "description": "In the function `_function_0xe9874106` a non-zero amount of Ether is sent to an address taken from storage slot 0.\nThere is a check on storage index 0. This storage slot can be written to by calling the function `fallback`.\n\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.", - "function": "_function_0xe9874106", - "type": "Warning", - "address": 1285, - "debug": "" - }, - { - "title": "Exception state", - "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. This is acceptable in most situations. Note however that `assert()` should only be used to check invariants. Use `require()` for regular input checking. ", - "function": "fallback", - "type": "Informational", - "address": 356, - "debug": "" - }, - { - "title": "Exception state", - "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. This is acceptable in most situations. Note however that `assert()` should only be used to check invariants. Use `require()` for regular input checking. ", - "function": "_function_0xe9874106", - "type": "Informational", - "address": 146, - "debug": "" - }, - { - "title": "Transaction order dependence", - "description": "A possible transaction order independence vulnerability exists in function _function_0xe9874106. The value or direction of the call statement is determined from a tainted storage location", - "function": "_function_0xe9874106", - "type": "Warning", - "address": 1285, - "debug": "" - } - ] + "success": true, + "error": null, + "issues": [ + { + "title": "Dependence on predictable environment variable", + "description": "In the function `_function_0xe9874106` the following predictable state variables are used to determine Ether recipient:\n- block.coinbase\n", + "function": "_function_0xe9874106", + "type": "Warning", + "address": 1285, + "debug": "", + }, + { + "title": "Ether send", + "description": "In the function `_function_0xe9874106` a non-zero amount of Ether is sent to an address taken from storage slot 0.\nThere is a check on storage index 0. This storage slot can be written to by calling the function `fallback`.\n\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.\nThere is a check on storage index 1. This storage slot can be written to by calling the function `fallback`.", + "function": "_function_0xe9874106", + "type": "Warning", + "address": 1285, + "debug": "", + }, + { + "title": "Exception state", + "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. This is acceptable in most situations. Note however that `assert()` should only be used to check invariants. Use `require()` for regular input checking. ", + "function": "fallback", + "type": "Informational", + "address": 356, + "debug": "", + }, + { + "title": "Exception state", + "description": "A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. This is acceptable in most situations. Note however that `assert()` should only be used to check invariants. Use `require()` for regular input checking. ", + "function": "_function_0xe9874106", + "type": "Informational", + "address": 146, + "debug": "", + }, + { + "title": "Transaction order dependence", + "description": "A possible transaction order independence vulnerability exists in function _function_0xe9874106. The value or direction of the call statement is determined from a tainted storage location", + "function": "_function_0xe9874106", + "type": "Warning", + "address": 1285, + "debug": "", + }, + ], }