-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(starknet_l1_provider): getting things ready for the client
Adding provider-side boilerplate for provider-batcher communication
- Loading branch information
Gilad Chase
committed
Dec 12, 2024
1 parent
dc8ca7a
commit 0b3f420
Showing
4 changed files
with
63 additions
and
11 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 async_trait::async_trait; | ||
use starknet_l1_provider_types::{L1ProviderRequest, L1ProviderResponse}; | ||
use starknet_sequencer_infra::component_client::{LocalComponentClient, RemoteComponentClient}; | ||
use starknet_sequencer_infra::component_definitions::{ | ||
ComponentRequestAndResponseSender, | ||
ComponentRequestHandler, | ||
}; | ||
use starknet_sequencer_infra::component_server::{LocalComponentServer, RemoteComponentServer}; | ||
use tracing::instrument; | ||
|
||
use crate::L1Provider; | ||
|
||
pub type LocalL1ProviderServer = | ||
LocalComponentServer<L1Provider, L1ProviderRequest, L1ProviderResponse>; | ||
pub type RemoteL1ProviderServer = RemoteComponentServer<L1ProviderRequest, L1ProviderResponse>; | ||
pub type L1ProviderRequestAndResponseSender = | ||
ComponentRequestAndResponseSender<L1ProviderRequest, L1ProviderResponse>; | ||
pub type LocalL1ProviderClient = LocalComponentClient<L1ProviderRequest, L1ProviderResponse>; | ||
pub type RemoteL1ProviderClient = RemoteComponentClient<L1ProviderRequest, L1ProviderResponse>; | ||
|
||
#[async_trait] | ||
impl ComponentRequestHandler<L1ProviderRequest, L1ProviderResponse> for L1Provider { | ||
#[instrument(skip(self))] | ||
async fn handle_request(&mut self, request: L1ProviderRequest) -> L1ProviderResponse { | ||
match request { | ||
L1ProviderRequest::GetTransactions(n_txs) => { | ||
L1ProviderResponse::GetTransactions(self.get_txs(n_txs)) | ||
} | ||
} | ||
} | ||
} |
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