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

Change numbers to ids #278

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ must be paid in ℏ from a cryptocurrency account. The payer authorizes a
fee by signing an appropriate transaction with a sufficient subset of the
Ed25519 key(s) associated to their account.

## Overview of state
State directory and its subdirectories contain the protobuf files that define the state of the network.
The state is divided into the following subdirectories, based on the service modules:
1. [Token](services/state/token) - The state of the Token service.
2. [Consensus](services/state/consensus) - The state of the Consensus service.

The state directory and its subdirectories are in preview and are subject to change.

# For Developers

## Branching
Expand Down
50 changes: 50 additions & 0 deletions services/state/blockrecords/block_info.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
syntax = "proto3";

package proto;

/*-
* ‌
* Hedera Network Services Protobuf
* ​
* Copyright (C) 2018 - 2023 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 "timestamp.proto";

option java_package = "com.hederahashgraph.api.proto.java";
// <<<pbj.java_package = "com.hedera.hapi.node.state.blockrecords">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

/**
* Information about the most recently completed and last 256 blocks.
*/
message BlockInfo {
/**
* The last block number, this is the last completed immutable block.
*/
int64 last_block_no = 1;
/**
* The consensus time of the first transaction of the last block, this is the last completed immutable block.
*/
Timestamp first_cons_time_of_last_block = 2;
/**
* SHA384 48 byte hashes of the last 256 blocks in single byte array.
* First 48 bytes is the oldest block.
* Last 48 bytes is the newest block, which is the last fully completed immutable block.
* If we are shortly after genesis and there are less than 256 blocks then this could contain less than 256 hashes.
*/
bytes block_hashes = 3;
}
50 changes: 50 additions & 0 deletions services/state/blockrecords/running_hashes.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
syntax = "proto3";

package proto;

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

/**
* The running hash of a transaction records and the previous 3 running hashes. All hashes are 48 bytes SHA384 hashes. If the
* running hashes do not exist yet then they will be default values witch is empty bytes object or zero length byte array.
*/
message RunningHashes {
/**
* A running hash of all record stream items
*/
bytes running_hash = 1;
/**
* The previous running hash of all record stream items
*/
bytes n_minus_1_running_hash = 2;
/**
* The previous, previous running hash of all record stream items
*/
bytes n_minus_2_running_hash = 3;
/**
* The previous, previous, previous running hash of all record stream items
*/
bytes n_minus_3_running_hash = 4;
}
58 changes: 58 additions & 0 deletions services/state/common.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
syntax = "proto3";

package proto;

/*-
* ‌
* Hedera Network Services Protobuf
* ​
* Copyright (C) 2018 - 2023 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 "basic_types.proto";

option java_package = "com.hederahashgraph.api.proto.java";
// <<<pbj.java_package = "com.hedera.hapi.node.state.common">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

/**
* A single 64-bit number identifying a Hedera native entity.
*/
message EntityNumber {
int64 number = 1;
}

/**
* Pair of AccountID and TokenID to represent TokenRelation
*/
message EntityIDPair {
AccountID account_id = 1;
TokenID token_id = 2;
}

/**
* Identifier for a unique token (or "NFT"), used by both contract and token services.
*/
message UniqueTokenId {
/**
* The id of the unique token this NFT is an instance of.
*/
TokenID token_id = 1;

/**
* The serial number of this NFT within its token type.
*/
int64 serial_number = 2;
}
8 changes: 4 additions & 4 deletions services/state/consensus/topic.proto
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ option java_multiple_files = true;
*/
message Topic {
/**
* The topic's unique entity number in the Merkle state.
* The topic's unique entity id in the Merkle state.
*/
int64 topic_number = 1;
TopicID topic_id = 1;
/**
* The number of messages sent to the topic.
*/
Expand All @@ -68,10 +68,10 @@ message Topic {
*/
int64 auto_renew_period = 4;
/**
* The number of the account (if any) that the network will attempt to charge for the
* The id of the account (if any) that the network will attempt to charge for the
* topic's auto-renewal upon expiration.
*/
int64 auto_renew_account_number = 5;
AccountID auto_renew_account_id = 5;
/**
* Whether this topic is deleted.
*/
Expand Down
37 changes: 37 additions & 0 deletions services/state/contract/bytecode.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
syntax = "proto3";

package proto;

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

/**
* The bytecode for a contract id.
*/
message Bytecode {
/**
* The raw bytes (not hex-encoded) of a contract's bytecode.
*/
bytes code = 1;
}
70 changes: 70 additions & 0 deletions services/state/contract/storage_slot.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
syntax = "proto3";

package proto;

/*-
* ‌
* Hedera Network Services Protobuf
* ​
* Copyright (C) 2018 - 2023 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/common.proto";

option java_package = "com.hederahashgraph.api.proto.java";
// <<<pbj.java_package = "com.hedera.hapi.node.state.contract">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

/**
* The key of a storage slot. A slot is scoped to a specific contract number.
*
* For each contract, its EVM storage is a mapping of 256-bit keys (or "words") to 256-bit values.
*/
message SlotKey {
/**
* The number of the contract whose storage this slot belongs to.
*/
int64 contract_number = 1;

/**
* The EVM key of this slot, when left-padded with zeros to form a 256-bit word.
*/
bytes key = 2;
}

/**
* The value of a contract storage slot. For the EVM, this is a single word.
*
* But because we need to be able to iterate through all the storage slots for an
* expired contract when purging it from state, our slot values also include the words
* of the previous and next keys in this contract's storage "list".
*/
message SlotValue {
/**
* The EVM value in this slot, when left-padded with zeros to form a 256-bit word.
*/
bytes value = 1;

/**
* The word of the previous key in this contract's storage list (if any).
*/
bytes previous_key = 2;

/**
* The word of the next key in this contract's storage list (if any).
*/
bytes next_key = 3;
}
63 changes: 63 additions & 0 deletions services/state/file/file.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
syntax = "proto3";

package proto;

/*-
* ‌
* Hedera Network Services Protobuf
* ​
* Copyright (C) 2018 - 2023 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 "basic_types.proto";
import "timestamp.proto";

option java_package = "com.hederahashgraph.api.proto.java";
// <<<pbj.java_package = "com.hedera.hapi.node.state.file">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

/**
* First-draft representation of a Hedera Token Service file in the network Merkle tree.
*
* As with all network entities, a file has a unique entity number, which is usually given along
* with the network's shard and realm in the form of a shard.realm.number id.
*/
message File {
/**
* The file's unique entity id in the Merkle state.
*/
FileID file_id = 1;
/**
* The file's consensus expiration time in seconds since the epoch.
*/
int64 expiration_time = 2;
/**
* All keys at the top level of a key list must sign to create, modify and delete the file.
*/
KeyList keys = 3;
/**
* The bytes that are the contents of the file
*/
bytes contents = 4;
/**
* The memo associated with the file (UTF-8 encoding max 100 bytes)
*/
string memo = 5;
/**
* Whether this file is deleted.
*/
bool deleted = 6;
}
Loading