diff --git a/.bootstrap_services b/.bootstrap_services index 3d2562c..3071b48 100644 --- a/.bootstrap_services +++ b/.bootstrap_services @@ -1,5 +1,4 @@ # Services start/stop order # Will start from top to bottom and stop in reverse basenet -chain morph_chain diff --git a/.env b/.env index 927233c..4fa3839 100644 --- a/.env +++ b/.env @@ -8,8 +8,6 @@ BASTION_VERSION=10 BASTION_IMAGE=debian # NeoGo privnet -#CHAIN_PATH="/path/to/devenv.dump.gz" -CHAIN_URL="https://github.com/nspcc-dev/neofs-contract/releases/download/v0.16.0/devenv_mainchain_notary_disabled.gz" NEOGO_VERSION=0.99.4 NEOGO_IMAGE=nspccdev/neo-go diff --git a/Makefile b/Makefile index 59fc415..61782ba 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,6 @@ HOSTS_LINES = $(shell grep -Rl IPV4_PREFIX ./services/* | grep .hosts) # Paths to protocol.privnet.yml MORPH_CHAIN_PROTOCOL = './services/morph_chain/protocol.privnet.yml' -CHAIN_PROTOCOL = './services/chain/protocol.privnet.yml' # List of grepped environment variables from *.env GREP_DOTENV = $(shell find . -name '*.env' -exec grep -rhv -e '^\#' -e '^$$' {} + | sort -u ) @@ -150,7 +149,6 @@ clean: env: @$(foreach envvar,$(GREP_DOTENV),echo $(envvar);) @echo MORPH_BLOCK_TIME=$(shell grep 'SecondsPerBlock' $(MORPH_CHAIN_PROTOCOL) | awk '{print $$2}')s - @echo MAINNET_BLOCK_TIME=$(shell grep 'SecondsPerBlock' $(CHAIN_PROTOCOL) | awk '{print $$2}')s @echo MORPH_MAGIC=$(shell grep 'Magic' $(MORPH_CHAIN_PROTOCOL) | awk '{print $$2}') # Restart storage nodes with clean volumes diff --git a/bin/config.sh b/bin/config.sh index e6d9cc5..31b613f 100755 --- a/bin/config.sh +++ b/bin/config.sh @@ -8,10 +8,10 @@ echo "Running bin/config.sh" source bin/helper.sh # NeoGo binary path. -NEOGO="${NEOGO:-docker exec main_chain neo-go}" +NEOGO="${NEOGO:-docker exec morph_chain neo-go}" # Wallet files to change config value -WALLET="${WALLET:-services/chain/node-wallet.json}" +WALLET="${WALLET:-services/morph_chain/node-wallet.json}" CONFIG_IMG="${CONFIG_IMG:-/wallets/config.yml}" NETMAP_ADDR=$(bin/resolve.sh netmap.frostfs) || die "Failed to resolve 'netmap.frostfs' domain name" diff --git a/bin/deposit.sh b/bin/deposit.sh deleted file mode 100755 index af039e5..0000000 --- a/bin/deposit.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -echo "Running bin/deposit.sh" - -# Source env settings -. .env -. services/ir/.ir.env -source bin/helper.sh - -# NeoGo binary path. -NEOGO="${NEOGO:-docker exec main_chain neo-go}" -# Wallet file to use for deposit GAS from -WALLET="${WALLET:-services/chain/node-wallet.json}" -CONFIG="${CONFIG:-/wallets/config.yml}" -# How much GAS to deposit. First cli argument or 50 by default -DEPOSIT="${1:-50}" - -# Internal variables -ADDR=$(jq -r .accounts[0].address < "${WALLET}" \ - || die "Cannot get address from wallet: ${WALLET}") -CONTRACT_ADDR=$(${NEOGO} util convert "${NEOFS_IR_CONTRACTS_FROSTFS}" \ - | grep 'LE ScriptHash to Address' \ - | awk '{print $5}' \ - | grep -oP "[A-z0-9]+" \ - || die "Cannot parse contract address: ${NEOFS_IR_CONTRACTS_FROSTFS}") - -# Make deposit -# shellcheck disable=SC2086 -${NEOGO} wallet nep17 transfer \ - --wallet-config ${CONFIG} \ - -r http://main-chain.${LOCAL_DOMAIN}:30333 \ - --from ${ADDR} --force \ - --to ${CONTRACT_ADDR} \ - --token GAS \ - --amount ${DEPOSIT} || die "Cannot transfer GAS to FrostFS contract" diff --git a/bin/tick.sh b/bin/tick.sh index 6120577..75482f0 100755 --- a/bin/tick.sh +++ b/bin/tick.sh @@ -8,10 +8,10 @@ echo "Running bin/tick.sh" source bin/helper.sh # NeoGo binary path. -NEOGO="${NEOGO:-docker exec main_chain neo-go}" +NEOGO="${NEOGO:-docker exec morph_chain neo-go}" # Wallet files to change config value -WALLET="${WALLET:-services/chain/node-wallet.json}" +WALLET="${WALLET:-services/morph_chain/node-wallet.json}" CONFIG_IMG="${CONFIG_IMG:-/wallets/config.yml}" # Internal variables diff --git a/docs/chain.md b/docs/chain.md deleted file mode 100644 index a1cb608..0000000 --- a/docs/chain.md +++ /dev/null @@ -1,158 +0,0 @@ -# N3 main chain privnet service - -A single-node N3 privnet deployment, running on -[neo-go](https://github.com/nspcc-dev/neo-go). Represents N3 MainNet. - -Contracts deployed: -- FrostFS [contract](https://github.com/TrueCloudLab/frostfs-contract/tree/master/neofs) -- Processing [contract](https://github.com/TrueCloudLab/frostfs-contract/tree/master/processing) - -RPC available at `http://main-chain.frostfs.devenv:30333`. - -## .env settings - -### CHAIN_URL - -URL to get main chain dump. Used on artifact get stage. - -### CHAIN_PATH - -Path to get main chain dump. If set, overrides `CHAIN_URL`. - -### NEOGO_VERSION - -Version of neo-go docker container for main chain deployment. - -## Main chain wallets - -There is a wallet with GAS that used for contract deployment: -`wallets/wallet.json`. This wallet has one account with **empty password**. - -``` -$ neo-go wallet nep17 balance \ - -w wallets/wallet.json \ - -r http://main-chain.frostfs.devenv:30333 - -Account NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM -GAS: GasToken (d2a4cff31913016155e38e474a2c06d08be276cf) - Amount : 9978.0074623 - Updated: 34 -``` - -If you want to operate in main chain with your personal wallet (e.g. to make -a deposit in FrostFS contract), you can transfer GAS from there. - -1. Create new wallet. - -``` -$ neo-go wallet init -a -w wallets/frostfs1.json - -Enter the name of the account > frostfs1 -Enter passphrase > -Confirm passphrase > - -{ - "version": "3.0", - "accounts": [ - { - "address": "NXnzw3J9VvKXjM1BPAJK4QUpTtEQu4TpU6", -... -wallet successfully created, file location is wallets/frostfs1.json -``` - -2. Transfer GAS from `wallets/wallet.json`. The password is empty. - -``` -$ neo-go wallet nep17 transfer \ - -w wallets/wallet.json \ - -r http://main-chain.frostfs.devenv:30333 \ - --from NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM \ - --to NXnzw3J9VvKXjM1BPAJK4QUpTtEQu4TpU6 \ - --amount 50 \ - --token GAS -``` - -3. Check it's there. - -``` -$ neo-go wallet nep17 balance \ - -w wallets/frostfs1.json \ - -r http://main-chain.frostfs.devenv:30333 - -Account NXnzw3J9VvKXjM1BPAJK4QUpTtEQu4TpU6 -GAS: GasToken (d2a4cff31913016155e38e474a2c06d08be276cf) - Amount : 50 - Updated: 14689 -``` - -## Claim GAS from consensus node - -If there is no enough GAS on `wallets/wallet.json` account, you can claim some -GAS to consensus node's wallet and then transfer it. - -Consensus node is running with `services/chain/node-wallet.json` wallet. It has -multiple accounts with the password `one`. - - -Claim GAS to consensus node's wallet. Use account that contains NEO tokens. -``` -$ neo-go wallet claim \ - -w services/chain/node-wallet.json \ - -r http://main-chain.frostfs.devenv:30333 \ - -a NfgHwwTi3wHAS8aFAN243C5vGbkYDpqLHP \ -Password > -70e09bbd55846dcc7cee23905b737c63e5a80d32e387bce108bc6db8e641fb90 -``` - -Then you can transfer GAS the same way as it was done in previous section. - -``` -$ neo-go wallet nep17 transfer \ - -w services/chain/node-wallet.json \ - -r http://main-chain.frostfs.devenv:30333 \ - --from NfgHwwTi3wHAS8aFAN243C5vGbkYDpqLHP \ - --to NXnzw3J9VvKXjM1BPAJK4QUpTtEQu4TpU6 \ - --amount 50 \ - --token GAS -``` - -## FrostFS GAS deposit - -FrostFS identifies users by their Neo wallet key pair. To start using FrostFS in -devenv you need to transfer some GAS to FrostFS contract in main chain. - -Invoke `bin/deposit.sh` script by running `make prepare.ir` command to transfer -50 GAS from account in `wallets/wallet.json` file. Script enters passwords -automatically with `expect` utility. - -``` -$ make prepare.ir -Password > -Can't find matching token in the wallet. Querying RPC-node for balances. -6713c776f4102300691d9c3c493bcd3402434f5e32e8147e0a5bc72209a1e410 -``` - -Script converts addresses and executes this command: -``` -$ neo-go wallet nep17 transfer \ - -w wallets/wallet.json \ - -r http://main-chain.frostfs.devenv:30333 \ - --from NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM \ - --to NerhjaqJsJt4LxMqUbkkVMpsF2d9TtcpFv \ - --token GAS \ - --amount 50 -``` - -You can specify any wallet address scripthash in the transfer's data argument, -and FrostFS deposit will be transferred to that address. - -``` -$ neo-go wallet nep17 transfer \ - -w wallets/wallet.json \ - -r http://main-chain.frostfs.devenv:30333 \ - --from NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM \ - --to NerhjaqJsJt4LxMqUbkkVMpsF2d9TtcpFv \ - --token GAS \ - --amount 50 \ - hash160:bd711de066e9c2f7b502c7f3f0e0a6f1c8341edd -``` diff --git a/services/chain/.env b/services/chain/.env deleted file mode 120000 index c7360fb..0000000 --- a/services/chain/.env +++ /dev/null @@ -1 +0,0 @@ -../../.env \ No newline at end of file diff --git a/services/chain/.hosts b/services/chain/.hosts deleted file mode 100644 index a576e59..0000000 --- a/services/chain/.hosts +++ /dev/null @@ -1 +0,0 @@ -IPV4_PREFIX.50 main-chain.LOCAL_DOMAIN diff --git a/services/chain/.int_test.env b/services/chain/.int_test.env deleted file mode 120000 index 582b6a2..0000000 --- a/services/chain/.int_test.env +++ /dev/null @@ -1 +0,0 @@ -../../.int_test.env \ No newline at end of file diff --git a/services/chain/artifacts.mk b/services/chain/artifacts.mk deleted file mode 100644 index 186b634..0000000 --- a/services/chain/artifacts.mk +++ /dev/null @@ -1,18 +0,0 @@ -# Download privnet chain dump with pre-deployed FrostFS contracts - -get.chain: CHAIN_DUMP_NAME=devenv.dump. -get.chain: CHAIN_PATH?= -get.chain: - @mkdir -p ./vendor - -ifeq (${CHAIN_PATH},) - @echo "⇒ Download blockchain dump from ${CHAIN_URL}" - @curl \ - -sSL "${CHAIN_URL}" \ - -o ./vendor/chain.gz -else - @echo "⇒ Copy local archive ${CHAIN_PATH}" - @cp ${CHAIN_PATH} ./vendor/chain.gz -endif - - diff --git a/services/chain/docker-compose.yml b/services/chain/docker-compose.yml deleted file mode 100644 index 1db47e2..0000000 --- a/services/chain/docker-compose.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- - -version: "2.4" -services: - frostfs_main_chain: - image: ${NEOGO_IMAGE}:${NEOGO_VERSION} - container_name: main_chain - command: ["node", "--config-path", "/config", "--privnet", "--debug"] - domainname: ${LOCAL_DOMAIN} - hostname: main-chain - networks: - chain_int: - internet: - ipv4_address: ${IPV4_PREFIX}.50 - stop_signal: SIGKILL - env_file: [ ".int_test.env" ] - environment: - - ACC=/chain.gz - volumes: - - ./../../vendor/chain.gz:/chain.gz - - ./protocol.privnet.yml:/config/protocol.privnet.yml - - ./node-wallet.json:/wallets/node-wallet.json - - ./config.yml:/wallets/config.yml - - ./../../vendor/hosts:/etc/hosts - - ./../../wallets/wallet.json:/wallets/wallet.json - -networks: - chain_int: - internet: - external: true - name: basenet_internet diff --git a/services/chain/node-wallet.json b/services/chain/node-wallet.json deleted file mode 100644 index 00bfe8e..0000000 --- a/services/chain/node-wallet.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "version": "3.0", - "name":null, - "accounts": [ - { - "address": "Nhfg3TbpwogLvDGVvAvqyThbsHgoSUKwtn", - "key": "6PYM8VdX2BSm7BSXKzV4Fz6S3R9cDLLWNrD9nMjxW352jEv3fsC8N3wNLY", - "label": "", - "contract": { - "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcJBVuezJw==", - "parameters": [ - { - "name": "parameter0", - "type": "Signature" - } - ], - "deployed": false - }, - "lock": false, - "extra":null, - "isDefault": false - }, - { - "address": "NVTiAjNgagDkTr5HTzDmQP9kPwPHN5BgVq", - "key": "6PYM8VdX2BSm7BSXKzV4Fz6S3R9cDLLWNrD9nMjxW352jEv3fsC8N3wNLY", - "label": "", - "contract": { - "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFEGe0Nw6", - "parameters": [ - { - "name": "parameter0", - "type": "Signature" - }, - { - "name": "parameter1", - "type": "Signature" - }, - { - "name": "parameter2", - "type": "Signature" - } - ], - "deployed": false - }, - "lock": false, - "extra":null, - "isDefault": false - }, - { - "address": "NfgHwwTi3wHAS8aFAN243C5vGbkYDpqLHP", - "key": "6PYM8VdX2BSm7BSXKzV4Fz6S3R9cDLLWNrD9nMjxW352jEv3fsC8N3wNLY", - "label": "", - "contract": { - "script": "EQwhArNiK/QBe9/jF8WK7V9MdT8ga324lgRvp9d0u8S/f43CEUGe0Nw6", - "parameters": [ - { - "name": "parameter0", - "type": "Signature" - } - ], - "deployed": false - }, - "lock": false, - "extra":null, - "isDefault": false - } - ], - "scrypt": { - "n": 16384, - "r": 8, - "p": 8 - }, - "extra": { - "Tokens": null - } -} diff --git a/services/chain/protocol.privnet.yml b/services/chain/protocol.privnet.yml deleted file mode 100644 index d9a6189..0000000 --- a/services/chain/protocol.privnet.yml +++ /dev/null @@ -1,48 +0,0 @@ -ProtocolConfiguration: - Magic: 56753 - MaxTraceableBlocks: 200000 - SecondsPerBlock: 1 - MemPoolSize: 50000 - StandbyCommittee: - - 02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2 - ValidatorsCount: 1 - SeedList: - - 172.200.0.1:20333 - VerifyBlocks: true - VerifyTransactions: true - P2PSigExtensions: false - -ApplicationConfiguration: - DBConfiguration: - Type: "boltdb" - BoltDBOptions: - FilePath: "./db/privnet.bolt" - NodePort: 20333 - Relay: true - DialTimeout: 3 - ProtoTickInterval: 2 - PingInterval: 30 - PingTimeout: 90 - MaxPeers: 10 - AttemptConnPeers: 5 - MinPeers: 0 - RPC: - Enabled: true - SessionEnabled: true - EnableCORSWorkaround: false - MaxGasInvoke: 15 - Port: 30333 - Prometheus: - Enabled: true - Port: 20001 - Pprof: - Enabled: true - Port: 20011 - UnlockWallet: - Path: "./wallets/node-wallet.json" - Password: "one" - P2PNotary: - Enabled: false - UnlockWallet: - Path: "./wallets/node-wallet.json" - Password: "one" diff --git a/services/ir/.ir.env b/services/ir/.ir.env index 73904ca..ddc40e6 100644 --- a/services/ir/.ir.env +++ b/services/ir/.ir.env @@ -17,9 +17,8 @@ NEOFS_IR_PROMETHEUS_ADDRESS=:9090 #NEOFS_IR_METRICS_SHUTDOWN_TIMEOUT=1m # Toggling the sidechain-only mode -NEOFS_IR_WITHOUT_MAINNET=false +NEOFS_IR_WITHOUT_MAINNET=true -NEOFS_IR_MAINNET_ENDPOINT_CLIENT_0_ADDRESS=ws://main-chain:30333/ws NEOFS_IR_MORPH_ENDPOINT_CLIENT_0_ADDRESS=ws://morph-chain:30333/ws NEOFS_IR_TIMERS_EMIT=50 NEOFS_IR_TIMERS_STOP_ESTIMATION_DIV=4 @@ -30,9 +29,7 @@ NEOFS_IR_TIMERS_DISTRIBUTE_BASIC_INCOME_DIV=4 NEOFS_IR_EMIT_STORAGE_AMOUNT=1000000000 NEOFS_IR_NETMAP_CLEANER_ENABLED=true -NEOFS_IR_CONTRACTS_FROSTFS=f5dba2f67baa3cbb5595f0a7e46adf564ec9407a NEOFS_IR_CONTRACTS_FROSTFSID=1943e9bb78a0fe2fe0c95fd2677eec2da6aa4aa5 -NEOFS_IR_CONTRACTS_PROCESSING=332016219b9eb48348fb12694409dbefe29bdf30 NEOFS_IR_MORPH_VALIDATORS=02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2 NEOFS_IR_AUDIT_PDP_MAX_SLEEP_INTERVAL=100ms diff --git a/services/ir/prepare.mk b/services/ir/prepare.mk index 5959964..fd7f253 100644 --- a/services/ir/prepare.mk +++ b/services/ir/prepare.mk @@ -1,3 +1,4 @@ # Deposit GAS from default wallet to FrostFS privnet contract prepare.ir: - @./bin/deposit.sh + @./bin/config.sh int ContainerFee 0 + @./bin/config.sh int ContainerAliasFee 0 diff --git a/services/chain/config.yml b/services/morph_chain/config.yml similarity index 100% rename from services/chain/config.yml rename to services/morph_chain/config.yml diff --git a/services/morph_chain/docker-compose.yml b/services/morph_chain/docker-compose.yml index a4cebf4..4cba4b3 100644 --- a/services/morph_chain/docker-compose.yml +++ b/services/morph_chain/docker-compose.yml @@ -2,7 +2,7 @@ version: "2.4" services: - neofs_morph_chain: + frostfs_morph_chain: image: ${NEOGO_IMAGE}:${NEOGO_VERSION} container_name: morph_chain command: ["node", "--config-path", "/config", "--privnet", "--debug"] @@ -17,6 +17,7 @@ services: volumes: - ./protocol.privnet.yml:/config/protocol.privnet.yml - ./node-wallet.json:/wallets/node-wallet.json + - ./config.yml:/wallets/config.yml - ./../../vendor/hosts:/etc/hosts - ./../../wallets/wallet.json:/wallets/wallet.json