Skip to content
Merged

Dev #32

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
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,38 @@ jobs:
with:
command: check bans licenses sources

clippy:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
submodules: true

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v2

- name: Run clippy checks
run: cargo clippy --workspace --all-targets --all-features
env:
RUSTFLAGS: -Dwarnings

ci-success:
runs-on: ubuntu-latest
if: always()
needs:
- rust-tests
- rustfmt
- crate-checks
- clippy
- deny
timeout-minutes: 30
steps:
Expand Down
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [unreleased]
## [0.0.2]

- Simplex MVP is in progress.
- Implemented `simplex init` and `simplex clean` commands.
- Added "initial signer bitcoins" to the Simplex configuration.
- Added `fetch_tip_height` and `fetch_tip_timestamp` methods to the providers.
- Added clippy check to CI.
- Fixed regtest not accepting transactions with multiple OP_RETURNs.
- Added `send` method to the signer to be able to quickly send a policy asset.
- Extended `get_wpkh_utxos` method to be able to filter signer's UTXOs on the fly.

## [0.0.1]

- Initial Simplex release!
35 changes: 26 additions & 9 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ edition = "2024"
multiple_crate_versions = "allow"

[workspace.dependencies]
smplx-macros = { path = "./crates/macros", version = "0.0.1" }
smplx-build = { path = "./crates/build", version = "0.0.1" }
smplx-test = { path = "./crates/test", version = "0.0.1" }
smplx-regtest = { path = "./crates/regtest", version = "0.0.1" }
smplx-sdk = { path = "./crates/sdk", version = "0.0.1" }
smplx-std = { path = "./crates/simplex", version = "0.0.1" }
smplx-macros = { path = "./crates/macros", version = "0.0.2" }
smplx-build = { path = "./crates/build", version = "0.0.2" }
smplx-test = { path = "./crates/test", version = "0.0.2" }
smplx-regtest = { path = "./crates/regtest", version = "0.0.2" }
smplx-sdk = { path = "./crates/sdk", version = "0.0.2" }
smplx-std = { path = "./crates/simplex", version = "0.0.2" }

serde = { version = "1.0.228", features = ["derive"]}
hex = { version = "0.4.3" }
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ out_dir = "./src/artifacts"

[regtest]
mnemonic = "exist carry drive collect lend cereal occur much tiger just involve mean"
bitcoins = 10_000_000

[test]
mnemonic = "exist carry drive collect lend cereal occur much tiger just involve mean"
bitcoins = 10_000_000

[test.esplora]
url = "<esplora url>"
Expand All @@ -79,6 +81,7 @@ Where:
- `out_dir` - The output directory where contracts artifacts are generated.
- `regtest` (`simplex regtest` config)
- `mnemonic` - The signer's mnemonic regtest will send initial funds to.
- `bitcoins` - Initial coins available to the signer
- `test` (`simplex test` config)
- `esplora`
- `url` - Esplora API endpoint url
Expand All @@ -88,16 +91,18 @@ Where:
- `username` - Elements RPC username
- `password` - Elements RPC password
- `mnemonic` - The signer's mnemonic internal regtest will send initial funds to.
- `bitcoins` - Initial coins available to the signer

### CLI

Simplex CLI provides the following commands:

- `simplex init` - Initializes a Simplex project.
- `simplex init` - Initializes a new Simplex project.
- `simplex config` - Prints the current config.
- `simplex build` - Generates simplicity artifacts.
- `simplex regtest` - Spins up local Electrs + Elements nodes.
- `simplex test` - Runs Simplex tests.
- `simplex clean` - Cleans up generated artifacts.

To view the available options, run the help command:

