2021-06-29 19:01:40 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Source env settings
|
|
|
|
. .env
|
|
|
|
. services/ir/.ir.env
|
|
|
|
|
|
|
|
# NeoGo binary path.
|
|
|
|
NEOGO="${NEOGO:-docker exec -it main_chain neo-go}"
|
|
|
|
|
|
|
|
# Wallet files to change config value
|
|
|
|
WALLET="${WALLET:-services/chain/node-wallet.json}"
|
|
|
|
WALLET_IMG="${WALLET_IMG:-wallets/node-wallet.json}"
|
|
|
|
|
|
|
|
# Wallet password that would be entered automatically; '-' means no password
|
|
|
|
PASSWD="one"
|
|
|
|
|
|
|
|
# Internal variables
|
2021-07-22 17:22:58 +00:00
|
|
|
if [[ -z "${NEOFS_NOTARY_DISABLED}" ]]; then
|
|
|
|
ADDR=`cat ${WALLET} | jq -r .accounts[2].address`
|
|
|
|
else
|
|
|
|
ADDR=`cat ${WALLET} | jq -r .accounts[0].address`
|
|
|
|
fi
|
2021-06-29 19:01:40 +00:00
|
|
|
|
2021-08-25 12:20:40 +00:00
|
|
|
# Grep Morph block time
|
|
|
|
SIDECHAIN_PROTO="${SIDECHAIN_PROTO:-services/morph_chain/protocol.privnet.yml}"
|
|
|
|
BLOCK_DURATION=`grep SecondsPerBlock < $SIDECHAIN_PROTO | awk '{print $2}'`
|
2021-09-21 14:59:35 +00:00
|
|
|
NETMAP_ADDR=`bin/resolve.sh netmap.neofs`
|
2021-08-25 12:20:40 +00:00
|
|
|
|
2021-06-29 19:01:40 +00:00
|
|
|
# Fetch current epoch value
|
2021-11-07 17:11:17 +00:00
|
|
|
EPOCH=`${NEOGO} contract testinvokefunction -r \
|
2022-03-03 12:54:27 +00:00
|
|
|
http://morph-chain.${LOCAL_DOMAIN}:30333 \
|
2021-09-21 14:59:35 +00:00
|
|
|
${NETMAP_ADDR} \
|
2021-06-29 19:01:40 +00:00
|
|
|
epoch | grep 'value' | awk -F'"' '{ print $4 }'`
|
|
|
|
|
|
|
|
echo "Updating NeoFS epoch to $((EPOCH+1))"
|
|
|
|
./bin/passwd.exp ${PASSWD} ${NEOGO} contract invokefunction \
|
|
|
|
-w ${WALLET_IMG} \
|
|
|
|
-a ${ADDR} \
|
2022-03-03 12:54:27 +00:00
|
|
|
-r http://morph-chain.${LOCAL_DOMAIN}:30333 \
|
2021-09-21 14:59:35 +00:00
|
|
|
${NETMAP_ADDR} \
|
2021-06-29 19:01:40 +00:00
|
|
|
newEpoch int:$((EPOCH+1)) -- ${ADDR}:Global
|
2021-08-25 12:20:40 +00:00
|
|
|
|
|
|
|
# Wait one Morph block to ensure the transaction broadcasted
|
|
|
|
sleep $BLOCK_DURATION
|