use of co.rsk.pcc.ExecutionEnvironment in project rskj by rsksmart.
the class DeriveExtendedPublicKeyTest method createMethod.
@Before
public void createMethod() {
ExecutionEnvironment executionEnvironment = mock(ExecutionEnvironment.class);
HDWalletUtilsHelper helper = new HDWalletUtilsHelper();
method = new DeriveExtendedPublicKey(executionEnvironment, helper);
}
use of co.rsk.pcc.ExecutionEnvironment in project rskj by rsksmart.
the class ExtractPublicKeyFromExtendedPublicKeyTest method createMethod.
@Before
public void createMethod() {
ExecutionEnvironment executionEnvironment = mock(ExecutionEnvironment.class);
HDWalletUtilsHelper helper = new HDWalletUtilsHelper();
method = new ExtractPublicKeyFromExtendedPublicKey(executionEnvironment, helper);
}
use of co.rsk.pcc.ExecutionEnvironment in project rskj by rsksmart.
the class BlockHeaderContractTest method setUp.
@Before
public void setUp() {
config = new TestSystemProperties();
blockFactory = new BlockFactory(config.getActivationConfig());
PrecompiledContracts precompiledContracts = new PrecompiledContracts(config, null);
ActivationConfig.ForBlock activations = mock(ActivationConfig.ForBlock.class);
// Enabling necessary RSKIPs for every precompiled contract to be available
when(activations.isActive(ConsensusRule.RSKIP119)).thenReturn(true);
world = new World();
contract = (BlockHeaderContract) precompiledContracts.getContractForAddress(activations, DataWord.valueFromHex(BLOCK_HEADER_CONTRACT_ADDRESS));
// contract methods
getCoinbaseFunction = getContractFunction(contract, GetCoinbaseAddress.class);
getMinGasPriceFunction = getContractFunction(contract, GetMinimumGasPrice.class);
getBlockHashFunction = getContractFunction(contract, GetBlockHash.class);
getMergedMiningTagsFunction = getContractFunction(contract, GetMergedMiningTags.class);
getGasLimitFunction = getContractFunction(contract, GetGasLimit.class);
getGasUsedFunction = getContractFunction(contract, GetGasUsed.class);
getDifficultyFunction = getContractFunction(contract, GetDifficulty.class);
getBitcoinHeaderFunction = getContractFunction(contract, GetBitcoinHeader.class);
getUncleCoinbaseAddressFunction = getContractFunction(contract, GetUncleCoinbaseAddress.class);
// invoke transaction
rskTx = Transaction.builder().nonce(NONCE).gasPrice(GAS_PRICE).gasLimit(GAS_LIMIT).destination(Hex.decode(PrecompiledContracts.BLOCK_HEADER_ADDR_STR)).data(Hex.decode(DATA)).chainId(Constants.REGTEST_CHAIN_ID).value(AMOUNT).build();
rskTx.sign(new ECKey().getPrivKeyBytes());
executionEnvironment = mock(ExecutionEnvironment.class);
Whitebox.setInternalState(contract, "executionEnvironment", executionEnvironment);
}
use of co.rsk.pcc.ExecutionEnvironment in project rskj by rsksmart.
the class BlockAccessorTest method getGenesisBlock.
@Test
public void getGenesisBlock() throws NativeContractIllegalArgumentException {
ExecutionEnvironment executionEnvironment = EnvironmentUtils.getEnvironmentWithBlockchainOfLength(1);
Optional<Block> genesis = blockAccessor.getBlock(ZERO_BLOCK_DEPTH, executionEnvironment);
Optional<Block> firstBlock = blockAccessor.getBlock(ONE_BLOCK_DEPTH, executionEnvironment);
Assert.assertTrue(genesis.isPresent());
Assert.assertFalse(firstBlock.isPresent());
Assert.assertEquals(0, genesis.get().getNumber());
}
Aggregations