use of com.hedera.services.state.merkle.MerkleTopic in project hedera-services by hashgraph.
the class SubmitMessageTransitionLogicTest method givenChunkMessage.
private void givenChunkMessage(int totalChunks, int chunkNumber, TransactionID initialTransactionID) {
ConsensusMessageChunkInfo chunkInfo = ConsensusMessageChunkInfo.newBuilder().setInitialTransactionID(initialTransactionID).setTotal(totalChunks).setNumber(chunkNumber).build();
givenTransaction(getBasicValidTransactionBodyBuilder().setChunkInfo(chunkInfo));
given(validator.queryableTopicStatus(asTopic(TOPIC_ID), topics)).willReturn(OK);
topics.put(EntityNum.fromTopicId(asTopic(TOPIC_ID)), new MerkleTopic());
}
use of com.hedera.services.state.merkle.MerkleTopic in project hedera-services by hashgraph.
the class UpdateMerkleTopicResourceUsageTest method getFeeThrowsExceptionForBadKeys.
@Test
void getFeeThrowsExceptionForBadKeys() throws DecoderException, IllegalArgumentException {
final var txnBody = makeTransactionBody(topicId, defaultMemo, JKey.mapJKey(adminKey), JKey.mapJKey(submitKey), IdUtils.asAccount("0.1.2"), null, null);
final var merkleTopic = new MerkleTopic(defaultMemo, adminKey, submitKey, 0, new EntityId(0, 1, 2), new RichInstant(36_000, 0));
given(topics.get(EntityNum.fromTopicId(topicId))).willReturn(merkleTopic);
final var mockedJkey = mockStatic(JKey.class);
mockedJkey.when(() -> JKey.mapJKey(any())).thenThrow(new DecoderException());
assertThrows(InvalidTxBodyException.class, () -> subject.usageGiven(txnBody, sigValueObj, view));
assertThat(logCaptor.warnLogs(), Matchers.contains(Matchers.startsWith("Usage estimation unexpectedly failed for")));
mockedJkey.close();
}
use of com.hedera.services.state.merkle.MerkleTopic in project hedera-services by hashgraph.
the class SubmitMessageTransitionLogicTest method givenValidTransactionContext.
private void givenValidTransactionContext() {
givenTransaction(getBasicValidTransactionBodyBuilder());
given(validator.queryableTopicStatus(asTopic(TOPIC_ID), topics)).willReturn(OK);
topics.put(EntityNum.fromTopicId(asTopic(TOPIC_ID)), new MerkleTopic());
}
use of com.hedera.services.state.merkle.MerkleTopic in project hedera-services by hashgraph.
the class GetTopicInfoAnswer method checkValidity.
@Override
public ResponseCodeEnum checkValidity(Query query, StateView view) {
MerkleMap<EntityNum, MerkleTopic> topics = view.topics();
ConsensusGetTopicInfoQuery op = query.getConsensusGetTopicInfo();
return validityOf(op, topics);
}
use of com.hedera.services.state.merkle.MerkleTopic in project hedera-services by hashgraph.
the class MerkleTopicTest method equalsViaCopy.
@ParameterizedTest
@CsvSource({ "memo, 0000000000000000000000000000000000000000000000000000000000000000, " + "1111111111111111111111111111111111111111111111111111111111111111, 2, 3.4.5, 6666_777777777", ", , , 0, , 0_0" })
void equalsViaCopy(final String memo, @ConvertWith(JEd25519KeyConverter.class) final JEd25519Key adminKey, @ConvertWith(JEd25519KeyConverter.class) final JEd25519Key submitKey, final long autoRenewDurationSeconds, @ConvertWith(EntityIdConverter.class) final EntityId autoRenewAccountId, @ConvertWith(RichInstantConverter.class) final RichInstant expirationTimestamp) {
final var topic = new MerkleTopic(memo, adminKey, submitKey, autoRenewDurationSeconds, autoRenewAccountId, expirationTimestamp);
assertEquals(topic, new MerkleTopic(topic));
}
Aggregations