Skip to content

Commit 22de8cf

Browse files
committed
Merge branch 'aac-client-breaking' of https://github.com/stacks-network/stacks-core into chore/aac-rename-clarity-error
2 parents 42d2b4b + 927747c commit 22de8cf

Some content is hidden

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

88 files changed

+2544
-2191
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ impl<'a, 'b> ReadOnlyChecker<'a, 'b> {
498498
///
499499
/// # Errors
500500
///
501-
/// - Returns CheckErrors::WriteAttemptedInReadOnly if there is a read-only
501+
/// - Returns CheckErrorKind::WriteAttemptedInReadOnly if there is a read-only
502502
/// violation, i.e. if some function marked read-only attempts to modify
503503
/// the chainstate.
504504
pub fn run(&mut self, contract_analysis: &ContractAnalysis) -> Result<(), StaticCheckError>

clarity-types/src/errors/analysis.rs

Lines changed: 351 additions & 170 deletions
Large diffs are not rendered by default.

clarity-types/src/errors/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub mod lexer;
2020

2121
use std::{error, fmt};
2222

23-
pub use analysis::{CheckErrors, StaticCheckError};
23+
pub use analysis::{CheckErrorKind, StaticCheckError};
2424
pub use ast::{ParseError, ParseErrors, ParseResult};
2525
pub use cost::CostErrors;
2626
pub use lexer::LexerError;
@@ -43,7 +43,7 @@ pub enum Error {
4343
/// UncheckedErrors are errors that *should* be caught by the
4444
/// TypeChecker and other check passes. Test executions may
4545
/// trigger these errors.
46-
Unchecked(CheckErrors),
46+
Unchecked(CheckErrorKind),
4747
Interpreter(InterpreterError),
4848
Runtime(RuntimeErrorType, Option<StackTrace>),
4949
EarlyReturn(EarlyReturnError),
@@ -192,7 +192,7 @@ impl From<CostErrors> for Error {
192192
CostErrors::Expect(s) => Error::from(InterpreterError::Expect(format!(
193193
"Interpreter failure during cost calculation: {s}"
194194
))),
195-
other_err => Error::from(CheckErrors::from(other_err)),
195+
other_err => Error::from(CheckErrorKind::from(other_err)),
196196
}
197197
}
198198
}
@@ -203,14 +203,14 @@ impl From<RuntimeErrorType> for Error {
203203
}
204204
}
205205

