aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-04-07 02:55:46 +0800
committerchriseth <c@ethdev.com>2016-04-07 02:56:00 +0800
commitf227050c203fd0da70fcefbbecc922fd16045aa6 (patch)
tree40ad7d2e00f051368349bdfc017a0d4b455d8313
parent193b1c940ce3e21d52e2cbdd253c1d7cb820fa06 (diff)
downloaddexon-solidity-f227050c203fd0da70fcefbbecc922fd16045aa6.tar
dexon-solidity-f227050c203fd0da70fcefbbecc922fd16045aa6.tar.gz
dexon-solidity-f227050c203fd0da70fcefbbecc922fd16045aa6.tar.bz2
dexon-solidity-f227050c203fd0da70fcefbbecc922fd16045aa6.tar.lz
dexon-solidity-f227050c203fd0da70fcefbbecc922fd16045aa6.tar.xz
dexon-solidity-f227050c203fd0da70fcefbbecc922fd16045aa6.tar.zst
dexon-solidity-f227050c203fd0da70fcefbbecc922fd16045aa6.zip
Make solidity independent from ethcore.
-rw-r--r--libevmasm/CMakeLists.txt2
-rw-r--r--libevmasm/ConstantOptimiser.cpp19
-rw-r--r--libevmasm/ConstantOptimiser.h8
-rw-r--r--libevmasm/GasMeter.cpp53
-rw-r--r--libevmasm/GasMeter.h48
-rw-r--r--libevmasm/Version.cpp38
-rw-r--r--libevmasm/Version.h36
-rw-r--r--libsolidity/CMakeLists.txt2
-rw-r--r--libsolidity/codegen/Compiler.cpp5
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp11
-rw-r--r--libsolidity/interface/Version.cpp4
-rw-r--r--lllc/main.cpp4
-rw-r--r--solc/CommandLineInterface.cpp6
-rw-r--r--solc/jsonCompiler.cpp4
-rw-r--r--test/CMakeLists.txt2
15 files changed, 98 insertions, 144 deletions
diff --git a/libevmasm/CMakeLists.txt b/libevmasm/CMakeLists.txt
index c753fbe3..8a283976 100644
--- a/libevmasm/CMakeLists.txt
+++ b/libevmasm/CMakeLists.txt
@@ -8,7 +8,7 @@ file(GLOB HEADERS "*.h")
include_directories(BEFORE ..)
add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
-eth_use(${EXECUTABLE} REQUIRED Dev::devcore Eth::ethcore)
+eth_use(${EXECUTABLE} REQUIRED Dev::devcore)
install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} )
diff --git a/libevmasm/ConstantOptimiser.cpp b/libevmasm/ConstantOptimiser.cpp
index 766371b0..27f630f5 100644
--- a/libevmasm/ConstantOptimiser.cpp
+++ b/libevmasm/ConstantOptimiser.cpp
@@ -69,13 +69,12 @@ unsigned ConstantOptimisationMethod::optimiseConstants(
bigint ConstantOptimisationMethod::simpleRunGas(AssemblyItems const& _items)
{
- EVMSchedule schedule; // TODO: make relevant to context.
bigint gas = 0;
for (AssemblyItem const& item: _items)
if (item.type() == Push)
- gas += GasMeter::runGas(Instruction::PUSH1, schedule);
+ gas += GasMeter::runGas(Instruction::PUSH1);
else if (item.type() == Operation)
- gas += GasMeter::runGas(item.instruction(), schedule);
+ gas += GasMeter::runGas(item.instruction());
return gas;
}
@@ -85,11 +84,11 @@ bigint ConstantOptimisationMethod::dataGas(bytes const& _data) const
{
bigint gas;
for (auto b: _data)
- gas += b ? m_schedule.txDataNonZeroGas : m_schedule.txDataZeroGas;
+ gas += b ? GasCosts::txDataNonZeroGas : GasCosts::txDataZeroGas;
return gas;
}
else
- return m_schedule.createDataGas * dataSize();
+ return GasCosts::createDataGas * dataSize();
}
size_t ConstantOptimisationMethod::bytesRequired(AssemblyItems const& _items)
@@ -121,7 +120,7 @@ bigint LiteralMethod::gasNeeded()
return combineGas(
simpleRunGas({Instruction::PUSH1}),
// PUSHX plus data
- (m_params.isCreation ? m_schedule.txDataNonZeroGas : m_schedule.createDataGas) + dataGas(),
+ (m_params.isCreation ? GasCosts::txDataNonZeroGas : GasCosts::createDataGas) + dataGas(),
0
);
}
@@ -148,9 +147,9 @@ bigint CodeCopyMethod::gasNeeded()
{
return combineGas(
// Run gas: we ignore memory increase costs
- simpleRunGas(m_copyRoutine) + m_schedule.copyGas,
+ simpleRunGas(m_copyRoutine) + GasCosts::copyGas,
// Data gas for copy routines: Some bytes are zero, but we ignore them.
- bytesRequired(m_copyRoutine) * (m_params.isCreation ? m_schedule.txDataNonZeroGas : m_schedule.createDataGas),
+ bytesRequired(m_copyRoutine) * (m_params.isCreation ? GasCosts::txDataNonZeroGas : GasCosts::createDataGas),
// Data gas for data itself
dataGas(toBigEndian(m_value))
);
@@ -217,9 +216,9 @@ bigint ComputeMethod::gasNeeded(AssemblyItems const& _routine)
{
size_t numExps = count(_routine.begin(), _routine.end(), Instruction::EXP);
return combineGas(
- simpleRunGas(_routine) + numExps * (m_schedule.expGas + m_schedule.expByteGas),
+ simpleRunGas(_routine) + numExps * (GasCosts::expGas + GasCosts::expByteGas),
// Data gas for routine: Some bytes are zero, but we ignore them.
- bytesRequired(_routine) * (m_params.isCreation ? m_schedule.txDataNonZeroGas : m_schedule.createDataGas),
+ bytesRequired(_routine) * (m_params.isCreation ? GasCosts::txDataNonZeroGas : GasCosts::createDataGas),
0
);
}
diff --git a/libevmasm/ConstantOptimiser.h b/libevmasm/ConstantOptimiser.h
index 64cb66bb..e75eff38 100644
--- a/libevmasm/ConstantOptimiser.h
+++ b/libevmasm/ConstantOptimiser.h
@@ -24,7 +24,6 @@
#include <vector>
#include <libdevcore/CommonData.h>
#include <libdevcore/CommonIO.h>
-#include <libethcore/ChainOperationParams.h>
namespace dev
{
@@ -35,8 +34,6 @@ class AssemblyItem;
using AssemblyItems = std::vector<AssemblyItem>;
class Assembly;
-// TODO: FIXME: HOMESTEAD: XXX: @chfast populate m_schedule from an ExtVMFace instance via ExtVMFace::evmSchedule.
-
/**
* Abstract base class for one way to change how constants are represented in the code.
*/
@@ -91,7 +88,6 @@ protected:
Params m_params;
u256 const& m_value;
- EVMSchedule m_schedule;
};
/**
@@ -105,8 +101,6 @@ public:
ConstantOptimisationMethod(_params, _value) {}
virtual bigint gasNeeded() override;
virtual void execute(Assembly&, AssemblyItems&) override {}
-
- EVMSchedule m_schedule;
};
/**
@@ -121,7 +115,6 @@ public:
protected:
AssemblyItems m_copyRoutine;
- EVMSchedule m_schedule;
};
/**
@@ -148,7 +141,6 @@ protected:
bigint gasNeeded(AssemblyItems const& _routine);
AssemblyItems m_routine;
- EVMSchedule m_schedule;
};
}
diff --git a/libevmasm/GasMeter.cpp b/libevmasm/GasMeter.cpp
index 40a67bb1..51f3cf1d 100644
--- a/libevmasm/GasMeter.cpp
+++ b/libevmasm/GasMeter.cpp
@@ -71,13 +71,13 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item)
m_state->storageContent().count(slot) &&
classes.knownNonZero(m_state->storageContent().at(slot))
))
- gas += m_schedule.sstoreResetGas; //@todo take refunds into account
+ gas += GasCosts::sstoreResetGas; //@todo take refunds into account
else
- gas += m_schedule.sstoreSetGas;
+ gas += GasCosts::sstoreSetGas;
break;
}
case Instruction::SLOAD:
- gas += m_schedule.sloadGas;
+ gas += GasCosts::sloadGas;
break;
case Instruction::RETURN:
gas += memoryGas(0, -1);
@@ -96,18 +96,18 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item)
}));
break;
case Instruction::SHA3:
- gas = m_schedule.sha3Gas;
- gas += wordGas(m_schedule.sha3WordGas, m_state->relativeStackElement(-1));
+ gas = GasCosts::sha3Gas;
+ gas += wordGas(GasCosts::sha3WordGas, m_state->relativeStackElement(-1));
gas += memoryGas(0, -1);
break;
case Instruction::CALLDATACOPY:
case Instruction::CODECOPY:
gas += memoryGas(0, -2);
- gas += wordGas(m_schedule.copyGas, m_state->relativeStackElement(-2));
+ gas += wordGas(GasCosts::copyGas, m_state->relativeStackElement(-2));
break;
case Instruction::EXTCODECOPY:
gas += memoryGas(-1, -3);
- gas += wordGas(m_schedule.copyGas, m_state->relativeStackElement(-3));
+ gas += wordGas(GasCosts::copyGas, m_state->relativeStackElement(-3));
break;
case Instruction::LOG0:
case Instruction::LOG1:
@@ -116,10 +116,10 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item)
case Instruction::LOG4:
{
unsigned n = unsigned(_item.instruction()) - unsigned(Instruction::LOG0);
- gas = m_schedule.logGas + m_schedule.logTopicGas * n;
+ gas = GasCosts::logGas + GasCosts::logTopicGas * n;
gas += memoryGas(0, -1);
if (u256 const* value = classes.knownConstant(m_state->relativeStackElement(-1)))
- gas += m_schedule.logDataGas * (*value);
+ gas += GasCosts::logDataGas * (*value);
else
gas = GasConsumption::infinite();
break;
@@ -128,30 +128,30 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item)
case Instruction::CALLCODE:
case Instruction::DELEGATECALL:
{
- gas = m_schedule.callGas;
+ gas = GasCosts::callGas;
if (u256 const* value = classes.knownConstant(m_state->relativeStackElement(0)))
gas += (*value);
else
gas = GasConsumption::infinite();
if (_item.instruction() == Instruction::CALL)
- gas += m_schedule.callNewAccountGas; // We very rarely know whether the address exists.
+ gas += GasCosts::callNewAccountGas; // We very rarely know whether the address exists.
int valueSize = _item.instruction() == Instruction::DELEGATECALL ? 0 : 1;
if (!classes.knownZero(m_state->relativeStackElement(-1 - valueSize)))
- gas += m_schedule.callValueTransferGas;
+ gas += GasCosts::callValueTransferGas;
gas += memoryGas(-2 - valueSize, -3 - valueSize);
gas += memoryGas(-4 - valueSize, -5 - valueSize);
break;
}
case Instruction::CREATE:
- gas = m_schedule.createGas;
+ gas = GasCosts::createGas;
gas += memoryGas(-1, -2);
break;
case Instruction::EXP:
- gas = m_schedule.expGas;
+ gas = GasCosts::expGas;
if (u256 const* value = classes.knownConstant(m_state->relativeStackElement(-1)))
- gas += m_schedule.expByteGas * (32 - (h256(*value).firstBitSet() / 8));
+ gas += GasCosts::expByteGas * (32 - (h256(*value).firstBitSet() / 8));
else
- gas += m_schedule.expByteGas * 32;
+ gas += GasCosts::expByteGas * 32;
break;
default:
break;
@@ -187,7 +187,7 @@ GasMeter::GasConsumption GasMeter::memoryGas(ExpressionClasses::Id _position)
auto memGas = [=](u256 const& pos) -> u256
{
u256 size = (pos + 31) / 32;
- return m_schedule.memoryGas * size + size * size / m_schedule.quadCoeffDiv;
+ return GasCosts::memoryGas * size + size * size / GasCosts::quadCoeffDiv;
};
return memGas(*value) - memGas(previous);
}
@@ -204,14 +204,25 @@ GasMeter::GasConsumption GasMeter::memoryGas(int _stackPosOffset, int _stackPosS
}));
}
-u256 GasMeter::runGas(Instruction _instruction, EVMSchedule const& _es)
+unsigned GasMeter::runGas(Instruction _instruction)
{
if (_instruction == Instruction::JUMPDEST)
return 1;
- int tier = instructionInfo(_instruction).gasPriceTier;
- assertThrow(tier != InvalidTier, OptimizerException, "Invalid gas tier.");
- return _es.tierStepGas[tier];
+ switch (instructionInfo(_instruction).gasPriceTier)
+ {
+ case 0: return GasCosts::tier0Gas;
+ case 1: return GasCosts::tier1Gas;
+ case 2: return GasCosts::tier2Gas;
+ case 3: return GasCosts::tier3Gas;
+ case 4: return GasCosts::tier4Gas;
+ case 5: return GasCosts::tier5Gas;
+ case 6: return GasCosts::tier6Gas;
+ case 7: return GasCosts::tier7Gas;
+ default: break;
+ }
+ assertThrow(false, OptimizerException, "Invalid gas tier.");
+ return 0;
}
diff --git a/libevmasm/GasMeter.h b/libevmasm/GasMeter.h
index b11a63a5..1a607a9f 100644
--- a/libevmasm/GasMeter.h
+++ b/libevmasm/GasMeter.h
@@ -25,7 +25,6 @@
#include <tuple>
#include <libevmasm/ExpressionClasses.h>
#include <libevmasm/AssemblyItem.h>
-#include <libethcore/ChainOperationParams.h>
namespace dev
{
@@ -34,7 +33,44 @@ namespace eth
class KnownState;
-// TODO: FIXME: HOMESTEAD: XXX: @chfast populate m_schedule from an ExtVMFace instance via ExtVMFace::evmSchedule.
+namespace GasCosts
+{
+ static unsigned const stackLimit = 1024;
+ static unsigned const tier0Gas = 0;
+ static unsigned const tier1Gas = 2;
+ static unsigned const tier2Gas = 3;
+ static unsigned const tier3Gas = 5;
+ static unsigned const tier4Gas = 8;
+ static unsigned const tier5Gas = 10;
+ static unsigned const tier6Gas = 20;
+ static unsigned const tier7Gas = 0;
+ static unsigned const expGas = 10;
+ static unsigned const expByteGas = 10;
+ static unsigned const sha3Gas = 30;
+ static unsigned const sha3WordGas = 6;
+ static unsigned const sloadGas = 50;
+ static unsigned const sstoreSetGas = 20000;
+ static unsigned const sstoreResetGas = 5000;
+ static unsigned const sstoreRefundGas = 15000;
+ static unsigned const jumpdestGas = 1;
+ static unsigned const logGas = 375;
+ static unsigned const logDataGas = 8;
+ static unsigned const logTopicGas = 375;
+ static unsigned const createGas = 32000;
+ static unsigned const callGas = 40;
+ static unsigned const callStipend = 2300;
+ static unsigned const callValueTransferGas = 9000;
+ static unsigned const callNewAccountGas = 25000;
+ static unsigned const suicideRefundGas = 24000;
+ static unsigned const memoryGas = 3;
+ static unsigned const quadCoeffDiv = 512;
+ static unsigned const createDataGas = 200;
+ static unsigned const txGas = 21000;
+ static unsigned const txCreateGas = 53000;
+ static unsigned const txDataZeroGas = 4;
+ static unsigned const txDataNonZeroGas = 68;
+ static unsigned const copyGas = 3;
+}
/**
* Class that helps computing the maximum gas consumption for instructions.
@@ -47,7 +83,8 @@ class GasMeter
public:
struct GasConsumption
{
- GasConsumption(u256 _value = 0, bool _infinite = false): value(_value), isInfinite(_infinite) {}
+ GasConsumption(unsigned _value = 0, bool _infinite = false): value(_value), isInfinite(_infinite) {}
+ GasConsumption(u256 _value, bool _infinite = false): value(_value), isInfinite(_infinite) {}
static GasConsumption infinite() { return GasConsumption(0, true); }
GasConsumption& operator+=(GasConsumption const& _other);
@@ -69,8 +106,7 @@ public:
u256 const& largestMemoryAccess() const { return m_largestMemoryAccess; }
- u256 runGas(Instruction _instruction) const { return runGas(_instruction, m_schedule); }
- static u256 runGas(Instruction _instruction, EVMSchedule const& _es);
+ static unsigned runGas(Instruction _instruction);
private:
/// @returns _multiplier * (_value + 31) / 32, if _value is a known constant and infinite otherwise.
@@ -85,8 +121,6 @@ private:
std::shared_ptr<KnownState> m_state;
/// Largest point where memory was accessed since the creation of this object.
u256 m_largestMemoryAccess;
-
- EVMSchedule m_schedule;
};
inline std::ostream& operator<<(std::ostream& _str, GasMeter::GasConsumption const& _consumption)
diff --git a/libevmasm/Version.cpp b/libevmasm/Version.cpp
deleted file mode 100644
index c1379848..00000000
--- a/libevmasm/Version.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- This file is part of cpp-ethereum.
-
- cpp-ethereum is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- cpp-ethereum is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
-*/
-/**
- * @author Christian <c@ethdev.com>
- * @date 2015
- * Versioning.
- */
-
-#include <string>
-#include <ethereum/BuildInfo.h>
-#include <libdevcore/Common.h>
-#include <libevmasm/Version.h>
-
-using namespace dev;
-using namespace std;
-
-char const* dev::eth::VersionNumberLibEvmAsm = ETH_PROJECT_VERSION;
-extern string const dev::eth::VersionStringLibEvmAsm =
- string(dev::eth::VersionNumberLibEvmAsm) +
- "-" +
- string(DEV_QUOTED(ETH_COMMIT_HASH)).substr(0, 8) +
- (ETH_CLEAN_REPO ? "" : "*") +
- "/" DEV_QUOTED(ETH_BUILD_TYPE) "-" DEV_QUOTED(ETH_BUILD_PLATFORM);
-
diff --git a/libevmasm/Version.h b/libevmasm/Version.h
deleted file mode 100644
index 8cba6e83..00000000
--- a/libevmasm/Version.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- This file is part of cpp-ethereum.
-
- cpp-ethereum is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- cpp-ethereum is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
-*/
-/**
- * @author Christian <c@ethdev.com>
- * @date 2015
- * Versioning.
- */
-
-#pragma once
-
-#include <string>
-
-namespace dev
-{
-namespace eth
-{
-
-extern char const* VersionNumberLibEvmAsm;
-extern std::string const VersionStringLibEvmAsm;
-
-}
-}
diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt
index 5f4a1a06..e86792c1 100644
--- a/libsolidity/CMakeLists.txt
+++ b/libsolidity/CMakeLists.txt
@@ -15,7 +15,7 @@ file(GLOB HEADERS "*/*.h")
include_directories(BEFORE ..)
add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
-eth_use(${EXECUTABLE} REQUIRED Dev::devcore Eth::evmcore Solidity::evmasm)
+eth_use(${EXECUTABLE} REQUIRED Dev::devcore Solidity::evmasm)
install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} )
diff --git a/libsolidity/codegen/Compiler.cpp b/libsolidity/codegen/Compiler.cpp
index 8b718fca..614c01ee 100644
--- a/libsolidity/codegen/Compiler.cpp
+++ b/libsolidity/codegen/Compiler.cpp
@@ -24,8 +24,8 @@
#include <algorithm>
#include <boost/range/adaptor/reversed.hpp>
#include <libevmasm/Instruction.h>
-#include <libethcore/ChainOperationParams.h>
#include <libevmasm/Assembly.h>
+#include <libevmasm/GasMeter.h>
#include <libsolidity/inlineasm/AsmCodeGen.h>
#include <libsolidity/ast/AST.h>
#include <libsolidity/codegen/ExpressionCompiler.h>
@@ -853,7 +853,6 @@ void Compiler::compileExpression(Expression const& _expression, TypePointer cons
eth::Assembly Compiler::cloneRuntime()
{
- eth::EVMSchedule schedule;
eth::Assembly a;
a << Instruction::CALLDATASIZE;
a << u256(0) << Instruction::DUP1 << Instruction::CALLDATACOPY;
@@ -863,7 +862,7 @@ eth::Assembly Compiler::cloneRuntime()
// this is the address which has to be substituted by the linker.
//@todo implement as special "marker" AssemblyItem.
a << u256("0xcafecafecafecafecafecafecafecafecafecafe");
- a << u256(schedule.callGas + 10) << Instruction::GAS << Instruction::SUB;
+ a << u256(eth::GasCosts::callGas + 10) << Instruction::GAS << Instruction::SUB;
a << Instruction::DELEGATECALL;
//Propagate error condition (if DELEGATECALL pushes 0 on stack).
a << Instruction::ISZERO;
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index ed36fb24..d1cbc8ed 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -25,16 +25,14 @@
#include <boost/range/adaptor/reversed.hpp>
#include <libdevcore/Common.h>
#include <libdevcore/SHA3.h>
-#include <libethcore/ChainOperationParams.h>
#include <libsolidity/ast/AST.h>
#include <libsolidity/codegen/ExpressionCompiler.h>
#include <libsolidity/codegen/CompilerContext.h>
#include <libsolidity/codegen/CompilerUtils.h>
#include <libsolidity/codegen/LValue.h>
+#include <libevmasm/GasMeter.h>
using namespace std;
-// TODO: FIXME: HOMESTEAD: XXX: @chriseth Params deprecated - use EVMSchedule instead.
-
namespace dev
{
namespace solidity
@@ -1454,14 +1452,13 @@ void ExpressionCompiler::appendExternalFunctionCall(
m_context << dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos));
else
{
- eth::EVMSchedule schedule;
// send all gas except the amount needed to execute "SUB" and "CALL"
// @todo this retains too much gas for now, needs to be fine-tuned.
- u256 gasNeededByCaller = schedule.callGas + 10;
+ u256 gasNeededByCaller = eth::GasCosts::callGas + 10;
if (_functionType.valueSet())
- gasNeededByCaller += schedule.callValueTransferGas;
+ gasNeededByCaller += eth::GasCosts::callValueTransferGas;
if (!isCallCode && !isDelegateCall)
- gasNeededByCaller += schedule.callNewAccountGas; // we never know
+ gasNeededByCaller += eth::GasCosts::callNewAccountGas; // we never know
m_context <<
gasNeededByCaller <<
Instruction::GAS <<
diff --git a/libsolidity/interface/Version.cpp b/libsolidity/interface/Version.cpp
index 84a82dbf..a846efea 100644
--- a/libsolidity/interface/Version.cpp
+++ b/libsolidity/interface/Version.cpp
@@ -24,7 +24,6 @@
#include <string>
#include <libdevcore/CommonData.h>
#include <libdevcore/Common.h>
-#include <libevmasm/Version.h>
#include <libsolidity/interface/Utils.h>
#include <solidity/BuildInfo.h>
@@ -39,8 +38,7 @@ string const dev::solidity::VersionString =
"-" +
string(DEV_QUOTED(ETH_COMMIT_HASH)).substr(0, 8) +
(ETH_CLEAN_REPO ? "" : "*") +
- "/" DEV_QUOTED(ETH_BUILD_TYPE) "-" DEV_QUOTED(ETH_BUILD_PLATFORM)
- " linked to libethereum-" + eth::VersionStringLibEvmAsm;
+ "/" DEV_QUOTED(ETH_BUILD_TYPE) "-" DEV_QUOTED(ETH_BUILD_PLATFORM);
bytes dev::solidity::binaryVersion()
diff --git a/lllc/main.cpp b/lllc/main.cpp
index 2c3b6a64..a4c92d67 100644
--- a/lllc/main.cpp
+++ b/lllc/main.cpp
@@ -26,7 +26,6 @@
#include <libdevcore/CommonIO.h>
#include <libdevcore/CommonData.h>
#include <libevmasm/Instruction.h>
-#include "ethereum/BuildInfo.h"
using namespace std;
using namespace dev;
using namespace dev::solidity;
@@ -48,9 +47,8 @@ void help()
void version()
{
- cout << "LLLC, the Lovely Little Language Compiler " << dev::Version << endl;
+ cout << "LLLC, the Lovely Little Language Compiler " << endl;
cout << " By Gav Wood, (c) 2014." << endl;
- cout << "Build: " << DEV_QUOTED(ETH_BUILD_PLATFORM) << "/" << DEV_QUOTED(ETH_BUILD_TYPE) << endl;
exit(0);
}
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index d82a2442..7f7655f2 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -35,6 +35,7 @@
#include <libdevcore/CommonData.h>
#include <libdevcore/CommonIO.h>
#include <libevmasm/Instruction.h>
+#include <libevmasm/GasMeter.h>
#include <libsolidity/interface/Version.h>
#include <libsolidity/parsing/Scanner.h>
#include <libsolidity/parsing/Parser.h>
@@ -240,7 +241,6 @@ void CommandLineInterface::handleMeta(DocumentationType _type, string const& _co
void CommandLineInterface::handleGasEstimation(string const& _contract)
{
- eth::EVMSchedule schedule; // TODO: make it relevant to the SealEngine/EnvInfo.
using Gas = GasEstimator::GasConsumption;
if (!m_compiler->assemblyItems(_contract) && !m_compiler->runtimeAssemblyItems(_contract))
return;
@@ -250,8 +250,8 @@ void CommandLineInterface::handleGasEstimation(string const& _contract)
Gas gas = GasEstimator::functionalEstimation(*items);
u256 bytecodeSize(m_compiler->runtimeObject(_contract).bytecode.size());
cout << "construction:" << endl;
- cout << " " << gas << " + " << (bytecodeSize * schedule.createDataGas) << " = ";
- gas += bytecodeSize * schedule.createDataGas;
+ cout << " " << gas << " + " << (bytecodeSize * eth::GasCosts::createDataGas) << " = ";
+ gas += bytecodeSize * eth::GasCosts::createDataGas;
cout << gas << endl;
}
if (eth::AssemblyItems const* items = m_compiler->runtimeAssemblyItems(_contract))
diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp
index 1c20d695..eaf83705 100644
--- a/solc/jsonCompiler.cpp
+++ b/solc/jsonCompiler.cpp
@@ -28,6 +28,7 @@
#include <libdevcore/CommonData.h>
#include <libdevcore/CommonIO.h>
#include <libevmasm/Instruction.h>
+#include <libevmasm/GasMeter.h>
#include <libsolidity/parsing/Scanner.h>
#include <libsolidity/parsing/Parser.h>
#include <libsolidity/ast/ASTPrinter.h>
@@ -77,7 +78,6 @@ Json::Value gasToJson(GasEstimator::GasConsumption const& _gas)
Json::Value estimateGas(CompilerStack const& _compiler, string const& _contract)
{
- eth::EVMSchedule schedule;
Json::Value gasEstimates(Json::objectValue);
using Gas = GasEstimator::GasConsumption;
if (!_compiler.assemblyItems(_contract) && !_compiler.runtimeAssemblyItems(_contract))
@@ -88,7 +88,7 @@ Json::Value estimateGas(CompilerStack const& _compiler, string const& _contract)
u256 bytecodeSize(_compiler.runtimeObject(_contract).bytecode.size());
Json::Value creationGas(Json::arrayValue);
creationGas[0] = gasToJson(gas);
- creationGas[1] = gasToJson(bytecodeSize * schedule.createDataGas);
+ creationGas[1] = gasToJson(bytecodeSize * eth::GasCosts::createDataGas);
gasEstimates["creation"] = creationGas;
}
if (eth::AssemblyItems const* items = _compiler.runtimeAssemblyItems(_contract))
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c72d31d3..28b9972e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -44,7 +44,7 @@ file(GLOB HEADERS "*.h")
set(EXECUTABLE soltest)
add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
-eth_use(${EXECUTABLE} REQUIRED Solidity::solidity Eth::ethereum)
+eth_use(${EXECUTABLE} REQUIRED Solidity::solidity Eth::ethereum Eth::ethcore)
include_directories(BEFORE ..)
target_link_libraries(${EXECUTABLE} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})