Skip to content

Commit 158d813

Browse files
committed
release v0.1.11 (granular thresholds and updated documentation)
1 parent 61cb9e8 commit 158d813

File tree

7 files changed

+68
-13
lines changed

7 files changed

+68
-13
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ members = [
66
]
77

88
[workspace.package]
9-
version = "0.1.10"
9+
version = "0.1.11"
1010
edition = "2021"
1111
authors = ["CreativesOnchain"]
1212
license = "MIT"
@@ -17,7 +17,7 @@ keywords = ["arbitrum", "stylus", "profiling", "gas", "flamegraph"]
1717
categories = ["development-tools::profiling", "wasm"]
1818

1919
[workspace.dependencies]
20-
stylus-trace-core = { version = "0.1.10", path = "crates/stylus-trace-core" }
20+
stylus-trace-core = { version = "0.1.11", path = "crates/stylus-trace-core" }
2121
clap = { version = "4.5", features = ["derive", "env"] }
2222
serde = { version = "1.0", features = ["derive"] }
2323
serde_json = "1.0"

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ This feature will be enabled automatically once upstream tracer support is avail
145145
|------|-------------|---------|
146146
| `--tx` | Transaction hash to profile in CI (optional) | - |
147147
| `--rpc` | RPC endpoint URL | `http://localhost:8547` |
148-
| `--threshold` | Percentage threshold for regressions | `1.0` |
148+
| `--threshold` | Global percentage threshold for all metrics | `1.0` |
149+
| `--gas-threshold` | Specific percentage threshold for Gas regressions | - |
150+
| `--hostio-threshold` | Specific percentage threshold for HostIO regressions | - |
149151
| `--force` | Overwrite existing workflow files | `false` |
150152

151153
---
@@ -169,7 +171,8 @@ You can use the [Stylus Trace Action](https://github.com/CreativesOnchain/Stylus
169171
uses: CreativesOnchain/Stylus-Trace@main
170172
with:
171173
tx_hash: "0x..."
172-
threshold: "1.0" # Fail if gas increases by > 1%
174+
gas_threshold: "1.0" # Fail if gas increases by > 1%
175+
threshold: "10.0" # Higher global limit for other metrics
173176
```
174177
175178
---

action.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ inputs:
1515
required: false
1616
default: 'artifacts/capture/baseline.json'
1717
threshold:
18-
description: 'Percentage threshold for allowed increase (e.g. 1.0 for 1%)'
18+
description: 'Global percentage threshold for all metrics (e.g. 1.0 for 1%)'
1919
required: false
2020
default: '1.0'
21+
gas_threshold:
22+
description: 'Specific percentage threshold for Gas regressions'
23+
required: false
24+
hostio_threshold:
25+
description: 'Specific percentage threshold for HostIO regressions'
26+
required: false
2127
ink:
2228
description: 'Use Stylus Ink units instead of Gas'
2329
required: false
@@ -71,8 +77,20 @@ runs:
7177
- name: Compare with Baseline
7278
shell: bash
7379
run: |
80+
GAS_FLAG=""
81+
if [ -n "${{ inputs.gas_threshold }}" ]; then
82+
GAS_FLAG="--gas-threshold ${{ inputs.gas_threshold }}"
83+
fi
84+
85+
HOSTIO_FLAG=""
86+
if [ -n "${{ inputs.hostio_threshold }}" ]; then
87+
HOSTIO_FLAG="--hostio-threshold ${{ inputs.hostio_threshold }}"
88+
fi
89+
7490
stylus-trace diff \
7591
"${{ inputs.baseline }}" \
7692
artifacts/capture/current_profile.json \
7793
--threshold-percent "${{ inputs.threshold }}" \
94+
$GAS_FLAG \
95+
$HOSTIO_FLAG \
7896
--summary

bin/stylus-trace-studio/src/main.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,18 @@ pub enum CiSubcommands {
184184
#[arg(short, long)]
185185
rpc: Option<String>,
186186

187-
/// Percentage threshold for regressions (e.g., 1.0)
187+
/// Global percentage threshold for all metrics (e.g., 1.0)
188188
#[arg(short = 'p', long, default_value = "1.0")]
189189
threshold: f64,
190190

191+
/// Specific gas increase threshold percentage
192+
#[arg(long = "gas-threshold")]
193+
gas_threshold: Option<f64>,
194+
195+
/// Specific HostIO calls increase threshold percentage
196+
#[arg(long = "hostio-threshold")]
197+
hostio_threshold: Option<f64>,
198+
191199
/// Force overwrite existing workflow files
192200
#[arg(long)]
193201
force: bool,
@@ -201,12 +209,16 @@ fn handle_ci(subcommand: CiSubcommands) -> Result<()> {
201209
tx,
202210
rpc,
203211
threshold,
212+
gas_threshold,
213+
hostio_threshold,
204214
force,
205215
} => {
206216
let args = stylus_trace_core::commands::models::CiInitArgs {
207217
transaction_hash: tx,
208218
rpc_url: rpc,
209219
threshold,
220+
gas_threshold,
221+
hostio_threshold,
210222
force,
211223
};
212224
stylus_trace_core::commands::execute_ci_init(args)

crates/stylus-trace-core/src/commands/ci.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,28 @@ pub fn execute_ci_init(args: CiInitArgs) -> Result<()> {
2626
}
2727

2828
// 2. Generate YAML
29-
3029
let tx_hash = args
3130
.transaction_hash
3231
.as_deref()
3332
.unwrap_or("YOUR_TRANSACTION_HASH");
3433

34+
let mut with_block = format!(
35+
r#" tx_hash: "{}"
36+
threshold: "{}"
37+
"#,
38+
tx_hash, args.threshold
39+
);
40+
41+
if let Some(gas) = args.gas_threshold {
42+
with_block.push_str(&format!(" gas_threshold: \"{}\"\n", gas));
43+
}
44+
45+
if let Some(hostio) = args.hostio_threshold {
46+
with_block.push_str(&format!(" hostio_threshold: \"{}\"\n", hostio));
47+
}
48+
49+
with_block.push_str(" skip_capture: \"true\"");
50+
3551
let workflow_yaml = format!(
3652
r#"name: Stylus Performance Check
3753
@@ -59,11 +75,9 @@ jobs:
5975
- name: Run Stylus Performance Check
6076
uses: CreativesOnchain/Stylus-Trace@main
6177
with:
62-
tx_hash: "{}"
63-
threshold: "{}"
64-
skip_capture: "true"
78+
{}
6579
"#,
66-
tx_hash, args.threshold
80+
with_block
6781
);
6882

6983
// 3. Write file

crates/stylus-trace-core/src/commands/models.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ pub struct CiInitArgs {
155155
/// Default percentage threshold for regressions
156156
pub threshold: f64,
157157

158+
/// Specific gas increase threshold percentage (optional)
159+
pub gas_threshold: Option<f64>,
160+
161+
/// Specific HostIO calls increase threshold percentage (optional)
162+
pub hostio_threshold: Option<f64>,
163+
158164
/// Force overwrite existing files
159165
pub force: bool,
160166
}
@@ -165,6 +171,8 @@ impl Default for CiInitArgs {
165171
transaction_hash: None,
166172
rpc_url: Some("http://localhost:8547".to_string()),
167173
threshold: 1.0,
174+
gas_threshold: None,
175+
hostio_threshold: None,
168176
force: false,
169177
}
170178
}

0 commit comments

Comments
 (0)