Search in sources :

Example 1 with MerkleTopic

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);
}
Also used : MerkleTopic(com.hedera.services.state.merkle.MerkleTopic) RichInstant(com.hedera.services.state.submerkle.RichInstant) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with MerkleTopic

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);
}
Also used : MerkleTopic(com.hedera.services.state.merkle.MerkleTopic) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with MerkleTopic

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);
}
Also used : MerkleTopic(com.hedera.services.state.merkle.MerkleTopic) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with MerkleTopic

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());
}
Also used : MerkleTopic(com.hedera.services.state.merkle.MerkleTopic)

Example 5 with 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());
}
Also used : MerkleTopic(com.hedera.services.state.merkle.MerkleTopic)

Aggregations

MerkleTopic (com.hedera.services.state.merkle.MerkleTopic)13 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 Test (org.junit.jupiter.api.Test)4 EntityId (com.hedera.services.state.submerkle.EntityId)3 RichInstant (com.hedera.services.state.submerkle.RichInstant)3 EntityNum (com.hedera.services.utils.EntityNum)2 CsvSource (org.junit.jupiter.params.provider.CsvSource)2 NetworkInfo (com.hedera.services.config.NetworkInfo)1 MutableStateChildren (com.hedera.services.context.MutableStateChildren)1 HFileMeta (com.hedera.services.files.HFileMeta)1 JKeyList (com.hedera.services.legacy.core.jproto.JKeyList)1 MerkleAccount (com.hedera.services.state.merkle.MerkleAccount)1 MerkleSpecialFiles (com.hedera.services.state.merkle.MerkleSpecialFiles)1 MerkleToken (com.hedera.services.state.merkle.MerkleToken)1 MerkleTokenRelStatus (com.hedera.services.state.merkle.MerkleTokenRelStatus)1 ContractKey (com.hedera.services.state.virtual.ContractKey)1 ContractValue (com.hedera.services.state.virtual.ContractValue)1 VirtualBlobKey (com.hedera.services.state.virtual.VirtualBlobKey)1 VirtualBlobValue (com.hedera.services.state.virtual.VirtualBlobValue)1 ScheduleStore (com.hedera.services.store.schedule.ScheduleStore)1