Use neofs-adm to tick epoch

This is a more convenient way to tick epoch when we have multiple moprh blockchain nodes.
Approach that we use in devenv would require multi-signed transaction which is cumbersome.

Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
Vladimir Domnich 2022-07-13 18:30:57 +04:00
parent cbaecc60dc
commit ab85389d59
4 changed files with 35 additions and 16 deletions

View file

@ -1,10 +1,12 @@
#!/usr/bin/python3.9
import contract
from robot.api import logger
from robot.api.deco import keyword
from common import IR_WALLET_PATH, IR_WALLET_PASS, MORPH_ENDPOINT
import contract
import wrappers
from common import (IR_WALLET_PATH, IR_WALLET_PASS, MORPH_ENDPOINT, NEOFS_ADM_EXEC,
NEOFS_ADM_CONFIG_PATH)
ROBOT_AUTO_KEYWORDS = False
@ -22,6 +24,15 @@ def get_epoch():
@keyword('Tick Epoch')
def tick_epoch():
if NEOFS_ADM_EXEC and NEOFS_ADM_CONFIG_PATH:
# If neofs-adm is available, then we tick epoch with it (to be consistent with UAT tests)
cmd = f"{NEOFS_ADM_EXEC} morph force-new-epoch -c {NEOFS_ADM_CONFIG_PATH}"
logger.info(f"Executing shell command: {cmd}")
out = wrappers.run_sh(cmd)
logger.info(f"Command completed with output: {out}")
return
# Otherwise we tick epoch using transaction
cur_epoch = get_epoch()
return contract.invoke_contract_multisig(
contract.get_netmap_contract_hash(MORPH_ENDPOINT),