-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconfig.py
More file actions
97 lines (81 loc) · 2.79 KB
/
Copy pathconfig.py
File metadata and controls
97 lines (81 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# -*- coding: utf-8 -*-
#
# This file is part of SKALE Transaction Manager
#
# Copyright (C) 2021 SKALE Labs
#
# This program is free software: you can redistribute it and/or modify
# 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
import sys
from functools import lru_cache
from pathlib import Path
from typing import List, Optional
from eth_typing import HexStr
from skale_core.settings import ( # type: ignore
ActiveSettings,
FairSettings,
SkaleSettings,
get_settings,
)
REDIS_URI: str = 'redis://@127.0.0.1:6379'
ETH_PRIVATE_KEY: Optional[HexStr] = None
LOCAL_SKALED_ENDPOINT_REDIS_KEY = 'node_config_fair_local_endpoint'
GAS_MULTIPLIER: float = 1.2
NODE_DATA_PATH = Path(os.getenv('NODE_DATA_PATH', '/skale_node_data'))
SETTINGS_FOLDER_PATH: Path = NODE_DATA_PATH / 'settings'
NODE_SETTINGS_PATH: Path = SETTINGS_FOLDER_PATH / 'node.toml'
INTERNAL_SETTINGS_PATH: Path = SETTINGS_FOLDER_PATH / 'internal.toml'
# General
RESTART_TIMEOUT: int = 3
BASE_WAITING_TIME: int = 60
CONFIRMATION_BLOCKS: int = 6
MAX_RESUBMIT_AMOUNT: int = 10
MAX_WAITING_TIME: int = 650 # TODO: determine value
UNDERPRICED_RETRIES = 5
ALLOWED_TS_DIFF = 300
DISABLE_GAS_ESTIMATION = False
TXRECORD_EXPIRATION = 24 * 60 * 60 # 1 day
DEFAULT_ID_LEN = 19
DEFAULT_GAS_LIMIT: int = 1000000
IMA_ID_SUFFIX = 'js'
STATSD_HOST: str = '127.0.0.1'
STATSD_PORT: int = 8125
# V1
AVG_GAS_PRICE_INC_PERCENT = 50
MAX_GAS_PRICE: int = 1000 * 10**9
GAS_PRICE_INC_PERCENT: int = 10
GRAD_GAS_PRICE_INC_PERCENT: int = 2
MIN_GAS_PRICE_INC_PERCENT: int = 5
# V2
BASE_FEE_ADJUSMENT_PERCENT = 50
TARGET_REWARD_PERCENTILE = 60
MIN_PRIORITY_FEE: int = 10**7
FEE_INC_PERCENT: int = 12
MAX_FEE_VALUE: int = 10**18
MIN_FEE_INC_PERCENT: int = 5
MAX_TX_CAP: int = 10**18
HARD_REPLACE_START_INDEX = 3
HARD_REPLACE_TIP_OFFSET = 10
def get_params() -> List[str]:
return list(filter(lambda v: not v.startswith('__') and v in os.environ, globals()))
for v in get_params():
type_ = type(getattr(sys.modules[__name__], v))
if not isinstance(None, type_):
casted = type_(os.environ[v])
else:
casted = os.environ[v]
globals()[v] = casted
@lru_cache
def get_node_settings() -> ActiveSettings:
return get_settings((SkaleSettings, FairSettings)) # type: ignore[return-value]