Skip to content

Commit e67c961

Browse files
committed
Merge branch 'develop' into feat/stacks-inspect-improvements
2 parents 35f883e + 8826d5c commit e67c961

File tree

96 files changed

+5608
-2529
lines changed

Some content is hidden

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

96 files changed

+5608
-2529
lines changed

CHANGELOG.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,23 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
99

1010
### Added
1111

12-
- Fixed an issue where `event.committed` was always equal to `true` in the block replay RPC endpoint
13-
- Added `result_hex` and `post_condition_aborted` to the block replay RPC endpoint
14-
- Added `--epoch <epoch_number>` flag to `clarity-cli` commands to specify the epoch context for evaluation.
1512
- In the `/v3/transaction/{txid}` RPC endpoint, added `block_height` and `is_canonical` to the response.
1613
- Improved block validation in `stacks-inspect`.
1714

1815
### Changed
1916

2017
- Removed `validate-naka-block` option in `stacks-inspect`, merging it with `validate-block` so that users do not need to differentiate between the two.
2118

19+
## [3.3.0.0.2]
20+
21+
### Added
22+
23+
- Fixed an issue where `event.committed` was always equal to `true` in the block replay RPC endpoint
24+
- Added `result_hex` and `post_condition_aborted` to the block replay RPC endpoint
25+
- Added `--epoch <epoch_number>` flag to `clarity-cli` commands to specify the epoch context for evaluation.
26+
- Added miner support for generating read-count tenure extends
27+
- Added `read_count_extend_cost_threshold` config option (in the miner config) which specifies the percentage of the block budget that must be used before attempting a time-based tenure extend. Defaults to 25%.
28+
2229
### Fixed
2330

2431
- Correctly produce the receipt for the `costs-4` contract, which was deployed on epoch 3.3 activation. Users who consume node events and want to fill in the missing receipt (e.g. the Hiro API) will need to revert their chainstate to before the 3.3 activation and then resume sync to receive the previously missing event.

clarity-types/src/errors/analysis.rs

Lines changed: 788 additions & 250 deletions
Large diffs are not rendered by default.

clarity-types/src/errors/mod.rs

Lines changed: 10 additions & 4 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::{CheckErrorKind, StaticCheckError};
23+
pub use analysis::{CheckErrorKind, CommonCheckErrorKind, StaticCheckError, StaticCheckErrorKind};
2424
pub use ast::{ParseError, ParseErrorKind, ParseResult};
2525
pub use cost::CostErrors;
2626
pub use lexer::LexerError;
@@ -292,15 +292,21 @@ impl From<RuntimeError> for VmExecutionError {
292292
}
293293
}
294294

295+
impl From<CommonCheckErrorKind> for VmExecutionError {
296+
fn from(err: CommonCheckErrorKind) -> Self {
297+
VmExecutionError::Unchecked(err.into())
298+
}
299+
}
300+
295301
impl From<CheckErrorKind> for VmExecutionError {
296302
fn from(err: CheckErrorKind) -> Self {
297303
VmExecutionError::Unchecked(err)
298304
}
299305
}
300306

