Skip to content

Commit

Permalink
Add deposit root check just before transaction
Browse files Browse the repository at this point in the history
Signed-off-by: cyc60 <[email protected]>
  • Loading branch information
cyc60 committed Nov 16, 2023
1 parent 804fef2 commit ed6b1da
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/validators/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
logger = logging.getLogger(__name__)


# pylint: disable-next=too-many-locals
# pylint: disable-next=too-many-locals,too-many-branches
async def register_validators(
keystores: Keystores,
remote_signer_config: RemoteSignerConfiguration | None,
Expand Down Expand Up @@ -140,6 +140,12 @@ async def register_validators(
e.threshold,
', '.join(e.failed_endpoints),
)
# compare validators root just before transaction to reduce reverted calls
if registry_root != await validators_registry_contract.get_registry_root():
logger.info(
'Registry root has changed during validators registration. Retrying...',
)
return

if len(validators) == 1:
validator = validators[0]
Expand Down

0 comments on commit ed6b1da

Please sign in to comment.