From 6ef4d4aa0ad7f99f948c0cf19bda4f0faa191c37 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 28 Mar 2025 14:07:50 +0300 Subject: [PATCH] [#102] Makefile: Parallelize GAS transfer The last version of the `frostfs-adm` allows to work with multiple wallets in `refill-gas` and `proxy-add-account` commands. This makes `up/bootstrap` target take ~6s less time. The Makefile stuff is not obvious, but it seem to work as expected. Refs TrueCloudLab/frostfs-node#1590, TrueCloudLab/frostfs-node#1578 Signed-off-by: Evgenii Stratonikov --- Makefile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index fcc09a3..911d168 100644 --- a/Makefile +++ b/Makefile @@ -72,6 +72,8 @@ up/basic: up/bootstrap # Start bootstrap services .PHONY: up/bootstrap +up/bootstrap: STORAGE_WALLETS = $(wildcard ./services/storage/wallet*.json) +up/bootstrap: STORAGE_ACCOUNTS = $(foreach wallet,$(STORAGE_WALLETS),$(shell docker container exec morph_chain neo-go wallet dump-keys -w /wallets/storage/$(notdir $(wallet)) | head -1 | awk '{print $$1}' )) up/bootstrap: get vendor/hosts @$(foreach SVC, $(START_BOOTSTRAP), $(shell docker-compose -f services/$(SVC)/docker-compose.yml up -d)) @source ./bin/helper.sh @@ -80,13 +82,16 @@ up/bootstrap: get vendor/hosts @./vendor/frostfs-adm --config frostfs-adm.yml morph \ ape add-rule-chain --target-type namespace --target-name "" \ --rule 'allow Container.* *' --chain-id "allow_container_ops" - @for f in ./services/storage/wallet*.json; do \ - echo "Transfer GAS to wallet $${f}" \ - && ./vendor/frostfs-adm -c frostfs-adm.yml morph refill-gas --storage-wallet $${f} --gas 10.0 \ - || die "Failed to transfer GAS to alphabet wallets"; \ - echo "Register storage wallet $${f} in proxy contract" \ - && ./vendor/frostfs-adm morph proxy-add-account --config frostfs-adm.yml --account=`docker container exec morph_chain neo-go wallet dump-keys -w /wallets/storage/$${f##*/} | head -1 | awk '{print $1}'` || die "Couldn't set storage allet as proxy wallet" - done + + echo -e "Transfer GAS to storage wallets: $(foreach wallet,$(STORAGE_WALLETS),\n\t$(wallet))" + ./vendor/frostfs-adm -c frostfs-adm.yml morph refill-gas \ + $(foreach wallet,$(STORAGE_WALLETS),--storage-wallet $(wallet)) \ + --gas 10.0 \ + || die "Failed to transfer GAS to alphabet wallets" + echo -e "Register storage accounts in proxy contract: $(foreach account,$(STORAGE_ACCOUNTS),\n\t$(account))" + ./vendor/frostfs-adm morph proxy-add-account --config frostfs-adm.yml \ + $(foreach account,$(STORAGE_ACCOUNTS),--account=$(account)) \ + || die "Couldn't set storage allet as proxy wallet" @echo "Create frostfsid subject for ./wallets/wallet.json"; \ if [ -n "$$(./vendor/frostfs-adm -c frostfs-adm.yml morph frostfsid list-subjects --namespace '')" ]; then \ echo "Subject already exists"; \ -- 2.45.3