Search in sources :

Example 1 with ExecutionEnvironment

use of co.rsk.pcc.ExecutionEnvironment in project rskj by rsksmart.

the class EnvironmentUtils method getEnvironmentWithBlockchainOfLength.

public static ExecutionEnvironment getEnvironmentWithBlockchainOfLength(int blockchainLength) {
    World world = new World();
    TestSystemProperties config = new TestSystemProperties();
    buildBlockchainOfLength(world, config, blockchainLength);
    ExecutionEnvironment executionEnvironment = mock(ExecutionEnvironment.class);
    when(executionEnvironment.getBlockStore()).thenReturn(world.getBlockStore());
    when(executionEnvironment.getBlock()).thenReturn(world.getBlockChain().getBestBlock());
    return executionEnvironment;
}
Also used : ExecutionEnvironment(co.rsk.pcc.ExecutionEnvironment) World(co.rsk.test.World) TestSystemProperties(co.rsk.config.TestSystemProperties)

Example 2 with ExecutionEnvironment

use of co.rsk.pcc.ExecutionEnvironment in project rskj by rsksmart.

the class GetMultisigScriptHashTest method createMethod.

@Before
public void createMethod() {
    ExecutionEnvironment executionEnvironment = mock(ExecutionEnvironment.class);
    method = new GetMultisigScriptHash(executionEnvironment);
}
Also used : ExecutionEnvironment(co.rsk.pcc.ExecutionEnvironment) Before(org.junit.Before)

Example 3 with ExecutionEnvironment

use of co.rsk.pcc.ExecutionEnvironment in project rskj by rsksmart.

the class ToBase58CheckTest method createMethod.

@Before
public void createMethod() {
    ExecutionEnvironment executionEnvironment = mock(ExecutionEnvironment.class);
    method = new ToBase58Check(executionEnvironment);
}
Also used : ExecutionEnvironment(co.rsk.pcc.ExecutionEnvironment) Before(org.junit.Before)

Example 4 with ExecutionEnvironment

use of co.rsk.pcc.ExecutionEnvironment in project rskj by rsksmart.

the class BlockAccessorTest method getTenBlocksFromTheTip.

@Test
public void getTenBlocksFromTheTip() throws NativeContractIllegalArgumentException {
    ExecutionEnvironment executionEnvironment = EnvironmentUtils.getEnvironmentWithBlockchainOfLength(100);
    for (short i = 0; i < 10; i++) {
        Optional<Block> block = blockAccessor.getBlock(i, executionEnvironment);
        Assert.assertTrue(block.isPresent());
        Assert.assertEquals(99 - i, block.get().getNumber());
    }
}
Also used : ExecutionEnvironment(co.rsk.pcc.ExecutionEnvironment) Block(org.ethereum.core.Block) Test(org.junit.Test)

Example 5 with ExecutionEnvironment

use of co.rsk.pcc.ExecutionEnvironment in project rskj by rsksmart.

the class HDWalletUtilsTest method createContract.

@Before
public void createContract() {
    RskSystemProperties config = new TestSystemProperties();
    ExecutionEnvironment executionEnvironment = mock(ExecutionEnvironment.class);
    contract = spy(new HDWalletUtils(config.getActivationConfig(), new RskAddress("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")));
    when(contract.getExecutionEnvironment()).thenReturn(executionEnvironment);
}
Also used : ExecutionEnvironment(co.rsk.pcc.ExecutionEnvironment) RskAddress(co.rsk.core.RskAddress) RskSystemProperties(co.rsk.config.RskSystemProperties) TestSystemProperties(co.rsk.config.TestSystemProperties) Before(org.junit.Before)

Aggregations

ExecutionEnvironment (co.rsk.pcc.ExecutionEnvironment)9 Before (org.junit.Before)6 TestSystemProperties (co.rsk.config.TestSystemProperties)3 World (co.rsk.test.World)2 Block (org.ethereum.core.Block)2 Test (org.junit.Test)2 RskSystemProperties (co.rsk.config.RskSystemProperties)1 RskAddress (co.rsk.core.RskAddress)1 ActivationConfig (org.ethereum.config.blockchain.upgrades.ActivationConfig)1 ECKey (org.ethereum.crypto.ECKey)1 PrecompiledContracts (org.ethereum.vm.PrecompiledContracts)1