Skip to content

Commit 3d5c759

Browse files
authored
[Guardian] minor (#594)
1 parent 7334237 commit 3d5c759

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

crates/hashi-guardian/src/init.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ pub async fn provisioner_init(
180180
// 5) If we have enough shares, finish initialization: combine shares & set config
181181
if current_share_count >= threshold {
182182
let shares_vec: Vec<Share> = received_shares.iter().cloned().collect();
183-
finalize_init(&shares_vec, &enclave, request.into_state()).await;
183+
finalize_init(&shares_vec, threshold, &enclave, request.into_state()).await;
184184
// Log to S3 indicating that withdrawals can be expected henceforth
185185
enclave
186186
.log_init(PIEnclaveFullyInitialized)
@@ -201,14 +201,11 @@ pub async fn provisioner_init(
201201
/// Panics upon an error as the enclaves state is irrecoverable at this point.
202202
async fn finalize_init(
203203
shares: &[Share],
204+
threshold: usize,
204205
enclave: &Arc<Enclave>,
205206
incoming_state: ProvisionerInitState,
206207
) {
207208
info!("Threshold reached, combining shares.");
208-
let threshold = enclave
209-
.secret_sharing_config()
210-
.expect("secret sharing config set during operator_init")
211-
.threshold();
212209
let enclave_btc_keypair = combine_shares(shares, threshold).expect("Unable to combine shares");
213210

214211
info!("Setting enclave keypair.");

crates/hashi-types/src/guardian/test_utils.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ use super::StandardWithdrawalResponse;
2626
use super::WithdrawalConfig;
2727
use super::WithdrawalID;
2828

29-
// Default secret-sharing params used by mock_for_testing helpers.
30-
const TEST_N: usize = 5;
31-
const TEST_T: usize = 3;
3229
use super::bitcoin_utils::BTC_LIB;
3330
use super::bitcoin_utils::InputUTXO;
3431
use super::bitcoin_utils::OutputUTXO;
@@ -56,6 +53,10 @@ use crate::committee::DEFAULT_MPC_MAX_FAULTY_IN_BASIS_POINTS;
5653
use crate::committee::DEFAULT_MPC_THRESHOLD_IN_BASIS_POINTS;
5754
use crate::committee::DEFAULT_MPC_WEIGHT_REDUCTION_ALLOWED_DELTA;
5855

56+
// Default secret-sharing params used by mock_for_testing helpers.
57+
const TEST_N: usize = 5;
58+
const TEST_T: usize = 3;
59+
5960
// -------------------------------
6061
// Shared deterministic test values
6162
// -------------------------------

0 commit comments

Comments
 (0)