├── .circleci └── config.yml ├── .dockerignore ├── .drone.yml ├── .editorconfig ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── analysis-module.md │ ├── bug-report.md │ └── feature-request.md ├── dependabot.yml └── workflows │ ├── container.yml │ ├── pre-commit-hooks-test.yml │ └── pre-commit.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .pre-commit-hooks.yaml ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── MANIFEST.in ├── README.md ├── all_tests.sh ├── coverage_report.sh ├── docker-bake.hcl ├── docker ├── docker-entrypoint.sh └── sync-svm-solc-versions-with-solcx.sh ├── docker_build_and_deploy.sh ├── docs ├── Makefile ├── make.bat └── source │ ├── about.rst │ ├── analysis-modules.rst │ ├── conf.py │ ├── create-module.rst │ ├── index.rst │ ├── installation.rst │ ├── module-list.rst │ ├── modules.rst │ ├── mythril.analysis.module.modules.rst │ ├── mythril.analysis.module.rst │ ├── mythril.analysis.rst │ ├── mythril.concolic.rst │ ├── mythril.disassembler.rst │ ├── mythril.ethereum.interface.rpc.rst │ ├── mythril.ethereum.interface.rst │ ├── mythril.ethereum.rst │ ├── mythril.interfaces.rst │ ├── mythril.laser.ethereum.function_managers.rst │ ├── mythril.laser.ethereum.rst │ ├── mythril.laser.ethereum.state.rst │ ├── mythril.laser.ethereum.strategy.extensions.rst │ ├── mythril.laser.ethereum.strategy.rst │ ├── mythril.laser.ethereum.transaction.rst │ ├── mythril.laser.plugin.plugins.coverage.rst │ ├── mythril.laser.plugin.plugins.rst │ ├── mythril.laser.plugin.plugins.summary_backup.rst │ ├── mythril.laser.plugin.rst │ ├── mythril.laser.rst │ ├── mythril.laser.smt.rst │ ├── mythril.laser.smt.solver.rst │ ├── mythril.mythril.rst │ ├── mythril.plugin.rst │ ├── mythril.rst │ ├── mythril.solidity.rst │ ├── mythril.support.rst │ ├── security-analysis.rst │ └── tutorial.rst ├── mypy-stubs └── z3 │ ├── __init__.pyi │ ├── z3core.pyi │ └── z3types.pyi ├── myth ├── mythril ├── __init__.py ├── __main__.py ├── __version__.py ├── analysis │ ├── __init__.py │ ├── analysis_args.py │ ├── call_helpers.py │ ├── callgraph.py │ ├── issue_annotation.py │ ├── module │ │ ├── __init__.py │ │ ├── base.py │ │ ├── loader.py │ │ ├── module_helpers.py │ │ ├── modules │ │ │ ├── __init__.py │ │ │ ├── arbitrary_jump.py │ │ │ ├── arbitrary_write.py │ │ │ ├── delegatecall.py │ │ │ ├── dependence_on_origin.py │ │ │ ├── dependence_on_predictable_vars.py │ │ │ ├── ether_thief.py │ │ │ ├── exceptions.py │ │ │ ├── external_calls.py │ │ │ ├── integer.py │ │ │ ├── multiple_sends.py │ │ │ ├── requirements_violation.py │ │ │ ├── state_change_external_calls.py │ │ │ ├── suicide.py │ │ │ ├── transaction_order_dependence.py │ │ │ ├── unchecked_retval.py │ │ │ ├── unexpected_ether.py │ │ │ └── user_assertions.py │ │ └── util.py │ ├── ops.py │ ├── potential_issues.py │ ├── report.py │ ├── security.py │ ├── solver.py │ ├── swc_data.py │ ├── symbolic.py │ ├── templates │ │ ├── callgraph.html │ │ ├── report_as_markdown.jinja2 │ │ └── report_as_text.jinja2 │ └── traceexplore.py ├── concolic │ ├── __init__.py │ ├── concolic_execution.py │ ├── concrete_data.py │ └── find_trace.py ├── config.ini ├── disassembler │ ├── __init__.py │ ├── asm.py │ └── disassembly.py ├── ethereum │ ├── __init__.py │ ├── evmcontract.py │ ├── interface │ │ ├── __init__.py │ │ └── rpc │ │ │ ├── __init__.py │ │ │ ├── base_client.py │ │ │ ├── client.py │ │ │ ├── constants.py │ │ │ ├── exceptions.py │ │ │ └── utils.py │ └── util.py ├── exceptions.py ├── interfaces │ ├── __init__.py │ ├── cli.py │ └── epic.py ├── laser │ ├── __init__.py │ ├── ethereum │ │ ├── __init__.py │ │ ├── call.py │ │ ├── cfg.py │ │ ├── cheat_code.py │ │ ├── evm_exceptions.py │ │ ├── function_managers │ │ │ ├── __init__.py │ │ │ ├── exponent_function_manager.py │ │ │ └── keccak_function_manager.py │ │ ├── instruction_data.py │ │ ├── instructions.py │ │ ├── natives.py │ │ ├── state │ │ │ ├── __init__.py │ │ │ ├── account.py │ │ │ ├── annotation.py │ │ │ ├── calldata.py │ │ │ ├── constraints.py │ │ │ ├── environment.py │ │ │ ├── global_state.py │ │ │ ├── machine_state.py │ │ │ ├── memory.py │ │ │ ├── return_data.py │ │ │ ├── transient_storage.py │ │ │ └── world_state.py │ │ ├── strategy │ │ │ ├── __init__.py │ │ │ ├── basic.py │ │ │ ├── beam.py │ │ │ ├── concolic.py │ │ │ ├── constraint_strategy.py │ │ │ └── extensions │ │ │ │ ├── __init__.py │ │ │ │ └── bounded_loops.py │ │ ├── svm.py │ │ ├── time_handler.py │ │ ├── transaction │ │ │ ├── __init__.py │ │ │ ├── concolic.py │ │ │ ├── symbolic.py │ │ │ └── transaction_models.py │ │ ├── tx_prioritiser │ │ │ ├── __init__.py │ │ │ └── rf_prioritiser.py │ │ └── util.py │ ├── execution_info.py │ ├── plugin │ │ ├── __init__.py │ │ ├── builder.py │ │ ├── interface.py │ │ ├── loader.py │ │ ├── plugins │ │ │ ├── __init__.py │ │ │ ├── benchmark.py │ │ │ ├── call_depth_limiter.py │ │ │ ├── coverage │ │ │ │ ├── __init__.py │ │ │ │ ├── coverage_plugin.py │ │ │ │ └── coverage_strategy.py │ │ │ ├── coverage_metrics │ │ │ │ ├── __init__.py │ │ │ │ ├── constants.py │ │ │ │ ├── coverage_data.py │ │ │ │ └── metrics_plugin.py │ │ │ ├── dependency_pruner.py │ │ │ ├── instruction_profiler.py │ │ │ ├── mutation_pruner.py │ │ │ ├── plugin_annotations.py │ │ │ ├── state_merge │ │ │ │ ├── __init__.py │ │ │ │ ├── check_mergeability.py │ │ │ │ ├── merge_states.py │ │ │ │ └── state_merge_plugin.py │ │ │ ├── summary │ │ │ │ ├── __init__.py │ │ │ │ ├── annotations.py │ │ │ │ ├── core.py │ │ │ │ └── summary.py │ │ │ ├── summary_backup │ │ │ │ └── __init__.py │ │ │ └── trace.py │ │ └── signals.py │ └── smt │ │ ├── __init__.py │ │ ├── array.py │ │ ├── bitvec.py │ │ ├── bitvec_helper.py │ │ ├── bool.py │ │ ├── expression.py │ │ ├── function.py │ │ ├── model.py │ │ └── solver │ │ ├── __init__.py │ │ ├── independence_solver.py │ │ ├── solver.py │ │ └── solver_statistics.py ├── mythril │ ├── __init__.py │ ├── mythril_analyzer.py │ ├── mythril_config.py │ └── mythril_disassembler.py ├── plugin │ ├── __init__.py │ ├── discovery.py │ ├── interface.py │ └── loader.py ├── solidity │ ├── __init__.py │ ├── features.py │ └── soliditycontract.py └── support │ ├── __init__.py │ ├── assets │ └── signatures.db │ ├── loader.py │ ├── lock.py │ ├── model.py │ ├── opcodes.py │ ├── signatures.py │ ├── source_support.py │ ├── start_time.py │ ├── support_args.py │ └── support_utils.py ├── pyproject.toml ├── requirements.txt ├── setup.py ├── solidity_examples ├── BECToken.sol ├── WalletLibrary.sol ├── calls.sol ├── etherstore.sol ├── exceptions.sol ├── hashforether.sol ├── killbilly.sol ├── origin.sol ├── returnvalue.sol ├── rubixi.sol ├── suicide.sol ├── timelock.sol ├── token.sol └── weak_random.sol ├── static ├── Ownable.html ├── assertions.html ├── callgraph7.png ├── callgraph8.png ├── mythril.html ├── mythril_new.png └── sample_report.md ├── tests ├── __init__.py ├── analysis │ ├── abi_decode_test.py │ └── arbitrary_jump_test.py ├── cli_tests │ └── cli_opts_test.py ├── cmd_line_test.py ├── concolic │ └── concolic_tests.py ├── disassembler │ ├── __init__.py │ ├── asm_test.py │ └── disassembly_test.py ├── disassembler_test.py ├── evmcontract_test.py ├── features_test.py ├── graph_test.py ├── instructions │ ├── __init__.py │ ├── basefee_test.py │ ├── codecopy_test.py │ ├── create2_test.py │ ├── create_test.py │ ├── extcodecopy_test.py │ ├── extcodehash_test.py │ ├── push_test.py │ ├── sar_test.py │ ├── shl_test.py │ ├── shr_test.py │ └── static_call_test.py ├── integration_tests │ ├── analysis_tests.py │ ├── coverage_metrics_test.py │ ├── old_version_test.py │ ├── safe_functions_test.py │ ├── solc_settings_test.py │ ├── src_mapping_test.py │ ├── state_merge_tests.py │ ├── summary_test.py │ ├── transient_storage_test.py │ ├── utils.py │ └── version_test.py ├── laser │ ├── Precompiles │ │ ├── blake2_test.py │ │ ├── ec_add_test.py │ │ ├── ecrecover_test.py │ │ ├── elliptic_curves_test.py │ │ ├── elliptic_mul_test.py │ │ ├── identity_test.py │ │ ├── mod_exp_test.py │ │ ├── ripemd_test.py │ │ └── sha256_test.py │ ├── __init__.py │ ├── evm_testsuite │ │ ├── VMTests │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── vmArithmeticTest │ │ │ │ ├── add0.json │ │ │ │ ├── add1.json │ │ │ │ ├── add2.json │ │ │ │ ├── add3.json │ │ │ │ ├── add4.json │ │ │ │ ├── addmod0.json │ │ │ │ ├── addmod1.json │ │ │ │ ├── addmod1_overflow2.json │ │ │ │ ├── addmod1_overflow3.json │ │ │ │ ├── addmod1_overflow4.json │ │ │ │ ├── addmod1_overflowDiff.json │ │ │ │ ├── addmod2.json │ │ │ │ ├── addmod2_0.json │ │ │ │ ├── addmod2_1.json │ │ │ │ ├── addmod3.json │ │ │ │ ├── addmod3_0.json │ │ │ │ ├── addmodBigIntCast.json │ │ │ │ ├── addmodDivByZero.json │ │ │ │ ├── addmodDivByZero1.json │ │ │ │ ├── addmodDivByZero2.json │ │ │ │ ├── addmodDivByZero3.json │ │ │ │ ├── arith1.json │ │ │ │ ├── div1.json │ │ │ │ ├── divBoostBug.json │ │ │ │ ├── divByNonZero0.json │ │ │ │ ├── divByNonZero1.json │ │ │ │ ├── divByNonZero2.json │ │ │ │ ├── divByNonZero3.json │ │ │ │ ├── divByZero.json │ │ │ │ ├── divByZero_2.json │ │ │ │ ├── exp0.json │ │ │ │ ├── exp1.json │ │ │ │ ├── exp2.json │ │ │ │ ├── exp3.json │ │ │ │ ├── exp4.json │ │ │ │ ├── exp5.json │ │ │ │ ├── exp6.json │ │ │ │ ├── exp7.json │ │ │ │ ├── exp8.json │ │ │ │ ├── expPowerOf256Of256_0.json │ │ │ │ ├── expPowerOf256Of256_1.json │ │ │ │ ├── expPowerOf256Of256_10.json │ │ │ │ ├── expPowerOf256Of256_11.json │ │ │ │ ├── expPowerOf256Of256_12.json │ │ │ │ ├── expPowerOf256Of256_13.json │ │ │ │ ├── expPowerOf256Of256_14.json │ │ │ │ ├── expPowerOf256Of256_15.json │ │ │ │ ├── expPowerOf256Of256_16.json │ │ │ │ ├── expPowerOf256Of256_17.json │ │ │ │ ├── expPowerOf256Of256_18.json │ │ │ │ ├── expPowerOf256Of256_19.json │ │ │ │ ├── expPowerOf256Of256_2.json │ │ │ │ ├── expPowerOf256Of256_20.json │ │ │ │ ├── expPowerOf256Of256_21.json │ │ │ │ ├── expPowerOf256Of256_22.json │ │ │ │ ├── expPowerOf256Of256_23.json │ │ │ │ ├── expPowerOf256Of256_24.json │ │ │ │ ├── expPowerOf256Of256_25.json │ │ │ │ ├── expPowerOf256Of256_26.json │ │ │ │ ├── expPowerOf256Of256_27.json │ │ │ │ ├── expPowerOf256Of256_28.json │ │ │ │ ├── expPowerOf256Of256_29.json │ │ │ │ ├── expPowerOf256Of256_3.json │ │ │ │ ├── expPowerOf256Of256_30.json │ │ │ │ ├── expPowerOf256Of256_31.json │ │ │ │ ├── expPowerOf256Of256_32.json │ │ │ │ ├── expPowerOf256Of256_33.json │ │ │ │ ├── expPowerOf256Of256_4.json │ │ │ │ ├── expPowerOf256Of256_5.json │ │ │ │ ├── expPowerOf256Of256_6.json │ │ │ │ ├── expPowerOf256Of256_7.json │ │ │ │ ├── expPowerOf256Of256_8.json │ │ │ │ ├── expPowerOf256Of256_9.json │ │ │ │ ├── expPowerOf256_1.json │ │ │ │ ├── expPowerOf256_10.json │ │ │ │ ├── expPowerOf256_11.json │ │ │ │ ├── expPowerOf256_12.json │ │ │ │ ├── expPowerOf256_13.json │ │ │ │ ├── expPowerOf256_14.json │ │ │ │ ├── expPowerOf256_15.json │ │ │ │ ├── expPowerOf256_16.json │ │ │ │ ├── expPowerOf256_17.json │ │ │ │ ├── expPowerOf256_18.json │ │ │ │ ├── expPowerOf256_19.json │ │ │ │ ├── expPowerOf256_2.json │ │ │ │ ├── expPowerOf256_20.json │ │ │ │ ├── expPowerOf256_21.json │ │ │ │ ├── expPowerOf256_22.json │ │ │ │ ├── expPowerOf256_23.json │ │ │ │ ├── expPowerOf256_24.json │ │ │ │ ├── expPowerOf256_25.json │ │ │ │ ├── expPowerOf256_26.json │ │ │ │ ├── expPowerOf256_27.json │ │ │ │ ├── expPowerOf256_28.json │ │ │ │ ├── expPowerOf256_29.json │ │ │ │ ├── expPowerOf256_3.json │ │ │ │ ├── expPowerOf256_30.json │ │ │ │ ├── expPowerOf256_31.json │ │ │ │ ├── expPowerOf256_32.json │ │ │ │ ├── expPowerOf256_33.json │ │ │ │ ├── expPowerOf256_4.json │ │ │ │ ├── expPowerOf256_5.json │ │ │ │ ├── expPowerOf256_6.json │ │ │ │ ├── expPowerOf256_7.json │ │ │ │ ├── expPowerOf256_8.json │ │ │ │ ├── expPowerOf256_9.json │ │ │ │ ├── expPowerOf2_128.json │ │ │ │ ├── expPowerOf2_16.json │ │ │ │ ├── expPowerOf2_2.json │ │ │ │ ├── expPowerOf2_256.json │ │ │ │ ├── expPowerOf2_32.json │ │ │ │ ├── expPowerOf2_4.json │ │ │ │ ├── expPowerOf2_64.json │ │ │ │ ├── expPowerOf2_8.json │ │ │ │ ├── expXY.json │ │ │ │ ├── expXY_success.json │ │ │ │ ├── fibbonacci_unrolled.json │ │ │ │ ├── mod0.json │ │ │ │ ├── mod1.json │ │ │ │ ├── mod2.json │ │ │ │ ├── mod3.json │ │ │ │ ├── mod4.json │ │ │ │ ├── modByZero.json │ │ │ │ ├── mul0.json │ │ │ │ ├── mul1.json │ │ │ │ ├── mul2.json │ │ │ │ ├── mul3.json │ │ │ │ ├── mul4.json │ │ │ │ ├── mul5.json │ │ │ │ ├── mul6.json │ │ │ │ ├── mul7.json │ │ │ │ ├── mulmod0.json │ │ │ │ ├── mulmod1.json │ │ │ │ ├── mulmod1_overflow.json │ │ │ │ ├── mulmod1_overflow2.json │ │ │ │ ├── mulmod1_overflow3.json │ │ │ │ ├── mulmod1_overflow4.json │ │ │ │ ├── mulmod2.json │ │ │ │ ├── mulmod2_0.json │ │ │ │ ├── mulmod2_1.json │ │ │ │ ├── mulmod3.json │ │ │ │ ├── mulmod3_0.json │ │ │ │ ├── mulmod4.json │ │ │ │ ├── mulmoddivByZero.json │ │ │ │ ├── mulmoddivByZero1.json │ │ │ │ ├── mulmoddivByZero2.json │ │ │ │ ├── mulmoddivByZero3.json │ │ │ │ ├── not1.json │ │ │ │ ├── sdiv0.json │ │ │ │ ├── sdiv1.json │ │ │ │ ├── sdiv2.json │ │ │ │ ├── sdiv3.json │ │ │ │ ├── sdiv4.json │ │ │ │ ├── sdiv5.json │ │ │ │ ├── sdiv6.json │ │ │ │ ├── sdiv7.json │ │ │ │ ├── sdiv8.json │ │ │ │ ├── sdiv9.json │ │ │ │ ├── sdivByZero0.json │ │ │ │ ├── sdivByZero1.json │ │ │ │ ├── sdivByZero2.json │ │ │ │ ├── sdiv_dejavu.json │ │ │ │ ├── sdiv_i256min.json │ │ │ │ ├── sdiv_i256min2.json │ │ │ │ ├── sdiv_i256min3.json │ │ │ │ ├── signextendInvalidByteNumber.json │ │ │ │ ├── signextend_00.json │ │ │ │ ├── signextend_0_BigByte.json │ │ │ │ ├── signextend_AlmostBiggestByte.json │ │ │ │ ├── signextend_BigByteBigByte.json │ │ │ │ ├── signextend_BigBytePlus1_2.json │ │ │ │ ├── signextend_BigByte_0.json │ │ │ │ ├── signextend_BitIsNotSet.json │ │ │ │ ├── signextend_BitIsNotSetInHigherByte.json │ │ │ │ ├── signextend_BitIsSetInHigherByte.json │ │ │ │ ├── signextend_Overflow_dj42.json │ │ │ │ ├── signextend_bigBytePlus1.json │ │ │ │ ├── signextend_bitIsSet.json │ │ │ │ ├── smod0.json │ │ │ │ ├── smod1.json │ │ │ │ ├── smod2.json │ │ │ │ ├── smod3.json │ │ │ │ ├── smod4.json │ │ │ │ ├── smod5.json │ │ │ │ ├── smod6.json │ │ │ │ ├── smod7.json │ │ │ │ ├── smod8_byZero.json │ │ │ │ ├── smod_i256min1.json │ │ │ │ ├── smod_i256min2.json │ │ │ │ ├── stop.json │ │ │ │ ├── sub0.json │ │ │ │ ├── sub1.json │ │ │ │ ├── sub2.json │ │ │ │ ├── sub3.json │ │ │ │ └── sub4.json │ │ │ ├── vmBitwiseLogicOperation │ │ │ │ ├── and0.json │ │ │ │ ├── and1.json │ │ │ │ ├── and2.json │ │ │ │ ├── and3.json │ │ │ │ ├── and4.json │ │ │ │ ├── and5.json │ │ │ │ ├── byte0.json │ │ │ │ ├── byte1.json │ │ │ │ ├── byte10.json │ │ │ │ ├── byte11.json │ │ │ │ ├── byte2.json │ │ │ │ ├── byte3.json │ │ │ │ ├── byte4.json │ │ │ │ ├── byte5.json │ │ │ │ ├── byte6.json │ │ │ │ ├── byte7.json │ │ │ │ ├── byte8.json │ │ │ │ ├── byte9.json │ │ │ │ ├── eq0.json │ │ │ │ ├── eq1.json │ │ │ │ ├── eq2.json │ │ │ │ ├── gt0.json │ │ │ │ ├── gt1.json │ │ │ │ ├── gt2.json │ │ │ │ ├── gt3.json │ │ │ │ ├── iszeo2.json │ │ │ │ ├── iszero0.json │ │ │ │ ├── iszero1.json │ │ │ │ ├── lt0.json │ │ │ │ ├── lt1.json │ │ │ │ ├── lt2.json │ │ │ │ ├── lt3.json │ │ │ │ ├── not0.json │ │ │ │ ├── not1.json │ │ │ │ ├── not2.json │ │ │ │ ├── not3.json │ │ │ │ ├── not4.json │ │ │ │ ├── not5.json │ │ │ │ ├── or0.json │ │ │ │ ├── or1.json │ │ │ │ ├── or2.json │ │ │ │ ├── or3.json │ │ │ │ ├── or4.json │ │ │ │ ├── or5.json │ │ │ │ ├── sgt0.json │ │ │ │ ├── sgt1.json │ │ │ │ ├── sgt2.json │ │ │ │ ├── sgt3.json │ │ │ │ ├── sgt4.json │ │ │ │ ├── slt0.json │ │ │ │ ├── slt1.json │ │ │ │ ├── slt2.json │ │ │ │ ├── slt3.json │ │ │ │ ├── slt4.json │ │ │ │ ├── xor0.json │ │ │ │ ├── xor1.json │ │ │ │ ├── xor2.json │ │ │ │ ├── xor3.json │ │ │ │ ├── xor4.json │ │ │ │ └── xor5.json │ │ │ ├── vmEnvironmentalInfo │ │ │ │ ├── address0.json │ │ │ │ ├── address1.json │ │ │ │ ├── calldatacopy0.json │ │ │ │ ├── calldatacopy0_return.json │ │ │ │ ├── calldatacopy1.json │ │ │ │ ├── calldatacopy1_return.json │ │ │ │ ├── calldatacopy2.json │ │ │ │ ├── calldatacopy2_return.json │ │ │ │ ├── calldatacopyUnderFlowerror.json │ │ │ │ ├── calldatacopyZeroMemExpansion.json │ │ │ │ ├── calldatacopyZeroMemExpansion_return.json │ │ │ │ ├── calldatacopy_DataIndexTooHigh.json │ │ │ │ ├── calldatacopy_DataIndexTooHigh2.json │ │ │ │ ├── calldatacopy_DataIndexTooHigh2_return.json │ │ │ │ ├── calldatacopy_DataIndexTooHigh_return.json │ │ │ │ ├── calldatacopy_sec.json │ │ │ │ ├── calldataload0.json │ │ │ │ ├── calldataload1.json │ │ │ │ ├── calldataload2.json │ │ │ │ ├── calldataloadSizeTooHigh.json │ │ │ │ ├── calldataloadSizeTooHighPartial.json │ │ │ │ ├── calldataload_BigOffset.json │ │ │ │ ├── calldatasize0.json │ │ │ │ ├── calldatasize1.json │ │ │ │ ├── calldatasize2.json │ │ │ │ ├── caller.json │ │ │ │ ├── callvalue.json │ │ │ │ ├── codecopy0.json │ │ │ │ ├── codecopyZeroMemExpansion.json │ │ │ │ ├── codecopy_DataIndexTooHigh.json │ │ │ │ ├── codesize.json │ │ │ │ ├── gasprice.json │ │ │ │ └── origin.json │ │ │ ├── vmIOandFlowOperations │ │ │ │ ├── BlockNumberDynamicJump0_AfterJumpdest.json │ │ │ │ ├── BlockNumberDynamicJump0_AfterJumpdest3.json │ │ │ │ ├── BlockNumberDynamicJump0_foreverOutOfGas.json │ │ │ │ ├── BlockNumberDynamicJump0_jumpdest0.json │ │ │ │ ├── BlockNumberDynamicJump0_jumpdest2.json │ │ │ │ ├── BlockNumberDynamicJump0_withoutJumpdest.json │ │ │ │ ├── BlockNumberDynamicJump1.json │ │ │ │ ├── BlockNumberDynamicJumpInsidePushWithJumpDest.json │ │ │ │ ├── BlockNumberDynamicJumpInsidePushWithoutJumpDest.json │ │ │ │ ├── BlockNumberDynamicJumpi0.json │ │ │ │ ├── BlockNumberDynamicJumpi1.json │ │ │ │ ├── BlockNumberDynamicJumpi1_jumpdest.json │ │ │ │ ├── BlockNumberDynamicJumpiAfterStop.json │ │ │ │ ├── BlockNumberDynamicJumpiOutsideBoundary.json │ │ │ │ ├── BlockNumberDynamicJumpifInsidePushWithJumpDest.json │ │ │ │ ├── BlockNumberDynamicJumpifInsidePushWithoutJumpDest.json │ │ │ │ ├── DyanmicJump0_outOfBoundary.json │ │ │ │ ├── DynamicJump0_AfterJumpdest.json │ │ │ │ ├── DynamicJump0_AfterJumpdest3.json │ │ │ │ ├── DynamicJump0_foreverOutOfGas.json │ │ │ │ ├── DynamicJump0_jumpdest0.json │ │ │ │ ├── DynamicJump0_jumpdest2.json │ │ │ │ ├── DynamicJump0_withoutJumpdest.json │ │ │ │ ├── DynamicJump1.json │ │ │ │ ├── DynamicJumpAfterStop.json │ │ │ │ ├── DynamicJumpInsidePushWithJumpDest.json │ │ │ │ ├── DynamicJumpInsidePushWithoutJumpDest.json │ │ │ │ ├── DynamicJumpJD_DependsOnJumps0.json │ │ │ │ ├── DynamicJumpJD_DependsOnJumps1.json │ │ │ │ ├── DynamicJumpPathologicalTest0.json │ │ │ │ ├── DynamicJumpPathologicalTest1.json │ │ │ │ ├── DynamicJumpPathologicalTest2.json │ │ │ │ ├── DynamicJumpPathologicalTest3.json │ │ │ │ ├── DynamicJumpStartWithJumpDest.json │ │ │ │ ├── DynamicJump_value1.json │ │ │ │ ├── DynamicJump_value2.json │ │ │ │ ├── DynamicJump_value3.json │ │ │ │ ├── DynamicJump_valueUnderflow.json │ │ │ │ ├── DynamicJumpi0.json │ │ │ │ ├── DynamicJumpi1.json │ │ │ │ ├── DynamicJumpi1_jumpdest.json │ │ │ │ ├── DynamicJumpiAfterStop.json │ │ │ │ ├── DynamicJumpiOutsideBoundary.json │ │ │ │ ├── DynamicJumpifInsidePushWithJumpDest.json │ │ │ │ ├── DynamicJumpifInsidePushWithoutJumpDest.json │ │ │ │ ├── JDfromStorageDynamicJump0_AfterJumpdest.json │ │ │ │ ├── JDfromStorageDynamicJump0_AfterJumpdest3.json │ │ │ │ ├── JDfromStorageDynamicJump0_foreverOutOfGas.json │ │ │ │ ├── JDfromStorageDynamicJump0_jumpdest0.json │ │ │ │ ├── JDfromStorageDynamicJump0_jumpdest2.json │ │ │ │ ├── JDfromStorageDynamicJump0_withoutJumpdest.json │ │ │ │ ├── JDfromStorageDynamicJump1.json │ │ │ │ ├── JDfromStorageDynamicJumpInsidePushWithJumpDest.json │ │ │ │ ├── JDfromStorageDynamicJumpInsidePushWithoutJumpDest.json │ │ │ │ ├── JDfromStorageDynamicJumpi0.json │ │ │ │ ├── JDfromStorageDynamicJumpi1.json │ │ │ │ ├── JDfromStorageDynamicJumpi1_jumpdest.json │ │ │ │ ├── JDfromStorageDynamicJumpiAfterStop.json │ │ │ │ ├── JDfromStorageDynamicJumpiOutsideBoundary.json │ │ │ │ ├── JDfromStorageDynamicJumpifInsidePushWithJumpDest.json │ │ │ │ ├── JDfromStorageDynamicJumpifInsidePushWithoutJumpDest.json │ │ │ │ ├── bad_indirect_jump1.json │ │ │ │ ├── bad_indirect_jump2.json │ │ │ │ ├── byte1.json │ │ │ │ ├── calldatacopyMemExp.json │ │ │ │ ├── codecopyMemExp.json │ │ │ │ ├── deadCode_1.json │ │ │ │ ├── dupAt51becameMload.json │ │ │ │ ├── for_loop1.json │ │ │ │ ├── for_loop2.json │ │ │ │ ├── gas0.json │ │ │ │ ├── gas1.json │ │ │ │ ├── gasOverFlow.json │ │ │ │ ├── indirect_jump1.json │ │ │ │ ├── indirect_jump2.json │ │ │ │ ├── indirect_jump3.json │ │ │ │ ├── indirect_jump4.json │ │ │ │ ├── jump0_AfterJumpdest.json │ │ │ │ ├── jump0_AfterJumpdest3.json │ │ │ │ ├── jump0_foreverOutOfGas.json │ │ │ │ ├── jump0_jumpdest0.json │ │ │ │ ├── jump0_jumpdest2.json │ │ │ │ ├── jump0_outOfBoundary.json │ │ │ │ ├── jump0_withoutJumpdest.json │ │ │ │ ├── jump1.json │ │ │ │ ├── jumpAfterStop.json │ │ │ │ ├── jumpDynamicJumpSameDest.json │ │ │ │ ├── jumpHigh.json │ │ │ │ ├── jumpInsidePushWithJumpDest.json │ │ │ │ ├── jumpInsidePushWithoutJumpDest.json │ │ │ │ ├── jumpOntoJump.json │ │ │ │ ├── jumpTo1InstructionafterJump.json │ │ │ │ ├── jumpTo1InstructionafterJump_jumpdestFirstInstruction.json │ │ │ │ ├── jumpTo1InstructionafterJump_noJumpDest.json │ │ │ │ ├── jumpToUint64maxPlus1.json │ │ │ │ ├── jumpToUintmaxPlus1.json │ │ │ │ ├── jumpdestBigList.json │ │ │ │ ├── jumpi0.json │ │ │ │ ├── jumpi1.json │ │ │ │ ├── jumpi1_jumpdest.json │ │ │ │ ├── jumpiAfterStop.json │ │ │ │ ├── jumpiOutsideBoundary.json │ │ │ │ ├── jumpiToUint64maxPlus1.json │ │ │ │ ├── jumpiToUintmaxPlus1.json │ │ │ │ ├── jumpi_at_the_end.json │ │ │ │ ├── jumpifInsidePushWithJumpDest.json │ │ │ │ ├── jumpifInsidePushWithoutJumpDest.json │ │ │ │ ├── kv1.json │ │ │ │ ├── log1MemExp.json │ │ │ │ ├── loop_stacklimit_1020.json │ │ │ │ ├── loop_stacklimit_1021.json │ │ │ │ ├── memory1.json │ │ │ │ ├── mloadError0.json │ │ │ │ ├── mloadError1.json │ │ │ │ ├── mloadMemExp.json │ │ │ │ ├── mloadOutOfGasError2.json │ │ │ │ ├── msize0.json │ │ │ │ ├── msize1.json │ │ │ │ ├── msize2.json │ │ │ │ ├── msize3.json │ │ │ │ ├── mstore0.json │ │ │ │ ├── mstore1.json │ │ │ │ ├── mstore8MemExp.json │ │ │ │ ├── mstore8WordToBigError.json │ │ │ │ ├── mstore8_0.json │ │ │ │ ├── mstore8_1.json │ │ │ │ ├── mstoreMemExp.json │ │ │ │ ├── mstoreWordToBigError.json │ │ │ │ ├── mstore_mload0.json │ │ │ │ ├── pc0.json │ │ │ │ ├── pc1.json │ │ │ │ ├── pop0.json │ │ │ │ ├── pop1.json │ │ │ │ ├── return1.json │ │ │ │ ├── return2.json │ │ │ │ ├── sha3MemExp.json │ │ │ │ ├── sstore_load_0.json │ │ │ │ ├── sstore_load_1.json │ │ │ │ ├── sstore_load_2.json │ │ │ │ ├── sstore_underflow.json │ │ │ │ ├── stack_loop.json │ │ │ │ ├── stackjump1.json │ │ │ │ ├── swapAt52becameMstore.json │ │ │ │ └── when.json │ │ │ ├── vmPushDupSwapTest │ │ │ │ ├── dup1.json │ │ │ │ ├── dup10.json │ │ │ │ ├── dup11.json │ │ │ │ ├── dup12.json │ │ │ │ ├── dup13.json │ │ │ │ ├── dup14.json │ │ │ │ ├── dup15.json │ │ │ │ ├── dup16.json │ │ │ │ ├── dup2.json │ │ │ │ ├── dup2error.json │ │ │ │ ├── dup3.json │ │ │ │ ├── dup4.json │ │ │ │ ├── dup5.json │ │ │ │ ├── dup6.json │ │ │ │ ├── dup7.json │ │ │ │ ├── dup8.json │ │ │ │ ├── dup9.json │ │ │ │ ├── push1.json │ │ │ │ ├── push10.json │ │ │ │ ├── push11.json │ │ │ │ ├── push12.json │ │ │ │ ├── push13.json │ │ │ │ ├── push14.json │ │ │ │ ├── push15.json │ │ │ │ ├── push16.json │ │ │ │ ├── push17.json │ │ │ │ ├── push18.json │ │ │ │ ├── push19.json │ │ │ │ ├── push1_missingStack.json │ │ │ │ ├── push2.json │ │ │ │ ├── push20.json │ │ │ │ ├── push21.json │ │ │ │ ├── push22.json │ │ │ │ ├── push23.json │ │ │ │ ├── push24.json │ │ │ │ ├── push25.json │ │ │ │ ├── push26.json │ │ │ │ ├── push27.json │ │ │ │ ├── push28.json │ │ │ │ ├── push29.json │ │ │ │ ├── push3.json │ │ │ │ ├── push30.json │ │ │ │ ├── push31.json │ │ │ │ ├── push32.json │ │ │ │ ├── push32AndSuicide.json │ │ │ │ ├── push32FillUpInputWithZerosAtTheEnd.json │ │ │ │ ├── push32Undefined.json │ │ │ │ ├── push32Undefined2.json │ │ │ │ ├── push32Undefined3.json │ │ │ │ ├── push33.json │ │ │ │ ├── push4.json │ │ │ │ ├── push5.json │ │ │ │ ├── push6.json │ │ │ │ ├── push7.json │ │ │ │ ├── push8.json │ │ │ │ ├── push9.json │ │ │ │ ├── swap1.json │ │ │ │ ├── swap10.json │ │ │ │ ├── swap11.json │ │ │ │ ├── swap12.json │ │ │ │ ├── swap13.json │ │ │ │ ├── swap14.json │ │ │ │ ├── swap15.json │ │ │ │ ├── swap16.json │ │ │ │ ├── swap2.json │ │ │ │ ├── swap2error.json │ │ │ │ ├── swap3.json │ │ │ │ ├── swap4.json │ │ │ │ ├── swap5.json │ │ │ │ ├── swap6.json │ │ │ │ ├── swap7.json │ │ │ │ ├── swap8.json │ │ │ │ ├── swap9.json │ │ │ │ └── swapjump1.json │ │ │ ├── vmRandomTest │ │ │ │ ├── 201503102320PYTHON.json │ │ │ │ ├── 201503110206PYTHON.json │ │ │ │ ├── 201503110219PYTHON.json │ │ │ │ ├── 201503110346PYTHON_PUSH24.json │ │ │ │ ├── 201503111844PYTHON.json │ │ │ │ └── 201503112218PYTHON.json │ │ │ ├── vmSha3Test │ │ │ │ ├── sha3_0.json │ │ │ │ ├── sha3_1.json │ │ │ │ ├── sha3_2.json │ │ │ │ ├── sha3_3oog.json │ │ │ │ ├── sha3_4oog.json │ │ │ │ ├── sha3_5oog.json │ │ │ │ ├── sha3_6oog.json │ │ │ │ ├── sha3_bigOffset2.json │ │ │ │ ├── sha3_bigOffsetoog.json │ │ │ │ ├── sha3_bigSizeoog.json │ │ │ │ ├── sha3_memSizeNoQuadraticCost31.json │ │ │ │ ├── sha3_memSizeQuadraticCost32.json │ │ │ │ ├── sha3_memSizeQuadraticCost32_zeroSize.json │ │ │ │ ├── sha3_memSizeQuadraticCost33.json │ │ │ │ ├── sha3_memSizeQuadraticCost63.json │ │ │ │ ├── sha3_memSizeQuadraticCost64.json │ │ │ │ ├── sha3_memSizeQuadraticCost64_2.json │ │ │ │ └── sha3_memSizeQuadraticCost65.json │ │ │ ├── vmSystemOperations │ │ │ │ ├── TestNameRegistrator.json │ │ │ │ ├── return0.json │ │ │ │ ├── return1.json │ │ │ │ ├── return2.json │ │ │ │ ├── suicide0.json │ │ │ │ ├── suicideNotExistingAccount.json │ │ │ │ └── suicideSendEtherToMe.json │ │ │ └── vmTests │ │ │ │ └── suicide.json │ │ └── evm_test.py │ ├── keccak_tests.py │ ├── smt │ │ ├── __init__.py │ │ ├── independece_solver_test.py │ │ └── model_test.py │ ├── state │ │ ├── __init__.py │ │ ├── calldata_test.py │ │ ├── mstack_test.py │ │ ├── mstate_test.py │ │ ├── storage_test.py │ │ └── world_state_account_exist_load_test.py │ ├── strategy │ │ ├── beam_test.py │ │ └── loop_bound_test.py │ ├── transaction │ │ ├── __init__.py │ │ ├── create_transaction_test.py │ │ └── symbolic_test.py │ ├── transaction_test.py │ └── tx_prioritisation_test.py ├── mythril │ ├── mythril_analyzer_test.py │ ├── mythril_config_test.py │ └── mythril_disassembler_test.py ├── plugin │ ├── interface_test.py │ └── loader_test.py ├── pre-commit-hooks │ ├── Counter.sol │ └── test.sh ├── rpc_test.py ├── solidity_contract_test.py ├── statespace_test.py ├── testdata │ ├── __init__.py │ ├── compile.py │ ├── concolic_io │ │ ├── multi_contract_example.sol │ │ ├── multi_contract_example_input.json │ │ ├── multiple_example.sol │ │ ├── multiple_example_input.json │ │ ├── simple_example.sol │ │ ├── simple_example_input.json │ │ ├── two_contract.sol │ │ └── two_contract_input.json │ ├── input_contracts │ │ ├── SecureVault.sol │ │ ├── SimpleModifier.sol │ │ ├── WalletLibrary.sol │ │ ├── base_case.sol │ │ ├── calls.sol │ │ ├── complex.sol │ │ ├── constructor_assert.sol │ │ ├── destruct.sol │ │ ├── destruct_crlf.sol │ │ ├── environments.sol │ │ ├── ether_send.sol │ │ ├── exceptions.sol │ │ ├── exceptions_0.8.0.sol │ │ ├── extcall.sol │ │ ├── flag_array.sol │ │ ├── hash_test.sol │ │ ├── integer_edge_case.sol │ │ ├── kcalls.sol │ │ ├── large.sol │ │ ├── metacoin.sol │ │ ├── multi_contracts.sol │ │ ├── nonascii.sol │ │ ├── old_origin.sol │ │ ├── old_version.sol │ │ ├── origin.sol │ │ ├── overflow.sol │ │ ├── regression_1.sol │ │ ├── requirements_violation_neg.sol │ │ ├── requirements_violation_pos.sol │ │ ├── returnvalue.sol │ │ ├── rubixi.sol │ │ ├── safe_funcs.sol │ │ ├── simple_theft.sol │ │ ├── suicide.sol │ │ ├── symbolic_exec_bytecode.sol │ │ ├── theft.sol │ │ ├── transient.sol │ │ ├── transient_bug.sol │ │ ├── transient_bug_2.sol │ │ ├── transient_recursive.sol │ │ ├── tx.sol │ │ ├── underflow.sol │ │ ├── unexpected_ether_neg.sol │ │ ├── unexpected_ether_pos.sol │ │ ├── version_2.sol │ │ ├── version_3.sol │ │ ├── version_4.sol │ │ ├── version_chaos.sol │ │ ├── version_contract.sol │ │ ├── version_contract_0.7.0.sol │ │ ├── version_contract_0.8.0.sol │ │ ├── version_patch.sol │ │ └── weak_random.sol │ ├── inputs │ │ ├── calls.sol.o │ │ ├── coverage.sol.o │ │ ├── environments.sol.o │ │ ├── ether_send.sol.o │ │ ├── exceptions.sol.o │ │ ├── exceptions_0.8.0.sol.o │ │ ├── extcall.sol.o │ │ ├── flag_array.sol.o │ │ ├── kinds_of_calls.sol.o │ │ ├── metacoin.sol.o │ │ ├── multi_contracts.sol.o │ │ ├── nonascii.sol.o │ │ ├── origin.sol.o │ │ ├── overflow.sol.o │ │ ├── returnvalue.sol.o │ │ ├── safe_funcs.sol.o │ │ ├── suicide.sol.o │ │ ├── symbolic_exec_bytecode.sol.o │ │ └── underflow.sol.o │ ├── json_test_dir │ │ ├── PRC20.sol │ │ ├── dir_a │ │ │ ├── input_file.sol │ │ │ └── input_file_args.sol │ │ ├── test_file.json │ │ └── test_file_disable.json │ ├── mythril_config_inputs │ │ └── config.ini │ └── outputs_expected │ │ ├── calls.sol.o.easm │ │ ├── calls.sol.o.graph.html │ │ ├── environments.sol.o.easm │ │ ├── environments.sol.o.graph.html │ │ ├── ether_send.sol.o.easm │ │ ├── ether_send.sol.o.graph.html │ │ ├── exceptions.sol.o.easm │ │ ├── exceptions.sol.o.graph.html │ │ ├── kinds_of_calls.sol.o.easm │ │ ├── kinds_of_calls.sol.o.graph.html │ │ ├── metacoin.sol.o.easm │ │ ├── metacoin.sol.o.graph.html │ │ ├── multi_contracts.sol.o.easm │ │ ├── multi_contracts.sol.o.graph.html │ │ ├── nonascii.sol.o.easm │ │ ├── nonascii.sol.o.graph.html │ │ ├── origin.sol.o.easm │ │ ├── origin.sol.o.graph.html │ │ ├── overflow.sol.o.easm │ │ ├── overflow.sol.o.graph.html │ │ ├── returnvalue.sol.o.easm │ │ ├── returnvalue.sol.o.graph.html │ │ ├── suicide.sol.o.easm │ │ ├── suicide.sol.o.graph.html │ │ ├── underflow.sol.o.easm │ │ └── underflow.sol.o.graph.html ├── teststorage │ ├── contractstorage.fs │ ├── contractstorage.fs.index │ └── contractstorage.fs.tmp └── util_tests.py └── tox.ini /.dockerignore: -------------------------------------------------------------------------------- 1 | /.* 2 | /build 3 | /docker-bake.hcl 4 | /Dockerfile 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | 7 | [*.py] 8 | indent_style = space 9 | indent_size = 4 10 | charset = utf-8 11 | 12 | [*.jinja2] 13 | insert_final_newline = false 14 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | tests/testdata/* linguist-detectable=false 2 | static/* linguist-documentation 3 | 4 | # Solidity 5 | *.sol linguist-language=Solidity 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/analysis-module.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Analysis module 3 | about: Create an analysis module feature request 4 | 5 | --- 6 | 7 | 8 | 9 | ## Description 10 | 11 | 13 | 14 | ## Tests 15 | 16 | 21 | 22 | ## Implementation details 23 | 24 | 28 | 29 | ## Links 30 | 31 | 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Tell us about a new feature that would make Mythril better 4 | 5 | --- 6 | 7 | ## Description 8 | 9 | 10 | 11 | ## Background 12 | 13 | 15 | 16 | ## Tests 17 | 18 | 28 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | groups: 8 | workflows: 9 | patterns: 10 | - '*' 11 | - package-ecosystem: "pip" 12 | directory: "/" 13 | schedule: 14 | interval: "weekly" 15 | -------------------------------------------------------------------------------- /.github/workflows/container.yml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | paths: 4 | - .github/workflows/container.yml 5 | - Dockerfile 6 | - docker_build_and_deploy.sh 7 | - requirements.txt 8 | - setup.py 9 | 10 | name: container 11 | 12 | concurrency: 13 | # Concurrency group that uses the workflow name and PR number if available 14 | # or commit SHA as a fallback. If a new build is triggered under that 15 | # concurrency group while a previous build is running it will be canceled. 16 | # Repeated pushes to a PR will cancel all previous builds, while multiple 17 | # merges to a branch will not cancel. 18 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} 19 | cancel-in-progress: true 20 | 21 | jobs: 22 | test: 23 | runs-on: ubuntu-latest 24 | timeout-minutes: 60 25 | steps: 26 | - uses: actions/checkout@v4 27 | - name: build and test 28 | run: | 29 | # when no DOCKERHUB_USERNAME is set, this only builds the 30 | # container and runs the myth-smoke-test 31 | ./docker_build_and_deploy.sh mythril/myth-dev 32 | -------------------------------------------------------------------------------- /.github/workflows/pre-commit-hooks-test.yml: -------------------------------------------------------------------------------- 1 | name: pre-commit 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - develop 8 | tags: 9 | - '*' 10 | pull_request: 11 | paths: 12 | - .github/workflows/pre-commit-hooks-test.yml 13 | - .pre-commit-hooks.yaml 14 | - tests/pre-commit-hooks/* 15 | - requirements.txt 16 | - setup.py 17 | 18 | jobs: 19 | hooks-test: 20 | runs-on: ubuntu-latest 21 | name: test hooks 22 | steps: 23 | - uses: actions/checkout@v4 24 | - uses: actions/setup-python@v5 25 | with: 26 | python-version: '3.12' 27 | - name: Install pre-commit 28 | run: | 29 | python -m pip install pre-commit 30 | - name: Test hooks 31 | run: | 32 | ./tests/pre-commit-hooks/test.sh 33 | -------------------------------------------------------------------------------- /.github/workflows/pre-commit.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: 4 | - master 5 | - develop 6 | tags: 7 | - '*' 8 | pull_request: 9 | 10 | name: pre-commit 11 | 12 | concurrency: 13 | # Concurrency group that uses the workflow name and PR number if available 14 | # or commit SHA as a fallback. If a new build is triggered under that 15 | # concurrency group while a previous build is running it will be canceled. 16 | # Repeated pushes to a PR will cancel all previous builds, while multiple 17 | # merges to a branch will not cancel. 18 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} 19 | cancel-in-progress: true 20 | 21 | jobs: 22 | check: 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v4 26 | - uses: actions/setup-python@v5 27 | with: 28 | python-version: '3.9' 29 | - uses: pre-commit/action@v3.0.1 30 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # See https://pre-commit.com for more information 2 | # See https://pre-commit.com/hooks.html for more hooks 3 | # Apply to all files without commiting: 4 | # pre-commit run --all-files 5 | # Update this file: 6 | # pre-commit autoupdate 7 | repos: 8 | - repo: https://github.com/pre-commit/pre-commit-hooks 9 | rev: v5.0.0 10 | hooks: 11 | - id: check-toml 12 | - id: check-yaml 13 | - repo: https://github.com/astral-sh/ruff-pre-commit 14 | rev: v0.9.1 15 | hooks: 16 | # lint & attempt to correct failures 17 | - id: ruff 18 | args: [--fix, --show-fixes] 19 | # compatible replacement for black 20 | - id: ruff-format 21 | - repo: https://github.com/scop/pre-commit-shfmt 22 | rev: v3.10.0-2 23 | hooks: 24 | - id: shfmt 25 | args: [--write, --indent, '4'] 26 | - repo: https://github.com/shellcheck-py/shellcheck-py 27 | rev: v0.10.0.1 28 | hooks: 29 | - id: shellcheck 30 | - repo: https://github.com/hadolint/hadolint 31 | rev: v2.12.0 32 | hooks: 33 | - id: hadolint-docker 34 | - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks 35 | rev: v2.14.0 36 | hooks: 37 | - id: pretty-format-toml 38 | args: [--autofix] 39 | - repo: https://github.com/python-jsonschema/check-jsonschema 40 | rev: 0.31.0 41 | hooks: 42 | - id: check-circle-ci 43 | - id: check-github-workflows 44 | - id: check-dependabot 45 | - repo: meta 46 | hooks: 47 | - id: check-hooks-apply 48 | - id: check-useless-excludes 49 | -------------------------------------------------------------------------------- /.pre-commit-hooks.yaml: -------------------------------------------------------------------------------- 1 | - id: mythril 2 | name: Mythril 3 | description: Analyze EVM bytecode with Mythril 4 | entry: myth 5 | args: 6 | - analyze 7 | language: python 8 | types: ["solidity"] 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Mythril 2 | Hi, if you are reading this that means that you probably want to contribute to Mythril, awesome! If not, then this file might not contain much useful information for you. 3 | 4 | ## Creating an issue 5 | If you have found a problem with Mythril or want to propose a new feature then you can do this using GitHub issues. 6 | We already created some templates to make this process easier, but if your issue/feature request does not fit within the template then feel free to deviate. 7 | 8 | If you have a small question or aren't sure if you should create an issue for your problem/suggestion then you can always hop by on our [Discord server](https://discord.gg/FGMkcU2). 9 | 10 | # Coding 11 | If you want to help out with the development of Mythril then you can take a look at our issues or [Waffle board](https://waffle.io/ConsenSys/mythril). 12 | 13 | Before you start working on an issue please stop by on Discord to message a collaborator, this way we can assign you to the issue making sure nobody does double work. We can also provide you with support through Discord if there are any questions during the development process. 14 | 15 | ## New ideas 16 | Before you start working on a new idea, it's useful to create an issue on GitHub, that way we know what you want to implement and that you are working on it. Additionally, it might happen that your feature does not fit with our roadmap, in which case it would be unfortunate if you have already spent some time working on it. 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) since 2017 Bernhard Mueller 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include mythril/support/assets/* 2 | include mythril/analysis/templates/* 3 | include requirements.txt -------------------------------------------------------------------------------- /all_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | echo -n "Checking Python version... " 6 | python -c 'import sys 7 | print(sys.version) 8 | assert sys.version_info[0:2] >= (3,5), \ 9 | """Please make sure you are using Python 3.5 or later. 10 | You ran with {}""".format(sys.version)' || exit $? 11 | 12 | rm -rf ./tests/testdata/outputs_current/ 13 | mkdir -p ./tests/testdata/outputs_current/ 14 | rm -rf ./tests/testdata/outputs_current_laser_result/ 15 | mkdir -p ./tests/testdata/outputs_current_laser_result/ 16 | mkdir -p /tmp/test-reports 17 | pytest --junitxml=/tmp/test-reports/junit.xml 18 | -------------------------------------------------------------------------------- /coverage_report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | python --version 4 | echo "Please make sure you are using python 3.6.x" 5 | 6 | rm -rf ./tests/testdata/outputs_current/ 7 | mkdir -p ./tests/testdata/outputs_current/ 8 | rm -rf ./tests/testdata/outputs_current_laser_result/ 9 | mkdir -p ./tests/testdata/outputs_current_laser_result/ 10 | rm -rf coverage_html_report 11 | 12 | py.test \ 13 | --cov=mythril \ 14 | --cov-config=tox.ini \ 15 | --cov-report=html:coverage_reports/coverage_html_report \ 16 | --cov-report=xml:coverage_reports/coverage_xml_report.xml 17 | -------------------------------------------------------------------------------- /docker-bake.hcl: -------------------------------------------------------------------------------- 1 | variable "REGISTRY" { 2 | default = "docker.io" 3 | } 4 | 5 | variable "VERSION" { 6 | default = "dev" 7 | } 8 | 9 | variable "PYTHON_VERSION" { 10 | default = "3.10" 11 | } 12 | 13 | variable "INSTALLED_SOLC_VERSIONS" { 14 | default = "0.8.19" 15 | } 16 | 17 | function "myth-tags" { 18 | params = [NAME] 19 | result = formatlist("${REGISTRY}/${NAME}:%s", split(",", VERSION)) 20 | } 21 | 22 | group "default" { 23 | targets = ["myth", "myth-smoke-test"] 24 | } 25 | 26 | target "_myth-base" { 27 | target = "myth" 28 | args = { 29 | PYTHON_VERSION = PYTHON_VERSION 30 | INSTALLED_SOLC_VERSIONS = INSTALLED_SOLC_VERSIONS 31 | } 32 | platforms = [ 33 | "linux/amd64", 34 | "linux/arm64" 35 | ] 36 | } 37 | 38 | target "myth" { 39 | inherits = ["_myth-base"] 40 | tags = myth-tags("mythril/myth") 41 | } 42 | 43 | target "myth-dev" { 44 | inherits = ["_myth-base"] 45 | tags = myth-tags("mythril/myth-dev") 46 | } 47 | 48 | target "myth-smoke-test" { 49 | inherits = ["_myth-base"] 50 | target = "myth-smoke-test" 51 | output = ["build/docker/smoke-test"] 52 | } 53 | -------------------------------------------------------------------------------- /docker/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | # Install extra solc versions if SOLC is set 5 | if [[ ${SOLC:-} != "" ]]; then 6 | read -ra solc_versions <<<"${SOLC:?}" 7 | svm install "${solc_versions[@]}" 8 | fi 9 | # Always sync versions, as the should be at least one solc version installed 10 | # in the base image, and we may be running as root rather than the mythril user. 11 | sync-svm-solc-versions-with-solcx 12 | 13 | # By default we run myth with options from arguments we received. But if the 14 | # first argument is a valid program, we execute that instead so that people can 15 | # run other commands without overriding the entrypoint (e.g. bash). 16 | if command -v "${1:-}" >/dev/null; then 17 | exec -- "$@" 18 | fi 19 | exec -- myth "$@" 20 | -------------------------------------------------------------------------------- /docker/sync-svm-solc-versions-with-solcx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | # Let solcx know about the solc versions installed by svm. 5 | # We do this by symlinking svm's solc binaries into solcx's solc dir. 6 | [[ -e ~/.svm ]] || exit 0 7 | mkdir -p ~/.solcx 8 | readarray -t svm_solc_bins <<<"$(find ~/.svm -type f -name 'solc-*')" 9 | [[ ${svm_solc_bins[0]} != "" ]] || exit 0 10 | for svm_solc in "${svm_solc_bins[@]}"; do 11 | name=$(basename "${svm_solc:?}") 12 | version="${name#"solc-"}" # strip solc- prefix 13 | solcx_solc=~/.solcx/"solc-v${version:?}" 14 | if [[ ! -e $solcx_solc ]]; then 15 | ln -s "${svm_solc:?}" "${solcx_solc:?}" 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /docker_build_and_deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eo pipefail 4 | 5 | NAME=$1 6 | 7 | if [[ ! $NAME =~ ^mythril/myth(-dev)?$ ]]; then 8 | echo "Error: unknown image name: $NAME" >&2 9 | exit 1 10 | fi 11 | 12 | if [ -n "$CIRCLE_TAG" ]; then 13 | GIT_VERSION=${CIRCLE_TAG#?} 14 | else 15 | GIT_VERSION=${CIRCLE_SHA1} 16 | fi 17 | 18 | export DOCKER_BUILDKIT=1 19 | docker buildx create --use 20 | 21 | # Build and test all versions of the image. (The result will stay in the cache, 22 | # so the next build should be almost instant.) 23 | docker buildx bake myth-smoke-test 24 | 25 | if [ -z "$DOCKERHUB_USERNAME" ]; then 26 | echo "Finishing without pushing to dockerhub" 27 | exit 0 28 | fi 29 | 30 | echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin 31 | 32 | # strip mythril/ from NAME, e.g. myth or myth-dev 33 | BAKE_TARGET="${NAME#mythril/}" 34 | 35 | VERSION="${GIT_VERSION:?},latest" docker buildx bake --push "${BAKE_TARGET:?}" 36 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = source 8 | BUILDDIR = build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/source/about.rst: -------------------------------------------------------------------------------- 1 | What is Mythril? 2 | ======================== 3 | 4 | Mythril is a security analysis tool for Ethereum smart contracts. It was `introduced at HITBSecConf 2018 `_. 5 | 6 | Mythril detects a range of security issues, including integer underflows, owner-overwrite-to-Ether-withdrawal, and others. Note that Mythril is targeted at finding common vulnerabilities, and is not able to discover issues in the business logic of an application. Furthermore, Mythril and symbolic executors are generally unsound, as they are often unable to explore all possible states of a program. 7 | -------------------------------------------------------------------------------- /docs/source/analysis-modules.rst: -------------------------------------------------------------------------------- 1 | Analysis Modules 2 | ================ 3 | 4 | Mythril's detection capabilities are written in modules in the `/analysis/module/modules `_ directory. 5 | 6 | 7 | .. toctree:: 8 | :maxdepth: 2 9 | 10 | module-list.rst 11 | create-module.rst 12 | -------------------------------------------------------------------------------- /docs/source/create-module.rst: -------------------------------------------------------------------------------- 1 | Creating a Module 2 | ================= 3 | 4 | Create a module in the :code:`analysis/modules` directory, and create an instance of a class that inherits :code:`DetectionModule` named :code:`detector`. Take a look at the `suicide module `_ as an example. 5 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to Mythril's documentation! 2 | =========================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | :caption: Table of Contents: 7 | 8 | about 9 | installation 10 | tutorial 11 | security-analysis 12 | analysis-modules 13 | mythril 14 | 15 | 16 | Indices and Tables 17 | ================== 18 | 19 | * :ref:`genindex` 20 | * :ref:`modindex` 21 | * :ref:`search` 22 | 23 | -------------------------------------------------------------------------------- /docs/source/modules.rst: -------------------------------------------------------------------------------- 1 | mythril 2 | ======= 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | mythril 8 | -------------------------------------------------------------------------------- /docs/source/mythril.analysis.module.rst: -------------------------------------------------------------------------------- 1 | mythril.analysis.module package 2 | =============================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | :maxdepth: 4 9 | 10 | mythril.analysis.module.modules 11 | 12 | Submodules 13 | ---------- 14 | 15 | mythril.analysis.module.base module 16 | ----------------------------------- 17 | 18 | .. automodule:: mythril.analysis.module.base 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | mythril.analysis.module.loader module 24 | ------------------------------------- 25 | 26 | .. automodule:: mythril.analysis.module.loader 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | mythril.analysis.module.module\_helpers module 32 | ---------------------------------------------- 33 | 34 | .. automodule:: mythril.analysis.module.module_helpers 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | mythril.analysis.module.util module 40 | ----------------------------------- 41 | 42 | .. automodule:: mythril.analysis.module.util 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | Module contents 48 | --------------- 49 | 50 | .. automodule:: mythril.analysis.module 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | -------------------------------------------------------------------------------- /docs/source/mythril.concolic.rst: -------------------------------------------------------------------------------- 1 | mythril.concolic package 2 | ======================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.concolic.concolic\_execution module 8 | ------------------------------------------- 9 | 10 | .. automodule:: mythril.concolic.concolic_execution 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | mythril.concolic.concrete\_data module 16 | -------------------------------------- 17 | 18 | .. automodule:: mythril.concolic.concrete_data 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | mythril.concolic.find\_trace module 24 | ----------------------------------- 25 | 26 | .. automodule:: mythril.concolic.find_trace 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | Module contents 32 | --------------- 33 | 34 | .. automodule:: mythril.concolic 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | -------------------------------------------------------------------------------- /docs/source/mythril.disassembler.rst: -------------------------------------------------------------------------------- 1 | mythril.disassembler package 2 | ============================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.disassembler.asm module 8 | ------------------------------- 9 | 10 | .. automodule:: mythril.disassembler.asm 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | mythril.disassembler.disassembly module 16 | --------------------------------------- 17 | 18 | .. automodule:: mythril.disassembler.disassembly 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | Module contents 24 | --------------- 25 | 26 | .. automodule:: mythril.disassembler 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | -------------------------------------------------------------------------------- /docs/source/mythril.ethereum.interface.rpc.rst: -------------------------------------------------------------------------------- 1 | mythril.ethereum.interface.rpc package 2 | ====================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.ethereum.interface.rpc.base\_client module 8 | -------------------------------------------------- 9 | 10 | .. automodule:: mythril.ethereum.interface.rpc.base_client 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | mythril.ethereum.interface.rpc.client module 16 | -------------------------------------------- 17 | 18 | .. automodule:: mythril.ethereum.interface.rpc.client 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | mythril.ethereum.interface.rpc.constants module 24 | ----------------------------------------------- 25 | 26 | .. automodule:: mythril.ethereum.interface.rpc.constants 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | mythril.ethereum.interface.rpc.exceptions module 32 | ------------------------------------------------ 33 | 34 | .. automodule:: mythril.ethereum.interface.rpc.exceptions 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | mythril.ethereum.interface.rpc.utils module 40 | ------------------------------------------- 41 | 42 | .. automodule:: mythril.ethereum.interface.rpc.utils 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | Module contents 48 | --------------- 49 | 50 | .. automodule:: mythril.ethereum.interface.rpc 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | -------------------------------------------------------------------------------- /docs/source/mythril.ethereum.interface.rst: -------------------------------------------------------------------------------- 1 | mythril.ethereum.interface package 2 | ================================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | :maxdepth: 4 9 | 10 | mythril.ethereum.interface.rpc 11 | 12 | Module contents 13 | --------------- 14 | 15 | .. automodule:: mythril.ethereum.interface 16 | :members: 17 | :undoc-members: 18 | :show-inheritance: 19 | -------------------------------------------------------------------------------- /docs/source/mythril.ethereum.rst: -------------------------------------------------------------------------------- 1 | mythril.ethereum package 2 | ======================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | :maxdepth: 4 9 | 10 | mythril.ethereum.interface 11 | 12 | Submodules 13 | ---------- 14 | 15 | mythril.ethereum.evmcontract module 16 | ----------------------------------- 17 | 18 | .. automodule:: mythril.ethereum.evmcontract 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | mythril.ethereum.util module 24 | ---------------------------- 25 | 26 | .. automodule:: mythril.ethereum.util 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | Module contents 32 | --------------- 33 | 34 | .. automodule:: mythril.ethereum 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | -------------------------------------------------------------------------------- /docs/source/mythril.interfaces.rst: -------------------------------------------------------------------------------- 1 | mythril.interfaces package 2 | ========================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.interfaces.cli module 8 | ----------------------------- 9 | 10 | .. automodule:: mythril.interfaces.cli 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | mythril.interfaces.epic module 16 | ------------------------------ 17 | 18 | .. automodule:: mythril.interfaces.epic 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | Module contents 24 | --------------- 25 | 26 | .. automodule:: mythril.interfaces 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | -------------------------------------------------------------------------------- /docs/source/mythril.laser.ethereum.function_managers.rst: -------------------------------------------------------------------------------- 1 | mythril.laser.ethereum.function\_managers package 2 | ================================================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.laser.ethereum.function\_managers.exponent\_function\_manager module 8 | ---------------------------------------------------------------------------- 9 | 10 | .. automodule:: mythril.laser.ethereum.function_managers.exponent_function_manager 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | mythril.laser.ethereum.function\_managers.keccak\_function\_manager module 16 | -------------------------------------------------------------------------- 17 | 18 | .. automodule:: mythril.laser.ethereum.function_managers.keccak_function_manager 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | Module contents 24 | --------------- 25 | 26 | .. automodule:: mythril.laser.ethereum.function_managers 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | -------------------------------------------------------------------------------- /docs/source/mythril.laser.ethereum.strategy.extensions.rst: -------------------------------------------------------------------------------- 1 | mythril.laser.ethereum.strategy.extensions package 2 | ================================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.laser.ethereum.strategy.extensions.bounded\_loops module 8 | ---------------------------------------------------------------- 9 | 10 | .. automodule:: mythril.laser.ethereum.strategy.extensions.bounded_loops 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | Module contents 16 | --------------- 17 | 18 | .. automodule:: mythril.laser.ethereum.strategy.extensions 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | -------------------------------------------------------------------------------- /docs/source/mythril.laser.ethereum.strategy.rst: -------------------------------------------------------------------------------- 1 | mythril.laser.ethereum.strategy package 2 | ======================================= 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | :maxdepth: 4 9 | 10 | mythril.laser.ethereum.strategy.extensions 11 | 12 | Submodules 13 | ---------- 14 | 15 | mythril.laser.ethereum.strategy.basic module 16 | -------------------------------------------- 17 | 18 | .. automodule:: mythril.laser.ethereum.strategy.basic 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | mythril.laser.ethereum.strategy.beam module 24 | ------------------------------------------- 25 | 26 | .. automodule:: mythril.laser.ethereum.strategy.beam 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | mythril.laser.ethereum.strategy.concolic module 32 | ----------------------------------------------- 33 | 34 | .. automodule:: mythril.laser.ethereum.strategy.concolic 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | Module contents 40 | --------------- 41 | 42 | .. automodule:: mythril.laser.ethereum.strategy 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | -------------------------------------------------------------------------------- /docs/source/mythril.laser.ethereum.transaction.rst: -------------------------------------------------------------------------------- 1 | mythril.laser.ethereum.transaction package 2 | ========================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.laser.ethereum.transaction.concolic module 8 | -------------------------------------------------- 9 | 10 | .. automodule:: mythril.laser.ethereum.transaction.concolic 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | mythril.laser.ethereum.transaction.symbolic module 16 | -------------------------------------------------- 17 | 18 | .. automodule:: mythril.laser.ethereum.transaction.symbolic 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | mythril.laser.ethereum.transaction.transaction\_models module 24 | ------------------------------------------------------------- 25 | 26 | .. automodule:: mythril.laser.ethereum.transaction.transaction_models 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | Module contents 32 | --------------- 33 | 34 | .. automodule:: mythril.laser.ethereum.transaction 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | -------------------------------------------------------------------------------- /docs/source/mythril.laser.plugin.plugins.coverage.rst: -------------------------------------------------------------------------------- 1 | mythril.laser.plugin.plugins.coverage package 2 | ============================================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.laser.plugin.plugins.coverage.coverage\_plugin module 8 | ------------------------------------------------------------- 9 | 10 | .. automodule:: mythril.laser.plugin.plugins.coverage.coverage_plugin 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | mythril.laser.plugin.plugins.coverage.coverage\_strategy module 16 | --------------------------------------------------------------- 17 | 18 | .. automodule:: mythril.laser.plugin.plugins.coverage.coverage_strategy 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | Module contents 24 | --------------- 25 | 26 | .. automodule:: mythril.laser.plugin.plugins.coverage 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | -------------------------------------------------------------------------------- /docs/source/mythril.laser.plugin.plugins.summary_backup.rst: -------------------------------------------------------------------------------- 1 | mythril.laser.plugin.plugins.summary\_backup package 2 | ==================================================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: mythril.laser.plugin.plugins.summary_backup 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | -------------------------------------------------------------------------------- /docs/source/mythril.laser.plugin.rst: -------------------------------------------------------------------------------- 1 | mythril.laser.plugin package 2 | ============================ 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | :maxdepth: 4 9 | 10 | mythril.laser.plugin.plugins 11 | 12 | Submodules 13 | ---------- 14 | 15 | mythril.laser.plugin.builder module 16 | ----------------------------------- 17 | 18 | .. automodule:: mythril.laser.plugin.builder 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | mythril.laser.plugin.interface module 24 | ------------------------------------- 25 | 26 | .. automodule:: mythril.laser.plugin.interface 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | mythril.laser.plugin.loader module 32 | ---------------------------------- 33 | 34 | .. automodule:: mythril.laser.plugin.loader 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | mythril.laser.plugin.signals module 40 | ----------------------------------- 41 | 42 | .. automodule:: mythril.laser.plugin.signals 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | Module contents 48 | --------------- 49 | 50 | .. automodule:: mythril.laser.plugin 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | -------------------------------------------------------------------------------- /docs/source/mythril.laser.rst: -------------------------------------------------------------------------------- 1 | mythril.laser package 2 | ===================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | :maxdepth: 4 9 | 10 | mythril.laser.ethereum 11 | mythril.laser.plugin 12 | mythril.laser.smt 13 | 14 | Submodules 15 | ---------- 16 | 17 | mythril.laser.execution\_info module 18 | ------------------------------------ 19 | 20 | .. automodule:: mythril.laser.execution_info 21 | :members: 22 | :undoc-members: 23 | :show-inheritance: 24 | 25 | Module contents 26 | --------------- 27 | 28 | .. automodule:: mythril.laser 29 | :members: 30 | :undoc-members: 31 | :show-inheritance: 32 | -------------------------------------------------------------------------------- /docs/source/mythril.laser.smt.solver.rst: -------------------------------------------------------------------------------- 1 | mythril.laser.smt.solver package 2 | ================================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.laser.smt.solver.independence\_solver module 8 | ---------------------------------------------------- 9 | 10 | .. automodule:: mythril.laser.smt.solver.independence_solver 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | mythril.laser.smt.solver.solver module 16 | -------------------------------------- 17 | 18 | .. automodule:: mythril.laser.smt.solver.solver 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | mythril.laser.smt.solver.solver\_statistics module 24 | -------------------------------------------------- 25 | 26 | .. automodule:: mythril.laser.smt.solver.solver_statistics 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | Module contents 32 | --------------- 33 | 34 | .. automodule:: mythril.laser.smt.solver 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | -------------------------------------------------------------------------------- /docs/source/mythril.mythril.rst: -------------------------------------------------------------------------------- 1 | mythril.mythril package 2 | ======================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.mythril.mythril\_analyzer module 8 | ---------------------------------------- 9 | 10 | .. automodule:: mythril.mythril.mythril_analyzer 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | mythril.mythril.mythril\_config module 16 | -------------------------------------- 17 | 18 | .. automodule:: mythril.mythril.mythril_config 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | mythril.mythril.mythril\_disassembler module 24 | -------------------------------------------- 25 | 26 | .. automodule:: mythril.mythril.mythril_disassembler 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | Module contents 32 | --------------- 33 | 34 | .. automodule:: mythril.mythril 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | -------------------------------------------------------------------------------- /docs/source/mythril.plugin.rst: -------------------------------------------------------------------------------- 1 | mythril.plugin package 2 | ====================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.plugin.discovery module 8 | ------------------------------- 9 | 10 | .. automodule:: mythril.plugin.discovery 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | mythril.plugin.interface module 16 | ------------------------------- 17 | 18 | .. automodule:: mythril.plugin.interface 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | mythril.plugin.loader module 24 | ---------------------------- 25 | 26 | .. automodule:: mythril.plugin.loader 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | Module contents 32 | --------------- 33 | 34 | .. automodule:: mythril.plugin 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | -------------------------------------------------------------------------------- /docs/source/mythril.rst: -------------------------------------------------------------------------------- 1 | mythril package 2 | =============== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | :maxdepth: 4 9 | 10 | mythril.analysis 11 | mythril.concolic 12 | mythril.disassembler 13 | mythril.ethereum 14 | mythril.interfaces 15 | mythril.laser 16 | mythril.mythril 17 | mythril.plugin 18 | mythril.solidity 19 | mythril.support 20 | 21 | Submodules 22 | ---------- 23 | 24 | mythril.exceptions module 25 | ------------------------- 26 | 27 | .. automodule:: mythril.exceptions 28 | :members: 29 | :undoc-members: 30 | :show-inheritance: 31 | 32 | Module contents 33 | --------------- 34 | 35 | .. automodule:: mythril 36 | :members: 37 | :undoc-members: 38 | :show-inheritance: 39 | -------------------------------------------------------------------------------- /docs/source/mythril.solidity.rst: -------------------------------------------------------------------------------- 1 | mythril.solidity package 2 | ======================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | mythril.solidity.soliditycontract module 8 | ---------------------------------------- 9 | 10 | .. automodule:: mythril.solidity.soliditycontract 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | Module contents 16 | --------------- 17 | 18 | .. automodule:: mythril.solidity 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | -------------------------------------------------------------------------------- /mypy-stubs/z3/z3core.pyi: -------------------------------------------------------------------------------- 1 | from .z3types import Ast, ContextObj 2 | 3 | def Z3_mk_eq(ctx: ContextObj, a: Ast, b: Ast) -> Ast: ... 4 | def Z3_mk_div(ctx: ContextObj, a: Ast, b: Ast) -> Ast: ... 5 | -------------------------------------------------------------------------------- /mypy-stubs/z3/z3types.pyi: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | class Z3Exception(Exception): 4 | def __init__(self, a: Any) -> None: 5 | self.value = a 6 | ... 7 | 8 | class ContextObj: ... 9 | class Ast: ... 10 | -------------------------------------------------------------------------------- /myth: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | """mythril.py: Bug hunting on the Ethereum blockchain 4 | http://www.github.com/ConsenSys/mythril 5 | """ 6 | 7 | from sys import exit 8 | 9 | import mythril.interfaces.cli 10 | 11 | if __name__ == "__main__": 12 | mythril.interfaces.cli.main() 13 | exit() 14 | -------------------------------------------------------------------------------- /mythril/__init__.py: -------------------------------------------------------------------------------- 1 | # We use RsT document formatting in docstring. For example :param to mark parameters. 2 | # See PEP 287 3 | __docformat__ = "restructuredtext" 4 | import logging 5 | 6 | from mythril.plugin.loader import MythrilPluginLoader 7 | 8 | # Accept mythril.VERSION to get mythril's current version number 9 | from .__version__ import __version__ as VERSION 10 | 11 | log = logging.getLogger(__name__) 12 | -------------------------------------------------------------------------------- /mythril/__main__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: UTF-8 -*- 3 | import mythril.interfaces.cli 4 | 5 | if __name__ == "__main__": 6 | mythril.interfaces.cli.main() 7 | -------------------------------------------------------------------------------- /mythril/__version__.py: -------------------------------------------------------------------------------- 1 | """This file contains the current Mythril version. 2 | 3 | This file is suitable for sourcing inside POSIX shell, e.g. bash as well 4 | as for importing into Python. 5 | """ 6 | 7 | __version__ = "v0.24.8" 8 | -------------------------------------------------------------------------------- /mythril/analysis/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/analysis/__init__.py -------------------------------------------------------------------------------- /mythril/analysis/analysis_args.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/analysis/analysis_args.py -------------------------------------------------------------------------------- /mythril/analysis/module/__init__.py: -------------------------------------------------------------------------------- 1 | from mythril.analysis.module.base import DetectionModule, EntryPoint 2 | from mythril.analysis.module.loader import ModuleLoader 3 | from mythril.analysis.module.util import ( 4 | get_detection_module_hooks, 5 | reset_callback_modules, 6 | ) 7 | -------------------------------------------------------------------------------- /mythril/analysis/module/module_helpers.py: -------------------------------------------------------------------------------- 1 | import traceback 2 | 3 | 4 | def is_prehook() -> bool: 5 | """Check if we are in prehook. One of Bernhard's trademark hacks! 6 | Let's leave it to this for now, unless we need to check prehook for 7 | a lot more modules. 8 | """ 9 | 10 | assert ("pre_hook" in traceback.format_stack()[-5]) or ( 11 | "post_hook" in traceback.format_stack()[-5] 12 | ) 13 | return "pre_hook" in traceback.format_stack()[-5] 14 | -------------------------------------------------------------------------------- /mythril/analysis/module/modules/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /mythril/concolic/__init__.py: -------------------------------------------------------------------------------- 1 | from mythril.concolic.concolic_execution import concolic_execution 2 | from mythril.concolic.find_trace import concrete_execution 3 | -------------------------------------------------------------------------------- /mythril/concolic/concrete_data.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, List 2 | 3 | from typing_extensions import TypedDict 4 | 5 | 6 | class AccountData(TypedDict): 7 | balance: str 8 | code: str 9 | nonce: int 10 | storage: dict 11 | 12 | 13 | class InitialState(TypedDict): 14 | accounts: Dict[str, AccountData] 15 | 16 | 17 | class TransactionData(TypedDict): 18 | address: str 19 | blockCoinbase: str 20 | blockDifficulty: str 21 | blockGasLimit: str 22 | blockNumber: str 23 | blockTime: str 24 | calldata: str 25 | gasLimit: str 26 | gasPrice: str 27 | input: str 28 | name: str 29 | origin: str 30 | value: str 31 | 32 | 33 | class ConcreteData(TypedDict): 34 | initialState: InitialState 35 | steps: List[TransactionData] 36 | -------------------------------------------------------------------------------- /mythril/config.ini: -------------------------------------------------------------------------------- 1 | [defaults] 2 | dynamic_loading = infura 3 | infura_id = 4 | 5 | -------------------------------------------------------------------------------- /mythril/disassembler/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/disassembler/__init__.py -------------------------------------------------------------------------------- /mythril/ethereum/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/ethereum/__init__.py -------------------------------------------------------------------------------- /mythril/ethereum/interface/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/ethereum/interface/__init__.py -------------------------------------------------------------------------------- /mythril/ethereum/interface/rpc/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/ethereum/interface/rpc/__init__.py -------------------------------------------------------------------------------- /mythril/ethereum/interface/rpc/constants.py: -------------------------------------------------------------------------------- 1 | """This file contains constants used used by the Ethereum JSON RPC 2 | interface.""" 3 | 4 | BLOCK_TAG_EARLIEST = "earliest" 5 | BLOCK_TAG_LATEST = "latest" 6 | BLOCK_TAG_PENDING = "pending" 7 | BLOCK_TAGS = (BLOCK_TAG_EARLIEST, BLOCK_TAG_LATEST, BLOCK_TAG_PENDING) 8 | -------------------------------------------------------------------------------- /mythril/ethereum/interface/rpc/exceptions.py: -------------------------------------------------------------------------------- 1 | """This module contains exceptions regarding JSON-RPC communication.""" 2 | 3 | 4 | class EthJsonRpcError(Exception): 5 | """The JSON-RPC base exception type.""" 6 | 7 | pass 8 | 9 | 10 | class ConnectionError(EthJsonRpcError): 11 | """An RPC exception denoting there was an error in connecting to the RPC 12 | instance.""" 13 | 14 | pass 15 | 16 | 17 | class BadStatusCodeError(EthJsonRpcError): 18 | """An RPC exception denoting a bad status code returned by the RPC 19 | instance.""" 20 | 21 | pass 22 | 23 | 24 | class BadJsonError(EthJsonRpcError): 25 | """An RPC exception denoting that the RPC instance returned a bad JSON 26 | object.""" 27 | 28 | pass 29 | 30 | 31 | class BadResponseError(EthJsonRpcError): 32 | """An RPC exception denoting that the RPC instance returned a bad 33 | response.""" 34 | 35 | pass 36 | -------------------------------------------------------------------------------- /mythril/ethereum/interface/rpc/utils.py: -------------------------------------------------------------------------------- 1 | """This module contains various utility functions regarding the RPC data format 2 | and validation.""" 3 | 4 | from .constants import BLOCK_TAGS 5 | 6 | 7 | def hex_to_dec(x): 8 | """Convert hex to decimal. 9 | 10 | :param x: 11 | :return: 12 | """ 13 | return int(x, 16) 14 | 15 | 16 | def clean_hex(d): 17 | """Convert decimal to hex and remove the "L" suffix that is appended to 18 | large numbers. 19 | 20 | :param d: 21 | :return: 22 | """ 23 | return hex(d).rstrip("L") 24 | 25 | 26 | def validate_block(block): 27 | """ 28 | 29 | :param block: 30 | :return: 31 | """ 32 | if isinstance(block, str): 33 | if block not in BLOCK_TAGS: 34 | raise ValueError("invalid block tag") 35 | if isinstance(block, int): 36 | block = hex(block) 37 | return block 38 | 39 | 40 | def wei_to_ether(wei): 41 | """Convert wei to ether. 42 | 43 | :param wei: 44 | :return: 45 | """ 46 | return 1.0 * wei / 10**18 47 | 48 | 49 | def ether_to_wei(ether): 50 | """Convert ether to wei. 51 | 52 | :param ether: 53 | :return: 54 | """ 55 | return ether * 10**18 56 | -------------------------------------------------------------------------------- /mythril/exceptions.py: -------------------------------------------------------------------------------- 1 | """This module contains general exceptions used by Mythril.""" 2 | 3 | 4 | class MythrilBaseException(Exception): 5 | """The Mythril exception base type.""" 6 | 7 | pass 8 | 9 | 10 | class CompilerError(MythrilBaseException): 11 | """A Mythril exception denoting an error during code compilation.""" 12 | 13 | pass 14 | 15 | 16 | class UnsatError(MythrilBaseException): 17 | """A Mythril exception denoting the unsatisfiability of a series of 18 | constraints.""" 19 | 20 | pass 21 | 22 | 23 | class SolverTimeOutException(UnsatError): 24 | """A Mythril exception denoting the unsatisfiability of a series of 25 | constraints.""" 26 | 27 | pass 28 | 29 | 30 | class NoContractFoundError(MythrilBaseException): 31 | """A Mythril exception denoting that a given contract file was not 32 | found.""" 33 | 34 | pass 35 | 36 | 37 | class CriticalError(MythrilBaseException): 38 | """A Mythril exception denoting an unknown critical error has been 39 | encountered.""" 40 | 41 | pass 42 | 43 | 44 | class DetectorNotFoundError(MythrilBaseException): 45 | """A Mythril exception denoting attempted usage of a non-existant 46 | detection module.""" 47 | 48 | pass 49 | 50 | 51 | class IllegalArgumentError(ValueError): 52 | """The argument used does not exist""" 53 | 54 | pass 55 | -------------------------------------------------------------------------------- /mythril/interfaces/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/interfaces/__init__.py -------------------------------------------------------------------------------- /mythril/laser/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/laser/__init__.py -------------------------------------------------------------------------------- /mythril/laser/ethereum/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/laser/ethereum/__init__.py -------------------------------------------------------------------------------- /mythril/laser/ethereum/cheat_code.py: -------------------------------------------------------------------------------- 1 | from typing import Union 2 | 3 | from mythril.laser.ethereum.state.calldata import ( 4 | BaseCalldata, 5 | ) 6 | from mythril.laser.ethereum.state.global_state import GlobalState 7 | from mythril.laser.ethereum.util import insert_ret_val 8 | from mythril.laser.smt import BitVec, Expression 9 | 10 | 11 | class hevm_cheat_code: 12 | # https://github.com/dapphub/ds-test/blob/cd98eff28324bfac652e63a239a60632a761790b/src/test.sol 13 | 14 | address = 0x7109709ECFA91A80626FF3989D68F67F5B1DD12D 15 | 16 | fail_payload = int( 17 | "70ca10bb" 18 | + "0000000000000000000000007109709ecfa91a80626ff3989d68f67f5b1dd12d" 19 | + "6661696c65640000000000000000000000000000000000000000000000000000" 20 | + "0000000000000000000000000000000000000000000000000000000000000001", 21 | 16, 22 | ) 23 | 24 | assume_sig = 0x4C63E562 25 | 26 | @staticmethod 27 | def is_cheat_address(address): 28 | if int(address, 16) == int("0x7109709ECfa91a80626fF3989D68f67F5b1DD12D", 16): 29 | return True 30 | if int(address, 16) == int("0x72c68108a82e82617b93d1be0d7975d762035015", 16): 31 | return True 32 | return False 33 | 34 | 35 | def handle_cheat_codes( 36 | global_state: GlobalState, 37 | callee_address: Union[str, BitVec], 38 | call_data: BaseCalldata, 39 | memory_out_offset: Union[int, Expression], 40 | memory_out_size: Union[int, Expression], 41 | ): 42 | insert_ret_val(global_state) 43 | pass 44 | -------------------------------------------------------------------------------- /mythril/laser/ethereum/evm_exceptions.py: -------------------------------------------------------------------------------- 1 | """This module contains EVM exception types used by LASER.""" 2 | 3 | 4 | class VmException(Exception): 5 | """The base VM exception type.""" 6 | 7 | pass 8 | 9 | 10 | class StackUnderflowException(IndexError, VmException): 11 | """A VM exception regarding stack underflows.""" 12 | 13 | pass 14 | 15 | 16 | class StackOverflowException(VmException): 17 | """A VM exception regarding stack overflows.""" 18 | 19 | pass 20 | 21 | 22 | class InvalidJumpDestination(VmException): 23 | """A VM exception regarding JUMPs to invalid destinations.""" 24 | 25 | pass 26 | 27 | 28 | class InvalidInstruction(VmException): 29 | """A VM exception denoting an invalid op code has been encountered.""" 30 | 31 | pass 32 | 33 | 34 | class OutOfGasException(VmException): 35 | """A VM exception denoting the current execution has run out of gas.""" 36 | 37 | pass 38 | 39 | 40 | class WriteProtection(VmException): 41 | """A VM exception denoting that a write operation is executed on a write protected environment""" 42 | 43 | pass 44 | -------------------------------------------------------------------------------- /mythril/laser/ethereum/function_managers/__init__.py: -------------------------------------------------------------------------------- 1 | from .exponent_function_manager import exponent_function_manager 2 | from .keccak_function_manager import KeccakFunctionManager, keccak_function_manager 3 | -------------------------------------------------------------------------------- /mythril/laser/ethereum/state/__init__.py: -------------------------------------------------------------------------------- 1 | # Hello! 2 | -------------------------------------------------------------------------------- /mythril/laser/ethereum/state/return_data.py: -------------------------------------------------------------------------------- 1 | """This module declares classes to represent call data.""" 2 | 3 | from typing import List 4 | 5 | from mythril.laser.smt import ( 6 | BitVec, 7 | ) 8 | 9 | 10 | class ReturnData: 11 | """Base returndata class.""" 12 | 13 | def __init__(self, return_data: List[BitVec], return_data_size: BitVec) -> None: 14 | """ 15 | 16 | :param tx_id: 17 | """ 18 | self.return_data = return_data 19 | self.return_data_size = return_data_size 20 | 21 | @property 22 | def size(self) -> BitVec: 23 | """ 24 | 25 | :return: Calldata size for this calldata object 26 | """ 27 | return self.return_data_size 28 | 29 | def __getitem__(self, index): 30 | if index < self.size: 31 | return self.return_data[index] 32 | else: 33 | return 0 34 | -------------------------------------------------------------------------------- /mythril/laser/ethereum/strategy/beam.py: -------------------------------------------------------------------------------- 1 | from mythril.laser.ethereum.state.global_state import GlobalState 2 | 3 | from . import BasicSearchStrategy 4 | 5 | 6 | class BeamSearch(BasicSearchStrategy): 7 | """chooses a random state from the worklist with equal likelihood.""" 8 | 9 | def __init__(self, work_list, max_depth, beam_width, **kwargs): 10 | super().__init__(work_list, max_depth) 11 | self.beam_width = beam_width 12 | 13 | @staticmethod 14 | def beam_priority(state): 15 | return sum([annotation.search_importance for annotation in state._annotations]) 16 | 17 | def sort_and_eliminate_states(self): 18 | self.work_list.sort(key=lambda state: self.beam_priority(state), reverse=True) 19 | del self.work_list[self.beam_width :] 20 | 21 | def view_strategic_global_state(self) -> GlobalState: 22 | """ 23 | 24 | :return: 25 | """ 26 | self.sort_and_eliminate_states() 27 | if len(self.work_list) > 0: 28 | return self.work_list[0] 29 | else: 30 | raise IndexError 31 | 32 | def get_strategic_global_state(self) -> GlobalState: 33 | """ 34 | 35 | :return: 36 | """ 37 | self.sort_and_eliminate_states() 38 | if len(self.work_list) > 0: 39 | return self.work_list.pop(0) 40 | else: 41 | raise IndexError 42 | -------------------------------------------------------------------------------- /mythril/laser/ethereum/strategy/constraint_strategy.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from mythril.laser.ethereum.state.global_state import GlobalState 4 | from mythril.laser.ethereum.strategy.basic import BasicSearchStrategy 5 | from mythril.support.support_utils import ModelCache 6 | 7 | log = logging.getLogger(__name__) 8 | 9 | 10 | class DelayConstraintStrategy(BasicSearchStrategy): 11 | def __init__(self, work_list, max_depth, **kwargs): 12 | super().__init__(work_list, max_depth) 13 | self.model_cache = ModelCache() 14 | self.pending_worklist = [] 15 | log.info("Loaded search strategy extension: DelayConstraintStrategy") 16 | 17 | def get_strategic_global_state(self) -> GlobalState: 18 | """Returns the next state 19 | 20 | :return: Global state 21 | """ 22 | while len(self.work_list) == 0: 23 | state = self.pending_worklist.pop(0) 24 | model = state.world_state.constraints.get_model() 25 | if model is not None: 26 | self.model_cache.put(model, 1) 27 | self.work_list.append(state) 28 | state = self.work_list.pop(0) 29 | return state 30 | -------------------------------------------------------------------------------- /mythril/laser/ethereum/strategy/extensions/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/laser/ethereum/strategy/extensions/__init__.py -------------------------------------------------------------------------------- /mythril/laser/ethereum/time_handler.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | from mythril.support.support_utils import Singleton 4 | 5 | 6 | class TimeHandler(object, metaclass=Singleton): 7 | def __init__(self): 8 | self._start_time = None 9 | self._execution_time = None 10 | 11 | def start_execution(self, execution_time): 12 | self._start_time = int(time.time() * 1000) 13 | self._execution_time = execution_time * 1000 14 | 15 | def time_remaining(self): 16 | return self._execution_time - (int(time.time() * 1000) - self._start_time) 17 | 18 | 19 | time_handler = TimeHandler() 20 | -------------------------------------------------------------------------------- /mythril/laser/ethereum/transaction/__init__.py: -------------------------------------------------------------------------------- 1 | from mythril.laser.ethereum.transaction.symbolic import ( 2 | execute_contract_creation, 3 | execute_message_call, 4 | ) 5 | from mythril.laser.ethereum.transaction.transaction_models import * 6 | -------------------------------------------------------------------------------- /mythril/laser/ethereum/tx_prioritiser/__init__.py: -------------------------------------------------------------------------------- 1 | from .rf_prioritiser import RfTxPrioritiser 2 | -------------------------------------------------------------------------------- /mythril/laser/execution_info.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class ExecutionInfo(ABC): 5 | @abstractmethod 6 | def as_dict(self): 7 | """Returns a dictionary with the execution info contained in this object 8 | 9 | The returned dictionary only uses primitive types. 10 | """ 11 | pass 12 | -------------------------------------------------------------------------------- /mythril/laser/plugin/__init__.py: -------------------------------------------------------------------------------- 1 | """Laser plugins 2 | 3 | This module contains everything to do with laser plugins 4 | 5 | Laser plugins are a way of extending laser's functionality without complicating the core business logic. 6 | Different features that have been implemented in the form of plugins are: 7 | - benchmarking 8 | - path pruning 9 | 10 | Plugins also provide a way to implement optimisations outside of the mythril code base and to inject them. 11 | The api that laser currently provides is still unstable and will probably change to suit our needs 12 | as more plugins get developed. 13 | 14 | For the implementation of plugins the following modules are of interest: 15 | - laser.plugins.plugin 16 | - laser.plugins.signals 17 | - laser.svm 18 | 19 | Which show the basic interfaces with which plugins are able to interact 20 | """ 21 | -------------------------------------------------------------------------------- /mythril/laser/plugin/builder.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | from mythril.laser.plugin.interface import LaserPlugin 4 | 5 | 6 | class PluginBuilder(ABC): 7 | """PluginBuilder 8 | 9 | The plugin builder interface enables construction of Laser plugins 10 | """ 11 | 12 | name = "Default Plugin Name" 13 | 14 | def __init__(self): 15 | self.enabled = True 16 | 17 | @abstractmethod 18 | def __call__(self, *args, **kwargs) -> LaserPlugin: 19 | """Constructs the plugin""" 20 | pass 21 | -------------------------------------------------------------------------------- /mythril/laser/plugin/interface.py: -------------------------------------------------------------------------------- 1 | from mythril.laser.ethereum.svm import LaserEVM 2 | 3 | 4 | class LaserPlugin: 5 | """Base class for laser plugins 6 | 7 | Functionality in laser that the symbolic execution process does not need to depend on 8 | can be implemented in the form of a laser plugin. 9 | 10 | Laser plugins implement the function initialize(symbolic_vm) which is called with the laser virtual machine 11 | when they are loaded. 12 | Regularly a plugin will introduce several hooks into laser in this function 13 | 14 | Plugins can direct actions by raising Signals defined in mythril.laser.ethereum.plugins.signals 15 | For example, a pruning plugin might raise the PluginSkipWorldState signal. 16 | """ 17 | 18 | def initialize(self, symbolic_vm: LaserEVM) -> None: 19 | """Initializes this plugin on the symbolic virtual machine 20 | 21 | :param symbolic_vm: symbolic virtual machine to initialize the laser plugin on 22 | """ 23 | raise NotImplementedError 24 | -------------------------------------------------------------------------------- /mythril/laser/plugin/plugins/__init__.py: -------------------------------------------------------------------------------- 1 | """Plugin implementations 2 | 3 | This module contains the implementation of some features 4 | 5 | - benchmarking 6 | - pruning 7 | """ 8 | 9 | from mythril.laser.plugin.plugins.benchmark import BenchmarkPluginBuilder 10 | from mythril.laser.plugin.plugins.call_depth_limiter import CallDepthLimitBuilder 11 | from mythril.laser.plugin.plugins.coverage.coverage_plugin import CoveragePluginBuilder 12 | from mythril.laser.plugin.plugins.coverage_metrics import CoverageMetricsPluginBuilder 13 | from mythril.laser.plugin.plugins.dependency_pruner import DependencyPrunerBuilder 14 | from mythril.laser.plugin.plugins.instruction_profiler import InstructionProfilerBuilder 15 | from mythril.laser.plugin.plugins.mutation_pruner import MutationPrunerBuilder 16 | from mythril.laser.plugin.plugins.state_merge import StateMergePluginBuilder 17 | from mythril.laser.plugin.plugins.summary import SymbolicSummaryPluginBuilder 18 | from mythril.laser.plugin.plugins.trace import TraceFinderBuilder 19 | -------------------------------------------------------------------------------- /mythril/laser/plugin/plugins/call_depth_limiter.py: -------------------------------------------------------------------------------- 1 | from mythril.laser.ethereum.state.global_state import GlobalState 2 | from mythril.laser.ethereum.svm import LaserEVM 3 | from mythril.laser.plugin.builder import PluginBuilder 4 | from mythril.laser.plugin.interface import LaserPlugin 5 | from mythril.laser.plugin.signals import PluginSkipState 6 | 7 | 8 | class CallDepthLimitBuilder(PluginBuilder): 9 | name = "call-depth-limit" 10 | 11 | def __call__(self, *args, **kwargs): 12 | return CallDepthLimit(kwargs["call_depth_limit"]) 13 | 14 | 15 | class CallDepthLimit(LaserPlugin): 16 | def __init__(self, call_depth_limit: int): 17 | self.call_depth_limit = call_depth_limit 18 | 19 | def initialize(self, symbolic_vm: LaserEVM): 20 | """Initializes the mutation pruner 21 | 22 | Introduces hooks for SSTORE operations 23 | :param symbolic_vm: 24 | :return: 25 | """ 26 | 27 | @symbolic_vm.pre_hook("CALL") 28 | def sstore_mutator_hook(global_state: GlobalState): 29 | if len(global_state.transaction_stack) - 1 == self.call_depth_limit: 30 | raise PluginSkipState 31 | -------------------------------------------------------------------------------- /mythril/laser/plugin/plugins/coverage/__init__.py: -------------------------------------------------------------------------------- 1 | from mythril.laser.plugin.plugins.coverage.coverage_plugin import ( 2 | InstructionCoveragePlugin, 3 | ) 4 | -------------------------------------------------------------------------------- /mythril/laser/plugin/plugins/coverage_metrics/__init__.py: -------------------------------------------------------------------------------- 1 | from .metrics_plugin import CoverageMetricsPluginBuilder 2 | -------------------------------------------------------------------------------- /mythril/laser/plugin/plugins/coverage_metrics/constants.py: -------------------------------------------------------------------------------- 1 | BATCH_OF_STATES = 5 2 | -------------------------------------------------------------------------------- /mythril/laser/plugin/plugins/state_merge/__init__.py: -------------------------------------------------------------------------------- 1 | from .state_merge_plugin import StateMergePluginBuilder 2 | -------------------------------------------------------------------------------- /mythril/laser/plugin/plugins/summary/__init__.py: -------------------------------------------------------------------------------- 1 | from .core import SymbolicSummaryPluginBuilder 2 | -------------------------------------------------------------------------------- /mythril/laser/plugin/plugins/summary_backup/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/laser/plugin/plugins/summary_backup/__init__.py -------------------------------------------------------------------------------- /mythril/laser/plugin/signals.py: -------------------------------------------------------------------------------- 1 | class PluginSignal(Exception): 2 | """Base plugin signal 3 | 4 | These signals are used by the laser plugins to create intent for certain actions in the symbolic virtual machine 5 | """ 6 | 7 | pass 8 | 9 | 10 | class PluginSkipWorldState(PluginSignal): 11 | """Plugin to skip world state 12 | 13 | Plugins that raise this signal while the add_world_state hook is being executed 14 | will force laser to abandon that world state. 15 | """ 16 | 17 | pass 18 | 19 | 20 | class PluginSkipState(PluginSignal): 21 | """Plugin to skip world state 22 | 23 | Plugins that raise this signal while the add_world_state hook is being executed 24 | will force laser to abandon that world state. 25 | """ 26 | 27 | pass 28 | -------------------------------------------------------------------------------- /mythril/laser/smt/function.py: -------------------------------------------------------------------------------- 1 | from typing import Any, List, Set, cast 2 | 3 | import z3 4 | 5 | from mythril.laser.smt.bitvec import BitVec 6 | 7 | 8 | class Function: 9 | """An uninterpreted function.""" 10 | 11 | def __init__(self, name: str, domain: List[int], value_range: int): 12 | """Initializes an uninterpreted function. 13 | 14 | :param name: Name of the Function 15 | :param domain: The domain for the Function (10 -> all the values that a bv of size 10 could take) 16 | :param value_range: The range for the values of the function (10 -> all the values that a bv of size 10 could take) 17 | """ 18 | self.domain = [] 19 | for element in domain: 20 | self.domain.append(z3.BitVecSort(element)) 21 | self.range = z3.BitVecSort(value_range) 22 | self.raw = z3.Function(name, *self.domain, self.range) 23 | 24 | def __call__(self, *items) -> BitVec: 25 | """Function accessor, item can be symbolic.""" 26 | annotations: Set[Any] = set().union(*[item.annotations for item in items]) 27 | return BitVec( 28 | cast(z3.BitVecRef, self.raw(*[item.raw for item in items])), 29 | annotations=annotations, 30 | ) 31 | -------------------------------------------------------------------------------- /mythril/laser/smt/solver/__init__.py: -------------------------------------------------------------------------------- 1 | import z3 2 | 3 | from mythril.laser.smt.solver.independence_solver import IndependenceSolver 4 | from mythril.laser.smt.solver.solver import BaseSolver, Optimize, Solver 5 | from mythril.laser.smt.solver.solver_statistics import SolverStatistics 6 | from mythril.support.support_args import args 7 | 8 | if args.parallel_solving: 9 | z3.set_param("parallel.enable", True) 10 | -------------------------------------------------------------------------------- /mythril/laser/smt/solver/solver_statistics.py: -------------------------------------------------------------------------------- 1 | from time import time 2 | from typing import Callable 3 | 4 | from mythril.support.support_utils import Singleton 5 | 6 | 7 | def stat_smt_query(func: Callable): 8 | """Measures statistics for annotated smt query check function""" 9 | stat_store = SolverStatistics() 10 | 11 | def function_wrapper(*args, **kwargs): 12 | if not stat_store.enabled: 13 | return func(*args, **kwargs) 14 | 15 | stat_store.query_count += 1 16 | begin = time() 17 | 18 | result = func(*args, **kwargs) 19 | 20 | end = time() 21 | stat_store.solver_time += end - begin 22 | 23 | return result 24 | 25 | return function_wrapper 26 | 27 | 28 | class SolverStatistics(object, metaclass=Singleton): 29 | """Solver Statistics Class 30 | 31 | Keeps track of the important statistics around smt queries 32 | """ 33 | 34 | def __init__(self): 35 | self.enabled = False 36 | self.query_count = 0 37 | self.solver_time = 0 38 | 39 | def __repr__(self): 40 | return "Query count: {} \nSolver time: {}".format( 41 | self.query_count, self.solver_time 42 | ) 43 | -------------------------------------------------------------------------------- /mythril/mythril/__init__.py: -------------------------------------------------------------------------------- 1 | from .mythril_analyzer import MythrilAnalyzer 2 | from .mythril_config import MythrilConfig 3 | from .mythril_disassembler import MythrilDisassembler 4 | -------------------------------------------------------------------------------- /mythril/plugin/__init__.py: -------------------------------------------------------------------------------- 1 | from mythril.plugin.interface import MythrilCLIPlugin, MythrilPlugin 2 | from mythril.plugin.loader import MythrilPluginLoader 3 | -------------------------------------------------------------------------------- /mythril/plugin/interface.py: -------------------------------------------------------------------------------- 1 | from abc import ABC 2 | 3 | from mythril.laser.plugin.builder import PluginBuilder as LaserPluginBuilder 4 | 5 | 6 | class MythrilPlugin: 7 | """MythrilPlugin interface 8 | 9 | Mythril Plugins can be used to extend Mythril in different ways: 10 | 1. Extend Laser, in which case the LaserPlugin interface must also be extended 11 | 2. Extend Laser with a new search strategy in which case the SearchStrategy needs to be implemented 12 | 3. Add an analysis module, in this case the AnalysisModule interface needs to be implemented 13 | 4. Add new commands to the Mythril cli, using the MythrilCLIPlugin Interface 14 | """ 15 | 16 | author = "Default Author" 17 | name = "Plugin Name" 18 | plugin_license = "All rights reserved." 19 | plugin_type = "Mythril Plugin" 20 | plugin_version = "0.0.1 " 21 | plugin_description = "This is an example plugin description" 22 | 23 | def __init__(self, **kwargs): 24 | pass 25 | 26 | def __repr__(self): 27 | plugin_name = type(self).__name__ 28 | return f"{plugin_name} - {self.plugin_version} - {self.author}" 29 | 30 | 31 | class MythrilCLIPlugin(MythrilPlugin): 32 | """MythrilCLIPlugin interface 33 | 34 | This interface should be implemented by mythril plugins that aim to add commands to the mythril cli 35 | """ 36 | 37 | pass 38 | 39 | 40 | class MythrilLaserPlugin(MythrilPlugin, LaserPluginBuilder, ABC): 41 | """Mythril Laser Plugin interface 42 | 43 | Plugins of this type are used to instrument the laser EVM 44 | """ 45 | 46 | pass 47 | -------------------------------------------------------------------------------- /mythril/solidity/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/solidity/__init__.py -------------------------------------------------------------------------------- /mythril/support/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/support/__init__.py -------------------------------------------------------------------------------- /mythril/support/assets/signatures.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/mythril/support/assets/signatures.db -------------------------------------------------------------------------------- /mythril/support/start_time.py: -------------------------------------------------------------------------------- 1 | from time import time 2 | 3 | from mythril.support.support_utils import Singleton 4 | 5 | 6 | class StartTime(metaclass=Singleton): 7 | """Maintains the start time of the current contract in execution""" 8 | 9 | def __init__(self): 10 | self.global_start_time = time() 11 | -------------------------------------------------------------------------------- /mythril/support/support_args.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | from mythril.support.support_utils import Singleton 4 | 5 | 6 | class Args(object, metaclass=Singleton): 7 | """ 8 | This module helps in preventing args being sent through multiple of classes to reach 9 | any analysis/laser module 10 | """ 11 | 12 | def __init__(self): 13 | self.solver_timeout = 10000 14 | self.pruning_factor = None 15 | self.unconstrained_storage = False 16 | self.parallel_solving = False 17 | self.call_depth_limit = 3 18 | self.disable_iprof = False 19 | self.solver_log = None 20 | self.transaction_sequences: List[List[str]] = None 21 | self.use_integer_module = True 22 | self.use_issue_annotations = False 23 | self.solc_args = None 24 | self.disable_coverage_strategy = False 25 | self.disable_mutation_pruner = False 26 | self.incremental_txs = True 27 | self.enable_summaries = False 28 | self.enable_state_merge = False 29 | 30 | 31 | args = Args() 32 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.ruff] 2 | target-version = "py37" 3 | 4 | [tool.ruff.lint] 5 | fixable = ["ALL"] 6 | # List of rules https://docs.astral.sh/ruff/rules/ 7 | select = ["F", "I"] 8 | 9 | [tool.ruff.lint.per-file-ignores] 10 | # Fine for __init__.py files: 11 | # * F401: Module imported but unused 12 | # * F403: 'from .module import *' 13 | # (resolvable via __all__ list, 14 | # see https://docs.python.org/3/tutorial/modules.html#importing-from-a-package) 15 | "mythril/**/__init__.py" = ["F401", "F403"] 16 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | blake2b-py>=0.2.0,<1 2 | coloredlogs>=10.0 3 | coincurve>=13.0.0 4 | cytoolz>=0.12.0 5 | asn1crypto>=0.22.0 6 | configparser>=3.5.0 7 | py_ecc>=5.0.0 8 | eth-abi>=5.1.0 9 | eth-hash>=0.3.1,<0.8.0 10 | eth-utils>=2.0.0 11 | hexbytes<1.4.0 12 | jinja2>=2.9 13 | MarkupSafe<3.1.0 14 | mypy-extensions==1.0.0 15 | numpy 16 | persistent>=4.2.0 17 | py-flags 18 | py-evm==0.10.1b2 19 | py-solc-x<3.0.0 20 | py-solc 21 | pyparsing>=2.0.2,<4 22 | requests 23 | rlp>=3,<5 24 | semantic_version 25 | z3-solver>=4.8.8.0,<=4.13.4.0 26 | matplotlib 27 | certifi>=2020.06.20 28 | -------------------------------------------------------------------------------- /solidity_examples/calls.sol: -------------------------------------------------------------------------------- 1 | 2 | 3 | contract Caller { 4 | 5 | address public fixed_address; 6 | address public stored_address; 7 | 8 | uint256 statevar; 9 | 10 | constructor(address addr) public { 11 | fixed_address = addr; 12 | } 13 | 14 | function thisisfine() public { 15 | fixed_address.call(""); 16 | } 17 | 18 | function reentrancy() public { 19 | fixed_address.call(""); 20 | statevar = 0; 21 | } 22 | 23 | function calluseraddress(address addr) public { 24 | addr.call(""); 25 | } 26 | 27 | function callstoredaddress() public { 28 | stored_address.call(""); 29 | } 30 | 31 | function setstoredaddress(address addr) public { 32 | stored_address = addr; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /solidity_examples/etherstore.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.0; 2 | 3 | 4 | contract EtherStore { 5 | 6 | uint256 public withdrawalLimit = 1 ether; 7 | mapping(address => uint256) public lastWithdrawTime; 8 | mapping(address => uint256) public balances; 9 | 10 | function depositFunds() public payable { 11 | balances[msg.sender] += msg.value; 12 | } 13 | 14 | function withdrawFunds (uint256 _weiToWithdraw) public { 15 | require(balances[msg.sender] >= _weiToWithdraw); 16 | // limit the withdrawal 17 | require(_weiToWithdraw <= withdrawalLimit); 18 | // limit the time allowed to withdraw 19 | require(now >= lastWithdrawTime[msg.sender] + 1 weeks); 20 | (bool success, bytes memory data) = msg.sender.call.value(_weiToWithdraw)(""); 21 | require(success); 22 | balances[msg.sender] -= _weiToWithdraw; 23 | lastWithdrawTime[msg.sender] = now; 24 | } 25 | } -------------------------------------------------------------------------------- /solidity_examples/exceptions.sol: -------------------------------------------------------------------------------- 1 | 2 | 3 | contract Exceptions { 4 | 5 | uint256[8] myarray; 6 | 7 | function assert1() public pure { 8 | uint256 i = 1; 9 | assert(i == 0); 10 | } 11 | 12 | function assert2() public pure { 13 | uint256 i = 1; 14 | assert(i > 0); 15 | } 16 | 17 | function assert3(uint256 input) public pure { 18 | assert(input != 23); 19 | } 20 | 21 | function requireisfine(uint256 input) public pure { 22 | require(input != 23); 23 | } 24 | 25 | function divisionby0(uint256 input) public pure { 26 | uint256 i = 1/input; 27 | } 28 | 29 | function thisisfine(uint256 input) public pure { 30 | if (input > 0) { 31 | uint256 i = 1/input; 32 | } 33 | } 34 | 35 | function arrayaccess(uint256 index) public view { 36 | uint256 i = myarray[index]; 37 | } 38 | 39 | function thisisalsofind(uint256 index) public view { 40 | if (index < 8) { 41 | uint256 i = myarray[index]; 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /solidity_examples/hashforether.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.0; 2 | 3 | 4 | contract HashForEther { 5 | 6 | function withdrawWinnings() public payable { 7 | // Winner if the last 8 hex characters of the address are 0. 8 | if (uint32(msg.sender) == 0) 9 | _sendWinnings(); 10 | } 11 | 12 | function _sendWinnings() public { 13 | msg.sender.transfer(address(this).balance); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /solidity_examples/killbilly.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.7; 2 | 3 | contract KillBilly { 4 | bool public is_killable; 5 | mapping (address => bool) public approved_killers; 6 | 7 | constructor() public { 8 | is_killable = false; 9 | } 10 | 11 | function killerize(address addr) public { 12 | approved_killers[addr] = true; 13 | } 14 | 15 | function activatekillability() public { 16 | require(approved_killers[msg.sender] == true); 17 | is_killable = true; 18 | } 19 | 20 | function commencekilling() public { 21 | require(is_killable); 22 | selfdestruct(msg.sender); 23 | } 24 | } -------------------------------------------------------------------------------- /solidity_examples/origin.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.0; 2 | 3 | 4 | contract Origin { 5 | address public owner; 6 | 7 | 8 | /** 9 | * @dev The Ownable constructor sets the original `owner` of the contract to the sender 10 | * account. 11 | */ 12 | constructor() public { 13 | owner = msg.sender; 14 | } 15 | 16 | 17 | /** 18 | * @dev Throws if called by any account other than the owner. 19 | */ 20 | modifier onlyOwner() { 21 | require(tx.origin != owner); 22 | _; 23 | } 24 | 25 | 26 | /** 27 | * @dev Allows the current owner to transfer control of the contract to a newOwner. 28 | * @param newOwner The address to transfer ownership to. 29 | */ 30 | function transferOwnership(address newOwner) public onlyOwner { 31 | if (newOwner != address(0)) { 32 | owner = newOwner; 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /solidity_examples/returnvalue.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.0; 2 | 3 | 4 | contract ReturnValue { 5 | 6 | address public callee = 0xE0f7e56E62b4267062172495D7506087205A4229; 7 | 8 | function callnotchecked() public { 9 | callee.call(""); 10 | } 11 | 12 | function callchecked() public { 13 | (bool success, bytes memory data) = callee.call(""); 14 | require(success); 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /solidity_examples/suicide.sol: -------------------------------------------------------------------------------- 1 | 2 | 3 | contract Suicide { 4 | 5 | function kill(address payable addr) public { 6 | if (addr == address(0x0)) { 7 | selfdestruct(addr); 8 | } 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /solidity_examples/timelock.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.0; 2 | 3 | 4 | contract TimeLock { 5 | 6 | mapping(address => uint) public balances; 7 | mapping(address => uint) public lockTime; 8 | 9 | function deposit() public payable { 10 | balances[msg.sender] += msg.value; 11 | lockTime[msg.sender] = now + 1 weeks; 12 | } 13 | 14 | function increaseLockTime(uint _secondsToIncrease) public { 15 | lockTime[msg.sender] += _secondsToIncrease; 16 | } 17 | 18 | function withdraw() public { 19 | require(balances[msg.sender] > 0); 20 | require(now > lockTime[msg.sender]); 21 | balances[msg.sender] = 0; 22 | msg.sender.transfer(balances[msg.sender]); 23 | } 24 | } -------------------------------------------------------------------------------- /solidity_examples/token.sol: -------------------------------------------------------------------------------- 1 | 2 | 3 | contract Token { 4 | 5 | mapping(address => uint) balances; 6 | uint public totalSupply; 7 | 8 | constructor(uint _initialSupply) public { 9 | balances[msg.sender] = totalSupply = _initialSupply; 10 | } 11 | 12 | function transfer(address _to, uint _value) public returns (bool) { 13 | require(balances[msg.sender] - _value >= 0); 14 | balances[msg.sender] -= _value; 15 | balances[_to] += _value; 16 | return true; 17 | } 18 | 19 | function balanceOf(address _owner) public view returns (uint balance) { 20 | return balances[_owner]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /solidity_examples/weak_random.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.5.0; 2 | 3 | 4 | contract WeakRandom { 5 | struct Contestant { 6 | address payable addr; 7 | uint gameId; 8 | } 9 | 10 | uint public prize = 2.5 ether; 11 | uint public totalTickets = 50; 12 | uint public pricePerTicket = prize / totalTickets; 13 | 14 | uint public gameId = 1; 15 | uint public nextTicket = 0; 16 | mapping (uint => Contestant) public contestants; 17 | 18 | function () payable external { 19 | uint moneySent = msg.value; 20 | 21 | while (moneySent >= pricePerTicket && nextTicket < totalTickets) { 22 | uint currTicket = nextTicket++; 23 | contestants[currTicket] = Contestant(msg.sender, gameId); 24 | moneySent -= pricePerTicket; 25 | } 26 | 27 | if (nextTicket == totalTickets) { 28 | chooseWinner(); 29 | } 30 | 31 | // Send back leftover money 32 | if (moneySent > 0) { 33 | msg.sender.transfer(moneySent); 34 | } 35 | } 36 | 37 | function chooseWinner() private { 38 | address seed1 = contestants[uint(block.coinbase) % totalTickets].addr; 39 | address seed2 = contestants[uint(msg.sender) % totalTickets].addr; 40 | uint seed3 = block.difficulty; 41 | bytes32 randHash = keccak256(abi.encode(seed1, seed2, seed3)); 42 | 43 | uint winningNumber = uint(randHash) % totalTickets; 44 | address payable winningAddress = contestants[winningNumber].addr; 45 | 46 | gameId++; 47 | nextTicket = 0; 48 | winningAddress.transfer(prize); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /static/callgraph7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/static/callgraph7.png -------------------------------------------------------------------------------- /static/callgraph8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/static/callgraph8.png -------------------------------------------------------------------------------- /static/mythril_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/static/mythril_new.png -------------------------------------------------------------------------------- /tests/analysis/abi_decode_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from mythril.analysis.report import Issue 4 | 5 | test_data = ( 6 | ( 7 | "0xa9059cbb000000000000000000000000010801010101010120020101020401010408040402", 8 | "func(uint256,uint256)", 9 | ( 10 | 5887484186314823854737699484601117092168074244, 11 | 904625697166532776746648320380374280103671755200316906558262375061821325312, 12 | ), 13 | ), 14 | ( 15 | "0xa9059cbb00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002", 16 | "func(uint256,uint256)", 17 | (2, 2), 18 | ), 19 | # location + length + data 20 | ( 21 | "0xa9059cbb" + "0" * 62 + "20" + "0" * 63 + "1" + "0" * 63 + "2", 22 | "func(uint256[])", 23 | ((2,),), 24 | ), 25 | ) 26 | 27 | 28 | @pytest.mark.parametrize("call_data, signature, expected", test_data) 29 | def test_abi_decode(call_data, signature, expected): 30 | assert Issue.resolve_input(call_data, signature) == expected 31 | -------------------------------------------------------------------------------- /tests/cli_tests/cli_opts_test.py: -------------------------------------------------------------------------------- 1 | import json 2 | import sys 3 | 4 | import pytest 5 | 6 | from mythril.interfaces.cli import main 7 | 8 | 9 | def test_version_opt(capsys): 10 | # Check that "myth --version" returns a string with the word 11 | # "version" in it 12 | sys.argv = ["mythril", "version"] 13 | with pytest.raises(SystemExit) as pytest_wrapped_e: 14 | main() 15 | assert pytest_wrapped_e.type == SystemExit 16 | captured = capsys.readouterr() 17 | assert captured.out.find(" version ") >= 1 18 | 19 | # Check that "myth --version -o json" returns a JSON object 20 | sys.argv = ["mythril", "version", "-o", "json"] 21 | with pytest.raises(SystemExit) as pytest_wrapped_e: 22 | main() 23 | assert pytest_wrapped_e.type == SystemExit 24 | captured = capsys.readouterr() 25 | d = json.loads(captured.out) 26 | assert isinstance(d, dict) 27 | assert d["version_str"] 28 | -------------------------------------------------------------------------------- /tests/disassembler/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/tests/disassembler/__init__.py -------------------------------------------------------------------------------- /tests/instructions/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/tests/instructions/__init__.py -------------------------------------------------------------------------------- /tests/instructions/basefee_test.py: -------------------------------------------------------------------------------- 1 | from mythril.disassembler.disassembly import Disassembly 2 | from mythril.laser.ethereum.instructions import Instruction 3 | from mythril.laser.ethereum.state.environment import Environment 4 | from mythril.laser.ethereum.state.global_state import GlobalState 5 | from mythril.laser.ethereum.state.machine_state import MachineState 6 | from mythril.laser.ethereum.state.world_state import WorldState 7 | from mythril.laser.ethereum.transaction.transaction_models import MessageCallTransaction 8 | from mythril.laser.smt import symbol_factory 9 | 10 | 11 | def test_basefee(): 12 | # Arrange 13 | world_state = WorldState() 14 | account = world_state.create_account(balance=10, address=101) 15 | account.code = Disassembly("60606040") 16 | environment = Environment( 17 | account, 18 | None, 19 | None, 20 | None, 21 | None, 22 | None, 23 | basefee=symbol_factory.BitVecSym("gasfee", 256), 24 | ) 25 | og_state = GlobalState( 26 | world_state, environment, None, MachineState(gas_limit=8000000) 27 | ) 28 | og_state.transaction_stack.append( 29 | (MessageCallTransaction(world_state=WorldState(), gas_limit=8000000), None) 30 | ) 31 | 32 | og_state.mstate.stack = [] 33 | instruction = Instruction("basefee", dynamic_loader=None) 34 | 35 | # Act 36 | new_state = instruction.evaluate(og_state)[0] 37 | 38 | # Assert 39 | assert new_state.mstate.stack == [symbol_factory.BitVecSym("gasfee", 256)] 40 | -------------------------------------------------------------------------------- /tests/instructions/codecopy_test.py: -------------------------------------------------------------------------------- 1 | from mythril.disassembler.disassembly import Disassembly 2 | from mythril.laser.ethereum.instructions import Instruction 3 | from mythril.laser.ethereum.state.environment import Environment 4 | from mythril.laser.ethereum.state.global_state import GlobalState 5 | from mythril.laser.ethereum.state.machine_state import MachineState 6 | from mythril.laser.ethereum.state.world_state import WorldState 7 | from mythril.laser.ethereum.transaction.transaction_models import MessageCallTransaction 8 | 9 | 10 | def test_codecopy_concrete(): 11 | # Arrange 12 | world_state = WorldState() 13 | account = world_state.create_account(balance=10, address=101) 14 | account.code = Disassembly("60606040") 15 | environment = Environment(account, None, None, None, None, None, None) 16 | og_state = GlobalState( 17 | world_state, environment, None, MachineState(gas_limit=8000000) 18 | ) 19 | og_state.transaction_stack.append( 20 | (MessageCallTransaction(world_state=WorldState(), gas_limit=8000000), None) 21 | ) 22 | 23 | og_state.mstate.stack = [2, 2, 2] 24 | instruction = Instruction("codecopy", dynamic_loader=None) 25 | 26 | # Act 27 | new_state = instruction.evaluate(og_state)[0] 28 | 29 | # Assert 30 | assert new_state.mstate.memory[2] == 96 31 | assert new_state.mstate.memory[3] == 64 32 | -------------------------------------------------------------------------------- /tests/integration_tests/coverage_metrics_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from utils import output_of 3 | 4 | from tests import PROJECT_DIR, TESTDATA 5 | 6 | MYTH = str(PROJECT_DIR / "myth") 7 | 8 | 9 | test_data = [ 10 | (open(f"{TESTDATA}/inputs/coverage.sol.o").read(), True), 11 | ] 12 | 13 | 14 | @pytest.mark.parametrize("code, exists", test_data) 15 | def test_basic_coverage(code, exists): 16 | assert ( 17 | "instruction_discovery_time" 18 | in output_of(f"{MYTH} a -c 0x{code} --solver-timeout 1000 -o jsonv2") 19 | ) == exists 20 | -------------------------------------------------------------------------------- /tests/integration_tests/old_version_test.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | import pytest 4 | from utils import output_of 5 | 6 | from tests import PROJECT_DIR, TESTDATA 7 | 8 | MYTH = str(PROJECT_DIR / "myth") 9 | test_data = ( 10 | ("old_origin.sol", 1), 11 | ("old_version.sol", 2), 12 | ) 13 | 14 | 15 | @pytest.mark.parametrize("file_name, issues", test_data) 16 | def test_analysis_old(file_name, issues): 17 | file = str(TESTDATA / "input_contracts" / file_name) 18 | command = f"python3 {MYTH} analyze {file} -o jsonv2" 19 | output = json.loads(output_of(command)) 20 | assert len(output[0]["issues"]) >= issues 21 | -------------------------------------------------------------------------------- /tests/integration_tests/src_mapping_test.py: -------------------------------------------------------------------------------- 1 | from subprocess import STDOUT 2 | 3 | from utils import output_of 4 | 5 | from tests import PROJECT_DIR, TESTDATA 6 | 7 | MYTH = str(PROJECT_DIR / "myth") 8 | 9 | 10 | def test_positive_solc_settings(): 11 | file_path = str(TESTDATA / "input_contracts" / "destruct_crlf.sol") 12 | 13 | command = f"python3 {MYTH} analyze {file_path} --solv 0.5.0" 14 | output = output_of(command, stderr=STDOUT) 15 | assert "selfdestruct(addr)" in output 16 | -------------------------------------------------------------------------------- /tests/integration_tests/state_merge_tests.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | 4 | import pytest 5 | 6 | from tests import PROJECT_DIR, TESTDATA 7 | 8 | MYTH = str(PROJECT_DIR / "myth") 9 | 10 | 11 | def output_with_stderr(command): 12 | return subprocess.run( 13 | command.split(" "), stdout=subprocess.PIPE, stderr=subprocess.PIPE 14 | ) 15 | 16 | 17 | testfile_path = os.path.split(__file__)[0] 18 | 19 | """ 20 | calls.bin is the bytecode of 21 | https://github.com/ConsenSys/mythril/blob/develop/solidity_examples/calls.sol 22 | """ 23 | swc_test_data = [ 24 | ("114", f"{TESTDATA}/inputs/calls.sol.o", (9, 5)), 25 | ] 26 | 27 | 28 | @pytest.mark.parametrize("swc, code, states_reduction", swc_test_data) 29 | def test_merge(swc, code, states_reduction): 30 | output = output_with_stderr( 31 | f"{MYTH} -v4 a -f {code} -t 1 --solver-timeout 500 -mUncheckedRetval --enable-state-merging" 32 | ) 33 | output_str = f"States reduced from {states_reduction[0]} to {states_reduction[1]}" 34 | assert output_str in output.stderr.decode("utf-8") 35 | -------------------------------------------------------------------------------- /tests/integration_tests/transient_storage_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from utils import output_of 3 | 4 | from tests import PROJECT_DIR, TESTDATA 5 | 6 | MYTH = str(PROJECT_DIR / "myth") 7 | 8 | input_files = [ 9 | ("transient.sol", False), 10 | ("transient_bug.sol", True), 11 | ("transient_bug_2.sol", True), 12 | ("transient_recursive.sol", True), 13 | ] 14 | 15 | 16 | @pytest.mark.parametrize("file_name, expected_has_bug", input_files) 17 | def test_positive_solc_settings(file_name, expected_has_bug): 18 | file_path = str(TESTDATA / "input_contracts" / file_name) 19 | 20 | # Call the function you want to test 21 | command = f"python3 {MYTH} analyze {file_path} -mExceptions --solv 0.8.25" 22 | actual_output = output_of(command) 23 | 24 | # Assertion 25 | if expected_has_bug: 26 | assert "An assertion violation was triggered" in actual_output 27 | else: 28 | assert ( 29 | "The analysis was completed successfully. No issues were detected" 30 | in actual_output 31 | ) 32 | -------------------------------------------------------------------------------- /tests/integration_tests/utils.py: -------------------------------------------------------------------------------- 1 | from subprocess import CalledProcessError, check_output 2 | 3 | 4 | def output_of(command, stderr=None): 5 | """ 6 | 7 | :param command: 8 | :return: 9 | """ 10 | try: 11 | return check_output(command, shell=True, stderr=stderr).decode("UTF-8") 12 | except CalledProcessError as exc: 13 | return exc.output.decode("UTF-8") 14 | -------------------------------------------------------------------------------- /tests/integration_tests/version_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from utils import output_of 3 | 4 | from tests import PROJECT_DIR, TESTDATA 5 | 6 | MYTH = str(PROJECT_DIR / "myth") 7 | test_data = ( 8 | ("version_contract.sol", "v0.7.0", True), 9 | ("version_contract.sol", "v0.8.0", False), 10 | ("version_contract_0.8.0.sol", None, False), 11 | ("version_contract_0.7.0.sol", None, True), 12 | ("version_chaos.sol", None, True), 13 | ("version_2.sol", None, True), 14 | ("version_3.sol", None, True), 15 | ("version_4.sol", None, False), 16 | ("version_patch.sol", None, False), 17 | ("integer_edge_case.sol", None, True), 18 | ("integer_edge_case.sol", "v0.8.19", True), 19 | ) 20 | 21 | 22 | @pytest.mark.parametrize("file_name, version, has_overflow", test_data) 23 | def test_analysis(file_name, version, has_overflow): 24 | file = str(TESTDATA / "input_contracts" / file_name) 25 | if version: 26 | command = f"python3 {MYTH} analyze {file} --solv {version}" 27 | else: 28 | command = f"python3 {MYTH} analyze {file}" 29 | output = output_of(command) 30 | if has_overflow: 31 | assert "SWC ID: 101" in output 32 | else: 33 | assert ( 34 | "The analysis was completed successfully. No issues were detected." 35 | in output 36 | ) 37 | -------------------------------------------------------------------------------- /tests/laser/Precompiles/ec_add_test.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import patch 2 | 3 | from eth_utils import decode_hex 4 | from py_ecc.optimized_bn128 import FQ 5 | 6 | from mythril.laser.ethereum.natives import ec_add 7 | 8 | VECTOR_A = decode_hex( 9 | "0000000000000000000000000000000000000000000000000000000000000001" 10 | "0000000000000000000000000000000000000000000000000000000000000020" 11 | "0000000000000000000000000000000000000000000000000000000000000020" 12 | "03" 13 | "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e" 14 | "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f" 15 | ) 16 | 17 | 18 | def test_ec_add_sanity(): 19 | assert ec_add(VECTOR_A) == [] 20 | 21 | 22 | @patch("mythril.laser.ethereum.natives.validate_point", return_value=1) 23 | @patch("mythril.laser.ethereum.natives.bn128.add", return_value=1) 24 | @patch("mythril.laser.ethereum.natives.bn128.normalize") 25 | def test_ec_add(f1, f2, f3): 26 | FQ.fielf_modulus = 128 27 | a = FQ(val=1) 28 | f1.return_value = (a, a) 29 | assert ec_add(VECTOR_A) == ([0] * 31 + [1]) * 2 30 | -------------------------------------------------------------------------------- /tests/laser/Precompiles/elliptic_curves_test.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import patch 2 | 3 | from py_ecc.optimized_bn128 import FQ 4 | 5 | from mythril.laser.ethereum.natives import ec_pair 6 | 7 | 8 | def test_ec_pair_192_check(): 9 | vec_c = [0] * 100 10 | assert ec_pair(vec_c) == [] 11 | 12 | 13 | @patch("mythril.laser.ethereum.natives.validate_point", return_value=1) 14 | @patch("mythril.laser.ethereum.natives.bn128.is_on_curve", return_value=True) 15 | @patch("mythril.laser.ethereum.natives.bn128.pairing", return_value=1) 16 | @patch("mythril.laser.ethereum.natives.bn128.normalize") 17 | def test_ec_pair(f1, f2, f3, f4): 18 | FQ.fielf_modulus = 100 19 | a = FQ(val=1) 20 | f1.return_value = (a, a) 21 | vec_c = [0] * 192 22 | assert ec_pair(vec_c) == [0] * 31 + [1] 23 | 24 | 25 | @patch("mythril.laser.ethereum.natives.validate_point", return_value=False) 26 | def test_ec_pair_point_validation_failure(f1): 27 | vec_c = [0] * 192 28 | assert ec_pair(vec_c) == [] 29 | 30 | 31 | @patch("mythril.laser.ethereum.natives.validate_point", return_value=1) 32 | def test_ec_pair_field_exceed_mod(f1): 33 | FQ.fielf_modulus = 100 34 | a = FQ(val=1) 35 | f1.return_value = (a, a) 36 | vec_c = [10] * 192 37 | assert ec_pair(vec_c) == [] 38 | -------------------------------------------------------------------------------- /tests/laser/Precompiles/elliptic_mul_test.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import patch 2 | 3 | from eth_utils import decode_hex 4 | from py_ecc.optimized_bn128 import FQ 5 | 6 | from mythril.laser.ethereum.natives import ec_mul 7 | 8 | VECTOR_A = decode_hex( 9 | "0000000000000000000000000000000000000000000000000000000000000001" 10 | "0000000000000000000000000000000000000000000000000000000000000020" 11 | "0000000000000000000000000000000000000000000000000000000000000020" 12 | "03" 13 | "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e" 14 | "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f" 15 | ) 16 | 17 | 18 | @patch("mythril.laser.ethereum.natives.validate_point", return_value=1) 19 | @patch("mythril.laser.ethereum.natives.bn128.multiply", return_value=1) 20 | @patch("mythril.laser.ethereum.natives.bn128.normalize") 21 | def test_ec_mul(f1, f2, f3): 22 | FQ.fielf_modulus = 128 23 | a = FQ(val=1) 24 | f1.return_value = (a, a) 25 | assert ec_mul(VECTOR_A) == ([0] * 31 + [1]) * 2 26 | 27 | 28 | def test_ec_mul_validation_failure(): 29 | assert ec_mul(VECTOR_A) == [] 30 | -------------------------------------------------------------------------------- /tests/laser/Precompiles/identity_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from mythril.laser.ethereum.natives import identity 4 | 5 | 6 | @pytest.mark.parametrize( 7 | "input_list, expected_result", (([], []), ([10, 20], [10, 20])) 8 | ) 9 | def test_identity(input_list, expected_result): 10 | assert identity(input_list) == expected_result 11 | -------------------------------------------------------------------------------- /tests/laser/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/tests/laser/__init__.py -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Ethereum Foundation 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/README.md: -------------------------------------------------------------------------------- 1 | Files found in this directory are taken from https://github.com/ethereum/tests, released under the 2 | license LICENSE in the same directory as this file. 3 | 4 | All credit goes to the awesome people that made this! 5 | -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/DynamicJump0_foreverOutOfGas.json: -------------------------------------------------------------------------------- 1 | { 2 | "DynamicJump0_foreverOutOfGas" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/DynamicJump0_foreverOutOfGasFiller.json", 8 | "sourceHash" : "68b687a344b0f44d7459e095f05f6b302ee3f5d15b3c3e7765d5642fb1f46689" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x5b600060000156", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x5b600060000156", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/DynamicJump1.json: -------------------------------------------------------------------------------- 1 | { 2 | "DynamicJump1" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/DynamicJump1Filler.json", 8 | "sourceHash" : "2369bac56afc1e0946f608c52027fbc88faf3844cdc2fa46954a0916221b8432" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x620fffff620fffff0160030156", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x620fffff620fffff0160030156", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/DynamicJumpi0.json: -------------------------------------------------------------------------------- 1 | { 2 | "DynamicJumpi0" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/DynamicJumpi0Filler.json", 8 | "sourceHash" : "394cae3e06d120cc1a5df5e14cfae3598d62e1fefa06dce4055c6ff59c367b63" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x602360016009600301576001600255", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x602360016009600301576001600255", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/bad_indirect_jump1.json: -------------------------------------------------------------------------------- 1 | { 2 | "bad_indirect_jump1" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/bad_indirect_jump1Filler.json", 8 | "sourceHash" : "15744a7158d6982822dc8a0c272c329f8dfdf93810e8f2f3f468a56db9bd2d90" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x601b602502565b", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x601b602502565b", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/bad_indirect_jump2.json: -------------------------------------------------------------------------------- 1 | { 2 | "bad_indirect_jump2" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/bad_indirect_jump2Filler.json", 8 | "sourceHash" : "6dd2730ab6f27b43eead1633f104f5d60d6a98fa7c81d5a8ba0d2f6434706813" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x60016003600302576000600056", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x60016003600302576000600056", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/calldatacopyMemExp.json: -------------------------------------------------------------------------------- 1 | { 2 | "calldatacopyMemExp" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/calldatacopyMemExpFiller.json", 8 | "sourceHash" : "fcf33988ecf7e66eae80382111d1128eb302e201be169ca20b306eac49231142" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x01f4153d80", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x60ff60ff630fffffff630fffffff37", 21 | "data" : "0x", 22 | "gas" : "0x01f4153d80", 23 | "gasPrice" : "0x01", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x60ff60ff630fffffff630fffffff37", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/codecopyMemExp.json: -------------------------------------------------------------------------------- 1 | { 2 | "codecopyMemExp" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/codecopyMemExpFiller.json", 8 | "sourceHash" : "baf738ce30cb457d16aa2f71f866ce00ddb998371757f2c6a30a5d1ca3a9e135" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x01f4153d80", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x60ff60ff630fffffff630fffffff39", 21 | "data" : "0x", 22 | "gas" : "0x01f4153d80", 23 | "gasPrice" : "0x01", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x60ff60ff630fffffff630fffffff39", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/jump0_AfterJumpdest.json: -------------------------------------------------------------------------------- 1 | { 2 | "jump0_AfterJumpdest" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/jump0_AfterJumpdestFiller.json", 8 | "sourceHash" : "8e933f0185d188f6eeb002d4ac8dace70a34a196e4c59932957eaac4cef27849" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x602360085660015b600255", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x602360085660015b600255", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/jump0_foreverOutOfGas.json: -------------------------------------------------------------------------------- 1 | { 2 | "jump0_foreverOutOfGas" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/jump0_foreverOutOfGasFiller.json", 8 | "sourceHash" : "06656a40346ccda59a2d1852d9bb59447d34fb9eb80706e378c5a067e337a080" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x5b600056", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x5b600056", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/jump0_outOfBoundary.json: -------------------------------------------------------------------------------- 1 | { 2 | "jump0_outOfBoundary" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/jump0_outOfBoundaryFiller.json", 8 | "sourceHash" : "9442ba4b2e4625b3ba5d7a3c43a5c1bcbb0f71fb8977d9cb291a58f956e5d014" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x60236007566001600255", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x60236007566001600255", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/jump0_withoutJumpdest.json: -------------------------------------------------------------------------------- 1 | { 2 | "jump0_withoutJumpdest" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/jump0_withoutJumpdestFiller.json", 8 | "sourceHash" : "4023b9b32fabb7baeb154e319422cc24e852c858eb124713508a241df86f3969" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x60236007566001600255", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x60236007566001600255", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/jump1.json: -------------------------------------------------------------------------------- 1 | { 2 | "jump1" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/jump1Filler.json", 8 | "sourceHash" : "c86900065dc3ca2743c247f2c7f305795833184ab64acf0c6911a899533ab628" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x620fffff620fffff0156", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x620fffff620fffff0156", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/jumpHigh.json: -------------------------------------------------------------------------------- 1 | { 2 | "jumpHigh" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/jumpHighFiller.json", 8 | "sourceHash" : "a7725bef6c1ff691ae5ad3b73c3b44a6d16f9c9b1c0e57671d7ff59fe9ac9800" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x630fffffff565b5b6001600155", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x630fffffff565b5b6001600155", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/jumpInsidePushWithoutJumpDest.json: -------------------------------------------------------------------------------- 1 | { 2 | "jumpInsidePushWithoutJumpDest" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/jumpInsidePushWithoutJumpDestFiller.json", 8 | "sourceHash" : "451d199b9c77c3a3297bb20ba2a01c238e984283e3690b22c9614121c878d8ec" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x60055661eeff", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x60055661eeff", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/jumpOntoJump.json: -------------------------------------------------------------------------------- 1 | { 2 | "jumpOntoJump" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/jumpOntoJumpFiller.json", 8 | "sourceHash" : "b7af74ccb70e4242810a2f47181f0c95ee1b9558385cff3a33896f29c7775d7e" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x565b600056", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x565b600056", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/jumpTo1InstructionafterJump.json: -------------------------------------------------------------------------------- 1 | { 2 | "jumpTo1InstructionafterJump" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/jumpTo1InstructionafterJumpFiller.json", 8 | "sourceHash" : "88eb8cc46a28df3e813fc9d859aaa7c10bd7246272ed7af7c7e119e18e7c6592" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x6003565b6001600055", 21 | "data" : "0x", 22 | "gas" : "0x2710", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x0de0b6b3a7640000", 30 | "code" : "0x6003565b6001600055", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/jumpi0.json: -------------------------------------------------------------------------------- 1 | { 2 | "jumpi0" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/jumpi0Filler.json", 8 | "sourceHash" : "86fb0cc0becb3234b287df55e90da9a860eff30714976e3395b25ee2e2b47c48" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x602360016009576001600255", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x602360016009576001600255", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/jumpi1_jumpdest.json: -------------------------------------------------------------------------------- 1 | { 2 | "jumpi1_jumpdest" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/jumpi1_jumpdestFiller.json", 8 | "sourceHash" : "ad83573b03f45ffbef8bfcea78a8cb61b1c793b36475000cf9222dea41696717" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x60236001600a5760015b600255", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x60236001600a5760015b600255", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/log1MemExp.json: -------------------------------------------------------------------------------- 1 | { 2 | "log1MemExp" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/log1MemExpFiller.json", 8 | "sourceHash" : "241dbcb0d33d25f1db0b51b65c38c4e3ef2f5b52c799264979423508e3fcf934" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x01f4153d80", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x60ff60ff630fffffffa1", 21 | "data" : "0x", 22 | "gas" : "0x01f4153d80", 23 | "gasPrice" : "0x01", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x60ff60ff630fffffffa1", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/mloadMemExp.json: -------------------------------------------------------------------------------- 1 | { 2 | "mloadMemExp" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/mloadMemExpFiller.json", 8 | "sourceHash" : "b12ca5b81a2d597d774f63fd3e6301a3808c7090e1b5ee00ea980c846ddadf32" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x01f4153d80", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x630fffffff51", 21 | "data" : "0x", 22 | "gas" : "0x800570", 23 | "gasPrice" : "0x01", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x630fffffff51", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/mloadOutOfGasError2.json: -------------------------------------------------------------------------------- 1 | { 2 | "mloadOutOfGasError2" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/mloadOutOfGasError2Filler.json", 8 | "sourceHash" : "8df8c3070849692634e4e7af44885da9c5d41df0717fd6d337aa7d5bfed56d52" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x6272482551600155", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x6272482551600155", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/mstore8MemExp.json: -------------------------------------------------------------------------------- 1 | { 2 | "mstore8MemExp" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/mstore8MemExpFiller.json", 8 | "sourceHash" : "df32f3b06a7e748f5fdd93a878f7687f4f28864f8a5956d8e3a4fff7463b47f0" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x01f4153d80", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x60f1630fffffff53", 21 | "data" : "0x", 22 | "gas" : "0x800570", 23 | "gasPrice" : "0x01", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x60f1630fffffff53", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/mstoreMemExp.json: -------------------------------------------------------------------------------- 1 | { 2 | "mstoreMemExp" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/mstoreMemExpFiller.json", 8 | "sourceHash" : "eb43769a562c8a34bcb776fd312cc723bf2e8f4e64c75d7d3e36451760d9fd44" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x01f4153d80", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x60f1630fffffff52", 21 | "data" : "0x", 22 | "gas" : "0x01f4153d80", 23 | "gasPrice" : "0x01", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x60f1630fffffff52", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/pop1.json: -------------------------------------------------------------------------------- 1 | { 2 | "pop1" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/pop1Filler.json", 8 | "sourceHash" : "f87d71b88a272f122f6ea9dbd4680f8b4bf659a1b2bae4634398e6ecdcc9f487" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x5060026003600455", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x5060026003600455", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/return1.json: -------------------------------------------------------------------------------- 1 | { 2 | "return1" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/return1Filler.json", 8 | "sourceHash" : "fe0798e0775da11e784482b44b51322ad70f4deaa8ce8643841257d3abee2e1f" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x6001620f4240f3", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x6001620f4240f3", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/sha3MemExp.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha3MemExp" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/sha3MemExpFiller.json", 8 | "sourceHash" : "6672d6b321654fc8397f1a89903d0fb859013f50a4483c33e7b14b08ba490886" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x01f4153d80", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x60ff630fffffff20", 21 | "data" : "0x", 22 | "gas" : "0x01f4153d80", 23 | "gasPrice" : "0x01", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x60ff630fffffff20", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/sstore_underflow.json: -------------------------------------------------------------------------------- 1 | { 2 | "sstore_underflow" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/sstore_underflowFiller.json", 8 | "sourceHash" : "805b307827e4870e9e3bf9655a71a4ca5c327223280c4c3125522d053732de4b" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x600155", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x600155", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmIOandFlowOperations/swapAt52becameMstore.json: -------------------------------------------------------------------------------- 1 | { 2 | "swapAt52becameMstore" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmIOandFlowOperations/swapAt52becameMstoreFiller.json", 8 | "sourceHash" : "b014aac7021775f56b763921bf12a663ca35c4aa230888cd7908edfa705b1413" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x600260035255", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x600260035255", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmRandomTest/201503112218PYTHON.json: -------------------------------------------------------------------------------- 1 | { 2 | "201503112218PYTHON" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.5.0.dev2-52+commit.d419e0a2", 6 | "lllcversion" : "Version: 0.4.26-develop.2018.9.19+commit.785cbf40.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmRandomTest/201503112218PYTHONFiller.json", 8 | "sourceHash" : "6fc205d30fd7493b6e120e18c91e1e41f6fe334b94abadbac37d2817066ebccb" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x012c", 15 | "currentTimestamp" : "0x02" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x4041", 21 | "data" : "0x", 22 | "gas" : "0x2710", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x0de0b6b3a7640000", 30 | "code" : "0x4041", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmSha3Test/sha3_3oog.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha3_3oog" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "cpp-1.3.0+commit.6e0ce939.Linux.g++", 6 | "lllcversion" : "Version: 0.4.18-develop.2017.9.25+commit.a72237f2.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmSha3Test/sha3_3Filler.json", 8 | "sourceHash" : "1f474f7dac8971615e641354d809db332975d1ea5ca589d855fb02a1da559033" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x620fffff6103e820600055", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x620fffff6103e820600055", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmSha3Test/sha3_4oog.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha3_4oog" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "cpp-1.3.0+commit.6e0ce939.Linux.g++", 6 | "lllcversion" : "Version: 0.4.18-develop.2017.9.25+commit.a72237f2.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmSha3Test/sha3_4Filler.json", 8 | "sourceHash" : "100da75ff0b63159ca86aa4ef7457a956027af5c6c1ed1f0fa894aaa63849887" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x6064640fffffffff20600055", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x6064640fffffffff20600055", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/laser/evm_testsuite/VMTests/vmSha3Test/sha3_5oog.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha3_5oog" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "cpp-1.3.0+commit.6e0ce939.Linux.g++", 6 | "lllcversion" : "Version: 0.4.18-develop.2017.9.25+commit.a72237f2.Linux.g++", 7 | "source" : "src/VMTestsFiller/vmSha3Test/sha3_5Filler.json", 8 | "sourceHash" : "066bcf3a8e9e7b4c15ec2240c8e1bb0d53de0230c76989e21e4b6aaac83f577d" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x0100", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x00", 15 | "currentTimestamp" : "0x01" 16 | }, 17 | "exec" : { 18 | "address" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 19 | "caller" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 20 | "code" : "0x640fffffffff61271020600055", 21 | "data" : "0x", 22 | "gas" : "0x0186a0", 23 | "gasPrice" : "0x5af3107a4000", 24 | "origin" : "0xcd1722f3947def4cf144679da39c4c32bdc35681", 25 | "value" : "0x0de0b6b3a7640000" 26 | }, 27 | "pre" : { 28 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 29 | "balance" : "0x152d02c7e14af6800000", 30 | "code" : "0x640fffffffff61271020600055", 31 | "nonce" : "0x00", 32 | "storage" : { 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/laser/smt/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/tests/laser/smt/__init__.py -------------------------------------------------------------------------------- /tests/laser/smt/model_test.py: -------------------------------------------------------------------------------- 1 | import z3 2 | 3 | from mythril.laser.smt import Solver, symbol_factory 4 | 5 | 6 | def test_decls(): 7 | # Arrange 8 | solver = Solver() 9 | x = symbol_factory.BitVecSym("x", 256) 10 | expression = x == symbol_factory.BitVecVal(2, 256) 11 | 12 | # Act 13 | solver.add(expression) 14 | result = solver.check() 15 | model = solver.model() 16 | 17 | decls = model.decls() 18 | 19 | # Assert 20 | assert z3.sat == result 21 | assert x.raw.decl() in decls 22 | 23 | 24 | def test_get_item(): 25 | # Arrange 26 | solver = Solver() 27 | x = symbol_factory.BitVecSym("x", 256) 28 | expression = x == symbol_factory.BitVecVal(2, 256) 29 | 30 | # Act 31 | solver.add(expression) 32 | result = solver.check() 33 | model = solver.model() 34 | 35 | x_concrete = model[x.raw.decl()] 36 | 37 | # Assert 38 | assert z3.sat == result 39 | assert 2 == x_concrete 40 | 41 | 42 | def test_as_long(): 43 | # Arrange 44 | solver = Solver() 45 | x = symbol_factory.BitVecSym("x", 256) 46 | expression = x == symbol_factory.BitVecVal(2, 256) 47 | 48 | # Act 49 | solver.add(expression) 50 | result = solver.check() 51 | model = solver.model() 52 | 53 | x_concrete = model.eval(x.raw).as_long() 54 | 55 | # Assert 56 | assert z3.sat == result 57 | assert 2 == x_concrete 58 | -------------------------------------------------------------------------------- /tests/laser/state/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/tests/laser/state/__init__.py -------------------------------------------------------------------------------- /tests/laser/state/mstack_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from mythril.laser.ethereum.evm_exceptions import ( 4 | StackOverflowException, 5 | StackUnderflowException, 6 | ) 7 | from mythril.laser.ethereum.state.machine_state import MachineStack 8 | from tests import BaseTestCase 9 | 10 | 11 | class MachineStackTest(BaseTestCase): 12 | @staticmethod 13 | def test_mstack_constructor(): 14 | mstack = MachineStack([1, 2]) 15 | assert mstack == [1, 2] 16 | 17 | @staticmethod 18 | def test_mstack_append_single_element(): 19 | mstack = MachineStack() 20 | 21 | mstack.append(0) 22 | 23 | assert mstack == [0] 24 | 25 | @staticmethod 26 | def test_mstack_append_multiple_elements(): 27 | mstack = MachineStack() 28 | 29 | for i in range(mstack.STACK_LIMIT): 30 | mstack.append(1) 31 | 32 | with pytest.raises(StackOverflowException): 33 | mstack.append(1000) 34 | 35 | @staticmethod 36 | def test_mstack_pop(): 37 | mstack = MachineStack([2]) 38 | 39 | assert mstack.pop() == 2 40 | 41 | with pytest.raises(StackUnderflowException): 42 | mstack.pop() 43 | 44 | @staticmethod 45 | def test_mstack_no_support_add(): 46 | mstack = MachineStack([0, 1]) 47 | 48 | with pytest.raises(NotImplementedError): 49 | mstack + [2] 50 | 51 | @staticmethod 52 | def test_mstack_no_support_iadd(): 53 | mstack = MachineStack() 54 | 55 | with pytest.raises(NotImplementedError): 56 | mstack += mstack 57 | -------------------------------------------------------------------------------- /tests/laser/state/world_state_account_exist_load_test.py: -------------------------------------------------------------------------------- 1 | """ 2 | def _get_global_state(): 3 | active_account = Account("0x0", code=Disassembly("60606040")) 4 | passive_account = Account( 5 | "0x325345346564645654645", code=Disassembly("6060604061626364") 6 | ) 7 | environment = Environment(active_account, None, None, None, None, None) 8 | world_state = WorldState() 9 | world_state.put_account(active_account) 10 | world_state.put_account(passive_account) 11 | return GlobalState(world_state, environment, None, MachineState(gas_limit=8000000)) 12 | 13 | 14 | @pytest.mark.parametrize( 15 | "addr, eth, code_len", 16 | [ 17 | ( 18 | "0xb09C477eCDAd49DD5Ac26c2C64914C3a6693843a", 19 | EthJsonRpc("rinkeby.infura.io", 443, True), 20 | 1548, 21 | ), 22 | ( 23 | "0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4", 24 | EthJsonRpc("mainnet.infura.io", 443, True), 25 | 0, 26 | ), 27 | ( 28 | "0x325345346564645654645", 29 | EthJsonRpc("mainnet.infura.io", 443, True), 30 | 16, 31 | ), # This contract tests Address Cache 32 | ], 33 | ) 34 | def test_extraction(addr, eth, code_len): 35 | global_state = _get_global_state() 36 | dynamic_loader = DynLoader(eth=eth) 37 | code = global_state.world_state.accounts_exist_or_load( 38 | addr, dynamic_loader 39 | ).code.bytecode 40 | assert len(code) == code_len 41 | """ 42 | -------------------------------------------------------------------------------- /tests/laser/strategy/loop_bound_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from mythril.laser.ethereum.strategy.extensions.bounded_loops import ( 4 | BoundedLoopsStrategy, 5 | ) 6 | 7 | 8 | @pytest.mark.parametrize( 9 | "trace, count", 10 | [ 11 | ([6, 7, 7, 7], 3), 12 | ([6, 8, 6, 7, 6, 7, 6, 7, 6, 7], 4), 13 | ([6, 6, 6, 6], 4), 14 | ([6, 7, 8] * 10, 10), 15 | ([7, 9, 10] + list(range(1, 100)) * 100, 100), 16 | ([7, 10, 15], 0), 17 | ([7] * 100, 100), 18 | ], 19 | ) 20 | def test_loop_count(trace, count): 21 | assert count == BoundedLoopsStrategy.get_loop_count(trace) 22 | -------------------------------------------------------------------------------- /tests/laser/transaction/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/tests/laser/transaction/__init__.py -------------------------------------------------------------------------------- /tests/plugin/interface_test.py: -------------------------------------------------------------------------------- 1 | from mythril.plugin.interface import MythrilCLIPlugin, MythrilPlugin 2 | 3 | 4 | def test_construct_cli_plugin(): 5 | _ = MythrilCLIPlugin() 6 | 7 | 8 | def test_construct_mythril_plugin(): 9 | _ = MythrilPlugin 10 | -------------------------------------------------------------------------------- /tests/plugin/loader_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from mythril.plugin import MythrilPlugin, MythrilPluginLoader 4 | from mythril.plugin.loader import UnsupportedPluginType 5 | 6 | 7 | def test_typecheck_load(): 8 | # Arrange 9 | loader = MythrilPluginLoader() 10 | 11 | # Act 12 | with pytest.raises(ValueError): 13 | loader.load(None) 14 | 15 | 16 | def test_unsupported_plugin_type(): 17 | # Arrange 18 | loader = MythrilPluginLoader() 19 | 20 | # Act 21 | with pytest.raises(UnsupportedPluginType): 22 | loader.load(MythrilPlugin()) 23 | -------------------------------------------------------------------------------- /tests/pre-commit-hooks/Counter.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.26; 3 | 4 | contract Counter { 5 | uint256 public number; 6 | 7 | function setNumber(uint256 newNumber) public { 8 | number = newNumber; 9 | } 10 | 11 | function increment() public { 12 | number++; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/pre-commit-hooks/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errtrace -o nounset -o pipefail -o errexit 4 | 5 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" 6 | 7 | # Create temp working directory for mock repo 8 | MOCK_REPO=$(mktemp -d) 9 | if [[ ! "$MOCK_REPO" || ! -d "$MOCK_REPO" ]]; then 10 | echo "Could not create temp dir" 11 | exit 1 12 | fi 13 | function cleanup { 14 | echo "Deleting temp working directory $MOCK_REPO" 15 | rm -rf "$MOCK_REPO" 16 | } 17 | trap cleanup EXIT 18 | 19 | # Filling the mock repo 20 | pushd "$MOCK_REPO" >/dev/null || exit 1 21 | git init --initial-branch=master 22 | git config user.email "test@example.com" 23 | git config user.name "pre-commit test" 24 | cp "$SCRIPT_DIR/Counter.sol" . 25 | git add . 26 | git commit -m "Initial commit" 27 | 28 | # Run pre-commit inside the mock repo while referencing the mythril directory, 29 | # where the .pre-commit-hooks.yaml is located. 30 | pre-commit try-repo "$SCRIPT_DIR/../.." mythril --verbose --color=always --all-files 31 | -------------------------------------------------------------------------------- /tests/testdata/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/tests/testdata/__init__.py -------------------------------------------------------------------------------- /tests/testdata/compile.py: -------------------------------------------------------------------------------- 1 | # compile test contracts 2 | from pathlib import Path 3 | 4 | from mythril.solidity.soliditycontract import SolidityContract 5 | 6 | # Recompiles all the to be tested contracts 7 | root = Path(__file__).parent 8 | input = root / "input_contracts" 9 | output = root / "inputs" 10 | 11 | for contract in input.iterdir(): 12 | sol = SolidityContract(str(contract)) 13 | code = sol.code 14 | 15 | output_file = output / "{}.o".format(contract.name) 16 | output_file.write_text(code) 17 | -------------------------------------------------------------------------------- /tests/testdata/concolic_io/multi_contract_example.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.6; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retrieve value in a variable 6 | */ 7 | contract D1 { 8 | 9 | uint256 number; 10 | 11 | function store(uint256 num) public { 12 | number =num; 13 | } 14 | 15 | function retval() public returns(uint256){ 16 | return number; 17 | } 18 | } 19 | contract D2 { 20 | 21 | 22 | uint256 number; 23 | 24 | function store(uint256 num) external { 25 | number = num; 26 | } 27 | function retval() public returns(uint256){ 28 | return number; 29 | } 30 | 31 | } 32 | 33 | 34 | contract D3 { 35 | D2 d2; 36 | D1 d1; 37 | constructor() public 38 | { 39 | d1 = D1(0x0901d12ebE1b195E5AA8748E62Bd7734aE19B51F); 40 | d2 = D2(0x384f682f4a5AbefC8795Cc38a340dE9446dFAE7A); 41 | } 42 | function test(uint256 num) public returns(uint256) { 43 | uint256 sum = d1.retval() + d2.retval() + num; 44 | if (sum == 10) { 45 | return sum + 10; 46 | } 47 | else if(sum == 25) { 48 | return sum * 2; 49 | } 50 | else return sum*10; 51 | return sum; 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /tests/testdata/concolic_io/multiple_example.sol: -------------------------------------------------------------------------------- 1 | // source of the bytecode, as a reference for the test. 2 | pragma solidity 0.8.6; 3 | 4 | contract Example1 { 5 | uint256 private initialized = 0; 6 | uint256 public count = 1; 7 | 8 | function init() public { 9 | initialized = 1; 10 | } 11 | 12 | function run(uint256 input, uint val) public { 13 | if (val == 3) { 14 | count += input; 15 | } 16 | else if(val == 5) { 17 | count += 2 * input; 18 | } 19 | else if(val == 7) { 20 | count += 10 + input; 21 | } 22 | else 23 | count++; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/testdata/concolic_io/simple_example.sol: -------------------------------------------------------------------------------- 1 | // source of the bytecode, as a reference for the test. 2 | pragma solidity 0.8.6; 3 | 4 | contract Example1 { 5 | uint256 private initialized = 0; 6 | uint256 public count = 1; 7 | 8 | function init() public { 9 | initialized = 1; 10 | } 11 | 12 | function run(uint256 input, uint val) public { 13 | if (val == 3) { 14 | count += input; 15 | } 16 | else 17 | count++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/testdata/concolic_io/two_contract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.6; 2 | 3 | /** 4 | * @title Storage 5 | * @dev Store & retrieve value in a variable 6 | */ 7 | contract D1 { 8 | 9 | uint256 number; 10 | 11 | function store(uint256 num) public { 12 | assert(num < 5); 13 | number =num; 14 | } 15 | 16 | function retval() public returns(uint256){ 17 | return number; 18 | } 19 | } 20 | 21 | contract D2 { 22 | D1 d1; 23 | constructor() public 24 | { 25 | d1 = D1(0x0901d12ebE1b195E5AA8748E62Bd7734aE19B51F); 26 | } 27 | function test(uint256 num) public returns(uint256) { 28 | uint256 sum = d1.retval() + num; 29 | if (sum == 10) { 30 | return sum + 10; 31 | } 32 | else if(sum == 11) { 33 | return sum + 12; 34 | } 35 | else if(sum == 30) { 36 | return sum * 2; 37 | } 38 | assert(sum != 20); 39 | return sum; 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/SimpleModifier.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | 5 | contract SimpleModifier { 6 | 7 | address payable public owner; 8 | 9 | modifier onlyOwner() { 10 | require(msg.sender == owner); 11 | _; 12 | } 13 | 14 | 15 | function withdrawfunds() public onlyOwner { 16 | owner.send(address(this).balance); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/base_case.sol: -------------------------------------------------------------------------------- 1 | contract B{ 2 | uint x=0; 3 | function incr() public returns(uint){ 4 | require(x==0); 5 | x += 1; 6 | } 7 | function incr2() public payable returns(uint){ 8 | require(x==1); 9 | x += 1; 10 | 11 | } 12 | function continous_incr() public payable returns(uint){ 13 | require(x>=2); 14 | x += 1; 15 | } 16 | 17 | function destroy() public returns(uint){ 18 | selfdestruct(msg.sender); 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/calls.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract Caller { 5 | 6 | address public fixed_address; 7 | address public stored_address; 8 | 9 | uint256 statevar; 10 | 11 | constructor(address addr) public { 12 | fixed_address = address(0x552254CbAaF32613C6c0450CF19524594eF84044); 13 | } 14 | 15 | function thisisfine() public { 16 | fixed_address.call(""); 17 | } 18 | 19 | function reentrancy() public { 20 | fixed_address.call(""); 21 | statevar = 0; 22 | } 23 | 24 | function calluseraddress(address addr) public { 25 | addr.call(""); 26 | } 27 | 28 | function callstoredaddress() public { 29 | stored_address.call(""); 30 | statevar = 0; 31 | } 32 | 33 | function setstoredaddress(address addr) public { 34 | stored_address = addr; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/constructor_assert.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract AssertFail { 5 | constructor(uint8 var1) public { 6 | assert(var1 > 0); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/destruct_crlf.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract Suicide { 5 | 6 | function kill(address payable addr) public { 7 | selfdestruct(addr); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/environments.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract IntegerOverflow2 { 5 | uint256 public count = 7; 6 | mapping(address => uint256) balances; 7 | 8 | function batchTransfer(address[] memory _receivers, uint256 _value) public returns(bool){ 9 | uint cnt = _receivers.length; 10 | uint256 amount = uint256(cnt) * _value; 11 | 12 | require(cnt > 0 && cnt <= 20); 13 | 14 | balances[msg.sender] -=amount; 15 | 16 | return true; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/ether_send.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | 5 | contract Crowdfunding { 6 | 7 | mapping(address => uint) public balances; 8 | address public owner; 9 | uint256 INVEST_MIN = 1 ether; 10 | uint256 INVEST_MAX = 10 ether; 11 | 12 | modifier onlyOwner() { 13 | require(msg.sender == owner); 14 | _; 15 | } 16 | 17 | function crowdfunding() public { 18 | owner = msg.sender; 19 | } 20 | 21 | function withdrawfunds() public onlyOwner { 22 | msg.sender.transfer(address(this).balance); 23 | } 24 | 25 | function invest() public payable { 26 | require(msg.value > INVEST_MIN && msg.value < INVEST_MAX); 27 | 28 | balances[msg.sender] += msg.value; 29 | } 30 | 31 | function getBalance() public view returns (uint) { 32 | return balances[msg.sender]; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/exceptions.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract Exceptions { 5 | 6 | uint256[8] myarray; 7 | 8 | function assert1() public pure { 9 | uint256 i = 1; 10 | assert(i == 0); 11 | } 12 | 13 | function assert2() public pure { 14 | uint256 i = 1; 15 | assert(i > 0); 16 | } 17 | 18 | function assert3(uint256 input) public pure { 19 | if (input > 10) { 20 | assert(input != 23); 21 | } 22 | } 23 | 24 | function requireisfine(uint256 input) public pure { 25 | require(input != 23); 26 | } 27 | 28 | function divisionby0(uint256 input) public pure { 29 | uint256 i = 1/input; 30 | } 31 | 32 | function thisisfine(uint256 input) public pure { 33 | if (input > 0) { 34 | uint256 i = 1/input; 35 | } 36 | } 37 | 38 | function arrayaccess(uint256 index) public view { 39 | uint256 i = myarray[index]; 40 | } 41 | 42 | function thisisalsofind(uint256 index) public view { 43 | if (index < 8) { 44 | uint256 i = myarray[index]; 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/exceptions_0.8.0.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | 4 | contract Exceptions { 5 | 6 | uint val; 7 | 8 | function change_val() public { 9 | val = 1; 10 | } 11 | function assert1() public pure { 12 | uint256 i = 1; 13 | assert(i == 0); 14 | } 15 | 16 | function fail() public view { 17 | assert(val==2); 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/extcall.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.6.0; 2 | 3 | interface IERC20 { 4 | function transfer(address to, uint256 amount) external returns (bool); 5 | } 6 | 7 | contract A { 8 | constructor() public { 9 | /// nothing detected 10 | address(0).call(""); 11 | IERC20(address(0)).transfer(address(0), 0); 12 | assert(false); 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/flag_array.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract BasicLiquidation { 4 | bool[4096] _flags; 5 | constructor() payable 6 | { 7 | require(msg.value == 0.1 ether); 8 | _flags[1234] = true; 9 | } 10 | function extractMoney(uint256 idx) public payable 11 | { 12 | require(idx >= 0); 13 | require(idx < 4096); 14 | require(_flags[idx]); 15 | payable(msg.sender).transfer(address(this).balance); 16 | } 17 | } -------------------------------------------------------------------------------- /tests/testdata/input_contracts/hash_test.sol: -------------------------------------------------------------------------------- 1 | 2 | contract StorageTest { 3 | mapping(bytes32 => address) data; 4 | 5 | function confirmAndCheck(uint256 x) public{ 6 | data[keccak256(abi.encodePacked(x))] = msg.sender; 7 | } 8 | 9 | function destruct(bytes32 x) public{ 10 | require(data[x] == msg.sender); 11 | selfdestruct(data[x]); 12 | } 13 | 14 | } 15 | 16 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/integer_edge_case.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.19; 3 | contract B { 4 | function f(uint256 arg) public view returns(uint256) { 5 | uint256 res; 6 | unchecked{ 7 | res = 10_000_000_000 * arg; // undetected overflow 8 | } 9 | //assert(res > arg); // the assertion violation is correctly detected if added 10 | return res; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/kcalls.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract Kcalls { 5 | uint public n; 6 | address public sender; 7 | 8 | function callSetN(address _e, uint _n) public { 9 | _e.call(abi.encode(bytes4(keccak256("setN(uint256)")), _n)); 10 | } 11 | 12 | function callcodeSetN(address _e, uint _n) public view { 13 | _e.staticcall(abi.encode(bytes4(keccak256("setN(uint256)")), _n)); 14 | } 15 | 16 | function delegatecallSetN(address _e, uint _n) public { 17 | _e.delegatecall(abi.encode(bytes4(keccak256("setN(uint256)")), _n)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/large.sol: -------------------------------------------------------------------------------- 1 | contract B{ 2 | uint x=0; 3 | uint total=0; 4 | function incr() public returns(uint){ 5 | x += 1; 6 | } 7 | 8 | 9 | function foo() public returns(uint){ 10 | require(x==10); 11 | selfdestruct(msg.sender); 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/metacoin.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract MetaCoin { 5 | mapping (address => uint) public balances; 6 | constructor() public { 7 | balances[msg.sender] = 10000; 8 | } 9 | 10 | function sendToken(address receiver, uint amount) public returns(bool successful){ 11 | if (balances[msg.sender] < amount) return false; 12 | balances[msg.sender] -= amount; 13 | balances[receiver] += amount; 14 | return false; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/multi_contracts.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract Transfer1 { 5 | function transfer() public { 6 | msg.sender.transfer(1 ether); 7 | } 8 | 9 | } 10 | 11 | 12 | contract Transfer2 { 13 | function transfer() public { 14 | msg.sender.transfer(2 ether); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/nonascii.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract nonAscii { 5 | function renderNonAscii () public pure returns (string memory) { 6 | return "Хэллоу Ворлд"; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/old_origin.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.11; 2 | 3 | 4 | contract Origin { 5 | address public owner; 6 | 7 | 8 | /** 9 | * @dev The Ownable constructor sets the original `owner` of the contract to the sender 10 | * account. 11 | */ 12 | function Origin() { 13 | owner = msg.sender; 14 | } 15 | 16 | 17 | /** 18 | * @dev Throws if called by any account other than the owner. 19 | */ 20 | modifier onlyOwner() { 21 | require(tx.origin != owner); 22 | _; 23 | } 24 | 25 | 26 | /** 27 | * @dev Allows the current owner to transfer control of the contract to a newOwner. 28 | * @param newOwner The address to transfer ownership to. 29 | */ 30 | function transferOwnership(address newOwner) public onlyOwner { 31 | if (newOwner != address(0)) { 32 | owner = newOwner; 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/old_version.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.4.11; 2 | contract test { } 3 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/origin.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract Origin { 5 | address public owner; 6 | 7 | 8 | /** 9 | * @dev The Ownable constructor sets the original `owner` of the contract to the sender 10 | * account. 11 | */ 12 | constructor() public { 13 | owner = msg.sender; 14 | } 15 | 16 | 17 | /** 18 | * @dev Throws if called by any account other than the owner. 19 | */ 20 | modifier onlyOwner() { 21 | require(tx.origin != owner); 22 | _; 23 | } 24 | 25 | 26 | /** 27 | * @dev Allows the current owner to transfer control of the contract to a newOwner. 28 | * @param newOwner The address to transfer ownership to. 29 | */ 30 | function transferOwnership(address newOwner) public onlyOwner { 31 | if (newOwner != address(0)) { 32 | owner = newOwner; 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/overflow.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract Over { 5 | 6 | mapping(address => uint) balances; 7 | uint public totalSupply; 8 | 9 | constructor(uint _initialSupply) public { 10 | balances[msg.sender] = totalSupply = _initialSupply; 11 | } 12 | 13 | function sendeth(address _to, uint _value) public returns (bool) { 14 | require(balances[msg.sender] - _value >= 0); 15 | balances[msg.sender] -= _value; 16 | balances[_to] += _value; 17 | return true; 18 | } 19 | 20 | function balanceOf(address _owner) public view returns (uint balance) { 21 | return balances[_owner]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/requirements_violation_neg.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.25; 2 | 3 | contract Bar { 4 | Foo private f = new Foo(); 5 | function doubleBaz() public view returns (int256) { 6 | return 2 * f.baz(1); //Changes the external contract to not hit the overly strong requirement. 7 | } 8 | } 9 | 10 | contract Foo { 11 | function baz(int256 x) public pure returns (int256) { 12 | require(0 < x); //You can also fix the contract by changing the input to the uint type and removing the require 13 | return 42; 14 | } 15 | } -------------------------------------------------------------------------------- /tests/testdata/input_contracts/requirements_violation_pos.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.25; 2 | 3 | contract Bar { 4 | Foo private f = new Foo(); 5 | function doubleBaz() public view returns (int256) { 6 | return 2 * f.baz(0); 7 | } 8 | } 9 | 10 | contract Foo { 11 | function baz(int256 x) public pure returns (int256) { 12 | require(0 < x); 13 | return 42; 14 | } 15 | } -------------------------------------------------------------------------------- /tests/testdata/input_contracts/returnvalue.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract ReturnValue { 5 | 6 | address public callee = 0xE0f7e56E62b4267062172495D7506087205A4229; 7 | 8 | function callnotchecked() public { 9 | callee.call(""); 10 | } 11 | 12 | function callchecked() public { 13 | (bool success, bytes memory data) = callee.call(""); 14 | require(success); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/safe_funcs.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | 4 | contract Exceptions { 5 | 6 | uint val; 7 | 8 | function change_val() public { 9 | val = 1; 10 | } 11 | function assert1() public pure { 12 | uint256 i = 1; 13 | assert(i == 0); 14 | } 15 | 16 | function fail() public view { 17 | assert(val==2); 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/simple_theft.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract Fallback { 4 | 5 | function withdraw() public { payable(msg.sender).transfer(address(this).balance); } 6 | 7 | 8 | } 9 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/suicide.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract Suicide { 5 | 6 | function kill(address payable addr) public { 7 | selfdestruct(addr); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/symbolic_exec_bytecode.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract Test { 4 | uint256 immutable inputSize; 5 | 6 | constructor(uint256 _log2Size) { 7 | inputSize = (1 << _log2Size); 8 | } 9 | 10 | function getBytes(bytes calldata _input) public view returns (bytes32) { 11 | require( 12 | _input.length > 0 && _input.length <= inputSize, 13 | "input len: (0,inputSize]" 14 | ); 15 | 16 | return "123"; 17 | } 18 | 19 | function commencekilling() public { 20 | address payable receiver = payable(msg.sender); 21 | selfdestruct(receiver); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/theft.sol: -------------------------------------------------------------------------------- 1 | contract B{ 2 | uint x=0; 3 | uint total = 0; 4 | function incr() public returns(uint){ 5 | require(x==0); 6 | x += 1; 7 | } 8 | function incr2() public payable returns(uint){ 9 | require(x==1); 10 | x += 1; 11 | total += msg.value; 12 | } 13 | function continous_incr(uint val) public payable returns(uint){ 14 | require(x>=2); 15 | x += val; 16 | total += msg.value; 17 | } 18 | 19 | function foo() public returns(uint){ 20 | require(x==4); 21 | x += 1; 22 | msg.sender.transfer(total); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/transient.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.25; 2 | contract Generosity { 3 | mapping(address => bool) sentGifts; 4 | 5 | modifier nonreentrant { 6 | uint x; 7 | assembly { 8 | x := tload(0) 9 | } 10 | assert (x == 0); 11 | assembly { 12 | if tload(0) { revert(0, 0) } 13 | tstore(0, 1) 14 | } 15 | _; 16 | // Unlocks the guard, making the pattern composable. 17 | // After the function exits, it can be called again, even in the same transaction. 18 | assembly { 19 | x := tload(0) 20 | } 21 | // It should be same as before, i.e., 1 22 | assert (x == 1); 23 | 24 | assembly { 25 | tstore(0, 0) 26 | } 27 | assembly { 28 | x := tload(0) 29 | } 30 | // resets to 0 31 | assert (x == 0); 32 | } 33 | function claimGift() nonreentrant public { 34 | require(address(this).balance >= 1 ether); 35 | require(!sentGifts[msg.sender]); 36 | (bool success, ) = msg.sender.call{value: 1 ether}(""); 37 | require(success); 38 | 39 | // In a reentrant function, doing this last would open up the vulnerability 40 | sentGifts[msg.sender] = true; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/transient_bug.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.25; 2 | contract Generosity { 3 | mapping(address => bool) sentGifts; 4 | 5 | modifier nonreentrant { 6 | uint x; 7 | assembly { 8 | x := tload(0) 9 | } 10 | assert (x == 0); 11 | assembly { 12 | if tload(0) { revert(0, 0) } 13 | tstore(0, 1) 14 | } 15 | _; 16 | // Unlocks the guard, making the pattern composable. 17 | // After the function exits, it can be called again, even in the same transaction. 18 | assembly { 19 | x := tload(0) 20 | } 21 | assert (x != 1); 22 | 23 | assembly { 24 | tstore(0, 0) 25 | } 26 | assembly { 27 | x := tload(0) 28 | } 29 | assert (x == 0); 30 | } 31 | function claimGift() nonreentrant public { 32 | require(address(this).balance >= 1 ether); 33 | require(!sentGifts[msg.sender]); 34 | (bool success, ) = msg.sender.call{value: 1 ether}(""); 35 | require(success); 36 | 37 | // In a reentrant function, doing this last would open up the vulnerability 38 | sentGifts[msg.sender] = true; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/transient_bug_2.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.25; 2 | contract Generosity { 3 | mapping(address => bool) sentGifts; 4 | 5 | modifier nonreentrant { 6 | uint x; 7 | assembly { 8 | x := tload(0) 9 | } 10 | assert (x == 0); 11 | assembly { 12 | if tload(0) { revert(0, 0) } 13 | tstore(0, 1) 14 | } 15 | _; 16 | // Unlocks the guard, making the pattern composable. 17 | // After the function exits, it can be called again, even in the same transaction. 18 | assembly { 19 | x := tload(0) 20 | } 21 | assert (x == 1); 22 | 23 | assembly { 24 | tstore(0, 0) 25 | } 26 | assembly { 27 | x := tload(0) 28 | } 29 | assert (x == 1); 30 | } 31 | function claimGift() nonreentrant public { 32 | require(address(this).balance >= 1 ether); 33 | require(!sentGifts[msg.sender]); 34 | (bool success, ) = msg.sender.call{value: 1 ether}(""); 35 | require(success); 36 | 37 | // In a reentrant function, doing this last would open up the vulnerability 38 | sentGifts[msg.sender] = true; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/tx.sol: -------------------------------------------------------------------------------- 1 | 2 | pragma solidity ^0.4.16; 3 | 4 | contract EthTxOrderDependenceMinimal { 5 | address public owner; 6 | bool public claimed; 7 | uint public reward; 8 | 9 | function EthTxOrderDependenceMinimal() public { 10 | owner = msg.sender; 11 | } 12 | 13 | function setReward() public payable { 14 | require (!claimed); 15 | 16 | require(msg.sender == owner); 17 | owner.transfer(reward); 18 | reward = msg.value; 19 | } 20 | 21 | function claimReward(uint256 submission) { 22 | require (!claimed); 23 | require(submission < 10); 24 | 25 | msg.sender.transfer(reward); 26 | claimed = true; 27 | } 28 | } -------------------------------------------------------------------------------- /tests/testdata/input_contracts/underflow.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | 4 | contract Under { 5 | 6 | mapping(address => uint) balances; 7 | uint public totalSupply; 8 | 9 | constructor(uint _initialSupply) public { 10 | balances[msg.sender] = totalSupply = _initialSupply; 11 | } 12 | 13 | function sendeth(address _to, uint _value) public returns (bool) { 14 | require(balances[msg.sender] - _value >= 0); 15 | balances[msg.sender] -= _value; 16 | balances[_to] += _value; 17 | return true; 18 | } 19 | 20 | function balanceOf(address _owner) public view returns (uint balance) { 21 | return balances[_owner]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/unexpected_ether_neg.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | contract Lockdrop { 4 | 5 | function lock() 6 | external 7 | payable 8 | { 9 | uint256 eth = msg.value; 10 | address owner = msg.sender; 11 | assert(address(0x0).balance > msg.value); 12 | } 13 | 14 | 15 | 16 | } -------------------------------------------------------------------------------- /tests/testdata/input_contracts/unexpected_ether_pos.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | contract Lockdrop { 4 | 5 | function lock() 6 | external 7 | payable 8 | { 9 | uint256 eth = msg.value; 10 | address owner = msg.sender; 11 | assert(address(0x0).balance == msg.value); 12 | } 13 | 14 | 15 | 16 | } -------------------------------------------------------------------------------- /tests/testdata/input_contracts/version_2.sol: -------------------------------------------------------------------------------- 1 | 2 | // VERSION: pragma solidity ^0.7.0; 3 | 4 | contract Test { 5 | uint256 input; 6 | function add(uint256 a, uint256 b) public { 7 | input = a + b; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/version_3.sol: -------------------------------------------------------------------------------- 1 | 2 | /* ORIGINAL: pragma solidity ^0.7.0; */ 3 | 4 | contract Test { 5 | uint256 input; 6 | function add(uint256 a, uint256 b) public { 7 | input = a + b; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/version_4.sol: -------------------------------------------------------------------------------- 1 | 2 | // VERSION: pragma solidity ^0.7.0; 3 | /* ORIGINAL: pragma solidity ^0.7.0; */ 4 | pragma solidity ^0.8.0; 5 | 6 | contract Test { 7 | uint256 input; 8 | function add(uint256 a, uint256 b) public { 9 | input = a + b; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/version_chaos.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >= 0 . 5 . 0 < 0 . 6 . 0; 2 | 3 | contract Test { 4 | uint256 input; 5 | function add(uint256 a, uint256 b) public { 6 | input = a + b; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/version_contract.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | uint256 input; 3 | function add(uint256 a, uint256 b) public { 4 | input = a + b; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/version_contract_0.7.0.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.7.0; 2 | 3 | contract Test { 4 | uint256 input; 5 | function add(uint256 a, uint256 b) public { 6 | input = a + b; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/version_contract_0.8.0.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract Test { 4 | uint256 input; 5 | function add(uint256 a, uint256 b) public { 6 | input = a + b; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/testdata/input_contracts/version_patch.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8; // Patch version - X.y[.z] is missing 3 | 4 | contract EtherWallet { 5 | address payable public owner; 6 | 7 | constructor() { 8 | owner = payable(msg.sender); 9 | } 10 | 11 | receive() external payable {} 12 | 13 | function withdraw(uint256 _amount) external { 14 | require(msg.sender == owner, "caller is not owner"); 15 | payable(msg.sender).transfer(_amount); 16 | } 17 | 18 | function getBalance() external view returns (uint256) { 19 | return address(this).balance; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/testdata/inputs/environments.sol.o: -------------------------------------------------------------------------------- 1 | 60806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306661abd1461005157806383f12fec1461007c575b600080fd5b34801561005d57600080fd5b50610066610104565b6040518082815260200191505060405180910390f35b34801561008857600080fd5b506100ea600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019092919050505061010a565b604051808215151515815260200191505060405180910390f35b60005481565b6000806000845191508382029050600082118015610129575060148211155b151561013457600080fd5b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550600192505050929150505600a165627a7a7230582016b81221eb990028632ba9b34d3c01599d24acdb5b81dd6789845696f5db257c0029 -------------------------------------------------------------------------------- /tests/testdata/inputs/exceptions.sol.o: -------------------------------------------------------------------------------- 1 | 60606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301d4277c14610093578063546455b5146100b657806378375f14146100d957806392dd38ea146100fc578063a08299f11461011f578063b34c361014610142578063b630d70614610157578063f44f13d81461017a575b600080fd5b341561009e57600080fd5b6100b4600480803590602001909190505061018f565b005b34156100c157600080fd5b6100d760048080359060200190919050506101b2565b005b34156100e457600080fd5b6100fa60048080359060200190919050506101c2565b005b341561010757600080fd5b61011d60048080359060200190919050506101d5565b005b341561012a57600080fd5b61014060048080359060200190919050506101ed565b005b341561014d57600080fd5b610155610202565b005b341561016257600080fd5b6101786004808035906020019091905050610217565b005b341561018557600080fd5b61018d610235565b005b600060088210156101ae576000826008811015156101a957fe5b015490505b5050565b601781141515156101bf57fe5b50565b601781141515156101d257600080fd5b50565b600080826008811015156101e557fe5b015490505050565b60008160018115156101fb57fe5b0490505050565b60006001905060008114151561021457fe5b50565b6000808211156102315781600181151561022d57fe5b0490505b5050565b60006001905060008111151561024757fe5b505600a165627a7a72305820b9f98ad234dd4e1d09a659013e7ffd1ecad3628194c307decc294b637820bb550029 -------------------------------------------------------------------------------- /tests/testdata/inputs/exceptions_0.8.0.sol.o: -------------------------------------------------------------------------------- 1 | 608060405234801561001057600080fd5b5060f18061001f6000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c8063a02f5b99146041578063a9cc4718146049578063b34c3610146051575b600080fd5b60476059565b005b604f6063565b005b60576075565b005b6001600081905550565b6002600054146073576072608c565b5b565b600060019050600081146089576088608c565b5b50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fdfea2646970667358221220cdbce6751f5dd32798edbe8c5cefae09753627f94e3f6e4a1f33afdb28a32e5464736f6c63430008060033 2 | -------------------------------------------------------------------------------- /tests/testdata/inputs/extcall.sol.o: -------------------------------------------------------------------------------- 1 | 608060405234801561001057600080fd5b50600073ffffffffffffffffffffffffffffffffffffffff166040518060000190506000604051808303816000865af19150503d806000811461006f576040519150601f19603f3d011682016040523d82523d6000602084013e610074565b606091505b505050600073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000806040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561010057600080fd5b505af1158015610114573d6000803e3d6000fd5b505050506040513d602081101561012a57600080fd5b810190808051906020019092919050505050600061014457fe5b603f806101526000396000f3fe6080604052600080fdfea26469706673582212205bba7185aa846906fd4f2cc890c4095f521be787e49f5366712f751111e8d91764736f6c63430006000033 -------------------------------------------------------------------------------- /tests/testdata/inputs/flag_array.sol.o: -------------------------------------------------------------------------------- 1 | 608060405267016345785d8a0000341461001857600080fd5b600160006104d2611000811061003157610030610055565b5b602091828204019190066101000a81548160ff021916908315150217905550610084565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6101a6806100936000396000f3fe60806040526004361061001e5760003560e01c8063ab12585814610023575b600080fd5b61003d600480360381019061003891906100ee565b61003f565b005b600081101561004d57600080fd5b611000811061005b57600080fd5b60008161100081106100705761006f610125565b5b602091828204019190069054906101000a900460ff1661008f57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156100d5573d6000803e3d6000fd5b5050565b6000813590506100e881610159565b92915050565b60006020828403121561010457610103610154565b5b6000610112848285016100d9565b91505092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b6101628161011b565b811461016d57600080fd5b5056fea264697066735822122038d1a63a64c5408c7008a0f3746ab94e43a04b5bc74f52e4869d3f15cf5b2b9e64736f6c63430008060033 -------------------------------------------------------------------------------- /tests/testdata/inputs/metacoin.sol.o: -------------------------------------------------------------------------------- 1 | 60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806327e235e314610051578063412664ae1461009e575b600080fd5b341561005c57600080fd5b610088600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506100f8565b6040518082815260200191505060405180910390f35b34156100a957600080fd5b6100de600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610110565b604051808215151515815260200191505060405180910390f35b60006020528060005260406000206000915090505481565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561016157600090506101fe565b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600090505b929150505600a165627a7a72305820c860d60246e215343f02c5025aeef4ad1f207b0a7d2dec05e43f6ecaaebe9cec0029 -------------------------------------------------------------------------------- /tests/testdata/inputs/multi_contracts.sol.o: -------------------------------------------------------------------------------- 1 | 606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638a4068dd146044575b600080fd5b3415604e57600080fd5b60546056565b005b3373ffffffffffffffffffffffffffffffffffffffff166108fc671bc16d674ec800009081150290604051600060405180830381858888f193505050501515609d57600080fd5b5600a165627a7a7230582028cb917d4f69cc2ea0fcd75329aa874b2bc743cfcde6b5197f571cff635aec130029 -------------------------------------------------------------------------------- /tests/testdata/inputs/nonascii.sol.o: -------------------------------------------------------------------------------- 1 | 608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806324ff38a214610046575b600080fd5b34801561005257600080fd5b5061005b6100d6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561009b578082015181840152602081019050610080565b50505050905090810190601f1680156100c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60606040805190810160405280601781526020017fd0a5d18dd0bbd0bbd0bed18320d092d0bed180d0bbd0b40000000000000000008152509050905600a165627a7a72305820a11284868fc6a38ff1d72ce9ec40db9c6c7c49902b5cabec3680e88e5ab92dcb0029 -------------------------------------------------------------------------------- /tests/testdata/inputs/origin.sol.o: -------------------------------------------------------------------------------- 1 | 60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638da5cb5b14610051578063f2fde38b146100a6575b600080fd5b341561005c57600080fd5b6100646100df565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100b157600080fd5b6100dd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610104565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614151561015f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156101d657806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b505600a165627a7a7230582094f3b40753c82d05a159fa87a8b075fa6226d092f90191c0f813a12c032ffaac0029 -------------------------------------------------------------------------------- /tests/testdata/inputs/overflow.sol.o: -------------------------------------------------------------------------------- 1 | 608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806318160ddd1461005c57806370a0823114610087578063a3210e87146100ec575b600080fd5b34801561006857600080fd5b5061007161015f565b6040518082815260200191505060405180910390f35b34801561009357600080fd5b506100d6600480360360208110156100aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610165565b6040518082815260200191505060405180910390f35b3480156100f857600080fd5b506101456004803603604081101561010f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506101ad565b604051808215151515815260200191505060405180910390f35b60015481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205403101515156101fe57600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600190509291505056fea165627a7a72305820fd522172282e2304f6e94eb345fcb4a11ab5e1102b64333180676726d88159a00029 2 | -------------------------------------------------------------------------------- /tests/testdata/inputs/returnvalue.sol.o: -------------------------------------------------------------------------------- 1 | 60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063633ab5e014610051578063e3bea28214610066575b600080fd5b341561005c57600080fd5b61006461007b565b005b341561007157600080fd5b6100796100d4565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166040516000604051808303816000865af191505015156100d257600080fd5b565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166040516000604051808303816000865af1915050505600a165627a7a72305820ca8be054abc9437f3c7d25b22fda833fed76e2687a94e19ec61b094b7ae089d70029 -------------------------------------------------------------------------------- /tests/testdata/inputs/safe_funcs.sol.o: -------------------------------------------------------------------------------- 1 | 6080604052348015600f57600080fd5b5060043610603c5760003560e01c8063a02f5b99146041578063a9cc4718146049578063b34c3610146051575b600080fd5b60476059565b005b604f6063565b005b60576075565b005b6001600081905550565b6002600054146073576072608c565b5b565b600060019050600081146089576088608c565b5b50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fdfea2646970667358221220e4fd4d461febf90b9c09fc5f55e8dc77f373e513a4448395d2073e8c3f388ecf64736f6c63430008060033 2 | -------------------------------------------------------------------------------- /tests/testdata/inputs/suicide.sol.o: -------------------------------------------------------------------------------- 1 | 606060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063cbf0b0c0146044575b600080fd5b3415604e57600080fd5b6078600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050607a565b005b8073ffffffffffffffffffffffffffffffffffffffff16ff00a165627a7a723058207c36f2082aef9ddde7fe0dc12aca42e091159cac6d4e9cb1b97983ea4e005d940029 -------------------------------------------------------------------------------- /tests/testdata/inputs/underflow.sol.o: -------------------------------------------------------------------------------- 1 | 606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806318160ddd146100675780636241bfd11461009057806370a08231146100b3578063a3210e8714610100575b600080fd5b341561007257600080fd5b61007a61015a565b6040518082815260200191505060405180910390f35b341561009b57600080fd5b6100b16004808035906020019091905050610160565b005b34156100be57600080fd5b6100ea600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506101ab565b6040518082815260200191505060405180910390f35b341561010b57600080fd5b610140600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506101f3565b604051808215151515815260200191505060405180910390f35b60015481565b8060018190556000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054031015151561024457600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060019050929150505600a165627a7a72305820acf4c21d1fe3e6f27af08897642fb3b8cc64265635081cf3ae7fe1f06b4af6490029 -------------------------------------------------------------------------------- /tests/testdata/json_test_dir/PRC20.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.0; 2 | 3 | contract PRC20{ 4 | function nothing1(uint256 a, uint256 b) public pure returns(uint256) { 5 | return a+b; 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /tests/testdata/json_test_dir/dir_a/input_file.sol: -------------------------------------------------------------------------------- 1 | import "@openzeppelin/contracts/token/PRC20/PRC20.sol"; 2 | 3 | contract Nothing is PRC20{ 4 | string x_0 = ""; 5 | 6 | bytes3 x_1 = "A"; 7 | 8 | bytes5 x_2 = "E"; 9 | 10 | bytes5 x_3 = ""; 11 | 12 | bytes3 x_4 = "I"; 13 | 14 | bytes3 x_5 = "U"; 15 | 16 | bytes3 x_6 = "O"; 17 | 18 | bytes3 x_7 = "0"; 19 | 20 | bytes3 x_8 = "U"; 21 | 22 | bytes3 x_9 = "U"; 23 | function stringCompare(string memory a, string memory b) internal pure returns (bool) { 24 | if(bytes(a).length != bytes(b).length) { 25 | return false; 26 | } else { 27 | return keccak256(bytes(a)) == keccak256(bytes(b)); 28 | } 29 | } 30 | 31 | function nothing(string memory g_0, bytes3 g_1, bytes5 g_2, bytes5 g_3, bytes3 g_4, bytes3 g_5, bytes3 g_6, bytes3 g_7, bytes3 g_8, bytes3 g_9, bytes3 g_10, bytes3 g_11) public view returns (bool){ 32 | if (!stringCompare(g_0, x_0)) return false; 33 | 34 | if (g_1 != x_1) return false; 35 | 36 | if (g_2 != x_2) return false; 37 | 38 | if (g_3 != x_3) return false; 39 | 40 | if (g_4 != x_4) return false; 41 | 42 | if (g_5 != x_5) return false; 43 | 44 | if (g_6 != x_6) return false; 45 | 46 | if (g_7 != x_7) return false; 47 | 48 | if (g_8 != x_8) return false; 49 | 50 | if (g_9 != x_9) return false; 51 | 52 | if (g_10 != x_9) return false; 53 | 54 | if (g_11 != x_9) return false; 55 | 56 | return true; 57 | 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /tests/testdata/json_test_dir/dir_a/input_file_args.sol: -------------------------------------------------------------------------------- 1 | import "../PRC20.sol"; 2 | 3 | contract Nothing is PRC20{ 4 | 5 | 6 | 7 | function nothing(string memory g_0, bytes3 g_11) public view returns (bool){ 8 | 9 | return true; 10 | 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /tests/testdata/json_test_dir/test_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "remappings": [ "@openzeppelin/contracts/token/PRC20/=../" ], 3 | "optimizer": { 4 | "enabled": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/testdata/json_test_dir/test_file_disable.json: -------------------------------------------------------------------------------- 1 | { 2 | "remappings": [ "@openzeppelin/contracts/token/PRC20/=../" ] 3 | } 4 | -------------------------------------------------------------------------------- /tests/testdata/mythril_config_inputs/config.ini: -------------------------------------------------------------------------------- 1 | [defaults] 2 | dynamic_loading = infura 3 | -------------------------------------------------------------------------------- /tests/testdata/outputs_expected/multi_contracts.sol.o.easm: -------------------------------------------------------------------------------- 1 | 0 PUSH1 0x60 2 | 2 PUSH1 0x40 3 | 4 MSTORE 4 | 5 PUSH1 0x04 5 | 7 CALLDATASIZE 6 | 8 LT 7 | 9 PUSH1 0x3f 8 | 11 JUMPI 9 | 12 PUSH1 0x00 10 | 14 CALLDATALOAD 11 | 15 PUSH29 0x0100000000000000000000000000000000000000000000000000000000 12 | 45 SWAP1 13 | 46 DIV 14 | 47 PUSH4 0xffffffff 15 | 52 AND 16 | 53 DUP1 17 | 54 PUSH4 0x8a4068dd 18 | 59 EQ 19 | 60 PUSH1 0x44 20 | 62 JUMPI 21 | 63 JUMPDEST 22 | 64 PUSH1 0x00 23 | 66 DUP1 24 | 67 REVERT 25 | 68 JUMPDEST 26 | 69 CALLVALUE 27 | 70 ISZERO 28 | 71 PUSH1 0x4e 29 | 73 JUMPI 30 | 74 PUSH1 0x00 31 | 76 DUP1 32 | 77 REVERT 33 | 78 JUMPDEST 34 | 79 PUSH1 0x54 35 | 81 PUSH1 0x56 36 | 83 JUMP 37 | 84 JUMPDEST 38 | 85 STOP 39 | 86 JUMPDEST 40 | 87 CALLER 41 | 88 PUSH20 0xffffffffffffffffffffffffffffffffffffffff 42 | 109 AND 43 | 110 PUSH2 0x08fc 44 | 113 PUSH8 0x1bc16d674ec80000 45 | 122 SWAP1 46 | 123 DUP2 47 | 124 ISZERO 48 | 125 MUL 49 | 126 SWAP1 50 | 127 PUSH1 0x40 51 | 129 MLOAD 52 | 130 PUSH1 0x00 53 | 132 PUSH1 0x40 54 | 134 MLOAD 55 | 135 DUP1 56 | 136 DUP4 57 | 137 SUB 58 | 138 DUP2 59 | 139 DUP6 60 | 140 DUP9 61 | 141 DUP9 62 | 142 CALL 63 | 143 SWAP4 64 | 144 POP 65 | 145 POP 66 | 146 POP 67 | 147 POP 68 | 148 ISZERO 69 | 149 ISZERO 70 | 150 PUSH1 0x9d 71 | 152 JUMPI 72 | 153 PUSH1 0x00 73 | 155 DUP1 74 | 156 REVERT 75 | 157 JUMPDEST 76 | 158 JUMP 77 | 159 STOP 78 | -------------------------------------------------------------------------------- /tests/testdata/outputs_expected/suicide.sol.o.easm: -------------------------------------------------------------------------------- 1 | 0 PUSH1 0x60 2 | 2 PUSH1 0x40 3 | 4 MSTORE 4 | 5 PUSH1 0x04 5 | 7 CALLDATASIZE 6 | 8 LT 7 | 9 PUSH1 0x3f 8 | 11 JUMPI 9 | 12 PUSH1 0x00 10 | 14 CALLDATALOAD 11 | 15 PUSH29 0x0100000000000000000000000000000000000000000000000000000000 12 | 45 SWAP1 13 | 46 DIV 14 | 47 PUSH4 0xffffffff 15 | 52 AND 16 | 53 DUP1 17 | 54 PUSH4 0xcbf0b0c0 18 | 59 EQ 19 | 60 PUSH1 0x44 20 | 62 JUMPI 21 | 63 JUMPDEST 22 | 64 PUSH1 0x00 23 | 66 DUP1 24 | 67 REVERT 25 | 68 JUMPDEST 26 | 69 CALLVALUE 27 | 70 ISZERO 28 | 71 PUSH1 0x4e 29 | 73 JUMPI 30 | 74 PUSH1 0x00 31 | 76 DUP1 32 | 77 REVERT 33 | 78 JUMPDEST 34 | 79 PUSH1 0x78 35 | 81 PUSH1 0x04 36 | 83 DUP1 37 | 84 DUP1 38 | 85 CALLDATALOAD 39 | 86 PUSH20 0xffffffffffffffffffffffffffffffffffffffff 40 | 107 AND 41 | 108 SWAP1 42 | 109 PUSH1 0x20 43 | 111 ADD 44 | 112 SWAP1 45 | 113 SWAP2 46 | 114 SWAP1 47 | 115 POP 48 | 116 POP 49 | 117 PUSH1 0x7a 50 | 119 JUMP 51 | 120 JUMPDEST 52 | 121 STOP 53 | 122 JUMPDEST 54 | 123 DUP1 55 | 124 PUSH20 0xffffffffffffffffffffffffffffffffffffffff 56 | 145 AND 57 | 146 SUICIDE 58 | 147 STOP 59 | -------------------------------------------------------------------------------- /tests/teststorage/contractstorage.fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/tests/teststorage/contractstorage.fs -------------------------------------------------------------------------------- /tests/teststorage/contractstorage.fs.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/tests/teststorage/contractstorage.fs.index -------------------------------------------------------------------------------- /tests/teststorage/contractstorage.fs.tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ConsenSysDiligence/mythril/125914a6eae81a79a089696e1f47ac8cc4b3a180/tests/teststorage/contractstorage.fs.tmp --------------------------------------------------------------------------------