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

Update Beacon Block Proto Fields #2340

Merged
merged 5 commits into from
Apr 23, 2019
Merged
Changes from all commits
Commits
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
130 changes: 101 additions & 29 deletions proto/beacon/p2p/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,48 @@ message Attestation {
AttestationData data = 1;
bytes aggregation_bitfield = 2;
bytes custody_bitfield = 3;
bytes aggregate_signature = 4; // Type of [uint384] ?
bytes aggregate_signature = 4; // bytes96
}

message AttestationData {
// LMD GHOST vote
uint64 slot = 1;
uint64 shard = 2;
bytes beacon_block_root_hash32 = 3;
bytes epoch_boundary_root_hash32 = 4;
bytes crosslink_data_root_hash32 = 5;
Crosslink latest_crosslink = 6;
uint64 justified_epoch = 7;
bytes justified_block_root_hash32 = 8;
bytes beacon_block_root = 2;

// FFG vote
uint64 source_epoch = 3;
uint64 source_root = 4;
uint64 target_root = 5;

// Crosslink vote
uint64 shard = 6;
bytes previous_crosslink_root = 7;
bytes crosslink_data_root = 8;

// Deprecated
// TODO(2307): Remove deprecated fields
bytes epoch_boundary_root_hash32 = 1000 [deprecated=true];
Crosslink latest_crosslink = 1001 [deprecated=true];
uint64 justified_epoch = 1002 [deprecated=true];
bytes justified_block_root_hash32 = 1003 [deprecated=true];
bytes beacon_block_root_hash32 = 1004 [deprecated=true];
bytes crosslink_data_root_hash32 = 1005 [deprecated=true];
}

message AttestationDataAndCustodyBit {
AttestationData data = 1;
bool custody_bit = 2;
}

message IndexedAttestation {
// Validator indices
repeated uint64 custody_bit_0_indices = 1;
repeated uint64 custody_bit_1_indices = 2;
AttestationData data = 3;
// Aggregate signature
bytes signature = 4; // bytes96
}

message Validator {
bytes pubkey = 1;
// TODO(781): The usage of withdrawal_credentials is not defined in spec. Not used in Prysm yet.
Expand Down Expand Up @@ -120,22 +143,28 @@ message Crosslink {

message BeaconBlock {
uint64 slot = 1;
bytes parent_root_hash32 = 2;
bytes state_root_hash32 = 3;
bytes randao_reveal = 4;
Eth1Data eth1_data = 5;
bytes signature = 6; // bytes96
bytes parent_block_root = 2;
bytes state_root = 3;
BeaconBlockBody body = 4;
bytes signature = 5; // bytes96

// Block Body
BeaconBlockBody body = 7;
// Deprecated
// TODO(2307): Remove deprecated fields
bytes parent_root_hash32 = 1001;
bytes state_root_hash32 = 1002;
bytes randao_reveal = 1003;
Eth1Data eth1_data = 1004;
}

message BeaconBlockBody {
repeated Attestation attestations = 1;
repeated ProposerSlashing proposer_slashings = 2;
repeated AttesterSlashing attester_slashings = 3;
repeated Deposit deposits = 4;
repeated VoluntaryExit voluntary_exits = 5;
bytes randao_reveal = 1; // bytes96
Eth1Data eth1_data = 2;
repeated Attestation attestations = 3;
repeated ProposerSlashing proposer_slashings = 4;
repeated AttesterSlashing attester_slashings = 5;
repeated Deposit deposits = 6;
repeated VoluntaryExit voluntary_exits = 7;
repeated Transfer transfers = 8;
}

message DepositInput {
Expand Down Expand Up @@ -166,29 +195,59 @@ message DepositData {

message ProposerSlashing {
uint64 proposer_index = 1;
ProposalSignedData proposal_data_1 = 2;
bytes proposal_signature_1 = 3; // bytes96
ProposalSignedData proposal_data_2 = 4;
bytes proposal_signature_2 = 5;
BeaconBlockHeader header_1 = 2;
BeaconBlockHeader header_2 = 3;

// Deprecated
// TODO(2307): Remove deprecated fields
ProposalSignedData proposal_data_1 = 1001 [deprecated=true];
bytes proposal_signature_1 = 1002 [deprecated=true]; // bytes96
ProposalSignedData proposal_data_2 = 1003 [deprecated=true];
bytes proposal_signature_2 = 1004 [deprecated=true];
}

message AttesterSlashing {
SlashableAttestation slashable_attestation_1 = 1;
SlashableAttestation slashable_attestation_2 = 2;
IndexedAttestation attestation_1 = 1;
IndexedAttestation attestation_2 = 2;
// Deprecated
// TODO(2307): Remove deprecated fields
SlashableAttestation slashable_attestation_1 = 1001 [deprecated=true];
SlashableAttestation slashable_attestation_2 = 1002 [deprecated=true];
}

message Deposit {
repeated bytes merkle_proof_hash32s = 1;
uint64 merkle_tree_index = 2;
bytes deposit_data = 3;
// Branch in the deposit tree
repeated bytes proof = 1;
// Index in the deposit tree
uint64 index = 2;
DepositData data = 3;
// Deprecated
// TODO(2307): Remove deprecated fields
repeated bytes merkle_proof_hash32s = 1001 [deprecated=true];
uint64 merkle_tree_index = 1002 [deprecated=true];
bytes deposit_data = 1003 [deprecated=true];
}

message VoluntaryExit {
// Minimum epoch for processing exit
uint64 epoch = 1;
uint64 validator_index = 2;
bytes signature = 3; // bytes96
}

message Transfer {
uint64 sender = 1;
uint64 recipient = 2;
// Amount in Gwei
uint64 amount = 3;
// Fee in Gwei for block proposer
uint64 fee = 4;
uint64 slot = 5;
// Sender withdrawal pubkey and signature
bytes pubkey = 6; // bytes48
bytes signature = 7; // bytes96
}

message Eth1Data {
// Root of the deposit tree
bytes deposit_root = 1;
Expand All @@ -207,3 +266,16 @@ message Eth1DataVote {
Eth1Data eth1_data = 1;
uint64 vote_count = 2;
}

message HistoricalBatch {
repeated bytes block_roots = 1;
repeated bytes state_roots = 2;
}

message BeaconBlockHeader {
uint64 slot = 1;
bytes previous_block_root = 2;
bytes state_root = 3;
bytes block_body_root = 4;
bytes signature = 5; // bytes86
}