From 849da0a52153810e6dafeebf31c67d980909e069 Mon Sep 17 00:00:00 2001 From: parazyd Date: Tue, 9 Jan 2024 15:05:35 +0100 Subject: [PATCH] contract: Strip built WASM binaries using wasm-strip from the wabt toolkit --- README.md | 3 ++- contrib/dependency_setup.sh | 2 +- src/contract/consensus/Makefile | 1 + src/contract/dao/Makefile | 1 + src/contract/deployooor/Makefile | 1 + src/contract/deployooor/tests/integration.rs | 1 - src/contract/money/Makefile | 1 + 7 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d680bf456..a063fb14c 100644 --- a/README.md +++ b/README.md @@ -55,13 +55,14 @@ The following dependencies are also required: | alsa-lib | libasound2-dev | | openssl | libssl-dev | | sqlcipher | libsqlcipher-dev | +| wabt | wabt | Users of Debian-based systems (e.g. Ubuntu) can simply run the following to install the required dependencies: ```shell # apt-get update -# apt-get install -y git make gcc pkg-config libasound2-dev libssl-dev libsqlcipher-dev +# apt-get install -y git make gcc pkg-config libasound2-dev libssl-dev libsqlcipher-dev wabt ``` Alternatively, users can try using the automated script under `contrib` diff --git a/contrib/dependency_setup.sh b/contrib/dependency_setup.sh index faa6233a2..0908b8bc5 100644 --- a/contrib/dependency_setup.sh +++ b/contrib/dependency_setup.sh @@ -22,7 +22,7 @@ setup_mac() { } setup_apt() { - apt_deps="git cmake make gcc g++ pkg-config libasound2-dev libclang-dev libssl-dev libsqlcipher-dev libsqlite3-dev" + apt_deps="git cmake make gcc g++ pkg-config libasound2-dev libclang-dev libssl-dev libsqlcipher-dev libsqlite3-dev wabt" $1 install $apt_deps || return 1 } diff --git a/src/contract/consensus/Makefile b/src/contract/consensus/Makefile index af7c58087..41b395eaa 100644 --- a/src/contract/consensus/Makefile +++ b/src/contract/consensus/Makefile @@ -42,6 +42,7 @@ $(WASM_BIN): $(WASM_SRC) $(PROOFS_BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(WASM_TARGET) \ --release --package $(PKGNAME) cp -f ../../../target/$(WASM_TARGET)/release/$@ $@ + wasm-strip $@ test-stake-unstake: all RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \ diff --git a/src/contract/dao/Makefile b/src/contract/dao/Makefile index 40b2be687..c33f0f17d 100644 --- a/src/contract/dao/Makefile +++ b/src/contract/dao/Makefile @@ -42,6 +42,7 @@ $(WASM_BIN): $(WASM_SRC) $(PROOFS_BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(WASM_TARGET) \ --release --package $(PKGNAME) cp -f ../../../target/$(WASM_TARGET)/release/$@ $@ + wasm-strip $@ test-integration: all RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \ diff --git a/src/contract/deployooor/Makefile b/src/contract/deployooor/Makefile index 40b2be687..c33f0f17d 100644 --- a/src/contract/deployooor/Makefile +++ b/src/contract/deployooor/Makefile @@ -42,6 +42,7 @@ $(WASM_BIN): $(WASM_SRC) $(PROOFS_BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(WASM_TARGET) \ --release --package $(PKGNAME) cp -f ../../../target/$(WASM_TARGET)/release/$@ $@ + wasm-strip $@ test-integration: all RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \ diff --git a/src/contract/deployooor/tests/integration.rs b/src/contract/deployooor/tests/integration.rs index 2cdda6775..411c44622 100644 --- a/src/contract/deployooor/tests/integration.rs +++ b/src/contract/deployooor/tests/integration.rs @@ -21,7 +21,6 @@ use darkfi_contract_test_harness::{init_logger, Holder, TestHarness}; use log::info; #[test] -#[ignore] fn deploy_integration() -> Result<()> { smol::block_on(async { init_logger(); diff --git a/src/contract/money/Makefile b/src/contract/money/Makefile index de83005a7..73392b76d 100644 --- a/src/contract/money/Makefile +++ b/src/contract/money/Makefile @@ -42,6 +42,7 @@ $(WASM_BIN): $(WASM_SRC) $(PROOFS_BIN) RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --target=$(WASM_TARGET) \ --release --package $(PKGNAME) cp -f ../../../target/$(WASM_TARGET)/release/$@ $@ + wasm-strip $@ test-integration: all RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --target=$(RUST_TARGET) \