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

refactor: system transaction proto changes #16702

Merged
merged 14 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
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
17 changes: 15 additions & 2 deletions hapi/hedera-protobufs/platform/event/gossip_event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,20 @@ message GossipEvent {
* <p>
* This field MAY contain zero transactions.<br/>
* This field MUST NOT exceed `maxTransactionCountPerEvent` entries, initially `245760`.<br/>
* This total size of this field MUST NOT exceed `maxTransactionBytesPerEvent`, initially `245760` bytes.
* This total size of this field MUST NOT exceed `maxTransactionBytesPerEvent`, initially `245760` bytes.<br/>
* Deprecated in favor of the `transaction` field. The idea is to clean the design of event transactions.<br/>
* This is transitional state until 'transaction' field is fully adopted.
*/
repeated EventTransaction event_transaction = 3;
repeated EventTransaction event_transaction = 3 [deprecated = true];

/**
* A list of serialized transactions.
* <p>
* This field MAY contain zero transactions.<br/>
* Each transaction in this list SHALL be presented exactly as
* it was supplied to the consensus algorithm.<br/>
* This field MUST contain one entry for each transaction
* included in this gossip event.
mustafauzunn marked this conversation as resolved.
Show resolved Hide resolved
*/
repeated bytes transactions = 4;
}
5 changes: 5 additions & 0 deletions hapi/hedera-protobufs/services/basic_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,11 @@ enum HederaFunctionality {
* Submit a node public tss encryption key as part of the Threshold Signature Scheme (TSS).
*/
TssEncryptionKey = 99;

/**
* Submit a signature of a state snapshot gossiped to other nodes
mustafauzunn marked this conversation as resolved.
Show resolved Hide resolved
*/
StateSignatureTransaction = 100;
}

/**
Expand Down
9 changes: 8 additions & 1 deletion hapi/hedera-protobufs/services/transaction_body.proto
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ import "auxiliary/tss/tss_vote.proto";
import "auxiliary/tss/tss_share_signature.proto";
import "auxiliary/tss/tss_encryption_key.proto";

import "event/state_signature_transaction.proto";

/**
* A single transaction. All transaction types are possible here.
*/
Expand Down Expand Up @@ -435,13 +437,18 @@ message TransactionBody {
com.hedera.hapi.services.auxiliary.tss.TssVoteTransactionBody tssVote = 62;

/**
* A transaction body for a 'tssShareSignature` request
* A transaction body for node signature as part of the Threshold Signature Scheme (TSS) processing.
*/
com.hedera.hapi.services.auxiliary.tss.TssShareSignatureTransactionBody tssShareSignature = 63;

/**
* A transaction body for a 'tssEncryptionKey` request
*/
com.hedera.hapi.services.auxiliary.tss.TssEncryptionKeyTransactionBody tssEncryptionKey = 64;

/**
* A transaction body for signature of a state snapshot gossiped to other nodes
mustafauzunn marked this conversation as resolved.
Show resolved Hide resolved
*/
com.hedera.hapi.platform.event.StateSignatureTransaction state_signature_transaction = 65;
}
}
1 change: 1 addition & 0 deletions hapi/src/main/java/com/hedera/hapi/util/HapiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@
case TSS_VOTE -> HederaFunctionality.TSS_VOTE;
case TSS_SHARE_SIGNATURE -> HederaFunctionality.TSS_SHARE_SIGNATURE;
case TSS_ENCRYPTION_KEY -> HederaFunctionality.TSS_ENCRYPTION_KEY;
case STATE_SIGNATURE_TRANSACTION -> HederaFunctionality.STATE_SIGNATURE_TRANSACTION;

Check warning on line 241 in hapi/src/main/java/com/hedera/hapi/util/HapiUtils.java

View check run for this annotation

Codecov / codecov/patch

hapi/src/main/java/com/hedera/hapi/util/HapiUtils.java#L241

Added line #L241 was not covered by tests
case UNSET -> throw new UnknownHederaFunctionality();
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import static com.hedera.hapi.node.base.HederaFunctionality.SCHEDULE_DELETE;
import static com.hedera.hapi.node.base.HederaFunctionality.SCHEDULE_GET_INFO;
import static com.hedera.hapi.node.base.HederaFunctionality.SCHEDULE_SIGN;
import static com.hedera.hapi.node.base.HederaFunctionality.STATE_SIGNATURE_TRANSACTION;
import static com.hedera.hapi.node.base.HederaFunctionality.SYSTEM_DELETE;
import static com.hedera.hapi.node.base.HederaFunctionality.SYSTEM_UNDELETE;
import static com.hedera.hapi.node.base.HederaFunctionality.TOKEN_ACCOUNT_WIPE;
Expand Down Expand Up @@ -267,7 +268,8 @@ public record ApiPermissionConfig(
@ConfigProperty(defaultValue = "0-0") PermissionedAccountsRange tssMessage,
@ConfigProperty(defaultValue = "0-0") PermissionedAccountsRange tssVote,
@ConfigProperty(defaultValue = "0-0") PermissionedAccountsRange tssShareSignature,
@ConfigProperty(defaultValue = "0-0") PermissionedAccountsRange tssEncryptionKey) {
@ConfigProperty(defaultValue = "0-0") PermissionedAccountsRange tssEncryptionKey,
@ConfigProperty(defaultValue = "0-0") PermissionedAccountsRange stateSignature) {

private static final EnumMap<HederaFunctionality, Function<ApiPermissionConfig, PermissionedAccountsRange>>
permissionKeys = new EnumMap<>(HederaFunctionality.class);
Expand Down Expand Up @@ -349,6 +351,7 @@ public record ApiPermissionConfig(
permissionKeys.put(TSS_VOTE, c -> c.tssVote);
permissionKeys.put(TSS_SHARE_SIGNATURE, c -> c.tssShareSignature);
permissionKeys.put(TSS_ENCRYPTION_KEY, c -> c.tssEncryptionKey);
permissionKeys.put(STATE_SIGNATURE_TRANSACTION, c -> c.stateSignature);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ public PlatformEvent(@NonNull final UnsignedEvent unsignedEvent, @NonNull final
Objects.requireNonNull(unsignedEvent, "The unsignedEvent must not be null")
.getEventCore(),
Objects.requireNonNull(signature, "The signature must not be null"),
unsignedEvent.getEventTransactions()),
unsignedEvent.getEventTransactions(),
// TODO: adapt new transaction format
null),
unsignedEvent.getMetadata());
}

Expand Down