206-
impl From<CheckErrors> for Error {
207-
fn from(err: CheckErrors) -> Self {
206+
impl From<CheckErrorKind> for Error {
207+
fn from(err: CheckErrorKind) -> Self {
208208
Error::Unchecked(err)
209209
}
210210
}
211211

212-
impl From<(CheckErrors, &SymbolicExpression)> for Error {
213-
fn from(err: (CheckErrors, &SymbolicExpression)) -> Self {
212+
impl From<(CheckErrorKind, &SymbolicExpression)> for Error {
213+
fn from(err: (CheckErrorKind, &SymbolicExpression)) -> Self {
214214
Error::Unchecked(err.0)
215215
}
216216
}

clarity-types/src/representations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,14 +623,14 @@ impl SymbolicExpression {
623623
}
624624

625625
/// Encode this SymbolicExpression as a String suitable for logging an error (such as in
626-
/// CheckErrors). The `developer-mode` feature includes the `span`.
626+
/// CheckErrorKind). The `developer-mode` feature includes the `span`.
627627
#[cfg(feature = "developer-mode")]
628628
pub fn as_error_string(&self) -> String {
629629
format!("{} at {:?}", &self.expr, &self.span)
630630
}
631631

632632
/// Encode this SymbolicExpression as a String suitable for logging an error (such as in
633-
/// CheckErrors).
633+
/// CheckErrorKind).
634634
#[cfg(not(feature = "developer-mode"))]
635635
pub fn as_error_string(&self) -> String {
636636
format!("{}", &self.expr)

clarity-types/src/tests/types/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rstest::rstest;
1919
use stacks_common::types::StacksEpochId;
2020

2121
use crate::Error;
22-
use crate::errors::{CheckErrors, InterpreterError, RuntimeErrorType};
22+
use crate::errors::{CheckErrorKind, InterpreterError, RuntimeErrorType};
2323
use crate::types::{
2424
ASCIIData, BuffData, CharType, ListTypeData, MAX_VALUE_SIZE, PrincipalData,
2525
QualifiedContractIdentifier, SequenceData, SequencedValue as _, StandardPrincipalData,
@@ -38,12 +38,12 @@ fn test_constructors() {
3838
);
3939
assert_eq!(
4040
ListTypeData::new_list(TypeSignature::IntType, MAX_VALUE_SIZE),
41-
Err(CheckErrors::ValueTooLarge)
41+
Err(CheckErrorKind::ValueTooLarge)
4242
);
4343

4444
assert_eq!(
4545
Value::buff_from(vec![0; (MAX_VALUE_SIZE + 1) as usize]),
46-
Err(CheckErrors::ValueTooLarge.into())
46+
Err(CheckErrorKind::ValueTooLarge.into())
4747
);
4848

4949
// Test that wrappers (okay, error, some)
@@ -52,17 +52,17 @@ fn test_constructors() {
5252
// isn't causing the error).
5353
assert_eq!(
5454
Value::okay(Value::buff_from(vec![0; (MAX_VALUE_SIZE) as usize]).unwrap()),
55-
Err(CheckErrors::ValueTooLarge.into())
55+
Err(CheckErrorKind::ValueTooLarge.into())
5656
);
5757

5858
assert_eq!(
5959
Value::error(Value::buff_from(vec![0; (MAX_VALUE_SIZE) as usize]).unwrap()),
60-
Err(CheckErrors::ValueTooLarge.into())
60+
Err(CheckErrorKind::ValueTooLarge.into())
6161
);
6262

6363
assert_eq!(
6464
Value::some(Value::buff_from(vec![0; (MAX_VALUE_SIZE) as usize]).unwrap()),
65-
Err(CheckErrors::ValueTooLarge.into())
65+
Err(CheckErrorKind::ValueTooLarge.into())
6666
);
6767

6868
// Test that the depth limit is correctly enforced:
@@ -86,24 +86,24 @@ fn test_constructors() {
8686
let inner_value = cons().unwrap();
8787
assert_eq!(
8888
TupleData::from_data(vec![("a".into(), inner_value.clone())]),
89-
Err(CheckErrors::TypeSignatureTooDeep.into())
89+
Err(CheckErrorKind::TypeSignatureTooDeep.into())
9090
);
9191

9292
assert_eq!(
9393
Value::list_from(vec![inner_value.clone()]),
94-
Err(CheckErrors::TypeSignatureTooDeep.into())
94+
Err(CheckErrorKind::TypeSignatureTooDeep.into())
9595
);
9696
assert_eq!(
9797
Value::okay(inner_value.clone()),
98-
Err(CheckErrors::TypeSignatureTooDeep.into())
98+
Err(CheckErrorKind::TypeSignatureTooDeep.into())
9999
);
100100
assert_eq!(
101101
Value::error(inner_value.clone()),
102-
Err(CheckErrors::TypeSignatureTooDeep.into())
102+
Err(CheckErrorKind::TypeSignatureTooDeep.into())
103103
);
104104
assert_eq!(
105105
Value::some(inner_value),
106-
Err(CheckErrors::TypeSignatureTooDeep.into())
106+
Err(CheckErrorKind::TypeSignatureTooDeep.into())
107107
);
108108

109109
if std::env::var("CIRCLE_TESTING") == Ok("1".to_string()) {
@@ -115,7 +115,7 @@ fn test_constructors() {
115115
if (u32::MAX as usize) < usize::MAX {
116116
assert_eq!(
117117
Value::buff_from(vec![0; (u32::MAX as usize) + 10]),
118-
Err(CheckErrors::ValueTooLarge.into())
118+
Err(CheckErrorKind::ValueTooLarge.into())
119119
);
120120
}
121121
}

clarity-types/src/tests/types/serialization.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use std::io::Write;
1616

1717
use crate::Error;
18-
use crate::errors::{CheckErrors, InterpreterError};
18+
use crate::errors::{CheckErrorKind, InterpreterError};
1919
use crate::types::serialization::SerializationError;
2020
use crate::types::{
2121
ASCIIData, CharType, MAX_VALUE_SIZE, PrincipalData, QualifiedContractIdentifier, SequenceData,
@@ -394,7 +394,7 @@ fn try_deser_large_tuple() {
394394
fn try_overflow_stack() {
395395
let input = "08080808080808080808070707080807080808080808080708080808080708080707080707080807080808080808080708080808080708080707080708070807080808080808080708080808080708080708080808080808080807070807080808080808070808070707080807070808070808080808070808070708070807080808080808080707080708070807080708080808080808070808080808070808070808080808080808080707080708080808080807080807070708080707080807080808080807080807070807080708080808080808070708070808080808080708080707070808070708080807080807070708";
396396
assert_eq!(
397-
Err(CheckErrors::TypeSignatureTooDeep.into()),
397+
Err(CheckErrorKind::TypeSignatureTooDeep.into()),
398398
Value::try_deserialize_hex_untyped(input)
399399
);
400400
}

clarity-types/src/tests/types/signatures.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1515
use std::collections::HashSet;
1616

17-
use crate::errors::CheckErrors;
17+
use crate::errors::CheckErrorKind;
1818
use crate::types::TypeSignature::{BoolType, IntType, ListUnionType, UIntType};
1919
use crate::types::signatures::{CallableSubtype, TypeSignature};
2020
use crate::types::{
@@ -518,11 +518,11 @@ fn test_least_supertype() {
518518
for pair in bad_pairs {
519519
matches!(
520520
TypeSignature::least_supertype_v2_1(&pair.0, &pair.1).unwrap_err(),
521-
CheckErrors::TypeError(..)
521+
CheckErrorKind::TypeError(..)
522522
);
523523
matches!(
524524
TypeSignature::least_supertype_v2_1(&pair.1, &pair.0).unwrap_err(),
525-
CheckErrors::TypeError(..)
525+
CheckErrorKind::TypeError(..)
526526
);
527527
}
528528
}
@@ -531,7 +531,7 @@ fn test_least_supertype() {
531531
fn test_type_signature_bound_string_ascii_type_returns_check_errors() {
532532
let err = TypeSignature::bound_string_ascii_type(MAX_VALUE_SIZE + 1).unwrap_err();
533533
assert_eq!(
534-
CheckErrors::Expects(
534+
CheckErrorKind::Expects(
535535
"FAIL: Max Clarity Value Size is no longer realizable in ASCII Type".to_string()
536536
),
537537
err

0 commit comments

Comments
 (0)