Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinI committed Oct 22, 2024
1 parent f479bd0 commit 2b1c75c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
disallowed-names = [ "TYPES" ]
doc-valid-idents = [ "HotShot", ".." ]
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ unexpected_cfgs = { level = "warn", check-cfg = [
] }

[workspace.lints.clippy]
disallowed-names = "deny"
doc_markdown = "deny"
doc_link_with_quotes = "deny"

Expand Down
13 changes: 13 additions & 0 deletions crates/marketplace/src/testing/integration.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! This module implements interfaces necessary to run marketplace builder
//! in HotShot testing harness.

use std::{collections::HashMap, fmt::Display, marker::PhantomData, sync::Arc, time::Duration};

use async_compatibility_layer::art::async_spawn;
Expand Down Expand Up @@ -33,6 +36,9 @@ use crate::{

const BUILDER_CHANNEL_CAPACITY: usize = 1024;

/// Testing configuration for marketplace builder
/// Stores hooks that will be used in the builder in a type-erased manner,
/// allowing for runtime configuration of hooks to use in tests.
struct TestMarketplaceBuilderConfig<Types>
where
Types: NodeType,
Expand All @@ -51,6 +57,9 @@ where
}
}

/// [`TestBuilderImplementation`] for marketplace builder.
/// Passed as a generic parameter to [`TestRunner::run_test`], it is be used
/// to instantiate builder API and builder task.
struct MarketplaceBuilderImpl {}

#[async_trait]
Expand All @@ -65,6 +74,9 @@ where
{
type Config = TestMarketplaceBuilderConfig<Types>;

/// This is mostly boilerplate to instantiate and start [`ProxyGlobalState`] APIs and initial [`BuilderState`]'s event loop.
/// [`BuilderTask`] it returns will be injected into consensus runtime by HotShot testing harness and
/// will forward transactions from hotshot event stream to the builder.
async fn start(
n_nodes: usize,
url: Url,
Expand Down Expand Up @@ -156,6 +168,7 @@ where
}
}

/// Marketplace builder task. Stores all the necessary information to run builder service
struct MarketplaceBuilderTask<Types>
where
Types: NodeType,
Expand Down
2 changes: 2 additions & 0 deletions crates/shared/src/testing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ impl TryFrom<&TransactionPayload> for TestTransaction {
}
}

/// Run a builder test. Thin wrapper around `TestRunner::run_test`, injecting transaction generation
/// and validation tasks based on `validation_config` and `transaction_generation_config` respectively.
pub async fn run_test<V: Versions, BuilderImpl: TestBuilderImplementation<TestTypes>>(
description: TestDescription<TestTypes, MemoryImpl, V>,
validation_config: BuilderValidationConfig,
Expand Down

0 comments on commit 2b1c75c

Please sign in to comment.