Full Makefile project cleanup

This commit is contained in:
parazyd
2023-11-21 15:57:45 +01:00
parent 14b4c96105
commit 673b0ec6b1
25 changed files with 347 additions and 360 deletions

72
.gitignore vendored
View File

@@ -1,50 +1,36 @@
/target
*.pyc *.pyc
*.pickle
*.sage.py *.sage.py
*.wasm
*.zk.bin *.zk.bin
*_circuit_layout.png *_circuit_layout.png
.vscode/
.idea/
.cargo/
.DS_Store
.#*
*.profraw
*_original
python-venv
/vendor/* /bin/zkas/zkas
/target/*
/tmp/*
/cashierd
/dao
/daod
/dhtd
/darkfid
/darkfid2
/darkfi-mmproxy
/darkotc
/dnetview
/drk
/faucetd
/fu
/fud
/genevd
/genev
/ircd
/darkirc
/tau
/taud
/vanityaddr
/zkas /zkas
/lilith
/darkwiki
/darkwikid
/zktool
/riscv-bins
/static-bins
# tags, ctags, rusty-tags /bin/darkfid2/darkfid2
TAGS /darkfid2
rusty-tags.emacs
rusty-tags.vi /bin/darkfi-mmproxy/darkfi-mmproxy
/darkfi-mmproxy
/bin/darkirc/darkirc
/darkirc
/bin/genev/genev-cli/genev
/genev
/bin/genev/genevd/genevd
/genevd
/bin/lilith/lilith
/lilith
/bin/tau/taud/taud
/taud
/bin/vanityaddr/vanityaddr
/vanityaddr

206
Cargo.lock generated
View File

@@ -1708,28 +1708,6 @@ dependencies = [
"x509-parser", "x509-parser",
] ]
[[package]]
name = "darkfi-consensus-contract"
version = "0.4.1"
dependencies = [
"blake3",
"bs58",
"chacha20poly1305",
"darkfi",
"darkfi-contract-test-harness",
"darkfi-money-contract",
"darkfi-sdk",
"darkfi-serial",
"getrandom 0.2.11",
"halo2_proofs",
"log",
"rand 0.8.5",
"simplelog",
"sled",
"smol",
"thiserror",
]
[[package]] [[package]]
name = "darkfi-contract-test-harness" name = "darkfi-contract-test-harness"
version = "0.4.1" version = "0.4.1"
@@ -1737,50 +1715,18 @@ dependencies = [
"blake3", "blake3",
"bs58", "bs58",
"darkfi", "darkfi",
"darkfi-consensus-contract",
"darkfi-dao-contract",
"darkfi-deployooor-contract",
"darkfi-money-contract",
"darkfi-sdk", "darkfi-sdk",
"darkfi-serial", "darkfi-serial",
"darkfi_consensus_contract",
"darkfi_dao_contract",
"darkfi_deployooor_contract",
"darkfi_money_contract",
"log", "log",
"rand 0.8.5", "rand 0.8.5",
"simplelog", "simplelog",
"sled", "sled",
] ]
[[package]]
name = "darkfi-dao-contract"
version = "0.4.1"
dependencies = [
"bs58",
"chacha20poly1305",
"darkfi",
"darkfi-contract-test-harness",
"darkfi-money-contract",
"darkfi-sdk",
"darkfi-serial",
"getrandom 0.2.11",
"halo2_proofs",
"log",
"rand 0.8.5",
"simplelog",
"sled",
"smol",
"thiserror",
]
[[package]]
name = "darkfi-deployooor-contract"
version = "0.4.1"
dependencies = [
"async-trait",
"darkfi-sdk",
"darkfi-serial",
"getrandom 0.2.11",
"thiserror",
]
[[package]] [[package]]
name = "darkfi-derive" name = "darkfi-derive"
version = "0.4.1" version = "0.4.1"
@@ -1826,27 +1772,6 @@ dependencies = [
"uuid", "uuid",
] ]
[[package]]
name = "darkfi-money-contract"
version = "0.4.1"
dependencies = [
"blake3",
"bs58",
"chacha20poly1305",
"darkfi",
"darkfi-contract-test-harness",
"darkfi-sdk",
"darkfi-serial",
"getrandom 0.2.11",
"halo2_proofs",
"log",
"rand 0.8.5",
"simplelog",
"sled",
"smol",
"thiserror",
]
[[package]] [[package]]
name = "darkfi-sdk" name = "darkfi-sdk"
version = "0.4.1" version = "0.4.1"
@@ -1896,27 +1821,78 @@ dependencies = [
] ]
[[package]] [[package]]
name = "darkfid" name = "darkfi_consensus_contract"
version = "0.4.1" version = "0.4.1"
dependencies = [ dependencies = [
"async-trait",
"blake3", "blake3",
"bs58", "bs58",
"chacha20poly1305",
"darkfi", "darkfi",
"darkfi-contract-test-harness",
"darkfi-sdk", "darkfi-sdk",
"darkfi-serial", "darkfi-serial",
"easy-parallel", "darkfi_money_contract",
"getrandom 0.2.11",
"halo2_proofs",
"log", "log",
"serde", "rand 0.8.5",
"signal-hook",
"signal-hook-async-std",
"simplelog", "simplelog",
"sled", "sled",
"smol", "smol",
"structopt", "thiserror",
"structopt-toml", ]
"tinyjson",
"url", [[package]]
name = "darkfi_dao_contract"
version = "0.4.1"
dependencies = [
"bs58",
"chacha20poly1305",
"darkfi",
"darkfi-contract-test-harness",
"darkfi-sdk",
"darkfi-serial",
"darkfi_money_contract",
"getrandom 0.2.11",
"halo2_proofs",
"log",
"rand 0.8.5",
"simplelog",
"sled",
"smol",
"thiserror",
]
[[package]]
name = "darkfi_deployooor_contract"
version = "0.4.1"
dependencies = [
"async-trait",
"darkfi-sdk",
"darkfi-serial",
"getrandom 0.2.11",
"thiserror",
]
[[package]]
name = "darkfi_money_contract"
version = "0.4.1"
dependencies = [
"blake3",
"bs58",
"chacha20poly1305",
"darkfi",
"darkfi-contract-test-harness",
"darkfi-sdk",
"darkfi-serial",
"getrandom 0.2.11",
"halo2_proofs",
"log",
"rand 0.8.5",
"simplelog",
"sled",
"smol",
"thiserror",
] ]
[[package]] [[package]]
@@ -1927,11 +1903,11 @@ dependencies = [
"blake3", "blake3",
"bs58", "bs58",
"darkfi", "darkfi",
"darkfi-consensus-contract",
"darkfi-contract-test-harness", "darkfi-contract-test-harness",
"darkfi-money-contract",
"darkfi-sdk", "darkfi-sdk",
"darkfi-serial", "darkfi-serial",
"darkfi_consensus_contract",
"darkfi_money_contract",
"easy-parallel", "easy-parallel",
"log", "log",
"num-bigint", "num-bigint",
@@ -2703,33 +2679,6 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "faucetd"
version = "0.4.1"
dependencies = [
"async-trait",
"blake3",
"chrono",
"darkfi",
"darkfi-money-contract",
"darkfi-sdk",
"darkfi-serial",
"easy-parallel",
"log",
"rand 0.8.5",
"rusqlite",
"serde",
"signal-hook",
"signal-hook-async-std",
"simplelog",
"sled",
"smol",
"structopt",
"structopt-toml",
"tinyjson",
"url",
]
[[package]] [[package]]
name = "fdeflate" name = "fdeflate"
version = "0.3.1" version = "0.3.1"
@@ -2914,27 +2863,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "fud"
version = "0.4.1"
dependencies = [
"async-trait",
"blake3",
"darkfi",
"darkfi-serial",
"easy-parallel",
"log",
"serde",
"signal-hook",
"signal-hook-async-std",
"simplelog",
"smol",
"structopt",
"structopt-toml",
"tinyjson",
"url",
]
[[package]] [[package]]
name = "funty" name = "funty"
version = "2.0.0" version = "2.0.0"

View File

@@ -20,13 +20,13 @@ doctest = false
[workspace] [workspace]
members = [ members = [
"bin/zkas", "bin/zkas",
"bin/darkfid", #"bin/darkfid",
"bin/darkfid2", "bin/darkfid2",
"bin/darkfi-mmproxy", "bin/darkfi-mmproxy",
#"bin/drk", #"bin/drk",
"bin/faucetd", #"bin/faucetd",
#"bin/fud/fu", #"bin/fud/fu",
"bin/fud/fud", #"bin/fud/fud",
"bin/genev/genevd", "bin/genev/genevd",
"bin/genev/genev-cli", "bin/genev/genev-cli",
"bin/darkirc", "bin/darkirc",

134
Makefile
View File

@@ -11,29 +11,26 @@ RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
# Uncomment when doing musl static builds # Uncomment when doing musl static builds
#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes #RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
# Binaries to be built # List of zkas circuits to compile, used for tests
PROOFS_SRC = $(shell find proof -type f -name '*.zk')
PROOFS_BIN = $(PROOFS_SRC:=.bin)
# List of all binaries built
BINS = \ BINS = \
zkas \ zkas \
darkfid \
darkfid2 \ darkfid2 \
faucetd \
darkirc \
darkfi-mmproxy \ darkfi-mmproxy \
genev/genev-cli \ darkirc \
genev/genevd \ genev \
genevd \
lilith \ lilith \
tau/tau-cli \ taud \
tau/taud \
vanityaddr vanityaddr
# ZK proofs to compile with zkas
PROOFS_SRC = $(shell find proof -type f -name '*.zk') example/simple.zk
PROOFS_BIN = $(PROOFS_SRC:=.bin)
all: $(BINS) all: $(BINS)
zkas: zkas:
$(MAKE) -C bin/zkas \ $(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \ PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \ CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \ RUST_TARGET="$(RUST_TARGET)" \
@@ -44,105 +41,112 @@ $(PROOFS_BIN): zkas $(PROOFS_SRC)
contracts: zkas contracts: zkas
$(MAKE) -C src/contract/money $(MAKE) -C src/contract/money
$(MAKE) -C src/contract/dao
$(MAKE) -C src/contract/consensus $(MAKE) -C src/contract/consensus
$(MAKE) -C src/contract/dao
$(MAKE) -C src/contract/deployooor $(MAKE) -C src/contract/deployooor
darkfid: $(PROOFS_BIN) contracts
$(MAKE) -C bin/darkfid
darkfid2: contracts darkfid2: contracts
$(MAKE) -C bin/darkfid2 $(MAKE) -C bin/$@ \
faucetd: contracts
$(MAKE) -C bin/faucetd
darkirc: zkas
$(MAKE) -C bin/darkirc \
PREFIX="$(PREFIX)" \ PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \ CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \ RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)" RUSTFLAGS="$(RUSTFLAGS)"
darkfi-mmproxy: darkfi-mmproxy:
$(MAKE) -C bin/darkfi-mmproxy \ $(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
darkirc: zkas
$(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \ PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \ CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \ RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)" RUSTFLAGS="$(RUSTFLAGS)"
genev: genev:
$(MAKE) -C bin/genev/genev-cli $(MAKE) -C bin/genev/genev-cli \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
genevd: genevd:
$(MAKE) -C bin/genev/genevd $(MAKE) -C bin/genev/genevd \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
lilith: lilith:
$(MAKE) -C bin/lilith $(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \
tau: CARGO="$(CARGO)" \
$(MAKE) -C bin/tau/tau-cli RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
taud: taud:
$(MAKE) -C bin/tau/taud $(MAKE) -C bin/tau/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
vanityaddr: vanityaddr:
$(MAKE) -C bin/vanityaddr $(MAKE) -C bin/$@ \
PREFIX="$(PREFIX)" \
CARGO="$(CARGO)" \
RUST_TARGET="$(RUST_TARGET)" \
RUSTFLAGS="$(RUSTFLAGS)"
# -- END OF BINS --
fmt: fmt:
$(CARGO) fmt $(CARGO) fmt --all
check: $(PROOFS_BIN) contracts check: contracts $(PROOFS_BIN)
$(CARGO) hack check --release --feature-powerset --workspace RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) hack check --target=$(RUST_TARGET) \
--release --feature-powerset --workspace
clippy: $(PROOFS_BIN) contracts clippy: contracts $(PROOFS_BIN)
$(CARGO) clippy --release --all-features --workspace --tests RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --target=$(RUST_TARGET) \
--release --all-features --workspace --tests
fix: $(PROOFS_BIN) contracts fix: contracts $(PROOFS_BIN)
$(CARGO) clippy --release --all-features --fix --allow-dirty --workspace --tests RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --target=$(RUST_TARGET) \
--release --all-features --workspace --tests --fix --allow-dirty
rustdoc: $(PROOFS_BIN) contracts rustdoc: contracts $(PROOFS_BIN)
$(CARGO) doc --release --all-features --workspace --document-private-items --no-deps RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) doc --target=$(RUST_TARGET) \
--release --all-features --workspace --document-private-items --no-deps
test: $(PROOFS_BIN) contracts test: contracts $(PROOFS_BIN)
$(CARGO) test --release --all-features --workspace RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \
--release --all-features --workspace
coverage: $(PROOFS_BIN) contracts coverage: contracts $(PROOFS_BIN)
$(CARGO) llvm-cov --release --all-features --workspace --html RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) llvm-cov --target=$(RUST_TARGET) \
--release --all-features --workspace --html
clean: clean:
$(MAKE) -C src/contract/money clean $(MAKE) -C src/contract/money clean
$(MAKE) -C src/contract/dao clean
$(MAKE) -C src/contract/consensus clean $(MAKE) -C src/contract/consensus clean
$(MAKE) -C src/contract/dao clean
$(MAKE) -C src/contract/deployooor clean $(MAKE) -C src/contract/deployooor clean
$(MAKE) -C bin/zkas clean $(MAKE) -C bin/zkas clean
$(MAKE) -C bin/darkfid clean
$(MAKE) -C bin/darkfid2 clean $(MAKE) -C bin/darkfid2 clean
$(MAKE) -C bin/darkfi-mmproxy clean $(MAKE) -C bin/darkfi-mmproxy clean
$(MAKE) -C bin/faucetd clean
$(MAKE) -C bin/darkirc clean $(MAKE) -C bin/darkirc clean
$(MAKE) -C bin/genev/genev-cli clean $(MAKE) -C bin/genev/genev-cli clean
$(MAKE) -C bin/genev/genevd clean $(MAKE) -C bin/genev/genevd clean
$(MAKE) -C bin/lilith clean $(MAKE) -C bin/lilith clean
$(MAKE) -C bin/tau/tau-cli clean
$(MAKE) -C bin/tau/taud clean $(MAKE) -C bin/tau/taud clean
$(MAKE) -C bin/vanityaddr clean $(MAKE) -C bin/vanityaddr clean
rm -f $(PROOFS_BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release
distclean: clean distclean: clean
$(CARGO) clean
rm -rf target rm -rf target
install: $(BINS) .PHONY: all $(BINS) fmt check clippy fix rustdoc test coverage clean distclean
@for i in $(BINS); \
do \
$(MAKE) -C bin/$$i install; \
done;
uninstall:
for i in $(BINS); \
do \
$(MAKE) -C bin/$$i uninstall; \
done;
.PHONY: all contracts check fix fmt clippy rustdoc test coverage distclean clean install uninstall $(BINS)

View File

@@ -8,6 +8,8 @@ CARGO = cargo +nightly
# Compile target # Compile target
RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2) RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
# Uncomment when doing musl static builds
#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
SRC = \ SRC = \
Cargo.toml \ Cargo.toml \
@@ -15,23 +17,25 @@ SRC = \
$(shell find src -type f -name '*.rs') \ $(shell find src -type f -name '*.rs') \
$(shell find ../../src -type f -name '*.rs') \ $(shell find ../../src -type f -name '*.rs') \
BIN = ../../darkfi-mmproxy BIN = $(shell grep '^name = ' Cargo.toml | cut -d' ' -f3 | tr -d '"')
all: $(BIN) all: $(BIN)
$(BIN): $(SRC) $(BIN): $(SRC)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package darkfi-mmproxy RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
cp -f ../../target/$(RUST_TARGET)/release/darkfi-mmproxy $@ cp -f ../../target/$(RUST_TARGET)/release/$@ $@
cp -f ../../target/$(RUST_TARGET)/release/$@ ../../$@
clean: clean:
rm -f $(BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
rm -f $(BIN) ../../$(BIN)
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/darkfi-mmproxy chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/darkfi-mmproxy rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
.PHONY: all clean install uninstall .PHONY: all clean install uninstall

View File

@@ -11,8 +11,8 @@ edition = "2021"
[dependencies] [dependencies]
# Darkfi # Darkfi
darkfi = {path = "../../", features = ["async-daemonize", "bs58"]} darkfi = {path = "../../", features = ["async-daemonize", "bs58"]}
darkfi-consensus-contract = {path = "../../src/contract/consensus"} darkfi_consensus_contract = {path = "../../src/contract/consensus"}
darkfi-money-contract = {path = "../../src/contract/money"} darkfi_money_contract = {path = "../../src/contract/money"}
darkfi-contract-test-harness = {path = "../../src/contract/test-harness"} darkfi-contract-test-harness = {path = "../../src/contract/test-harness"}
darkfi-sdk = {path = "../../src/sdk"} darkfi-sdk = {path = "../../src/sdk"}
darkfi-serial = {path = "../../src/serial"} darkfi-serial = {path = "../../src/serial"}

View File

@@ -6,29 +6,37 @@ PREFIX = $(HOME)/.cargo
# Cargo binary # Cargo binary
CARGO = cargo +nightly CARGO = cargo +nightly
# Compile target
RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
# Uncomment when doing musl static builds
#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
SRC = \ SRC = \
Cargo.toml \ Cargo.toml \
../../Cargo.toml \ ../../Cargo.toml \
$(shell find src -type f) \ $(shell find src -type f -name '*.rs') \
$(shell find ../../src -type f) \ $(shell find ../../src -type f -name '*.rs') \
$(shell find ../../src/contract -type f -name '*.wasm')
BIN = ../../darkfid2 BIN = $(shell grep '^name = ' Cargo.toml | cut -d' ' -f3 | tr -d '"')
all: $(BIN) all: $(BIN)
$(BIN): $(SRC) $(BIN): $(SRC)
$(CARGO) build $(TARGET_PRFX)$(RUST_TARGET) --release --package darkfid2 RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
cp -f ../../target/$(RUST_TARGET)/release/darkfid2 $@ cp -f ../../target/$(RUST_TARGET)/release/$@ $@
cp -f ../../target/$(RUST_TARGET)/release/$@ ../../$@
clean: clean:
rm -f $(BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
rm -f $(BIN) ../../$(BIN)
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/darkfid2 chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/darkfid2 rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
.PHONY: all clean install uninstall .PHONY: all clean install uninstall

View File

@@ -8,6 +8,15 @@ CARGO = cargo +nightly
# Compile target # Compile target
RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2) RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
# Uncomment when doing musl static builds
#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
# zkas compiler binary
ZKAS = ../../zkas
# zkas circuits
PROOFS_SRC = $(shell find proof -type f -name '*.zk')
PROOFS_BIN = $(PROOFS_SRC:=.bin)
SRC = \ SRC = \
Cargo.toml \ Cargo.toml \
@@ -15,43 +24,43 @@ SRC = \
$(shell find src -type f -name '*.rs') \ $(shell find src -type f -name '*.rs') \
$(shell find ../../src -type f -name '*.rs') \ $(shell find ../../src -type f -name '*.rs') \
BIN = ../../darkirc BIN = $(shell grep '^name = ' Cargo.toml | cut -d' ' -f3 | tr -d '"')
ZKAS = ../../zkas
ZKSRC = $(shell find proof -type f -name '*.zk')
ZKBIN = $(ZKSRC:=.bin)
all: $(BIN) all: $(BIN)
$(ZKBIN): $(ZKAS) $(ZKSRC) $(PROOFS_BIN): $(ZKAS) $(PROOFS_SRC)
$(ZKAS) $(basename $@) -o $@ $(ZKAS) $(basename $@) -o $@
$(BIN): $(ZKBIN) $(SRC) $(BIN): $(PROOFS_BIN) $(SRC)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package darkirc RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
cp -f ../../target/$(RUST_TARGET)/release/darkirc $@ cp -f ../../target/$(RUST_TARGET)/release/$@ $@
cp -f ../../target/$(RUST_TARGET)/release/$@ ../../$@
android: # To build for android, install the Android NDK (Android Studio)
docker build -t test:latest . --file android.Dockerfile # and then install cargo-ndk: `cargo install cargo-ndk`.
# Use this command to get an interactive terminal inside docker: # After that, add new android rust toolchains:
#docker run -v $(shell pwd)/../../:/root/src -it test:latest /bin/bash # - rustup target add aarch64-linux-android
docker run --rm -v $(shell pwd)/../../:/root/src -t test:latest make _aarch64-android # - rustup target add armv7-linux-androideabi
cp -f ../../target/aarch64-linux-android/release/darkirc darkirc.aarch64-android # - rustup target add x86_64-linux-android
# - rustup target add i686-linux-android
$(BIN).android64:
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) ndk -t arm64-v8a -o ./jniLibs build --release --package $(BIN)
cp -f ../../target/aarch64-linux-android/release/$(BIN) $(BIN).$@
# Invoked inside docker by the command above $(BIN).android32:
# We need to mount this directory as a volume using -v so docker can access it RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) ndk -t armeabi-v7a -o ./jniLibs build --release --package $(BIN)
_aarch64-android: cp -f ../../target/armv7-linux-androideabi/release/$(BIN) $(BIN).$@
cargo build --release --target aarch64-linux-android --package darkirc
clean: clean:
rm -f $(BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
rm -f $(BIN) ../../$(BIN) $(BIN).android64 $(BIN).android32
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/darkirc chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/darkirc rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
.PHONY: all clean install uninstall .PHONY: all clean install uninstall

View File

@@ -19,7 +19,7 @@
//! IRC command implemenatations //! IRC command implemenatations
//! //!
//! These try to follow the RFCs, modified in order for our P2P stack. //! These try to follow the RFCs, modified in order for our P2P stack.
//! Copied from https://simple.wikipedia.org/wiki/List_of_Internet_Relay_Chat_commands //! Copied from <https://simple.wikipedia.org/wiki/List_of_Internet_Relay_Chat_commands>
//! //!
//! Unimplemented commands: //! Unimplemented commands:
//! * `AWAY` //! * `AWAY`
@@ -354,7 +354,7 @@ impl Client {
/// `LIST [<channels> [<server>]]` /// `LIST [<channels> [<server>]]`
/// ///
/// List all channels on the server. If the list `<channels>` is given, it /// List all channels on the server. If the list `<channels>` is given, it
/// will return the channel topics. If <server> is given, the command will /// will return the channel topics. If `<server>` is given, the command will
/// be sent to `<server>` for evaluation. /// be sent to `<server>` for evaluation.
pub async fn handle_cmd_list(&self, _args: &str) -> Result<Vec<ReplyType>> { pub async fn handle_cmd_list(&self, _args: &str) -> Result<Vec<ReplyType>> {
if !self.registered.load(SeqCst) { if !self.registered.load(SeqCst) {
@@ -431,7 +431,7 @@ impl Client {
/// `MOTD [<server>]` /// `MOTD [<server>]`
/// ///
/// Returns the message of the day on <server> or the current server if /// Returns the message of the day on `<server>` or the current server if
/// it is not stated. /// it is not stated.
pub async fn handle_cmd_motd(&self, _args: &str) -> Result<Vec<ReplyType>> { pub async fn handle_cmd_motd(&self, _args: &str) -> Result<Vec<ReplyType>> {
let nick = self.nickname.read().await.to_string(); let nick = self.nickname.read().await.to_string();
@@ -448,8 +448,8 @@ impl Client {
/// `NAMES [<channel>]` /// `NAMES [<channel>]`
/// ///
/// Returns a list of who is on the list of <channel>, by channel name. /// Returns a list of who is on the list of `<channel>`, by channel name.
/// If <channel> is not used, all users are shown. They are grouped by /// If `<channel>` is not used, all users are shown. They are grouped by
/// channel name with all users who are not on a channel being shown as /// channel name with all users who are not on a channel being shown as
/// part of channel "*". /// part of channel "*".
pub async fn handle_cmd_names(&self, args: &str) -> Result<Vec<ReplyType>> { pub async fn handle_cmd_names(&self, args: &str) -> Result<Vec<ReplyType>> {
@@ -563,7 +563,7 @@ impl Client {
/// `PART <channel>` /// `PART <channel>`
/// ///
/// Causes a user to leave the channel <channel>. /// Causes a user to leave the channel `<channel>`.
pub async fn handle_cmd_part(&self, args: &str) -> Result<Vec<ReplyType>> { pub async fn handle_cmd_part(&self, args: &str) -> Result<Vec<ReplyType>> {
if !self.registered.load(SeqCst) { if !self.registered.load(SeqCst) {
self.penalty.fetch_add(1, SeqCst); self.penalty.fetch_add(1, SeqCst);
@@ -635,7 +635,7 @@ impl Client {
/// `PRIVMSG <msgtarget> <message>` /// `PRIVMSG <msgtarget> <message>`
/// ///
/// Sends <message> to <msgtarget>. The target is usually a user or /// Sends `<message>` to `<msgtarget>`. The target is usually a user or
/// a channel. /// a channel.
pub async fn handle_cmd_privmsg(&self, args: &str) -> Result<Vec<ReplyType>> { pub async fn handle_cmd_privmsg(&self, args: &str) -> Result<Vec<ReplyType>> {
if !self.registered.load(SeqCst) { if !self.registered.load(SeqCst) {
@@ -703,8 +703,8 @@ impl Client {
/// `TOPIC <channel> [<topic>]` /// `TOPIC <channel> [<topic>]`
/// ///
/// Used to get the channel topic on <channel>. If <topic> is given, it /// Used to get the channel topic on `<channel>`. If `<topic>` is given, it
/// sets the channel topic to <topic>. /// sets the channel topic to `<topic>`.
pub async fn handle_cmd_topic(&self, args: &str) -> Result<Vec<ReplyType>> { pub async fn handle_cmd_topic(&self, args: &str) -> Result<Vec<ReplyType>> {
if !self.registered.load(SeqCst) { if !self.registered.load(SeqCst) {
self.penalty.fetch_add(1, SeqCst); self.penalty.fetch_add(1, SeqCst);
@@ -762,7 +762,7 @@ impl Client {
/// ///
/// This command is used at the beginning of a connection to specify the /// This command is used at the beginning of a connection to specify the
/// username, hostname, real name, and the initial user modes of the /// username, hostname, real name, and the initial user modes of the
/// connecting client. <realname> may contain spaces, and thus must be /// connecting client. `<realname>` may contain spaces, and thus must be
/// prefixed with a colon. /// prefixed with a colon.
pub async fn handle_cmd_user(&self, args: &str) -> Result<Vec<ReplyType>> { pub async fn handle_cmd_user(&self, args: &str) -> Result<Vec<ReplyType>> {
if self.registered.load(SeqCst) { if self.registered.load(SeqCst) {

View File

@@ -32,7 +32,7 @@ pub const INVALID_SYNTAX: &str = "Syntax error";
/// The first message sent after client registration. /// The first message sent after client registration.
pub const RPL_WELCOME: u16 = 001; pub const RPL_WELCOME: u16 = 001;
/// `<client> :Your host is <servername>, running version <version` /// `<client> :Your host is <servername>, running version <version>`
/// ///
/// Part of the post-registration greeting. /// Part of the post-registration greeting.
pub const RPL_YOURHOST: u16 = 002; pub const RPL_YOURHOST: u16 = 002;
@@ -50,19 +50,19 @@ pub const RPL_ADMINME: u16 = 256;
/// `<client> :<info>` /// `<client> :<info>`
/// ///
/// Sent as a reply to an ADMIN command. <info> is a string intended to /// Sent as a reply to an ADMIN command. `<info>` is a string intended to
/// provide information about the location of the server. /// provide information about the location of the server.
pub const RPL_ADMINLOC1: u16 = 257; pub const RPL_ADMINLOC1: u16 = 257;
/// `<client> :<info>` /// `<client> :<info>`
/// ///
/// Sent as a reply to an ADMIN command. <info> is a string intended to /// Sent as a reply to an ADMIN command. `<info>` is a string intended to
/// provide information about whoever runs the server. /// provide information about whoever runs the server.
pub const RPL_ADMINLOC2: u16 = 258; pub const RPL_ADMINLOC2: u16 = 258;
/// `<client> :<info>` /// `<client> :<info>`
/// ///
/// Sent as a reply to an ADMIN command. <info> MUST contain the email /// Sent as a reply to an ADMIN command. `<info>` MUST contain the email
/// address to contact the administrator(s) of the server. /// address to contact the administrator(s) of the server.
pub const RPL_ADMINEMAIL: u16 = 259; pub const RPL_ADMINEMAIL: u16 = 259;
@@ -75,12 +75,12 @@ pub const RPL_LISTSTART: u16 = 321;
/// `<client> <channel> <client count> :<topic>` /// `<client> <channel> <client count> :<topic>`
/// ///
/// Sent as a reply to the LIST command, this numeric sends information /// Sent as a reply to the LIST command, this numeric sends information
/// about a channel to the client. <channel> is the name of the channel. /// about a channel to the client. `<channel>` is the name of the channel.
/// <client count> is an integer indicating how many clients are joined /// `<client count>` is an integer indicating how many clients are joined
/// to that channel. <topic> is the channels topic. /// to that channel. `<topic>` is the channels topic.
pub const RPL_LIST: u16 = 322; pub const RPL_LIST: u16 = 322;
/// <client> :End of /LIST /// `<client> :End of /LIST`
/// ///
/// Sent as a reply to the LIST command, this numeric indicates the end /// Sent as a reply to the LIST command, this numeric indicates the end
/// of a LIST response. /// of a LIST response.
@@ -89,18 +89,18 @@ pub const RPL_LISTEND: u16 = 323;
/// `<client> <channel> <modestring> <mode arguments>...` /// `<client> <channel> <modestring> <mode arguments>...`
/// ///
/// Sent to a client to inform them of the currently-set modes of a channel. /// Sent to a client to inform them of the currently-set modes of a channel.
/// <channel> is the name of the channel. /// `<channel>` is the name of the channel.
pub const RPL_CHANNELMODEIS: u16 = 324; pub const RPL_CHANNELMODEIS: u16 = 324;
/// `<client> <channel> :No topic is set` /// `<client> <channel> :No topic is set`
/// ///
/// Sent to a client when joining a channel to inform them that the channel /// Sent to a client when joining a channel to inform them that the channel
/// with the name <channel> does not have any topic set. /// with the name `<channel>` does not have any topic set.
pub const RPL_NOTOPIC: u16 = 331; pub const RPL_NOTOPIC: u16 = 331;
/// `<client> <channel> :<topic>` /// `<client> <channel> :<topic>`
/// ///
/// Sent to a client when joining the <channel> to inform them of the /// Sent to a client when joining the `<channel>` to inform them of the
/// current topic of the channel. /// current topic of the channel.
pub const RPL_TOPIC: u16 = 332; pub const RPL_TOPIC: u16 = 332;
@@ -159,7 +159,7 @@ pub const ERR_NOSUCHCHANNEL: u16 = 403;
/// ///
/// Indicates a PING or PONG message missing the originator parameter /// Indicates a PING or PONG message missing the originator parameter
/// which is required by old IRC servers. Nowadays, this may be used by /// which is required by old IRC servers. Nowadays, this may be used by
/// some servers when the PING <token> is empty. /// some servers when the PING `<token>` is empty.
pub const ERR_NOORIGIN: u16 = 409; pub const ERR_NOORIGIN: u16 = 409;
/// `<client> :No recipient given (<command>)` /// `<client> :No recipient given (<command>)`
@@ -174,7 +174,7 @@ pub const ERR_NORECIPIENT: u16 = 411;
/// delivered because there was no text to send. /// delivered because there was no text to send.
pub const ERR_NOTEXTTOSEND: u16 = 412; pub const ERR_NOTEXTTOSEND: u16 = 412;
/// <client> <nick> :Erroneus nickname /// `<client> <nick> :Erroneus nickname`
/// ///
/// Returned when a NICK command cannot be successfully completed as /// Returned when a NICK command cannot be successfully completed as
/// the desired nickname contains characters that are disallowed by the server. /// the desired nickname contains characters that are disallowed by the server.

View File

@@ -15,7 +15,7 @@ chrono = "0.4.31"
darkfi = {path = "../../", features = ["async-daemonize", "validator"]} darkfi = {path = "../../", features = ["async-daemonize", "validator"]}
darkfi-serial = {path = "../../src/serial"} darkfi-serial = {path = "../../src/serial"}
darkfi-sdk = {path = "../../src/sdk"} darkfi-sdk = {path = "../../src/sdk"}
darkfi-money-contract = {path = "../../src/contract/money", features = ["no-entrypoint", "client"]} darkfi_money_contract = {path = "../../src/contract/money", features = ["no-entrypoint", "client"]}
log = "0.4.20" log = "0.4.20"
rand = "0.8.5" rand = "0.8.5"
rusqlite = "0.29.0" rusqlite = "0.29.0"

View File

@@ -6,29 +6,36 @@ PREFIX = $(HOME)/.cargo
# Cargo binary # Cargo binary
CARGO = cargo +nightly CARGO = cargo +nightly
# Compile target
RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
# Uncomment when doing musl static builds
#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
SRC = \ SRC = \
Cargo.toml \ Cargo.toml \
../../../Cargo.toml \ ../../../Cargo.toml \
$(shell find src -type f) \ $(shell find src -type f -name '*.rs') \
$(shell find ../../../src -type f) \ $(shell find ../../../src -type f -name '*.rs') \
BIN = ../../../genev BIN = $(shell grep '^name = ' Cargo.toml | cut -d' ' -f3 | tr -d '"')
all: $(BIN) all: $(BIN)
$(BIN): $(SRC) $(BIN): $(SRC)
$(CARGO) build $(TARGET_PRFX)$(RUST_TARGET) --release --package genev RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
cp -f ../../../target/$(RUST_TARGET)/release/genev $@ cp -f ../../../target/$(RUST_TARGET)/release/$@ $@
cp -f ../../../target/$(RUST_TARGET)/release/$@ ../../../$@
clean: clean:
rm -f $(BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
rm -f $(BIN) ../../../$(BIN)
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/genev chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/genev rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
.PHONY: all clean install uninstall .PHONY: all clean install uninstall

View File

@@ -6,29 +6,36 @@ PREFIX = $(HOME)/.cargo
# Cargo binary # Cargo binary
CARGO = cargo +nightly CARGO = cargo +nightly
# Compile target
RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
# Uncomment when doing musl static builds
#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
SRC = \ SRC = \
Cargo.toml \ Cargo.toml \
../../../Cargo.toml \ ../../../Cargo.toml \
$(shell find src -type f) \ $(shell find src -type f -name '*.rs') \
$(shell find ../../../src -type f) \ $(shell find ../../../src -type f -name '*.rs') \
BIN = ../../../genevd BIN = $(shell grep '^name = ' Cargo.toml | sed 1q | cut -d' ' -f3 | tr -d '"')
all: $(BIN) all: $(BIN)
$(BIN): $(SRC) $(BIN): $(SRC)
$(CARGO) build $(TARGET_PRFX)$(RUST_TARGET) --release --package genevd RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
cp -f ../../../target/$(RUST_TARGET)/release/genevd $@ cp -f ../../../target/$(RUST_TARGET)/release/$@ $@
cp -f ../../../target/$(RUST_TARGET)/release/$@ ../../../$@
clean: clean:
rm -f $(BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
rm -f $(BIN) ../../../$(BIN)
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/genevd chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/genevd rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
.PHONY: all clean install uninstall .PHONY: all clean install uninstall

View File

@@ -8,6 +8,8 @@ CARGO = cargo +nightly
# Compile target # Compile target
RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2) RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
# Uncomment when doing musl static builds
#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
SRC = \ SRC = \
Cargo.toml \ Cargo.toml \
@@ -15,23 +17,25 @@ SRC = \
$(shell find src -type f -name '*.rs') \ $(shell find src -type f -name '*.rs') \
$(shell find ../../src -type f -name '*.rs') \ $(shell find ../../src -type f -name '*.rs') \
BIN = ../../lilith BIN = $(shell grep '^name = ' Cargo.toml | cut -d' ' -f3 | tr -d '"')
all: $(BIN) all: $(BIN)
$(BIN): $(SRC) $(BIN): $(SRC)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package lilith RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
cp -f ../../target/$(RUST_TARGET)/release/lilith $@ cp -f ../../target/$(RUST_TARGET)/release/$@ $@
cp -f ../../target/$(RUST_TARGET)/release/$@ ../../$@
clean: clean:
rm -f $(BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
rm -f $(BIN) ../../$(BIN)
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/lilith chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/lilith rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
.PHONY: all clean install uninstall .PHONY: all clean install uninstall

View File

@@ -8,6 +8,8 @@ CARGO = cargo +nightly
# Compile target # Compile target
RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2) RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
# Uncomment when doing musl static builds
#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
SRC = \ SRC = \
Cargo.toml \ Cargo.toml \
@@ -15,23 +17,25 @@ SRC = \
$(shell find src -type f -name '*.rs') \ $(shell find src -type f -name '*.rs') \
$(shell find ../../../src -type f -name '*.rs') \ $(shell find ../../../src -type f -name '*.rs') \
BIN = ../../../taud BIN = $(shell grep '^name = ' Cargo.toml | sed 1q | cut -d' ' -f3 | tr -d '"')
all: $(BIN) all: $(BIN)
$(BIN): $(SRC) $(BIN): $(SRC)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package taud RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
cp -f ../../../target/$(RUST_TARGET)/release/taud $@ cp -f ../../../target/$(RUST_TARGET)/release/$@ $@
cp -f ../../../target/$(RUST_TARGET)/release/$@ ../../../$@
clean: clean:
rm -f $(BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
rm -f $(BIN) ../../../$(BIN)
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/taud chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/taud rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
.PHONY: all clean install uninstall .PHONY: all clean install uninstall

View File

@@ -8,6 +8,8 @@ CARGO = cargo +nightly
# Compile target # Compile target
RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2) RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
# Uncomment when doing musl static builds
#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
SRC = \ SRC = \
Cargo.toml \ Cargo.toml \
@@ -15,23 +17,25 @@ SRC = \
$(shell find src -type f -name '*.rs') \ $(shell find src -type f -name '*.rs') \
$(shell find ../../src -type f -name '*.rs') \ $(shell find ../../src -type f -name '*.rs') \
BIN = ../../vanityaddr BIN = vanityaddr
all: $(BIN) all: $(BIN)
$(BIN): $(SRC) $(BIN): $(SRC)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package vanityaddr RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
cp -f ../../target/$(RUST_TARGET)/release/vanityaddr $@ cp -f ../../target/$(RUST_TARGET)/release/$@ $@
cp -f ../../target/$(RUST_TARGET)/release/$@ ../../$@
clean: clean:
rm -f $(BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
rm -f $(BIN) ../../$(BIN)
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/vanityaddr chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/vanityaddr rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
.PHONY: all clean install uninstall .PHONY: all clean install uninstall

View File

@@ -8,6 +8,8 @@ CARGO = cargo +nightly
# Compile target # Compile target
RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2) RUST_TARGET = $(shell rustc -Vv | grep '^host: ' | cut -d' ' -f2)
# Uncomment when doing musl static builds
#RUSTFLAGS = -C target-feature=+crt-static -C link-self-contained=yes
SRC = \ SRC = \
Cargo.toml \ Cargo.toml \
@@ -16,23 +18,25 @@ SRC = \
$(shell find ../../src/serial -type f -name '*.rs') \ $(shell find ../../src/serial -type f -name '*.rs') \
$(shell find ../../src/zkas -type f -name '*.rs') $(shell find ../../src/zkas -type f -name '*.rs')
BIN = ../../zkas BIN = zkas
all: $(BIN) all: $(BIN)
$(BIN): $(SRC) $(BIN): $(SRC)
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package zkas RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(RUST_TARGET) --release --package $@
cp -f ../../target/$(RUST_TARGET)/release/zkas $@ cp -f ../../target/$(RUST_TARGET)/release/$@ $@
cp -f ../../target/$(RUST_TARGET)/release/$@ ../../$@
clean: clean:
rm -f $(BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clean --target=$(RUST_TARGET) --release --package $(BIN)
rm -f $(BIN) ../../$(BIN)
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/zkas chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/zkas rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
.PHONY: all clean install uninstall .PHONY: all clean install uninstall

View File

@@ -153,19 +153,19 @@ impl ValidatorState {
( (
"Money Contract", "Money Contract",
*MONEY_CONTRACT_ID, *MONEY_CONTRACT_ID,
include_bytes!("../contract/money/money_contract.wasm").to_vec(), include_bytes!("../contract/money/darkfi_money_contract.wasm").to_vec(),
money_contract_deploy_payload, money_contract_deploy_payload,
), ),
( (
"DAO Contract", "DAO Contract",
*DAO_CONTRACT_ID, *DAO_CONTRACT_ID,
include_bytes!("../contract/dao/dao_contract.wasm").to_vec(), include_bytes!("../contract/dao/darkfi_dao_contract.wasm").to_vec(),
dao_contract_deploy_payload, dao_contract_deploy_payload,
), ),
( (
"Consensus Contract", "Consensus Contract",
*CONSENSUS_CONTRACT_ID, *CONSENSUS_CONTRACT_ID,
include_bytes!("../contract/consensus/consensus_contract.wasm").to_vec(), include_bytes!("../contract/consensus/darkfi_consensus_contract.wasm").to_vec(),
consensus_contract_deploy_payload, consensus_contract_deploy_payload,
), ),
]; ];

View File

@@ -25,6 +25,10 @@ PROOFS_BIN = $(PROOFS_SRC:=.bin)
# wasm source files # wasm source files
WASM_SRC = \ WASM_SRC = \
Cargo.toml \
../../../Cargo.toml \
../../../src/sdk/Cargo.toml \
../../../src/serial/Cargo.toml \
$(shell find src -type f -name '*.rs') \ $(shell find src -type f -name '*.rs') \
$(shell find ../../sdk -type f -name '*.rs') \ $(shell find ../../sdk -type f -name '*.rs') \
$(shell find ../../serial -type f -name '*.rs') $(shell find ../../serial -type f -name '*.rs')

View File

@@ -25,6 +25,10 @@ PROOFS_BIN = $(PROOFS_SRC:=.bin)
# wasm source files # wasm source files
WASM_SRC = \ WASM_SRC = \
Cargo.toml \
../../../Cargo.toml \
../../../src/sdk/Cargo.toml \
../../../src/serial/Cargo.toml \
$(shell find src -type f -name '*.rs') \ $(shell find src -type f -name '*.rs') \
$(shell find ../../sdk -type f -name '*.rs') \ $(shell find ../../sdk -type f -name '*.rs') \
$(shell find ../../serial -type f -name '*.rs') $(shell find ../../serial -type f -name '*.rs')

View File

@@ -25,6 +25,10 @@ PROOFS_BIN = $(PROOFS_SRC:=.bin)
# wasm source files # wasm source files
WASM_SRC = \ WASM_SRC = \
Cargo.toml \
../../../Cargo.toml \
../../../src/sdk/Cargo.toml \
../../../src/serial/Cargo.toml \
$(shell find src -type f -name '*.rs') \ $(shell find src -type f -name '*.rs') \
$(shell find ../../sdk -type f -name '*.rs') \ $(shell find ../../sdk -type f -name '*.rs') \
$(shell find ../../serial -type f -name '*.rs') $(shell find ../../serial -type f -name '*.rs')

View File

@@ -25,6 +25,10 @@ PROOFS_BIN = $(PROOFS_SRC:=.bin)
# wasm source files # wasm source files
WASM_SRC = \ WASM_SRC = \
Cargo.toml \
../../../Cargo.toml \
../../../src/sdk/Cargo.toml \
../../../src/serial/Cargo.toml \
$(shell find src -type f -name '*.rs') \ $(shell find src -type f -name '*.rs') \
$(shell find ../../sdk -type f -name '*.rs') \ $(shell find ../../sdk -type f -name '*.rs') \
$(shell find ../../serial -type f -name '*.rs') $(shell find ../../serial -type f -name '*.rs')

View File

@@ -34,7 +34,7 @@ pub struct Event {
} }
impl Event { impl Event {
/// Create a new event with the given data and an [`EventGraph`] reference. /// Create a new event with the given data and an `EventGraph` reference.
/// The timestamp of the event will be the current time, and the parents /// The timestamp of the event will be the current time, and the parents
/// will be `N_EVENT_PARENTS` from the current event graph unreferenced tips. /// will be `N_EVENT_PARENTS` from the current event graph unreferenced tips.
/// The parents can also include NULL, but this should be handled by the rest /// The parents can also include NULL, but this should be handled by the rest

View File

@@ -24,8 +24,10 @@ pub use error::{ClientFailed, ClientResult, Error, Result};
#[cfg(feature = "blockchain")] #[cfg(feature = "blockchain")]
pub mod blockchain; pub mod blockchain;
/*
#[cfg(feature = "validator")] #[cfg(feature = "validator")]
pub mod consensus; pub mod consensus;
*/
#[cfg(feature = "validator")] #[cfg(feature = "validator")]
pub mod validator; pub mod validator;

View File

@@ -68,19 +68,19 @@ pub fn deploy_native_contracts(
( (
"Money Contract", "Money Contract",
*MONEY_CONTRACT_ID, *MONEY_CONTRACT_ID,
include_bytes!("../contract/money/money_contract.wasm").to_vec(), include_bytes!("../contract/money/darkfi_money_contract.wasm").to_vec(),
money_contract_deploy_payload, money_contract_deploy_payload,
), ),
( (
"DAO Contract", "DAO Contract",
*DAO_CONTRACT_ID, *DAO_CONTRACT_ID,
include_bytes!("../contract/dao/dao_contract.wasm").to_vec(), include_bytes!("../contract/dao/darkfi_dao_contract.wasm").to_vec(),
dao_contract_deploy_payload, dao_contract_deploy_payload,
), ),
( (
"Consensus Contract", "Consensus Contract",
*CONSENSUS_CONTRACT_ID, *CONSENSUS_CONTRACT_ID,
include_bytes!("../contract/consensus/consensus_contract.wasm").to_vec(), include_bytes!("../contract/consensus/darkfi_consensus_contract.wasm").to_vec(),
consensus_contract_deploy_payload, consensus_contract_deploy_payload,
), ),
]; ];