use of org.aion.precompiled.ContractFactory in project aion by aionnetwork.
the class EDVerifyContractTest method emptyInputTest.
@Test
public void emptyInputTest() {
byte[] input = new byte[128];
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(), pubKey));
}
use of org.aion.precompiled.ContractFactory in project aion by aionnetwork.
the class EDVerifyContractTest method emptyInputTest.
@Test
public void emptyInputTest() {
byte[] input = new byte[128];
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));
}
use of org.aion.precompiled.ContractFactory 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));
}
Aggregations