prysm-pulse/proto/eth/v1/beacon_block.proto
Radosław Kapka ede85c21e2
Clean up v1 protos (#9377)
* Clean up v1 protos

# Conflicts:
#	proto/eth/v1/generated.ssz.go

* A little more cleanup

# Conflicts:
#	proto/eth/v1/generated.ssz.go

* fix java class names
2021-08-13 09:12:18 +00:00

202 lines
7.5 KiB
Protocol Buffer

// Copyright 2021 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/protobuf/descriptor.proto";
import "proto/eth/ext/options.proto";
import "proto/eth/v1/attestation.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 = "BeaconBlockProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
// The Ethereum consensus beacon block. The message does not contain a validator signature.
message BeaconBlock {
// Beacon chain slot that this block represents.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
// Validator index of the validator that proposed the block header.
uint64 proposer_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
// 32 byte root of the parent block.
bytes parent_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// 32 byte root of the resulting state after processing this block.
bytes state_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
// The block body itself.
BeaconBlockBody body = 5;
}
// The signed version of beacon block.
message SignedBeaconBlock {
// The unsigned beacon block itself.
BeaconBlock block = 1;
// 96 byte BLS signature from the validator that produced this block.
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
// The block body of an Ethereum consensus beacon block.
message BeaconBlockBody {
// The validators RANDAO reveal 96 byte value.
bytes randao_reveal = 1 [(ethereum.eth.ext.ssz_size) = "96"];
// A reference to the Ethereum 1.x chain.
Eth1Data eth1_data = 2;
// 32 byte field of arbitrary data. This field may contain any data and
// is not used for anything other than a fun message.
bytes graffiti = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// Block operations
// Refer to spec constants at https://github.com/ethereum/eth2.0-specs/blob/dev/specs/core/0_beacon-chain.md#max-operations-per-block
// At most MAX_PROPOSER_SLASHINGS.
repeated ProposerSlashing proposer_slashings = 4 [(ethereum.eth.ext.ssz_max) = "16"];
// At most MAX_ATTESTER_SLASHINGS.
repeated AttesterSlashing attester_slashings = 5 [(ethereum.eth.ext.ssz_max) = "2"];
// At most MAX_ATTESTATIONS.
repeated Attestation attestations = 6 [(ethereum.eth.ext.ssz_max) = "128"];
// At most MAX_DEPOSITS.
repeated Deposit deposits = 7 [(ethereum.eth.ext.ssz_max) = "16"];
// At most MAX_VOLUNTARY_EXITS.
repeated SignedVoluntaryExit voluntary_exits = 8 [(ethereum.eth.ext.ssz_max) = "16"];
}
// Proposer slashings are proofs that a slashable offense has been committed by
// proposing two conflicting blocks from the same validator.
message ProposerSlashing {
// First conflicting signed block header.
SignedBeaconBlockHeader signed_header_1 = 2;
// Second conflicting signed block header.
SignedBeaconBlockHeader signed_header_2 = 3;
}
// Attestor slashings are proofs that a slashable offense has been committed by
// attestating to two conflicting pieces of information by the same validator.
message AttesterSlashing {
// First conflicting attestation.
IndexedAttestation attestation_1 = 1;
// Second conflicting attestation.
IndexedAttestation attestation_2 = 2;
}
// Deposit into the Ethereum consensus from the Ethereum 1.x deposit contract.
message Deposit {
message Data {
// 48 byte BLS public key of the validator.
bytes pubkey = 1 [(ethereum.eth.ext.ssz_size) = "48", (ethereum.eth.ext.spec_name) = "pubkey"];
// A 32 byte hash of the withdrawal address public key.
bytes withdrawal_credentials = 2 [(ethereum.eth.ext.ssz_size) = "32"];
// Deposit amount in gwei.
uint64 amount = 3;
// 96 byte signature from the validators public key.
bytes signature = 4 [(ethereum.eth.ext.ssz_size) = "96"];
}
// 32 byte roots in the deposit tree branch.
repeated bytes proof = 1 [(ethereum.eth.ext.ssz_size) = "33,32"];
Data data = 2;
}
// A message that represents a validator signaling that they want to voluntarily
// withdraw from the active validator set. The message does not contain a
// validator signature.
message VoluntaryExit {
// The epoch on when exit request becomes valid.
uint64 epoch = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Epoch"];
// Index of the exiting validator.
uint64 validator_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
}
// The signed version of voluntary exit.
message SignedVoluntaryExit {
// The unsigned voluntary exit itself.
VoluntaryExit message = 1;
// Validator's 96 byte signature
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
// Eth1Data represents references to the Ethereum 1.x deposit contract.
message Eth1Data {
// The 32 byte deposit tree root for the last deposit included in this
// block.
bytes deposit_root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
// The total number of deposits included in the beacon chain since genesis
// including the deposits in this block.
uint64 deposit_count = 2;
// The 32 byte block hash of the Ethereum 1.x block considered for deposit
// inclusion.
bytes block_hash = 3 [(ethereum.eth.ext.ssz_size) = "32"];
}
// A beacon block header is essentially a beacon block with only a reference to
// the beacon body as a 32 byte merkle tree root. This type of message is more
// lightweight than a full beacon block. The message does not contain
// a validator signature.
message BeaconBlockHeader {
// Beacon chain slot that this block represents.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
// Validator index of the validator that proposed the block header.
uint64 proposer_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
// 32 byte merkle tree root of the parent ssz encoded block.
bytes parent_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// 32 byte merkle tree root of the resulting ssz encoded state after processing this block.
bytes state_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
// 32 byte merkle tree root of the ssz encoded block body.
bytes body_root = 5 [(ethereum.eth.ext.ssz_size) = "32"];
}
message SignedBeaconBlockHeader {
// The unsigned beacon block header itself.
BeaconBlockHeader message = 1;
// 96 byte BLS signature from the validator that produced this block header.
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
message IndexedAttestation {
repeated uint64 attesting_indices = 1 [(ethereum.eth.ext.ssz_max) = "2048"];
AttestationData data = 2;
// 96 bytes aggregate signature.
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
}