Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Instruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ static const std::map<Instruction, InstructionInfo> c_instructionInfo =
{ Instruction::MSIZE, { "MSIZE", 0, 1, Tier::Base } },
{ Instruction::GAS, { "GAS", 0, 1, Tier::Base } },
{ Instruction::JUMPDEST, { "JUMPDEST", 0, 0, Tier::Special } },
{ Instruction::PUSH0, { "PUSH0", 0, 1, Tier::Base } },
{ Instruction::PUSH1, { "PUSH1", 0, 1, Tier::VeryLow } },
{ Instruction::PUSH2, { "PUSH2", 0, 1, Tier::VeryLow } },
{ Instruction::PUSH3, { "PUSH3", 0, 1, Tier::VeryLow } },
Expand Down
1 change: 1 addition & 0 deletions Instruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ enum class Instruction : uint8_t
GAS, ///< get the amount of available gas
JUMPDEST, ///< set a potential jump destination

PUSH0 = 0x5f, ///< place the value 0 on stack
PUSH1 = 0x60, ///< place 1 byte item on stack
PUSH2, ///< place 2 byte item on stack
PUSH3, ///< place 3 byte item on stack
Expand Down
11 changes: 11 additions & 0 deletions LegacyVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,17 @@ void LegacyVM::interpretCases()
#endif
}
CONTINUE
// EIP-3855. Code PUSH0 is similar to PUSH1 but pushes 0
// we need to increment program counter only by one since
// the value is not read from program code as in PUSH1
CASE( PUSH0 ) {
if (!m_schedule->havePush0)
throwBadInstruction();
ON_OP();
updateIOGas();
m_SPP[0] = 0;
++m_PC;
};

CASE(PUSH1)
{
Expand Down
2 changes: 1 addition & 1 deletion LegacyVMConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ namespace dev
&&BEGINDATA, \
&&BEGINSUB, \
&&INVALID, \
&&INVALID, \
&&PUSH0, \
&&PUSH1, /* 60, */ \
&&PUSH2, \
&&PUSH3, \
Expand Down