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

chore: Add HistoryService handlers #17535

Merged
merged 9 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* # Proof Key Publication Transaction
*
* ### Keywords
* The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
* "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
* document are to be interpreted as described in
* [RFC2119](https://www.ietf.org/rfc/rfc2119) and clarified in
* [RFC8174](https://www.ietf.org/rfc/rfc8174).
*/
syntax = "proto3";

package com.hedera.hapi.services.auxiliary.history;

/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

option java_package = "com.hedera.hapi.services.auxiliary.history.legacy";
// <<<pbj.java_package = "com.hedera.hapi.services.auxiliary.history">>> This comment is special code for setting PBJ Compiler java package

option java_multiple_files = true;

/**
* A transaction body to publish a node's history proof key.
*/
message HistoryProofKeyPublicationTransactionBody {
/**
* The proof key the submitting node intends to use when
* contributing signatures for use in proving history
* belongs to the chain of trust for the ledger id.
*/
bytes proof_key = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* # Metadata Proof Assembly Signature Transaction
*
* ### Keywords
* The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
* "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
* document are to be interpreted as described in
* [RFC2119](https://www.ietf.org/rfc/rfc2119) and clarified in
* [RFC8174](https://www.ietf.org/rfc/rfc8174).
*/
syntax = "proto3";

package com.hedera.hapi.services.auxiliary.history;

/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import "state/history/history_types.proto";

option java_package = "com.hedera.hapi.services.auxiliary.history.legacy";
// <<<pbj.java_package = "com.hedera.hapi.services.auxiliary.history">>> This comment is special code for setting PBJ Compiler java package

option java_multiple_files = true;

/**
* A transaction body to publish a node's signature on a computed
* history of address book hash and associated metadata. This
* signature can contribute to a proof that the history belongs to
* to the chain of trust for the ledger id.
*/
message HistoryProofSignatureTransactionBody {
/**
* The id of the proof construction this signature is contributing to.
*/
uint64 construction_id = 1;

/**
* This node's signature on its computed history.
*/
com.hedera.hapi.node.state.history.HistorySignature signature = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* # Metadata Proof Vote Transaction
*
* ### Keywords
* The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
* "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
* document are to be interpreted as described in
* [RFC2119](https://www.ietf.org/rfc/rfc2119) and clarified in
* [RFC8174](https://www.ietf.org/rfc/rfc8174).
*/
syntax = "proto3";

package com.hedera.hapi.services.auxiliary.history;

/*
* Copyright (C) 2024 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import "state/history/history_types.proto";

option java_package = "com.hedera.hapi.services.auxiliary.history.legacy";
// <<<pbj.java_package = "com.hedera.hapi.services.auxiliary.history">>> This comment is special code for setting PBJ Compiler java package

option java_multiple_files = true;

/**
* A transaction body to publish a node's vote for a
* proof of history associated to a construction id.
*/
message HistoryProofVoteTransactionBody {
/**
* The id of the proof construction this vote is for.
*/
uint64 construction_id = 1;

/**
* The submitting node's vote on the history proof.
*/
com.hedera.hapi.node.state.history.HistoryProofVote vote = 2;
}
15 changes: 15 additions & 0 deletions hapi/hedera-protobufs/services/basic_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,21 @@ enum HederaFunctionality {
* Submit a signature of a state root hash gossiped to other nodes
*/
StateSignatureTransaction = 100;

/**
* Sign a particular history assembly.
*/
HistoryAssemblySignature = 104;

/**
* Publish a roster history proof key to the network.
*/
HistoryProofKeyPublication = 105;

/**
* Vote for a particular history proof.
*/
HistoryProofVote = 106;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ message HistoryProof {
*/
bytes source_address_book_hash = 1;
/**
* The proof keys for the source address book.
* The proof keys for the target address book, needed to keep
* constructing proofs after adopting the target address book's
* roster at a handoff.
*/
repeated ProofKey proof_keys = 2;
repeated ProofKey target_proof_keys = 2;
/**
* The target history of the proof.
*/
Expand Down
21 changes: 20 additions & 1 deletion hapi/hedera-protobufs/services/transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ import "node_delete.proto";

import "event/state_signature_transaction.proto";

import "auxiliary/history/history_proof_signature.proto";
import "auxiliary/history/history_proof_key_publication.proto";
import "auxiliary/history/history_proof_vote.proto";

/**
* A wrapper around signed transaction bytes.<br/>
* This was originally a transaction with body, signatures, and/or bytes,
Expand Down Expand Up @@ -167,7 +171,7 @@ message Transaction {
*/
message TransactionBody {
// <<<pbj.java_package = "com.hedera.hapi.node.transaction">>> This comment is special code for setting PBJ Compiler java package
reserved 30, 61, 62, 63, 64;
reserved 30, 61, 62, 63, 64, 66, 67, 68;

reserved "tssMessage", "tssVote", "tssShareSignature", "tssEncryptionKey";

Expand Down Expand Up @@ -608,5 +612,20 @@ message TransactionBody {
* A transaction body for signature of a state root hash gossiped to other nodes
*/
com.hedera.hapi.platform.event.StateSignatureTransaction state_signature_transaction = 65;

/**
* A transaction body for contributed a signature with a node's proof key to a history proof.
*/
com.hedera.hapi.services.auxiliary.history.HistoryProofSignatureTransactionBody history_proof_signature = 69;

/**
* A transaction body for publishing a node's metadata proof key.
*/
com.hedera.hapi.services.auxiliary.history.HistoryProofKeyPublicationTransactionBody history_proof_key_publication = 70;

/**
* A transaction body for voting on a metadata proof descending from the ledger id.
*/
com.hedera.hapi.services.auxiliary.history.HistoryProofVoteTransactionBody history_proof_vote = 71;
}
}
3 changes: 3 additions & 0 deletions hapi/src/main/java/com/hedera/hapi/util/HapiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@
case TOKEN_CANCEL_AIRDROP -> HederaFunctionality.TOKEN_CANCEL_AIRDROP;
case TOKEN_CLAIM_AIRDROP -> HederaFunctionality.TOKEN_CLAIM_AIRDROP;
case STATE_SIGNATURE_TRANSACTION -> HederaFunctionality.STATE_SIGNATURE_TRANSACTION;
case HISTORY_PROOF_SIGNATURE -> HederaFunctionality.HISTORY_ASSEMBLY_SIGNATURE;
case HISTORY_PROOF_KEY_PUBLICATION -> HederaFunctionality.HISTORY_PROOF_KEY_PUBLICATION;
case HISTORY_PROOF_VOTE -> HederaFunctionality.HISTORY_PROOF_VOTE;

Check warning on line 238 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#L236-L238

Added lines #L236 - L238 were not covered by tests
case UNSET -> throw new UnknownHederaFunctionality();
};
}
Expand Down
1 change: 1 addition & 0 deletions hapi/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
exports com.hedera.hapi.block.stream.protoc;
exports com.hedera.hapi.block;
exports com.hedera.hapi.services.auxiliary.tss.legacy;
exports com.hedera.hapi.services.auxiliary.history;
exports com.hedera.hapi.platform.event.legacy;
exports com.hedera.hapi.node.state.entity;

Expand Down
19 changes: 18 additions & 1 deletion hedera-node/hedera-app-spi/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright (C) 2025 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id("org.hiero.gradle.module.library")
id("org.hiero.gradle.feature.test-fixtures")
Expand All @@ -13,5 +28,7 @@ testModuleInfo {
requires("org.assertj.core")
requires("org.junit.jupiter.api")
requires("org.junit.jupiter.params")
requires("org.mockito")
requires("org.mockito.junit.jupiter")
requiresStatic("com.github.spotbugs.annotations")
}
Loading