Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add message submit tests 129-145 #17022

Merged
merged 124 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
98a7ac9
Topic get info changes
ibankov Sep 5, 2024
a1e1257
add temporary fix for topic update unit test
ibankov Sep 5, 2024
36d7f4b
Update documentation on protobuf changes
kimbor Sep 8, 2024
dca8c74
Add custom fees to ConsensusCreateTopicHandler
JivkoKelchev Sep 9, 2024
773cbcd
Refactor
JivkoKelchev Sep 10, 2024
e67f50b
consensus custom fee builders and asserts for hapi tests
JivkoKelchev Sep 10, 2024
b9c05bd
Topic create hapi tests
JivkoKelchev Sep 10, 2024
3e4c95f
Merge branch 'refs/heads/develop' into hip-991-topic-fees-get-info
JivkoKelchev Sep 10, 2024
8f48c49
Merge branch 'refs/heads/hip-991-topic-fees-get-info' into hip-991-to…
JivkoKelchev Sep 10, 2024
960cae5
Fix checkModuleDirectivesScope error
JivkoKelchev Sep 10, 2024
a97d4ca
Use copyBuilder()
JivkoKelchev Sep 10, 2024
80c29cb
Fix indentation
JivkoKelchev Sep 10, 2024
54bf31d
Topic create hapi tests
JivkoKelchev Sep 11, 2024
904afa8
Update protobuf messages
JivkoKelchev Sep 11, 2024
3508749
Update protobufs specification text
JivkoKelchev Sep 12, 2024
b695b0d
Merge branch 'refs/heads/hip-991-topic-fees-get-info' into hip-991-to…
JivkoKelchev Sep 12, 2024
a720252
Replace FMLK with FEKL in HapiGetTopicInfo
JivkoKelchev Sep 12, 2024
ee8e728
Merge branch 'refs/heads/hip-991-topic-fees-get-info' into hip-991-to…
JivkoKelchev Sep 12, 2024
0f9a897
Replace FMLK with FEKL in HapiGetTopicInfo
JivkoKelchev Sep 12, 2024
e52365f
Add FEKL and custom fee amount validation
JivkoKelchev Sep 13, 2024
c54f1f5
fix tests
JivkoKelchev Sep 15, 2024
63687f0
spotless
JivkoKelchev Sep 15, 2024
b00e1e8
Merge branch 'refs/heads/hip-991-topic-fees' into hip-991-topic-fees-…
JivkoKelchev Sep 17, 2024
c339784
fix merge conflicts
JivkoKelchev Sep 17, 2024
25ee202
Topic allowances protobufs
ibankov Sep 17, 2024
0ed094c
extend protobufs
ibankov Sep 19, 2024
9ddc6a1
consensus approve allowance proto
ibankov Sep 19, 2024
f473cbb
consensus approve allowance handler
ibankov Sep 19, 2024
11b7bb4
api permissions config
ibankov Sep 19, 2024
1ed4d19
validator and unit tests
ibankov Sep 19, 2024
d620eb6
fix protos and add builders
ibankov Sep 19, 2024
ee2a6b4
fix indentation
ibankov Sep 19, 2024
54afd45
improving descriptions of allowance lists
ibankov Sep 19, 2024
f4cf054
add further documentation
ibankov Sep 19, 2024
c2fdf52
Add grcp endpoint
ibankov Sep 19, 2024
af5e2e3
addressing PR comments
ibankov Sep 20, 2024
34dba09
Merge branch 'hip-991-approve-allowance-proto' into hip-991-allowance…
ibankov Sep 24, 2024
b7c2e84
approve allowance initial commit
ibankov Sep 26, 2024
6633fb8
fix scope
ibankov Sep 26, 2024
32b35c3
add some unit tests
ibankov Sep 26, 2024
9c1f8e9
submit msg
JivkoKelchev Sep 27, 2024
14af58b
Merge branch 'refs/heads/hip-991-allowance-transaction' into hip-991-…
JivkoKelchev Sep 30, 2024
c32fba1
Add hapi tests
JivkoKelchev Sep 30, 2024
ff651bc
Add unit tests and reject contracts
ibankov Oct 1, 2024
38bd23d
Merge branch 'refs/heads/hip-991-allowance-transaction' into hip-991-…
JivkoKelchev Oct 1, 2024
5fec8e3
Split crypto dispatches if we have to many transfers
JivkoKelchev Oct 1, 2024
145a04f
Hapi tests, custom fee assessor refactoring
JivkoKelchev Oct 8, 2024
8598691
Refactor
JivkoKelchev Oct 8, 2024
78c8748
Add hapi tests
JivkoKelchev Oct 8, 2024
dea8af1
Fix tests
JivkoKelchev Oct 10, 2024
ab6ce39
submit msg
JivkoKelchev Sep 27, 2024
b1f07bc
Add hapi tests
JivkoKelchev Sep 30, 2024
83f37e2
Split crypto dispatches if we have to many transfers
JivkoKelchev Oct 1, 2024
5e6d71f
Hapi tests, custom fee assessor refactoring
JivkoKelchev Oct 8, 2024
2cca738
Refactor
JivkoKelchev Oct 8, 2024
44ff622
Add hapi tests
JivkoKelchev Oct 8, 2024
3ef8877
Fix tests
JivkoKelchev Oct 10, 2024
f1de34a
feat: Add custom fees to ConsensusCreateTopicHandler (#15402)
JivkoKelchev Oct 3, 2024
becfa7e
feat: Update ConsensusUpdateTopicHandler with new custom fee function…
vtronkov Oct 3, 2024
cc1d011
fix merge conflict
JivkoKelchev Dec 5, 2024
10dc471
Merge remote-tracking branch 'origin/hip-991-submit-message' into hip…
JivkoKelchev Dec 5, 2024
7483da7
Remove allowances
JivkoKelchev Dec 5, 2024
158ab5b
Remove allowances
JivkoKelchev Dec 5, 2024
fa0445f
Remove allowances
JivkoKelchev Dec 5, 2024
ca60528
Remove allowances
JivkoKelchev Dec 6, 2024
d428b8c
Revert ConsensusCreateTopicHandler
JivkoKelchev Dec 6, 2024
7d5da3a
Remove allowances
JivkoKelchev Dec 6, 2024
ecc3e93
Merge branch 'refs/heads/hip-991-topic-fees' into hip-991-submit-message
JivkoKelchev Dec 6, 2024
e222736
Fix merge conflicts
JivkoKelchev Dec 6, 2024
a0446e0
Revert changes
JivkoKelchev Dec 9, 2024
db637af
Fix dispatching of child transfers
JivkoKelchev Dec 9, 2024
d1b1714
fix unit tests
JivkoKelchev Dec 9, 2024
d472977
Add max_custom_fees and accept_all_custom_fees
JivkoKelchev Dec 10, 2024
2570e43
Revert unnecessary changes
JivkoKelchev Dec 10, 2024
ae381ba
Refactor custom fee validations
JivkoKelchev Dec 10, 2024
0705691
Cleanup
JivkoKelchev Dec 10, 2024
51c7183
add CUSTOM_FEES_LIMIT_EXCEEDED status code
JivkoKelchev Dec 11, 2024
1dfd412
Merge branch 'refs/heads/hip-991-topic-fees' into hip-991-submit-message
JivkoKelchev Dec 11, 2024
5a6f72c
Simplify the fee assessment
JivkoKelchev Dec 11, 2024
9a3c4e1
Add message submit tests 129-145
ibankov Dec 11, 2024
02b3fc9
asdd
ibankov Dec 11, 2024
7773580
spot
ibankov Dec 11, 2024
22de1f8
description
ibankov Dec 11, 2024
4a9f444
Add unit test
JivkoKelchev Dec 11, 2024
b548295
fix module-info.java
JivkoKelchev Dec 12, 2024
5f0acd2
fix module-info.java
JivkoKelchev Dec 12, 2024
7ddd522
fix limit comparison
JivkoKelchev Dec 12, 2024
5c1b466
Merge branch 'hip-991-submit-message' into hip-991-submit-message-129…
ibankov Dec 13, 2024
29dfbba
revert HapiTopicCreate changes
JivkoKelchev Dec 13, 2024
44f9842
Fee limits additional validations
JivkoKelchev Dec 16, 2024
2be0067
Fee limits additional validations
JivkoKelchev Dec 16, 2024
ac943c5
fixed fee limit validation
ibankov Dec 16, 2024
b2dc290
Merge branch 'hip-991-submit-message' into hip-991-submit-message-129…
ibankov Dec 16, 2024
b103957
Merge branch 'hip-991-topic-fees' into hip-991-submit-message
ibankov Dec 17, 2024
c2c4f48
Remove draft test
JivkoKelchev Dec 17, 2024
3afeacd
Filter only payable fees and use this list for limit validation and c…
JivkoKelchev Dec 19, 2024
1379127
Merge branch 'refs/heads/hip-991-topic-fees' into hip-991-submit-message
JivkoKelchev Dec 19, 2024
a9d333a
Fix docs
JivkoKelchev Dec 19, 2024
d9fab19
Merge branch 'hip-991-topic-fees' into hip-991-submit-message
ibankov Jan 2, 2025
28a8f2f
Merge branch 'hip-991-topic-fees' into hip-991-submit-message
ibankov Jan 2, 2025
e236632
spotless
ibankov Jan 2, 2025
42abcdc
Merge branch 'hip-991-submit-message' into hip-991-submit-message-129…
ibankov Jan 2, 2025
2c5413d
Replace FEKL keys validation
JivkoKelchev Jan 6, 2025
c0880ab
Merge remote-tracking branch 'origin/hip-991-submit-message' into hip…
JivkoKelchev Jan 6, 2025
29da0fb
Replace FEKL keys validation
JivkoKelchev Jan 6, 2025
700acbc
Fix unit tests
JivkoKelchev Jan 6, 2025
07d571e
Added more coverage
ibankov Jan 6, 2025
35bac65
java doc
ibankov Jan 7, 2025
aa773a6
Update protobufs
JivkoKelchev Jan 10, 2025
ad28cb8
Merge branch 'refs/heads/hip-991-protobuf-changes' into hip-991-submi…
JivkoKelchev Jan 10, 2025
063d698
Update protobufs
JivkoKelchev Jan 10, 2025
abb9118
Update doc
JivkoKelchev Jan 13, 2025
eae0d98
Merge branch 'refs/heads/hip-991-protobuf-changes' into hip-991-submi…
JivkoKelchev Jan 14, 2025
178b878
Merge branch 'hip-991-submit-message' into hip-991-submit-message-129…
ibankov Jan 14, 2025
a616404
Change ordinal of CustomFeeLimit according to HIP changes
JivkoKelchev Jan 14, 2025
9e70e55
Merge branch 'refs/heads/hip-991-protobuf-changes' into hip-991-submi…
JivkoKelchev Jan 14, 2025
8960c6c
Merge branch 'hip-991-submit-message' into hip-991-submit-message-129…
ibankov Jan 14, 2025
bd148f4
fix tests
ibankov Jan 14, 2025
0adfdbe
fix test name
ibankov Jan 14, 2025
d64317c
Merge branch 'refs/heads/hip-991-topic-fees' into hip-991-protobuf-ch…
JivkoKelchev Jan 14, 2025
45fb7a9
Merge branch 'refs/heads/hip-991-protobuf-changes' into hip-991-submi…
JivkoKelchev Jan 14, 2025
061420e
Merge branch 'hip-991-submit-message' into hip-991-submit-message-129…
ibankov Jan 14, 2025
71bf501
Merge branch 'hip-991-topic-fees' into hip-991-submit-message-129-145
ibankov Jan 20, 2025
7470de9
merge conflicts
ibankov Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update protobufs
Signed-off-by: Zhivko Kelchev <zhivko.kelchev@limechain.tech>
  • Loading branch information
JivkoKelchev committed Jan 10, 2025
commit 063d69871723c738f92a4cb20af1382fc32fe929
11 changes: 0 additions & 11 deletions hapi/hedera-protobufs/services/consensus_submit_message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ option java_package = "com.hederahashgraph.api.proto.java";
option java_multiple_files = true;

import "basic_types.proto";
import "custom_fees.proto";

/**
* Consensus message "chunk" detail.<br/>
Expand Down Expand Up @@ -108,14 +107,4 @@ message ConsensusSubmitMessageTransactionBody {
* field SHOULD NOT be set.
*/
ConsensusMessageChunkInfo chunkInfo = 3;

/**
* The maximum custom fee that the user is willing to pay for the message. This field will be ignored if `accept_all_custom_fees` is set to `true`.
*/
repeated FixedFee max_custom_fees = 4;

/**
* If set to true, the transaction will accept all custom fees from the topic id
*/
bool accept_all_custom_fees = 5;
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
import com.hedera.hapi.node.base.TransactionID;
import com.hedera.hapi.node.consensus.ConsensusSubmitMessageTransactionBody;
import com.hedera.hapi.node.state.consensus.Topic;
import com.hedera.hapi.node.transaction.ConsensusCustomFee;
import com.hedera.hapi.node.transaction.FixedFee;
import com.hedera.hapi.node.transaction.CustomFeeLimit;
import com.hedera.hapi.node.transaction.FixedCustomFee;
import com.hedera.hapi.node.transaction.TransactionBody;
import com.hedera.node.app.hapi.utils.CommonPbjConverters;
import com.hedera.node.app.service.consensus.ReadableTopicStore;
Expand Down Expand Up @@ -160,8 +160,8 @@
final var feesToBeCharged = extractFeesToBeCharged(topic.customFees(), handleContext);

// check payer limits or throw
if (!op.acceptAllCustomFees()) {
validateFeeLimits(feesToBeCharged, op.maxCustomFees());
if (!txn.maxCustomFees().isEmpty()) {
validateFeeLimits(handleContext.payer(), feesToBeCharged, txn.maxCustomFees());
}

// create synthetic body and dispatch crypto transfer
Expand Down Expand Up @@ -342,7 +342,7 @@
final var authorizingKeys =
keyVerifier.authorizingSimpleKeys().stream().toList();
final VerificationAssistant callback =
(k, ignore) -> simpleKeyVerifierFrom(authorizingKeys).test(k);

Check warning on line 345 in hedera-node/hedera-consensus-service-impl/src/main/java/com/hedera/node/app/service/consensus/impl/handlers/ConsensusSubmitMessageHandler.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-consensus-service-impl/src/main/java/com/hedera/node/app/service/consensus/impl/handlers/ConsensusSubmitMessageHandler.java#L345

Added line #L345 was not covered by tests
// check if authorizing keys are satisfying any of the fee exempt keys
for (final var feeExemptKey : feeExemptKeyList) {
if (keyVerifier.verificationFor(feeExemptKey, callback).passed()) {
Expand All @@ -365,7 +365,7 @@
});
return key -> switch (key.key().kind()) {
case ED25519, ECDSA_SECP256K1 -> cryptoSigs.contains(key);
default -> false;

Check warning on line 368 in hedera-node/hedera-consensus-service-impl/src/main/java/com/hedera/node/app/service/consensus/impl/handlers/ConsensusSubmitMessageHandler.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-consensus-service-impl/src/main/java/com/hedera/node/app/service/consensus/impl/handlers/ConsensusSubmitMessageHandler.java#L368

Added line #L368 was not covered by tests
};
}

Expand All @@ -376,8 +376,9 @@
* @param payerCustomFeeLimits List with limits of fees that the payer is willing to pay
*/
private void validateFeeLimits(
@NonNull final List<ConsensusCustomFee> topicCustomFees,
@NonNull final List<FixedFee> payerCustomFeeLimits) {
@NonNull final AccountID payer,
@NonNull final List<FixedCustomFee> topicCustomFees,
@NonNull final List<CustomFeeLimit> payerCustomFeeLimits) {
// Validate the duplication of payer custom fee limits
validateDuplicationFeeLimits(payerCustomFeeLimits);

Expand All @@ -388,20 +389,23 @@
// Validate payer token limits
tokenFees.forEach((token, feeAmount) -> {
final boolean isValid = payerCustomFeeLimits.stream()
.filter(fee -> token.equals(fee.denominatingTokenId()))
.anyMatch(fee -> {
validateTrue(fee.amount() >= feeAmount, MAX_CUSTOM_FEE_LIMIT_EXCEEDED);
.filter(maxCustomFee ->
token.equals(maxCustomFee.amountLimit().denominatingTokenId()))
.filter(maxCustomFee -> payer.equals(maxCustomFee.accountId()))
.anyMatch(maxCustomFee -> {
validateTrue(maxCustomFee.amountLimit().amount() >= feeAmount, MAX_CUSTOM_FEE_LIMIT_EXCEEDED);
return true;
});
validateTrue(isValid, NO_VALID_MAX_CUSTOM_FEE);
});
// Validate payer HBAR limit
if (hbarFee.get() > 0) {
final var payerHbarLimit = payerCustomFeeLimits.stream()
.filter(fee -> !fee.hasDenominatingTokenId())
.filter(maxCustomFee -> !maxCustomFee.amountLimit().hasDenominatingTokenId())
.filter(maxCustomFee -> payer.equals(maxCustomFee.accountId()))
.findFirst()
.orElseThrow(() -> new HandleException(NO_VALID_MAX_CUSTOM_FEE));
validateTrue(payerHbarLimit.amount() >= hbarFee.get(), MAX_CUSTOM_FEE_LIMIT_EXCEEDED);
validateTrue(payerHbarLimit.amountLimit().amount() >= hbarFee.get(), MAX_CUSTOM_FEE_LIMIT_EXCEEDED);
}
}

Expand All @@ -413,15 +417,15 @@
* @param context The handle context
* @return List containing only the fees concerning given payer
*/
private List<ConsensusCustomFee> extractFeesToBeCharged(
@NonNull final List<ConsensusCustomFee> topicCustomFees, @NonNull final HandleContext context) {
private List<FixedCustomFee> extractFeesToBeCharged(
@NonNull final List<FixedCustomFee> topicCustomFees, @NonNull final HandleContext context) {
final var payer = context.payer();
final var tokenStore = context.storeFactory().readableStore(ReadableTokenStore.class);
return topicCustomFees.stream()
.filter(fee -> {
var fixedFee = fee.fixedFeeOrThrow();
if (payer.equals(fee.feeCollectorAccountId())) {
return false;

Check warning on line 428 in hedera-node/hedera-consensus-service-impl/src/main/java/com/hedera/node/app/service/consensus/impl/handlers/ConsensusSubmitMessageHandler.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-consensus-service-impl/src/main/java/com/hedera/node/app/service/consensus/impl/handlers/ConsensusSubmitMessageHandler.java#L428

Added line #L428 was not covered by tests
}
if (fixedFee.hasDenominatingTokenId()) {
final var denomTokenId = fixedFee.denominatingTokenId();
Expand All @@ -441,7 +445,7 @@
* @param tokenFees Map with total amount per token.
*/
private void totalAmountToBeCharged(
@NonNull List<ConsensusCustomFee> topicCustomFees,
@NonNull List<FixedCustomFee> topicCustomFees,
AtomicReference<Long> hbarFee,
Map<TokenID, Long> tokenFees) {
for (final var fee : topicCustomFees) {
Expand All @@ -455,16 +459,16 @@
}
}

private void validateDuplicationFeeLimits(@NonNull final List<FixedFee> payerCustomFeeLimits) {
private void validateDuplicationFeeLimits(@NonNull final List<CustomFeeLimit> payerCustomFeeLimits) {
final var htsCustomFeeLimits = payerCustomFeeLimits.stream()
.filter(FixedFee::hasDenominatingTokenId)
.filter(maxCustomFee -> maxCustomFee.amountLimit().hasDenominatingTokenId())
.toList();
final var hbarCustomFeeLimits = payerCustomFeeLimits.stream()
.filter(fee -> !fee.hasDenominatingTokenId())
.filter(maxCustomFee -> !maxCustomFee.amountLimit().hasDenominatingTokenId())
.toList();

final var htsLimitHasDuplicate = htsCustomFeeLimits.stream()
.map(FixedFee::denominatingTokenId)
.map(maxCustomFee -> maxCustomFee.amountLimit().denominatingTokenId())
.collect(Collectors.toSet())
.size()
!= htsCustomFeeLimits.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.hedera.hapi.node.base.TokenTransferList;
import com.hedera.hapi.node.base.TransferList;
import com.hedera.hapi.node.token.CryptoTransferTransactionBody;
import com.hedera.hapi.node.transaction.ConsensusCustomFee;
import com.hedera.hapi.node.transaction.FixedCustomFee;
import com.hedera.hapi.node.transaction.FixedFee;
import com.hedera.node.app.service.token.ReadableTokenStore;
import edu.umd.cs.findbugs.annotations.NonNull;
Expand Down Expand Up @@ -55,12 +55,12 @@
* @return List of synthetic crypto transfer transaction bodies
*/
public List<CryptoTransferTransactionBody> assessCustomFee(
@NonNull final List<ConsensusCustomFee> customFees, @NonNull final AccountID payer) {
@NonNull final List<FixedCustomFee> customFees, @NonNull final AccountID payer) {
final List<CryptoTransferTransactionBody> transactionBodies = new ArrayList<>();

// build crypto transfer bodies for the first layer of custom fees,
// if there is a second or third layer it will be assessed in crypto transfer handler
for (ConsensusCustomFee fee : customFees) {
for (FixedCustomFee fee : customFees) {
final var tokenTransfers = new ArrayList<TokenTransferList>();
List<AccountAmount> hbarTransfers = new ArrayList<>();

Expand Down Expand Up @@ -111,8 +111,8 @@

@VisibleForTesting
public AccountID getTokenTreasury(TokenID tokenId, ReadableTokenStore tokenStore) {
final var token = tokenStore.get(tokenId);

Check warning on line 114 in hedera-node/hedera-consensus-service-impl/src/main/java/com/hedera/node/app/service/consensus/impl/handlers/customfee/ConsensusCustomFeeAssessor.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-consensus-service-impl/src/main/java/com/hedera/node/app/service/consensus/impl/handlers/customfee/ConsensusCustomFeeAssessor.java#L114

Added line #L114 was not covered by tests
validateTrue(token != null, ResponseCodeEnum.INVALID_TOKEN_ID_IN_CUSTOM_FEES);
return token.treasuryAccountIdOrThrow();

Check warning on line 116 in hedera-node/hedera-consensus-service-impl/src/main/java/com/hedera/node/app/service/consensus/impl/handlers/customfee/ConsensusCustomFeeAssessor.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-consensus-service-impl/src/main/java/com/hedera/node/app/service/consensus/impl/handlers/customfee/ConsensusCustomFeeAssessor.java#L116

Added line #L116 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
import com.hedera.hapi.node.consensus.ConsensusMessageChunkInfo;
import com.hedera.hapi.node.consensus.ConsensusSubmitMessageTransactionBody;
import com.hedera.hapi.node.state.consensus.Topic;
import com.hedera.hapi.node.transaction.CustomFeeLimit;
import com.hedera.hapi.node.transaction.FixedFee;
import com.hedera.hapi.node.transaction.TransactionBody;
import com.hedera.node.app.service.consensus.ReadableTopicStore;
import com.hedera.node.app.service.consensus.impl.ReadableTopicStoreImpl;
Expand Down Expand Up @@ -473,14 +475,27 @@ private TransactionBody newSubmitMessageTxn(final long topicEntityNum, final Str

private TransactionBody newSubmitMessageTxnWithMaxFee() {
final var txnId = TransactionID.newBuilder().accountID(payerId).build();
final var maxCustomFees = List.of(
// fungible token limit
CustomFeeLimit.newBuilder()
.accountId(payerId)
.amountLimit(FixedFee.newBuilder()
.denominatingTokenId(fungibleTokenId)
.amount(1))
.build(),
// hbar limit
CustomFeeLimit.newBuilder()
.accountId(payerId)
.amountLimit(FixedFee.newBuilder().amount(1))
.build());
final var submitMessageBuilder = ConsensusSubmitMessageTransactionBody.newBuilder()
.maxCustomFees(tokenCustomFee.fixedFee(), hbarCustomFee.fixedFee())
.topicID(TopicID.newBuilder().topicNum(topicEntityNum).build())
.message(Bytes.wrap("Message for test-" + Instant.now() + "."
+ Instant.now().getNano()));
return TransactionBody.newBuilder()
.transactionID(txnId)
.consensusSubmitMessage(submitMessageBuilder.build())
.maxCustomFees(maxCustomFees)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,18 @@ public class ConsensusTestBase {
protected final long sequenceNumber = 1L;
protected final long autoRenewSecs = 100L;
protected final Instant consensusTimestamp = Instant.ofEpochSecond(1_234_567L);
protected final ConsensusCustomFee tokenCustomFee = ConsensusCustomFee.newBuilder()
protected final FixedCustomFee tokenCustomFee = FixedCustomFee.newBuilder()
.fixedFee(FixedFee.newBuilder()
.denominatingTokenId(fungibleTokenId)
.amount(1)
.build())
.feeCollectorAccountId(anotherPayer)
.build();
protected final ConsensusCustomFee hbarCustomFee = ConsensusCustomFee.newBuilder()
protected final FixedCustomFee hbarCustomFee = FixedCustomFee.newBuilder()
.fixedFee(FixedFee.newBuilder().amount(1).build())
.feeCollectorAccountId(anotherPayer)
.build();
protected final List<ConsensusCustomFee> customFees = List.of(tokenCustomFee, hbarCustomFee);
protected final List<FixedCustomFee> customFees = List.of(tokenCustomFee, hbarCustomFee);

protected Topic topic;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import com.hedera.services.bdd.spec.HapiSpec;
import com.hedera.services.bdd.spec.fees.AdapterUtils;
import com.hedera.services.bdd.spec.transactions.HapiTxnOp;
import com.hederahashgraph.api.proto.java.ConsensusCustomFee;
import com.hederahashgraph.api.proto.java.ConsensusMessageChunkInfo;
import com.hederahashgraph.api.proto.java.ConsensusSubmitMessageTransactionBody;
import com.hederahashgraph.api.proto.java.FeeData;
Expand Down Expand Up @@ -125,16 +124,6 @@ public HapiMessageSubmit chunkInfo(
return chunkInfo(totalChunks, chunkNumber);
}

public HapiMessageSubmit maxCustomFee(Function<HapiSpec, ConsensusCustomFee> f) {
maxCustomFeeList.add(f);
return this;
}

public HapiMessageSubmit acceptAllCustomFees(boolean acceptAllFees) {
this.acceptAllCustomFees = acceptAllFees;
return this;
}

@Override
protected Consumer<TransactionBody.Builder> opBodyDef(final HapiSpec spec) throws Throwable {
final TopicID id = resolveTopicId(spec);
Expand All @@ -146,12 +135,6 @@ protected Consumer<TransactionBody.Builder> opBodyDef(final HapiSpec spec) throw
if (clearMessage) {
b.clearMessage();
}
if (!maxCustomFeeList.isEmpty()) {
for (final var supplier : maxCustomFeeList) {
b.addMaxCustomFees(supplier.apply(spec).getFixedFee());
}
}
b.setAcceptAllCustomFees(acceptAllCustomFees);
if (totalChunks.isPresent() && chunkNumber.isPresent()) {
final ConsensusMessageChunkInfo chunkInfo = ConsensusMessageChunkInfo.newBuilder()
.setInitialTransactionID(initialTransactionID.orElse(asTransactionID(
Expand Down
Loading
Loading