Browse Source

Log/bloom alterations.

cl-refactor
Gav Wood 10 years ago
parent
commit
5a538bf314
  1. 2
      libdevcore/FixedHash.h
  2. 2
      libethcore/BlockInfo.cpp
  3. 7
      libethcore/CommonEth.h
  4. 4
      libethereum/BlockDetails.h
  5. 7
      libevm/FeeStructure.cpp
  6. 1
      libevm/FeeStructure.h
  7. 17
      libevm/VM.cpp

2
libdevcore/FixedHash.h

@ -240,6 +240,8 @@ inline std::ostream& operator<<(std::ostream& _out, FixedHash<N> const& _h)
}
// Common types of FixedHash.
using h2048 = FixedHash<256>;
using h1024 = FixedHash<128>;
using h520 = FixedHash<65>;
using h512 = FixedHash<64>;
using h256 = FixedHash<32>;

2
libethcore/BlockInfo.cpp

@ -101,7 +101,7 @@ void BlockInfo::populateFromHeader(RLP const& _header, bool _checkNonce)
stateRoot = _header[field = 3].toHash<h256>();
transactionsRoot = _header[field = 4].toHash<h256>();
receiptsRoot = _header[field = 5].toHash<h256>();
logBloom = _header[field = 6].toHash<h512>();
logBloom = _header[field = 6].toHash<LogBloom>();
difficulty = _header[field = 7].toInt<u256>();
number = _header[field = 8].toInt<u256>();
gasLimit = _header[field = 9].toInt<u256>();

7
libethcore/CommonEth.h

@ -44,8 +44,11 @@ std::string formatBalance(bigint const& _b);
/// Get information concerning the currency denominations.
std::vector<std::pair<u256, std::string>> const& units();
/// The log bloom's size (512 bit).
using LogBloom = h512;
/// The log bloom's size (2048-bit).
using LogBloom = h2048;
/// Many log blooms.
using LogBlooms = std::vector<LogBloom>;
template <size_t n> inline u256 exp10()
{

4
libethereum/BlockDetails.h

@ -55,10 +55,10 @@ struct BlockDetails
struct BlockLogBlooms
{
BlockLogBlooms() {}
BlockLogBlooms(RLP const& _r) { blooms = _r.toVector<h512>(); }
BlockLogBlooms(RLP const& _r) { blooms = _r.toVector<LogBloom>(); }
bytes rlp() const { RLPStream s; s << blooms; return s.out(); }
h512s blooms;
LogBlooms blooms;
};
struct BlockReceipts

7
libevm/FeeStructure.cpp

@ -39,14 +39,15 @@ u256 const dev::eth::c_sstoreClearGas = 5000;
u256 const dev::eth::c_sstoreRefundGas = 15000;
u256 const dev::eth::c_jumpdestGas = 1;
u256 const dev::eth::c_logGas = 2000;
u256 const dev::eth::c_logGas = 375;
u256 const dev::eth::c_logDataGas = 8;
u256 const dev::eth::c_logTopicGas = 2000;
u256 const dev::eth::c_logTopicGas = 375;
u256 const dev::eth::c_createGas = 32000;
u256 const dev::eth::c_callGas = 40;
u256 const dev::eth::c_callValueTransferGas = 6700;
u256 const dev::eth::c_callStipend = 2300;
u256 const dev::eth::c_callValueTransferGas = 9000;
u256 const dev::eth::c_callNewAccountGas = 25000;
u256 const dev::eth::c_suicideRefundGas = 24000;

1
libevm/FeeStructure.h

@ -50,6 +50,7 @@ extern u256 const c_logTopicGas; ///< Multiplied by the * of the LOG*, per LOG
extern u256 const c_createGas; ///< Once per CREATE operation & contract-creation transaction.
extern u256 const c_createDataGas;
extern u256 const c_callGas; ///< Once per CALL operation & message call transaction.
extern u256 const c_callStipend; ///< Free gas given at beginning of call.
extern u256 const c_callNewAccountGas; ///< Paid for CALL when the destination address didn't exist prior.
extern u256 const c_callValueTransferGas; ///< Paid for CALL when the value transfor is non-zero.
extern u256 const c_suicideRefundGas; ///< Refunded following a suicide operation.

17
libevm/VM.cpp

@ -563,21 +563,6 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps)
break;
case Instruction::JUMPDEST:
break;
/* case Instruction::LOG0:
_ext.log({}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 1], (unsigned)m_stack[m_stack.size() - 2]));
break;
case Instruction::LOG1:
_ext.log({m_stack[m_stack.size() - 1]}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 2], (unsigned)m_stack[m_stack.size() - 3]));
break;
case Instruction::LOG2:
_ext.log({m_stack[m_stack.size() - 1], m_stack[m_stack.size() - 2]}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 3], (unsigned)m_stack[m_stack.size() - 4]));
break;
case Instruction::LOG3:
_ext.log({m_stack[m_stack.size() - 1], m_stack[m_stack.size() - 2], m_stack[m_stack.size() - 3]}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 4], (unsigned)m_stack[m_stack.size() - 5]));
break;
case Instruction::LOG4:
_ext.log({m_stack[m_stack.size() - 1], m_stack[m_stack.size() - 2], m_stack[m_stack.size() - 3], m_stack[m_stack.size() - 4]}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 5], (unsigned)m_stack[m_stack.size() - 6]));
break;*/
case Instruction::LOG0:
_ext.log({}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 1], (unsigned)m_stack[m_stack.size() - 2]));
m_stack.pop_back();
@ -635,6 +620,8 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps)
case Instruction::CALLCODE:
{
u256 gas = m_stack.back();
if (m_stack[m_stack.size() - 3] > 0)
gas += c_callStipend;
m_stack.pop_back();
Address receiveAddress = asAddress(m_stack.back());
m_stack.pop_back();

Loading…
Cancel
Save