Search in sources :

Example 11 with PrecompiledContract

use of org.aion.precompiled.type.PrecompiledContract in project aion by aionnetwork.

the class EDVerifyContractTest method shouldReturnSuccessTestingWith256.

@Test
public void shouldReturnSuccessTestingWith256() {
    byte[] input = setupInput();
    PrecompiledTransactionContext ctx = new PrecompiledTransactionContext(ContractInfo.ED_VERIFY.contractAddress, origin, caller, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), txHash, txHash, blockNumber, nrgLimit, depth);
    PrecompiledContract contract = new ContractFactory().getPrecompiledContract(ctx, externalStateForTests);
    assertNotNull(contract);
    PrecompiledTransactionResult result = contract.execute(input, 21000L);
    assertThat(result.getStatus().isSuccess());
    assertThat(Arrays.equals(result.getReturnData(), ownerAddr));
}
Also used : PrecompiledContract(org.aion.precompiled.type.PrecompiledContract) PrecompiledTransactionResult(org.aion.precompiled.PrecompiledTransactionResult) PrecompiledTransactionContext(org.aion.precompiled.type.PrecompiledTransactionContext) ContractFactory(org.aion.precompiled.ContractFactory) Test(org.junit.Test)

Aggregations

PrecompiledContract (org.aion.precompiled.type.PrecompiledContract)11 PrecompiledTransactionContext (org.aion.precompiled.type.PrecompiledTransactionContext)11 Test (org.junit.Test)11 ContractFactory (org.aion.precompiled.ContractFactory)10 PrecompiledTransactionResult (org.aion.precompiled.PrecompiledTransactionResult)10 ExternalStateForTests (org.aion.zero.impl.precompiled.ExternalStateForTests)1