Skip to content

Commit aac6741

Browse files
committed
Merge branch 'develop' into chore/update-openapi-spec
2 parents 02513ed + 32461ef commit aac6741

File tree

14 files changed

+185
-126
lines changed

14 files changed

+185
-126
lines changed

.github/workflows/nix-check.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Check Nix
2+
3+
on:
4+
merge_group:
5+
types:
6+
- checks_requested
7+
push:
8+
branches:
9+
- master
10+
- develop
11+
- next
12+
paths-ignore:
13+
- "**.md"
14+
- "**.yml"
15+
workflow_dispatch:
16+
pull_request:
17+
types:
18+
- opened
19+
- reopened
20+
- synchronize
21+
22+
concurrency:
23+
group: nix-${{ github.head_ref || github.ref || github.run_id }}
24+
## Always cancel duplicate jobs
25+
cancel-in-progress: true
26+
27+
run-name: ${{ github.ref_name }}
28+
29+
permissions: {}
30+
31+
jobs:
32+
build-pkg:
33+
name: Check Nix package
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37+
- uses: DeterminateSystems/determinate-nix-action@d4b23d0b9eeeaeba3648c24d43bcb623dcf75336 # v3.7.0
38+
- uses: DeterminateSystems/magic-nix-cache-action@e1c1dae8e170ed20fd2e6aaf9979ca2d3905d636 # v12
39+
with:
40+
use-flakehub: false # Remove error when trying to authenticate without credentials
41+
- run: nix flake check ./contrib/nix

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
77

88
## Unreleased
99

10-
- The HTTP `Date` header in responses now strictly follows RFC7231.
10+
### Added
11+
12+
- Added `/v3/contracts/fast-call-read/:principal/:contract_name/:func_name` api endpoint. It allows to run read-only calls faster by disabling the cost and memory trackers. This endpoint requires authentication.
1113

1214
### Changed
1315

16+
- The HTTP `Date` header in responses now strictly follows RFC7231.
1417
- When a previous block commit is unable to be RBFed, the miner will now just wait for it to be confirmed instead of submitting a new block commit which breaks the miner's UTXO chain.
1518

1619
### Fixed

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clarity/Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ name = "clarity"
1818
path = "./src/libclarity.rs"
1919

2020
[dependencies]
21-
rand = { workspace = true }
22-
rand_chacha = { workspace = true }
2321
serde = "1"
2422
serde_derive = "1"
2523
serde_stacker = "0.1"
@@ -28,8 +26,8 @@ lazy_static = "1.4.0"
2826
integer-sqrt = "0.1.3"
2927
slog = { version = "2.5.2", features = [ "max_level_trace" ] }
3028
stacks_common = { package = "stacks-common", path = "../stacks-common", default-features = false }
31-
rstest = "0.17.0"
32-
rstest_reuse = "0.5.0"
29+
rstest = { version = "0.17.0", optional = true }
30+
rstest_reuse = { version = "0.5.0", optional = true }
3331
hashbrown = { workspace = true }
3432
rusqlite = { workspace = true, optional = true }
3533

@@ -40,6 +38,8 @@ features = ["arbitrary_precision", "unbounded_depth"]
4038
[dev-dependencies]
4139
assert-json-diff = "1.0.0"
4240
mutants = "0.0.3"
41+
rstest = { version = "0.17.0" }
42+
rstest_reuse = { version = "0.5.0" }
4343
# a nightly rustc regression (35dbef235 2021-03-02) prevents criterion from compiling
4444
# but it isn't necessary for tests: only benchmarks. therefore, commenting out for now.
4545
# criterion = "0.3"
@@ -49,7 +49,8 @@ default = ["rusqlite"]
4949
developer-mode = ["stacks_common/developer-mode"]
5050
slog_json = ["stacks_common/slog_json"]
5151
rusqlite = ["stacks_common/rusqlite", "dep:rusqlite"]
52-
testing = []
52+
testing = ["rstest", "rstest_reuse"]
5353
devtools = []
5454
rollback_value_check = []
5555
disable-costs = []
56+
wasm-web = ["stacks_common/wasm-web"]

clarity/src/vm/analysis/type_checker/v2_05/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ pub fn no_type() -> TypeSignature {
335335
}
336336

