Skip to content

Migrate configuration to Pydantic settings#261

Merged
dmytrotkk merged 16 commits into
developfrom
optimize-config
Feb 18, 2026
Merged

Migrate configuration to Pydantic settings#261
dmytrotkk merged 16 commits into
developfrom
optimize-config

Conversation

@alexgex
Copy link
Copy Markdown
Collaborator

@alexgex alexgex commented Feb 15, 2026

This pull request introduces several important updates to improve configuration management, time handling, and logging throughout the codebase. The main changes include centralizing configuration using the SkaleSettings class, enforcing timezone-aware datetimes, updating logging to better handle sensitive information, and updating dependencies and test fixtures for better consistency and reliability.

Configuration and Initialization Improvements:

  • Refactored configuration management to use the SkaleSettings class, updating initialization of BountyAgent, init_skale, and related functions to accept a settings parameter, and centralized settings file paths in configs/__init__.py [1] [2] [3] [4] [5] [6] [7].
  • Updated test fixtures to provide and use SkaleSettings, ensuring tests use consistent configuration and environment variables [1] [2] [3] [4].

Timezone and Date Handling:

  • Standardized all datetime usage to be timezone-aware and in UTC, replacing datetime.utcnow() and datetime.utcfromtimestamp() with datetime.now(timezone.utc) and datetime.fromtimestamp(..., timezone.utc) across the codebase and tests [1] [2] [3] [4] [5] [6] [7] [8] [9].

Logging and Sensitive Data Handling:

  • Enhanced the logging system to pass sgx_url and endpoint into file handlers, and updated the compose_hiding_patterns function to dynamically hide sensitive information based on these values [1] [2] [3].

Dependency and Environment Updates:

  • Upgraded the skale.py dependency to version 7.12dev2 for improved compatibility and features.
  • Added DEFAULT_GAS_PRICE_WEI to the environment variables and ensured low gas price is used in tests to prevent insufficient funds errors [1] [2].

Test and Helper Function Updates:

  • Updated helper and test functions to work with the new configuration system, and fixed method calls to align with the latest SkaleManager interface [1] [2] [3].

These changes collectively improve maintainability, reliability, and security in both production and testing environments.

@alexgex alexgex requested a review from dmytrotkk February 15, 2026 20:35
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 15, 2026

Codecov Report

❌ Patch coverage is 69.76744% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.64%. Comparing base (0d2a133) to head (61985af).
⚠️ Report is 17 commits behind head on develop.

Files with missing lines Patch % Lines
bounty_agent.py 53.84% 6 Missing ⚠️
tools/logger.py 82.60% 4 Missing ⚠️
tools/helper.py 57.14% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #261      +/-   ##
===========================================
- Coverage    71.64%   71.64%   -0.01%     
===========================================
  Files            4        4              
  Lines          261      268       +7     
===========================================
+ Hits           187      192       +5     
- Misses          74       76       +2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread tools/helper.py
STATE_FILEPATH,
)
from configs.web3 import ENDPOINT, MANAGER_CONTRACTS
from tools.exceptions import NodeNotFoundException
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why configs.web3 module is still present in the repo?

@dmytrotkk dmytrotkk linked an issue Feb 18, 2026 that may be closed by this pull request
@dmytrotkk dmytrotkk merged commit 291acde into develop Feb 18, 2026
3 of 6 checks passed
@dmytrotkk dmytrotkk deleted the optimize-config branch February 18, 2026 19:37
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.

Migrate configs to the pydantic-settings

2 participants