-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ralexstokes/add-validations
Refactor around a Builder API trait
- Loading branch information
Showing
10 changed files
with
303 additions
and
317 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use crate::types::{BidRequest, SignedBuilderBid}; | ||
use async_trait::async_trait; | ||
use beacon_api_client::ApiError; | ||
use ethereum_consensus::bellatrix::mainnet::{ExecutionPayload, SignedBlindedBeaconBlock}; | ||
use ethereum_consensus::builder::SignedValidatorRegistration; | ||
use thiserror::Error; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum Error { | ||
#[error("{0}")] | ||
Api(#[from] ApiError), | ||
#[error("internal server error")] | ||
Internal(String), | ||
#[error("{0}")] | ||
Custom(String), | ||
} | ||
|
||
#[async_trait] | ||
pub trait Builder { | ||
async fn register_validator( | ||
&self, | ||
registration: &SignedValidatorRegistration, | ||
) -> Result<(), Error>; | ||
|
||
async fn fetch_best_bid(&self, bid_request: &BidRequest) -> Result<SignedBuilderBid, Error>; | ||
|
||
async fn open_bid( | ||
&self, | ||
signed_block: &SignedBlindedBeaconBlock, | ||
) -> Result<ExecutionPayload, Error>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
mod builder_api_server; | ||
pub mod builder; | ||
pub mod builder_api_server; | ||
mod relay; | ||
mod relay_mux; | ||
mod serde; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.