Skip to content

Instantly share code, notes, and snippets.

@arnetheduck
Last active March 15, 2019 21:10
Show Gist options
  • Save arnetheduck/d0292fc023f5279961792b92819dc011 to your computer and use it in GitHub Desktop.
Save arnetheduck/d0292fc023f5279961792b92819dc011 to your computer and use it in GitHub Desktop.
beacon block, flatbuffers style
struct Bytes8 {
v0: ubyte;
v1: ubyte;
v2: ubyte;
v3: ubyte;
v4: ubyte;
v5: ubyte;
v6: ubyte;
v7: ubyte;
v8: ubyte;
}
struct Bytes32 {
v0: Bytes8;
v1: Bytes8;
v2: Bytes8;
v3: Bytes8;
}
struct ValidatorSig {
a: Bytes32;
b: Bytes32;
}
struct ValidatorPubKey {
a: Bytes32;
}
table Eth1Data {
deposit_root: Bytes32;
block_hash: Bytes32;
}
table ProposalSignedData {
slot: uint64;
shard: uint64;
block_root: Bytes32;
}
table ProposerSlashing {
proposer_index: uint64;
proposal_data_1: ProposalSignedData;
proposal_signature_1: ValidatorSig;
proposal_data_2: ProposalSignedData;
proposal_signature_2: ValidatorSig;
}
struct Crosslink {
epoch: uint64;
shard_block_root: Bytes32;
}
struct AttestationData {
slot: uint64;
shard: uint64;
beacon_block_root: Bytes32;
epoch_boundary_root: Bytes32;
shard_block_root: Bytes32;
latest_crosslink: Crosslink;
justified_epoch: uint64;
justified_block_root: Bytes32;
}
table SlashableAttestation {
validator_indices: [uint64];
data: AttestationData;
custody_bitfield: [byte];
aggregate_signature: ValidatorSig;
}
table AttesterSlashing {
slashable_attestation_1: SlashableAttestation;
slashable_attestation_2: SlashableAttestation;
}
table Attestation {
aggregation_bitfield: [byte];
data: AttestationData;
custody_bitfield: [byte];
aggregate_signature: ValidatorSig;
}
struct AttestationDataAndCustodyBit {
data: AttestationData;
custody_bit: bool;
}
table Deposit {
branch: [Bytes32];
index: uint64;
deposit_data: DepositData;
}
struct DepositInput {
pubkey: ValidatorPubKey;
withdrawal_credentials: Bytes32;
proof_of_possession: ValidatorSig;
}
struct DepositData {
amount: uint64;
timestamp: uint64;
deposit_input: DepositInput;
}
struct VoluntaryExit {
epoch: uint64;
validator_index: uint64;
signature: ValidatorSig;
}
struct Transfer {
from_field: uint64;
to: uint64;
amount: uint64;
fee: uint64;
slot: uint64;
pubkey: ValidatorPubKey;
signature: ValidatorSig;
}
table BeaconBlockBody {
proposer_slashings: [ProposerSlashing];
attester_slashings: [AttesterSlashing];
attestations: [Attestation];
deposits: [Deposit];
voluntary_exits: [VoluntaryExit];
transfers: [Transfer];
}
table BeaconBlock {
slot: uint64;
parent_root: Bytes32;
state_root: Bytes32;
randao_reveal: ValidatorSig;
eth1_data: Eth1Data;
signature: ValidatorSig;
body: BeaconBlockBody;
}
@zah
Copy link

zah commented Mar 14, 2019

struct Bytes32 {
  v0: ubyte;
  v1: ubyte;
  v2: ubyte;
  v3: ubyte;
}

I guess you meant to say Bytes8 instead of ubyte here.

@arnetheduck
Copy link
Author

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment