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

feat: 13135 Added PlatformState protobuf representation #349

Merged
merged 22 commits into from
Jul 3, 2024
Merged
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c91db2a
feat: 13135 Added PlatformState protobuf representation
imalygin May 8, 2024
2cb4e07
Update sdk/platform_state.proto
imalygin May 8, 2024
47b69d8
Moved platform_state.proto to platform/state directory.
imalygin May 8, 2024
da7a417
Updated type of `lowest_judge_generation_before_birth_round_mode` to …
imalygin May 9, 2024
9ab437a
Added platform-specific `AddressBook`.
imalygin May 9, 2024
3520390
Update platform/state/platform_state.proto
imalygin May 10, 2024
05d145a
Addressed review comments.
imalygin Jun 11, 2024
097ac74
Removed Roster, Address and NodeId as they will be a part of another PR.
imalygin Jun 12, 2024
2455e32
Update platform/state/platform_state.proto
imalygin Jun 12, 2024
44fa002
Addressed review comments:
imalygin Jun 12, 2024
131b668
Update platform/state/platform_state.proto
imalygin Jun 13, 2024
8a331b6
Addressed review comments - removed `SoftwareVersion` message and rep…
imalygin Jun 13, 2024
d554baa
Addressed a review comment - deprecated `last_round_before_birth_roun…
imalygin Jun 14, 2024
a6c7cea
Addressed a review comment - improved description for `minimum_judge_…
imalygin Jun 14, 2024
c9b5c63
Addressed a review comment - removed `round` and `consensusTimestamp`…
imalygin Jun 14, 2024
cbc1e2d
Addressed a review comment - updated comment for `MinimumJudgeInfo`
imalygin Jun 14, 2024
f1f4dd1
Update platform/state/platform_state.proto
imalygin Jun 14, 2024
e00fa8a
Addressed Lazar's comment - removed `round` from `PlatformState` and …
imalygin Jun 20, 2024
b8e1110
Addressed Lazar's comment - removed `consensus_timestamp` from `Platf…
imalygin Jun 20, 2024
132c25b
Improved javadoc for `ConsensusSnapshot.consensus_timestamp`
imalygin Jun 20, 2024
52206e3
Addressed Cody's comment - moved `PlatformState.first_version_in_birt…
imalygin Jun 20, 2024
dd4b50c
Fixed HTML tags.
imalygin Jul 1, 2024
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
232 changes: 232 additions & 0 deletions platform/state/platform_state.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
/**
* # PlatformState
* Messages that hold platform state in the network state.
*
* 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.platform.state;

/*
* 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.platform.state.legacy";
cody-littley marked this conversation as resolved.
Show resolved Hide resolved
// <<<pbj.java_package = "com.hedera.hapi.platform.state">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

import "basic_types.proto";
import "timestamp.proto";

/**
* The current state of platform consensus.<br/>
* This message stores the current consensus data for the platform
* in network state.
*
* The platform state SHALL represent the latest round's consensus.<br/>
* This data SHALL be used to ensure consistency and provide critical data for
* restart and reconnect.
*/
message PlatformState {
/**
* A consensus round.<br/>
* The round represented by this state.
* <p>
* This message SHALL represent the network state after handling of all
* transactions reaching consensus in all previous rounds.<br/>
* The first state (genesis state) SHALL have a round of 0.<br/>
* The first round to handle transactions SHALL be round `1`.
*/
uint64 round = 1;
imalygin marked this conversation as resolved.
Show resolved Hide resolved

/**
* A consensus timestamp for this state.
* <p>
* This SHALL be the consensus timestamp of the first transaction in
* the current round.
*/
proto.Timestamp consensus_timestamp = 2;
imalygin marked this conversation as resolved.
Show resolved Hide resolved

/**
* A version describing the current version of application software.
* <p>
* This SHALL be the software version that created this state.
*/
SoftwareVersion creation_software_version = 3;

/**
* A number of non-ancient rounds.
* <p>
* This SHALL be the count of rounds considered non-ancient.
*/
uint32 rounds_non_ancient = 4;

/**
* A snapshot of the consensus state at the end of the round.
* <p>
* This SHALL be used for restart/reconnect.
*/
ConsensusSnapshot consensus_snapshot = 5;

/**
* A timestamp for the next scheduled time when a freeze will start.
* <p>
* If a freeze is not scheduled, this SHALL NOT be set.<br/>
* If a freeze is currently scheduled, this MUST be set, and MUST
* match the timestamp requested for that freeze.
*/
proto.Timestamp freeze_time = 6;

/**
* A timestamp for the last time a freeze was performed.<br/>
* If not set, there has never been a freeze.
*/
proto.Timestamp last_frozen_time = 7;

/**
* A consensus node software version.<br/>
* The software version that enabled birth round mode.
* <p>
* This SHALL be unset if birth round migration has not yet happened.<br/>
* If birth round migration is complete, this SHALL be the _first_ software
* version that enabled birth round mode.
*/
SoftwareVersion first_version_in_birth_round_mode = 8;

/**
* A consensus round.<br/>
* The last round before the birth round mode was enabled.
* <p>
* This SHALL be `MAX_UNSIGNED` if birth round mode has not yet been enabled.
*/
uint64 last_round_before_birth_round_mode = 9;

// Fields below are to be deprecated in the foreseeable future.

/**
* A running event hash.<br/>
* This is computed by the consensus event stream.
* <p>
* This will be _deprecated_ once the consensus event stream is retired.
jsync-swirlds marked this conversation as resolved.
Show resolved Hide resolved
imalygin marked this conversation as resolved.
Show resolved Hide resolved
*/
bytes legacy_running_event_hash = 10000 [deprecated = true];
imalygin marked this conversation as resolved.
Show resolved Hide resolved

/**
* A consensus generation.<br/>
* The lowest judge generation before birth round mode was enabled.
* <p>
* This SHALL be `MAX_UNSIGNED` if birth round mode has not yet been enabled.
*/
uint64 lowest_judge_generation_before_birth_round_mode = 10001 [deprecated = true];
}


