Browse Source

Various VM & LLL bugs fixed.

cl-refactor
Gav Wood 11 years ago
parent
commit
ef7532caec
  1. 1
      libethereum/ExtVMFace.h
  2. 6
      libethereum/Instruction.cpp
  3. 4
      libethereum/State.cpp
  4. 7
      libethereum/VM.h

1
libethereum/ExtVMFace.h

@ -73,6 +73,7 @@ public:
Address myAddress;
Address txSender;
Address origin;
u256 txValue;
u256 gasPrice;
bytesConstRef txData;

6
libethereum/Instruction.cpp

@ -493,6 +493,8 @@ static int compileLispFragment(char const*& d, char const* e, bool _quiet, bytes
// First fragment - predicate
appendCode(o_code, o_locs, codes[0], locs[0]);
if (t == "WHEN")
o_code.push_back((byte)Instruction::NOT);
// Push the positive location.
unsigned endLocation = (unsigned)o_code.size();
@ -500,8 +502,6 @@ static int compileLispFragment(char const*& d, char const* e, bool _quiet, bytes
pushLocation(o_code, 0);
// Jump to end...
if (t == "WHEN")
o_code.push_back((byte)Instruction::NOT);
o_code.push_back((byte)Instruction::JUMPI);
// Second fragment - negative.
@ -532,6 +532,7 @@ static int compileLispFragment(char const*& d, char const* e, bool _quiet, bytes
// First fragment - predicate
appendCode(o_code, o_locs, codes[0], locs[0]);
o_code.push_back((byte)Instruction::NOT);
// Push the positive location.
unsigned endInsertion = (unsigned)o_code.size();
@ -539,7 +540,6 @@ static int compileLispFragment(char const*& d, char const* e, bool _quiet, bytes
pushLocation(o_code, 0);
// Jump to positive if true.
o_code.push_back((byte)Instruction::NOT);
o_code.push_back((byte)Instruction::JUMPI);
// Second fragment - negative.

4
libethereum/State.cpp

@ -616,14 +616,14 @@ void State::execute(bytesConstRef _rlp)
throw InvalidNonce(nonceReq, t.nonce);
}
// Don't like transactions whose gas price is too low.
// Don't like transactions whose gas price is too low. NOTE: this won't stay here forever - it's just until we get a proper gas proce discovery protocol going.
if (t.gasPrice < 10 * szabo)
{
clog(StateChat) << "Offered gas-price is too low.";
throw GasPriceTooLow();
}
// Entry point for a contract-originated transaction.
// Check gas cost is enough.
u256 gasCost;
if (t.isCreation())
gasCost = (t.init.size() + t.data.size()) * c_txDataGas + c_createGas;

7
libethereum/VM.h

@ -41,8 +41,8 @@ inline Address asAddress(u256 _item)
inline u256 fromAddress(Address _a)
{
u256 ret;
memcpy(&_a, &ret, sizeof(_a));
h256 ret;
memcpy(&ret, &_a, sizeof(_a));
return ret;
}
@ -176,7 +176,8 @@ template <class Ext> eth::bytesConstRef eth::VM::go(Ext& _ext, uint64_t _steps)
m_gas = (u256)((bigint)m_gas - runGas);
m_temp.resize(newTempSize);
if (newTempSize > m_temp.size())
m_temp.resize(newTempSize);
// EXECUTE...
switch (inst)

Loading…
Cancel
Save