Skip to content

Commit

Permalink
Merge branch 'develop' into feat/block_rejections_heuristic
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeioris committed Jan 30, 2025
2 parents d5abfdc + 1f97bcf commit ed48786
Show file tree
Hide file tree
Showing 331 changed files with 6,603 additions and 7,191 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[alias]
stacks-node = "run --package stacks-node --"
fmt-stacks = "fmt -- --config group_imports=StdExternalCrate,imports_granularity=Module"
clippy-stacks = "clippy -p libstackerdb -p stacks-signer -p pox-locking -p clarity -p libsigner -p stacks-common --no-deps --tests --all-features -- -D warnings"

# Uncomment to improve performance slightly, at the cost of portability
# * Note that native binaries may not run on CPUs that are different from the build machine
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/bitcoin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
- tests::signer::v0::signing_in_0th_tenure_of_reward_cycle
- tests::signer::v0::continue_after_tenure_extend
- tests::signer::v0::tenure_extend_after_idle_signers
- tests::signer::v0::tenure_extend_with_other_transactions
- tests::signer::v0::tenure_extend_after_idle_miner
- tests::signer::v0::tenure_extend_after_failed_miner
- tests::signer::v0::tenure_extend_succeeds_after_rejected_attempt
Expand Down Expand Up @@ -168,6 +169,7 @@ jobs:
- tests::nakamoto_integrations::sip029_coinbase_change
- tests::nakamoto_integrations::clarity_cost_spend_down
- tests::nakamoto_integrations::v3_blockbyheight_api_endpoint
- tests::nakamoto_integrations::mine_invalid_principal_from_consensus_buff
- tests::nakamoto_integrations::test_tenure_extend_from_flashblocks
# TODO: enable these once v1 signer is supported by a new nakamoto epoch
# - tests::signer::v1::dkg
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,4 @@ jobs:
components: clippy
- name: Clippy
id: clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -p libstackerdb -p stacks-signer -p pox-locking -p clarity -p libsigner -p stacks-common --no-deps --tests --all-features -- -D warnings
run: cargo clippy-stacks
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE

## [Unreleased]

### Changed

