Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
6f5771a
chore: remove unused TypeSignature::empty_buffer(), #6467
fdefelici Sep 17, 2025
2e0cad6
test: add TypeSignature::min_buffer() unit test, #6467
fdefelici Sep 17, 2025
bd5ef8a
chore: convert TypeSignature::min_buffer() to const, #6467
fdefelici Sep 17, 2025
87918a8
chore: convert TypeSignature::min_buffer() to TypeSignature::BUFFER_M…
fdefelici Sep 17, 2025
936300e
refactor: replace lazy static BUFF_1 with TypeSignature::BUFFER_1 con…
fdefelici Sep 17, 2025
37e1e8b
chore: merge develop with conflicts
fdefelici Sep 18, 2025
0610ce3
refactor: improve proposal, #6467
fdefelici Sep 18, 2025
a5c784b
chore: proposal revision, #6467
fdefelici Sep 19, 2025
181adcc
chore: remove unused BUFF_16, #6467
fdefelici Sep 19, 2025
0a9ad44
chore: porting BUFFER_21 for tests, #6467
fdefelici Sep 19, 2025
b0a541f
chore: ported BUFF_20, #6467
fdefelici Sep 19, 2025
d350e76
chore: ported BUFF_33, #6467
fdefelici Sep 19, 2025
6e7846e
chore: ported BUFF_32, #6467
fdefelici Sep 19, 2025
4542fce
chore: ported BUFF_64, #6467
fdefelici Sep 19, 2025
87d2297
chore: ported BUFF_65, #6467
fdefelici Sep 19, 2025
276386c
chore: move BUFFER_21 to test local, 6467
fdefelici Sep 19, 2025
0cdea7c
chore: convert max_buffer() to BUFFER_MAX, 6467
fdefelici Sep 19, 2025
87fbbe9
chore: move try_from traits next to BufferLength struct, #6467
fdefelici Sep 19, 2025
6a1f415
refactor: avoid TryFrom code duplication with BufferLength::try_from_…
fdefelici Sep 22, 2025
7ecd45a
chore: remove unused TypeSignature::new_string_ascii(), #6467
fdefelici Sep 22, 2025
93a646b
chore: ported min_string_ascii() to STRING_ASCII_MIN, #6467
fdefelici Sep 22, 2025
5bba38e
chore: ported max_string_ascii() to STRING_ASCII_MAX, #6467
fdefelici Sep 22, 2025
a0f7ae2
chore: ported ASCII_40 to STRING_ASCII_40, #6467
fdefelici Sep 22, 2025
649af14
refactor: avoid TryFrom code duplication with StringUTF8Length::try_f…
fdefelici Sep 22, 2025
7ebbea7
chore: ported min_string_utf8() to STRING_UTF8_MIN, #6467
fdefelici Sep 22, 2025
b6316d1
chore: ported max_string_utf8() to STRING_UTF8_MAX, #6467
fdefelici Sep 22, 2025
f6e870b
chore: ported UTF8_40 to STRING_UTF8_40, #6467
fdefelici Sep 22, 2025
bc8061c
chore: ported TO_ASCII_MAX_BUFF to TO_ASCII_BUFFER_MAX, #6467
fdefelici Sep 22, 2025
01a680a
chore: ported TO_ASCII_RESPONSE_STRING to TO_ASCII_STRING_ASCII_MAX, …
fdefelici Sep 22, 2025
7e7ef19
chore: rename type_buffer_of_size() to type_buffer(), #6467
fdefelici Sep 22, 2025
339b3b3
chore: ported contract_name_string_ascii_type() to CONTRACT_NAME_STRI…
fdefelici Sep 23, 2025
426ec21
chore: improve doc, #6467
fdefelici Sep 23, 2025
c75264c
chore: improve clarity test for TO_ASCII_BUFFER_MAX, #6467
fdefelici Sep 23, 2025
146d71c
chore: remove Result form unit_type() signature, #6467
fdefelici Sep 23, 2025
d222bfd
chore: improve const doc, #6467
fdefelici Sep 23, 2025
6a1f0e9
chore: limit cfg test to crate, #6467
fdefelici Sep 23, 2025
3b8963b
chore: improve const type function to be used in test context, #6467
fdefelici Sep 23, 2025
9e7ebfa
Implement TestChainstate
jferrant Sep 23, 2025
2376c98
Add ConsensusTest boiler plate for appending a block
jferrant Sep 23, 2025
9fd6728
bugfix: enforce bitcoin rpc client to be created only for miner node
fdefelici Sep 24, 2025
c6daf6b
Make TestPeer use TestChainstate internally
jferrant Sep 25, 2025
b7492a2
test: add unit-tests to nail btc rpc client creation behaviour based …
fdefelici Sep 25, 2025
07e44fb
crc: rename try_get_rpc_client to get_rpc_client
fdefelici Sep 25, 2025
bb53602
crc: rename try_create_rpc_client to create_rpc_client_unchecked
fdefelici Sep 25, 2025
a4310f1
crc: makes create_rpc_client_unchecked more idiomatic
fdefelici Sep 25, 2025
ce3c88a
crc: improve BitcoinRpcClient::from_stx_config documentation
fdefelici Sep 25, 2025
51ee551
test: fix test antientropy_integration_test that was using a follower…
fdefelici Sep 25, 2025
bafbfde
crc: makes create_rpc_client_unchecked idiomatic
fdefelici Sep 25, 2025
246510c
crc: makes try_from code reuse architecture agnostic, #6467
fdefelici Sep 25, 2025
8b455aa
Add a test mismatch structures
jferrant Sep 26, 2025
39a1b4a
CRC: directly compare Error as string, comment cleanup, and rename so…
jferrant Sep 26, 2025
42ac8ae
Implement some helper functions and remove duplication
jferrant Sep 26, 2025
1c75a97
Merge branch 'aac-client-breaking' of https://github.com/stacks-netwo…
jferrant Sep 26, 2025
e1d1351
Fix bad merge
jferrant Sep 26, 2025
8531746
Merge branch 'feat/aac-testing-boiler-plate' of github.com:jferrant/s…
jferrant Sep 26, 2025
8f1f31a
Renaming block-replay script to block-validation
wileyj Sep 28, 2025
7683a29
cargo fmt
wileyj Sep 28, 2025
a8e30cc
Update link to block-validation script in release process doc (script
wileyj Sep 29, 2025
bcf4591
Fix spelling error in stdout
wileyj Sep 29, 2025
be46dbb
Merge branch 'develop' into bugfix/btc-rpc-only-for-miner
jcnelson Sep 29, 2025
28701fa
CRC: add a helper function to pretty print ConsensusMismatch as a JSO…
jferrant Sep 29, 2025
685df22
Merge branch 'feat/aac-testing-boiler-plate' of github.com:jferrant/s…
jferrant Sep 29, 2025
374e525
Merge pull request #6540 from wileyj/chore/rename_block_replay
wileyj Sep 29, 2025
c245ce4
Add a stx transfer test
jferrant Sep 29, 2025
b6fc3ff
Add a ExpressionStackDepthTooDeep test
jferrant Sep 29, 2025
4da4c6a
Merge pull request #6534 from fdefelici/bugfix/btc-rpc-only-for-miner
fdefelici Sep 30, 2025
9ab65d1
Merge pull request #6498 from fdefelici/refactor/aac-infallible-to-co…
fdefelici Sep 30, 2025
03ed436
Add support for epoch specific tests
jferrant Sep 30, 2025
857c0f9
Add support for multiple blocks per epoch and chainstate reuse
jferrant Sep 30, 2025
6642663
Merge branch 'feat/aac-testing-boiler-plate' of github.com:jferrant/s…
jferrant Oct 2, 2025
b5e3baf
Merge pull request #6531 from jferrant/feat/aac-testing-boiler-plate
jferrant Oct 2, 2025
b30fc08
Merge branch 'develop' of https://github.com/stacks-network/stacks-co…
jferrant Oct 2, 2025
ca45e4f
Fix bad merge
jferrant Oct 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
447 changes: 372 additions & 75 deletions clarity-types/src/tests/types/signatures.rs

Large diffs are not rendered by default.

33 changes: 21 additions & 12 deletions clarity-types/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,29 @@ use stacks_common::types::chainstate::StacksPrivateKey;
use stacks_common::util::hash;

pub use self::signatures::{
AssetIdentifier, BUFF_1, BUFF_20, BUFF_21, BUFF_32, BUFF_33, BUFF_64, BUFF_65, BufferLength,
ListTypeData, SequenceSubtype, StringSubtype, StringUTF8Length, TupleTypeSignature,
TypeSignature,
AssetIdentifier, BufferLength, ListTypeData, SequenceSubtype, StringSubtype, StringUTF8Length,
TupleTypeSignature, TypeSignature,
};
use crate::errors::{CheckErrorKind, InterpreterResult as Result, RuntimeError, VmInternalError};
use crate::representations::{ClarityName, ContractName, SymbolicExpression};
// use crate::vm::ClarityVersion;

/// Maximum size in bytes allowed for types.
pub const MAX_VALUE_SIZE: u32 = 1024 * 1024; // 1MB
/// Bytes serialization upper limit.
pub const BOUND_VALUE_SERIALIZATION_BYTES: u32 = MAX_VALUE_SIZE * 2;
/// Hex serialization upper limit.
pub const BOUND_VALUE_SERIALIZATION_HEX: u32 = BOUND_VALUE_SERIALIZATION_BYTES * 2;

/// Maximum length for UFT8 string.
pub const MAX_UTF8_VALUE_SIZE: u32 = MAX_VALUE_SIZE / 4;
/// Maximum string length returned from `to-ascii?`.
/// 5 bytes reserved for embedding in response.
pub const MAX_TO_ASCII_RESULT_LEN: u32 = MAX_VALUE_SIZE - 5;
/// Maximum buffer length returned from `to-ascii?`.
/// 2 bytes reserved for "0x" prefix and 2 characters per byte.
pub const MAX_TO_ASCII_BUFFER_LEN: u32 = (MAX_TO_ASCII_RESULT_LEN - 2) / 2;
/// Maximum allowed nesting depth of types.
pub const MAX_TYPE_DEPTH: u8 = 32;
// this is the charged size for wrapped values, i.e., response or optionals
/// this is the charged size for wrapped values, i.e., response or optionals
pub const WRAPPER_VALUE_SIZE: u32 = 1;

#[derive(Debug, Clone, Eq, Serialize, Deserialize)]
Expand Down Expand Up @@ -342,10 +351,10 @@ impl SequenceData {

pub fn element_size(&self) -> Result<u32> {
let out = match self {
SequenceData::Buffer(..) => TypeSignature::min_buffer()?.size(),
SequenceData::Buffer(..) => TypeSignature::BUFFER_MIN.size(),
SequenceData::List(data) => data.type_signature.get_list_item_type().size(),
SequenceData::String(CharType::ASCII(..)) => TypeSignature::min_string_ascii()?.size(),
SequenceData::String(CharType::UTF8(..)) => TypeSignature::min_string_utf8()?.size(),
SequenceData::String(CharType::ASCII(..)) => TypeSignature::STRING_ASCII_MIN.size(),
SequenceData::String(CharType::UTF8(..)) => TypeSignature::STRING_UTF8_MIN.size(),
}?;
Ok(out)
}
Expand Down Expand Up @@ -455,7 +464,7 @@ impl SequenceData {
}
} else {
Err(CheckErrorKind::TypeValueError(
Box::new(TypeSignature::min_buffer()?),
Box::new(TypeSignature::BUFFER_MIN),
Box::new(to_find),
)
.into())
Expand Down Expand Up @@ -484,7 +493,7 @@ impl SequenceData {
}
} else {
Err(CheckErrorKind::TypeValueError(
Box::new(TypeSignature::min_string_ascii()?),
Box::new(TypeSignature::STRING_ASCII_MIN),
Box::new(to_find),
)
.into())
Expand All @@ -505,7 +514,7 @@ impl SequenceData {
}
} else {
Err(CheckErrorKind::TypeValueError(
Box::new(TypeSignature::min_string_utf8()?),
Box::new(TypeSignature::STRING_UTF8_MIN),
Box::new(to_find),
)
.into())
Expand Down
Loading
Loading