Skip to content

Commit

Permalink
fix: Protobufs updated (#2691)
Browse files Browse the repository at this point in the history
* fix: Updated protobufs, taskfile to move the platform protos to the services directory and fixed tests

Signed-off-by: ivaylogarnev-limechain <[email protected]>

* fix: Adjusted mocker.js to work with newest protos

Signed-off-by: ivaylogarnev-limechain <[email protected]>

---------

Signed-off-by: ivaylogarnev-limechain <[email protected]>
  • Loading branch information
ivaylogarnev-limechain authored and ivaylonikolov7 committed Dec 5, 2024
1 parent e1147a7 commit 9bf92a6
Show file tree
Hide file tree
Showing 13 changed files with 487 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/proto/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ tasks:
- mv src/services/hapi/hedera-protobufs/services src/proto/
- rm -rf src/proto/streams
- mv src/services/hapi/hedera-protobufs/streams src/proto/
- mv src/services/hapi/hedera-protobufs/platform/event/* src/proto/services
- echo "Protobufs moved successfully!"
- task "delete:submodule"

Expand Down
5 changes: 5 additions & 0 deletions packages/proto/src/proto/services/basic_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,11 @@ enum HederaFunctionality {
* Submit a node public tss encryption key as part of the Threshold Signature Scheme (TSS).
*/
TssEncryptionKey = 99;

/**
* Submit a signature of a state root hash gossiped to other nodes
*/
StateSignatureTransaction = 100;
}

/**
Expand Down
69 changes: 69 additions & 0 deletions packages/proto/src/proto/services/event_consensus_data.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* # Event Consensus Data
* A message that describes the consensus data for an event.
*
* The `EventConsensusData` contains two fields that are determined once an
* event reaches consensus, the `consensus_timestamp` and `consensus_order`.
*
* ### Keywords
* 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).
*/
syntax = "proto3";

package com.hedera.hapi.platform.event;

/*
* 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.
*/

import "basic_types.proto";
import "event/event_descriptor.proto";
import "timestamp.proto";

option java_package = "com.hedera.hapi.platform.event.legacy";
// <<<pbj.java_package = "com.hedera.hapi.platform.event">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

/**
* Event Consensus Data.<br/>
* This message records the critical values produced by consensus for an event.
*/
message EventConsensusData {
/**
* A consensus timestamp.<br/>
* The network's consensus agreement on a timestamp for this event.
* <p>
* This timestamp MUST be strictly greater than the `consensus_timestamp` of
* the previous consensus event.<br/>
* This is a consensus value and MAY NOT match real-world "wall clock" time.
*/
proto.Timestamp consensus_timestamp = 1;

/**
* A consensus order sequence number.<br/>
* A non-negative sequence number that identifies an event's consensus order
* since genesis.
* <p>
* This SHALL be the unique for each consensus event.<br/>
* This SHALL always increase, and SHALL NOT decrease.<br/>
* This SHALL increment by one for each consensus event.
*/
uint64 consensus_order = 2;
}

83 changes: 83 additions & 0 deletions packages/proto/src/proto/services/event_core.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/**
* # Core Event Data
* A message that describes the metadata for an event.
*
* The `EventCore` contains a list of the event's parents, as well as the software
* version, an identifier for the node that created this event, the birth round, and
* the creation timestamp for the event.
*
* ### Keywords
* 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).
*/
syntax = "proto3";

package com.hedera.hapi.platform.event;

/*
* 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.
*/

import "basic_types.proto";
import "event/event_descriptor.proto";
import "timestamp.proto";

option java_package = "com.hedera.hapi.platform.event.legacy";
// <<<pbj.java_package = "com.hedera.hapi.platform.event">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

