Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update lib.rs #4945

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
384e381
4746 - avoid extra ci runs
wileyj May 8, 2024
2a729d3
remove paths-ignore
wileyj May 8, 2024
b7f7295
Merge pull request #4766 from stacks-network/fix/reduce_ci_runs-master
wileyj May 9, 2024
e756c6e
Adding 2.5.0.0.4 to the changelog
wileyj May 20, 2024
0924437
Update build command
wileyj May 20, 2024
5c718ff
Update changelog with what's changing in this version
wileyj May 21, 2024
a88ee2b
Merge pull request #4806 from stacks-network/chore/2.5.0.0.4-changelog
wileyj May 23, 2024
631138f
fix: the number of stacker signer slots is 13 for Nakamoto
jcnelson Jun 3, 2024
c13e521
fix: disable relevant unit tests that assume 14 stacker signer slots
jcnelson Jun 3, 2024
5d9f472
fix: fix stacks-inspect so that the block ranges correspond to height…
jcnelson Jun 3, 2024
246aac0
Merge pull request #4845 from stacks-network/fix/signer-slot-count
wileyj Jun 4, 2024
3906688
Revert "Fix/signer slot count"
wileyj Jun 4, 2024
c848473
Merge pull request #4853 from stacks-network/revert-4845-fix/signer-s…
wileyj Jun 4, 2024
0f8b661
chore: disable stackerdb encrypted state to make dkg and adjacent CI …
jcnelson Jun 4, 2024
0ece14b
Merge branch 'release/2.5.0.0.4' into fix/signer-slot-count
jcnelson Jun 4, 2024
cfffe55
Merge pull request #4868 from stacks-network/fix/signer-slot-count
jcnelson Jun 4, 2024
2d7f8ed
fix: always, always, always filter out stacks blocks on non-canonical…
jcnelson Jun 14, 2024
0d850da
Merge pull request #4893 from stacks-network/fix/miner-ignores-noncan…
kantai Jun 18, 2024
6e64d0d
fix: signer slots count in staging
kantai Jun 18, 2024
e4770f6
test: update tests
kantai Jun 18, 2024
5309358
Merge pull request #4891 from stacks-network/fix/signer-slots-count
kantai Jun 18, 2024
a758941
Add PR's to the changelog for 2.5.0.0.4
wileyj Jun 25, 2024
3ae098e
perf: improvements in clarity analysis
kantai Jun 14, 2024
4669b75
Merge pull request #4908 from stacks-network/perf/clarity-improvements
wileyj Jun 25, 2024
0fbd7ac
Merge branch 'release/2.5.0.0.4' into chore/2.5.0.0.4-changelog
wileyj Jun 25, 2024
b667b65
Address PR comments
wileyj Jun 25, 2024
c47af1b
Merge pull request #4909 from stacks-network/chore/2.5.0.0.4-changelog
wileyj Jun 25, 2024
d073cdb
Merge branch 'master' into chore/merge-master-2.5.0.0.4
wileyj Jun 26, 2024
35d0840
Merge pull request #4917 from stacks-network/chore/merge-master-2.5.0…
wileyj Jun 26, 2024
0f000c9
chore: make connection_options.antientropy_retry configurable
kantai Jun 29, 2024
f938baf
Merge pull request #4932 from stacks-network/chore/configure-antientr…
wileyj Jul 1, 2024
5d2e751
chore: update lib.rs
eltociear Jul 3, 2024
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
25 changes: 23 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,36 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the versioning scheme outlined in the [README.md](README.md).

## Unreleased
## [2.5.0.0.4]

### Added

