diff --git a/tests/modifier_expected_results.py b/tests/modifier_expected_results.py index bd233c5..dbf6579 100644 --- a/tests/modifier_expected_results.py +++ b/tests/modifier_expected_results.py @@ -456,6 +456,339 @@ ], }, ], + "time_and_block_seq": [ + { + "name": "-2210631667546636005.txt", + "content": [ + { + "call": { + "contents": ["setInt256", [{"contents": [256, "0"], "tag": "AbiInt"}]], + "tag": "SolCall", + }, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000010000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": {"contents": ["check_int256", []], "tag": "SolCall"}, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000010000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + ], + }, + { + "name": "-1469195906620168853.txt", + "content": [ + { + "call": { + "contents": [ + "setUint256", + [{"contents": [256, "0"], "tag": "AbiUInt"}], + ], + "tag": "SolCall", + }, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000010000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": {"contents": ["check_uint256", []], "tag": "SolCall"}, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000010000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + ], + }, + ], + "blacklisted_functions_seq": [ + { + "name": "-1234458407747697055.txt", + "content": [ + { + "call": { + "contents": [ + "check_specific_string", + [ + { + "contents": '"\\fEs8\\DLE3\\180\\FSQ,\\156G\\135\\223\\162\\131 cM\\204,4$\\227w\\168$Oz"', + "tag": "AbiString", + } + ], + ], + "tag": "SolCall", + }, + "delay": [ + "0x000000000000000000000000000000000000000000000000000000000005caa0", + "0x00000000000000000000000000000000000000000000000000000000000030cd", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000020000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": { + "contents": [ + "check_specific_string", + [ + { + "contents": '"\\v\\252\\&1l\\134-{G}\\ETXH"', + "tag": "AbiString", + } + ], + ], + "tag": "SolCall", + }, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000087adc", + "0x00000000000000000000000000000000000000000000000000000000000013bd", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000020000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": {"contents": ["check_address", []], "tag": "SolCall"}, + "delay": [ + "0x000000000000000000000000000000000000000000000000000000000001b2da", + "0x0000000000000000000000000000000000000000000000000000000000006b0c", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000020000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": { + "contents": [ + "setAddress", + [ + { + "contents": "0x0000000000000000000000000000000000020000", + "tag": "AbiAddress", + } + ], + ], + "tag": "SolCall", + }, + "delay": [ + "0x000000000000000000000000000000000000000000000000000000000004694f", + "0x000000000000000000000000000000000000000000000000000000000000bb03", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000020000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": {"contents": ["check_int256", []], "tag": "SolCall"}, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000048a23", + "0x0000000000000000000000000000000000000000000000000000000000008ffb", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000030000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + ], + }, + { + "name": "-2210631667546636005.txt", + "content": [ + { + "call": { + "contents": ["setInt256", [{"contents": [256, "0"], "tag": "AbiInt"}]], + "tag": "SolCall", + }, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000010000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": {"contents": ["check_int256", []], "tag": "SolCall"}, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000010000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + ], + }, + ], + "invalid_functions_seq": [ + { + "name": "-1234458407747697055.txt", + "content": [ + { + "call": { + "contents": [ + "check_specific_string", + [ + { + "contents": '"\\fEs8\\DLE3\\180\\FSQ,\\156G\\135\\223\\162\\131 cM\\204,4$\\227w\\168$Oz"', + "tag": "AbiString", + } + ], + ], + "tag": "SolCall", + }, + "delay": [ + "0x000000000000000000000000000000000000000000000000000000000005caa0", + "0x00000000000000000000000000000000000000000000000000000000000030cd", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000020000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": { + "contents": [ + "check_specific_string", + [ + { + "contents": '"\\v\\252\\&1l\\134-{G}\\ETXH"', + "tag": "AbiString", + } + ], + ], + "tag": "SolCall", + }, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000087adc", + "0x00000000000000000000000000000000000000000000000000000000000013bd", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000020000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": {"contents": ["check_address", []], "tag": "SolCall"}, + "delay": [ + "0x000000000000000000000000000000000000000000000000000000000001b2da", + "0x0000000000000000000000000000000000000000000000000000000000006b0c", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000020000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": { + "contents": [ + "setAddress", + [ + { + "contents": "0x0000000000000000000000000000000000020000", + "tag": "AbiAddress", + } + ], + ], + "tag": "SolCall", + }, + "delay": [ + "0x000000000000000000000000000000000000000000000000000000000004694f", + "0x000000000000000000000000000000000000000000000000000000000000bb03", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000020000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": {"contents": ["check_int256", []], "tag": "SolCall"}, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000048a23", + "0x0000000000000000000000000000000000000000000000000000000000008ffb", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000030000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + ], + }, + { + "name": "-2210631667546636005.txt", + "content": [ + { + "call": { + "contents": ["setInt256", [{"contents": [256, "0"], "tag": "AbiInt"}]], + "tag": "SolCall", + }, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000010000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + { + "call": {"contents": ["check_int256", []], "tag": "SolCall"}, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000010000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + ], + }, + ], "modify_senders": [ { "name": "-585908729518561292.txt", @@ -650,23 +983,202 @@ "value": "0x0000000000000000000000000000000000000000000000000000000000000000", }, { - "call": {"contents": ["check_int256", []], "tag": "SolCall"}, - "delay": [ - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x0000000000000000000000000000000000000000000000000000000000000000", - ], - "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", - "gas": 12500000, - "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", - "src": "0x0000000000000000000000000000000000020000", - "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + "call": {"contents": ["check_int256", []], "tag": "SolCall"}, + "delay": [ + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + ], + "dst": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "gas": 12500000, + "gasprice": "0x0000000000000000000000000000000000000000000000000000000000000000", + "src": "0x0000000000000000000000000000000000020000", + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + ], + }, + ], + }, + "medusa": { + "time_and_block_call": [ + { + "name": "1711369139037582000-cd75b0ae-6513-431b-81d3-d4bd19581b92.json", + "content": [ + { + "call": { + "from": "0x0000000000000000000000000000000000010000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 0, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0x8bc5af90", + "dataAbiValues": { + "methodSignature": "check_string()", + "inputValues": [], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 0, + "blockTimestampDelay": 0, + } + ], + }, + { + "name": "1711369139040471000-410883c1-42cd-4f17-b326-f13eb6bb65fe.json", + "content": [ + { + "call": { + "from": "0x0000000000000000000000000000000000010000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 0, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0x8bc5af90", + "dataAbiValues": { + "methodSignature": "check_string()", + "inputValues": [], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 0, + "blockTimestampDelay": 0, + }, + { + "call": { + "from": "0x0000000000000000000000000000000000030000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 1, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0x68fe2494", + "dataAbiValues": { + "methodSignature": "check_bytes()", + "inputValues": [], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 0, + "blockTimestampDelay": 1, + }, + ], + }, + { + "name": "1711369139036115000-9eaced3e-b7ae-4565-a0ff-c2ba04d31b13.json", + "content": [ + { + "call": { + "from": "0x0000000000000000000000000000000000010000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 0, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0x8bc5af90", + "dataAbiValues": { + "methodSignature": "check_string()", + "inputValues": [], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 0, + "blockTimestampDelay": 0, + } + ], + }, + { + "name": "1711369139036682000-39bea42d-9a8e-4e02-9652-76990e1d9043.json", + "content": [ + { + "call": { + "from": "0x0000000000000000000000000000000000030000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 1, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0xe30081a0000000000000000000000000647be767dca5dea7641f4edac5754609bd0b5ee2", + "dataAbiValues": { + "methodSignature": "setAddress(address)", + "inputValues": ["0x647BE767Dca5DeA7641f4EDaC5754609bd0b5eE2"], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 8, + "blockTimestampDelay": 10, + } + ], + }, + { + "name": "1711369141680378000-563145f4-2fb6-4929-9438-d9f229d9c2a4.json", + "content": [ + { + "call": { + "from": "0x0000000000000000000000000000000000020000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 0, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0xd3b5d5d4", + "dataAbiValues": { + "methodSignature": "check_uint256()", + "inputValues": [], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 9, + "blockTimestampDelay": 80, + }, + ], + }, + { + "name": "1711369141706737000-34e6f348-02b4-4ff1-92ea-dac3b77823c5.json", + "content": [ + { + "call": { + "from": "0x0000000000000000000000000000000000010000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 0, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0x68fe2494", + "dataAbiValues": { + "methodSignature": "check_bytes()", + "inputValues": [], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 0, + "blockTimestampDelay": 0, }, ], }, ], - }, - "medusa": { - "time_and_block_call": [ + "invalid_functions_call": [ { "name": "1711369139037582000-cd75b0ae-6513-431b-81d3-d4bd19581b92.json", "content": [ @@ -690,7 +1202,49 @@ }, "blockNumberDelay": 0, "blockTimestampDelay": 0, - } + }, + { + "call": { + "from": "0x0000000000000000000000000000000000010000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 1, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0x8bc5af90", + "dataAbiValues": { + "methodSignature": "check_string()", + "inputValues": [], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 27285, + "blockTimestampDelay": 570987, + }, + { + "call": { + "from": "0x0000000000000000000000000000000000020000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 0, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0xda359dc80000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001426b87d7a48ed7d5bc05982fac03649d6741c65f4000000000000000000000000", + "dataAbiValues": { + "methodSignature": "setBytes(bytes)", + "inputValues": ["26b87d7a48ed7d5bc05982fac03649d6741c65f4"], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 32686, + "blockTimestampDelay": 517396, + }, ], }, { @@ -717,6 +1271,27 @@ "blockNumberDelay": 0, "blockTimestampDelay": 0, }, + { + "call": { + "from": "0x0000000000000000000000000000000000010000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 1, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0x1e26fd330000000000000000000000000000000000000000000000000000000000000001", + "dataAbiValues": { + "methodSignature": "setBool(bool)", + "inputValues": [True], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 1, + "blockTimestampDelay": 175946, + }, { "call": { "from": "0x0000000000000000000000000000000000030000", @@ -738,6 +1313,48 @@ "blockNumberDelay": 0, "blockTimestampDelay": 1, }, + { + "call": { + "from": "0x0000000000000000000000000000000000020000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 0, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0xe30081a00000000000000000000000003ce6b28f541002ec458324582e3ab2bfc2b77167", + "dataAbiValues": { + "methodSignature": "setAddress(address)", + "inputValues": ["0x3CE6B28F541002EC458324582e3Ab2bfC2b77167"], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 20, + "blockTimestampDelay": 107219, + }, + { + "call": { + "from": "0x0000000000000000000000000000000000030000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 2, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0x73e69a18", + "dataAbiValues": { + "methodSignature": "check_address()", + "inputValues": [], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 40568, + "blockTimestampDelay": 353358, + }, ], }, { @@ -797,7 +1414,7 @@ "content": [ { "call": { - "from": "0x0000000000000000000000000000000000020000", + "from": "0x0000000000000000000000000000000000010000", "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", "nonce": 0, "value": "0x0", @@ -805,17 +1422,17 @@ "gasPrice": "0x1", "gasFeeCap": "0x0", "gasTipCap": "0x0", - "data": "0xd3b5d5d4", + "data": "0xd2282dc536ac105a7845b109c000df159eb4427dedbcdedf9379aff52bf13cedc54c1928", "dataAbiValues": { - "methodSignature": "check_uint256()", - "inputValues": [], + "methodSignature": "setUint256(uint256)", + "inputValues": ["19050454979278060990829239674756109780367087"], }, "AccessList": None, "SkipAccountChecks": False, }, - "blockNumberDelay": 9, - "blockTimestampDelay": 80, - }, + "blockNumberDelay": 25421, + "blockTimestampDelay": 401424, + } ], }, { @@ -831,6 +1448,27 @@ "gasPrice": "0x1", "gasFeeCap": "0x0", "gasTipCap": "0x0", + "data": "0xda359dc800000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000033a2e6714916369cbf3a3e32dc69db8f561b7235556e8cf0948ad0e1ad5dab0aa92d9b3da693f7219ea302629a45abdeb1fe003c00000000000000000000000000", + "dataAbiValues": { + "methodSignature": "setBytes(bytes)", + "inputValues": [""], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 38145, + "blockTimestampDelay": 360617, + }, + { + "call": { + "from": "0x0000000000000000000000000000000000010000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 1, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", "data": "0x68fe2494", "dataAbiValues": { "methodSignature": "check_bytes()", @@ -845,7 +1483,61 @@ ], }, ], - "invalid_functions_call": [ + "time_and_block_seq": [ + { + "name": "1711369139036115000-9eaced3e-b7ae-4565-a0ff-c2ba04d31b13.json", + "content": [ + { + "call": { + "from": "0x0000000000000000000000000000000000010000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 0, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0x8bc5af90", + "dataAbiValues": { + "methodSignature": "check_string()", + "inputValues": [], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 0, + "blockTimestampDelay": 0, + } + ], + }, + { + "name": "1711369139036682000-39bea42d-9a8e-4e02-9652-76990e1d9043.json", + "content": [ + { + "call": { + "from": "0x0000000000000000000000000000000000030000", + "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", + "nonce": 1, + "value": "0x0", + "gasLimit": 12500000, + "gasPrice": "0x1", + "gasFeeCap": "0x0", + "gasTipCap": "0x0", + "data": "0xe30081a0000000000000000000000000647be767dca5dea7641f4edac5754609bd0b5ee2", + "dataAbiValues": { + "methodSignature": "setAddress(address)", + "inputValues": ["0x647BE767Dca5DeA7641f4EDaC5754609bd0b5eE2"], + }, + "AccessList": None, + "SkipAccountChecks": False, + }, + "blockNumberDelay": 8, + "blockTimestampDelay": 10, + } + ], + }, + ], + "invalid_functions_seq": [ { "name": "1711369139037582000-cd75b0ae-6513-431b-81d3-d4bd19581b92.json", "content": [ @@ -1076,32 +1768,6 @@ } ], }, - { - "name": "1711369141680378000-563145f4-2fb6-4929-9438-d9f229d9c2a4.json", - "content": [ - { - "call": { - "from": "0x0000000000000000000000000000000000010000", - "to": "0xa647ff3c36cfab592509e13860ab8c4f28781a66", - "nonce": 0, - "value": "0x0", - "gasLimit": 12500000, - "gasPrice": "0x1", - "gasFeeCap": "0x0", - "gasTipCap": "0x0", - "data": "0xd2282dc536ac105a7845b109c000df159eb4427dedbcdedf9379aff52bf13cedc54c1928", - "dataAbiValues": { - "methodSignature": "setUint256(uint256)", - "inputValues": ["19050454979278060990829239674756109780367087"], - }, - "AccessList": None, - "SkipAccountChecks": False, - }, - "blockNumberDelay": 25421, - "blockTimestampDelay": 401424, - } - ], - }, { "name": "1711369141706737000-34e6f348-02b4-4ff1-92ea-dac3b77823c5.json", "content": [ diff --git a/tests/test_corpus_modifier.py b/tests/test_corpus_modifier.py index 9e7638d..bb1f2c3 100644 --- a/tests/test_corpus_modifier.py +++ b/tests/test_corpus_modifier.py @@ -33,6 +33,9 @@ def compare_corpus_with_expected(expected_corpus: list, new_corpus: list) -> Non assert expected_corpus_sorted[idx]["content"] == item["content"] +# delete_calls mode + + def test_echidna_delay_delete_calls( setup_foundry_temp_dir: TempPathFactory, ) -> None: @@ -47,9 +50,9 @@ def test_echidna_delay_delete_calls( modifier = CorpusModifier(config, None) new_corpus, corpus_hash = modifier.modify_corpus() - # print("new corpus", new_corpus) - compare_corpus_with_expected(expected_results["echidna"]["time_and_block_call"], new_corpus) + modifier.restore_corpus_from_history(corpus_hash) + compare_corpus_with_expected(expected_results["echidna"]["time_and_block_call"], new_corpus) def test_echidna_blacklist_delete_calls( @@ -67,10 +70,10 @@ def test_echidna_blacklist_delete_calls( modifier = CorpusModifier(config, None) new_corpus, corpus_hash = modifier.modify_corpus() + modifier.restore_corpus_from_history(corpus_hash) compare_corpus_with_expected( expected_results["echidna"]["blacklisted_functions_call"], new_corpus ) - modifier.restore_corpus_from_history(corpus_hash) def test_echidna_function_filter_delete_calls( @@ -89,8 +92,71 @@ def test_echidna_function_filter_delete_calls( new_corpus, corpus_hash = modifier.modify_corpus() # print("new corpus", new_corpus) + modifier.restore_corpus_from_history(corpus_hash) compare_corpus_with_expected(expected_results["echidna"]["invalid_functions_call"], new_corpus) + + +# delete_sequence mode + + +def test_echidna_delay_delete_sequence( + setup_foundry_temp_dir: TempPathFactory, +) -> None: + """Test that correct calls are deleted when filtering by time and block delay""" + config = copy.deepcopy(default_config) + config["mode"] = "delete_sequence" + config["corpusDir"] = "echidna-corpora/corpus-basic-modifier" + config["fuzzerConfigPath"] = "echidna.yaml" + config["fuzzer"] = "echidna" + + create_file(setup_foundry_temp_dir, "echidna.yaml", "maxTimeDelay: 65535\nmaxBlockDelay: 46801") + + modifier = CorpusModifier(config, None) + new_corpus, corpus_hash = modifier.modify_corpus() + modifier.restore_corpus_from_history(corpus_hash) + compare_corpus_with_expected(expected_results["echidna"]["time_and_block_seq"], new_corpus) + + +def test_echidna_blacklist_delete_sequence( + setup_foundry_temp_dir: TempPathFactory, +) -> None: + """Test that correct calls are deleted when filtering blacklisted functions""" + config = copy.deepcopy(default_config) + config["mode"] = "delete_sequence" + config["corpusDir"] = "echidna-corpora/corpus-basic-modifier" + config["fuzzerConfigPath"] = "echidna.yaml" + config["fuzzer"] = "echidna" + + create_file(setup_foundry_temp_dir, "echidna.yaml", 'filterFunctions: ["check_uint256"]') + + modifier = CorpusModifier(config, None) + new_corpus, corpus_hash = modifier.modify_corpus() + + modifier.restore_corpus_from_history(corpus_hash) + compare_corpus_with_expected( + expected_results["echidna"]["blacklisted_functions_seq"], new_corpus + ) + + +def test_echidna_function_filter_delete_sequence( + setup_foundry_temp_dir: TempPathFactory, # pylint: disable=unused-argument +) -> None: + """Test that correct calls are deleted when filtering non-existent functions""" + config = copy.deepcopy(default_config) + config["corpusDir"] = "echidna-corpora/corpus-basic-modifier" + config["targetContract"] = "BasicTypesNoCheckUint256" + config["filterFunctions"] = True + config["mode"] = "delete_sequence" + config["fuzzer"] = "echidna" + + slither = Slither(config["compilationPath"]) + modifier = CorpusModifier(config, slither) + + new_corpus, corpus_hash = modifier.modify_corpus() + + modifier.restore_corpus_from_history(corpus_hash) + compare_corpus_with_expected(expected_results["echidna"]["invalid_functions_seq"], new_corpus) def test_echidna_modify_senders( @@ -108,8 +174,8 @@ def test_echidna_modify_senders( modifier = CorpusModifier(config, None) new_corpus, corpus_hash = modifier.modify_corpus() - compare_corpus_with_expected(expected_results["echidna"]["modify_senders"], new_corpus) modifier.restore_corpus_from_history(corpus_hash) + compare_corpus_with_expected(expected_results["echidna"]["modify_senders"], new_corpus) def test_medusa_delay_delete_calls( @@ -130,12 +196,9 @@ def test_medusa_delay_delete_calls( modifier = CorpusModifier(config, None) new_corpus, corpus_hash = modifier.modify_corpus() - print("new corpus", new_corpus) - compare_corpus_with_expected(expected_results["medusa"]["time_and_block_call"], new_corpus) - # set1 = set(new_corpus) - # set2 = set(expected_results["medusa"]["time_and_block_call"]) - # print("Diff", set1 ^ set2) + modifier.restore_corpus_from_history(corpus_hash) + compare_corpus_with_expected(expected_results["medusa"]["time_and_block_call"], new_corpus) def test_medusa_function_filter_delete_calls( @@ -153,8 +216,50 @@ def test_medusa_function_filter_delete_calls( modifier = CorpusModifier(config, slither) new_corpus, corpus_hash = modifier.modify_corpus() + modifier.restore_corpus_from_history(corpus_hash) compare_corpus_with_expected(expected_results["medusa"]["invalid_functions_call"], new_corpus) + + +def test_medusa_delay_delete_sequence( + setup_foundry_temp_dir: TempPathFactory, +) -> None: + """Test that correct calls are deleted when filtering by time and block delay""" + config = copy.deepcopy(default_config) + config["mode"] = "delete_sequence" + config["corpusDir"] = "medusa-corpora/corpus-basic-modifier" + config["fuzzerConfigPath"] = "medusa.json" + config["fuzzer"] = "medusa" + + create_file( + setup_foundry_temp_dir, + "medusa.json", + '{"fuzzing": {"blockNumberDelayMax": 100,\n"blockTimestampDelayMax": 100}}', + ) + + modifier = CorpusModifier(config, None) + new_corpus, corpus_hash = modifier.modify_corpus() + + modifier.restore_corpus_from_history(corpus_hash) + compare_corpus_with_expected(expected_results["medusa"]["time_and_block_seq"], new_corpus) + + +def test_medusa_function_filter_delete_sequence( + setup_foundry_temp_dir: TempPathFactory, # pylint: disable=unused-argument +) -> None: + """Test that correct calls are deleted when filtering non-existent functions""" + config = copy.deepcopy(default_config) + config["corpusDir"] = "medusa-corpora/corpus-basic-modifier" + config["targetContract"] = "BasicTypesNoCheckUint256" + config["filterFunctions"] = True + config["mode"] = "delete_sequence" + config["fuzzer"] = "medusa" + + slither = Slither(config["compilationPath"]) + modifier = CorpusModifier(config, slither) + + new_corpus, corpus_hash = modifier.modify_corpus() modifier.restore_corpus_from_history(corpus_hash) + compare_corpus_with_expected(expected_results["medusa"]["invalid_functions_seq"], new_corpus) def test_medusa_modify_senders( @@ -171,6 +276,5 @@ def test_medusa_modify_senders( modifier = CorpusModifier(config, None) new_corpus, corpus_hash = modifier.modify_corpus() - - compare_corpus_with_expected(expected_results["medusa"]["modify_senders"], new_corpus) modifier.restore_corpus_from_history(corpus_hash) + compare_corpus_with_expected(expected_results["medusa"]["modify_senders"], new_corpus)