/**
* Contains information about an event and its parents.
*/
message EventCore {
/**
* The creator node identifier.<br/>
* This SHALL be the unique identifier for the node that created the event.<br/>
* This SHALL match the ID of the node as it appears in the address book.
*/
int64 creator_node_id = 1;

/**
* The birth round of the event.<br/>
* The birth round SHALL be the pending consensus round at the time the event is created.<br/>
* The pending consensus round SHALL be **one greater** than the latest round to reach consensus.
*/
int64 birth_round = 2;

/**
* The wall clock time at which the event was created, according to the node creating the event.<br/>
* If the event has a self parent, this timestamp MUST be strictly greater than the `time_created` of the self parent.
*/
proto.Timestamp time_created = 3;

/**
* A list of EventDescriptors representing the parents of this event.<br/>
* The list of parents SHALL include zero or one self parents, and zero or more other parents.<br/>
* The first element of the list SHALL be the self parent, if one exists.<br/>
* The list of parents SHALL NOT include more than one parent from the same creator.
*/
repeated EventDescriptor parents = 4;

/**
* The event specification version.<br/>
* The specification described by this version SHALL encompass the format of the `GossipEvent` message, and also the
* format of all contained messages.<br/>
* This SHALL exactly match the specification version passed into the platform at construction.
*/
proto.SemanticVersion version = 17; // This field is temporary until birth_round migration is complete. Field number 17 chosen to avoid polluting cheaper 1 byte field numbers 1-16
}
80 changes: 80 additions & 0 deletions packages/proto/src/proto/services/event_descriptor.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* # Event Descriptor
* Unique identifier for an event.
*
* Contains the hash of the event, the creator identifier, the birth round, and the generation.
*
* An event's descriptor is constructed individually by each node that receives a `GossipEvent`,
* to uniquely identify that event. An event's descriptor isn't part of the `GossipEvent` itself,
* since the descriptor contains the fields `hash` and `generation`, which can be computed locally.
* Nodes receiving a `GossipEvent` have the required information to construct the event descriptor
* immediately upon receiving the event, without needing to wait for the event to reach consensus.
*
* Aside from being a unique identifier for events that have been received through gossip,
* the event descriptor contains the necessary information to describe an event's parents,
* in the `parents` field of `GossipEvent`.
*
* ### Keywords
* 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).
*/
syntax = "proto3";

package com.hedera.hapi.platform.event;

/*
* 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.hedera.hapi.platform.event.legacy";
// <<<pbj.java_package = "com.hedera.hapi.platform.event">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

/**
* Unique identifier for an event.
*/
message EventDescriptor {
/**
* The hash of the event.<br/>
* The hash SHALL be a SHA-384 hash.<br/>
* The hash SHALL have the following inputs, in the specified order:<br/>
* 1. The bytes of the `EventCore` protobuf<br/>
* 2. The SHA-384 hash of each individual `EventTransaction`, in the order the transactions appear in the `event_transactions` field of the `GossipEvent` protobuf
*/
bytes hash = 1;

/**
* The creator node identifier.<br/>
* This SHALL be the unique identifier for the node that created the event.<br/>
* This SHALL match the ID of the node as it appears in the address book.
*/
int64 creator_node_id = 2;

/**
* The birth round of the event.<br/>
* The birth round SHALL be the pending consensus round at the time the event is created.<br/>
* The pending consensus round SHALL be **one greater** than the latest round to reach consensus.
*/
int64 birth_round = 3;

/**
* The generation of the event.<br/>
* This value SHALL be **one greater** than the _maximum_ generation of all parents.<br/>
*/
int64 generation = 17; // This field is temporary until birth_round migration is complete. Field number 17 chosen to avoid polluting cheaper 1 byte field numbers 1-16
}
65 changes: 65 additions & 0 deletions packages/proto/src/proto/services/event_transaction.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* # Event Transaction
* An Event Transaction gossiped between nodes as part of events.
*
* ### Keywords
* 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.event;

/*
* 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.
*/

import "event/state_signature_transaction.proto";

option java_package = "com.hedera.hapi.platform.event.legacy";
// <<<pbj.java_package = "com.hedera.hapi.platform.event">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

/**
* An Event Transaction gossiped between nodes as part of events.
*
* Each node MUST extract this transaction and process according to the type
* of transaction encoded.<br/>
* Both the platform and the application built on that platform MAY define event
* transactions.<br/>
* The encoded data MUST be a serialized protobuf message.
*/
message EventTransaction {
oneof transaction {
/**
* An application transaction.
* <p>
* The contents of this transaction SHALL be defined by the application
* subsystem that created the event.<br/>
* The contents MUST be a serialized protobuf message.
*/
bytes application_transaction = 1;
/**
* A state signature.
* <p>
* This transaction SHALL be a valid state signature for a state snapshot.
*/
StateSignatureTransaction state_signature_transaction = 2;
}

}
Loading

0 comments on commit 9bf92a6

Please sign in to comment.