Skip to content

Commit

Permalink
feat: Dynamic Address Book Phase 2 protobufs changes (#344)
Browse files Browse the repository at this point in the history
* Initial draft of PBJ types for token state (#263)

* Add HCS state proto

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

* Add running hash, delete EntityNumber

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

* add account and token

* add account and token

* add token

* add tokenRelation

* add some javadocs

* add some javadocs

* address review comments

* fix missing import

* address comments

* address review comments

* Update services/state/token/account.proto

Co-authored-by: Richard Bair <rbair23@users.noreply.github.com>

* Update services/state/token/account.proto

Co-authored-by: Richard Bair <rbair23@users.noreply.github.com>

* address some review comments

* move back under services

* change package name

* some docs and revert java package name

* revert docs

* add javadocs

* add javadocs

* re-order the first 16

---------

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Co-authored-by: Michael Tinker <michael.tinker@swirldslabs.com>
Co-authored-by: Richard Bair <rbair23@users.noreply.github.com>

* file proto (#267)

* 265 - file proto

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* 265 - packaging

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* 265 - comments

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

---------

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* Change allowance maps on `Account` PBJ Object (#269)

* change allowances

* change allowances

* change allowances

* change allowances

* change allowances

* change allowances

* fix some comments on file proto (#268)

* 265 - file proto

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* 265 - packaging

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* 265 - comments

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* 265 - comments fix

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

---------

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* Add missing fields in Account (#270)

* add missing fields and change allowance names

* change to bits

* address review comments

* address review comments

* address review comments

* Add the TransactionRecordEntry type for the record cache.

* Add payer account ID

* Include `ContractService` state types (#273)

* Add bytecode and storage slot representations

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

* Add Nft type

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

* Add EntityNumber

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

* Use bytes instead of Int256Value

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

* Fix typo

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

* Remove superfluous Int256Value type

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

* Rename Id -> UniqueTokenId

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

* Don't store code_hash, can be cached on load

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

---------

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

* Added state for blocks and running hashes (#276)

* Added state for blocks and running hashes

Signed-off-by: jasperpotts <jasperpotts@users.noreply.github.com>

---------

Signed-off-by: jasperpotts <jasperpotts@users.noreply.github.com>
Co-authored-by: jasperpotts <jasperpotts@users.noreply.github.com>

* Add `StakingNodeInfo` for MerkleStakingInfo (#277)

add staking node info

* add schedule proto (#280)

* new schedule proto

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* addresspe comments

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* address comments

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

---------

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* Fixing incorrect case for Timestamp. (#282)

Signed-off-by: Joseph Sinclair <joseph.sinclair@swirldslabs.com>

* Adding missed import statement. (#283)

Signed-off-by: Joseph Sinclair <joseph.sinclair@swirldslabs.com>

* Fix package name for state/schedule (#284)

Original commit of this file uses package com.hedera.hapi.node.state.file
The correct package is com.hedera.hapi.node.state.schedule.

Signed-off-by: Joseph Sinclair <joseph.sinclair@swirldslabs.com>

* change topic number to topicID (#286)

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* Update file.proto to use FileID type instead of long for file identification (#285)

* Initial commit

* Replace instead of deprecate previous field

* change topic number to topicID (#286)

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

* Initial commit

* Replace instead of deprecate previous field

---------

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>
Co-authored-by: Lev Povolotsky <16233475+povolev15@users.noreply.github.com>

* Adjusting the state Schedule message to improve implementation. (#288)

* Changed body_bytes to original_create_transaction
   * Changed type to TransactionBody
 * Updated comments to clarify several items and correct language

Signed-off-by: Joseph Sinclair <joseph.sinclair@swirldslabs.com>

* Change nft owner and spender identifier from long to AccountID (#289)

* Change nft owner and spender identifier from long to AccountID

* Import basic_types.proto for AccountID

Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>

---------

Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>

* Update common.proto, token.proto, token-relation.protp and classes that rely on it to use AccountID and TokenID (#290)

* Updated common.proto to use use AccountID and TokenID instead of long

* Updated token.proto to use use AccountID and TokenID instead of long

* Updated token_relation.proto to use use AccountID and TokenID instead of long

* Use NftID instead of UniqueTokenId (#292)

Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>

* changed auto_renew_account_number to auto_renew_account_id in topic.proto (#293)

changed auto_renew_account_number to auto_renew_account_id

* Add Staking Reward related fields from `MerkleNetworkContext` (#295)

* add fields from MerkleNetworkContext

* add fields from MerkleNetworkContext

* doc update

* doc update

* doc update

* doc update

* use snake case throughout protobufs (#294)

* Updated last_block_number in BlockInfo to match all others

* Added staked_id, removed staked_number.

* updated number

* Update Schedule state protobuf to add a wait_for_expiry flag. (#297)

Updated Schedule state protobuf to add a wait_for_expiry flag.
 * This protobuf is not yet used, so the fields were renumbered for efficient representation.
 * This is in support of resolving Issue #5518

Signed-off-by: Joseph Sinclair <joseph.sinclair@swirldslabs.com>

* update account ids (#291)

Update account.proto to use IDs instead of longs

Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>

* Add Protobuf messages for primitive values and a list of Schedules. (#299)

* Added primitive.proto which includes ProtoLong, ProtoInteger, ProtoBoolen, ProtoString, and ProtoBytes.
* Added ScheduleList message to schedule.proto

Signed-off-by: Joseph Sinclair <joseph.sinclair@swirldslabs.com>

* Fix the "java_package" (#302)

* fix path

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@swirldslabs.com>

* fix comment

---------

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@swirldslabs.com>

* protobuf cleanup (#298)

Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>

* Add TransactionGetFastRecord to HederaFunctionality (#303)

* Add TransactionGetFastRecord to HederaFunctionality

Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>

---------

Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>

* Revert `NftID#tokenId` to `NftID#tokenID` (#306)

* Revert NftID#tokenId to NftID#tokenID

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>

* add pre_system_delete_expiration_second

Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>

---------

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>
Co-authored-by: Lev Povolotsky <lev@swirldslabs.com>

* Add throttle and congestion types (#304)

* Add ThrottleUsageSnapshots type

Signed-off-by: Miroslav Gatsanoga <miroslav.gatsanoga@limechain.tech>

* Add CongestionLevelStarts type

Signed-off-by: Miroslav Gatsanoga <miroslav.gatsanoga@limechain.tech>

---------

Signed-off-by: Miroslav Gatsanoga <miroslav.gatsanoga@limechain.tech>

* Dynamic address book HAPI change

* Dynamic address book HAPI change

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* update change

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* update to CamelCase.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Revert "update to CamelCase."

This reverts commit d3c7074.

* updated names and types by review comments.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* updated with mandatory/optional fields in create node

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* updated transaction_receipt.proto with added node_id

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* updated with discussions from Dynamic Address Book Record Stream Requirements call today.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Added to schedulable_transaction_body.proto

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* more updates

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Add migration properties to BlockInfo (#310)

Update `BlockInfo` to also include properties needed for migration records

Signed-off-by: Matt Hess <matt.hess@swirldslabs.com>

* Update with review comments.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Update with review comments.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated according to Mark's confirmation posted on #dynamic-addressbook today.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Commented out status field.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updates

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated with HIP draft changes.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated with HIP draft changes.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated with latest HIP and merged with main branch.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* format.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* updated node state with latest HIP.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* added getNodeInfo query

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* update with reviews

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* updated with review comments

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* updated with review comments

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated with review comments.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated from DAB p2 & PFX meeting today

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Added more response codes.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated with review comments.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Corrected an accident change during the call.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Changed pbj.java_package to com.hedera.hapi.node.addressbook and NodeService to AddressBookService.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

* Updated with reviews.

Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>

---------

Signed-off-by: Michael Tinker <michael.tinker@swirldslabs.com>
Signed-off-by: Lev Povolotsky <lev@swirldslabs.com>
Signed-off-by: jasperpotts <jasperpotts@users.noreply.github.com>
Signed-off-by: Joseph Sinclair <joseph.sinclair@swirldslabs.com>
Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>
Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@swirldslabs.com>
Signed-off-by: Miroslav Gatsanoga <miroslav.gatsanoga@limechain.tech>
Signed-off-by: Iris Simon <iris.simon@swirldslabs.com>
Signed-off-by: Matt Hess <matt.hess@swirldslabs.com>
Co-authored-by: Neeha <52669918+Neeharika-Sompalli@users.noreply.github.com>
Co-authored-by: Michael Tinker <michael.tinker@swirldslabs.com>
Co-authored-by: Richard Bair <rbair23@users.noreply.github.com>
Co-authored-by: Lev Povolotsky <16233475+povolev15@users.noreply.github.com>
Co-authored-by: Neeharika-Sompalli <neeharika.sompalli@swirldslabs.com>
Co-authored-by: Jasper Potts <1466205+jasperpotts@users.noreply.github.com>
Co-authored-by: jasperpotts <jasperpotts@users.noreply.github.com>
Co-authored-by: Joseph Sinclair <121976561+jsync-swirlds@users.noreply.github.com>
Co-authored-by: Kim Rader <kimrader@gmail.com>
Co-authored-by: Kim Rader <kim.rader@swirldslabs.com>
Co-authored-by: Lev Povolotsky <lev@swirldslabs.com>
Co-authored-by: Miroslav Gatsanoga <miroslav.gatsanoga@limechain.tech>
Co-authored-by: Matt Hess <matt.hess@swirldslabs.com>
  • Loading branch information
14 people authored Apr 26, 2024
1 parent a55d494 commit e650477
Show file tree
Hide file tree
Showing 11 changed files with 619 additions and 7 deletions.
65 changes: 65 additions & 0 deletions services/address_book_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
syntax = "proto3";

package proto;

/*
* Hedera Network Services Protobuf
*
* 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.hederahashgraph.service.proto.java";
// <<<pbj.java_package = "com.hedera.hapi.node.addressbook">>> This comment is special code for setting PBJ Compiler java package

import "query.proto";
import "response.proto";
import "transaction_response.proto";
import "transaction.proto";

/**
* Transactions for the AddressBook Service, those HAPI APIs facilitate changes to the nodes used across the Hedera network.
* All those transactions needs to be signed by the Hedera Council. Steps needed below:
* 1. The node operator creates and signs the transaction with their key (the key on the node operator account)
* 2. The node operator hands this transaction to Alex, who then gives it to the council to sign
* 3. When signed and submitted, the server will verify that account 2 keys have signed, and the keys on the operator account have signed.
* Hedera council should have ability to make all edits in addition to add/remove nodes
*/
service AddressBookService {
/**
* Prepare to add a new node to the network.
* When a valid council member initiates a HAPI transaction to add a new node,
* then the network should acknowledge the transaction and update the network’s Address Book within 24 hours.
* The added node will not be active until the network is upgraded.
*/
rpc createNode (Transaction) returns (TransactionResponse);

/**
* Prepare to delete the node to the network.
* The deleted node will not be deleted until the network is upgraded.
* Such a deleted node can never be reused.
*/
rpc deleteNode (Transaction) returns (TransactionResponse);

/**
* Prepare to update the node to the network.
* The node will not be updated until the network is upgraded.
*/
rpc updateNode (Transaction) returns (TransactionResponse);

/**
* Retrieves the node information by node Id.
*/
rpc getNodeInfo (Query) returns (Response);
}
36 changes: 29 additions & 7 deletions services/basic_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ message Key {
* contractID key, which also requires the code in the active message frame belong to the
* the contract with the given id.)
*/
ContractID delegatable_contract_id = 8;
ContractID delegatable_contract_id = 8;
}
}

Expand Down Expand Up @@ -1188,9 +1188,24 @@ enum HederaFunctionality {
TransactionGetFastRecord = 87;

/**
* Update the metadata of one or more NFT's of a specific token type.
*/
* Update the metadata of one or more NFT's of a specific token type.
*/
TokenUpdateNfts = 88;

/**
* Create a node
*/
NodeCreate = 89;

/**
* Update a node
*/
NodeUpdate = 90;

/**
* Delete a node
*/
NodeDelete = 91;
}

/**
Expand Down Expand Up @@ -1268,7 +1283,7 @@ message TransactionFeeSchedule {
/**
* Resource price coefficients
*/
FeeData feeData = 2 [deprecated=true];
FeeData feeData = 2 [deprecated = true];

/**
* Resource price coefficients. Supports subtype price definition.
Expand Down Expand Up @@ -1353,6 +1368,13 @@ message ServiceEndpoint {
* The port of the node
*/
int32 port = 2;

/**
* A node domain name
* This MUST be the fully qualified domain name of the node.
* This value MUST NOT be more than 253 characters.
*/
string domain_name = 3;
}

/**
Expand All @@ -1370,18 +1392,18 @@ message NodeAddress {
* The IP address of the Node with separator & octets encoded in UTF-8. Usage is deprecated,
* ServiceEndpoint is preferred to retrieve a node's list of IP addresses and ports
*/
bytes ipAddress = 1 [deprecated=true];
bytes ipAddress = 1 [deprecated = true];

/**
* The port number of the grpc server for the node. Usage is deprecated, ServiceEndpoint is
* preferred to retrieve a node's list of IP addresses and ports
*/
int32 portno = 2 [deprecated=true];
int32 portno = 2 [deprecated = true];

/**
* Usage is deprecated, nodeAccountId is preferred to retrieve a node's account ID
*/
bytes memo = 3 [deprecated=true];
bytes memo = 3 [deprecated = true];

/**
* The node's X509 RSA public key used to sign stream files (e.g., record stream
Expand Down
88 changes: 88 additions & 0 deletions services/node_create.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
syntax = "proto3";

package proto;

/*
* Hedera Network Services Protobuf
*
* 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.hederahashgraph.api.proto.java";
// <<<pbj.java_package = "com.hedera.hapi.node.addressbook">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

import "basic_types.proto";

/**
* A transaction body to add a new node to the network.
* After the node is created, the node_id for it is in the receipt.
*
* This transaction body SHALL be considered a "privileged transaction".
*
* This message supports a transaction to create a new node in the network.
* The transaction, once complete, enables a new consensus node
* to join the network, and requires governing council authorization.
*
* A `NodeCreateTransactionBody` MUST be signed by the governing council.<br/>
* The newly created node information will be used to generate config.txt and
* a-pulbic-NodeAlias.pem file per each node during phase 2,<br>
* not active until next freeze upgrade.
*/
message NodeCreateTransactionBody {

/**
* Node account id, mandatory field, ALIAS is not allowed, only ACCOUNT_NUM.
* If account_id does not exist, it will reject the transaction.
* Multiple nodes can have the same account_id.
*/
AccountID account_id = 1;

/**
* Description of the node with UTF-8 encoding up to 100 bytes, optional field.
*/
string description = 2;

/**
* Ip address and port, mandatory field. Fully qualified domain name is
* not allowed here. Maximum number of these endpoints is 10.
* The first in the list is used as the Internal IP address in config.txt,
* the second in the list is used as the External IP address in config.txt,
* the rest of IP addresses are ignored for DAB phase 2.
*/
repeated ServiceEndpoint gossip_endpoint = 3;

/**
* A node's grpc service IP addresses and ports, IP:Port is mandatory,
* fully qualified domain name is optional. Maximum number of these endpoints is 8.
*/
repeated ServiceEndpoint service_endpoint = 4;

/**
* The node's X509 certificate used to sign stream files (e.g., record stream
* files). Precisely, this field is the DER encoding of gossip X509 certificate.
* This is a mandatory field.
*/
bytes gossip_ca_certificate = 5;

/**
* Hash of the node's TLS certificate. Precisely, this field is a string of
* hexadecimal characters which translated to binary, are the SHA-384 hash of
* the UTF-8 NFKD encoding of the node's TLS cert in PEM format.
* Its value can be used to verify the node's certificate it presents
* during TLS negotiations.node x509 certificate hash, optional field.
*/
bytes grpc_certificate_hash = 6;
}
44 changes: 44 additions & 0 deletions services/node_delete.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
syntax = "proto3";

package proto;

/*
* Hedera Network Services Protobuf
*
* 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.hederahashgraph.api.proto.java";
// <<<pbj.java_package = "com.hedera.hapi.node.addressbook">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

import "basic_types.proto";

/**
* Delete the given node. After deletion, it will be marked as deleted.
* But information about it will continue to exist for a year.
* For phase 2, this marks the node to be deleted in the merkle tree and will be used to write config.txt and
* a-pulbic-NodeAlias.pem file per each node during prepare freeze.
* The deleted node will not be deleted until the network is upgraded.
* Such a deleted node can never be reused.
* The council has to sign this transaction. This is a privileged transaction.
*/
message NodeDeleteTransactionBody {
/**
* The unique id of the node to be deleted. If invalid node is specified, transaction will
* result in INVALID_NODE_ID.
*/
uint64 node_id = 1;
}
Loading

0 comments on commit e650477

Please sign in to comment.