Skip to content

Commit 9e44e76

Browse files
committed
standards: add workspace and CI split
1 parent 250b0f4 commit 9e44e76

11 files changed

Lines changed: 3623 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,45 @@ on:
55
- main
66

77
jobs:
8+
changes:
9+
name: Detect changed contract areas
10+
runs-on: core
11+
outputs:
12+
legacy: ${{ steps.filter.outputs.legacy }}
13+
standards: ${{ steps.filter.outputs.standards }}
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
- id: filter
19+
uses: dorny/paths-filter@v3
20+
with:
21+
filters: |
22+
legacy:
23+
- 'genesis/**'
24+
- 'tests/**'
25+
- 'bin/**'
26+
- 'scripts/setup-compiler.sh'
27+
- 'scripts/download-rusk.sh'
28+
- 'scripts/build-test-contracts.sh'
29+
- 'Cargo.toml'
30+
- 'Cargo.lock'
31+
- 'Makefile'
32+
- 'README.md'
33+
- 'rust-toolchain.toml'
34+
- '.github/workflows/ci.yml'
35+
standards:
36+
- 'standards/**'
37+
- 'docs/dusk-contract-standards*'
38+
- 'scripts/dusk-contract-standards-*'
39+
- 'Cargo.toml'
40+
- 'Cargo.lock'
41+
- 'Makefile'
42+
- 'README.md'
43+
- 'rust-toolchain.toml'
44+
- '.github/workflows/ci.yml'
45+
- '.github/workflows/standards-hardening.yml'
46+
847
dusk_analyzer:
948
name: Dusk Analyzer
1049
runs-on: core
@@ -13,9 +52,13 @@ jobs:
1352
- uses: dsherret/rust-toolchain-file@v1
1453
- run: cargo install --git https://github.com/dusk-network/cargo-dusk-analyzer
1554
- run: cargo dusk-analyzer
55+
- run: rustup toolchain install nightly-2026-02-27 --profile minimal --component rust-src --component rustfmt --component clippy --target wasm32-unknown-unknown
56+
- run: cd standards && cargo dusk-analyzer
1657

1758
clippy:
1859
name: Clippy check
60+
needs: changes
61+
if: needs.changes.outputs.legacy == 'true'
1962
runs-on: core
2063
steps:
2164
- uses: actions/checkout@v4
@@ -25,9 +68,22 @@ jobs:
2568

2669
test:
2770
name: Run Tests
71+
needs: changes
72+
if: needs.changes.outputs.legacy == 'true'
2873
runs-on: core
2974
steps:
3075
- uses: actions/checkout@v4
3176
- uses: dsherret/rust-toolchain-file@v1
3277
- run: make keys
3378
- run: make test
79+
80+
standards:
81+
name: Standards CI
82+
needs: changes
83+
if: needs.changes.outputs.standards == 'true'
84+
runs-on: core
85+
steps:
86+
- uses: actions/checkout@v4
87+
- uses: dsherret/rust-toolchain-file@v1
88+
- run: rustup toolchain install nightly-2026-02-27 --profile minimal --component rust-src --component rustfmt --component clippy --target wasm32-unknown-unknown
89+
- run: make standards-ci

