mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
C++ namespace cleanup (except tests).
This commit is contained in:
committed by
Daniel Kirchner
parent
8385256bdc
commit
6b23412fae
@@ -27,7 +27,7 @@ dev::bytes SolidityCompilationFramework::compileContract(
|
||||
);
|
||||
std::cerr << "Compiling contract failed" << std::endl;
|
||||
}
|
||||
dev::eth::LinkerObject obj = m_compiler.object(
|
||||
evmasm::LinkerObject obj = m_compiler.object(
|
||||
_contractName.empty() ?
|
||||
m_compiler.lastContractName() :
|
||||
_contractName
|
||||
|
||||
@@ -124,7 +124,7 @@ DEFINE_PROTO_FUZZER(Contract const& _input)
|
||||
hexEncodedInput = methodIdentifiers["test()"].asString();
|
||||
}
|
||||
// Ignore stack too deep errors during compilation
|
||||
catch (eth::StackTooDeepException const&)
|
||||
catch (evmasm::StackTooDeepException const&)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -77,12 +77,12 @@ void copyZeroExtended(
|
||||
using u512 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<512, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>;
|
||||
|
||||
u256 EVMInstructionInterpreter::eval(
|
||||
dev::eth::Instruction _instruction,
|
||||
evmasm::Instruction _instruction,
|
||||
vector<u256> const& _arguments
|
||||
)
|
||||
{
|
||||
using namespace dev::eth;
|
||||
using dev::eth::Instruction;
|
||||
using evmasm::Instruction;
|
||||
|
||||
auto info = instructionInfo(_instruction);
|
||||
yulAssert(size_t(info.args) == _arguments.size(), "");
|
||||
@@ -484,9 +484,9 @@ void EVMInstructionInterpreter::writeMemoryWord(u256 const& _offset, u256 const&
|
||||
}
|
||||
|
||||
|
||||
void EVMInstructionInterpreter::logTrace(dev::eth::Instruction _instruction, std::vector<u256> const& _arguments, bytes const& _data)
|
||||
void EVMInstructionInterpreter::logTrace(evmasm::Instruction _instruction, std::vector<u256> const& _arguments, bytes const& _data)
|
||||
{
|
||||
logTrace(dev::eth::instructionInfo(_instruction).name, _arguments, _data);
|
||||
logTrace(evmasm::instructionInfo(_instruction).name, _arguments, _data);
|
||||
}
|
||||
|
||||
void EVMInstructionInterpreter::logTrace(std::string const& _pseudoInstruction, std::vector<u256> const& _arguments, bytes const& _data)
|
||||
|
||||
@@ -26,13 +26,10 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace eth
|
||||
namespace solidity::evmasm
|
||||
{
|
||||
enum class Instruction: uint8_t;
|
||||
}
|
||||
}
|
||||
|
||||
namespace yul
|
||||
{
|
||||
@@ -70,7 +67,7 @@ public:
|
||||
m_state(_state)
|
||||
{}
|
||||
/// Evaluate instruction
|
||||
dev::u256 eval(dev::eth::Instruction _instruction, std::vector<dev::u256> const& _arguments);
|
||||
dev::u256 eval(evmasm::Instruction _instruction, std::vector<dev::u256> const& _arguments);
|
||||
/// Evaluate builtin function
|
||||
dev::u256 evalBuiltin(BuiltinFunctionForEVM const& _fun, std::vector<dev::u256> const& _arguments);
|
||||
|
||||
@@ -89,7 +86,7 @@ private:
|
||||
/// Does not adjust msize, use @a accessMemory for that
|
||||
void writeMemoryWord(dev::u256 const& _offset, dev::u256 const& _value);
|
||||
|
||||
void logTrace(dev::eth::Instruction _instruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});
|
||||
void logTrace(evmasm::Instruction _instruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});
|
||||
/// Appends a log to the trace representing an instruction or similar operation by string,
|
||||
/// with arguments and auxiliary data (if nonempty).
|
||||
void logTrace(std::string const& _pseudoInstruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});
|
||||
|
||||
@@ -95,7 +95,7 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _a
|
||||
return {};
|
||||
else if (_fun == "unreachable"_yulstring)
|
||||
{
|
||||
logTrace(eth::Instruction::INVALID, {});
|
||||
logTrace(evmasm::Instruction::INVALID, {});
|
||||
throw ExplicitlyTerminated();
|
||||
}
|
||||
else if (_fun == "i64.add"_yulstring)
|
||||
@@ -188,7 +188,7 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _a
|
||||
{
|
||||
// TODO read args from memory
|
||||
// TODO use readAddress to read address.
|
||||
logTrace(eth::Instruction::CALL, {});
|
||||
logTrace(evmasm::Instruction::CALL, {});
|
||||
return arg[0] & 1;
|
||||
}
|
||||
else if (_fun == "eth.callDataCopy"_yulstring)
|
||||
@@ -208,21 +208,21 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _a
|
||||
{
|
||||
// TODO read args from memory
|
||||
// TODO use readAddress to read address.
|
||||
logTrace(eth::Instruction::CALLCODE, {});
|
||||
logTrace(evmasm::Instruction::CALLCODE, {});
|
||||
return arg[0] & 1;
|
||||
}
|
||||
else if (_fun == "eth.callDelegate"_yulstring)
|
||||
{
|
||||
// TODO read args from memory
|
||||
// TODO use readAddress to read address.
|
||||
logTrace(eth::Instruction::DELEGATECALL, {});
|
||||
logTrace(evmasm::Instruction::DELEGATECALL, {});
|
||||
return arg[0] & 1;
|
||||
}
|
||||
else if (_fun == "eth.callStatic"_yulstring)
|
||||
{
|
||||
// TODO read args from memory
|
||||
// TODO use readAddress to read address.
|
||||
logTrace(eth::Instruction::STATICCALL, {});
|
||||
logTrace(evmasm::Instruction::STATICCALL, {});
|
||||
return arg[0] & 1;
|
||||
}
|
||||
else if (_fun == "eth.storageStore"_yulstring)
|
||||
@@ -266,7 +266,7 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _a
|
||||
{
|
||||
// TODO access memory
|
||||
// TODO use writeAddress to store resulting address
|
||||
logTrace(eth::Instruction::CREATE, {});
|
||||
logTrace(evmasm::Instruction::CREATE, {});
|
||||
return 0xcccccc + arg[1];
|
||||
}
|
||||
else if (_fun == "eth.getBlockDifficulty"_yulstring)
|
||||
@@ -302,7 +302,7 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _a
|
||||
uint64_t numberOfTopics = arg[2];
|
||||
if (numberOfTopics > 4)
|
||||
throw ExplicitlyTerminated();
|
||||
logTrace(eth::logInstruction(numberOfTopics), {});
|
||||
logTrace(evmasm::logInstruction(numberOfTopics), {});
|
||||
return 0;
|
||||
}
|
||||
else if (_fun == "eth.getBlockNumber"_yulstring)
|
||||
@@ -317,7 +317,7 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _a
|
||||
bytes data;
|
||||
if (accessMemory(arg[0], arg[1]))
|
||||
data = readMemory(arg[0], arg[1]);
|
||||
logTrace(eth::Instruction::RETURN, {}, data);
|
||||
logTrace(evmasm::Instruction::RETURN, {}, data);
|
||||
throw ExplicitlyTerminated();
|
||||
}
|
||||
else if (_fun == "eth.revert"_yulstring)
|
||||
@@ -325,7 +325,7 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _a
|
||||
bytes data;
|
||||
if (accessMemory(arg[0], arg[1]))
|
||||
data = readMemory(arg[0], arg[1]);
|
||||
logTrace(eth::Instruction::REVERT, {}, data);
|
||||
logTrace(evmasm::Instruction::REVERT, {}, data);
|
||||
throw ExplicitlyTerminated();
|
||||
}
|
||||
else if (_fun == "eth.getReturnDataSize"_yulstring)
|
||||
@@ -344,7 +344,7 @@ u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _a
|
||||
else if (_fun == "eth.selfDestruct"_yulstring)
|
||||
{
|
||||
// TODO use readAddress to read address.
|
||||
logTrace(eth::Instruction::SELFDESTRUCT, {});
|
||||
logTrace(evmasm::Instruction::SELFDESTRUCT, {});
|
||||
throw ExplicitlyTerminated();
|
||||
}
|
||||
else if (_fun == "eth.getBlockTimestamp"_yulstring)
|
||||
@@ -417,9 +417,9 @@ u256 EwasmBuiltinInterpreter::readU256(uint64_t _offset, size_t _croppedTo)
|
||||
return value;
|
||||
}
|
||||
|
||||
void EwasmBuiltinInterpreter::logTrace(dev::eth::Instruction _instruction, std::vector<u256> const& _arguments, bytes const& _data)
|
||||
void EwasmBuiltinInterpreter::logTrace(evmasm::Instruction _instruction, std::vector<u256> const& _arguments, bytes const& _data)
|
||||
{
|
||||
logTrace(dev::eth::instructionInfo(_instruction).name, _arguments, _data);
|
||||
logTrace(evmasm::instructionInfo(_instruction).name, _arguments, _data);
|
||||
}
|
||||
|
||||
void EwasmBuiltinInterpreter::logTrace(std::string const& _pseudoInstruction, std::vector<u256> const& _arguments, bytes const& _data)
|
||||
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
dev::u256 readU128(uint64_t _offset) { return readU256(_offset, 16); }
|
||||
dev::u256 readAddress(uint64_t _offset) { return readU256(_offset, 20); }
|
||||
|
||||
void logTrace(dev::eth::Instruction _instruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});
|
||||
void logTrace(evmasm::Instruction _instruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});
|
||||
/// Appends a log to the trace representing an instruction or similar operation by string,
|
||||
/// with arguments and auxiliary data (if nonempty).
|
||||
void logTrace(std::string const& _pseudoInstruction, std::vector<dev::u256> const& _arguments = {}, dev::bytes const& _data = {});
|
||||
|
||||
Reference in New Issue
Block a user