diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index 284745c64..41d140cad 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -158,7 +158,7 @@ public: return ret; } - template inline FixedHash& shiftBloom(FixedHash const& _h) { return (*this |= _h.nbloom()); } + template inline FixedHash& shiftBloom(FixedHash const& _h) { return (*this |= _h.template nbloom()); } template inline FixedHash nbloom() const { diff --git a/libevm/VM.h b/libevm/VM.h index c8071e346..d5db792f5 100644 --- a/libevm/VM.h +++ b/libevm/VM.h @@ -427,9 +427,13 @@ template dev::bytesConstRef dev::eth::VM::go(Ext& _ext, OnOpFunc con break; case Instruction::SIGNEXTEND: { - auto k = m_stack[m_stack.size() - 2]; - m_stack[m_stack.size() - 2] = m_stack.back(); + unsigned k = m_stack.back(); m_stack.pop_back(); + auto& b = m_stack.back(); + if (k <= 31) + if ((b >> (k * 8)) & 0x80) + for (int i = 31; i > k; --i) + b |= (u256(0xff) << i); break; } case Instruction::SHA3: diff --git a/test/vm.cpp b/test/vm.cpp index ca9ea57ce..d03a4a278 100644 --- a/test/vm.cpp +++ b/test/vm.cpp @@ -359,9 +359,9 @@ void FakeExtVM::importExec(mObject& _o) code = &thisTxCode; if (_o["code"].type() == str_type) if (_o["code"].get_str().find_first_of("0x") == 0) - thisTxCode = compileLLL(_o["code"].get_str()); - else thisTxCode = fromHex(_o["code"].get_str().substr(2)); + else + thisTxCode = compileLLL(_o["code"].get_str()); else if (_o["code"].type() == array_type) for (auto const& j: _o["code"].get_array()) thisTxCode.push_back(toByte(j));