301-
impl From<(CheckErrorKind, &SymbolicExpression)> for VmExecutionError {
302-
fn from(err: (CheckErrorKind, &SymbolicExpression)) -> Self {
303-
VmExecutionError::Unchecked(err.0)
307+
impl From<(CommonCheckErrorKind, &SymbolicExpression)> for VmExecutionError {
308+
fn from(err: (CommonCheckErrorKind, &SymbolicExpression)) -> Self {
309+
VmExecutionError::Unchecked(err.0.into())
304310
}
305311
}
306312

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

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

2121
use crate::VmExecutionError;
22+
use crate::errors::analysis::CommonCheckErrorKind;
2223
use crate::errors::{CheckErrorKind, RuntimeError, VmInternalError};
2324
use crate::types::{
2425
ASCIIData, BuffData, CharType, ListTypeData, MAX_VALUE_SIZE, PrincipalData,
@@ -38,7 +39,7 @@ fn test_constructors() {
3839
);
3940
assert_eq!(
4041
ListTypeData::new_list(TypeSignature::IntType, MAX_VALUE_SIZE),
41-
Err(CheckErrorKind::ValueTooLarge)
42+
Err(CommonCheckErrorKind::ValueTooLarge)
4243
);
4344

4445
assert_eq!(

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

Lines changed: 11 additions & 11 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::CheckErrorKind;
17+
use crate::errors::analysis::CommonCheckErrorKind;
1818
use crate::representations::CONTRACT_MAX_NAME_LENGTH;
1919
use crate::types::TypeSignature::{BoolType, IntType, ListUnionType, UIntType};
2020
use crate::types::signatures::{CallableSubtype, TypeSignature};
@@ -43,7 +43,7 @@ fn test_buffer_length_try_from_u32_trait() {
4343
assert_eq!(MAX_VALUE_SIZE, buffer.get_value());
4444

4545
let err = BufferLength::try_from(MAX_VALUE_SIZE + 1).unwrap_err();
46-
assert_eq!(CheckErrorKind::ValueTooLarge, err);
46+
assert_eq!(CommonCheckErrorKind::ValueTooLarge, err);
4747
}
4848

4949
#[test]
@@ -55,7 +55,7 @@ fn test_buffer_length_try_from_usize_trait() {
5555
assert_eq!(MAX_VALUE_SIZE, buffer.get_value());
5656

5757
let err = BufferLength::try_from(MAX_VALUE_SIZE as usize + 1).unwrap_err();
58-
assert_eq!(CheckErrorKind::ValueTooLarge, err);
58+
assert_eq!(CommonCheckErrorKind::ValueTooLarge, err);
5959
}
6060

6161
#[test]
@@ -67,10 +67,10 @@ fn test_buffer_length_try_from_i128_trait() {
6767
assert_eq!(MAX_VALUE_SIZE, buffer.get_value());
6868

6969
let err = BufferLength::try_from(MAX_VALUE_SIZE as i128 + 1).unwrap_err();
70-
assert_eq!(CheckErrorKind::ValueTooLarge, err);
70+
assert_eq!(CommonCheckErrorKind::ValueTooLarge, err);
7171

7272
let err = BufferLength::try_from(-1_i128).unwrap_err();
73-
assert_eq!(CheckErrorKind::ValueOutOfBounds, err);
73+
assert_eq!(CommonCheckErrorKind::ValueOutOfBounds, err);
7474
}
7575

7676
#[test]
@@ -229,7 +229,7 @@ fn test_string_utf8_length_try_from_u32_trait() {
229229
assert_eq!(MAX_UTF8_VALUE_SIZE, string.get_value());
230230

231231
let err = StringUTF8Length::try_from(MAX_UTF8_VALUE_SIZE + 1).unwrap_err();
232-
assert_eq!(CheckErrorKind::ValueTooLarge, err);
232+
assert_eq!(CommonCheckErrorKind::ValueTooLarge, err);
233233
}
234234

235235
#[test]
@@ -244,7 +244,7 @@ fn test_string_utf8_length_try_from_usize_trait() {
244244
assert_eq!(MAX_UTF8_VALUE_SIZE, string.get_value());
245245

246246
let err = StringUTF8Length::try_from(MAX_UTF8_VALUE_SIZE as usize + 1).unwrap_err();
247-
assert_eq!(CheckErrorKind::ValueTooLarge, err);
247+
assert_eq!(CommonCheckErrorKind::ValueTooLarge, err);
248248
}
249249

250250
#[test]
@@ -259,10 +259,10 @@ fn test_string_utf8_length_try_from_i128_trait() {
259259
assert_eq!(MAX_UTF8_VALUE_SIZE, string.get_value());
260260

261261
let err = StringUTF8Length::try_from(MAX_UTF8_VALUE_SIZE as i128 + 1).unwrap_err();
262-
assert_eq!(CheckErrorKind::ValueTooLarge, err);
262+
assert_eq!(CommonCheckErrorKind::ValueTooLarge, err);
263263

264264
let err = StringUTF8Length::try_from(-1_i128).unwrap_err();
265-
assert_eq!(CheckErrorKind::ValueOutOfBounds, err);
265+
assert_eq!(CommonCheckErrorKind::ValueOutOfBounds, err);
266266
}
267267

268268
#[test]
@@ -826,11 +826,11 @@ fn test_least_supertype() {
826826
for pair in bad_pairs {
827827
matches!(
828828
TypeSignature::least_supertype_v2_1(&pair.0, &pair.1).unwrap_err(),
829-
CheckErrorKind::TypeError(..)
829+
CommonCheckErrorKind::TypeError(..)
830830
);
831831
matches!(
832832
TypeSignature::least_supertype_v2_1(&pair.1, &pair.0).unwrap_err(),
833-
CheckErrorKind::TypeError(..)
833+
CommonCheckErrorKind::TypeError(..)
834834
);
835835
}
836836
}

clarity-types/src/types/mod.rs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub use self::signatures::{
3636
AssetIdentifier, BufferLength, ListTypeData, SequenceSubtype, StringSubtype, StringUTF8Length,
3737
TupleTypeSignature, TypeSignature,
3838
};
39+
use crate::errors::analysis::CommonCheckErrorKind;
3940
use crate::errors::{CheckErrorKind, RuntimeError, VmExecutionError, VmInternalError};
4041
use crate::representations::{ClarityName, ContractName, SymbolicExpression};
4142

@@ -711,7 +712,7 @@ impl fmt::Display for UTF8Data {
711712
}
712713

713714
pub trait SequencedValue<T> {
714-
fn type_signature(&self) -> std::result::Result<TypeSignature, CheckErrorKind>;
715+
fn type_signature(&self) -> std::result::Result<TypeSignature, CommonCheckErrorKind>;
715716

716717
fn items(&self) -> &Vec<T>;
717718

@@ -736,7 +737,7 @@ impl SequencedValue<Value> for ListData {
736737
self.data.drain(..).collect()
737738
}
738739

739-
fn type_signature(&self) -> std::result::Result<TypeSignature, CheckErrorKind> {
740+
fn type_signature(&self) -> std::result::Result<TypeSignature, CommonCheckErrorKind> {
740741
Ok(TypeSignature::SequenceType(SequenceSubtype::ListType(
741742
self.type_signature.clone(),
742743
)))
@@ -756,9 +757,11 @@ impl SequencedValue<u8> for BuffData {
756757
self.data.drain(..).collect()
757758
}
758759

759-
fn type_signature(&self) -> std::result::Result<TypeSignature, CheckErrorKind> {
760+
fn type_signature(&self) -> std::result::Result<TypeSignature, CommonCheckErrorKind> {
760761
let buff_length = BufferLength::try_from(self.data.len()).map_err(|_| {
761-
CheckErrorKind::Expects("ERROR: Too large of a buffer successfully constructed.".into())
762+
CommonCheckErrorKind::Expects(
763+
"ERROR: Too large of a buffer successfully constructed.".into(),
764+
)
762765
})?;
763766
Ok(TypeSignature::SequenceType(SequenceSubtype::BufferType(
764767
buff_length,
@@ -779,9 +782,11 @@ impl SequencedValue<u8> for ASCIIData {
779782
self.data.drain(..).collect()
780783
}
781784

782-
fn type_signature(&self) -> std::result::Result<TypeSignature, CheckErrorKind> {
785+
fn type_signature(&self) -> std::result::Result<TypeSignature, CommonCheckErrorKind> {
783786
let buff_length = BufferLength::try_from(self.data.len()).map_err(|_| {
784-
CheckErrorKind::Expects("ERROR: Too large of a buffer successfully constructed.".into())
787+
CommonCheckErrorKind::Expects(
788+
"ERROR: Too large of a buffer successfully constructed.".into(),
789+
)
785790
})?;
786791
Ok(TypeSignature::SequenceType(SequenceSubtype::StringType(
787792
StringSubtype::ASCII(buff_length),
@@ -805,9 +810,11 @@ impl SequencedValue<Vec<u8>> for UTF8Data {
805810
self.data.drain(..).collect()
806811
}
807812

808-
fn type_signature(&self) -> std::result::Result<TypeSignature, CheckErrorKind> {
813+
fn type_signature(&self) -> std::result::Result<TypeSignature, CommonCheckErrorKind> {
809814
let str_len = StringUTF8Length::try_from(self.data.len()).map_err(|_| {
810-
CheckErrorKind::Expects("ERROR: Too large of a buffer successfully constructed.".into())
815+
CommonCheckErrorKind::Expects(
816+
"ERROR: Too large of a buffer successfully constructed.".into(),
817+
)
811818
})?;
812819
Ok(TypeSignature::SequenceType(SequenceSubtype::StringType(
813820
StringSubtype::UTF8(str_len),
@@ -823,19 +830,19 @@ impl SequencedValue<Vec<u8>> for UTF8Data {
823830
}
824831

825832
impl OptionalData {
826-
pub fn type_signature(&self) -> std::result::Result<TypeSignature, CheckErrorKind> {
833+
pub fn type_signature(&self) -> std::result::Result<TypeSignature, CommonCheckErrorKind> {
827834
let type_result = match self.data {
828835
Some(ref v) => TypeSignature::new_option(TypeSignature::type_of(v)?),
829836
None => TypeSignature::new_option(TypeSignature::NoType),
830837
};
831838
type_result.map_err(|_| {
832-
CheckErrorKind::Expects("Should not have constructed too large of a type.".into())
839+
CommonCheckErrorKind::Expects("Should not have constructed too large of a type.".into())
833840
})
834841
}
835842
}
836843

837844
impl ResponseData {
838-
pub fn type_signature(&self) -> std::result::Result<TypeSignature, CheckErrorKind> {
845+
pub fn type_signature(&self) -> std::result::Result<TypeSignature, CommonCheckErrorKind> {
839846
let type_result = match self.committed {
840847
true => TypeSignature::new_response(
841848
TypeSignature::type_of(&self.data)?,
@@ -847,7 +854,7 @@ impl ResponseData {
847854
),
848855
};
849856
type_result.map_err(|_| {
850-
CheckErrorKind::Expects("Should not have constructed too large of a type.".into())
857+
CommonCheckErrorKind::Expects("Should not have constructed too large of a type.".into())
851858
})
852859
}
853860
}

0 commit comments

Comments
 (0)