Skip to content

Commit

Permalink
Update for all Metadata HIPS with support for NFTs (hashgraph#326)
Browse files Browse the repository at this point in the history
* Initial draft of PBJ types for token state (hashgraph#263)

* Add HCS state proto

Signed-off-by: Michael Tinker <[email protected]>

* Add running hash, delete EntityNumber

Signed-off-by: Michael Tinker <[email protected]>

* 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 <[email protected]>

* Update services/state/token/account.proto

Co-authored-by: Richard Bair <[email protected]>

* 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 <[email protected]>
Co-authored-by: Michael Tinker <[email protected]>
Co-authored-by: Richard Bair <[email protected]>

* file proto (hashgraph#267)

* 265 - file proto

Signed-off-by: Lev Povolotsky <[email protected]>

* 265 - packaging

Signed-off-by: Lev Povolotsky <[email protected]>

* 265 - comments

Signed-off-by: Lev Povolotsky <[email protected]>

---------

Signed-off-by: Lev Povolotsky <[email protected]>

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

* change allowances

* change allowances

* change allowances

* change allowances

* change allowances

* change allowances

* fix some comments on file proto (hashgraph#268)

* 265 - file proto

Signed-off-by: Lev Povolotsky <[email protected]>

* 265 - packaging

Signed-off-by: Lev Povolotsky <[email protected]>

* 265 - comments

Signed-off-by: Lev Povolotsky <[email protected]>

* 265 - comments fix

Signed-off-by: Lev Povolotsky <[email protected]>

---------

Signed-off-by: Lev Povolotsky <[email protected]>

* Add missing fields in Account (hashgraph#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 (hashgraph#273)

* Add bytecode and storage slot representations

Signed-off-by: Michael Tinker <[email protected]>

* Add Nft type

Signed-off-by: Michael Tinker <[email protected]>

* Add EntityNumber

Signed-off-by: Michael Tinker <[email protected]>

* Use bytes instead of Int256Value

Signed-off-by: Michael Tinker <[email protected]>

* Fix typo

Signed-off-by: Michael Tinker <[email protected]>

* Remove superfluous Int256Value type

Signed-off-by: Michael Tinker <[email protected]>

* Rename Id -> UniqueTokenId

Signed-off-by: Michael Tinker <[email protected]>

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

Signed-off-by: Michael Tinker <[email protected]>

---------

Signed-off-by: Michael Tinker <[email protected]>

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

* Added state for blocks and running hashes

Signed-off-by: jasperpotts <[email protected]>

---------

Signed-off-by: jasperpotts <[email protected]>
Co-authored-by: jasperpotts <[email protected]>

* Add `StakingNodeInfo` for MerkleStakingInfo (hashgraph#277)

add staking node info

* add schedule proto (hashgraph#280)

* new schedule proto

Signed-off-by: Lev Povolotsky <[email protected]>

* addresspe comments

Signed-off-by: Lev Povolotsky <[email protected]>

* address comments

Signed-off-by: Lev Povolotsky <[email protected]>

---------

Signed-off-by: Lev Povolotsky <[email protected]>

* Fixing incorrect case for Timestamp. (hashgraph#282)

Signed-off-by: Joseph Sinclair <[email protected]>

* Adding missed import statement. (hashgraph#283)

Signed-off-by: Joseph Sinclair <[email protected]>

* Fix package name for state/schedule (hashgraph#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 <[email protected]>

* change topic number to topicID (hashgraph#286)

Signed-off-by: Lev Povolotsky <[email protected]>

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

* Initial commit

* Replace instead of deprecate previous field

* change topic number to topicID (hashgraph#286)

Signed-off-by: Lev Povolotsky <[email protected]>

* Initial commit

* Replace instead of deprecate previous field

---------

Signed-off-by: Lev Povolotsky <[email protected]>
Co-authored-by: Lev Povolotsky <[email protected]>

* Adjusting the state Schedule message to improve implementation. (hashgraph#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 <[email protected]>

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

* Change nft owner and spender identifier from long to AccountID

* Import basic_types.proto for AccountID

Signed-off-by: Kim Rader <[email protected]>

---------

Signed-off-by: Kim Rader <[email protected]>

* Update common.proto, token.proto, token-relation.protp and classes that rely on it to use AccountID and TokenID (hashgraph#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 (hashgraph#292)

Signed-off-by: Kim Rader <[email protected]>

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

changed auto_renew_account_number to auto_renew_account_id

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

* add fields from MerkleNetworkContext

* add fields from MerkleNetworkContext

* doc update

* doc update

* doc update

* doc update

* use snake case throughout protobufs (hashgraph#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. (hashgraph#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 <[email protected]>

* update account ids (hashgraph#291)

Update account.proto to use IDs instead of longs

Signed-off-by: Kim Rader <[email protected]>

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

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

Signed-off-by: Joseph Sinclair <[email protected]>

* Fix the "java_package" (hashgraph#302)

* fix path

Signed-off-by: Neeharika-Sompalli <[email protected]>

* fix comment

---------

Signed-off-by: Neeharika-Sompalli <[email protected]>

* protobuf cleanup (hashgraph#298)

Signed-off-by: Kim Rader <[email protected]>

* Add TransactionGetFastRecord to HederaFunctionality (hashgraph#303)

* Add TransactionGetFastRecord to HederaFunctionality

Signed-off-by: Kim Rader <[email protected]>

---------

Signed-off-by: Kim Rader <[email protected]>

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

* Revert NftID#tokenId to NftID#tokenID

Signed-off-by: Michael Tinker <[email protected]>

* add pre_system_delete_expiration_second

Signed-off-by: Lev Povolotsky <[email protected]>

---------

Signed-off-by: Michael Tinker <[email protected]>
Signed-off-by: Lev Povolotsky <[email protected]>
Co-authored-by: Lev Povolotsky <[email protected]>

* Add throttle and congestion types (hashgraph#304)

* Add ThrottleUsageSnapshots type

Signed-off-by: Miroslav Gatsanoga <[email protected]>

* Add CongestionLevelStarts type

Signed-off-by: Miroslav Gatsanoga <[email protected]>

---------

Signed-off-by: Miroslav Gatsanoga <[email protected]>

* Add migration properties to BlockInfo (hashgraph#310)

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

Signed-off-by: Matt Hess <[email protected]>

* Add BlockInfo#first_cons_time_of_current_block

Signed-off-by: Michael Tinker <[email protected]>

* Update SlotKey message to use ContractID instead of an int64, in order to be future-proof for sharding

Signed-off-by: Kim Rader <[email protected]>

* Rename contract_number -> contractID

Signed-off-by: Kim Rader <[email protected]>

* Sync with updates from `main` branch (hashgraph#314)

feat: HIP-844 - add signer_nonce field to message ContractFunctionResult (hashgraph#312)

add signer_nonce field to message ContractFunctionResult

Signed-off-by: Stoyan Panayotov <[email protected]>
Co-authored-by: Stoyan Panayotov <[email protected]>

* Sync with changes from main (hashgraph#317)

* feat: HIP-844 - add signer_nonce field to message ContractFunctionResult (hashgraph#312)

add signer_nonce field to message ContractFunctionResult

Signed-off-by: Stoyan Panayotov <[email protected]>

* 315 Added fully-qualified name for a type of `ContractFunctionResult.signer_nonce` (hashgraph#316)

315 Added fully-qualified name for a type of `ContractFunctionResult.signer_nonce`.

Signed-off-by: Ivan Malygin <[email protected]>

---------

Signed-off-by: Stoyan Panayotov <[email protected]>
Signed-off-by: Ivan Malygin <[email protected]>
Signed-off-by: Neeharika-Sompalli <[email protected]>
Co-authored-by: Stoyan Panayotov <[email protected]>
Co-authored-by: Ivan Malygin <[email protected]>

* Protobuf changes for implementation of metadata hips 646, 657 and 765 (hashgraph#313)

Signed-off-by: Thomas Moran <[email protected]>

* Add `BlockInfo#first_cons_time_of_current_block` (hashgraph#311)

Add BlockInfo#first_cons_time_of_current_block

Signed-off-by: Michael Tinker <[email protected]>

* Add pending rewards per node (hashgraph#320)

* add pending rewards per node

* deleted flag for nodes

* Metadata hips 646 657 765 (hashgraph#319)

* Protobuf changes for implementation of metadata hips 646, 657 and 765

Signed-off-by: Thomas Moran <[email protected]>

* adding endpoint for updating an NFT, metadata and key field to getTokenInfo

Signed-off-by: Thomas Moran <[email protected]>

* Temporary workaround for google.protobuf.BytesValue PBJ bug

Signed-off-by: Thomas Moran <[email protected]>

* Addition of metadata to Token Entity

Signed-off-by: Thomas Moran <[email protected]>

* Adding Invalid Metadata Key Response Code

Signed-off-by: Thomas Moran <[email protected]>

* Removing partition verbiage

Signed-off-by: Thomas Moran <[email protected]>

* Reverting to used google.protobuf.BytesValue

Signed-off-by: Thomas Moran <[email protected]>

---------

Signed-off-by: Thomas Moran <[email protected]>

* Revert "Metadata hips 646 657 765 (hashgraph#319)" (hashgraph#322)

This reverts commit ffbd48e.

* Use contract id in slot key (hashgraph#321)

* Add BlockInfo#first_cons_time_of_current_block

Signed-off-by: Michael Tinker <[email protected]>

* Update SlotKey message to use ContractID instead of an int64, in order to be future-proof for sharding

Signed-off-by: Kim Rader <[email protected]>

* Rename contract_number -> contractID

Signed-off-by: Kim Rader <[email protected]>

---------

Signed-off-by: Michael Tinker <[email protected]>
Signed-off-by: Kim Rader <[email protected]>
Co-authored-by: Michael Tinker <[email protected]>
Co-authored-by: Lev Povolotsky <[email protected]>

* Replay metadata change after merge from add-pbj-types-for-state

Signed-off-by: Thomas Moran <[email protected]>

* Adding response code for no metadata key on update

Signed-off-by: Thomas Moran <[email protected]>

* Adding missing token metadata reponseCode

Signed-off-by: Thomas Moran <[email protected]>

* Update NFT transaction body with tokenId and SerialNumbers

Signed-off-by: Thomas Moran <[email protected]>

* Updating token_update_nft message comment description

Signed-off-by: Thomas Moran <[email protected]>

* Adding new TokenUpdateNftTransactionBody to transaction_body message

Signed-off-by: Thomas Moran <[email protected]>

* Importing TokenUpdateNftTransactionBody to transaction_body

Signed-off-by: Thomas Moran <[email protected]>

* Adding TokenUpdateNft to HederaFunctionality

Signed-off-by: Thomas Moran <[email protected]>

* Adding updateNfts grpc endpoint

Signed-off-by: Thomas Moran <[email protected]>

* Updated comments on key signage

Signed-off-by: Thomas Moran <[email protected]>

* Change update nfts transaction definition

Signed-off-by: Thomas Moran <[email protected]>

* Change update nfts transaction body

Signed-off-by: Thomas Moran <[email protected]>

* Implement PR review feedback

Signed-off-by: Thomas Moran <[email protected]>

* update comment

* Missing import in schedulable_transaction_body

Signed-off-by: Thomas Moran <[email protected]>

* update response code

---------

Signed-off-by: Michael Tinker <[email protected]>
Signed-off-by: Lev Povolotsky <[email protected]>
Signed-off-by: jasperpotts <[email protected]>
Signed-off-by: Joseph Sinclair <[email protected]>
Signed-off-by: Kim Rader <[email protected]>
Signed-off-by: Neeharika-Sompalli <[email protected]>
Signed-off-by: Miroslav Gatsanoga <[email protected]>
Signed-off-by: Matt Hess <[email protected]>
Signed-off-by: Stoyan Panayotov <[email protected]>
Signed-off-by: Ivan Malygin <[email protected]>
Signed-off-by: Thomas Moran <[email protected]>
Co-authored-by: Neeha <[email protected]>
Co-authored-by: Michael Tinker <[email protected]>
Co-authored-by: Richard Bair <[email protected]>
Co-authored-by: Lev Povolotsky <[email protected]>
Co-authored-by: Neeharika-Sompalli <[email protected]>
Co-authored-by: Jasper Potts <[email protected]>
Co-authored-by: jasperpotts <[email protected]>
Co-authored-by: Joseph Sinclair <[email protected]>
Co-authored-by: Kim Rader <[email protected]>
Co-authored-by: Iris Simon <[email protected]>
Co-authored-by: Kim Rader <[email protected]>
Co-authored-by: Lev Povolotsky <[email protected]>
Co-authored-by: Miroslav Gatsanoga <[email protected]>
Co-authored-by: Matt Hess <[email protected]>
Co-authored-by: Stoyan Panayotov <[email protected]>
Co-authored-by: Ivan Malygin <[email protected]>
  • Loading branch information
17 people authored Mar 12, 2024
1 parent 0b4d91e commit 6d41db3
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 2 deletions.
5 changes: 5 additions & 0 deletions services/basic_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,11 @@ enum HederaFunctionality {
* Get a record for a transaction.
*/
TransactionGetFastRecord = 87;

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

/**
Expand Down
19 changes: 19 additions & 0 deletions services/response_code.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1373,4 +1373,23 @@ enum ResponseCodeEnum {
* An alias that is assigned to an account or contract cannot be assigned to another account or contract.
*/
ALIAS_ALREADY_ASSIGNED = 332;

/**
* A provided metadata key was invalid. Verification includes, for example, checking the size of Ed25519 and ECDSA(secp256k1) public keys.
*/
INVALID_METADATA_KEY = 333;

/**
* Metadata key is not set on token
*/
TOKEN_HAS_NO_METADATA_KEY = 334;

/**
* Token Metadata is not provided
*/
MISSING_TOKEN_METADATA = 335;
/**
* NFT serial numbers are missing in the TokenUpdateNftsTransactionBody
*/
MISSING_SERIAL_NUMBERS = 336;
}
6 changes: 6 additions & 0 deletions services/schedulable_transaction_body.proto
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import "token_dissociate.proto";
import "token_fee_schedule_update.proto";
import "token_pause.proto";
import "token_unpause.proto";
import "token_update_nfts.proto";

import "schedule_delete.proto";
import "util_prng.proto";
Expand Down Expand Up @@ -283,5 +284,10 @@ message SchedulableTransactionBody {
* Generates a pseudorandom number.
*/
UtilPrngTransactionBody util_prng = 40;

/**
* Update the metadata of one or more NFT's of a specific token type.
*/
TokenUpdateNftsTransactionBody token_update_nfts = 41;
}
}
11 changes: 11 additions & 0 deletions services/state/token/token.proto
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,15 @@ message Token {
* (Optional) The custom fees of this token.
*/
repeated CustomFee custom_fees = 26;

/**
* Metadata of the created token definition
*/
bytes metadata = 27;

/**
* The key which can change the metadata of a token
* (token definition and individual NFTs).
*/
Key metadata_key = 28;
}
4 changes: 2 additions & 2 deletions services/token_create.proto
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ message TokenCreateTransactionBody {
Key pause_key = 22;

/**
* Metadata of the created token definition.
*/
* Metadata of the created token definition.
*/
bytes metadata = 23;

/**
Expand Down
11 changes: 11 additions & 0 deletions services/token_get_info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,17 @@ message TokenInfo {
* The ledger ID the response was returned from; please see <a href="https://github.com/hashgraph/hedera-improvement-proposal/blob/master/HIP/hip-198.md">HIP-198</a> for the network-specific IDs.
*/
bytes ledger_id = 26;

/**
* Represents the metadata of the token definition.
*/
bytes metadata = 27;

/**
* The key which can change the metadata of a token
* (token definition and individual NFTs).
*/
Key metadata_key = 28;
}

/**
Expand Down
5 changes: 5 additions & 0 deletions services/token_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,9 @@ service TokenService {

// Unpause the token
rpc unpauseToken (Transaction) returns (TransactionResponse);

/**
* Updates the NFTs in a collection by TokenID and serial number
*/
rpc updateNfts (Transaction) returns (TransactionResponse);
}
2 changes: 2 additions & 0 deletions services/token_update.proto
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ message TokenUpdateTransactionBody {
/**
* The key which can change the metadata of a token
* (token definition, partition definition, and individual NFTs).
* If the Token does not have currently a Metadata key,
* transaction will resolve to TOKEN_HAS_NO_METADATA_KEY
*/
Key metadata_key = 17;
}
61 changes: 61 additions & 0 deletions services/token_update_nfts.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
syntax = "proto3";

package proto;

/*-
* ‌
* Hedera Network Services Protobuf
* ​
* Copyright (C) 2018 - 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.token">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

import "basic_types.proto";
import "duration.proto";
import "timestamp.proto";
import "google/protobuf/wrappers.proto";

/**
* At consensus, updates an already created Non Fungible Token to the given values.
*
* If no value is given for a field, that field is left unchanged.
* Only certain fields such as metadata can be updated.
*
* Updating the metadata of an NFT does not affect its ownership or transferability.
* This operation is intended for updating attributes of individual NFTs in a collection.
*
* --- Signing Requirements ---
* 1. To update metadata of an NFT, the metadata_key of the token should sign the transaction.
*/
message TokenUpdateNftsTransactionBody {
/**
* The token for which to update NFTs.
*/
TokenID token = 1;

/**
* The list of serial numbers to be updated.
*/
repeated int64 serial_numbers = 2;

/**
* The new metadata of the NFT(s)
*/
google.protobuf.BytesValue metadata = 3;
}
6 changes: 6 additions & 0 deletions services/transaction_body.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import "token_dissociate.proto";
import "token_fee_schedule_update.proto";
import "token_pause.proto";
import "token_unpause.proto";
import "token_update_nfts.proto";

import "schedule_create.proto";
import "schedule_delete.proto";
Expand Down Expand Up @@ -350,5 +351,10 @@ message TransactionBody {
* Generates a pseudorandom number.
*/
UtilPrngTransactionBody util_prng = 52;

/**
* Update the metadata of one or more NFT's of a specific token type.
*/
TokenUpdateNftsTransactionBody token_update_nfts = 53;
}
}

0 comments on commit 6d41db3

Please sign in to comment.