diff --git a/Cargo.lock b/Cargo.lock index 92dab9a62..93d0b9017 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -108,9 +108,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.7" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd2405b3ac1faab2990b74d728624cd9fd115651fcecc7c2d8daf01376275ba" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -189,6 +189,9 @@ name = "arrayvec" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +dependencies = [ + "serde", +] [[package]] name = "asn1-rs" @@ -262,9 +265,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.2.2" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7" +checksum = "fb41eb19024a91746eba0773aa5e16036045bbf45733766661099e182ea6a744" dependencies = [ "async-lock 3.3.0", "cfg-if", @@ -272,8 +275,8 @@ dependencies = [ "futures-io", "futures-lite 2.2.0", "parking", - "polling 3.3.1", - "rustix 0.38.28", + "polling 3.3.2", + "rustix 0.38.30", "slab", "tracing", "windows-sys 0.52.0", @@ -376,9 +379,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d09dbe0e490df5da9d69b36dca48a76635288a82f92eca90024883a56202026d" +checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" dependencies = [ "async-trait", "axum-core", @@ -410,9 +413,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87c8503f93e6d144ee5690907ba22db7ba79ab001a932ab99034f0fe836b3df" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" dependencies = [ "async-trait", "bytes", @@ -505,9 +508,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" dependencies = [ "serde", ] @@ -723,9 +726,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.16" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58e54881c004cec7895b0068a0a954cd5d62da01aef83fa35b1e594497bf5445" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -733,9 +736,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.16" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59cb82d7f531603d2fd1f507441cdd35184fa81beff7bd489570de7f773460bb" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -1656,6 +1659,7 @@ name = "freenet-stdlib" version = "0.0.8" dependencies = [ "arbitrary", + "arrayvec", "bincode", "blake3", "bs58", @@ -1917,9 +1921,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.23" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b553656127a00601c8ae5590fcfdc118e4083a7924b6cf4ffc1ea4b99dc429d7" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -1936,9 +1940,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991910e35c615d8cab86b5ab04be67e6ad24d2bf5f4f11fdbbed26da999bbeab" +checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" dependencies = [ "bytes", "fnv", @@ -2016,9 +2020,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "hex" @@ -2148,7 +2152,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.23", + "h2 0.3.24", "http 0.2.11", "http-body 0.4.6", "httparse", @@ -2171,7 +2175,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.1", + "h2 0.4.2", "http 1.0.0", "http-body 1.0.0", "httparse", @@ -2275,7 +2279,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6b0422c86d7ce0e97169cc42e04ae643caf278874a7a3c87b8150a220dc7e1e" dependencies = [ - "async-io 2.2.2", + "async-io 2.3.0", "core-foundation", "fnv", "futures", @@ -2453,9 +2457,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] @@ -2925,7 +2929,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "libc", "redox_syscall", ] @@ -2981,9 +2985,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -3334,7 +3338,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cfg-if", "libc", ] @@ -3361,7 +3365,7 @@ version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "crossbeam-channel", "filetime", "fsevent-sys", @@ -3511,9 +3515,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.98" +version = "0.9.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", @@ -3835,9 +3839,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platforms" @@ -3863,14 +3867,14 @@ dependencies = [ [[package]] name = "polling" -version = "3.3.1" +version = "3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e" +checksum = "545c980a3880efd47b2e262f6a4bb6daad6555cf3367aa9c4e52895f69537a41" dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite", - "rustix 0.38.28", + "rustix 0.38.30", "tracing", "windows-sys 0.52.0", ] @@ -4146,9 +4150,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ "either", "rayon-core", @@ -4156,9 +4160,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -4454,14 +4458,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", - "linux-raw-sys 0.4.12", + "linux-raw-sys 0.4.13", "windows-sys 0.52.0", ] @@ -4808,9 +4812,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "snow" @@ -4988,7 +4992,7 @@ checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" dependencies = [ "atoi", "base64 0.21.7", - "bitflags 2.4.1", + "bitflags 2.4.2", "byteorder", "bytes", "crc", @@ -5030,7 +5034,7 @@ checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" dependencies = [ "atoi", "base64 0.21.7", - "bitflags 2.4.1", + "bitflags 2.4.2", "byteorder", "crc", "dotenvy", @@ -5246,7 +5250,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall", - "rustix 0.38.28", + "rustix 0.38.30", "windows-sys 0.52.0", ] @@ -5487,11 +5491,11 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09e12e6351354851911bdf8c2b8f2ab15050c567d70a8b9a37ae7b8301a4080d" +checksum = "0da193277a4e2c33e59e09b5861580c33dd0a637c3883d0fa74ba40c0374af2e" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bytes", "futures-util", "http 1.0.0", @@ -5761,9 +5765,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -5867,9 +5871,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" [[package]] name = "valuable" @@ -5928,9 +5932,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "serde", @@ -5940,9 +5944,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", @@ -5955,9 +5959,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5965,9 +5969,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", @@ -5978,9 +5982,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "wasm-encoder" @@ -6154,9 +6158,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ "js-sys", "wasm-bindgen", @@ -6502,13 +6506,13 @@ dependencies = [ [[package]] name = "xattr" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914566e6413e7fa959cc394fb30e563ba80f3541fbd40816d4c05a0fc3f2a0f1" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", - "linux-raw-sys 0.4.12", - "rustix 0.38.28", + "linux-raw-sys 0.4.13", + "rustix 0.38.30", ] [[package]] diff --git a/apps/freenet-email-app/Makefile b/apps/freenet-email-app/Makefile index 9bbc387d1..f661d31b2 100644 --- a/apps/freenet-email-app/Makefile +++ b/apps/freenet-email-app/Makefile @@ -1,21 +1,100 @@ # expected make version >= 3.82 -.ONESHELL: +#.ONESHELL: + +ifeq ($(OS), Windows_NT) + ROOT := $(abspath .\) + FREENET_ROOT := $(ROOT)\..\..\..\freenet-core + INBOX_WEB_DIR := $(ROOT)\web + INBOX_DIR := $(ROOT)\contracts\inbox + AFT_RECORD := $(FREENET_ROOT)\modules\antiflood-tokens\contracts\token-allocation-record + AFT_GENERATOR := $(FREENET_ROOT)\modules\antiflood-tokens\delegates\token-generator + IDENTITY_DELEGATE := $(FREENET_ROOT)\modules\identity-management + WEB_DIR_SRC := $(ROOT)\web\src + FILE := $(IDENTITY_DELEGATE)\build\identity-manager-key.private.pem +else + ROOT := $(abspath ./) + INBOX_WEB_DIR := $(ROOT)/web + INBOX_DIR := $(ROOT)/contracts/inbox + AFT_RECORD := $(FREENET_ROOT)/modules/antiflood-tokens/contracts/token-allocation-record + AFT_GENERATOR := $(FREENET_ROOT)/modules/antiflood-tokens/delegates/token-generator + IDENTITY_DELEGATE := $(FREENET_ROOT)/modules/identity-management + WEB_DIR_SRC := $(ROOT)/web/src +endif -FREENET_DIR := $(abspath ../../) -INBOX_WEB_DIR := $(FREENET_DIR)/apps/freenet-email-app/web -INBOX_DIR := $(FREENET_DIR)/apps/freenet-email-app/contracts/inbox -AFT_RECORD := $(FREENET_DIR)/modules/antiflood-tokens/contracts/token-allocation-record -AFT_GENERATOR := $(FREENET_DIR)/modules/antiflood-tokens/delegates/token-generator -IDENTITY_DELEGATE := $(FREENET_DIR)/modules/identity-management -WEB_DIR_SRC := $(FREENET_DIR)/apps/freenet-email-app/web/src ifeq ($(CARGO_TARGET_DIR),) $(error CARGO_TARGET_DIR is not set) endif -.PHONY: build clean +#.PHONY: build clean + + +ifeq ($(OS), Windows_NT) +all: + echo "root: $(ROOT)" + echo "freenet root: $(FREENET_ROOT)" + echo "cargo target dir: $(CARGO_TARGET_DIR)" + $(MAKE) install-deps + $(MAKE) build + +install-deps: + cargo install dioxus-cli + +build: \ + build-aft-record \ + generate-id-manager-key \ + build-inbox \ + build-webapp \ + publish-webapp + +build-aft-record: + echo $(AFT_RECORD) + cd $(AFT_RECORD) && fdev build + +generate-id-manager-key: + echo $(FILE) +ifeq ("$(wildcard $(FILE))","") + cd $(IDENTITY_DELEGATE) + cargo run -- --path "$(IDENTITY_DELEGATE)\build" +endif + + setx FILE $(IDENTITY_DELEGATE)\build\identity-manager-key.private.pem + echo "file: $(FILE)" +build-inbox: + cd $(INBOX_DIR) && fdev build --features contract + fdev inspect $(INBOX_DIR)\build\freenet\freenet_email_inbox code + $(eval HASH_LINE=$(shell fdev inspect $(INBOX_DIR)\build\freenet\freenet_email_inbox code)) + echo $(subst "code hash: , ,$(HASH_LINE)) + $(eval HASH_LINE=$(subst code hash: ,,$(HASH_LINE))) + $(eval HASH=$(subst contract API version: 0.0.1,,$(HASH_LINE))) + echo $(HASH) + $(shell mkdir "$(WEB_DIR_SRC)\..\build") + echo $(HASH) > $(WEB_DIR_SRC)\..\build\inbox_code_hash + +run-node: + setx RUST_BACKTRACE 1 + setx RUST_LOG debug + setx freenet debug + setx freenet_core debug,info + freenet local + +run-web: + cd $(INBOX_WEB_DIR) && dx build --target index.html --platform web --features use-node + cd $(INBOX_WEB_DIR) && dx serve --features use-node --port 57616 + +build-webapp: + cd $(INBOX_WEB_DIR) && dx build --target index.html --release --platform web --features use-node + cd $(INBOX_WEB_DIR) && sed -i "s@/./assets@./assets@g" dist/index.html + cd $(INBOX_WEB_DIR) && fdev build + +publish-webapp: + cd $(INBOX_WEB_DIR) && fdev publish --code build\freenet\freenet_email_app_web contract --state build\freenet\contract-state + +clean: + rm -rf $(CARGO_TARGET_DIR) +else all: \ $(MAKE) build-tool \ $(MAKE) build @@ -63,3 +142,6 @@ publish-webapp: clean: rm -rf $(CARGO_TARGET_DIR) +endif + + diff --git a/modules/antiflood-tokens/Makefile b/modules/antiflood-tokens/Makefile index 602c286a4..fa945fcaf 100644 --- a/modules/antiflood-tokens/Makefile +++ b/modules/antiflood-tokens/Makefile @@ -12,6 +12,56 @@ endif .PHONY: all clean + +ifeq ($(OS), Windows_NT) +all: + $(MAKE) build-tool && + $(MAKE) build-token-allocation + +build: \ + build-token-allocation-contract \ + build-token-generator \ + generate-token-allocation-code-hash generate-token-generator-delegate-code-hash + +build-tool: + cargo install --force --path $(FREENET_DIR)/crates/core + cargo install --force --path $(FREENET_DIR)/crates/fdev + +build-token-allocation-contract: + cd $(AFT_RECORD) + fdev build + +build-token-generator: + cd $(AFT_GENERATOR) + fdev build --package-type delegate + +generate-token-allocation-code-hash: + cd $(AFT_RECORD) + echo $(AFT_RECORD) + $(eval HASH_LINE=$(shell fdev inspect "$(AFT_RECORD)/build/freenet/freenet_token_allocation_record" code)) + echo $(HASH_LINE) + echo $(subst "code hash: ,,$(HASH_LINE)) + $(eval HASH_LINE=$(subst code hash: ,,$(HASH_LINE))) + $(eval HASH=$(subst contract API version: 0.0.1,,$(HASH_LINE))) + echo "hash: $(HASH)" + echo $(HASH) > $(AFT_RECORD)/build/token_allocation_record_code_hash + +generate-token-generator-delegate-code-hash: + echo $(AFT_GENERATOR) + cd $(AFT_GENERATOR) + $(eval HASH_LINE=$(shell fdev inspect "$(AFT_GENERATOR)/build/freenet/freenet_token_generator" delegate)) + $(eval HASH_LINE=$(subst code hash: ,,$(HASH_LINE))) + $(eval HASH=$(subst delegate API version: 0.0.1,,$(HASH_LINE))) + echo "line $(HASH_LINE)" + mkdir "$(AFT_GENERATOR)/build" + echo $(HASH) > $(AFT_GENERATOR)/build/token_generator_code_hash + echo "success" + +clean: + rm -rf $(CARGO_TARGET_DIR) + +else + all: $(MAKE) build-tool && $(MAKE) build-token-allocation @@ -47,3 +97,4 @@ generate-token-generator-delegate-code-hash: clean: rm -rf $(CARGO_TARGET_DIR) +endif \ No newline at end of file diff --git a/modules/identity-management/Makefile b/modules/identity-management/Makefile index 1139ef7cc..20d579864 100644 --- a/modules/identity-management/Makefile +++ b/modules/identity-management/Makefile @@ -28,11 +28,27 @@ build-delegate: cd $(DELEGATE_DIR) fdev build --package-type delegate --features contract +ifeq ($(OS), Windows_NT) +generate-delegate-code-hash: + echo "TMP" + cd $(DELEGATE_DIR) + fdev inspect "$(DELEGATE_DIR)/build/freenet/identity_management" delegate + $(eval HASH_LINE=$(shell fdev inspect "$(DELEGATE_DIR)/build/freenet/identity_management" delegate)) + echo $(HASH_LINE) + echo $(subst "code hash: ,,$(HASH_LINE)) + $(eval HASH_LINE=$(subst code hash: ,,$(HASH_LINE))) + $(eval HASH=$(subst contract API version: 0.0.1,,$(HASH_LINE))) + mkdir "$(DELEGATE_DIR)/build" + echo "hash: $(HASH)" + echo $(HASH) > $(DELEGATE_DIR)/build/identity_management_code_hash +else generate-delegate-code-hash: cd $(DELEGATE_DIR) hash=$$(bash -c "fdev inspect build/freenet/identity_management delegate | grep 'code hash:' | cut -d' ' -f3") mkdir -p $(DELEGATE_DIR)/build echo -n $$hash > $(DELEGATE_DIR)/build/identity_management_code_hash +endif + generate-delegate-params: cd $(DELEGATE_DIR)