Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't skip fallback builder when solver fails #3558

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/examples/infra/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ pub trait RunDa<

let marketplace_config = MarketplaceConfig {
auction_results_provider: TestAuctionResultsProvider::<TYPES>::default().into(),
// TODO: we need to pass a valid generic builder url here somehow
generic_builder_url: url::Url::parse("http://localhost").unwrap(),
// TODO: we need to pass a valid fallback builder url here somehow
fallback_builder_url: url::Url::parse("http://localhost").unwrap(),
};

SystemContext::init(
Expand Down
4 changes: 2 additions & 2 deletions crates/hotshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ pub const H_256: usize = 32;
pub struct MarketplaceConfig<TYPES: NodeType, I: NodeImplementation<TYPES>> {
/// auction results provider
pub auction_results_provider: Arc<I::AuctionResultsProvider>,
/// generic builder
pub generic_builder_url: Url,
/// fallback builder
pub fallback_builder_url: Url,
}

/// Bundle of all the memberships a consensus instance uses
Expand Down
4 changes: 2 additions & 2 deletions crates/hotshot/src/tasks/task_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>> CreateTaskState<TYPES, I>
auction_results_provider: Arc::clone(
&handle.hotshot.marketplace_config.auction_results_provider,
),
generic_builder_url: handle
fallback_builder_url: handle
.hotshot
.marketplace_config
.generic_builder_url
.fallback_builder_url
.clone(),
}
}
Expand Down
16 changes: 11 additions & 5 deletions crates/task-impls/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ pub struct TransactionTaskState<TYPES: NodeType, I: NodeImplementation<TYPES>> {
pub decided_upgrade_certificate: Arc<RwLock<Option<UpgradeCertificate<TYPES>>>>,
/// auction results provider
pub auction_results_provider: Arc<I::AuctionResultsProvider>,
/// generic builder url
pub generic_builder_url: Url,
/// fallback builder url
pub fallback_builder_url: Url,
}

impl<TYPES: NodeType, I: NodeImplementation<TYPES>> TransactionTaskState<TYPES, I> {
Expand Down Expand Up @@ -276,17 +276,21 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>> TransactionTaskState<TYPES,
{
let start = Instant::now();

if let Ok(Ok(auction_result)) = async_timeout(
if let Ok(maybe_auction_result) = async_timeout(
self.builder_timeout,
self.auction_results_provider
.fetch_auction_result(block_view),
)
.await
{
let auction_result = maybe_auction_result
.map_err(|e| warn!("Failed to get auction results: {e:#}"))
.unwrap_or_default(); // We continue here, as we still have fallback builder URL

let mut futures = Vec::new();

let mut builder_urls = auction_result.clone().urls();
builder_urls.push(self.generic_builder_url.clone());
builder_urls.push(self.fallback_builder_url.clone());

for url in builder_urls {
futures.push(async_timeout(
Expand Down Expand Up @@ -343,10 +347,12 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>> TransactionTaskState<TYPES,

return None;
}
} else {
warn!("Timeout while getting auction results");
}
}

// If we couldn't get any bundles (due to either the builders or solver failing to return a result), send an empty block
// If we couldn't get any bundles (due to either all of the builders or solver failing to return a result), send an empty block
warn!(
"Failed to get a block for view {:?}, proposing empty block",
block_view
Expand Down
3 changes: 1 addition & 2 deletions crates/testing/src/test_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,7 @@ where
config,
marketplace_config: Box::new(|_| MarketplaceConfig::<TYPES, I> {
auction_results_provider: TestAuctionResultsProvider::<TYPES>::default().into(),
// TODO: we need to pass a valid generic builder url here somehow
generic_builder_url: Url::parse("http://localhost").unwrap(),
fallback_builder_url: Url::parse("http://localhost").unwrap(),
}),
},
metadata: self,
Expand Down