Search in sources :

Example 11 with VM

use of org.ethereum.vm.VM in project rskj by rsksmart.

the class ExtCodeHashTest method testDoEXTCODEHASHWithoutArguments.

@Test
public void testDoEXTCODEHASHWithoutArguments() {
    int gasExpected = 1000000;
    String stringCode = " EXTCODEHASH";
    byte[] code = compiler.compile(stringCode);
    VM vm = new VM(vmConfig, precompiledContracts);
    Program program = new Program(vmConfig, precompiledContracts, blockFactory, activationConfig, code, invoke, transaction, new HashSet<>());
    try {
        while (!program.isStopped()) {
            vm.step(program);
        }
    } catch (Program.StackTooSmallException e) {
        Assert.assertEquals(0, program.getStack().size());
        Assert.assertEquals(gasExpected, program.getResult().getGasUsed());
    }
}
Also used : Program(org.ethereum.vm.program.Program) VM(org.ethereum.vm.VM) Test(org.junit.Test)

Aggregations

VM (org.ethereum.vm.VM)11 Program (org.ethereum.vm.program.Program)9 PrecompiledContracts (org.ethereum.vm.PrecompiledContracts)5 Test (org.junit.Test)5 ActivationConfigsForTest (org.ethereum.config.blockchain.upgrades.ActivationConfigsForTest)4 RskAddress (co.rsk.core.RskAddress)3 ProgramInvoke (org.ethereum.vm.program.invoke.ProgramInvoke)3 ProgramInvokeMockImpl (org.ethereum.vm.program.invoke.ProgramInvokeMockImpl)3 EVMAssembler (co.rsk.asm.EVMAssembler)2 Keccak256 (co.rsk.crypto.Keccak256)2 SimpleBtcTransaction (co.rsk.peg.bitcoin.SimpleBtcTransaction)2 DataWord (org.ethereum.vm.DataWord)2 Ignore (org.junit.Ignore)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 VmConfig (co.rsk.config.VmConfig)1 Coin (co.rsk.core.Coin)1 BytecodeCompiler (co.rsk.vm.BytecodeCompiler)1 IOException (java.io.IOException)1 ThreadMXBean (java.lang.management.ThreadMXBean)1 BigInteger (java.math.BigInteger)1