Skip to content

Commit db9e9b9

Browse files
committed
Merge branch 'develop' into refactor/bitcoin-rpc
2 parents 2a95955 + 495fe91 commit db9e9b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1128
-656
lines changed

clarity/src/vm/costs/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ impl TrackerData {
949949
if cost_function_ref.contract_id == boot_costs_id {
950950
m.insert(
951951
f,
952-
ClarityCostFunctionEvaluator::Default(cost_function_ref, *f, v),
952+
ClarityCostFunctionEvaluator::Default(cost_function_ref, f.clone(), v),
953953
);
954954
} else {
955955
m.insert(f, ClarityCostFunctionEvaluator::Clarity(cost_function_ref));

clarity/src/vm/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ pub fn apply(
280280
env.call_stack.insert(&identifier, track_recursion);
281281
let mut resp = match function {
282282
CallableType::NativeFunction(_, function, cost_function) => {
283-
runtime_cost(*cost_function, env, evaluated_args.len())
283+
runtime_cost(cost_function.clone(), env, evaluated_args.len())
284284
.map_err(Error::from)
285285
.and_then(|_| function.apply(evaluated_args, env))
286286
}
@@ -290,7 +290,7 @@ pub fn apply(
290290
} else {
291291
evaluated_args.len() as u64
292292
};
293-
runtime_cost(*cost_function, env, cost_input)
293+
runtime_cost(cost_function.clone(), env, cost_input)
294294
.map_err(Error::from)
295295
.and_then(|_| function.apply(evaluated_args, env))
296296
}

libsigner/src/signer_set.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ impl SignerEntries {
6767
})?;
6868

6969
let stacks_address = StacksAddress::p2pkh(is_mainnet, &signer_public_key);
70-
signer_addr_to_id.insert(stacks_address, signer_id);
71-
signer_id_to_pk.insert(signer_id, signer_public_key);
72-
signer_pk_to_id.insert(signer_public_key, signer_id);
70+
signer_addr_to_id.insert(stacks_address.clone(), signer_id);
71+
signer_id_to_pk.insert(signer_id, signer_public_key.clone());
72+
signer_pk_to_id.insert(signer_public_key.clone(), signer_id);
7373
signer_pks.push(signer_public_key);
74-
signer_id_to_addr.insert(signer_id, stacks_address);
75-
signer_addr_to_weight.insert(stacks_address, entry.weight);
74+
signer_id_to_addr.insert(signer_id, stacks_address.clone());
75+
signer_addr_to_weight.insert(stacks_address.clone(), entry.weight);
7676
signer_addresses.push(stacks_address);
7777
}
7878

libsigner/src/tests/signer_state.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn generate_global_state_evaluator(num_addresses: u32) -> GlobalStateEvaluator {
5353

5454
let mut address_updates = HashMap::new();
5555
for address in address_weights.keys() {
56-
address_updates.insert(*address, update.clone());
56+
address_updates.insert(address.clone(), update.clone());
5757
}
5858
GlobalStateEvaluator::new(address_updates, address_weights)
5959
}
@@ -72,7 +72,7 @@ fn determine_latest_supported_signer_protocol_versions() {
7272
let mut global_eval = generate_global_state_evaluator(5);
7373

7474
let addresses: Vec<_> = global_eval.address_weights.keys().cloned().collect();
75-
let local_address = addresses[0];
75+
let local_address = addresses[0].clone();
7676

7777
let local_update = global_eval
7878
.address_updates
@@ -152,7 +152,7 @@ fn determine_global_burn_views() {
152152
let mut global_eval = generate_global_state_evaluator(5);
153153

154154
let addresses: Vec<_> = global_eval.address_weights.keys().cloned().collect();
155-
let local_address = addresses[0];
155+
let local_address = addresses[0].clone();
156156
let local_update = global_eval
157157
.address_updates
158158
.get(&local_address)
@@ -211,7 +211,7 @@ fn determine_global_states() {
211211
let mut global_eval = generate_global_state_evaluator(5);
212212

213213
let addresses: Vec<_> = global_eval.address_weights.keys().cloned().collect();
214-
let local_address = addresses[0];
214+
let local_address = addresses[0].clone();
215215
let local_update = global_eval
216216
.address_updates
217217
.get(&local_address)
@@ -240,7 +240,7 @@ fn determine_global_states() {
240240
tx_replay_set: ReplayTransactionSet::none(),
241241
};
242242

243-
global_eval.insert_update(local_address, local_update);
243+
global_eval.insert_update(local_address.clone(), local_update);
244244
assert_eq!(global_eval.determine_global_state().unwrap(), state_machine);
245245
let new_miner = StateMachineUpdateMinerState::ActiveMiner {
246246
current_miner_pkh: Hash160([0x00; 20]),
@@ -289,7 +289,7 @@ fn determine_global_states_with_tx_replay_set() {
289289
let mut global_eval = generate_global_state_evaluator(5);
290290

291291
let addresses: Vec<_> = global_eval.address_weights.keys().cloned().collect();
292-
let local_address = addresses[0];
292+
let local_address = addresses[0].clone();
293293
let local_update = global_eval
294294
.address_updates
295295
.get(&local_address)
@@ -337,7 +337,7 @@ fn determine_global_states_with_tx_replay_set() {
337337

338338
// Let's update 3 signers to some new tx_replay_set but one that has no txs in it
339339
for address in addresses.iter().skip(1).take(3) {
340-
global_eval.insert_update(*address, no_tx_replay_set_update.clone());
340+
global_eval.insert_update(address.clone(), no_tx_replay_set_update.clone());
341341
}
342342

343343
// we have disagreement about the burn block height
@@ -346,7 +346,7 @@ fn determine_global_states_with_tx_replay_set() {
346346
"We should have disagreement about the burn view"
347347
);
348348

349-
global_eval.insert_update(local_address, no_tx_replay_set_update.clone());
349+
global_eval.insert_update(local_address.clone(), no_tx_replay_set_update.clone());
350350

351351
let new_burn_view_state_machine = SignerStateMachine {
352352
burn_block,
@@ -357,7 +357,7 @@ fn determine_global_states_with_tx_replay_set() {
357357
};
358358

359359
// Let's tip the scales over to the correct burn view
360-
global_eval.insert_update(local_address, no_tx_replay_set_update);
360+
global_eval.insert_update(local_address.clone(), no_tx_replay_set_update);
361361
assert_eq!(
362362
global_eval.determine_global_state().unwrap(),
363363
new_burn_view_state_machine
@@ -372,7 +372,7 @@ fn determine_global_states_with_tx_replay_set() {
372372
post_condition_mode: TransactionPostConditionMode::Allow,
373373
post_conditions: vec![],
374374
payload: TransactionPayload::TokenTransfer(
375-
local_address.into(),
375+
local_address.clone().into(),
376376
123,
377377
TokenTransferMemo([0u8; 34]),
378378
),

stacks-common/src/types/chainstate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl fmt::Display for PoxId {
286286
}
287287
}
288288

289-
#[derive(Debug, Clone, PartialEq, Eq, Copy, Serialize, Deserialize, Hash)]
289+
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
290290
pub struct StacksAddress {
291291
version: u8,
292292
bytes: Hash160,

stacks-common/src/util/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ macro_rules! define_named_enum {
5050
}
5151
) => {
5252
$(#[$enum_meta])*
53-
#[derive(::serde::Serialize, ::serde::Deserialize, Debug, Hash, PartialEq, Eq, Copy, Clone)]
53+
#[derive(::serde::Serialize, ::serde::Deserialize, Debug, Hash, PartialEq, Eq, Clone)]
5454
pub enum $Name {
5555
$(
5656
$(#[$variant_meta])*

stacks-common/src/util/secp256k1/native.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use crate::util::hash::{hex_bytes, to_hex, Sha256Sum};
3434
// per-thread Secp256k1 context
3535
thread_local!(static _secp256k1: Secp256k1<secp256k1::All> = Secp256k1::new());
3636

37-
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize, Hash)]
37+
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize, Hash)]
3838
pub struct Secp256k1PublicKey {
3939
// serde is broken for secp256k1, so do it ourselves
4040
#[serde(
@@ -45,7 +45,7 @@ pub struct Secp256k1PublicKey {
4545
compressed: bool,
4646
}
4747

48-
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
48+
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
4949
pub struct Secp256k1PrivateKey {
5050
// serde is broken for secp256k1, so do it ourselves
5151
#[serde(
@@ -468,7 +468,7 @@ mod tests {
468468
.unwrap()
469469
.compress_public());
470470

471-
assert_eq!(Secp256k1PrivateKey::from_hex(&h_uncomp), Ok(t1));
471+
assert_eq!(Secp256k1PrivateKey::from_hex(&h_uncomp), Ok(t1.clone()));
472472

473473
t1.set_compress_public(true);
474474

stacks-node/src/burnchains/bitcoin_regtest_controller.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,11 +629,11 @@ impl BitcoinRegtestController {
629629
let filter_addresses = vec![addr2str(&address)];
630630

631631
let pubk = if self.config.miner.segwit {
632-
let mut p = *public_key;
632+
let mut p = public_key.clone();
633633
p.set_compressed(true);
634634
p
635635
} else {
636-
*public_key
636+
public_key.clone()
637637
};
638638

639639
test_debug!("Import public key '{}'", &pubk.to_hex());
@@ -736,11 +736,11 @@ impl BitcoinRegtestController {
736736
block_height: u64,
737737
) -> Option<UTXOSet> {
738738
let pubk = if self.config.miner.segwit && epoch_id >= StacksEpochId::Epoch21 {
739-
let mut p = *public_key;
739+
let mut p = public_key.clone();
740740
p.set_compressed(true);
741741
p
742742
} else {
743-
*public_key
743+
public_key.clone()
744744
};
745745

746746
// Configure UTXO filter

stacks-node/src/keychain.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ mod tests {
354354
}
355355
};
356356
sk.set_compress_public(true);
357-
self.microblocks_secret_keys.push(sk);
357+
self.microblocks_secret_keys.push(sk.clone());
358358

359359
debug!("Microblock keypair rotated";
360360
"burn_block_height" => %burn_block_height,
@@ -451,7 +451,7 @@ mod tests {
451451
}
452452

453453
pub fn generate_op_signer(&self) -> BurnchainOpSigner {
454-
BurnchainOpSigner::new(self.secret_keys[0])
454+
BurnchainOpSigner::new(self.secret_keys[0].clone())
455455
}
456456
}
457457

@@ -536,7 +536,7 @@ mod tests {
536536
TransactionVersion::Testnet,
537537
k1.get_transaction_auth().unwrap(),
538538
TransactionPayload::TokenTransfer(
539-
recv_addr.into(),
539+
recv_addr.clone().into(),
540540
123,
541541
TokenTransferMemo([0u8; 34]),
542542
),

stacks-node/src/nakamoto_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ impl StacksNode {
186186
let burnchain = runloop.get_burnchain();
187187
let atlas_config = config.atlas.clone();
188188
let mut keychain = Keychain::default(config.node.seed.clone());
189-
if let Some(mining_key) = config.miner.mining_key {
189+
if let Some(mining_key) = config.miner.mining_key.clone() {
190190
keychain.set_nakamoto_sk(mining_key);
191191
}
192192

0 commit comments

Comments
 (0)