- Miner will include other transactions in blocks with tenure extend transactions (#5760)

## [3.1.0.0.4]

### Added

- The stacks-node miner now performs accurate tenure-extensions in certain bitcoin block production
Expand Down
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,18 @@ You can automatically reformat your commit via:
cargo fmt-stacks
```

## Clippy Warnings

PRs will be checked against `clippy` and will _fail_ if any clippy warnings are generated.
Unfortunately, not all existing clippy warnings have been addressed throughout stacks-core, so arguments must be passed via the command line.
Therefore, we handle `clippy` configurations using a Cargo alias: `cargo clippy-stacks`

You can check what warnings need to be addressed locally via:

```bash
cargo clippy-stacks
```

## Comments

Comments are very important for the readability and correctness of the codebase. The purpose of comments is:
Expand Down
41 changes: 41 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions clarity/src/libclarity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#![allow(unused_imports)]
#![allow(dead_code)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![cfg_attr(test, allow(unused_variables, unused_assignments))]

#[allow(unused_imports)]
#[macro_use(o, slog_log, slog_trace, slog_debug, slog_info, slog_warn, slog_error)]
extern crate slog;

#[macro_use]
extern crate serde_derive;

#[macro_use]
extern crate serde_json;

#[cfg(any(test, feature = "testing"))]
Expand Down
4 changes: 2 additions & 2 deletions clarity/src/vm/analysis/analysis_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ use std::collections::{BTreeMap, BTreeSet};

use stacks_common::types::StacksEpochId;

use crate::vm::analysis::errors::{CheckError, CheckErrors, CheckResult};
use crate::vm::analysis::errors::{CheckErrors, CheckResult};
use crate::vm::analysis::type_checker::ContractAnalysis;
use crate::vm::database::{
ClarityBackingStore, ClarityDeserializable, ClaritySerializable, RollbackWrapper,
};
use crate::vm::representations::ClarityName;
use crate::vm::types::signatures::FunctionSignature;
use crate::vm::types::{FunctionType, QualifiedContractIdentifier, TraitIdentifier, TypeSignature};
use crate::vm::types::{FunctionType, QualifiedContractIdentifier, TraitIdentifier};
use crate::vm::ClarityVersion;

pub struct AnalysisDatabase<'a> {
Expand Down
12 changes: 3 additions & 9 deletions clarity/src/vm/analysis/arithmetic_checker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

use hashbrown::HashMap;

pub use super::errors::{
check_argument_count, check_arguments_at_least, CheckError, CheckErrors, CheckResult,
};
use super::AnalysisDatabase;
use crate::vm::analysis::types::{AnalysisPass, ContractAnalysis};
use crate::vm::analysis::types::ContractAnalysis;
use crate::vm::functions::define::{DefineFunctions, DefineFunctionsParsed};
use crate::vm::functions::{tuples, NativeFunctions};
use crate::vm::functions::NativeFunctions;
use crate::vm::representations::SymbolicExpressionType::{
Atom, AtomValue, Field, List, LiteralValue, TraitReference,
};
use crate::vm::representations::{ClarityName, SymbolicExpression, SymbolicExpressionType};
use crate::vm::types::{
parse_name_type_pairs, PrincipalData, TupleTypeSignature, TypeSignature, Value,
};
use crate::vm::representations::{ClarityName, SymbolicExpression};
use crate::vm::variables::NativeVariables;
use crate::vm::ClarityVersion;

Expand Down
7 changes: 2 additions & 5 deletions clarity/src/vm/analysis/read_only_checker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ pub use super::errors::{
use super::AnalysisDatabase;
use crate::vm::analysis::types::{AnalysisPass, ContractAnalysis};
use crate::vm::functions::define::DefineFunctionsParsed;
use crate::vm::functions::{tuples, NativeFunctions};
use crate::vm::functions::NativeFunctions;
use crate::vm::representations::SymbolicExpressionType::{
Atom, AtomValue, Field, List, LiteralValue, TraitReference,
};
use crate::vm::representations::{ClarityName, SymbolicExpression, SymbolicExpressionType};
use crate::vm::types::{
parse_name_type_pairs, PrincipalData, TupleTypeSignature, TypeSignature, Value,
};
use crate::vm::variables::NativeVariables;
use crate::vm::types::{PrincipalData, Value};
use crate::vm::ClarityVersion;

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion clarity/src/vm/analysis/read_only_checker/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rstest_reuse::{self, *};
use stacks_common::types::StacksEpochId;

use crate::vm::analysis::type_checker::v2_1::tests::mem_type_check;
use crate::vm::analysis::{type_check, CheckError, CheckErrors};
use crate::vm::analysis::{type_check, CheckErrors};
use crate::vm::ast::parse;
use crate::vm::database::MemoryBackingStore;
use crate::vm::tests::test_clarity_versions;
Expand Down
6 changes: 1 addition & 5 deletions clarity/src/vm/analysis/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@

use stacks_common::types::StacksEpochId;

use crate::vm::analysis::errors::CheckErrors;
use crate::vm::analysis::mem_type_check as mem_run_analysis;
use crate::vm::analysis::type_checker::v2_1::tests::mem_type_check;
use crate::vm::analysis::{
mem_type_check as mem_run_analysis, type_check, AnalysisDatabase, ContractAnalysis,
};
use crate::vm::ast::parse;
use crate::vm::ClarityVersion;

#[test]
Expand Down
8 changes: 1 addition & 7 deletions clarity/src/vm/analysis/trait_checker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

use hashbrown::HashMap;
use stacks_common::types::StacksEpochId;

use crate::vm::analysis::errors::{CheckError, CheckErrors, CheckResult};
use crate::vm::analysis::errors::{CheckErrors, CheckResult};
use crate::vm::analysis::types::{AnalysisPass, ContractAnalysis};
use crate::vm::analysis::AnalysisDatabase;
use crate::vm::functions::define::{DefineFunctions, DefineFunctionsParsed};
use crate::vm::functions::NativeFunctions;
use crate::vm::representations::SymbolicExpressionType::{Atom, AtomValue, List, LiteralValue};
use crate::vm::representations::{ClarityName, SymbolicExpression};
use crate::vm::types::{FunctionType, TraitIdentifier, TypeSignature, Value};

pub struct TraitChecker {
epoch: StacksEpochId,
Expand Down
3 changes: 1 addition & 2 deletions clarity/src/vm/analysis/trait_checker/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ use rstest::rstest;
use rstest_reuse::{self, *};
use stacks_common::types::StacksEpochId;

use crate::vm::analysis::contract_interface_builder::build_contract_interface;
use crate::vm::analysis::errors::CheckErrors;
use crate::vm::analysis::{type_check, AnalysisDatabase, CheckError};
use crate::vm::analysis::{type_check, CheckError};
use crate::vm::ast::errors::ParseErrors;
use crate::vm::ast::{build_ast, parse};
use crate::vm::database::MemoryBackingStore;
Expand Down
14 changes: 3 additions & 11 deletions clarity/src/vm/analysis/type_checker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,11 @@ pub mod v2_1;

use stacks_common::types::StacksEpochId;

use super::errors::{
check_argument_count, check_arguments_at_least, check_arguments_at_most, CheckError,
CheckErrors, CheckResult,
};
use super::errors::{CheckErrors, CheckResult};
pub use super::types::{AnalysisPass, ContractAnalysis};
use super::AnalysisDatabase;
use crate::vm::costs::{analysis_typecheck_cost, CostTracker, LimitedCostTracker};
use crate::vm::types::signatures::{
CallableSubtype, FunctionArgSignature, FunctionReturnsSignature,
};
use crate::vm::types::{
FixedFunction, FunctionType, PrincipalData, SequenceSubtype, StringSubtype, TypeSignature,
};
use crate::vm::costs::CostTracker;
use crate::vm::types::{FunctionType, TypeSignature};
use crate::vm::{ClarityVersion, Value};

impl FunctionType {
Expand Down
3 changes: 1 addition & 2 deletions clarity/src/vm/analysis/type_checker/v2_05/contexts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use hashbrown::{HashMap, HashSet};

use crate::vm::analysis::errors::{CheckError, CheckErrors, CheckResult};
use crate::vm::analysis::types::ContractAnalysis;
use crate::vm::contexts::MAX_CONTEXT_DEPTH;
use crate::vm::representations::{ClarityName, SymbolicExpression};
use crate::vm::representations::ClarityName;
use crate::vm::types::signatures::FunctionSignature;
use crate::vm::types::{FunctionType, TraitIdentifier, TypeSignature};

Expand Down
13 changes: 5 additions & 8 deletions clarity/src/vm/analysis/type_checker/v2_05/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,31 @@ pub mod natives;

use std::collections::BTreeMap;

use hashbrown::HashMap;
use stacks_common::types::StacksEpochId;

use self::contexts::ContractContext;
pub use self::natives::{SimpleNativeFunction, TypedNativeFunction};
use super::contexts::{TypeMap, TypingContext};
use super::{AnalysisPass, ContractAnalysis};
use super::ContractAnalysis;
pub use crate::vm::analysis::errors::{
check_argument_count, check_arguments_at_least, CheckError, CheckErrors, CheckResult,
};
use crate::vm::analysis::AnalysisDatabase;
use crate::vm::contexts::Environment;
use crate::vm::costs::cost_functions::ClarityCostFunction;
use crate::vm::costs::{
analysis_typecheck_cost, cost_functions, runtime_cost, ClarityCostFunctionReference,
CostErrors, CostOverflowingMath, CostTracker, ExecutionCost, LimitedCostTracker,
analysis_typecheck_cost, runtime_cost, CostErrors, CostOverflowingMath, CostTracker,
ExecutionCost, LimitedCostTracker,
};
use crate::vm::errors::InterpreterError;
use crate::vm::functions::define::DefineFunctionsParsed;
use crate::vm::functions::NativeFunctions;
use crate::vm::representations::SymbolicExpressionType::{
Atom, AtomValue, Field, List, LiteralValue, TraitReference,
};
use crate::vm::representations::{depth_traverse, ClarityName, SymbolicExpression};
use crate::vm::types::signatures::{FunctionSignature, BUFF_20};
use crate::vm::types::signatures::FunctionSignature;
use crate::vm::types::{
parse_name_type_pairs, FixedFunction, FunctionArg, FunctionType, PrincipalData,
QualifiedContractIdentifier, TupleTypeSignature, TypeSignature, Value,
QualifiedContractIdentifier, TypeSignature, Value,
};
use crate::vm::variables::NativeVariables;
use crate::vm::ClarityVersion;
Expand Down
8 changes: 4 additions & 4 deletions clarity/src/vm/analysis/type_checker/v2_05/natives/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

use super::{no_type, FunctionType, TypeChecker, TypeResult, TypingContext};
use crate::vm::analysis::errors::{check_argument_count, CheckError, CheckErrors, CheckResult};
use super::{TypeChecker, TypeResult, TypingContext};
use crate::vm::analysis::errors::{check_argument_count, CheckErrors};
use crate::vm::costs::cost_functions::ClarityCostFunction;
use crate::vm::costs::{cost_functions, runtime_cost};
use crate::vm::costs::runtime_cost;
use crate::vm::representations::SymbolicExpression;
use crate::vm::types::{BlockInfoProperty, TupleTypeSignature, TypeSignature, MAX_VALUE_SIZE};
use crate::vm::types::TypeSignature;

pub fn check_special_get_owner(
checker: &mut TypeChecker,
Expand Down
11 changes: 4 additions & 7 deletions clarity/src/vm/analysis/type_checker/v2_05/natives/maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@

use stacks_common::types::StacksEpochId;

use super::check_special_tuple_cons;
use crate::vm::analysis::type_checker::v2_05::{
check_arguments_at_least, no_type, CheckError, CheckErrors, TypeChecker, TypeResult,
TypingContext,
check_arguments_at_least, CheckError, CheckErrors, TypeChecker, TypeResult, TypingContext,
};
use crate::vm::costs::cost_functions::ClarityCostFunction;
use crate::vm::costs::{analysis_typecheck_cost, cost_functions, runtime_cost};
use crate::vm::functions::tuples;
use crate::vm::representations::{SymbolicExpression, SymbolicExpressionType};
use crate::vm::types::{PrincipalData, TypeSignature, Value};
use crate::vm::costs::{analysis_typecheck_cost, runtime_cost};
use crate::vm::representations::SymbolicExpression;
use crate::vm::types::TypeSignature;

pub fn check_special_fetch_entry(
checker: &mut TypeChecker,
Expand Down
Loading

0 comments on commit ed48786

Please sign in to comment.