/src/solidity/test/tools/ossfuzz/YulEvmoneInterface.h
Line | Count | Source |
1 | | /* |
2 | | This file is part of solidity. |
3 | | |
4 | | solidity is free software: you can redistribute it and/or modify |
5 | | it under the terms of the GNU General Public License as published by |
6 | | the Free Software Foundation, either version 3 of the License, or |
7 | | (at your option) any later version. |
8 | | |
9 | | solidity is distributed in the hope that it will be useful, |
10 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | | GNU General Public License for more details. |
13 | | |
14 | | You should have received a copy of the GNU General Public License |
15 | | along with solidity. If not, see <http://www.gnu.org/licenses/>. |
16 | | */ |
17 | | |
18 | | #pragma once |
19 | | |
20 | | #include <test/EVMHost.h> |
21 | | |
22 | | #include <libyul/YulStack.h> |
23 | | |
24 | | #include <libsolidity/interface/OptimiserSettings.h> |
25 | | |
26 | | #include <liblangutil/DebugInfoSelection.h> |
27 | | |
28 | | namespace solidity::test::fuzzer |
29 | | { |
30 | | class YulAssembler |
31 | | { |
32 | | public: |
33 | | YulAssembler( |
34 | | langutil::EVMVersion _evmVersion, |
35 | | solidity::frontend::OptimiserSettings _optSettings, |
36 | | std::string const& _yulSource |
37 | | ): |
38 | 25.7k | m_stack( |
39 | 25.7k | _evmVersion, |
40 | 25.7k | _optSettings, |
41 | 25.7k | langutil::DebugInfoSelection::All() |
42 | 25.7k | ), |
43 | 25.7k | m_yulProgram(_yulSource), |
44 | 25.7k | m_optimiseYul(_optSettings.runYulOptimiser) |
45 | 25.7k | {} |
46 | | solidity::bytes assemble(); |
47 | | std::shared_ptr<yul::Object> object(); |
48 | | private: |
49 | | solidity::yul::YulStack m_stack; |
50 | | std::string m_yulProgram; |
51 | | bool m_optimiseYul; |
52 | | }; |
53 | | |
54 | | struct YulEvmoneUtility |
55 | | { |
56 | | /// @returns the result of deploying bytecode @param _input on @param _host. |
57 | | static evmc::Result deployCode(solidity::bytes const& _input, EVMHost& _host); |
58 | | /// @returns call message to be sent to @param _address. |
59 | | static evmc_message callMessage(evmc_address _address); |
60 | | /// @returns true if call result indicates a serious error, false otherwise. |
61 | | static bool seriousCallError(evmc_status_code _code); |
62 | | }; |
63 | | } |