Search in sources :

Example 16 with MessageFrame

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);
}
Also used : MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) TraceOptions(org.hyperledger.besu.ethereum.debug.TraceOptions) Bytes32(org.apache.tuweni.bytes.Bytes32) TraceFrame(org.hyperledger.besu.ethereum.debug.TraceFrame) Test(org.junit.Test)

Example 17 with MessageFrame

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);
}
Also used : MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) TraceOptions(org.hyperledger.besu.ethereum.debug.TraceOptions) UInt256(org.apache.tuweni.units.bigints.UInt256) TraceFrame(org.hyperledger.besu.ethereum.debug.TraceFrame) Test(org.junit.Test)

Example 18 with MessageFrame

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);
}
Also used : MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) TraceFrame(org.hyperledger.besu.ethereum.debug.TraceFrame) Test(org.junit.Test)

Example 19 with MessageFrame

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;
}
Also used : MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame)

Example 20 with MessageFrame

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");
}
Also used : MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) TraceFrame(org.hyperledger.besu.ethereum.debug.TraceFrame) Test(org.junit.Test)

Aggregations

MessageFrame (org.hyperledger.besu.evm.frame.MessageFrame)73 Test (org.junit.Test)39 Bytes (org.apache.tuweni.bytes.Bytes)28 WorldUpdater (org.hyperledger.besu.evm.worldstate.WorldUpdater)15 ArrayDeque (java.util.ArrayDeque)13 Wei (org.hyperledger.besu.datatypes.Wei)12 Code (org.hyperledger.besu.evm.Code)12 MessageFrameTestFixture (org.hyperledger.besu.ethereum.core.MessageFrameTestFixture)11 OperationResult (org.hyperledger.besu.evm.operation.Operation.OperationResult)11 UInt256 (org.apache.tuweni.units.bigints.UInt256)10 Address (org.hyperledger.besu.datatypes.Address)10 EVM (org.hyperledger.besu.evm.EVM)10 TraceFrame (org.hyperledger.besu.ethereum.debug.TraceFrame)9 Bytes32 (org.apache.tuweni.bytes.Bytes32)8 ContractCreationProcessor (org.hyperledger.besu.evm.processor.ContractCreationProcessor)8 BlockHashLookup (org.hyperledger.besu.ethereum.vm.BlockHashLookup)7 MutableAccount (org.hyperledger.besu.evm.account.MutableAccount)7 Hash (org.hyperledger.besu.datatypes.Hash)6 Block (org.hyperledger.besu.ethereum.core.Block)6 BlockHeader (org.hyperledger.besu.ethereum.core.BlockHeader)6