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

refactor: bls_aggr encapsulate task initialization params in TaskMetadata #254

Merged
merged 31 commits into from
Feb 6, 2025
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f361cff
Create new struct for encapsulate initialize_new_task params
damiramirez Jan 30, 2025
44f2b4c
Create new() method and fix tests
damiramirez Jan 30, 2025
3440dd5
Fix integration test with new func
damiramirez Jan 30, 2025
820be8a
Add docs to the new struct
damiramirez Jan 30, 2025
3721a0e
Add docs to methods of TaskMetadata
damiramirez Jan 30, 2025
4884537
Fix typo
damiramirez Jan 30, 2025
d1231e1
Change interface of single_task_aggregator. Now it expects the new st…
damiramirez Jan 30, 2025
4cc09ad
Change some docs
damiramirez Jan 30, 2025
8f214d6
Complete CHANGELOG.md
damiramirez Jan 30, 2025
aad5ef9
Improve docs
damiramirez Jan 30, 2025
7cb81ab
Merge branch 'main' into refactor/task-metadata
MegaRedHand Jan 30, 2025
70c3ab7
Update crates/services/bls_aggregation/src/bls_agg.rs
damiramirez Jan 30, 2025
847c27a
Update crates/services/bls_aggregation/src/bls_agg.rs
damiramirez Jan 30, 2025
bcf260e
Update crates/services/bls_aggregation/src/bls_agg.rs
damiramirez Jan 30, 2025
4a957d6
Update crates/services/bls_aggregation/src/bls_agg.rs
damiramirez Jan 30, 2025
90e8540
Update crates/services/bls_aggregation/src/bls_agg.rs
damiramirez Jan 30, 2025
89034b7
Update crates/services/bls_aggregation/src/bls_agg.rs
damiramirez Jan 30, 2025
cdbf9f2
Update crates/services/bls_aggregation/src/bls_agg.rs
damiramirez Jan 30, 2025
109da17
Update CHANGELOG.md
damiramirez Jan 30, 2025
653eb6d
Update crates/services/bls_aggregation/src/bls_agg.rs
damiramirez Jan 30, 2025
68f0149
Add doc to TaskMetadata
damiramirez Jan 30, 2025
1c1931b
Move metadata.task_index to a variable
damiramirez Jan 30, 2025
6b775a7
Move method single_task_aggregator private
damiramirez Jan 30, 2025
7730ed1
Add before and after examples in CHANGELOG
damiramirez Jan 30, 2025
f80b50f
Use task_index variable in multiple places within the method
damiramirez Jan 30, 2025
1e4bcb6
Fix some comments
damiramirez Jan 30, 2025
bde216e
Change BEFORE and AFTER to code comments
damiramirez Jan 31, 2025
e9aa4ad
Merge branch 'dev' into refactor/task-metadata
damiramirez Feb 5, 2025
3affce0
Merge branch 'dev' into refactor/task-metadata
damiramirez Feb 6, 2025
8939af1
Fix delimiter
damiramirez Feb 6, 2025
fa82029
Add try_into and expect when cast to u32
damiramirez Feb 6, 2025
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
Prev Previous commit
Next Next commit
Change some docs
  • Loading branch information
damiramirez committed Jan 30, 2025
commit 4cc09ad039d48ef2ef8c3d14706a0a197278f51b
18 changes: 6 additions & 12 deletions crates/services/bls_aggregation/src/bls_agg.rs
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ pub struct TaskMetadata {
quorum_numbers: Vec<u8>,
quorum_threshold_percentages: QuorumThresholdPercentages,
time_to_expiry: Duration,
window_duration: Option<Duration>,
window_duration: Duration,
}

impl TaskMetadata {
@@ -52,7 +52,7 @@ impl TaskMetadata {
/// * `time_to_expiry` - The timeout for the task reader to expire
///
/// Use the `with_window_duration` method to set the window duration.
/// If the window duration is not set, it will default to None and the value will be Duration::ZERO.
/// If the window duration is not set, it will default Duration::ZERO.
///
/// # Returns a new instance of the TaskMetadata
pub fn new(
@@ -68,7 +68,7 @@ impl TaskMetadata {
quorum_numbers,
quorum_threshold_percentages,
time_to_expiry,
window_duration: None,
window_duration: Duration::ZERO,
}
}

@@ -79,7 +79,7 @@ impl TaskMetadata {
///
/// # Returns the TaskMetadata with the window duration set
pub fn with_window_duration(mut self, window_duration: Duration) -> Self {
self.window_duration = Some(window_duration);
self.window_duration = window_duration;
self
}
}
@@ -128,7 +128,6 @@ impl<A: AvsRegistryService + Send + Sync + Clone + 'static> BlsAggregatorService
///
/// * `TaskMetadata` - The metadata of the task
///
///
/// # Error
///
/// Returns error if the task index already exists
@@ -307,14 +306,9 @@ impl<A: AvsRegistryService + Send + Sync + Clone + 'static> BlsAggregatorService
///
/// # Arguments
///
/// * `task_index` - The index of the task
/// * `task_created_block` - The block number at which the task was created
/// * `quorum_nums` - The quorum numbers for the task
/// * `quorum_threshold_percentages` - The quorum threshold percentages for the task
/// * `time_to_expiry` - The timeout for the task reader to expire
/// * `TaskMetadata` - The metadata of the task
/// * `aggregated_response_sender` - The sender channel for the aggregated responses
/// * `signatures_rx` - The receiver channel for the signed task responses
/// * `window_duration` - The duration of the window to wait for signatures after quorum is reached
/// * `logger` - The logger to log messages.
#[allow(clippy::too_many_arguments)]
pub async fn single_task_aggregator(
@@ -366,7 +360,7 @@ impl<A: AvsRegistryService + Send + Sync + Clone + 'static> BlsAggregatorService
quorum_threshold_percentage_map,
quorum_apks_g1,
metadata.quorum_numbers,
metadata.window_duration.unwrap_or(Duration::ZERO),
metadata.window_duration,
logger,
)
.await