Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.31
0.1.32
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "skribe"
version = "0.1.31"
version = "0.1.32"
description = "Property testing for Stylus smart contracts"
readme = "README.md"
requires-python = "~=3.10"
Expand Down
2 changes: 2 additions & 0 deletions skribe-fuzz-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ version = "0.1.0"
edition = "2024"

[dependencies]
serde = "1.0.228"
serde_json = "1.0.149"
kframework = { git = "https://github.com/runtimeverification/kframework-rs.git", rev = "1e7ee3a" }
kframework_ffi = { git = "https://github.com/runtimeverification/kframework-rs.git", rev = "1e7ee3a" }
52 changes: 52 additions & 0 deletions skribe-fuzz-rs/src/fuzz_spec.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
use serde::Deserialize;

#[derive(Debug, Deserialize)]
pub struct Signature {
pub contract_name: String,
pub name: String,
pub arg_types: Vec<String>,
}

#[derive(Debug, Deserialize)]
pub struct FuzzSpec {
pub template: String,
pub signatures: Vec<Signature>,
}

pub fn fuzz_specs_from_json(json: &str) -> Result<Vec<FuzzSpec>, serde_json::Error> {
serde_json::from_str(json)
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_fuzz_specs_from_json() {
let json = r#"[
{
"template": "X:SortGeneratedTopCell{}",
"signatures": [
{
"contract_name": "TestSkribeEndToEnd",
"name": "test_end_to_end_intense",
"arg_types": ["bytes8", "bytes8", "bool", "(uint256,bool)[]"]
}
]
}
]"#;

let specs = fuzz_specs_from_json(json).unwrap();
assert_eq!(specs.len(), 1);
assert_eq!(specs[0].template, "X:SortGeneratedTopCell{}");
assert_eq!(specs[0].signatures.len(), 1);

let sig = &specs[0].signatures[0];
assert_eq!(sig.contract_name, "TestSkribeEndToEnd");
assert_eq!(sig.name, "test_end_to_end_intense");
assert_eq!(
sig.arg_types,
["bytes8", "bytes8", "bool", "(uint256,bool)[]"]
);
}
}
3 changes: 3 additions & 0 deletions skribe-fuzz-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ pub use kframework_ffi::kllvm;
use kframework::kore::{Id, Pattern, Sort};
use kframework_ffi::kllvm::{Marshaller, VarHandler};

mod fuzz_spec;
pub use fuzz_spec::{FuzzSpec, Signature, fuzz_specs_from_json};

struct DummyHandler;

impl VarHandler for DummyHandler {
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading