diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp
index a44af8a2d..e15d08ab8 100644
--- a/alethzero/MainWin.cpp
+++ b/alethzero/MainWin.cpp
@@ -273,12 +273,12 @@ void Main::installWatches()
Address Main::getNameReg() const
{
- return abiOut
(ethereum()->call(c_newConfig, abiIn(1, (u256)1)));
+ return abiOut(ethereum()->call(c_newConfig, abiIn("lookup(uint256)", (u256)1)));
}
Address Main::getCurrencies() const
{
- return abiOut(ethereum()->call(c_newConfig, abiIn(1, (u256)2)));
+ return abiOut(ethereum()->call(c_newConfig, abiIn("lookup(uint256)", (u256)2)));
}
void Main::installNameRegWatch()
@@ -475,7 +475,7 @@ QString Main::pretty(dev::Address _a) const
if (g_newNameReg)
{
- QString s = QString::fromStdString(toString(abiOut(ethereum()->call(g_newNameReg, abiIn(2, _a)))));
+ QString s = QString::fromStdString(toString(abiOut(ethereum()->call(g_newNameReg, abiIn("nameOf(address)", _a)))));
// s_memos[_a] = s;
if (s.size())
return s;
@@ -522,11 +522,11 @@ Address Main::fromString(QString const& _n) const
if (!s_memos.count(_n))
{*/
// if (!g_newNameReg)
- auto g_newNameReg = abiOut(ethereum()->call(c_newConfig, abiIn(1, (u256)1)));
+ auto g_newNameReg = getNameReg();
if (g_newNameReg)
{
- Address a = abiOut(ethereum()->call(g_newNameReg, abiIn(0, ::fromString(_n.toStdString()))));
+ Address a = abiOut(ethereum()->call(g_newNameReg, abiIn("addressOf(string32)", ::fromString(_n.toStdString()))));
// s_memos[_n] = a;
if (a)
return a;
diff --git a/evmjit/libevmjit/Cache.cpp b/evmjit/libevmjit/Cache.cpp
index 2311c0496..3ac9f4a73 100644
--- a/evmjit/libevmjit/Cache.cpp
+++ b/evmjit/libevmjit/Cache.cpp
@@ -46,6 +46,7 @@ std::unique_ptr Cache::getObject(std::string const& id)
auto module = std::unique_ptr(new llvm::Module(id, llvm::getGlobalContext()));
auto mainFuncType = llvm::FunctionType::get(llvm::IntegerType::get(llvm::getGlobalContext(), 32), {}, false);
auto func = llvm::Function::Create(mainFuncType, llvm::Function::ExternalLinkage, id, module.get());
+ (void)func;
}
return nullptr;
}
@@ -70,6 +71,7 @@ void ObjectCache::notifyObjectCompiled(llvm::Module const* _module, llvm::Memory
llvm::MemoryBuffer* ObjectCache::getObject(llvm::Module const* _module)
{
+ (void)_module;
auto o = lastObject;
lastObject = nullptr;
return o;
diff --git a/evmjit/libevmjit/Ext.cpp b/evmjit/libevmjit/Ext.cpp
index cd741ad24..b92a07bf8 100644
--- a/evmjit/libevmjit/Ext.cpp
+++ b/evmjit/libevmjit/Ext.cpp
@@ -22,9 +22,11 @@ namespace jit
Ext::Ext(RuntimeManager& _runtimeManager, Memory& _memoryMan):
RuntimeHelper(_runtimeManager),
- m_memoryMan(_memoryMan),
+ m_memoryMan(_memoryMan)
+ // TODO: fix: either initialise properly or don't specify in constructor.
+ /*,
m_funcs{},
- m_argAllocas{}
+ m_argAllocas{}*/
{
m_size = m_builder.CreateAlloca(Type::Size, nullptr, "env.size");
}
diff --git a/libdevcore/vector_ref.h b/libdevcore/vector_ref.h
index 2771c739a..0cd3f8064 100644
--- a/libdevcore/vector_ref.h
+++ b/libdevcore/vector_ref.h
@@ -28,7 +28,7 @@ public:
bool contentsEqual(std::vector const& _c) const { return _c.size() == m_count && !memcmp(_c.data(), m_data, m_count); }
std::vector toVector() const { return std::vector(m_data, m_data + m_count); }
- std::vector toBytes() const { return std::vector((unsigned char const*)m_data, m_data + m_count * sizeof(_T)); }
+ std::vector toBytes() const { return std::vector((unsigned char const*)m_data, (unsigned char const*)m_data + m_count * sizeof(_T)); }
std::string toString() const { return std::string((char const*)m_data, ((char const*)m_data) + m_count * sizeof(_T)); }
template operator vector_ref<_T2>() const { assert(m_count * sizeof(_T) / sizeof(_T2) * sizeof(_T2) / sizeof(_T) == m_count); return vector_ref<_T2>((_T2*)m_data, m_count * sizeof(_T) / sizeof(_T2)); }
diff --git a/libethereum/Client.h b/libethereum/Client.h
index 6a3d7ec22..efe076dab 100644
--- a/libethereum/Client.h
+++ b/libethereum/Client.h
@@ -119,9 +119,9 @@ template bytes abiInAux(T const& _t, U const& ... _u)
return ABISerialiser::serialise(_t) + abiInAux(_u ...);
}
-template bytes abiIn(byte _id, T const& ... _t)
+template bytes abiIn(std::string _id, T const& ... _t)
{
- return bytes(1, _id) + abiInAux(_t ...);
+ return sha3(_id).ref().cropped(0, 4).toBytes() + abiInAux(_t ...);
}
template struct ABIDeserialiser {};
diff --git a/libethereum/Executive.cpp b/libethereum/Executive.cpp
index f79bb4a3b..c4ce543d6 100644
--- a/libethereum/Executive.cpp
+++ b/libethereum/Executive.cpp
@@ -146,9 +146,17 @@ bool Executive::create(Address _sender, u256 _endowment, u256 _gasPrice, u256 _g
m_s.m_cache[m_newAddress] = Account(m_s.balance(m_newAddress) + _endowment, Account::ContractConception);
// Execute _init.
- m_vm = VMFactory::create(_gas);
- m_ext = make_shared(m_s, m_lastHashes, m_newAddress, _sender, _origin, _endowment, _gasPrice, bytesConstRef(), _init, m_depth);
- return _init.empty();
+ if (_init.empty())
+ {
+ m_s.m_cache[m_newAddress].setCode({});
+ m_endGas = _gas;
+ }
+ else
+ {
+ m_vm = VMFactory::create(_gas);
+ m_ext = make_shared(m_s, m_lastHashes, m_newAddress, _sender, _origin, _endowment, _gasPrice, bytesConstRef(), _init, m_depth);
+ }
+ return !m_ext;
}
OnOpFunc Executive::simpleTrace()
diff --git a/libevm/VM.h b/libevm/VM.h
index b8a33909c..377effe11 100644
--- a/libevm/VM.h
+++ b/libevm/VM.h
@@ -202,9 +202,7 @@ inline bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _st
case Instruction::CREATE:
{
require(3);
- u256 inOff = m_stack[m_stack.size() - 2];
- u256 inSize = m_stack[m_stack.size() - 3];
- newTempSize = (bigint)inOff + inSize;
+ newTempSize = memNeed(m_stack[m_stack.size() - 2], m_stack[m_stack.size() - 3]);
runGas = c_createGas;
break;
}