Skip to content

Commit 4a42ba0

Browse files
committed
Merge branch 'develop' of https://github.com/stacks-network/stacks-core into feat/ignore-old-proposals-node
2 parents 3752fdb + 0ee5d7c commit 4a42ba0

File tree

60 files changed

+919
-728
lines changed

Some content is hidden

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

60 files changed

+919
-728
lines changed

.github/workflows/bitcoin-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ jobs:
144144
- tests::nakamoto_integrations::mock_mining
145145
- tests::nakamoto_integrations::multiple_miners
146146
- tests::nakamoto_integrations::follower_bootup_across_multiple_cycles
147+
- tests::nakamoto_integrations::nakamoto_lockup_events
147148
- tests::nakamoto_integrations::utxo_check_on_startup_panic
148149
- tests::nakamoto_integrations::utxo_check_on_startup_recover
149150
- tests::nakamoto_integrations::v3_signer_api_endpoint

.github/workflows/clippy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ jobs:
3737
uses: actions-rs/clippy-check@v1
3838
with:
3939
token: ${{ secrets.GITHUB_TOKEN }}
40-
args: -p libstackerdb -p stacks-signer -p pox-locking --no-deps --tests --all-features -- -D warnings
40+
args: -p libstackerdb -p stacks-signer -p pox-locking -p clarity -p libsigner --no-deps --tests --all-features -- -D warnings

clarity/src/vm/analysis/analysis_db.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ impl<'a> AnalysisDatabase<'a> {
5050
self.begin();
5151
let result = f(self).or_else(|e| {
5252
self.roll_back()
53-
.map_err(|e| CheckErrors::Expects(format!("{e:?}")).into())?;
53+
.map_err(|e| CheckErrors::Expects(format!("{e:?}")))?;
5454
Err(e)
5555
})?;
5656
self.commit()
57-
.map_err(|e| CheckErrors::Expects(format!("{e:?}")).into())?;
57+
.map_err(|e| CheckErrors::Expects(format!("{e:?}")))?;
5858
Ok(result)
5959
}
6060

@@ -130,9 +130,9 @@ impl<'a> AnalysisDatabase<'a> {
130130
.map_err(|_| CheckErrors::Expects("Bad data deserialized from DB".into()))
131131
})
132132
.transpose()?
133-
.and_then(|mut x| {
133+
.map(|mut x| {
134134
x.canonicalize_types(epoch);
135-
Some(x)
135+
x
136136
}))
137137
}
138138

clarity/src/vm/analysis/arithmetic_checker/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl std::fmt::Display for Error {
6868
}
6969
}
7070