Expand All @@ -115,7 +120,7 @@ We are open to any mind-blowing ideas! Please take a look at our [contributing g

## Future work

- [ ] Complete `simplex init` and `simplex clean` tasks.
- [x] Complete `simplex init` and `simplex clean` tasks.
- [ ] SDK support for confidential assets, taproot signer, and custom witness signatures.
- [ ] Local regtest 10x speedup.
- [ ] Regtest cheat codes.
Expand Down
2 changes: 1 addition & 1 deletion crates/build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "smplx-build"
version = "0.0.1"
version = "0.0.2"
description = "Simplex build command internal implementation"
license.workspace = true
edition.workspace = true
Expand Down
12 changes: 6 additions & 6 deletions crates/build/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ impl ArtifactsGenerator {
fn generate_bindings(out_dir: &Path, path_tree: TreeNode) -> Result<Vec<String>, BuildError> {
fs::create_dir_all(out_dir)?;

let mut mod_filenames = Self::generate_simfs(&out_dir, &path_tree.files)?;
let mut mod_filenames = Self::generate_simfs(out_dir, &path_tree.files)?;

for (dir_name, tree_node) in path_tree.dirs.into_iter() {
Self::generate_bindings(&out_dir.join(&dir_name), tree_node)?;
mod_filenames.push(dir_name);
}

Self::generate_mod_rs(&out_dir, &mod_filenames)?;
Self::generate_mod_rs(out_dir, &mod_filenames)?;

Ok(mod_filenames)
}
Expand Down Expand Up @@ -156,10 +156,8 @@ impl ArtifactsGenerator {
let include_simf_source_const = convert_contract_name_to_contract_source_const(contract_name);
let include_simf_module = convert_contract_name_to_contract_module(contract_name);

let pathdiff = pathdiff::diff_paths(&simf_file, &cwd).ok_or(BuildError::FailedToFindCorrectRelativePath {
cwd: cwd,
simf_file: simf_file,
})?;
let pathdiff = pathdiff::diff_paths(&simf_file, &cwd)
.ok_or(BuildError::FailedToFindCorrectRelativePath { cwd, simf_file })?;
let pathdiff = pathdiff.to_string_lossy().into_owned();

let code = quote! {
Expand Down Expand Up @@ -199,6 +197,8 @@ impl ArtifactsGenerator {
let mod_names = mod_names.iter().map(|x| format_ident!("{x}")).collect::<Vec<_>>();

let code = quote! {
#![allow(clippy::all)]

#(pub mod #mod_names);*;
};

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions crates/build/src/macros/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod codegen;
pub mod macros;
pub mod core;
pub mod parse;
pub mod program;
pub mod types;

pub use macros::expand;
pub use core::expand;
7 changes: 3 additions & 4 deletions crates/build/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ use super::error::BuildError;
pub struct ArtifactsResolver {}

impl ArtifactsResolver {
pub fn resolve_files_to_build(src_dir: &String, simfs: &Vec<String>) -> Result<Vec<PathBuf>, BuildError> {
pub fn resolve_files_to_build(src_dir: &String, simfs: &[String]) -> Result<Vec<PathBuf>, BuildError> {
let cwd = env::current_dir()?;
let base = cwd.join(src_dir);

let mut paths = Vec::new();

let walker = globwalk::GlobWalkerBuilder::from_patterns(base, &simfs)
let walker = globwalk::GlobWalkerBuilder::from_patterns(base, simfs)
.follow_links(true)
.file_type(FileType::FILE)
.build()?
.into_iter()
.filter_map(Result::ok);

for img in walker {
Expand All @@ -34,7 +33,7 @@ impl ArtifactsResolver {
if !path_outer.is_absolute() {
let manifest_dir = env::current_dir()?;

let mut path_local = PathBuf::from(manifest_dir);
let mut path_local = manifest_dir;
path_local.push(path_outer);

path_outer = path_local;
Expand Down
13 changes: 8 additions & 5 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[package]
name = "smplx-cli"
version = "0.0.1"
version = "0.0.2"
description = "Simplex cli with various utilities to manage a simplicity project"
license.workspace = true
edition.workspace = true
repository = "https://github.com/BlockstreamResearch/smplx"
readme = "../../README.md"

[[bin]]
name = "simplex"
Expand All @@ -15,17 +17,18 @@ workspace = true
[dependencies]
smplx-regtest = { workspace = true }
smplx-test = { workspace = true }
smplx-build = { workspace = true}
smplx-build = { workspace = true }
smplx-sdk = { workspace = true }

simplicityhl = { workspace = true }
electrsd = { workspace = true }
thiserror = { workspace = true }
serde = { workspace = true }
toml = { workspace = true }
minreq = { workspace = true }

anyhow = "1"
dotenvy = "0.15"
clap = { version = "4", features = ["derive", "env"] }
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
ctrlc = { version = "3.5.2", features = ["termination"] }
toml_edit = { version = "0.23.9" }
ctrlc = { version = "3.5.2", features = ["termination"] }
serde_json = { version = "1.0.149" }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TEST CONFIG
# DEFAULT CONFIG

# [build]
# src_dir = "./simf"
Expand All @@ -7,9 +7,11 @@

# [regtest]
# mnemonic = "exist carry drive collect lend cereal occur much tiger just involve mean"
# bitcoins = 10_000_000

# [test]
# mnemonic = "exist carry drive collect lend cereal occur much tiger just involve mean"
# bitcoins = 10_000_000

# [test.esplora]
# url = "<esplora url>"
Expand Down
Loading