Cargo.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ members = [
1414
resolver = "2"
1515

1616
[workspace.dependencies]
17-
# Dusk dependencies
18-
dusk-core = "1.4.0"
17+
# Dusk dependencies used by the legacy genesis/test contracts. The standards
18+
# crates pin their Aegis/Forge dependencies in their own manifests so they do
19+
# not force genesis contracts onto a compiler-incompatible dependency graph.
20+
dusk-core = "=1.4.0"
1921
dusk-bytes = "0.1.7"
20-
dusk-vm = "1.4.3"
21-
dusk-wallet-core = "1.4.0"
22-
rusk-profile = "1.4.0"
23-
rusk-prover = "1.3.0"
22+
dusk-vm = "=1.4.3"
23+
dusk-wallet-core = "=1.4.0"
24+
rusk-profile = "=1.4.0"
25+
rusk-prover = "=1.3.0"
2426

2527
# Other dependencies
2628
bytecheck = { version = "0.6.12", default-features = false }

Makefile

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,60 @@
1-
SUBDIRS := tests/alice tests/bob tests/charlie genesis/transfer genesis/stake tests/host_fn
1+
STANDARDS_EXAMPLES :=
2+
STANDARDS_WASM_CONTRACTS :=
3+
LEGACY_SUBDIRS := tests/alice tests/bob tests/charlie genesis/transfer genesis/stake tests/host_fn
4+
STANDARDS_PROPTEST_CASES ?= 8192
5+
STANDARDS_PROPTEST_MAX_SHRINK_ITERS ?= 16384
6+
STANDARDS_DATA_DRIVER_FUZZ_CASES ?= 2048
7+
STANDARDS_DATA_DRIVER_FUZZ_SHRINK_ITERS ?= 4096
28

3-
all: setup-compiler $(SUBDIRS) ## Build all the contracts
9+
all: setup-compiler $(LEGACY_SUBDIRS) ## Build the legacy genesis/test contracts
410

511
help: ## Display this help screen
612
@grep -h \
713
-E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
814
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
915

1016
test: wasm ## Run all the tests in the subfolder
11-
$(MAKE) $(SUBDIRS) MAKECMDGOALS=test
17+
$(MAKE) $(LEGACY_SUBDIRS) MAKECMDGOALS=test
1218

1319
wasm: setup-compiler ## Generate the WASM for all the contracts
14-
$(MAKE) $(SUBDIRS) MAKECMDGOALS=wasm
20+
$(MAKE) $(LEGACY_SUBDIRS) MAKECMDGOALS=wasm
21+
22+
standards-fmt: ## Check Dusk standards formatting without the Dusk compiler bundle
23+
cd standards && cargo fmt --all --check
24+
25+
standards-check: ## Check the Dusk standards crate without the Dusk compiler bundle
26+
$(MAKE) -C standards/dusk-contract-standards check
27+
28+
standards-test: ## Test the Dusk standards crate without the Dusk compiler bundle
29+
$(MAKE) -C standards/dusk-contract-standards test
30+
31+
standards-wasm: ## Build standards reference contracts without the Dusk compiler bundle
32+
@true
33+
34+
standards-clippy: ## Run standards clippy without the Dusk compiler bundle
35+
$(MAKE) -C standards/dusk-contract-standards clippy
36+
37+
standards-ci: standards-fmt standards-check standards-clippy standards-test standards-wasm ## Run regular standards CI checks
38+
39+
standards-data-drivers: ## Generate Forge data-driver WASM for standards reference contracts
40+
@if [ -n "$(STANDARDS_EXAMPLES)" ]; then \
41+
$(MAKE) $(STANDARDS_EXAMPLES) MAKECMDGOALS=wasm-dd; \
42+
fi
43+
44+
standards-properties: ## Run the longer standards property hardening suite
45+
STANDARDS_PROPTEST_CASES=$(STANDARDS_PROPTEST_CASES) \
46+
STANDARDS_PROPTEST_MAX_SHRINK_ITERS=$(STANDARDS_PROPTEST_MAX_SHRINK_ITERS) \
47+
cd standards && cargo test -p dusk-contract-standards --test properties
48+
49+
standards-data-driver-fuzz: standards-data-drivers ## Fuzz Forge data-driver JSON/rkyv input codecs
50+
STANDARDS_DATA_DRIVER_FUZZ_CASES=$(STANDARDS_DATA_DRIVER_FUZZ_CASES) \
51+
STANDARDS_DATA_DRIVER_FUZZ_SHRINK_ITERS=$(STANDARDS_DATA_DRIVER_FUZZ_SHRINK_ITERS) \
52+
cd standards && cargo test -p dusk-contract-standards --test data_driver_fuzz -- --ignored
53+
54+
standards-hardening: standards-properties standards-data-driver-fuzz ## Run long standards hardening checks
1555

1656
clippy: setup-compiler ## Run clippy
17-
$(MAKE) $(SUBDIRS) MAKECMDGOALS=clippy
57+
$(MAKE) $(LEGACY_SUBDIRS) MAKECMDGOALS=clippy
1858

1959
keys: ## Create the keys for the circuits
2060
./scripts/download-rusk.sh
@@ -24,9 +64,9 @@ COMPILER_VERSION=v0.3.0-rc.1
2464
setup-compiler: ## Setup the Dusk Contract Compiler
2565
@./scripts/setup-compiler.sh $(COMPILER_VERSION)
2666

27-
doc: $(SUBDIRS) ## Run doc gen
67+
doc: $(LEGACY_SUBDIRS) ## Run doc gen
2868

29-
$(SUBDIRS):
69+
$(LEGACY_SUBDIRS) $(STANDARDS_WASM_CONTRACTS):
3070
$(MAKE) -C $@ $(MAKECMDGOALS)
3171

32-
.PHONY: all test help $(SUBDIRS)
72+
.PHONY: all test help standards-fmt standards-check standards-test standards-wasm standards-clippy standards-ci standards-data-drivers standards-properties standards-data-driver-fuzz standards-hardening $(LEGACY_SUBDIRS) $(STANDARDS_WASM_CONTRACTS)

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ This repository contains smart contracts for the Dusk ecosystem:
1111

1212
- Genesis protocol contracts: part of the genesis state and provide core
1313
functionality to the Dusk protocol.
14+
- Contract standards: reusable Dusk-native primitives and examples for access
15+
control, tokens, replay and nonce protection, timelocks, pausing, reentrancy
16+
guards, and upgrade policy.
1417
- Test contracts: small contracts used for integration tests and host function
1518
coverage.
1619

@@ -45,3 +48,11 @@ The on-chain ContractId for the stake contract is:
4548
on behalf of a contract via the transfer and stake contracts.
4649
- [`host_fn`](tests/host_fn): wraps host functions (hashing, signature/proof
4750
verification, chain metadata, etc.) for testing.
51+
52+
## Contract Standards
53+
54+
- [`dusk-contract-standards`](standards/dusk-contract-standards): reusable
55+
primitives.
56+
57+
Reference contracts, design notes, and security documentation are added in the
58+
follow-up standards PRs.

0 commit comments

Comments
 (0)