From ae0205796c8959680de6e4cff041279dbb3b0ed6 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 5 Aug 2015 23:23:38 +0200 Subject: [PATCH] JITEVM fixes. --- evmjit/libevmjit-cpp/JitVM.cpp | 14 +++++++------- evmjit/libevmjit/Ext.cpp | 2 +- evmjit/libevmjit/Ext.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/evmjit/libevmjit-cpp/JitVM.cpp b/evmjit/libevmjit-cpp/JitVM.cpp index 9c94f145e..2bc9043db 100644 --- a/evmjit/libevmjit-cpp/JitVM.cpp +++ b/evmjit/libevmjit-cpp/JitVM.cpp @@ -23,8 +23,8 @@ bytesConstRef JitVM::execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _on // TODO: Rejecting transactions with gas limit > 2^63 can be used by attacker to take JIT out of scope rejected |= io_gas > std::numeric_limits::max(); // Do not accept requests with gas > 2^63 (int64 max) rejected |= _ext.gasPrice > std::numeric_limits::max(); - rejected |= _ext.currentBlock.number() > std::numeric_limits::max(); - rejected |= _ext.currentBlock.timestamp() > std::numeric_limits::max(); + rejected |= _ext.envInfo().number() > std::numeric_limits::max(); + rejected |= _ext.envInfo().timestamp() > std::numeric_limits::max(); if (rejected) { @@ -41,11 +41,11 @@ bytesConstRef JitVM::execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _on m_data.caller = eth2jit(fromAddress(_ext.caller)); m_data.origin = eth2jit(fromAddress(_ext.origin)); m_data.callValue = eth2jit(_ext.value); - m_data.coinBase = eth2jit(fromAddress(_ext.currentBlock.beneficiary())); - m_data.difficulty = eth2jit(_ext.currentBlock.difficulty()); - m_data.gasLimit = eth2jit(_ext.currentBlock.gasLimit()); - m_data.number = static_cast(_ext.currentBlock.number()); - m_data.timestamp = static_cast(_ext.currentBlock.timestamp()); + m_data.coinBase = eth2jit(fromAddress(_ext.envInfo().beneficiary())); + m_data.difficulty = eth2jit(_ext.envInfo().difficulty()); + m_data.gasLimit = eth2jit(_ext.envInfo().gasLimit()); + m_data.number = static_cast(_ext.envInfo().number()); + m_data.timestamp = static_cast(_ext.envInfo().timestamp()); m_data.code = _ext.code.data(); m_data.codeSize = _ext.code.size(); m_data.codeHash = eth2jit(_ext.codeHash); diff --git a/evmjit/libevmjit/Ext.cpp b/evmjit/libevmjit/Ext.cpp index b8b124ff5..3bbb47cdf 100644 --- a/evmjit/libevmjit/Ext.cpp +++ b/evmjit/libevmjit/Ext.cpp @@ -131,7 +131,7 @@ llvm::Value* Ext::balance(llvm::Value* _address) return m_builder.CreateLoad(ret); } -llvm::Value* Ext::blockhash(llvm::Value* _number) +llvm::Value* Ext::blockHash(llvm::Value* _number) { auto hash = getArgAlloca(); createCall(EnvFunc::blockhash, {getRuntimeManager().getEnvPtr(), byPtr(_number), hash}); diff --git a/evmjit/libevmjit/Ext.h b/evmjit/libevmjit/Ext.h index 2af074f4a..5ac37deea 100644 --- a/evmjit/libevmjit/Ext.h +++ b/evmjit/libevmjit/Ext.h @@ -51,7 +51,7 @@ public: llvm::Value* calldataload(llvm::Value* _index); llvm::Value* create(llvm::Value* _endowment, llvm::Value* _initOff, llvm::Value* _initSize); llvm::Value* call(llvm::Value* _callGas, llvm::Value* _receiveAddress, llvm::Value* _value, llvm::Value* _inOff, llvm::Value* _inSize, llvm::Value* _outOff, llvm::Value* _outSize, llvm::Value* _codeAddress); - llvm::Value* blockhash(llvm::Value* _number); + llvm::Value* blockHash(llvm::Value* _number); llvm::Value* sha3(llvm::Value* _inOff, llvm::Value* _inSize); MemoryRef extcode(llvm::Value* _addr);