337337
impl<'a, 'b> TypeChecker<'a, 'b> {
338-
fn new(
338+
pub fn new(
339339
db: &'a mut AnalysisDatabase<'b>,
340340
cost_track: LimitedCostTracker,
341341
build_type_map: bool,

clarity/src/vm/costs/mod.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,25 @@ pub enum CostErrors {
417417
ExecutionTimeExpired,
418418
}
419419

420+
impl fmt::Display for CostErrors {
421+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
422+
match self {
423+
CostErrors::CostComputationFailed(ref s) => write!(f, "Cost computation failed: {s}"),
424+
CostErrors::CostOverflow => write!(f, "Cost overflow"),
425+
CostErrors::CostBalanceExceeded(ref total, ref limit) => {
426+
write!(f, "Cost balance exceeded: total {total}, limit {limit}")
427+
}
428+
CostErrors::MemoryBalanceExceeded(ref used, ref limit) => {
429+
write!(f, "Memory balance exceeded: used {used}, limit {limit}")
430+
}
431+
CostErrors::CostContractLoadFailure => write!(f, "Failed to load cost contract"),
432+
CostErrors::InterpreterFailure => write!(f, "Interpreter failure"),
433+
CostErrors::Expect(ref s) => write!(f, "Expectation failed: {s}"),
434+
CostErrors::ExecutionTimeExpired => write!(f, "Execution time expired"),
435+
}
436+
}
437+
}
438+
420439
impl CostErrors {
421440
fn rejectable(&self) -> bool {
422441
matches!(self, CostErrors::InterpreterFailure | CostErrors::Expect(_))

clarity/src/vm/docs/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2627,7 +2627,7 @@ pub fn make_api_reference(function: &NativeFunctions) -> FunctionAPI {
26272627
}
26282628
}
26292629

2630-
fn make_keyword_reference(variable: &NativeVariables) -> Option<KeywordAPI> {
2630+
pub fn make_keyword_reference(variable: &NativeVariables) -> Option<KeywordAPI> {
26312631
let keyword = match variable {
26322632
NativeVariables::TxSender => TX_SENDER_KEYWORD.clone(),
26332633
NativeVariables::ContractCaller => CONTRACT_CALLER_KEYWORD.clone(),

clarity/src/vm/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ pub mod clarity;
5656
use std::collections::BTreeMap;
5757

5858
use costs::CostErrors;
59-
use serde_json;
6059
use stacks_common::types::StacksEpochId;
6160

6261
use self::analysis::ContractAnalysis;
@@ -77,6 +76,7 @@ pub use crate::vm::database::clarity_db::StacksEpoch;
7776
use crate::vm::errors::{
7877
CheckErrors, Error, InterpreterError, InterpreterResult as Result, RuntimeErrorType,
7978
};
79+
use crate::vm::events::StacksTransactionEvent;
8080
use crate::vm::functions::define::DefineResult;
8181
pub use crate::vm::functions::stx_transfer_consolidated;
8282
pub use crate::vm::representations::{
@@ -118,12 +118,12 @@ pub enum EvaluationResult {
118118
#[derive(Debug, Clone)]
119119
pub struct ExecutionResult {
120120
pub result: EvaluationResult,
121-
pub events: Vec<serde_json::Value>,
121+
pub events: Vec<StacksTransactionEvent>,
122122
pub cost: Option<CostSynthesis>,
123123
pub diagnostics: Vec<Diagnostic>,
124124
}
125125

126-
#[derive(Clone, Debug)]
126+
#[derive(Clone, Debug, Serialize)]
127127
pub struct CostSynthesis {
128128
pub total: ExecutionCost,
129129
pub limit: ExecutionCost,

clarity/src/vm/representations.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -453,13 +453,17 @@ pub struct SymbolicExpression {
453453
pub id: u64,
454454

455455
#[cfg(feature = "developer-mode")]
456+
#[serde(default)]
456457
pub span: Span,
457458

458459
#[cfg(feature = "developer-mode")]
460+
#[serde(default, skip_serializing_if = "Vec::is_empty")]
459461
pub pre_comments: Vec<(String, Span)>,
460462
#[cfg(feature = "developer-mode")]
463+
#[serde(default, skip_serializing_if = "Option::is_none")]
461464
pub end_line_comment: Option<String>,
462465
#[cfg(feature = "developer-mode")]
466+
#[serde(default, skip_serializing_if = "Vec::is_empty")]
463467
pub post_comments: Vec<(String, Span)>,
464468
}
465469

@@ -649,7 +653,7 @@ impl fmt::Display for SymbolicExpression {
649653
}
650654
}
651655

652-
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
656+
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
653657
pub struct Span {
654658
pub start_line: u32,
655659
pub start_column: u32,
@@ -665,12 +669,7 @@ impl Span {
665669
end_column: 0,
666670
};
667671

668-
pub fn zero() -> Span {
669-
Span {
670-
start_line: 0,
671-
start_column: 0,
672-
end_line: 0,
673-
end_column: 0,
674-
}
672+
pub fn zero() -> Self {
673+
Self::default()
675674
}
676675
}

contrib/nix/flake.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)