Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge sync node to develop, update monitors logic #1045

Merged
merged 110 commits into from
Mar 6, 2024

Conversation

dmytrotkk
Copy link
Collaborator

@dmytrotkk dmytrotkk commented Feb 7, 2024

This PR merges sync-node branch into develop with minor modifications to the codebase to incorporate sync node into the new node architecture with separate config/skaled monitors.

Breaking news:

1 new monitor added

Existing monitors from the regular node are reused for the sync node.

Monitors available on the sync node:

  • NoConfigSkaledMonitor
  • RecreateSkaledMonitor
  • UpdateConfigSkaledMonitor
  • ReloadGroupSkaledMonitor

Also, SyncConfigMonitor was added to handle config generation on sync node.

Tests were slightly modified to work with the new sync node params, no new tests added.
No performance changes.

Fixes https://github.com/skalenetwork/internal-support/issues/907

dmytrotkk added 30 commits May 12, 2022 19:54
…-node

SKALE-779 Add fix for schain finish_ts
…-node

SKALE-779 Add generate IMA sChain ABI
…-node

SKALE-779 Fix ecdsa_key_name for sync node
Hotfix: add firewall rules to sync monitor and SSL reload support
Copy link

codecov bot commented Feb 13, 2024

Codecov Report

Attention: 111 lines in your changes are missing coverage. Please review.

Comparison is base (b049f2b) 81.43% compared to head (ae8f90b) 80.88%.

Files Patch % Lines
sync_node.py 0.00% 52 Missing ⚠️
core/schains/volume.py 57.14% 15 Missing ⚠️
core/schains/process_manager.py 14.28% 12 Missing ⚠️
core/schains/monitor/skaled_monitor.py 31.25% 11 Missing ⚠️
core/schains/monitor/config_monitor.py 20.00% 8 Missing ⚠️
core/schains/monitor/main.py 14.28% 6 Missing ⚠️
core/schains/monitor/action.py 86.66% 2 Missing ⚠️
core/schains/config/node_info.py 92.30% 1 Missing ⚠️
core/schains/config/static_accounts.py 91.66% 1 Missing ⚠️
tools/docker_utils.py 66.66% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##           v2.7.x    #1045      +/-   ##
==========================================
- Coverage   81.43%   80.88%   -0.56%     
==========================================
  Files         101      103       +2     
  Lines        5709     5900     +191     
==========================================
+ Hits         4649     4772     +123     
- Misses       1060     1128      +68     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dmytrotkk dmytrotkk marked this pull request as ready for review February 13, 2024 19:52
) -> SChainConfig:
"""Main function that is used to generate sChain config"""
logger.info(
f'Going to generate sChain config for {schain["name"]}, '
f'node_name: {node["name"]}, node_id: {node_id}, rotation_id: {rotation_id}, '
f'ecdsa keyname: {ecdsa_key_name}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to remove keyname and add sync_node logging.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

'info-acceptors': 1,
**self.static_node_info
}
}
if self.archive is not None and self.sync_node:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to simply put true/false for archiveMode / syncFromCatchup.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

wallets = {} if sync_node else generate_wallets_config(schain['name'], rotation_id)

if ecdsa_key_name is None:
logger.warning(f'Generating CurrentNodeInfo for {schain["name"]}, ecdsa_key_name is None')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a warning if sync node=true, since it's expected. Also if for sync_node=false it's better to raise and exception.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

@@ -113,8 +117,8 @@ def monitor_ima_container(
) -> None:
schain_name = schain["name"]

if DISABLE_IMA:
logger.info(f'{schain_name} - IMA is disabled, skipping')
if SYNC_NODE:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this log line can be ommited.

Copy link
Collaborator Author

@dmytrotkk dmytrotkk Feb 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed log only

mon = RegularConfigMonitor(config_am, config_checks)

if SYNC_NODE:
logger.info('Sync node mode, running config checks')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Config check was executed before. It's better to remove the line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to running config monitor

elif is_config_update_time(status, skaled_status):
mon_type = UpdateConfigSkaledMonitor
elif is_reload_group_mode(status, action_manager.upstream_finish_ts):
mon_type = ReloadGroupSkaledMonitor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about ReloadIpSkaledMonitor?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added ReloadIpSkaledMonitor to sync node

tools/logger.py Outdated
@@ -87,6 +88,9 @@ def init_logger(
log_file_path=None,
debug_file_path=None
):
# for handler in logging.root.handlers[:]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@@ -45,3 +49,4 @@

ADMIN_LOG_FORMAT = '[%(asctime)s %(levelname)s][%(process)d][%(processName)s][%(threadName)s] - %(name)s:%(lineno)d - %(message)s' # noqa
API_LOG_FORMAT = '[%(asctime)s] %(process)d %(levelname)s %(url)s %(module)s: %(message)s' # noqa
SYNC_LOG_FORMAT = '[%(asctime)s %(levelname)s] - %(name)s:%(lineno)d - %(message)s' # noqa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to use same log formant for regular and sync nodes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to ADMIN_LOG_FORMAT

f'--aa no --ssl-key {ssl_key_path} --ssl-cert {ssl_cert_path}'
)
print(container_opts, 'IVD')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

requirements.txt Outdated
@@ -30,3 +30,5 @@ pyOpenSSL==23.1.1
python-dateutil==2.8.2
python-telegram-bot==12.8
sh==1.14.1

urllib3<2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary anymore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@badrogger badrogger merged commit 032f899 into v2.7.x Mar 6, 2024
4 of 6 checks passed
@badrogger badrogger deleted the merge-sync-node-to-develop branch March 6, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants