use of com.hedera.services.state.merkle.MerkleTopic in project hedera-services by hashgraph.
the class GetMerkleTopicInfoResourceUsageTest method feeDataAsExpected.
@ParameterizedTest
@CsvSource({ ", , , , 236, 112", // bpr += memo size(8)
"abcdefgh, , , , 236, 120", // bpr += 32
"abcdefgh, 0000000000000000000000000000000000000000000000000000000000000000, , , 236, 152", // for admin key
"abcdefgh, 0000000000000000000000000000000000000000000000000000000000000000, " + // bpr += 32 for
"1111111111111111111111111111111111111111111111111111111111111111, , 236, 184", // submit key
"abcdefgh, 0000000000000000000000000000000000000000000000000000000000000000, " + // bpr += 24
"1111111111111111111111111111111111111111111111111111111111111111, 0.1.2, 236, 208" // for auto renew account
})
void feeDataAsExpected(final String memo, @ConvertWith(JEd25519KeyConverter.class) final JEd25519Key adminKey, @ConvertWith(JEd25519KeyConverter.class) final JEd25519Key submitKey, @ConvertWith(EntityIdConverter.class) final EntityId autoRenewAccountId, // query header + topic id size
final int expectedBpt, // query response header + topic id size + topic info size
final int expectedBpr) {
final var merkleTopic = new MerkleTopic(memo, adminKey, submitKey, 0, autoRenewAccountId, new RichInstant(1, 0));
final var expectedFeeData = FeeData.newBuilder().setNodedata(FeeComponents.newBuilder().setConstant(1).setBpt(expectedBpt).setBpr(expectedBpr).build()).setNetworkdata(FeeComponents.getDefaultInstance()).setServicedata(FeeComponents.getDefaultInstance()).build();
given(topics.get(EntityNum.fromTopicId(topicId))).willReturn(merkleTopic);
final var costAnswerEstimate = subject.usageGiven(topicInfoQuery(topicId, COST_ANSWER), view);
final var answerOnlyEstimate = subject.usageGiven(topicInfoQuery(topicId, ANSWER_ONLY), view);
assertEquals(expectedFeeData, costAnswerEstimate);
assertEquals(expectedFeeData, answerOnlyEstimate);
}
use of com.hedera.services.state.merkle.MerkleTopic in project hedera-services by hashgraph.
the class MerkleTopicTest method equalsNull.
@Test
void equalsNull() {
final var equalsForcedCallResult = new MerkleTopic().equals(null);
assertFalse(equalsForcedCallResult);
}
use of com.hedera.services.state.merkle.MerkleTopic in project hedera-services by hashgraph.
the class MerkleTopicTest method copyConstructorWithDefaultsTestingAccessors.
@Test
void copyConstructorWithDefaultsTestingAccessors() {
final var topic = new MerkleTopic(new MerkleTopic());
assertDefaultTopicAccessors(topic);
}
use of com.hedera.services.state.merkle.MerkleTopic in project hedera-services by hashgraph.
the class MerkleTopicDeleteTransitionLogicTest method givenTransactionContextNoAdminKey.
private void givenTransactionContextNoAdminKey() {
givenTransaction(getBasicValidTransactionBodyBuilder());
given(validator.queryableTopicStatus(asTopic(TOPIC_ID), topics)).willReturn(OK);
topics.put(fromTopicId(asTopic(TOPIC_ID)), new MerkleTopic());
}
use of com.hedera.services.state.merkle.MerkleTopic in project hedera-services by hashgraph.
the class SubmitMessageTransitionLogicTest method givenTransactionContextNoMessage.
private void givenTransactionContextNoMessage() {
givenTransaction(ConsensusSubmitMessageTransactionBody.newBuilder().setTopicID(asTopic(TOPIC_ID)).setTopicID(asTopic(TOPIC_ID)));
given(validator.queryableTopicStatus(asTopic(TOPIC_ID), topics)).willReturn(OK);
topics.put(EntityNum.fromTopicId(asTopic(TOPIC_ID)), new MerkleTopic());
}
Aggregations