Exemplo n.º 1
0
 def wrapper_decorator(*args, **kwargs):
     field_name, field_value = func(*args, **kwargs)
     lock = FileLock(LOCK_PATH)
     with lock:
         config = read_json(NODE_CONFIG_FILEPATH)
         config[field_name] = field_value
         write_json(NODE_CONFIG_FILEPATH, config)
Exemplo n.º 2
0
def generate_wallets_config(schain_name):
    secret_key_share_filepath = get_secret_key_share_filepath(schain_name)
    secret_key_share_config = read_json(secret_key_share_filepath)
    wallets = {
        'ima': {
            'url': SGX_SERVER_URL,
            'keyShareName': secret_key_share_config['key_share_name'],
            't': secret_key_share_config['t'],
            'n': secret_key_share_config['n']
        }
    }
    common_public_keys = secret_key_share_config['common_public_key']
    for (i, value) in enumerate(common_public_keys):
        name = 'insecureBLSPublicKey' + str(i)
        wallets['ima'][name] = str(value)

    public_keys = secret_key_share_config['public_key']
    for (i, value) in enumerate(public_keys):
        name = 'insecureCommonBLSPublicKey' + str(i)
        wallets['ima'][name] = str(value)

    return wallets
Exemplo n.º 3
0
 def all(self) -> dict:
     return read_json(NODE_CONFIG_FILEPATH)
Exemplo n.º 4
0
 def wrapper_decorator(*args, **kwargs):
     field_name = func(*args, **kwargs)
     config = read_json(NODE_CONFIG_FILEPATH)
     return config.get(field_name)
Exemplo n.º 5
0
def get_resource_allocation_info():
    return read_json(RESOURCE_ALLOCATION_FILEPATH)
Exemplo n.º 6
0
def get_mp_addresses():
    ima_abi = read_json(MAINNET_PROXY_PATH)
    ima_mp_schain = None  # todo: unknown at the launch time, tbd
    ima_mp_mainnet = ima_abi['message_proxy_mainnet_address']
    return ima_mp_schain, ima_mp_mainnet
Exemplo n.º 7
0
#   it under the terms of the GNU Affero General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with this program.  If not, see <https://www.gnu.org/licenses/>.

import os
from tools.configs import CONFIG_FOLDER
from tools.helper import read_json

DATA_DIR_CONTAINER_PATH = '/data_dir'

SCHAIN_CONTAINER = 'schain'
IMA_CONTAINER = 'ima'

CONTAINER_NAME_PREFIX = 'skale'
CONTAINERS_FILENAME = 'containers.json'

CONTAINERS_FILEPATH = os.path.join(CONFIG_FOLDER, CONTAINERS_FILENAME)
CONTAINERS_INFO = read_json(CONTAINERS_FILEPATH)

CONTAINER_NOT_FOUND = 'not_found'
EXITED_STATUS = 'exited'
RUNNING_STATUS = 'running'