71-
impl<'a> ArithmeticOnlyChecker<'a> {
71+
impl ArithmeticOnlyChecker<'_> {
7272
pub fn check_contract_cost_eligible(contract_analysis: &mut ContractAnalysis) {
7373
let is_eligible = ArithmeticOnlyChecker::run(contract_analysis).is_ok();
7474
contract_analysis.is_cost_contract_eligible = is_eligible;

clarity/src/vm/analysis/contract_interface_builder/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl ContractInterfaceFunction {
276276
outputs: ContractInterfaceFunctionOutput {
277277
type_f: match function_type {
278278
FunctionType::Fixed(FixedFunction { returns, .. }) => {
279-
ContractInterfaceAtomType::from_type_signature(&returns)
279+
ContractInterfaceAtomType::from_type_signature(returns)
280280
}
281281
_ => return Err(CheckErrors::Expects(
282282
"Contract functions should only have fixed function return types!"
@@ -287,7 +287,7 @@ impl ContractInterfaceFunction {
287287
},
288288
args: match function_type {
289289
FunctionType::Fixed(FixedFunction { args, .. }) => {
290-
ContractInterfaceFunctionArg::from_function_args(&args)
290+
ContractInterfaceFunctionArg::from_function_args(args)
291291
}
292292
_ => {
293293
return Err(CheckErrors::Expects(

clarity/src/vm/analysis/errors.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,10 @@ impl CheckErrors {
207207
/// Does this check error indicate that the transaction should be
208208
/// rejected?
209209
pub fn rejectable(&self) -> bool {
210-
match &self {
211-
CheckErrors::SupertypeTooLarge | CheckErrors::Expects(_) => true,
212-
_ => false,
213-
}
210+
matches!(
211+
self,
212+
CheckErrors::SupertypeTooLarge | CheckErrors::Expects(_)
213+
)
214214
}
215215
}
216216

@@ -323,7 +323,7 @@ pub fn check_arguments_at_most<T>(expected: usize, args: &[T]) -> Result<(), Che
323323
}
324324
}
325325

326-
fn formatted_expected_types(expected_types: &Vec<TypeSignature>) -> String {
326+
fn formatted_expected_types(expected_types: &[TypeSignature]) -> String {
327327
let mut expected_types_joined = format!("'{}'", expected_types[0]);
328328

329329
if expected_types.len() > 2 {

clarity/src/vm/analysis/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
pub mod analysis_db;
1818
pub mod arithmetic_checker;
1919
pub mod contract_interface_builder;
20-
#[allow(clippy::result_large_err)]
2120
pub mod errors;
2221
pub mod read_only_checker;
2322
pub mod trait_checker;
@@ -52,7 +51,7 @@ pub fn mem_type_check(
5251
epoch: StacksEpochId,
5352
) -> CheckResult<(Option<TypeSignature>, ContractAnalysis)> {
5453
let contract_identifier = QualifiedContractIdentifier::transient();
55-
let mut contract = build_ast_with_rules(
54+
let contract = build_ast_with_rules(
5655
&contract_identifier,
5756
snippet,
5857
&mut (),
@@ -68,7 +67,7 @@ pub fn mem_type_check(
6867
let cost_tracker = LimitedCostTracker::new_free();
6968
match run_analysis(
7069
&QualifiedContractIdentifier::transient(),
71-
&mut contract,
70+
&contract,
7271
&mut analysis_db,
7372
false,
7473
cost_tracker,
@@ -120,6 +119,7 @@ pub fn type_check(
120119
.map_err(|(e, _cost_tracker)| e)
121120
}
122121

122+
#[allow(clippy::too_many_arguments)]
123123
pub fn run_analysis(
124124
contract_identifier: &QualifiedContractIdentifier,
125125
expressions: &[SymbolicExpression],

clarity/src/vm/analysis/read_only_checker/mod.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub struct ReadOnlyChecker<'a, 'b> {
5050
clarity_version: ClarityVersion,
5151
}
5252

53-
impl<'a, 'b> AnalysisPass for ReadOnlyChecker<'a, 'b> {
53+
impl AnalysisPass for ReadOnlyChecker<'_, '_> {
5454
fn run_pass(
5555
epoch: &StacksEpochId,
5656
contract_analysis: &mut ContractAnalysis,
@@ -250,13 +250,12 @@ impl<'a, 'b> ReadOnlyChecker<'a, 'b> {
250250
Ok(result)
251251
}
252252

253-
/// Checks the native function application of the function named by the
254-
/// string `function` to `args` to determine whether it is read-only
255-
/// compliant.
253+
/// Checks the native function application of the function named by the string `function`
254+
/// to `args` to determine whether it is read-only compliant.
256255
///
257256
/// - Returns `None` if there is no native function named `function`.
258-
/// - If there is such a native function, returns `true` iff this function application is
259-
/// read-only.
257+
/// - If there is such a native function, returns `true` iff this function
258+
/// application is read-only.
260259
///
261260
/// # Errors
262261
/// - Contract parsing errors
@@ -414,15 +413,15 @@ impl<'a, 'b> ReadOnlyChecker<'a, 'b> {
414413
}
415414
}
416415

417-
/// Checks the native and user-defined function applications implied by `expressions`. The
418-
/// first expression is used as the function name, and the tail expressions are used as the
419-
/// arguments.
416+
/// Checks the native and user-defined function applications implied by `expressions`.
417+
///
418+
/// The first expression is used as the function name, and the tail expressions are used as the arguments.
420419
///
421420
/// Returns `true` iff the function application is read-only.
422421
///
423422
/// # Errors
424423
/// - `CheckErrors::NonFunctionApplication` if there is no first expression, or if the first
425-
/// expression is not a `ClarityName`.
424+
/// expression is not a `ClarityName`.
426425
/// - `CheckErrors::UnknownFunction` if the first expression does not name a known function.
427426
fn check_expression_application_is_read_only(
428427
&mut self,

clarity/src/vm/analysis/type_checker/contexts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl TypeMap {
9292
}
9393
}
9494

95-
impl<'a> TypingContext<'a> {
95+
impl TypingContext<'_> {
9696
pub fn new(epoch: StacksEpochId, clarity_version: ClarityVersion) -> TypingContext<'static> {
9797
TypingContext {
9898
epoch,

clarity/src/vm/analysis/type_checker/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl FunctionType {
5555
| StacksEpochId::Epoch30
5656
| StacksEpochId::Epoch31 => self.check_args_2_1(accounting, args, clarity_version),
5757
StacksEpochId::Epoch10 => {
58-
return Err(CheckErrors::Expects("Epoch10 is not supported".into()).into())
58+
Err(CheckErrors::Expects("Epoch10 is not supported".into()).into())
5959
}
6060
}
6161
}
@@ -81,17 +81,14 @@ impl FunctionType {
8181
self.check_args_by_allowing_trait_cast_2_1(db, clarity_version, func_args)
8282
}
8383
StacksEpochId::Epoch10 => {
84-
return Err(CheckErrors::Expects("Epoch10 is not supported".into()).into())
84+
Err(CheckErrors::Expects("Epoch10 is not supported".into()).into())
8585
}
8686
}
8787
}
8888
}
8989

9090
fn is_reserved_word_v3(word: &str) -> bool {
91-
match word {
92-
"block-height" => true,
93-
_ => false,
94-
}
91+
word == "block-height"
9592
}
9693

9794
/// Is this a reserved word that should trigger an analysis error for the given

0 commit comments

Comments
 (0)