|
@ -32,6 +32,7 @@ using namespace dev; |
|
|
using namespace dev::eth; |
|
|
using namespace dev::eth; |
|
|
|
|
|
|
|
|
const char* VMTraceChannel::name() { return "EVM"; } |
|
|
const char* VMTraceChannel::name() { return "EVM"; } |
|
|
|
|
|
const char* ExecutiveWarnChannel::name() { return WarnChannel::name(); } |
|
|
|
|
|
|
|
|
Executive::Executive(State& _s, BlockChain const& _bc, unsigned _level): |
|
|
Executive::Executive(State& _s, BlockChain const& _bc, unsigned _level): |
|
|
m_s(_s), |
|
|
m_s(_s), |
|
@ -63,7 +64,7 @@ void Executive::initialize(Transaction const& _transaction) |
|
|
u256 startGasUsed = m_s.gasUsed(); |
|
|
u256 startGasUsed = m_s.gasUsed(); |
|
|
if (startGasUsed + (bigint)m_t.gas() > m_s.m_currentBlock.gasLimit) |
|
|
if (startGasUsed + (bigint)m_t.gas() > m_s.m_currentBlock.gasLimit) |
|
|
{ |
|
|
{ |
|
|
clog(StateDetail) << "Too much gas used in this block: Require <" << (m_s.m_currentBlock.gasLimit - startGasUsed) << " Got" << m_t.gas(); |
|
|
clog(ExecutiveWarnChannel) << "Too much gas used in this block: Require <" << (m_s.m_currentBlock.gasLimit - startGasUsed) << " Got" << m_t.gas(); |
|
|
m_excepted = TransactionException::BlockGasLimitReached; |
|
|
m_excepted = TransactionException::BlockGasLimitReached; |
|
|
BOOST_THROW_EXCEPTION(BlockGasLimitReached() << RequirementError((bigint)(m_s.m_currentBlock.gasLimit - startGasUsed), (bigint)m_t.gas())); |
|
|
BOOST_THROW_EXCEPTION(BlockGasLimitReached() << RequirementError((bigint)(m_s.m_currentBlock.gasLimit - startGasUsed), (bigint)m_t.gas())); |
|
|
} |
|
|
} |
|
@ -71,7 +72,7 @@ void Executive::initialize(Transaction const& _transaction) |
|
|
// Check gas cost is enough.
|
|
|
// Check gas cost is enough.
|
|
|
if (!m_t.checkPayment()) |
|
|
if (!m_t.checkPayment()) |
|
|
{ |
|
|
{ |
|
|
clog(StateDetail) << "Not enough gas to pay for the transaction: Require >" << m_t.gasRequired() << " Got" << m_t.gas(); |
|
|
clog(ExecutiveWarnChannel) << "Not enough gas to pay for the transaction: Require >" << m_t.gasRequired() << " Got" << m_t.gas(); |
|
|
m_excepted = TransactionException::OutOfGas; |
|
|
m_excepted = TransactionException::OutOfGas; |
|
|
BOOST_THROW_EXCEPTION(OutOfGasBase() << RequirementError(m_t.gasRequired(), (bigint)m_t.gas())); |
|
|
BOOST_THROW_EXCEPTION(OutOfGasBase() << RequirementError(m_t.gasRequired(), (bigint)m_t.gas())); |
|
|
} |
|
|
} |
|
@ -84,13 +85,13 @@ void Executive::initialize(Transaction const& _transaction) |
|
|
} |
|
|
} |
|
|
catch (...) |
|
|
catch (...) |
|
|
{ |
|
|
{ |
|
|
clog(StateDetail) << "Invalid Signature"; |
|
|
clog(ExecutiveWarnChannel) << "Invalid Signature"; |
|
|
m_excepted = TransactionException::InvalidSignature; |
|
|
m_excepted = TransactionException::InvalidSignature; |
|
|
throw; |
|
|
throw; |
|
|
} |
|
|
} |
|
|
if (m_t.nonce() != nonceReq) |
|
|
if (m_t.nonce() != nonceReq) |
|
|
{ |
|
|
{ |
|
|
clog(StateDetail) << "Invalid Nonce: Require" << nonceReq << " Got" << m_t.nonce(); |
|
|
clog(ExecutiveWarnChannel) << "Invalid Nonce: Require" << nonceReq << " Got" << m_t.nonce(); |
|
|
m_excepted = TransactionException::InvalidNonce; |
|
|
m_excepted = TransactionException::InvalidNonce; |
|
|
BOOST_THROW_EXCEPTION(InvalidNonce() << RequirementError((bigint)nonceReq, (bigint)m_t.nonce())); |
|
|
BOOST_THROW_EXCEPTION(InvalidNonce() << RequirementError((bigint)nonceReq, (bigint)m_t.nonce())); |
|
|
} |
|
|
} |
|
@ -100,7 +101,7 @@ void Executive::initialize(Transaction const& _transaction) |
|
|
m_totalCost = m_t.value() + m_gasCost; |
|
|
m_totalCost = m_t.value() + m_gasCost; |
|
|
if (m_s.balance(m_t.sender()) < m_totalCost) |
|
|
if (m_s.balance(m_t.sender()) < m_totalCost) |
|
|
{ |
|
|
{ |
|
|
clog(StateDetail) << "Not enough cash: Require >" << m_totalCost << " Got" << m_s.balance(m_t.sender()); |
|
|
clog(ExecutiveWarnChannel) << "Not enough cash: Require >" << m_totalCost << " Got" << m_s.balance(m_t.sender()); |
|
|
m_excepted = TransactionException::NotEnoughCash; |
|
|
m_excepted = TransactionException::NotEnoughCash; |
|
|
BOOST_THROW_EXCEPTION(NotEnoughCash() << RequirementError(m_totalCost, (bigint)m_s.balance(m_t.sender()))); |
|
|
BOOST_THROW_EXCEPTION(NotEnoughCash() << RequirementError(m_totalCost, (bigint)m_s.balance(m_t.sender()))); |
|
|
} |
|
|
} |
|
|