Skip to content

Commit b455eee

Browse files
committed
refactor: consistency and lints
1 parent 9e48542 commit b455eee

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

crates/asm/subprotocols/bridge-v1/src/state/bridge.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ impl BridgeV1State {
192192
) -> Result<(), DepositValidationError> {
193193
// Validate the deposit first
194194
self.validate_deposit(tx, info)?;
195-
let operators = self.operators.current_multisig_bitmap().clone();
196-
let entry = DepositEntry::new(info.deposit_idx, info.outpoint, operators, info.amt)?;
195+
let notary_operators = self.operators.current_multisig_bitmap().clone();
196+
let entry = DepositEntry::new(info.deposit_idx, info.outpoint, notary_operators, info.amt)?;
197197
self.deposits.insert_deposit(entry)?;
198198

199199
Ok(())

crates/asm/subprotocols/bridge-v1/src/state/deposit.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub struct DepositEntry {
5656
/// Any one honest operator from this set can process user withdrawals.
5757
///
5858
/// Uses a memory-efficient bitmap representation instead of storing operator indices.
59-
operators: OperatorBitmap,
59+
notary_operators: OperatorBitmap,
6060

6161
/// Amount of Bitcoin locked in this deposit (in satoshis).
6262
amt: BitcoinAmount,
@@ -96,17 +96,17 @@ impl DepositEntry {
9696
pub fn new(
9797
idx: u32,
9898
output: OutputRef,
99-
operators: OperatorBitmap,
99+
notary_operators: OperatorBitmap,
100100
amt: BitcoinAmount,
101101
) -> Result<Self, DepositValidationError> {
102-
if operators.active_count() == 0 {
102+
if notary_operators.active_count() == 0 {
103103
return Err(DepositValidationError::EmptyOperators);
104104
}
105105

106106
Ok(Self {
107107
deposit_idx: idx,
108108
output,
109-
operators,
109+
notary_operators,
110110
amt,
111111
})
112112
}
@@ -127,7 +127,7 @@ impl DepositEntry {
127127
///
128128
/// A reference to the operator bitmap that contains the operators active for this deposit.
129129
pub fn notary_operators_bitmap(&self) -> &OperatorBitmap {
130-
&self.operators
130+
&self.notary_operators
131131
}
132132

133133
/// Returns the indices of operators that formed the N/N multisig for this deposit.
@@ -136,7 +136,7 @@ impl DepositEntry {
136136
///
137137
/// Vector containing [`OperatorIdx`] for operators that were active for this deposit.
138138
pub fn notary_operators_indices(&self) -> Vec<OperatorIdx> {
139-
self.operators.to_indices()
139+
self.notary_operators.to_indices()
140140
}
141141

142142
/// Returns the amount of Bitcoin locked in this deposit.
@@ -153,17 +153,14 @@ impl<'a> Arbitrary<'a> for DepositEntry {
153153
// Generate a random Bitcoin UTXO reference
154154
let output: OutputRef = u.arbitrary()?;
155155

156-
// Generate a random number of notary operators between 1 and 20
157-
let num_operators = u.int_in_range(1..=20)?;
158-
159156
// Create OperatorBitmap directly by setting sequential operators as active
160-
let operators = OperatorBitmap::new_sequential_active(num_operators);
157+
let notary_operators = u.arbitrary()?;
161158

162159
// Generate a random Bitcoin amount (between 1 satoshi and 21 million BTC)
163160
let amount: BitcoinAmount = u.arbitrary()?;
164161

165162
// Create the DepositEntry - this should not fail since we ensure operators is non-empty
166-
Self::new(deposit_idx, output, operators, amount)
163+
Self::new(deposit_idx, output, notary_operators, amount)
167164
.map_err(|_| arbitrary::Error::IncorrectFormat)
168165
}
169166
}

0 commit comments

Comments
 (0)