use of com.hederahashgraph.api.proto.java.ContractCallTransactionBody in project hedera-services by hashgraph.
the class SmartContractFeeBuilder method getContractCallBodyTxSize.
/**
* This method returns total bytes in Contract Call body Transaction
*/
private int getContractCallBodyTxSize(TransactionBody txBody) {
/*
* ContractID contractID - BASIC_ENTITY_ID_SIZE int64 gas - LONG_SIZE int64 amount - LONG_SIZE bytes
* functionParameters - calculated value
*
*/
int contractCallBodySize = BASIC_ACCOUNT_SIZE + LONG_SIZE;
ContractCallTransactionBody contractCallTxBody = txBody.getContractCall();
if (contractCallTxBody.getFunctionParameters() != null) {
contractCallBodySize += contractCallTxBody.getFunctionParameters().size();
}
if (contractCallTxBody.getAmount() != 0) {
contractCallBodySize += LONG_SIZE;
}
return contractCallBodySize;
}
use of com.hederahashgraph.api.proto.java.ContractCallTransactionBody in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerContractTest method assertContractCallResult.
private void assertContractCallResult(ContractCallTransactionBody transactionBody, TransactionRecord record) {
long consensusTimestamp = DomainUtils.timestampInNanosMax(record.getConsensusTimestamp());
ContractFunctionResult result = record.getContractCallResult();
// get the corresponding entity id from the local cache, fall back to parseContractId if not found.
ContractID protoContractId = record.getContractCallResult().getContractID();
EntityId contractId = contractIds.getOrDefault(protoContractId, parseContractId(protoContractId));
ObjectAssert<ContractResult> contractResult = assertThat(contractResultRepository.findAll()).filteredOn(c -> c.getConsensusTimestamp().equals(consensusTimestamp)).hasSize(1).first().returns(transactionBody.getAmount(), ContractResult::getAmount).returns(contractId, ContractResult::getContractId).returns(consensusTimestamp, ContractResult::getConsensusTimestamp).returns(toBytes(transactionBody.getFunctionParameters()), ContractResult::getFunctionParameters).returns(transactionBody.getGas(), ContractResult::getGasLimit);
assertContractResult(consensusTimestamp, result, result.getLogInfoList(), contractResult, result.getStateChangesList());
}
Aggregations