mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 05:18:30 +00:00
Gloas gossip boilerplate (#8700)
All the required boilerplate for gloas gossip. We'll include the gossip message processing logic in a separate PR Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com> Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ mod builder;
|
||||
mod builder_bid;
|
||||
mod builder_pending_payment;
|
||||
mod builder_pending_withdrawal;
|
||||
mod proposer_preferences;
|
||||
|
||||
pub use builder::{Builder, BuilderIndex};
|
||||
pub use builder_bid::{
|
||||
@@ -10,3 +11,4 @@ pub use builder_bid::{
|
||||
};
|
||||
pub use builder_pending_payment::BuilderPendingPayment;
|
||||
pub use builder_pending_withdrawal::BuilderPendingWithdrawal;
|
||||
pub use proposer_preferences::{ProposerPreferences, SignedProposerPreferences};
|
||||
|
||||
51
consensus/types/src/builder/proposer_preferences.rs
Normal file
51
consensus/types/src/builder/proposer_preferences.rs
Normal file
@@ -0,0 +1,51 @@
|
||||
use crate::test_utils::TestRandom;
|
||||
use crate::{Address, ForkName, SignedRoot, Slot};
|
||||
use bls::Signature;
|
||||
use context_deserialize::context_deserialize;
|
||||
use educe::Educe;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use test_random_derive::TestRandom;
|
||||
use tree_hash_derive::TreeHash;
|
||||
|
||||
#[derive(
|
||||
Default, Debug, Clone, Serialize, Encode, Decode, Deserialize, TreeHash, Educe, TestRandom,
|
||||
)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
#[educe(PartialEq, Hash)]
|
||||
#[context_deserialize(ForkName)]
|
||||
// https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/p2p-interface.md#new-proposerpreferences
|
||||
pub struct ProposerPreferences {
|
||||
pub proposal_slot: Slot,
|
||||
pub validator_index: u64,
|
||||
pub fee_recipient: Address,
|
||||
pub gas_limit: u64,
|
||||
}
|
||||
|
||||
impl SignedRoot for ProposerPreferences {}
|
||||
|
||||
#[derive(TestRandom, TreeHash, Debug, Clone, Encode, Decode, Serialize, Deserialize, Educe)]
|
||||
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
||||
#[educe(PartialEq, Hash)]
|
||||
#[context_deserialize(ForkName)]
|
||||
// https://github.com/ethereum/consensus-specs/blob/master/specs/gloas/p2p-interface.md#new-signedproposerpreferences
|
||||
pub struct SignedProposerPreferences {
|
||||
pub message: ProposerPreferences,
|
||||
pub signature: Signature,
|
||||
}
|
||||
|
||||
impl SignedProposerPreferences {
|
||||
pub fn empty() -> Self {
|
||||
Self {
|
||||
message: ProposerPreferences::default(),
|
||||
signature: Signature::empty(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
ssz_and_tree_hash_tests!(ProposerPreferences);
|
||||
}
|
||||
Reference in New Issue
Block a user