diff --git a/CHANGELOG.md b/CHANGELOG.md index de7d88df..4037b906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,61 @@ Each version will have a separate `Breaking Changes` section as well. To describ * Fixed the rewardsv2 bindings version in readme to 0.5.4 in [#246](https://github.com/Layr-Labs/eigensdk-rs/pull/246). ### Breaking changes +* refactor: update interface on `bls aggregation` in [#254](https://github.com/Layr-Labs/eigensdk-rs/pull/254) + * Introduces a new struct `TaskMetadata` with a constructor `TaskMetadata::new` to initialize a new task and a method `with_window_duration` to set the window duration. + * Refactors `initialize_new_task` and `single_task_aggregator` to accept a `TaskMetadata` struct instead of multiple parameters. + *Before* + ```rust + bls_agg_service + .initialize_new_task( + task_index, + block_number as u32, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ) + .await + .unwrap(); + ``` + *After* + ```rust + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ) + bls_agg_service.initialize_new_task(metadata).await.unwrap(); + ``` + + * Removes `initialize_new_task_with_window` since `window_duration` can now be set in `TaskMetadata`. + *Before* + ```rust + bls_agg_service + .initialize_new_task_with_window( + task_index, + block_number as u32, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + window_duration, + ) + .await + .unwrap(); + ``` + *After* + ```rust + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ).with_window_duration(window_duration); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); + ``` + ### Removed ## [0.1.3] - 2024-01-17 diff --git a/crates/services/bls_aggregation/src/bls_agg.rs b/crates/services/bls_aggregation/src/bls_agg.rs index cd1d713c..40807877 100644 --- a/crates/services/bls_aggregation/src/bls_agg.rs +++ b/crates/services/bls_aggregation/src/bls_agg.rs @@ -31,6 +31,66 @@ pub struct AggregatedOperators { pub signers_operator_ids_set: HashMap, bool>, } +/// Contains the metadata required to initialize a new task. +#[derive(Clone)] +pub struct TaskMetadata { + /// Index of the task + task_index: TaskIndex, + /// Block the task was created + task_created_block: u32, // TODO: Should this be a u64? + /// Quorum numbers which should respond to the task + quorum_numbers: Vec, + /// Thresholds for each quorum + quorum_threshold_percentages: QuorumThresholdPercentages, + /// Time before expiry of the task response aggregation + time_to_expiry: Duration, + // Duration of the window to wait for signatures after quorum is reached + window_duration: Duration, +} + +impl TaskMetadata { + /// Creates a new instance of [`TaskMetadata`] + /// + /// # Arguments + /// * `task_index` - index of the task + /// * `task_created_block` - block number at which the task was created + /// * `quorum_numbers` - quorum numbers which should respond to the task + /// * `quorum_threshold_percentages` - threshold percentages for each quorum + /// * `time_to_expiry` - time until the task expires + /// + /// Use [`with_window_duration`](Self::with_window_duration) to set the window duration. + /// If the window duration is not set, it will default to [`Duration::ZERO`]. + /// + /// # Returns a new instance of [`TaskMetadata`] + pub fn new( + task_index: TaskIndex, + task_created_block: u64, + quorum_numbers: Vec, + quorum_threshold_percentages: QuorumThresholdPercentages, + time_to_expiry: Duration, + ) -> Self { + Self { + task_index, + task_created_block: task_created_block as u32, // TODO: Review this possible panic + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + window_duration: Duration::ZERO, + } + } + + /// Sets the window duration for the task + /// + /// # Arguments + /// * `window_duration` - The duration of the window to wait for signatures after quorum is reached + /// + /// # Returns the TaskMetadata with the window duration set + pub fn with_window_duration(mut self, window_duration: Duration) -> Self { + self.window_duration = window_duration; + self + } +} + /// The BLS Aggregator Service main struct #[derive(Debug)] pub struct BlsAggregatorService @@ -73,57 +133,16 @@ impl 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 + /// * `metadata` - task metadata /// /// # Error /// /// Returns error if the task index already exists pub async fn initialize_new_task( &self, - task_index: TaskIndex, - task_created_block: u32, - quorum_nums: Vec, - quorum_threshold_percentages: QuorumThresholdPercentages, - time_to_expiry: Duration, - ) -> Result<(), BlsAggregationServiceError> { - self.initialize_new_task_with_window( - task_index, - task_created_block, - quorum_nums, - quorum_threshold_percentages, - time_to_expiry, - Duration::ZERO, - ) - .await - } - - /// Creates a new task meant to process new signed task responses for a task tokio channel. - /// - /// # 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 - /// * `window_duration` - The duration of the window to wait for signatures after quorum is reached - /// - /// # Error - /// - /// Returns error if the task index already exists - pub async fn initialize_new_task_with_window( - &self, - task_index: TaskIndex, - task_created_block: u32, - quorum_nums: Vec, - quorum_threshold_percentages: QuorumThresholdPercentages, - time_to_expiry: Duration, - window_duration: Duration, + metadata: TaskMetadata, ) -> Result<(), BlsAggregationServiceError> { + let task_index = metadata.task_index; let signatures_rx = { let mut task_channel = self.signed_task_response.write(); @@ -150,14 +169,9 @@ impl BlsAggregatorService // Process each signed response here let _ = BlsAggregatorService::::single_task_aggregator( avs_registry_service, - task_index, - task_created_block, - quorum_nums.clone(), - quorum_threshold_percentages.clone(), - time_to_expiry, + metadata, aggregated_response_sender, signatures_rx, - window_duration, logger, ) .await @@ -300,43 +314,33 @@ impl 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 + /// * `metadata` - task metadata /// * `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( + async fn single_task_aggregator( avs_registry_service: A, - task_index: TaskIndex, - task_created_block: u32, - quorum_nums: Vec, - quorum_threshold_percentages: QuorumThresholdPercentages, - time_to_expiry: Duration, + metadata: TaskMetadata, aggregated_response_sender: UnboundedSender< Result, >, signatures_rx: UnboundedReceiver, - window_duration: Duration, logger: SharedLogger, ) -> Result<(), BlsAggregationServiceError> { - let quorum_threshold_percentage_map: HashMap = quorum_nums + let quorum_threshold_percentage_map: HashMap = metadata + .quorum_numbers .iter() .enumerate() - .map(|(i, quorum_number)| (*quorum_number, quorum_threshold_percentages[i])) + .map(|(i, quorum_number)| (*quorum_number, metadata.quorum_threshold_percentages[i])) .collect(); let operator_state_avs = avs_registry_service - .get_operators_avs_state_at_block(task_created_block, &quorum_nums) + .get_operators_avs_state_at_block(metadata.task_created_block, &metadata.quorum_numbers) .await .map_err(|_| BlsAggregationServiceError::RegistryError)?; let quorums_avs_state = avs_registry_service - .get_quorums_avs_state_at_block(&quorum_nums, task_created_block) + .get_quorums_avs_state_at_block(&metadata.quorum_numbers, metadata.task_created_block) .await .map_err(|_| BlsAggregationServiceError::RegistryError)?; let total_stake_per_quorum: HashMap<_, _> = quorums_avs_state @@ -344,7 +348,8 @@ impl BlsAggregatorService .map(|(k, v)| (*k, v.total_stake)) .collect(); - let quorum_apks_g1: Vec = quorum_nums + let quorum_apks_g1: Vec = metadata + .quorum_numbers .iter() .filter_map(|quorum_num| quorums_avs_state.get(quorum_num)) .map(|avs_state| avs_state.agg_pub_key_g1.clone()) @@ -352,17 +357,17 @@ impl BlsAggregatorService Self::loop_task_aggregator( avs_registry_service, - task_index, - task_created_block, - time_to_expiry, + metadata.task_index, + metadata.task_created_block, + metadata.time_to_expiry, aggregated_response_sender, signatures_rx, operator_state_avs, total_stake_per_quorum, quorum_threshold_percentage_map, quorum_apks_g1, - quorum_nums, - window_duration, + metadata.quorum_numbers, + metadata.window_duration, logger, ) .await @@ -786,6 +791,7 @@ impl BlsAggregatorService #[cfg(test)] mod tests { use super::{BlsAggregationServiceError, BlsAggregationServiceResponse, BlsAggregatorService}; + use crate::bls_agg::TaskMetadata; use alloy::primitives::{B256, U256}; use eigen_crypto_bls::{BlsG1Point, BlsG2Point, BlsKeyPair, Signature}; use eigen_logging::get_test_logger; @@ -862,16 +868,14 @@ mod tests { FakeAvsRegistryService::new(block_number, vec![test_operator_1.clone()]); let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); bls_agg_service .process_new_signature( @@ -937,16 +941,14 @@ mod tests { FakeAvsRegistryService::new(block_number, test_operators.clone()); let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let bls_signature_1 = test_operator_1 .bls_keypair @@ -1056,16 +1058,14 @@ mod tests { let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let bls_sig_op_1 = test_operator_1 .bls_keypair .sign_message(task_response_digest.as_ref()); @@ -1163,16 +1163,14 @@ mod tests { let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let bls_sig_op_1 = test_operator_1 .bls_keypair .sign_message(task_response_digest.as_ref()); @@ -1259,28 +1257,30 @@ mod tests { let task_1_index = 1; let task_1_response = 123; // Initialize with appropriate data let task_1_response_digest = hash(task_1_response); + let metadata1 = TaskMetadata::new( + task_1_index, + block_number, + quorum_numbers.clone(), + quorum_threshold_percentages.clone(), + time_to_expiry, + ); bls_agg_service - .initialize_new_task( - task_1_index, - block_number as u32, - quorum_numbers.clone(), - quorum_threshold_percentages.clone(), - time_to_expiry, - ) + .initialize_new_task(metadata1) .await .unwrap(); let task_2_index = 2; let task_2_response = 234; // Initialize with appropriate data let task_2_response_digest = hash(task_2_response); + let metadata2 = TaskMetadata::new( + task_2_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); bls_agg_service - .initialize_new_task( - task_2_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) + .initialize_new_task(metadata2) .await .unwrap(); @@ -1424,16 +1424,14 @@ mod tests { FakeAvsRegistryService::new(block_number, vec![test_operator_1.clone()]); let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let response = bls_agg_service .aggregated_response_receiver @@ -1477,16 +1475,14 @@ mod tests { let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); bls_agg_service .process_new_signature( task_index, @@ -1556,16 +1552,14 @@ mod tests { let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); bls_agg_service .process_new_signature( task_index, @@ -1618,16 +1612,14 @@ mod tests { let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let bls_sig_op_1 = test_operator_1 .bls_keypair @@ -1728,16 +1720,14 @@ mod tests { let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let bls_sig_op_1 = test_operator_1 .bls_keypair @@ -1839,16 +1829,14 @@ mod tests { let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let bls_sig_op_1 = test_operator_1 .bls_keypair @@ -1912,16 +1900,14 @@ mod tests { let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let bls_sig_op_1 = test_operator_1 .bls_keypair @@ -1978,16 +1964,14 @@ mod tests { let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let bls_sig_op_1 = test_operator_1 .bls_keypair @@ -2072,16 +2056,14 @@ mod tests { let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let task_response_1 = 123; // Initialize with appropriate data let task_response_1_digest = hash(task_response_1); @@ -2149,16 +2131,14 @@ mod tests { FakeAvsRegistryService::new(block_number, vec![test_operator_1.clone()]); let bls_agg_service = BlsAggregatorService::new(fake_avs_registry_service, get_test_logger()); - bls_agg_service - .initialize_new_task( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let result = bls_agg_service .process_new_signature( @@ -2225,17 +2205,15 @@ mod tests { let window_duration = Duration::from_secs(1); let start = Instant::now(); - bls_agg_service - .initialize_new_task_with_window( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - window_duration, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ) + .with_window_duration(window_duration); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let task_response_1_digest = hash(task_response); let bls_sig_op_1 = test_operator_1 @@ -2351,17 +2329,15 @@ mod tests { let window_duration = Duration::from_secs(10); let start = Instant::now(); - bls_agg_service - .initialize_new_task_with_window( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - window_duration, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ) + .with_window_duration(window_duration); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let task_response_1_digest = hash(task_response); let bls_sig_op_1 = test_operator_1 @@ -2457,17 +2433,15 @@ mod tests { let window_duration = Duration::ZERO; let start = Instant::now(); - bls_agg_service - .initialize_new_task_with_window( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - window_duration, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ) + .with_window_duration(window_duration); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let task_response_1_digest = hash(task_response); let bls_sig_op_1 = test_operator_1 @@ -2565,17 +2539,15 @@ mod tests { let window_duration = Duration::from_secs(1); let start = Instant::now(); - bls_agg_service - .initialize_new_task_with_window( - task_index, - block_number as u32, - quorum_numbers, - quorum_threshold_percentages, - time_to_expiry, - window_duration, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + block_number, + quorum_numbers, + quorum_threshold_percentages, + time_to_expiry, + ) + .with_window_duration(window_duration); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); let task_response_1_digest = hash(task_response); let bls_sig_op_1 = test_operator_1 diff --git a/crates/services/bls_aggregation/src/bls_agg_test.rs b/crates/services/bls_aggregation/src/bls_agg_test.rs index c21c6470..77268402 100644 --- a/crates/services/bls_aggregation/src/bls_agg_test.rs +++ b/crates/services/bls_aggregation/src/bls_agg_test.rs @@ -1,6 +1,6 @@ #[cfg(test)] pub mod integration_test { - use crate::bls_agg::BlsAggregatorService; + use crate::bls_agg::{BlsAggregatorService, TaskMetadata}; use crate::bls_aggregation_service_response::BlsAggregationServiceResponse; use alloy::primitives::{aliases::U96, hex, Bytes, FixedBytes, B256, U256}; use alloy::providers::Provider; @@ -199,16 +199,14 @@ pub mod integration_test { let time_to_expiry = Duration::from_secs(10); // Initialize the task - bls_agg_service - .initialize_new_task( - task_index, - current_block_num as u32, - quorum_nums.to_vec(), - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + current_block_num, + quorum_nums.to_vec(), + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); // Compute the signature and send it to the aggregation service let task_response = 123; @@ -385,16 +383,14 @@ pub mod integration_test { let time_to_expiry = Duration::from_secs(10); // Initialize the task - bls_agg_service - .initialize_new_task( - task_index, - current_block_num as u32, - quorum_nums.to_vec(), - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + current_block_num, + quorum_nums.to_vec(), + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); // Compute the signature and send it to the aggregation service let task_response = 123; @@ -605,16 +601,14 @@ pub mod integration_test { let time_to_expiry = Duration::from_secs(10); // Initialize the task - bls_agg_service - .initialize_new_task( - task_index, - current_block_num as u32, - quorum_nums.to_vec(), - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + current_block_num, + quorum_nums.to_vec(), + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); // Compute the signature and send it to the aggregation service let task_response = 123; @@ -814,16 +808,14 @@ pub mod integration_test { let time_to_expiry = Duration::from_secs(1); // Initialize the task - bls_agg_service - .initialize_new_task( - task_index, - current_block_num as u32, - quorum_nums.to_vec(), - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + current_block_num, + quorum_nums.to_vec(), + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); // Compute the signature and send it to the aggregation service let task_response = 123; @@ -993,16 +985,14 @@ pub mod integration_test { let time_to_expiry = Duration::from_secs(1); // Initialize the task - bls_agg_service - .initialize_new_task( - task_index, - current_block_num as u32, - quorum_nums.to_vec(), - quorum_threshold_percentages, - time_to_expiry, - ) - .await - .unwrap(); + let metadata = TaskMetadata::new( + task_index, + current_block_num, + quorum_nums.to_vec(), + quorum_threshold_percentages, + time_to_expiry, + ); + bls_agg_service.initialize_new_task(metadata).await.unwrap(); // Compute the signature and send it to the aggregation service let task_response = 123;