Skip to content

Commit

Permalink
Switch marketplace builder to coordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinI committed Nov 12, 2024
1 parent cb5ca22 commit 28d258d
Show file tree
Hide file tree
Showing 13 changed files with 533 additions and 2,543 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v30

- uses: cachix/cachix-action@v15
# If PR is from a non-collaborator (e.g. dependabot) the secrets are missing and the login to cachix fails.
continue-on-error: true
with:
name: espresso-systems-private
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
extraPullNames: nix-community
skipPush: ${{ github.actor == 'dependabot[bot]' }}
- uses: dtolnay/rust-toolchain@stable

- name: Audit
run: nix develop .# -c cargo audit
run: cargo audit
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/marketplace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async-lock = { workspace = true }
async-std = { workspace = true, features = ["unstable", "attributes"] }
async-trait = { workspace = true }
committable = { workspace = true }
derivative = { workspace = true }
derive_more = { workspace = true, features = ["deref", "deref_mut"] }
futures = { workspace = true }
marketplace-builder-shared = { path = "../shared" }

Expand Down
1,430 changes: 0 additions & 1,430 deletions crates/marketplace/src/builder_state.rs

This file was deleted.

43 changes: 43 additions & 0 deletions crates/marketplace/src/hooks.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
use std::marker::PhantomData;

use async_trait::async_trait;
use hotshot::types::Event;
use hotshot_types::traits::node_implementation::NodeType;

#[async_trait]
pub trait BuilderHooks<Types: NodeType>: Sync + Send + 'static {
#[inline(always)]
async fn process_transactions(
&self,
transactions: Vec<Types::Transaction>,
) -> Vec<Types::Transaction> {
transactions
}

#[inline(always)]
async fn handle_hotshot_event(&self, _event: &Event<Types>) {}
}

#[async_trait]
impl<T: ?Sized, Types> BuilderHooks<Types> for Box<T>
where
Types: NodeType,
T: BuilderHooks<Types>,
{
#[inline(always)]
async fn process_transactions(
&self,
transactions: Vec<Types::Transaction>,
) -> Vec<Types::Transaction> {
(**self).process_transactions(transactions).await
}

#[inline(always)]
async fn handle_hotshot_event(&self, event: &Event<Types>) {
(**self).handle_hotshot_event(event).await
}
}

pub struct NoHooks<Types: NodeType>(pub PhantomData<Types>);

impl<Types: NodeType> BuilderHooks<Types> for NoHooks<Types> {}
8 changes: 1 addition & 7 deletions crates/marketplace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@
// It also provides one API services external users:
// 1. Serves a user's request to submit a private transaction

// providing the core services to support above API services
pub mod builder_state;

// Core interaction with the HotShot network
pub mod hooks;
pub mod service;

// utilities
pub mod utils;

// tracking the testing
#[cfg(test)]
pub mod testing;
Loading

0 comments on commit 28d258d

Please sign in to comment.