-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: Unified configurations #385
Open
snowmead
wants to merge
10
commits into
main
Choose a base branch
from
feat/unified-configurations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c57da17
wip add configs to tasks and add the to cli and command
snowmead 60ac098
Merge branch 'main' into feat/unified-configurations
snowmead f2e982f
Merge branch 'main' into feat/unified-configurations
snowmead d398e41
consolidate task and blockchain service configuration
snowmead 926434c
Merge branch 'main' into feat/unified-configurations
snowmead 07343e6
fix some merge errors
snowmead 99e40f7
remove uneeded serde dep
snowmead 0dc3eb6
unify timeout configuration in `SendExtrinsicOptions`
snowmead c27b65c
Merge branch 'main' into feat/unified-configurations
ffarall 8e98032
docs: :memo: Add TODO comment
ffarall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,47 @@ | ||
[provider] | ||
# BSP provider type | ||
provider_type = "bsp" | ||
# Using memory storage layer for simplicity | ||
storage_layer = "memory" | ||
# Maximum storage capacity in bytes (4GB) | ||
max_storage_capacity = 4294967295 | ||
# Jump capacity in bytes (1GB) | ||
jump_capacity = 1073741824 | ||
# Extrinsic retry timeout in seconds | ||
extrinsic_retry_timeout = 60 | ||
# Node key for identity | ||
node_key = "0x2e6e3670c96202a2d6f5a58b7ac9092c5a51e0250f324eec2111ca94f5e568be" | ||
# Path to keystores | ||
keystore_path = "./docker/dev-keystores" | ||
|
||
# Configuration for the BSP Upload File task | ||
[provider.bsp_upload_file] | ||
# Maximum number of times to retry file upload operations | ||
max_try_count = 5 | ||
# Maximum tip amount to use when submitting file upload extrinsics | ||
max_tip = 100.0 | ||
|
||
# Configuration for the BSP Move Bucket task | ||
[provider.bsp_move_bucket] | ||
# Grace period in seconds to accept download requests after a bucket move is accepted | ||
move_bucket_accepted_grace_period = 14400 | ||
|
||
# Configuration for the BSP Charge Fees task | ||
[provider.bsp_charge_fees] | ||
# Minimum debt threshold for charging users | ||
min_debt = 0 | ||
|
||
# Configuration for the BSP Submit Proof task | ||
[provider.bsp_submit_proof] | ||
# Maximum number of attempts to submit a proof | ||
max_submission_attempts = 5 | ||
|
||
# Configuration for the Blockchain Service | ||
[provider.blockchain_service] | ||
extrinsic_retry_timeout = 60 | ||
|
||
# Optional indexer configuration | ||
[indexer] | ||
# Set to true to enable the indexer | ||
indexer = true | ||
database_url = "postgresql://postgres:postgres@docker-sh-postgres-1:5432/storage_hub" |
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,6 @@ | ||
// TODO CONSTANTS | ||
pub const MAX_PENDING_EVENTS: usize = 2000; | ||
pub const MAX_TASKS_SPAWNED_PER_QUEUE: usize = 2000; | ||
|
||
// TODO CONSTANTS | ||
pub const DEFAULT_ACTOR_COMMAND_QUEUE_WARNING_SIZE: usize = 2000; |
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,4 @@ | ||
use std::collections::VecDeque; | ||
use std::{collections::VecDeque, time::Duration}; | ||
|
||
use anyhow::anyhow; | ||
use log::{debug, error}; | ||
|
@@ -11,7 +11,10 @@ use shc_forest_manager::traits::ForestStorageHandler; | |
use sp_api::ProvideRuntimeApi; | ||
use sp_core::H256; | ||
|
||
use crate::{transaction::SubmittedTransaction, types::ManagedProvider, BlockchainService}; | ||
use crate::{ | ||
transaction::SubmittedTransaction, types::ManagedProvider, types::SendExtrinsicOptions, | ||
BlockchainService, | ||
}; | ||
|
||
const LOG_TARGET: &str = "blockchain-service-capacity-manager"; | ||
|
||
|
@@ -154,7 +157,7 @@ impl CapacityRequestQueue { | |
} | ||
|
||
/// Configuration parameters determining values for capacity increases. | ||
#[derive(Clone)] | ||
#[derive(Clone, Debug)] | ||
pub struct CapacityConfig { | ||
/// Maximum storage capacity of the provider in bytes. | ||
/// | ||
|
@@ -304,13 +307,23 @@ where | |
pallet_storage_providers::Call::change_capacity { new_capacity }, | ||
); | ||
|
||
let extrinsic_retry_timeout = Duration::from_secs(self.config.extrinsic_retry_timeout); | ||
|
||
// Send extrinsic to increase capacity | ||
match self.send_extrinsic(call, Default::default()).await { | ||
match self | ||
.send_extrinsic(call, &SendExtrinsicOptions::new(extrinsic_retry_timeout)) | ||
.await | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't seem to be useful at all if we're not calling |
||
{ | ||
Ok(output) => { | ||
// Add all pending requests to the list of requests waiting for inclusion. | ||
if let Some(capacity_manager) = self.capacity_manager.as_mut() { | ||
capacity_manager.add_pending_requests_to_waiting_for_inclusion( | ||
SubmittedTransaction::new(output.receiver, output.hash, output.nonce), | ||
SubmittedTransaction::new( | ||
output.receiver, | ||
output.hash, | ||
output.nonce, | ||
extrinsic_retry_timeout, | ||
), | ||
); | ||
} else { | ||
error!(target: LOG_TARGET, "Capacity manager not initialized"); | ||
|
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
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
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's up here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for spotting, marked them as constants to remove to make them cli parameters