Skip to content

Commit

Permalink
Add StakingNodeInfo for MerkleStakingInfo (#277)
Browse files Browse the repository at this point in the history
add staking node info
  • Loading branch information
Neeharika-Sompalli authored Jun 8, 2023
1 parent 96774e9 commit 2bbbee4
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions services/state/token/staking_node_info.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
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";
import "basic_types.proto";

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

/**
* First-draft representation of a Hedera Token Service staking info entity in the network Merkle tree.
*
* As with all network entities, staking info is per node and has an unique entity number represented as shard.realm.X.
*/
message StakingNodeInfo {
/**
* The unique entity number of the node. The shard and realm numbers are implied, based on the network
* this entity came from.
*/
int64 node_number = 1;
/**
* The minimum stake on this node that is required for this node to have a non-zero weight to
* participate in the network consensus.
*/
int64 min_stake = 2;
/**
* The maximum stake on this node that is considered to calculate its weight to participate in the network consensus.
*/
int64 max_stake = 3;
/**
* The sum of balances of all accounts staked to this node who have opted to receive rewards.
*/
int64 stake_to_reward = 4;
/**
* The sum of balances of all accounts staked to this node who have opted to decline rewards.
*/
int64 stake_to_not_reward = 5;
/**
* The snapshot of stake_to_reward value at the beginning of the current staking period.
* This is needed for calculating rewards for current staking period without considering changes to
* stake_to_reward in the current staking period. It is reset at the beginning of every period.
*/
int64 stake_reward_start = 6;
/**
* Tracks how much stake from stakeRewardStart will have unclaimed rewards due to accounts changing their staking
* metadata in a way that disqualifies them for the current period; It is reset at the beginning of every period
*/
int64 unclaimed_stake_reward_start = 7;
/**
* The total amount of effective hbar staked to this node. This is sum of stake_to_reward and stake_to_not_reward.
* If the sum is greater than max_stake, then the effective stake is max_stake.
* If the sum is less than min_stake, then the effective stake is 0.
*/
int64 stake = 8;
/**
* An running sum of reward rates per hbar for the last 365+1 staking periods. The first element is the
* is the reward up to and including the last full period that finished before the present. Second element is
* the reward up to and including the period before that
*/
repeated int64 reward_sum_history = 9;
/**
* The consensus weight of this node in the network. This is computed based on the stake of this node
* at midnight UTC of the current day. If the stake of this node is less than minStake, then the weight is 0.
* Sum of all weights of nodes in the network should be less than 500.
* If the stake of this node A is greater than minStake, then the weight of this node A is calculated as:
* (node A stake * 500/ total stake of all nodes)
*/
int32 weight = 10;
}

0 comments on commit 2bbbee4

Please sign in to comment.