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

Move exit_signature_deadline to oracles config #154

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/common/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ async def get_oracles() -> Oracles:
if exit_signature_recover_threshold > validators_threshold:
raise ValueError('Invalid exit signature threshold')

exit_signature_deadline = config['exit_signature_deadline']

if exit_signature_deadline < 0:
raise ValueError('Invalid exit signature deadline')

if len(public_keys) != len(set(public_keys)):
raise ValueError('Duplicate public keys in oracles config')

Expand All @@ -82,6 +87,7 @@ async def get_oracles() -> Oracles:
rewards_threshold=rewards_threshold,
validators_threshold=validators_threshold,
exit_signature_recover_threshold=exit_signature_recover_threshold,
exit_signature_deadline=exit_signature_deadline,
public_keys=public_keys,
endpoints=endpoints,
validators_approval_batch_limit=validators_approval_batch_limit,
Expand Down
2 changes: 2 additions & 0 deletions src/common/typings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@


@dataclass
# pylint: disable-next=too-many-instance-attributes
class Oracles:
rewards_threshold: int
validators_threshold: int
exit_signature_recover_threshold: int
exit_signature_deadline: int
public_keys: list[HexStr]
endpoints: list[list[str]]

Expand Down
4 changes: 0 additions & 4 deletions src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class Settings(metaclass=Singleton):
ipfs_fetch_endpoints: list[str]
validators_fetch_chunk_size: int
sentry_dsn: str
exit_signature_deadline: int

# pylint: disable-next=too-many-arguments,too-many-locals
def set(
Expand Down Expand Up @@ -122,9 +121,6 @@ def set(
'VALIDATORS_FETCH_CHUNK_SIZE', default=100, cast=int
)
self.sentry_dsn = decouple_config('SENTRY_DSN', default='')
self.exit_signature_deadline = decouple_config(
'EXIT_SIGNATURE_DEADLINE', default=600, cast=int
)

@property
def network_config(self) -> NetworkConfig:
Expand Down
2 changes: 1 addition & 1 deletion src/exits/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def get_oracles_approval(
) -> OraclesApproval:
"""Fetches approval from oracles."""
fork = await consensus_client.get_consensus_fork()
deadline = datetime.now(timezone.utc) + timedelta(seconds=settings.exit_signature_deadline)
deadline = datetime.now(timezone.utc) + timedelta(seconds=oracles.exit_signature_deadline)

# get exit signature shards
request = SignatureRotationRequest(
Expand Down
Loading