prysm-pulse/proto/slashing/slashing.proto
Victor Farazdagi a8e501b3cf
ETH2 Types: Epoch (#8373)
* update deps

* update deps

* update protos/*

* update deps

* reset protos

* update protos

* update shared/params/config

* update protos

* update /shared

* update shared/slotutil and shared/testutil

* update beacon-chain/core/helpers

* updates beacon-chain/state

* update beacon-chain/forkchoice

* update beacon-chain/blockchain

* update beacon-chain/cache

* update beacon-chain/core

* update beacon-chain/db

* update beacon-chain/node

* update beacon-chain/p2p

* update beacon-chain/rpc

* update beacon-chain/sync

* go mod tidy

* make sure that beacon-chain build suceeds

* go fmt

* update e2e tests

* update slasher

* remove redundant alias

* update validator

* gazelle

* fix build errors in unit tests

* go fmt

* update deps

* update fuzz/BUILD.bazel

* fix unit tests

* more unit test fixes

* fix blockchain UTs

* more unit test fixes
2021-02-09 10:05:22 +00:00

78 lines
3.5 KiB
Protocol Buffer

syntax = "proto3";
package ethereum.slashing;
import "eth/v1alpha1/beacon_block.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
// Slasher service API
//
// Slasher service provides an interface for validators and beacon chain server to query
// and subscribe for slashable events on the network as well as to make sure that the
// attestation or proposal they are going to submit to the network are not going to
// produce a slashable event.
service Slasher {
// Returns any found attester slashings if the passed in attestation conflicts with a validators history.
rpc IsSlashableAttestation(ethereum.eth.v1alpha1.IndexedAttestation) returns (AttesterSlashingResponse);
// Returns any found proposer slashings if the passed in proposal conflicts with a validators history.
rpc IsSlashableBlock(ethereum.eth.v1alpha1.SignedBeaconBlockHeader) returns (ProposerSlashingResponse);
// Returns if a given indexed attestation could be slashable when compared to the slashers history for the attesters.
// This function is read-only, and does not need the indexed attestation to be signed.
rpc IsSlashableAttestationNoUpdate(ethereum.eth.v1alpha1.IndexedAttestation) returns (Slashable);
// Returns if a given beacon block header could be slashable when compared to the slashers history for the proposer.
// This function is read-only, and does not need the beacon block header to be signed.
rpc IsSlashableBlockNoUpdate(ethereum.eth.v1alpha1.BeaconBlockHeader) returns (Slashable);
// Returns the highest source and target attestation for validator indexes that have been observed by the slasher.
rpc HighestAttestations(HighestAttestationRequest) returns (HighestAttestationResponse);
}
message HighestAttestationRequest {
repeated uint64 validator_ids = 1;
}
message HighestAttestationResponse {
repeated HighestAttestation attestations = 1;
}
message HighestAttestation {
uint64 validator_id = 1;
uint64 highest_source_epoch = 2 [(gogoproto.casttype) = "github.com/prysmaticlabs/eth2-types.Epoch"];
uint64 highest_target_epoch = 3 [(gogoproto.casttype) = "github.com/prysmaticlabs/eth2-types.Epoch"];
}
message ProposerSlashingResponse {
repeated ethereum.eth.v1alpha1.ProposerSlashing proposer_slashing = 1;
}
message Slashable {
bool slashable = 1;
}
message AttesterSlashingResponse {
repeated ethereum.eth.v1alpha1.AttesterSlashing attester_slashing = 1;
}
// ProposalHistory defines the structure for recording a validator's historical proposals.
// Using a bitlist to represent the epochs and an uint64 to mark the latest marked
// epoch of the bitlist, we can easily store which epochs a validator has proposed
// a block for while pruning the older data.
message ProposalHistory {
bytes epoch_bits = 1 [(gogoproto.casttype) = "github.com/prysmaticlabs/go-bitfield.Bitlist"];
uint64 latest_epoch_written = 2 [(gogoproto.casttype) = "github.com/prysmaticlabs/eth2-types.Epoch"];
}
// AttestationHistory defines the structure for recording a validator's historical attestation.
// Using a map[uint64]uint64 to map its target epoch to its source epoch, in order to detect if a
// vote being created is not a double vote and surrounded by, or surrounding any other votes.
// Using an uint64 to mark the latest written epoch, we can safely perform a rolling prune whenever
// the history is updated.
message AttestationHistory {
map<uint64, uint64> target_to_source = 1;
uint64 latest_epoch_written = 2 [(gogoproto.casttype) = "github.com/prysmaticlabs/eth2-types.Epoch"];
}