- Added support for Clarity 3, with new keywords, `tenure-height` and `stacks-block-height`, and removal of `block-height`
- Adds the solo stacking scenarios to the stateful property-based testing strategy for PoX-4 (#4725)
- Add signer-key to synthetic stack-aggregation-increase event (#4728)
- Implement the assumed total commit with carry-over (ATC-C) strategy for denying opportunistic Bitcoin miners from mining Stacks at a discount (#4733)
- Adding support for stacks-block-height and tenure-height in Clarity 3 (#4745)
- Preserve PeerNetwork struct when transitioning to 3.0 (#4767)
- Implement singer monitor server error (#4773)
- Pull current stacks signer out into v1 implementation and create placeholder v0 mod (#4778)
- Create new block signature message type for v0 signer (#4787)
- Isolate the rusqlite dependency in stacks-common and clarity behind a cargo feature (#4791)
- Add next_initiative_delay config option to control how frequently the miner checks if a new burnchain block has been processed (#4795)
- Various performance improvements and cleanup

### Changed

- Downgraded log messages about transactions from warning to info (#4697)
- Fix race condition between the signer binary and the /v2/pox endpoint (#4738)
- Make node config mock_miner item hot-swappable (#4743)
- Mandates that a burnchain block header be resolved by a BurnchainHeaderReader, which will resolve a block height to at most one burnchain header (#4748)
- Optional config option to resolve DNS of bootstrap nodes (#4749)
- Limit inventory syncs with new peers (#4750)
- Update /v2/fees/transfer to report the median transaction fee estimate for a STX-transfer of 180 bytes (#4754)
- Reduce connection spamming in stackerdb (#4759)
- Remove deprecated signer cli commands (#4772)
- Extra pair of signer slots got introduced at the epoch 2.5 boundary (#4845, #4868, #4891)
- Never consider Stacks chain tips that are not on the canonical burn chain #4886 (#4893)


## [2.5.0.0.3]

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apk add --no-cache musl-dev

RUN mkdir /out

RUN cd testnet/stacks-node && cargo build --features monitoring_prom,slog_json --release
RUN cargo build --features monitoring_prom,slog_json --release

RUN cp target/release/stacks-node /out

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ COPY . .

RUN mkdir /out

RUN cd testnet/stacks-node && cargo build --features monitoring_prom,slog_json --release
RUN cargo build --features monitoring_prom,slog_json --release

RUN cp target/release/stacks-node /out

Expand Down
200 changes: 189 additions & 11 deletions clarity/src/vm/analysis/type_checker/v2_1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use crate::vm::costs::{
analysis_typecheck_cost, cost_functions, runtime_cost, ClarityCostFunctionReference,
CostErrors, CostOverflowingMath, CostTracker, ExecutionCost, LimitedCostTracker,
};
use crate::vm::diagnostic::Diagnostic;
use crate::vm::functions::define::DefineFunctionsParsed;
use crate::vm::functions::NativeFunctions;
use crate::vm::representations::SymbolicExpressionType::{
Expand Down Expand Up @@ -151,7 +152,130 @@ impl TypeChecker<'_, '_> {

pub type TypeResult = CheckResult<TypeSignature>;

pub fn compute_typecheck_cost<T: CostTracker>(
track: &mut T,
t1: &TypeSignature,
t2: &TypeSignature,
) -> Result<ExecutionCost, CostErrors> {
let t1_size = t1.type_size().map_err(|_| CostErrors::CostOverflow)?;
let t2_size = t2.type_size().map_err(|_| CostErrors::CostOverflow)?;
track.compute_cost(
ClarityCostFunction::AnalysisTypeCheck,
&[std::cmp::max(t1_size, t2_size).into()],
)
}

pub fn check_argument_len(expected: usize, args_len: usize) -> Result<(), CheckErrors> {
if args_len != expected {
Err(CheckErrors::IncorrectArgumentCount(expected, args_len))
} else {
Ok(())
}
}

impl FunctionType {
pub fn check_args_visitor_2_1<T: CostTracker>(
&self,
accounting: &mut T,
arg_type: &TypeSignature,
arg_index: usize,
accumulated_type: Option<&TypeSignature>,
) -> (
Option<Result<ExecutionCost, CostErrors>>,
CheckResult<Option<TypeSignature>>,
) {
match self {
// variadic stops checking cost at the first error...
FunctionType::Variadic(expected_type, _) => {
let cost = Some(compute_typecheck_cost(accounting, expected_type, arg_type));
let admitted = match expected_type.admits_type(&StacksEpochId::Epoch21, arg_type) {
Ok(admitted) => admitted,
Err(e) => return (cost, Err(e.into())),
};
if !admitted {
return (
cost,
Err(CheckErrors::TypeError(expected_type.clone(), arg_type.clone()).into()),
);
}
(cost, Ok(None))
}
FunctionType::ArithmeticVariadic => {
let cost = Some(compute_typecheck_cost(
accounting,
&TypeSignature::IntType,
arg_type,
));
if arg_index == 0 {
let return_type = match arg_type {
TypeSignature::IntType => Ok(Some(TypeSignature::IntType)),
TypeSignature::UIntType => Ok(Some(TypeSignature::UIntType)),
_ => Err(CheckErrors::UnionTypeError(
vec![TypeSignature::IntType, TypeSignature::UIntType],
arg_type.clone(),
)
.into()),
};
(cost, return_type)
} else {
let return_type = accumulated_type
.ok_or_else(|| CheckErrors::Expects("Failed to set accumulated type for arg indices >= 1 in variadic arithmetic".into()).into());
let check_result = return_type.and_then(|return_type| {
if arg_type != return_type {
Err(
CheckErrors::TypeError(return_type.clone(), arg_type.clone())
.into(),
)
} else {
Ok(None)
}
});
(cost, check_result)
}
}
// For the fixed function types, the visitor will just
// tell the processor that any results greater than the args len
// do not need to be stored, because an error will occur before
// further checking anyways
FunctionType::Fixed(FixedFunction {
args: arg_types, ..
}) => {
if arg_index >= arg_types.len() {
// note: argument count will be wrong?
return (
None,
Err(CheckErrors::IncorrectArgumentCount(arg_types.len(), arg_index).into()),
);
}
return (None, Ok(None));
}
// For the following function types, the visitor will just
// tell the processor that any results greater than len 1 or 2
// do not need to be stored, because an error will occur before
// further checking anyways
FunctionType::ArithmeticUnary | FunctionType::UnionArgs(..) => {
if arg_index >= 1 {
return (
None,
Err(CheckErrors::IncorrectArgumentCount(1, arg_index).into()),
);
}
return (None, Ok(None));
}
FunctionType::ArithmeticBinary
| FunctionType::ArithmeticComparison
| FunctionType::Binary(..) => {
if arg_index >= 2 {
return (
None,
Err(CheckErrors::IncorrectArgumentCount(2, arg_index).into()),
);
}
return (None, Ok(None));
}
}
}

pub fn check_args_2_1<T: CostTracker>(
&self,
accounting: &mut T,
Expand Down Expand Up @@ -1017,17 +1141,23 @@ impl<'a, 'b> TypeChecker<'a, 'b> {
args: &[SymbolicExpression],
context: &TypingContext,
) -> TypeResult {
let mut types_returned = self.type_check_all(args, context)?;

let last_return = types_returned
.pop()
.ok_or(CheckError::new(CheckErrors::CheckerImplementationFailure))?;

for type_return in types_returned.iter() {
if type_return.is_response_type() {
return Err(CheckErrors::UncheckedIntermediaryResponses.into());
let mut last_return = None;
let mut return_failure = Ok(());
for ix in 0..args.len() {
let type_return = self.type_check(&args[ix], context)?;
if ix + 1 < args.len() {
if type_return.is_response_type() {
return_failure = Err(CheckErrors::UncheckedIntermediaryResponses);
}
} else {
last_return = Some(type_return);
}
}

let last_return = last_return
.ok_or_else(|| CheckError::new(CheckErrors::CheckerImplementationFailure))?;
return_failure?;

Ok(last_return)
}

Expand All @@ -1052,8 +1182,56 @@ impl<'a, 'b> TypeChecker<'a, 'b> {
epoch: StacksEpochId,
clarity_version: ClarityVersion,
) -> TypeResult {
let typed_args = self.type_check_all(args, context)?;
func_type.check_args(self, &typed_args, epoch, clarity_version)
if epoch <= StacksEpochId::Epoch2_05 {
let typed_args = self.type_check_all(args, context)?;
return func_type.check_args(self, &typed_args, epoch, clarity_version);
}
// use func_type visitor pattern
let mut accumulated_type = None;
let mut total_costs = vec![];
let mut check_result = Ok(());
let mut accumulated_types = Vec::new();
for (arg_ix, arg_expr) in args.iter().enumerate() {
let arg_type = self.type_check(arg_expr, context)?;
if check_result.is_ok() {
let (costs, result) = func_type.check_args_visitor_2_1(
self,
&arg_type,
arg_ix,
accumulated_type.as_ref(),
);
// add the accumulated type and total cost *before*
// checking for an error: we want the subsequent error handling
// to account for this cost
accumulated_types.push(arg_type);
total_costs.extend(costs);

match result {
Ok(Some(returned_type)) => {
accumulated_type = Some(returned_type);
}
Ok(None) => {}
Err(e) => {
check_result = Err(e);
}
};
}
}
if let Err(mut check_error) = check_result {
if let CheckErrors::IncorrectArgumentCount(expected, _actual) = check_error.err {
check_error.err = CheckErrors::IncorrectArgumentCount(expected, args.len());
check_error.diagnostic = Diagnostic::err(&check_error.err)
}
// accumulate the checking costs
// the reason we do this now (instead of within the loop) is for backwards compatibility
for cost in total_costs.into_iter() {
self.add_cost(cost?)?;
}

return Err(check_error);
}
// otherwise, just invoke the normal checking routine
func_type.check_args(self, &accumulated_types, epoch, clarity_version)
}

fn get_function_type(&self, function_name: &str) -> Option<FunctionType> {
Expand Down
Loading