use of com.hederahashgraph.api.proto.java.ContractFunctionResult in project hedera-mirror-node by hashgraph.
the class ContractResultMigrationTest method migrate.
@SuppressWarnings("deprecation")
@Test
void migrate() throws Exception {
ContractFunctionResult.Builder functionResult = contractFunctionResult();
MigrationContractResult contractResult = contractResult(functionResult);
insert(contractResult);
contractResultMigration.doMigrate();
ContractLoginfo loginfo = functionResult.getLogInfo(0);
assertThat(getContractLogs()).hasSize(1).first().returns(loginfo.getBloom().toByteArray(), MigrationContractLog::getBloom).returns(contractResult.getConsensusTimestamp(), MigrationContractLog::getConsensusTimestamp).returns(loginfo.getContractID().getContractNum(), MigrationContractLog::getContractId).returns(0, MigrationContractLog::getIndex).returns(Hex.encodeHexString(loginfo.getTopic(0).toByteArray()), MigrationContractLog::getTopic0).returns(Hex.encodeHexString(loginfo.getTopic(1).toByteArray()), MigrationContractLog::getTopic1).returns(Hex.encodeHexString(loginfo.getTopic(2).toByteArray()), MigrationContractLog::getTopic2).returns(Hex.encodeHexString(loginfo.getTopic(3).toByteArray()), MigrationContractLog::getTopic3);
assertThat(getContractResults()).hasSize(1).first().returns(functionResult.getBloom().toByteArray(), MigrationContractResult::getBloom).returns(contractResult.getConsensusTimestamp(), MigrationContractResult::getConsensusTimestamp).returns(functionResult.getContractCallResult().toByteArray(), MigrationContractResult::getCallResult).returns(functionResult.getContractID().getContractNum(), MigrationContractResult::getContractId).returns(functionResult.getErrorMessage(), MigrationContractResult::getErrorMessage).returns(functionResult.getCreatedContractIDsList().stream().map(EntityId::of).map(EntityId::getId).toArray(Long[]::new), MigrationContractResult::getCreatedContractIds);
}
use of com.hederahashgraph.api.proto.java.ContractFunctionResult in project hedera-mirror-node by hashgraph.
the class ContractResultMigrationTest method migrateWhenEmptyTopic.
@Test
void migrateWhenEmptyTopic() throws Exception {
ContractFunctionResult.Builder functionResult = contractFunctionResult();
functionResult.setLogInfo(0, functionResult.getLogInfoBuilder(0).clearTopic().addTopic(ByteString.copyFrom(new byte[0])));
MigrationContractResult contractResult = contractResult(functionResult);
insert(contractResult);
contractResultMigration.doMigrate();
assertThat(getContractLogs()).hasSize(1).first().returns("", MigrationContractLog::getTopic0).returns(null, MigrationContractLog::getTopic1).returns(null, MigrationContractLog::getTopic2).returns(null, MigrationContractLog::getTopic3);
}
use of com.hederahashgraph.api.proto.java.ContractFunctionResult in project hedera-mirror-node by hashgraph.
the class ContractResultMigrationTest method migrateWhenEmptyContractIDs.
@Test
void migrateWhenEmptyContractIDs() throws Exception {
ContractFunctionResult.Builder functionResult = contractFunctionResult().clearContractID().clearCreatedContractIDs().addCreatedContractIDs(ContractID.getDefaultInstance());
MigrationContractResult contractResult = contractResult(functionResult);
insert(contractResult);
contractResultMigration.doMigrate();
assertThat(getContractResults()).hasSize(1).first().returns(null, MigrationContractResult::getContractId).returns(new Long[] { null }, MigrationContractResult::getCreatedContractIds);
}
use of com.hederahashgraph.api.proto.java.ContractFunctionResult in project hedera-mirror-node by hashgraph.
the class ContractResultServiceImplIntegrationTest method contractResultZeroLogs.
@Test
void contractResultZeroLogs() {
RecordItem recordItem = recordItemBuilder.contractCall().record(x -> x.setContractCallResult(recordItemBuilder.contractFunctionResult(CONTRACT_ID).clearLogInfo())).build();
ContractFunctionResult contractFunctionResult = recordItem.getRecord().getContractCallResult();
contractResultsTest(recordItem, contractFunctionResult);
}
use of com.hederahashgraph.api.proto.java.ContractFunctionResult in project hedera-mirror-node by hashgraph.
the class ContractResultServiceImplIntegrationTest method getContractResultOnCall.
@Test
void getContractResultOnCall() {
RecordItem recordItem = recordItemBuilder.contractCall().build();
ContractFunctionResult contractFunctionResult = recordItem.getRecord().getContractCallResult();
contractResultsTest(recordItem, contractFunctionResult);
}
Aggregations