diff --git a/clarity/src/libclarity.rs b/clarity/src/libclarity.rs
index daae7dcfd7..7ce2a4f903 100644
--- a/clarity/src/libclarity.rs
+++ b/clarity/src/libclarity.rs
@@ -14,20 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-#![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"))]
diff --git a/clarity/src/vm/analysis/analysis_db.rs b/clarity/src/vm/analysis/analysis_db.rs
index 36e1f8c970..dda74dd5c0 100644
--- a/clarity/src/vm/analysis/analysis_db.rs
+++ b/clarity/src/vm/analysis/analysis_db.rs
@@ -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> {
diff --git a/clarity/src/vm/analysis/arithmetic_checker/mod.rs b/clarity/src/vm/analysis/arithmetic_checker/mod.rs
index 429907b4c6..e0f774d9be 100644
--- a/clarity/src/vm/analysis/arithmetic_checker/mod.rs
+++ b/clarity/src/vm/analysis/arithmetic_checker/mod.rs
@@ -14,22 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-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;
diff --git a/clarity/src/vm/analysis/read_only_checker/mod.rs b/clarity/src/vm/analysis/read_only_checker/mod.rs
index f60ce11a44..a244bf7101 100644
--- a/clarity/src/vm/analysis/read_only_checker/mod.rs
+++ b/clarity/src/vm/analysis/read_only_checker/mod.rs
@@ -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)]
diff --git a/clarity/src/vm/analysis/read_only_checker/tests.rs b/clarity/src/vm/analysis/read_only_checker/tests.rs
index 828e5d42bc..1f0d17117b 100644
--- a/clarity/src/vm/analysis/read_only_checker/tests.rs
+++ b/clarity/src/vm/analysis/read_only_checker/tests.rs
@@ -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;
diff --git a/clarity/src/vm/analysis/tests/mod.rs b/clarity/src/vm/analysis/tests/mod.rs
index 2484ee86cd..01d5e98136 100644
--- a/clarity/src/vm/analysis/tests/mod.rs
+++ b/clarity/src/vm/analysis/tests/mod.rs
@@ -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]
diff --git a/clarity/src/vm/analysis/trait_checker/mod.rs b/clarity/src/vm/analysis/trait_checker/mod.rs
index 868c1d378e..87a31a9867 100644
--- a/clarity/src/vm/analysis/trait_checker/mod.rs
+++ b/clarity/src/vm/analysis/trait_checker/mod.rs
@@ -14,17 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-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,
diff --git a/clarity/src/vm/analysis/trait_checker/tests.rs b/clarity/src/vm/analysis/trait_checker/tests.rs
index b1d9bdb222..ab997afc58 100644
--- a/clarity/src/vm/analysis/trait_checker/tests.rs
+++ b/clarity/src/vm/analysis/trait_checker/tests.rs
@@ -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;
diff --git a/clarity/src/vm/analysis/type_checker/mod.rs b/clarity/src/vm/analysis/type_checker/mod.rs
index 36aa2519cc..68bbe1873e 100644
--- a/clarity/src/vm/analysis/type_checker/mod.rs
+++ b/clarity/src/vm/analysis/type_checker/mod.rs
@@ -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 {
diff --git a/clarity/src/vm/analysis/type_checker/v2_05/contexts.rs b/clarity/src/vm/analysis/type_checker/v2_05/contexts.rs
index 2a11f6839f..f765878254 100644
--- a/clarity/src/vm/analysis/type_checker/v2_05/contexts.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_05/contexts.rs
@@ -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};
diff --git a/clarity/src/vm/analysis/type_checker/v2_05/mod.rs b/clarity/src/vm/analysis/type_checker/v2_05/mod.rs
index 77083b88cf..82e1e50490 100644
--- a/clarity/src/vm/analysis/type_checker/v2_05/mod.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_05/mod.rs
@@ -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;
diff --git a/clarity/src/vm/analysis/type_checker/v2_05/natives/assets.rs b/clarity/src/vm/analysis/type_checker/v2_05/natives/assets.rs
index dfd55e2df2..ad066938ce 100644
--- a/clarity/src/vm/analysis/type_checker/v2_05/natives/assets.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_05/natives/assets.rs
@@ -14,12 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-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,
diff --git a/clarity/src/vm/analysis/type_checker/v2_05/natives/maps.rs b/clarity/src/vm/analysis/type_checker/v2_05/natives/maps.rs
index 497a01da2b..b8d36b2f82 100644
--- a/clarity/src/vm/analysis/type_checker/v2_05/natives/maps.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_05/natives/maps.rs
@@ -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,
diff --git a/clarity/src/vm/analysis/type_checker/v2_05/natives/mod.rs b/clarity/src/vm/analysis/type_checker/v2_05/natives/mod.rs
index 3c5ab99029..11dbd2d04c 100644
--- a/clarity/src/vm/analysis/type_checker/v2_05/natives/mod.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_05/natives/mod.rs
@@ -19,17 +19,13 @@ use stacks_common::types::StacksEpochId;
use super::{
check_argument_count, check_arguments_at_least, no_type, TypeChecker, TypeResult, TypingContext,
};
-use crate::vm::analysis::errors::{CheckError, CheckErrors, CheckResult};
+use crate::vm::analysis::errors::{CheckError, CheckErrors};
use crate::vm::costs::cost_functions::ClarityCostFunction;
-use crate::vm::costs::{
- analysis_typecheck_cost, cost_functions, runtime_cost, CostOverflowingMath,
-};
-use crate::vm::errors::{Error as InterpError, InterpreterError, RuntimeErrorType};
+use crate::vm::costs::{analysis_typecheck_cost, runtime_cost};
use crate::vm::functions::{handle_binding_list, NativeFunctions};
use crate::vm::types::{
BlockInfoProperty, FixedFunction, FunctionArg, FunctionSignature, FunctionType, PrincipalData,
TupleTypeSignature, TypeSignature, Value, BUFF_20, BUFF_32, BUFF_33, BUFF_64, BUFF_65,
- MAX_VALUE_SIZE,
};
use crate::vm::{ClarityName, ClarityVersion, SymbolicExpression, SymbolicExpressionType};
diff --git a/clarity/src/vm/analysis/type_checker/v2_05/natives/options.rs b/clarity/src/vm/analysis/type_checker/v2_05/natives/options.rs
index b04f38b44f..55469262df 100644
--- a/clarity/src/vm/analysis/type_checker/v2_05/natives/options.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_05/natives/options.rs
@@ -17,11 +17,11 @@
use stacks_common::types::StacksEpochId;
use crate::vm::analysis::type_checker::v2_05::{
- check_argument_count, check_arguments_at_least, no_type, CheckError, CheckErrors, TypeChecker,
- TypeResult, TypingContext,
+ check_argument_count, check_arguments_at_least, no_type, 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::costs::{analysis_typecheck_cost, runtime_cost};
use crate::vm::representations::{ClarityName, SymbolicExpression};
use crate::vm::types::TypeSignature;
diff --git a/clarity/src/vm/analysis/type_checker/v2_05/natives/sequences.rs b/clarity/src/vm/analysis/type_checker/v2_05/natives/sequences.rs
index bed885d147..e1bdb8cbbd 100644
--- a/clarity/src/vm/analysis/type_checker/v2_05/natives/sequences.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_05/natives/sequences.rs
@@ -18,17 +18,17 @@ use stacks_common::types::StacksEpochId;
use super::{SimpleNativeFunction, TypedNativeFunction};
use crate::vm::analysis::type_checker::v2_05::{
- check_argument_count, check_arguments_at_least, no_type, CheckErrors, CheckResult, TypeChecker,
+ check_argument_count, check_arguments_at_least, CheckErrors, CheckResult, TypeChecker,
TypeResult, TypingContext,
};
use crate::vm::costs::cost_functions::ClarityCostFunction;
-use crate::vm::costs::{analysis_typecheck_cost, cost_functions, runtime_cost};
+use crate::vm::costs::{analysis_typecheck_cost, runtime_cost};
use crate::vm::functions::NativeFunctions;
use crate::vm::representations::{SymbolicExpression, SymbolicExpressionType};
pub use crate::vm::types::signatures::{BufferLength, ListTypeData, StringUTF8Length, BUFF_1};
use crate::vm::types::SequenceSubtype::*;
use crate::vm::types::StringSubtype::*;
-use crate::vm::types::{FunctionType, TypeSignature, Value, MAX_VALUE_SIZE};
+use crate::vm::types::{FunctionType, TypeSignature, Value};
use crate::vm::ClarityVersion;
fn get_simple_native_or_user_define(
diff --git a/clarity/src/vm/analysis/type_checker/v2_05/tests/assets.rs b/clarity/src/vm/analysis/type_checker/v2_05/tests/assets.rs
index 5cfc9ab992..badfba6245 100644
--- a/clarity/src/vm/analysis/type_checker/v2_05/tests/assets.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_05/tests/assets.rs
@@ -17,7 +17,6 @@
use stacks_common::types::StacksEpochId;
use crate::vm::analysis::errors::CheckErrors;
-use crate::vm::analysis::AnalysisDatabase;
use crate::vm::ast::parse;
use crate::vm::database::MemoryBackingStore;
use crate::vm::tooling::mem_type_check;
@@ -151,8 +150,6 @@ fn test_names_tokens_contracts() {
#[test]
fn test_bad_asset_usage() {
- use crate::vm::analysis::type_check;
-
let bad_scripts = [
"(ft-get-balance stackoos tx-sender)",
"(ft-get-balance u1234 tx-sender)",
diff --git a/clarity/src/vm/analysis/type_checker/v2_05/tests/contracts.rs b/clarity/src/vm/analysis/type_checker/v2_05/tests/contracts.rs
index bc005e9d30..0eec9c1d67 100644
--- a/clarity/src/vm/analysis/type_checker/v2_05/tests/contracts.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_05/tests/contracts.rs
@@ -20,14 +20,11 @@ use {assert_json_diff, serde_json};
use crate::vm::analysis::contract_interface_builder::build_contract_interface;
use crate::vm::analysis::errors::CheckErrors;
-use crate::vm::analysis::{
- mem_type_check, type_check, AnalysisDatabase, CheckError, ContractAnalysis,
-};
+use crate::vm::analysis::{mem_type_check, type_check};
use crate::vm::ast::parse;
-use crate::vm::costs::LimitedCostTracker;
use crate::vm::database::MemoryBackingStore;
use crate::vm::types::QualifiedContractIdentifier;
-use crate::vm::{ClarityVersion, SymbolicExpression};
+use crate::vm::ClarityVersion;
const SIMPLE_TOKENS: &str = "(define-map tokens { account: principal } { balance: uint })
(define-read-only (my-get-token-balance (account principal))
@@ -603,7 +600,6 @@ fn test_same_function_name() {
#[test]
fn test_expects() {
- use crate::vm::analysis::type_check;
let okay = "(define-map tokens { id: int } { balance: int })
(define-private (my-get-token-balance)
(let ((balance (unwrap!
diff --git a/clarity/src/vm/analysis/type_checker/v2_05/tests/mod.rs b/clarity/src/vm/analysis/type_checker/v2_05/tests/mod.rs
index 1830caf7ce..c314fa319d 100644
--- a/clarity/src/vm/analysis/type_checker/v2_05/tests/mod.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_05/tests/mod.rs
@@ -17,20 +17,15 @@
use stacks_common::types::StacksEpochId;
use crate::vm::analysis::errors::CheckErrors;
-use crate::vm::analysis::type_checker::v2_05::{TypeChecker, TypeResult, TypingContext};
-use crate::vm::analysis::types::ContractAnalysis;
-use crate::vm::analysis::{mem_type_check, type_check, AnalysisDatabase};
+use crate::vm::analysis::mem_type_check;
+use crate::vm::analysis::type_checker::v2_05::TypeResult;
+use crate::vm::ast::build_ast;
use crate::vm::ast::errors::ParseErrors;
-use crate::vm::ast::{build_ast, parse};
-use crate::vm::contexts::OwnedEnvironment;
-use crate::vm::database::MemoryBackingStore;
-use crate::vm::representations::SymbolicExpression;
use crate::vm::types::SequenceSubtype::*;
use crate::vm::types::StringSubtype::*;
-use crate::vm::types::TypeSignature::{BoolType, IntType, PrincipalType, SequenceType, UIntType};
+use crate::vm::types::TypeSignature::{BoolType, IntType, PrincipalType, UIntType};
use crate::vm::types::{
- FixedFunction, FunctionType, PrincipalData, QualifiedContractIdentifier, TypeSignature, Value,
- BUFF_32, BUFF_64,
+ FixedFunction, FunctionType, QualifiedContractIdentifier, TypeSignature, BUFF_32, BUFF_64,
};
use crate::vm::ClarityVersion;
@@ -1437,8 +1432,6 @@ fn test_response_inference() {
#[test]
fn test_function_arg_names() {
- use crate::vm::analysis::type_check;
-
let functions = [
"(define-private (test (x int)) (ok 0))
(define-public (test-pub (x int)) (ok 0))
diff --git a/clarity/src/vm/analysis/type_checker/v2_1/contexts.rs b/clarity/src/vm/analysis/type_checker/v2_1/contexts.rs
index d210194ea4..8ac9ee8254 100644
--- a/clarity/src/vm/analysis/type_checker/v2_1/contexts.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_1/contexts.rs
@@ -21,9 +21,8 @@ use hashbrown::{HashMap, HashSet};
use crate::vm::analysis::errors::{CheckError, CheckErrors, CheckResult};
use crate::vm::analysis::type_checker::is_reserved_word;
use crate::vm::analysis::types::ContractAnalysis;
-use crate::vm::contexts::MAX_CONTEXT_DEPTH;
-use crate::vm::representations::{ClarityName, SymbolicExpression};
-use crate::vm::types::signatures::{CallableSubtype, FunctionSignature};
+use crate::vm::representations::ClarityName;
+use crate::vm::types::signatures::FunctionSignature;
use crate::vm::types::{FunctionType, QualifiedContractIdentifier, TraitIdentifier, TypeSignature};
use crate::vm::ClarityVersion;
diff --git a/clarity/src/vm/analysis/type_checker/v2_1/mod.rs b/clarity/src/vm/analysis/type_checker/v2_1/mod.rs
index 7899b3e27d..17ee17f615 100644
--- a/clarity/src/vm/analysis/type_checker/v2_1/mod.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_1/mod.rs
@@ -19,23 +19,21 @@ 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, check_arguments_at_most, 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::diagnostic::Diagnostic;
use crate::vm::functions::define::DefineFunctionsParsed;
@@ -45,13 +43,13 @@ use crate::vm::representations::SymbolicExpressionType::{
};
use crate::vm::representations::{depth_traverse, ClarityName, SymbolicExpression};
use crate::vm::types::signatures::{
- CallableSubtype, FunctionArgSignature, FunctionReturnsSignature, FunctionSignature, BUFF_20,
+ CallableSubtype, FunctionArgSignature, FunctionReturnsSignature, FunctionSignature,
};
use crate::vm::types::{
- parse_name_type_pairs, CallableData, FixedFunction, FunctionArg, FunctionType, ListData,
- ListTypeData, OptionalData, PrincipalData, QualifiedContractIdentifier, ResponseData,
- SequenceData, SequenceSubtype, StringSubtype, TraitIdentifier, TupleData, TupleTypeSignature,
- TypeSignature, Value, MAX_TYPE_DEPTH,
+ parse_name_type_pairs, FixedFunction, FunctionArg, FunctionType, ListData, ListTypeData,
+ OptionalData, PrincipalData, QualifiedContractIdentifier, ResponseData, SequenceData,
+ SequenceSubtype, StringSubtype, TraitIdentifier, TupleData, TupleTypeSignature, TypeSignature,
+ Value, MAX_TYPE_DEPTH,
};
use crate::vm::variables::NativeVariables;
use crate::vm::ClarityVersion;
diff --git a/clarity/src/vm/analysis/type_checker/v2_1/natives/assets.rs b/clarity/src/vm/analysis/type_checker/v2_1/natives/assets.rs
index d94e0fad56..f91c64e1c0 100644
--- a/clarity/src/vm/analysis/type_checker/v2_1/natives/assets.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_1/natives/assets.rs
@@ -16,15 +16,12 @@
use stacks_common::consts::TOKEN_TRANSFER_MEMO_LENGTH;
-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, BufferLength, SequenceSubtype, TupleTypeSignature, TypeSignature,
- MAX_VALUE_SIZE,
-};
+use crate::vm::types::{BufferLength, SequenceSubtype, TypeSignature};
pub fn check_special_get_owner(
checker: &mut TypeChecker,
diff --git a/clarity/src/vm/analysis/type_checker/v2_1/natives/maps.rs b/clarity/src/vm/analysis/type_checker/v2_1/natives/maps.rs
index 7ce4cfad22..676badd14f 100644
--- a/clarity/src/vm/analysis/type_checker/v2_1/natives/maps.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_1/natives/maps.rs
@@ -16,15 +16,13 @@
use stacks_common::types::StacksEpochId;
-use super::check_special_tuple_cons;
use crate::vm::analysis::type_checker::v2_1::{
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,
diff --git a/clarity/src/vm/analysis/type_checker/v2_1/natives/mod.rs b/clarity/src/vm/analysis/type_checker/v2_1/natives/mod.rs
index 7769652d25..6b807ed1da 100644
--- a/clarity/src/vm/analysis/type_checker/v2_1/natives/mod.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_1/natives/mod.rs
@@ -20,19 +20,14 @@ use super::{
check_argument_count, check_arguments_at_least, check_arguments_at_most,
compute_typecheck_cost, no_type, TypeChecker, TypeResult, TypingContext,
};
-use crate::vm::analysis::errors::{CheckError, CheckErrors, CheckResult};
+use crate::vm::analysis::errors::{CheckError, CheckErrors};
use crate::vm::costs::cost_functions::ClarityCostFunction;
-use crate::vm::costs::{
- analysis_typecheck_cost, cost_functions, runtime_cost, CostErrors, CostOverflowingMath,
- CostTracker,
-};
-use crate::vm::errors::{Error as InterpError, RuntimeErrorType};
+use crate::vm::costs::{analysis_typecheck_cost, runtime_cost, CostErrors, CostTracker};
use crate::vm::functions::{handle_binding_list, NativeFunctions};
use crate::vm::types::signatures::{
CallableSubtype, FunctionArgSignature, FunctionReturnsSignature, SequenceSubtype, ASCII_40,
UTF8_40,
};
-use crate::vm::types::TypeSignature::SequenceType;
use crate::vm::types::{
BlockInfoProperty, BufferLength, BurnBlockInfoProperty, FixedFunction, FunctionArg,
FunctionSignature, FunctionType, PrincipalData, StacksBlockInfoProperty, TenureInfoProperty,
diff --git a/clarity/src/vm/analysis/type_checker/v2_1/natives/options.rs b/clarity/src/vm/analysis/type_checker/v2_1/natives/options.rs
index 772bdd32a4..0e12f802d2 100644
--- a/clarity/src/vm/analysis/type_checker/v2_1/natives/options.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_1/natives/options.rs
@@ -17,18 +17,13 @@
use stacks_common::types::StacksEpochId;
use super::{
- check_argument_count, check_arguments_at_least, no_type, CheckError, CheckErrors, TypeChecker,
- TypeResult,
+ check_argument_count, check_arguments_at_least, no_type, CheckErrors, TypeChecker, TypeResult,
};
use crate::vm::analysis::type_checker::contexts::TypingContext;
use crate::vm::costs::cost_functions::ClarityCostFunction;
-use crate::vm::costs::{
- analysis_typecheck_cost, cost_functions, runtime_cost, CostErrors, CostTracker,
-};
+use crate::vm::costs::{analysis_typecheck_cost, runtime_cost, CostErrors, CostTracker};
use crate::vm::representations::{ClarityName, SymbolicExpression};
-use crate::vm::types::signatures::CallableSubtype;
use crate::vm::types::TypeSignature;
-use crate::vm::ClarityVersion;
pub fn check_special_okay(
checker: &mut TypeChecker,
diff --git a/clarity/src/vm/analysis/type_checker/v2_1/natives/sequences.rs b/clarity/src/vm/analysis/type_checker/v2_1/natives/sequences.rs
index c1b3aabb17..0207fe49d8 100644
--- a/clarity/src/vm/analysis/type_checker/v2_1/natives/sequences.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_1/natives/sequences.rs
@@ -22,15 +22,14 @@ use crate::vm::analysis::type_checker::v2_1::{
TypeResult, TypingContext,
};
use crate::vm::costs::cost_functions::ClarityCostFunction;
-use crate::vm::costs::{analysis_typecheck_cost, cost_functions, runtime_cost, CostTracker};
+use crate::vm::costs::{analysis_typecheck_cost, runtime_cost, CostTracker};
use crate::vm::diagnostic::Diagnostic;
use crate::vm::functions::NativeFunctions;
use crate::vm::representations::{SymbolicExpression, SymbolicExpressionType};
pub use crate::vm::types::signatures::{BufferLength, ListTypeData, StringUTF8Length, BUFF_1};
use crate::vm::types::SequenceSubtype::*;
use crate::vm::types::StringSubtype::*;
-use crate::vm::types::{FunctionType, TypeSignature, Value, MAX_VALUE_SIZE};
-use crate::vm::ClarityVersion;
+use crate::vm::types::{FunctionType, TypeSignature, Value};
fn get_simple_native_or_user_define(
function_name: &str,
diff --git a/clarity/src/vm/analysis/type_checker/v2_1/tests/assets.rs b/clarity/src/vm/analysis/type_checker/v2_1/tests/assets.rs
index ba120575bd..ab06802f27 100644
--- a/clarity/src/vm/analysis/type_checker/v2_1/tests/assets.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_1/tests/assets.rs
@@ -22,8 +22,6 @@ use stacks_common::types::StacksEpochId;
use super::contracts::type_check;
use crate::vm::analysis::errors::CheckErrors;
-use crate::vm::analysis::type_checker::v2_1::tests::mem_type_check;
-use crate::vm::analysis::AnalysisDatabase;
use crate::vm::ast::parse;
use crate::vm::database::MemoryBackingStore;
use crate::vm::tests::test_clarity_versions;
diff --git a/clarity/src/vm/analysis/type_checker/v2_1/tests/contracts.rs b/clarity/src/vm/analysis/type_checker/v2_1/tests/contracts.rs
index b87177062c..838be9e6bb 100644
--- a/clarity/src/vm/analysis/type_checker/v2_1/tests/contracts.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_1/tests/contracts.rs
@@ -30,13 +30,10 @@ use crate::vm::analysis::{
use crate::vm::ast::parse;
use crate::vm::costs::LimitedCostTracker;
use crate::vm::database::MemoryBackingStore;
-use crate::vm::errors::Error;
use crate::vm::tests::test_clarity_versions;
use crate::vm::types::signatures::CallableSubtype;
-use crate::vm::types::{
- PrincipalData, QualifiedContractIdentifier, StandardPrincipalData, TypeSignature,
-};
-use crate::vm::{ClarityVersion, ContractName, SymbolicExpression};
+use crate::vm::types::{QualifiedContractIdentifier, TypeSignature};
+use crate::vm::{ClarityVersion, SymbolicExpression};
fn mem_type_check_v1(snippet: &str) -> CheckResult<(Option, ContractAnalysis)> {
mem_run_analysis(snippet, ClarityVersion::Clarity1, StacksEpochId::latest())
@@ -567,7 +564,6 @@ fn test_same_function_name(#[case] version: ClarityVersion, #[case] epoch: Stack
#[test]
fn test_expects() {
- use crate::vm::analysis::type_check;
let okay = "(define-map tokens { id: int } { balance: int })
(define-private (my-get-token-balance)
(let ((balance (unwrap!
diff --git a/clarity/src/vm/analysis/type_checker/v2_1/tests/mod.rs b/clarity/src/vm/analysis/type_checker/v2_1/tests/mod.rs
index 498b52dcb0..5ce27eabcb 100644
--- a/clarity/src/vm/analysis/type_checker/v2_1/tests/mod.rs
+++ b/clarity/src/vm/analysis/type_checker/v2_1/tests/mod.rs
@@ -22,24 +22,20 @@ use stacks_common::types::StacksEpochId;
use super::CheckResult;
use crate::vm::analysis::errors::CheckErrors;
-use crate::vm::analysis::type_checker::v2_1::{TypeChecker, TypeResult, TypingContext};
-use crate::vm::analysis::type_checker::SequenceSubtype;
+use crate::vm::analysis::mem_type_check as mem_run_analysis;
+use crate::vm::analysis::type_checker::v2_1::TypeResult;
use crate::vm::analysis::types::ContractAnalysis;
-use crate::vm::analysis::{mem_type_check as mem_run_analysis, AnalysisDatabase};
+use crate::vm::ast::build_ast;
use crate::vm::ast::errors::ParseErrors;
-use crate::vm::ast::{build_ast, parse};
-use crate::vm::contexts::OwnedEnvironment;
-use crate::vm::representations::SymbolicExpression;
use crate::vm::tests::test_clarity_versions;
use crate::vm::types::signatures::TypeSignature::OptionalType;
use crate::vm::types::signatures::{ListTypeData, StringUTF8Length};
use crate::vm::types::SequenceSubtype::*;
use crate::vm::types::StringSubtype::*;
use crate::vm::types::TypeSignature::{BoolType, IntType, PrincipalType, SequenceType, UIntType};
-use crate::vm::types::Value::Sequence;
use crate::vm::types::{
- BufferLength, FixedFunction, FunctionType, PrincipalData, QualifiedContractIdentifier,
- TraitIdentifier, TypeSignature, Value, BUFF_1, BUFF_20, BUFF_21, BUFF_32, BUFF_64,
+ BufferLength, FixedFunction, FunctionType, QualifiedContractIdentifier, TraitIdentifier,
+ TypeSignature, BUFF_1, BUFF_20, BUFF_21, BUFF_32, BUFF_64,
};
use crate::vm::{execute_v2, ClarityName, ClarityVersion};
@@ -2252,8 +2248,6 @@ fn test_response_inference(#[case] version: ClarityVersion, #[case] epoch: Stack
#[test]
fn test_function_arg_names() {
- use crate::vm::analysis::type_check;
-
let functions = [
"(define-private (test (x int)) (ok 0))
(define-public (test-pub (x int)) (ok 0))
diff --git a/clarity/src/vm/analysis/types.rs b/clarity/src/vm/analysis/types.rs
index 60a93f9c79..5085f2bc46 100644
--- a/clarity/src/vm/analysis/types.rs
+++ b/clarity/src/vm/analysis/types.rs
@@ -16,14 +16,13 @@
use std::collections::{BTreeMap, BTreeSet};
-use hashbrown::HashMap;
use stacks_common::types::StacksEpochId;
use crate::vm::analysis::analysis_db::AnalysisDatabase;
use crate::vm::analysis::contract_interface_builder::ContractInterface;
use crate::vm::analysis::errors::{CheckErrors, CheckResult};
use crate::vm::analysis::type_checker::contexts::TypeMap;
-use crate::vm::costs::{CostTracker, ExecutionCost, LimitedCostTracker};
+use crate::vm::costs::LimitedCostTracker;
use crate::vm::types::signatures::FunctionSignature;
use crate::vm::types::{FunctionType, QualifiedContractIdentifier, TraitIdentifier, TypeSignature};
use crate::vm::{ClarityName, ClarityVersion, SymbolicExpression};
diff --git a/clarity/src/vm/ast/definition_sorter/mod.rs b/clarity/src/vm/ast/definition_sorter/mod.rs
index bd611851b6..2be40271e6 100644
--- a/clarity/src/vm/ast/definition_sorter/mod.rs
+++ b/clarity/src/vm/ast/definition_sorter/mod.rs
@@ -17,9 +17,9 @@
use hashbrown::{HashMap, HashSet};
use crate::vm::ast::errors::{ParseError, ParseErrors, ParseResult};
-use crate::vm::ast::types::{BuildASTPass, ContractAST};
+use crate::vm::ast::types::ContractAST;
use crate::vm::costs::cost_functions::ClarityCostFunction;
-use crate::vm::costs::{cost_functions, runtime_cost, CostTracker, LimitedCostTracker};
+use crate::vm::costs::{runtime_cost, CostTracker};
use crate::vm::functions::define::DefineFunctions;
use crate::vm::functions::NativeFunctions;
use crate::vm::representations::PreSymbolicExpressionType::{
@@ -27,7 +27,6 @@ use crate::vm::representations::PreSymbolicExpressionType::{
SugaredFieldIdentifier, TraitReference, Tuple,
};
use crate::vm::representations::{ClarityName, PreSymbolicExpression};
-use crate::vm::types::Value;
use crate::vm::ClarityVersion;
#[cfg(test)]
diff --git a/clarity/src/vm/ast/definition_sorter/tests.rs b/clarity/src/vm/ast/definition_sorter/tests.rs
index 2c993db266..0142052c50 100644
--- a/clarity/src/vm/ast/definition_sorter/tests.rs
+++ b/clarity/src/vm/ast/definition_sorter/tests.rs
@@ -24,7 +24,7 @@ use crate::vm::ast::definition_sorter::DefinitionSorter;
use crate::vm::ast::errors::{ParseErrors, ParseResult};
use crate::vm::ast::expression_identifier::ExpressionIdentifier;
use crate::vm::ast::parser;
-use crate::vm::ast::types::{BuildASTPass, ContractAST};
+use crate::vm::ast::types::ContractAST;
use crate::vm::types::QualifiedContractIdentifier;
use crate::vm::ClarityVersion;
diff --git a/clarity/src/vm/ast/errors.rs b/clarity/src/vm/ast/errors.rs
index 56f8e40f86..6c668bacc1 100644
--- a/clarity/src/vm/ast/errors.rs
+++ b/clarity/src/vm/ast/errors.rs
@@ -21,7 +21,6 @@ use crate::vm::ast::parser::v2::lexer::token::Token;
use crate::vm::costs::{CostErrors, ExecutionCost};
use crate::vm::diagnostic::{DiagnosableError, Diagnostic, Level};
use crate::vm::representations::{PreSymbolicExpression, Span};
-use crate::vm::types::{TupleTypeSignature, TypeSignature};
use crate::vm::MAX_CALL_STACK_DEPTH;
pub type ParseResult = Result;
@@ -308,7 +307,6 @@ impl DiagnosableError for ParseErrors {
}
fn level(&self) -> crate::vm::diagnostic::Level {
- use self::ParseErrors::*;
match self {
ParseErrors::NoteToMatchThis(_) => Level::Note,
ParseErrors::Lexer(lexerError) => lexerError.level(),
diff --git a/clarity/src/vm/ast/expression_identifier/mod.rs b/clarity/src/vm/ast/expression_identifier/mod.rs
index b8a39362ae..13b9aac2bd 100644
--- a/clarity/src/vm/ast/expression_identifier/mod.rs
+++ b/clarity/src/vm/ast/expression_identifier/mod.rs
@@ -15,8 +15,7 @@
// along with this program. If not, see .
use crate::vm::ast::errors::{ParseError, ParseErrors, ParseResult};
-use crate::vm::ast::types::{BuildASTPass, ContractAST};
-use crate::vm::representations::PreSymbolicExpressionType::List;
+use crate::vm::ast::types::ContractAST;
use crate::vm::representations::SymbolicExpressionCommon;
use crate::vm::ClarityVersion;
diff --git a/clarity/src/vm/ast/mod.rs b/clarity/src/vm/ast/mod.rs
index 5c615f46fa..263fc86526 100644
--- a/clarity/src/vm/ast/mod.rs
+++ b/clarity/src/vm/ast/mod.rs
@@ -36,10 +36,9 @@ use self::traits_resolver::TraitsResolver;
use self::types::BuildASTPass;
pub use self::types::ContractAST;
use crate::vm::costs::cost_functions::ClarityCostFunction;
-use crate::vm::costs::{cost_functions, runtime_cost, CostTracker, LimitedCostTracker};
+use crate::vm::costs::{runtime_cost, CostTracker};
use crate::vm::diagnostic::{Diagnostic, Level};
-use crate::vm::errors::{Error, RuntimeErrorType};
-use crate::vm::representations::{PreSymbolicExpression, SymbolicExpression};
+use crate::vm::representations::PreSymbolicExpression;
use crate::vm::types::QualifiedContractIdentifier;
use crate::vm::ClarityVersion;
@@ -50,7 +49,7 @@ pub fn parse(
source_code: &str,
version: ClarityVersion,
epoch: StacksEpochId,
-) -> Result, Error> {
+) -> Result, crate::vm::errors::Error> {
let ast = build_ast(contract_identifier, source_code, &mut (), version, epoch)?;
Ok(ast.expressions)
}
diff --git a/clarity/src/vm/ast/parser/v1.rs b/clarity/src/vm/ast/parser/v1.rs
index 4cef2e5411..32f0b7001e 100644
--- a/clarity/src/vm/ast/parser/v1.rs
+++ b/clarity/src/vm/ast/parser/v1.rs
@@ -14,20 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use std::cmp;
-
use lazy_static::lazy_static;
use regex::{Captures, Regex};
-use stacks_common::address::c32::c32_address_decode;
use stacks_common::util::hash::hex_bytes;
use crate::vm::ast::errors::{ParseError, ParseErrors, ParseResult};
use crate::vm::ast::stack_depth_checker::AST_CALL_STACK_DEPTH_BUFFER;
-use crate::vm::errors::{InterpreterResult as Result, RuntimeErrorType};
use crate::vm::representations::{
- ClarityName, ContractName, PreSymbolicExpression, PreSymbolicExpressionType, MAX_STRING_LEN,
+ ClarityName, ContractName, PreSymbolicExpression, MAX_STRING_LEN,
};
-use crate::vm::types::{PrincipalData, QualifiedContractIdentifier, TraitIdentifier, Value};
+use crate::vm::types::{PrincipalData, TraitIdentifier, Value};
use crate::vm::MAX_CALL_STACK_DEPTH;
pub const CONTRACT_MIN_NAME_LENGTH: usize = 1;
@@ -734,12 +730,10 @@ pub fn parse_no_stack_limit(input: &str) -> ParseResult.
-use crate::vm::ast::errors::{ParseError, ParseErrors, ParseResult};
+use crate::vm::ast::errors::{ParseErrors, ParseResult};
use crate::vm::ast::types::{BuildASTPass, ContractAST};
use crate::vm::representations::PreSymbolicExpression;
use crate::vm::representations::PreSymbolicExpressionType::{List, Tuple};
diff --git a/clarity/src/vm/ast/sugar_expander/mod.rs b/clarity/src/vm/ast/sugar_expander/mod.rs
index 670796cf4c..f844f5ec39 100644
--- a/clarity/src/vm/ast/sugar_expander/mod.rs
+++ b/clarity/src/vm/ast/sugar_expander/mod.rs
@@ -16,14 +16,9 @@
use hashbrown::{HashMap, HashSet};
-use crate::vm::ast::errors::{ParseError, ParseErrors, ParseResult};
+use crate::vm::ast::errors::{ParseErrors, ParseResult};
use crate::vm::ast::types::{BuildASTPass, ContractAST, PreExpressionsDrain};
-use crate::vm::functions::define::{DefineFunctions, DefineFunctionsParsed};
-use crate::vm::functions::NativeFunctions;
-use crate::vm::representations::{
- ClarityName, PreSymbolicExpression, PreSymbolicExpressionType, SymbolicExpression,
- SymbolicExpressionType,
-};
+use crate::vm::representations::{ClarityName, PreSymbolicExpressionType, SymbolicExpression};
use crate::vm::types::{
PrincipalData, QualifiedContractIdentifier, StandardPrincipalData, TraitIdentifier, Value,
};
@@ -169,14 +164,11 @@ impl SugarExpander {
#[cfg(test)]
mod test {
- use crate::vm::ast::errors::{ParseError, ParseErrors};
use crate::vm::ast::sugar_expander::SugarExpander;
use crate::vm::ast::types::ContractAST;
- use crate::vm::representations::{
- ContractName, PreSymbolicExpression, Span, SymbolicExpression,
- };
- use crate::vm::types::{PrincipalData, QualifiedContractIdentifier, StandardPrincipalData};
- use crate::vm::{ast, Value};
+ use crate::vm::representations::{ContractName, PreSymbolicExpression, SymbolicExpression};
+ use crate::vm::types::{PrincipalData, QualifiedContractIdentifier};
+ use crate::vm::Value;
fn make_pre_atom(
x: &str,
@@ -565,6 +557,9 @@ mod test {
);
}
+ #[cfg(feature = "developer-mode")]
+ use crate::vm::representations::Span;
+
#[test]
#[cfg(feature = "developer-mode")]
fn test_attach_end_line_comment() {
diff --git a/clarity/src/vm/ast/traits_resolver/mod.rs b/clarity/src/vm/ast/traits_resolver/mod.rs
index 0bb4ba3186..d84e8cb673 100644
--- a/clarity/src/vm/ast/traits_resolver/mod.rs
+++ b/clarity/src/vm/ast/traits_resolver/mod.rs
@@ -14,20 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use hashbrown::{HashMap, HashSet};
+use hashbrown::HashMap;
-use crate::vm::analysis::AnalysisDatabase;
use crate::vm::ast::errors::{ParseError, ParseErrors, ParseResult};
-use crate::vm::ast::types::{BuildASTPass, ContractAST, PreExpressionsDrain};
-use crate::vm::functions::define::{DefineFunctions, DefineFunctionsParsed};
-use crate::vm::functions::NativeFunctions;
+use crate::vm::ast::types::{BuildASTPass, ContractAST};
+use crate::vm::functions::define::DefineFunctions;
use crate::vm::representations::PreSymbolicExpressionType::{
- Atom, AtomValue, FieldIdentifier, List, SugaredFieldIdentifier, TraitReference, Tuple,
+ Atom, FieldIdentifier, List, SugaredFieldIdentifier, TraitReference, Tuple,
};
-use crate::vm::representations::{
- ClarityName, PreSymbolicExpression, SymbolicExpression, TraitDefinition,
-};
-use crate::vm::types::{QualifiedContractIdentifier, TraitIdentifier, Value};
+use crate::vm::representations::{ClarityName, PreSymbolicExpression, TraitDefinition};
+use crate::vm::types::{QualifiedContractIdentifier, TraitIdentifier};
use crate::vm::ClarityVersion;
pub struct TraitsResolver {}
diff --git a/clarity/src/vm/ast/types.rs b/clarity/src/vm/ast/types.rs
index 2071130131..d969ed855f 100644
--- a/clarity/src/vm/ast/types.rs
+++ b/clarity/src/vm/ast/types.rs
@@ -20,7 +20,6 @@ use hashbrown::{HashMap, HashSet};
use crate::vm::ast::errors::ParseResult;
use crate::vm::representations::{PreSymbolicExpression, SymbolicExpression, TraitDefinition};
-use crate::vm::types::signatures::FunctionSignature;
use crate::vm::types::{QualifiedContractIdentifier, TraitIdentifier};
use crate::vm::{ClarityName, ClarityVersion};
diff --git a/clarity/src/vm/callables.rs b/clarity/src/vm/callables.rs
index 4691025a8d..b7572f070e 100644
--- a/clarity/src/vm/callables.rs
+++ b/clarity/src/vm/callables.rs
@@ -26,14 +26,12 @@ use super::ClarityVersion;
use crate::vm::analysis::errors::CheckErrors;
use crate::vm::contexts::ContractContext;
use crate::vm::costs::cost_functions::ClarityCostFunction;
-use crate::vm::costs::{cost_functions, runtime_cost};
+use crate::vm::costs::runtime_cost;
use crate::vm::errors::{check_argument_count, Error, InterpreterResult as Result};
-use crate::vm::representations::{ClarityName, Span, SymbolicExpression};
-use crate::vm::types::Value::UInt;
+use crate::vm::representations::{ClarityName, SymbolicExpression};
use crate::vm::types::{
- CallableData, FunctionType, ListData, ListTypeData, OptionalData, PrincipalData,
- QualifiedContractIdentifier, ResponseData, SequenceData, SequenceSubtype, TraitIdentifier,
- TupleData, TupleTypeSignature, TypeSignature,
+ CallableData, ListData, ListTypeData, OptionalData, PrincipalData, ResponseData, SequenceData,
+ SequenceSubtype, TraitIdentifier, TupleData, TypeSignature,
};
use crate::vm::{eval, Environment, LocalContext, Value};
@@ -377,7 +375,7 @@ impl DefinedFunction {
}
#[cfg(feature = "developer-mode")]
- pub fn get_span(&self) -> Span {
+ pub fn get_span(&self) -> crate::vm::representations::Span {
self.body.span.clone()
}
}
@@ -512,7 +510,9 @@ fn clarity2_implicit_cast(type_sig: &TypeSignature, value: &Value) -> Result.
-use std::collections::{BTreeMap, BTreeSet};
+use std::collections::BTreeMap;
use std::fmt;
use std::mem::replace;
use hashbrown::{HashMap, HashSet};
use serde::Serialize;
use serde_json::json;
-use stacks_common::consts::CHAIN_ID_TESTNET;
use stacks_common::types::chainstate::StacksBlockId;
use stacks_common::types::StacksEpochId;
@@ -30,10 +29,7 @@ use crate::vm::ast::{ASTRules, ContractAST};
use crate::vm::callables::{DefinedFunction, FunctionIdentifier};
use crate::vm::contracts::Contract;
use crate::vm::costs::cost_functions::ClarityCostFunction;
-use crate::vm::costs::{
- cost_functions, runtime_cost, ClarityCostFunctionReference, CostErrors, CostTracker,
- ExecutionCost, LimitedCostTracker,
-};
+use crate::vm::costs::{runtime_cost, CostErrors, CostTracker, ExecutionCost, LimitedCostTracker};
use crate::vm::database::{
ClarityDatabase, DataMapMetadata, DataVariableMetadata, FungibleTokenMetadata,
NonFungibleTokenMetadata,
@@ -42,11 +38,11 @@ use crate::vm::errors::{
CheckErrors, InterpreterError, InterpreterResult as Result, RuntimeErrorType,
};
use crate::vm::events::*;
-use crate::vm::representations::{ClarityName, ContractName, SymbolicExpression};
+use crate::vm::representations::{ClarityName, SymbolicExpression};
use crate::vm::types::signatures::FunctionSignature;
use crate::vm::types::{
- AssetIdentifier, BuffData, CallableData, OptionalData, PrincipalData,
- QualifiedContractIdentifier, TraitIdentifier, TypeSignature, Value,
+ AssetIdentifier, BuffData, CallableData, PrincipalData, QualifiedContractIdentifier,
+ TraitIdentifier, TypeSignature, Value,
};
use crate::vm::version::ClarityVersion;
use crate::vm::{ast, eval, is_reserved, stx_transfer_consolidated};
@@ -496,7 +492,7 @@ impl<'a, 'hooks> OwnedEnvironment<'a, 'hooks> {
OwnedEnvironment {
context: GlobalContext::new(
false,
- CHAIN_ID_TESTNET,
+ stacks_common::consts::CHAIN_ID_TESTNET,
database,
LimitedCostTracker::new_free(),
epoch,
@@ -519,7 +515,7 @@ impl<'a, 'hooks> OwnedEnvironment<'a, 'hooks> {
OwnedEnvironment {
context: GlobalContext::new(
false,
- CHAIN_ID_TESTNET,
+ stacks_common::consts::CHAIN_ID_TESTNET,
database,
LimitedCostTracker::new_free(),
epoch,
@@ -1974,11 +1970,9 @@ mod test {
use super::*;
use crate::vm::callables::DefineType;
- use crate::vm::tests::{
- test_epochs, tl_env_factory, MemoryEnvironmentGenerator, TopLevelMemoryEnvironmentGenerator,
- };
+ use crate::vm::tests::{test_epochs, tl_env_factory, TopLevelMemoryEnvironmentGenerator};
use crate::vm::types::signatures::CallableSubtype;
- use crate::vm::types::{FixedFunction, FunctionArg, FunctionType, StandardPrincipalData};
+ use crate::vm::types::StandardPrincipalData;
#[test]
fn test_asset_map_abort() {
diff --git a/clarity/src/vm/contracts.rs b/clarity/src/vm/contracts.rs
index 1982665aee..17493a978f 100644
--- a/clarity/src/vm/contracts.rs
+++ b/clarity/src/vm/contracts.rs
@@ -17,13 +17,11 @@
use stacks_common::types::StacksEpochId;
use crate::vm::ast::ContractAST;
-use crate::vm::callables::CallableType;
-use crate::vm::contexts::{ContractContext, Environment, GlobalContext, LocalContext};
+use crate::vm::contexts::{ContractContext, GlobalContext};
use crate::vm::errors::InterpreterResult as Result;
-use crate::vm::representations::SymbolicExpression;
+use crate::vm::eval_all;
use crate::vm::types::{PrincipalData, QualifiedContractIdentifier};
use crate::vm::version::ClarityVersion;
-use crate::vm::{apply, eval_all, Value};
#[derive(Serialize, Deserialize)]
pub struct Contract {
diff --git a/clarity/src/vm/costs/mod.rs b/clarity/src/vm/costs/mod.rs
index a3c7fa7140..d86cd643bd 100644
--- a/clarity/src/vm/costs/mod.rs
+++ b/clarity/src/vm/costs/mod.rs
@@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use std::collections::BTreeMap;
use std::{cmp, fmt};
use hashbrown::HashMap;
@@ -23,20 +22,18 @@ use serde::{Deserialize, Serialize};
use stacks_common::types::StacksEpochId;
use crate::boot_util::boot_code_id;
-use crate::vm::ast::ContractAST;
-use crate::vm::contexts::{ContractContext, Environment, GlobalContext, OwnedEnvironment};
+use crate::vm::contexts::{ContractContext, GlobalContext};
use crate::vm::costs::cost_functions::ClarityCostFunction;
use crate::vm::database::clarity_store::NullBackingStore;
use crate::vm::database::ClarityDatabase;
-use crate::vm::errors::{Error, InterpreterResult};
+use crate::vm::errors::InterpreterResult;
use crate::vm::types::signatures::FunctionType::Fixed;
-use crate::vm::types::signatures::{FunctionSignature, TupleTypeSignature};
+use crate::vm::types::signatures::TupleTypeSignature;
use crate::vm::types::Value::UInt;
use crate::vm::types::{
- FunctionArg, FunctionType, PrincipalData, QualifiedContractIdentifier, TupleData,
- TypeSignature, NONE,
+ FunctionType, PrincipalData, QualifiedContractIdentifier, TupleData, TypeSignature,
};
-use crate::vm::{ast, eval_all, ClarityName, SymbolicExpression, Value};
+use crate::vm::{eval_all, ClarityName, SymbolicExpression, Value};
pub mod constants;
pub mod cost_functions;
diff --git a/clarity/src/vm/coverage.rs b/clarity/src/vm/coverage.rs
index 862c035f98..4e0d64e62b 100644
--- a/clarity/src/vm/coverage.rs
+++ b/clarity/src/vm/coverage.rs
@@ -3,7 +3,6 @@ use std::fs::File;
use std::io::Write;
use hashbrown::{HashMap, HashSet};
-use serde_json::Value as JsonValue;
use super::functions::define::DefineFunctionsParsed;
use super::EvalHook;
diff --git a/clarity/src/vm/database/clarity_db.rs b/clarity/src/vm/database/clarity_db.rs
index cbb8bcb4de..38101197f2 100644
--- a/clarity/src/vm/database/clarity_db.rs
+++ b/clarity/src/vm/database/clarity_db.rs
@@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use serde_json;
-use stacks_common::address::AddressHashMode;
use stacks_common::consts::{
BITCOIN_REGTEST_FIRST_BLOCK_HASH, BITCOIN_REGTEST_FIRST_BLOCK_HEIGHT,
BITCOIN_REGTEST_FIRST_BLOCK_TIMESTAMP, FIRST_BURNCHAIN_CONSENSUS_HASH, FIRST_STACKS_BLOCK_HASH,
@@ -25,8 +23,8 @@ use stacks_common::types::chainstate::{
BlockHeaderHash, BurnchainHeaderHash, ConsensusHash, SortitionId, StacksAddress, StacksBlockId,
TrieHash, VRFSeed,
};
-use stacks_common::types::{Address, StacksEpoch as GenericStacksEpoch, StacksEpochId};
-use stacks_common::util::hash::{to_hex, Hash160, Sha256Sum, Sha512Trunc256Sum};
+use stacks_common::types::{StacksEpoch as GenericStacksEpoch, StacksEpochId};
+use stacks_common::util::hash::{to_hex, Hash160, Sha512Trunc256Sum};
use super::clarity_store::SpecialCaseHandler;
use super::key_value_wrapper::ValueResult;
@@ -35,20 +33,18 @@ use crate::vm::ast::ASTRules;
use crate::vm::contracts::Contract;
use crate::vm::costs::{CostOverflowingMath, ExecutionCost};
use crate::vm::database::structures::{
- ClarityDeserializable, ClaritySerializable, ContractMetadata, DataMapMetadata,
- DataVariableMetadata, FungibleTokenMetadata, NonFungibleTokenMetadata, STXBalance,
- STXBalanceSnapshot, SimmedBlock,
+ ClarityDeserializable, ClaritySerializable, DataMapMetadata, DataVariableMetadata,
+ FungibleTokenMetadata, NonFungibleTokenMetadata, STXBalance, STXBalanceSnapshot,
};
use crate::vm::database::{ClarityBackingStore, RollbackWrapper};
use crate::vm::errors::{
- CheckErrors, Error, IncomparableError, InterpreterError, InterpreterResult as Result,
- RuntimeErrorType,
+ CheckErrors, Error, InterpreterError, InterpreterResult as Result, RuntimeErrorType,
};
use crate::vm::representations::ClarityName;
-use crate::vm::types::serialization::{SerializationError, NONE_SERIALIZATION_LEN};
+use crate::vm::types::serialization::NONE_SERIALIZATION_LEN;
use crate::vm::types::{
- byte_len_of_serialization, OptionalData, PrincipalData, QualifiedContractIdentifier,
- SequenceData, StandardPrincipalData, TupleData, TupleTypeSignature, TypeSignature, Value, NONE,
+ byte_len_of_serialization, PrincipalData, QualifiedContractIdentifier, StandardPrincipalData,
+ TupleData, TypeSignature, Value,
};
pub const STORE_CONTRACT_SRC_INTERFACE: bool = true;
diff --git a/clarity/src/vm/database/clarity_store.rs b/clarity/src/vm/database/clarity_store.rs
index 07d48c9504..a37669f499 100644
--- a/clarity/src/vm/database/clarity_store.rs
+++ b/clarity/src/vm/database/clarity_store.rs
@@ -14,26 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use std::path::PathBuf;
-
#[cfg(feature = "canonical")]
use rusqlite::Connection;
-use stacks_common::types::chainstate::{BlockHeaderHash, StacksBlockId, TrieHash, VRFSeed};
-use stacks_common::util::hash::{hex_bytes, to_hex, Hash160, Sha512Trunc256Sum};
+use stacks_common::types::chainstate::{StacksBlockId, TrieHash};
+use stacks_common::util::hash::{hex_bytes, to_hex, Sha512Trunc256Sum};
use crate::vm::analysis::AnalysisDatabase;
use crate::vm::contexts::GlobalContext;
#[cfg(feature = "canonical")]
-use crate::vm::database::SqliteConnection;
use crate::vm::database::{
- BurnStateDB, ClarityDatabase, ClarityDeserializable, ClaritySerializable, HeadersDB,
- NULL_BURN_STATE_DB, NULL_HEADER_DB,
-};
-use crate::vm::errors::{
- CheckErrors, IncomparableError, InterpreterError, InterpreterResult as Result,
- InterpreterResult, RuntimeErrorType,
+ ClarityDatabase, ClarityDeserializable, ClaritySerializable, NULL_BURN_STATE_DB, NULL_HEADER_DB,
};
-use crate::vm::events::StacksTransactionEvent;
+use crate::vm::errors::{InterpreterError, InterpreterResult as Result};
use crate::vm::types::{PrincipalData, QualifiedContractIdentifier};
use crate::vm::Value;
diff --git a/clarity/src/vm/database/key_value_wrapper.rs b/clarity/src/vm/database/key_value_wrapper.rs
index eecbe092ea..4d16d2dae6 100644
--- a/clarity/src/vm/database/key_value_wrapper.rs
+++ b/clarity/src/vm/database/key_value_wrapper.rs
@@ -26,10 +26,8 @@ use super::{ClarityBackingStore, ClarityDeserializable};
use crate::vm::database::clarity_store::make_contract_hash_key;
use crate::vm::errors::{InterpreterError, InterpreterResult};
use crate::vm::types::serialization::SerializationError;
-use crate::vm::types::{
- QualifiedContractIdentifier, SequenceData, SequenceSubtype, TupleData, TypeSignature,
-};
-use crate::vm::{StacksEpoch, Value};
+use crate::vm::types::{QualifiedContractIdentifier, TypeSignature};
+use crate::vm::Value;
#[cfg(feature = "rollback_value_check")]
type RollbackValueCheck = String;
diff --git a/clarity/src/vm/database/mod.rs b/clarity/src/vm/database/mod.rs
index a9c2182806..65236cd88a 100644
--- a/clarity/src/vm/database/mod.rs
+++ b/clarity/src/vm/database/mod.rs
@@ -13,7 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use hashbrown::HashMap;
#[cfg(feature = "canonical")]
pub use sqlite::MemoryBackingStore;
diff --git a/clarity/src/vm/database/sqlite.rs b/clarity/src/vm/database/sqlite.rs
index 7bc9a7130f..b5da5efedf 100644
--- a/clarity/src/vm/database/sqlite.rs
+++ b/clarity/src/vm/database/sqlite.rs
@@ -15,10 +15,7 @@
// along with this program. If not, see .
use rusqlite::types::{FromSql, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
-use rusqlite::{
- params, Connection, Error as SqliteError, ErrorCode as SqliteErrorCode, OptionalExtension, Row,
- Savepoint,
-};
+use rusqlite::{params, Connection, OptionalExtension};
use stacks_common::types::chainstate::{BlockHeaderHash, StacksBlockId, TrieHash};
use stacks_common::types::sqlite::NO_PARAMS;
use stacks_common::util::db::tx_busy_handler;
@@ -30,10 +27,9 @@ use super::{
NULL_BURN_STATE_DB, NULL_HEADER_DB,
};
use crate::vm::analysis::{AnalysisDatabase, CheckErrors};
-use crate::vm::contracts::Contract;
use crate::vm::costs::ExecutionCost;
use crate::vm::errors::{
- Error, IncomparableError, InterpreterError, InterpreterResult as Result, RuntimeErrorType,
+ IncomparableError, InterpreterError, InterpreterResult as Result, RuntimeErrorType,
};
use crate::vm::types::QualifiedContractIdentifier;
diff --git a/clarity/src/vm/database/structures.rs b/clarity/src/vm/database/structures.rs
index b88420ff6a..215c0d10d3 100644
--- a/clarity/src/vm/database/structures.rs
+++ b/clarity/src/vm/database/structures.rs
@@ -22,12 +22,8 @@ use stacks_common::util::hash::{hex_bytes, to_hex};
use crate::vm::analysis::ContractAnalysis;
use crate::vm::contracts::Contract;
use crate::vm::database::ClarityDatabase;
-use crate::vm::errors::{
- Error, IncomparableError, InterpreterError, InterpreterResult, RuntimeErrorType,
-};
-use crate::vm::types::{
- OptionalData, PrincipalData, TupleTypeSignature, TypeSignature, Value, NONE,
-};
+use crate::vm::errors::{Error, InterpreterError, RuntimeErrorType};
+use crate::vm::types::{PrincipalData, TypeSignature};
pub trait ClaritySerializable {
fn serialize(&self) -> String;
diff --git a/clarity/src/vm/docs/contracts.rs b/clarity/src/vm/docs/contracts.rs
index 138203db71..70c1b3ecb2 100644
--- a/clarity/src/vm/docs/contracts.rs
+++ b/clarity/src/vm/docs/contracts.rs
@@ -86,7 +86,7 @@ fn doc_execute(program: &str) -> Result