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 5 commits
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
6 changes: 3 additions & 3 deletions hapi/hedera-protobufs/services/consensus_create_topic.proto
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ message ConsensusCreateTopicTransactionBody {
* <p>
* If unset, custom fees CANNOT be set for this topic.<br/>
* If not set when the topic is created, this field CANNOT be set via update.
* If set when the topic is created, this field CAN be changed via update.
* If set when the topic is created, this field MAY be changed via update.
*/
Key fee_schedule_key = 8;

Expand All @@ -88,10 +88,10 @@ message ConsensusCreateTopicTransactionBody {
* If a submit transaction is signed by _any_ key included in this set,
* custom fees SHALL NOT be charged for that transaction.
* <p>
* If free_messages_key_list is unset, the following keys are exempt
* If fee_exempt_key_list is unset, the following keys are exempt
* from custom fees: adminKey, submitKey, fee_schedule_key.
*/
repeated Key free_messages_key_list = 9;
repeated Key fee_exempt_key_list = 9;

/**
* A set of custom fee definitions.<br/>
Expand Down
6 changes: 3 additions & 3 deletions hapi/hedera-protobufs/services/consensus_topic_info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ message ConsensusTopicInfo {
* <p>
* If unset, custom fees CANNOT be set for this topic.<br/>
* If not set when the topic is created, this field CANNOT be set via update.
* If set when the topic is created, this field CAN be changed via update.
* If set when the topic is created, this field MAY be changed via update.
*/
Key fee_schedule_key = 10;

Expand All @@ -105,10 +105,10 @@ message ConsensusTopicInfo {
* If a submit transaction is signed by _any_ key included in this set,
* custom fees SHALL NOT be charged for that transaction.
* <p>
* If free_messages_key_list is unset, the following keys are exempt
* If fee_exempt_key_list is unset, the following keys are exempt
* from custom fees: adminKey, submitKey, fee_schedule_key.
*/
repeated Key free_messages_key_list = 11;
repeated Key fee_exempt_key_list = 11;

/**
* A set of custom fee definitions.<br/>
Expand Down
44 changes: 36 additions & 8 deletions hapi/hedera-protobufs/services/consensus_update_topic.proto
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,52 @@ message ConsensusUpdateTopicTransactionBody {
* <p>
* If unset in state, this field MUST NOT be set.<br/>
* If unset in this transaction and set in state, the current value SHALL
* be removed.<br/>
* If set in this transaction, the existing key MUST sign this transaction.
* be removed.<br/>
* If this field is set, the existing key MUST sign this transaction.
*/
Key fee_schedule_key = 10;

/**
* A set of keys that are allowed to submit messages to the topic without
* A wrapper of a set of keys.<br/>
* These keys are permitted to submit messages to the topic without
* paying the topic's custom fees.
* <p>
* If this list is empty, the current set of keys is unchanged.
* If this field is not set, the current set of keys SHALL NOT change.<br/>
* If this field is set, but contains an empty list, any existing fee-exempt
* keys SHALL be removed.
*/
repeated Key free_messages_key_list = 11;
FeeExemptKeyList fee_exempt_key_list = 11;

/**
* A set of custom fee definitions.<br/>
* A wrapper of a set of custom fee definitions.<br/>
* These are fees to be assessed for each submit to this topic.
* <p>
* If this list is empty, the current set of fees is unchanged.
* If this field is not set, the current set of custom fees
* SHALL NOT change.<br/>
* If this field is set, but contains an empty list, all current custom fees
* SHALL be removed.
*/
repeated ConsensusCustomFee custom_fees = 12;
ConsensusCustomFeeList custom_fees = 12;

/**
* A key validation mode.<br/>
* Any key may be updated by a transaction signed by the topic `admin_key`.
* Each role key may _also_ sign a transaction to update that key.
* If a role key signs an update to change that role key both old
* and new key must sign the transaction, _unless_ this field is set
* to `NO_VALIDATION`, in which case the _new_ key is not required to
* sign the transaction (the existing key is still required).<br/>
* The primary intent for this field is to allow a role key (e.g. a
* `fee_schedule_key`) holder to "remove" that key from the token by signing
* a transaction to set that role key to an empty `KeyList`.
* <p>
* If set to `FULL_VALIDATION`, either the `admin_key` or _both_ current
* and new key MUST sign this transaction to update a "key" field for the
* identified token.<br/>
* If set to `NO_VALIDATION`, either the `admin_key` or the current
* key MUST sign this transaction to update a "key" field for the
* identified token.<br/>
* This field SHALL be treated as `FULL_VALIDATION` if not set.
*/
TokenKeyValidation key_verification_mode = 13;
}
55 changes: 48 additions & 7 deletions hapi/hedera-protobufs/services/custom_fees.proto
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ message AssessedCustomFee {

/**
* A custom fee definition for a consensus topic.
* <p>
*
* This fee definition is specific to an Hedera Consensus Service (HCS) topic
* and SHOULD NOT be used in any other context.<br/>
* All fields for this message are REQUIRED.<br/>
Expand All @@ -185,12 +185,12 @@ message AssessedCustomFee {
*/
message ConsensusCustomFee {
/**
* A fixed custom fee.
* <p>
* The amount of HBAR or other token described by this `FixedFee` SHALL
* be charged to the transction payer for each message submitted to a
* topic that assigns this consensus custom fee.
*/
* A fixed custom fee.
* <p>
* The amount of HBAR or other token described by this `FixedFee` SHALL
* be charged to the transction payer for each message submitted to a
* topic that assigns this consensus custom fee.
*/
FixedFee fixed_fee = 1;

/**
Expand All @@ -201,3 +201,44 @@ message ConsensusCustomFee {
*/
AccountID fee_collector_account_id = 2;
}

/**
* A wrapper around a consensus custom fee list.<br/>
* This wrapper exists to enable an update transaction to differentiate between
* a field that is not set and an empty list of custom fees.
*
* An _unset_ field of this type SHALL NOT modify existing values.<br/>
* A _set_ field of this type with an empty `fees` list SHALL remove any
* existing values.
*/
message ConsensusCustomFeeList {
/**
* A set of custom fee definitions.<br/>
* These are fees to be assessed for each submit to a topic.
*/
repeated ConsensusCustomFee fees = 1;
}

/**
* A wrapper for fee exempt key list.<br/>
* This wrapper exists to enable an update transaction to differentiate between
* a field that is not set and an empty list of keys.
*
* An _unset_ field of this type SHALL NOT modify existing values.<br/>
* A _set_ field of this type with an empty `keys` list SHALL remove any
* existing values.
*/
message FeeExemptKeyList {
/**
* A set of keys.
* The keys in this list are permitted to submit messages to the
* topic without paying the topic's custom fees.
* <p>
* If a submit transaction is signed by _any_ key included in this set,
* custom fees SHALL NOT be charged for that transaction.
* <p>
* This list SHALL _implicitly_ include the following keys
* `adminKey`, `submitKey`, `fee_schedule_key`.
*/
repeated Key keys = 1;
}
16 changes: 8 additions & 8 deletions hapi/hedera-protobufs/services/state/consensus/topic.proto
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,24 @@ message Topic {
Key submit_key = 10;

/**
* Access control for update/delete of custom fees.
* <p>
* If this field is unset, the current custom fees CANNOT be changed.<br/>
* If this field is set, that `Key` MUST sign any transaction to update
* the custom fee schedule for this topic.
*/
* Access control for update/delete of custom fees.
* <p>
* If this field is unset, the current custom fees CANNOT be changed.<br/>
* If this field is set, that `Key` MUST sign any transaction to update
* the custom fee schedule for this topic.
*/
Key fee_schedule_key = 11;

/**
* A list of "privileged payer" keys.
* <p>
* If a submit transaction is signed by _any_ key from this list,
* custom fees SHALL NOT be charged for that transaction.<br/>
* If free_messages_key_list is unset, it SHALL _implicitly_ contain
* If fee_exempt_key_list is unset, it SHALL _implicitly_ contain
* the key `admin_key`, the key `submit_key`, and the key
* `fee_schedule_key`, if any of those keys are set.
*/
repeated Key free_messages_key_list = 12;
repeated Key fee_exempt_key_list = 12;

/**
* A set of custom fee definitions.<br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private Optional<ConsensusTopicInfo> infoForTopic(
info.autoRenewPeriod(Duration.newBuilder().seconds(meta.autoRenewPeriod()));
if (meta.hasAutoRenewAccountId()) info.autoRenewAccount(meta.autoRenewAccountId());
if (meta.hasFeeScheduleKey()) info.feeScheduleKey(meta.feeScheduleKey());
if (!meta.freeMessagesKeyList().isEmpty()) info.freeMessagesKeyList(meta.freeMessagesKeyList());
if (!meta.feeExemptKeyList().isEmpty()) info.feeExemptKeyList(meta.feeExemptKeyList());
if (!meta.customFees().isEmpty()) info.customFees(meta.customFees());

info.ledgerId(config.id());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,7 @@ public void handle(@NonNull final HandleContext handleContext) {
validateMaybeNewAttributes(handleContext, op, topic);

// Now we apply the mutations to a builder
final var builder = new Topic.Builder();
// But first copy over the immutable topic attributes to the builder
builder.topicId(topic.topicId());
builder.sequenceNumber(topic.sequenceNumber());
builder.runningHash(topic.runningHash());
builder.deleted(topic.deleted());
// TODO: added so unit tests pass (fix this when implementing the actual logic)
builder.feeScheduleKey(topic.feeScheduleKey());
builder.freeMessagesKeyList(topic.freeMessagesKeyList());
builder.customFees(topic.customFees());
// And then resolve mutable attributes, and put the new topic back
final var builder = topic.copyBuilder();
resolveMutableBuilderAttributes(handleContext, op, builder, topic);
topicStore.put(builder.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private ConsensusTopicInfo getExpectedInfo() {
.autoRenewPeriod(WELL_KNOWN_AUTO_RENEW_PERIOD)
.ledgerId(new BytesConverter().convert("0x03"))
.feeScheduleKey(feeScheduleKey)
.freeMessagesKeyList(key, anotherKey)
.feeExemptKeyList(key, anotherKey)
.customFees(customFees)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ protected void assertExpectationsGiven(HapiSpec spec) {
for (var expectedFee : expectedFees) {
expectedFee.accept(spec, actualFees);
}
var actualFreeMessagesKeys = info.getFreeMessagesKeyListList();
var actualFreeMessagesKeys = info.getFeeExemptKeyListList();
for (var expectedKey : expectedFreeMessagesKeyList) {
assertTrue(
actualFreeMessagesKeys.contains(spec.registry().getKey(expectedKey)),
Expand Down
Loading