Skip to content
Open
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 .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
**/target/
Cargo.lock
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Replace EVM-flavored test-bridge with a general-purpose test contract that exercises every `#[contract]` macro code path without domain-specific types.
- Make local forge path overrides opt-in for release builds and harden CLI template/path handling across platforms.

### Fixed
Expand Down
26 changes: 10 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[package]
name = "dusk-forge"
version = "0.2.2"
edition = "2021"
edition = "2024"
rust-version = "1.85"
description = "A smart contract development framework for Dusk"
license = "MPL-2.0"
repository = "https://github.com/dusk-network/forge"
Expand All @@ -20,19 +21,19 @@ dusk-core = { workspace = true }

[workspace]
resolver = "2"
members = ["contract-macro", "tests/types", "tests/test-bridge", "cli"]
members = ["contract-macro", "tests/types", "tests/test-contract", "cli"]
exclude = ["contract-template"]

[workspace.package]
edition = "2021"
edition = "2024"
rust-version = "1.85"

[workspace.dependencies]
# Workspace internal dependencies
dusk-forge-contract = { version = "0.1.1", path = "./contract-macro/" }

dusk-core = "1.4"
dusk-core = { version = "1.6", git = "https://github.com/dusk-network/rusk", tag = "dusk-core-1.6.0" }
bytecheck = { version = "0.6.12", default-features = false }
dusk-bytes = "0.1.7"
rkyv = { version = "0.7", default-features = false, features = [
"alloc",
"size_32",
Expand All @@ -45,27 +46,20 @@ serde_json = { version = "1", default-features = false }
proc-macro2 = "1"
quote = "1"
syn = { version = "2", features = ["full", "visit"] }
# Keep this on a pre-edition-2024 release until the workspace toolchain moves
# forward; newer releases require a newer Cargo parser than this branch uses.
assert_cmd = "=2.1.1"
assert_cmd = "2"
cargo_metadata = "0.19"
clap = { version = "4", features = ["derive"] }
clap_complete = "4"
colored = "3"
predicates = "3"
tempfile = "=3.10.1"
tempfile = "3"
thiserror = "2"
toml = "0.8"
wasmtime = "25"
blake3 = "1"

# Pin to match L1Contracts versions
dusk-vm = { version = "=1.4.0", default-features = false }
# Pin to avoid edition2024 issues
blake2b_simd = "=1.0.2"
blake3 = "=1.5.4"
constant_time_eq = "=0.3.1"
time-core = "=0.1.6"
uuid = "=1.20.0"
dusk-vm = { version = "1.6", git = "https://github.com/dusk-network/rusk", tag = "dusk-core-1.6.0", default-features = false }

# Enable overflow checks in release builds for contract safety
[profile.release]
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ test-unit: ## Run unit tests
@cargo test -p dusk-forge-contract
@cargo test --release

test-integration: ## Run integration tests (test-bridge)
@$(MAKE) -C tests/test-bridge test
test-integration: ## Run integration tests (test-contract)
@$(MAKE) -C tests/test-contract test

fmt: ## Format all Rust source files
@cargo fmt --all

clippy: ## Run clippy on all workspace members
@echo "Running clippy..."
@cargo clippy --all-targets -- -D warnings
@$(MAKE) -C tests/test-bridge clippy
@$(MAKE) -C tests/test-contract clippy

clean: ## Clean all build artifacts
@cargo clean
@$(MAKE) -C tests/test-bridge clean
@$(MAKE) -C tests/test-contract clean

help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ dusk-forge/
├── src/lib.rs # Re-exports the contract macro
├── contract-macro/ # Proc-macro implementation
├── contract-template/ # Template for new contracts
├── tests/test-bridge/ # Integration tests
├── tests/test-contract/ # Integration tests
└── docs/
└── design.md # Detailed macro internals
```
Expand Down
3 changes: 2 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[package]
name = "dusk-forge-cli"
version = "0.1.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true
description = "CLI for scaffolding and building Dusk Forge contracts"
license = "MPL-2.0"
repository = "https://github.com/dusk-network/forge"
Expand Down
4 changes: 0 additions & 4 deletions cli/src/build_runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ pub fn build(project: &ProjectMetadata, target: BuildTarget, verbose: bool) -> R
.arg(&project.manifest_path)
.arg("--color=always");

if target == BuildTarget::Contract {
cmd.arg("-Z").arg("build-std=core,alloc");
}

let target_dir = match target {
BuildTarget::Contract => &project.contract_target_dir,
BuildTarget::DataDriver => &project.data_driver_target_dir,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/template/engine.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::error::{CliError, Result};

use super::embedded::{files, TemplateKind};
use super::embedded::{TemplateKind, files};

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ContractName {
Expand Down
26 changes: 16 additions & 10 deletions cli/tests/core_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{

use assert_cmd::cargo::cargo_bin_cmd;
use predicates::prelude::*;
use tempfile::{tempdir, TempDir};
use tempfile::{TempDir, tempdir};

fn repo_root() -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR"))
Expand Down Expand Up @@ -283,12 +283,16 @@ fn build_creates_contract_and_data_driver_artifacts() {
.stderr(predicate::str::contains("contract wasm:"))
.stderr(predicate::str::contains("data-driver wasm:"));

assert!(project
.join("target/contract/wasm32-unknown-unknown/release/smoke_contract.wasm")
.exists());
assert!(project
.join("target/data-driver/wasm32-unknown-unknown/release/smoke_contract.wasm")
.exists());
assert!(
project
.join("target/contract/wasm32-unknown-unknown/release/smoke_contract.wasm")
.exists()
);
assert!(
project
.join("target/data-driver/wasm32-unknown-unknown/release/smoke_contract.wasm")
.exists()
);

let log = tools.log();
assert!(log.contains("subcmd=build toolchain=+nightly-2024-07-30 feature=contract"));
Expand All @@ -315,9 +319,11 @@ fn test_builds_contract_and_runs_cargo_test() {
.success()
.stderr(predicate::str::contains("Tests completed"));

assert!(project
.join("target/contract/wasm32-unknown-unknown/release/smoke_contract.wasm")
.exists());
assert!(
project
.join("target/contract/wasm32-unknown-unknown/release/smoke_contract.wasm")
.exists()
);

let log = tools.log();
assert!(log.contains("subcmd=build toolchain=+nightly-2024-07-30 feature=contract"));
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/dx_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{fs, path::PathBuf};

use assert_cmd::cargo::cargo_bin_cmd;
use predicates::prelude::*;
use tempfile::{tempdir, TempDir};
use tempfile::{TempDir, tempdir};

fn scaffold_project(name: &str) -> (TempDir, PathBuf) {
let tmp = tempdir().expect("tempdir");
Expand Down
Loading
Loading