prysm-pulse/proto/eth/v1/events_service.proto
Raul Jordan bb6f00fd87
New Proto Messages Required for Event Streams (#9010)
* add event messages

* define all required event messages

* add new proto event messages

* formatting
2021-06-09 16:49:03 +00:00

108 lines
3.6 KiB
Protocol Buffer

// Copyright 2020 Prysmatic Labs.
//
// 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.
syntax = "proto3";
package ethereum.eth.v1;
import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "proto/eth/ext/options.proto";
import "proto/gateway/event_source.proto";
option csharp_namespace = "Ethereum.Eth.v1";
option go_package = "github.com/prysmaticlabs/prysm/proto/eth/v1";
option java_multiple_files = true;
option java_outer_classname = "BeaconEventsProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
// Events API
//
// This service is defined in the upstream eth2.0-apis repository (eth2.0-APIs/apis/debug).
service Events {
rpc StreamEvents(StreamEventsRequest) returns (stream gateway.EventSource) {
option (google.api.http) = {
get: "/eth/v1/events"
};
}
}
message StreamEventsRequest {
// List of topics to request for event streaming items. Allowed request topics are
// head, attestation, block, voluntary_exit, finalized_checkpoint, chain_reorg.
repeated string topics = 1;
}
message EventHead {
// Slot of the new chain head.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
// Block root of the new chain head.
bytes block = 2 [(ethereum.eth.ext.ssz_size) = "32"];
// State root of the new chain head.
bytes state = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// Whether or not the new chain head is at an epoch transition.
bool epoch_transition = 4;
// The previous dependent root.
bytes previous_duty_dependent_root = 5 [(ethereum.eth.ext.ssz_size) = "32"];
// The current dependent root.
bytes current_duty_dependent_root = 6 [(ethereum.eth.ext.ssz_size) = "32"];
}
message EventBlock {
// The slot of the observed block.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
// The root of the observed block.
bytes block = 2 [(ethereum.eth.ext.ssz_size) = "32"];
}
message EventChainReorg {
// The slot of the observed reorg.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
// Depth of the reorg in slots.
uint64 depth = 2;
// Block root of the old head.
bytes old_head_block = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// Block root of the new head.
bytes new_head_block = 4 [(ethereum.eth.ext.ssz_size) = "32"];
// State root of the old state.
bytes old_head_state = 5 [(ethereum.eth.ext.ssz_size) = "32"];
// State root of the new state.
bytes new_head_state = 6 [(ethereum.eth.ext.ssz_size) = "32"];
// Epoch of the observed reorg.
uint64 epoch = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Epoch"];
}
message EventFinalizedCheckpoint {
// Block root of the finalized checkpoint.
bytes block = 1 [(ethereum.eth.ext.ssz_size) = "32"];
// State root of the finalized checkpoint.
bytes state = 2 [(ethereum.eth.ext.ssz_size) = "32"];
// Epoch the checkpoint references.
uint64 epoch = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Epoch"];
}