/**
* A consensus node software version.
*
* This message records version information for configuration, the Hedera
* API, and the "Services" subsystems.
*/
message SoftwareVersion {
lpetrovic05 marked this conversation as resolved.
Show resolved Hide resolved
/**
* A single numeric version.<br/>
* This is the current configuration version read on node startup.
*/
uint32 config_version = 1;

/**
* A semantic version entry.<br/>
* This is the version of the HAPI module (Hedera API).
*/
proto.SemanticVersion hapi_version = 2;

/**
* A semantic version entry.<br/>
* This is the version of the services module.
*/
proto.SemanticVersion services_version = 3;
}


/**
* A consensus snapshot.<br/>
* This is a snapshot of the consensus state for a particular round.
*
* This message SHALL record consensus data necessary for restart
* and reconnect.
*/
message ConsensusSnapshot {
imalygin marked this conversation as resolved.
Show resolved Hide resolved
/**
* A consensus round.<br/>
* The round number of this snapshot.
*/
uint64 round = 1;

/**
* A list of SHA-384 hash values.<br/>
* The hashes of all judges for this round.
* <p>
* This list SHALL be ordered by creator ID.<br/>
* This list MUST be deterministically ordered.
*/
repeated bytes judge_hashes = 2;

/**
* A list of minimum judge information entries.<br/>
* These are "minimum ancient" entries for non-ancient rounds.
*/
repeated MinimumJudgeInfo minimum_judge_info_list = 3;

/**
* A single consensus number.<br/>
* The consensus order of the next event to reach consensus.
*/
uint64 next_consensus_number = 4;

/**
* A "consensus" timestamp.<br/>
* The consensus timestamp of this snapshot.
* <p>
* This SHALL be a consensus value and MAY NOT correspond to an actual
* "wall clock" timestamp.<br/>
* Consensus Timestamps SHALL always increase.
*/
proto.Timestamp consensus_timestamp = 5;
}

/**
* Minimum ancient threshold information for round judges.<br/>
imalygin marked this conversation as resolved.
Show resolved Hide resolved
* This message records the minimum ancient threshold agreed by all judges in
* a round.
*/
message MinimumJudgeInfo {
/**
* A consensus round.<br/>
* The round this judge information applies to.
imalygin marked this conversation as resolved.
Show resolved Hide resolved
*/
uint64 round = 1;

/**
* Minimum ancient threshold for all judges in the round.
* <p>
* This SHALL reflect the relevant minimum threshold, whether
litt3 marked this conversation as resolved.
Show resolved Hide resolved
* generation-based or birth-round-based.
*/
uint64 minimum_judge_ancient_threshold = 2;
}