use of org.hyperledger.besu.evm.frame.MessageFrame in project besu by hyperledger.
the class DebugOperationTracerTest method shouldRecordMemoryWhenEnabled.
@Test
public void shouldRecordMemoryWhenEnabled() {
final MessageFrame frame = validMessageFrame();
final Bytes32 word1 = Bytes32.fromHexString("0x01");
final Bytes32 word2 = Bytes32.fromHexString("0x02");
final Bytes32 word3 = Bytes32.fromHexString("0x03");
frame.writeMemory(0, 32, word1);
frame.writeMemory(32, 32, word2);
frame.writeMemory(64, 32, word3);
final TraceFrame traceFrame = traceFrame(frame, new TraceOptions(false, true, false));
assertThat(traceFrame.getMemory()).isPresent();
assertThat(traceFrame.getMemory().get()).containsExactly(word1, word2, word3);
}
use of org.hyperledger.besu.evm.frame.MessageFrame in project besu by hyperledger.
the class DebugOperationTracerTest method shouldRecordStackWhenEnabled.
@Test
public void shouldRecordStackWhenEnabled() {
final MessageFrame frame = validMessageFrame();
final UInt256 stackItem1 = UInt256.fromHexString("0x01");
final UInt256 stackItem2 = UInt256.fromHexString("0x02");
final UInt256 stackItem3 = UInt256.fromHexString("0x03");
frame.pushStackItem(stackItem1);
frame.pushStackItem(stackItem2);
frame.pushStackItem(stackItem3);
final TraceFrame traceFrame = traceFrame(frame, new TraceOptions(false, false, true));
assertThat(traceFrame.getStack()).isPresent();
assertThat(traceFrame.getStack().get()).containsExactly(stackItem1, stackItem2, stackItem3);
}
use of org.hyperledger.besu.evm.frame.MessageFrame in project besu by hyperledger.
the class DebugOperationTracerTest method shouldRecordProgramCounter.
@Test
public void shouldRecordProgramCounter() {
final MessageFrame frame = validMessageFrame();
frame.setPC(10);
final TraceFrame traceFrame = traceFrame(frame);
assertThat(traceFrame.getPc()).isEqualTo(10);
}
use of org.hyperledger.besu.evm.frame.MessageFrame in project besu by hyperledger.
the class DebugOperationTracerTest method validMessageFrame.
private MessageFrame validMessageFrame() {
final MessageFrame frame = validMessageFrameBuilder().build();
frame.setCurrentOperation(anOperation);
frame.setPC(10);
return frame;
}
use of org.hyperledger.besu.evm.frame.MessageFrame in project besu by hyperledger.
the class DebugOperationTracerTest method shouldRecordOpcode.
@Test
public void shouldRecordOpcode() {
final MessageFrame frame = validMessageFrame();
final TraceFrame traceFrame = traceFrame(frame);
assertThat(traceFrame.getOpcode()).isEqualTo("MUL");
}
Aggregations