Skip to content

Commit

Permalink
Add deposit root check just before transaction (#233)
Browse files Browse the repository at this point in the history
* Add deposit root check just before transaction

Signed-off-by: cyc60 <[email protected]>

* Increase HOT_WALLET_MIN_BALANCE

Signed-off-by: cyc60 <[email protected]>

---------

Signed-off-by: cyc60 <[email protected]>
  • Loading branch information
cyc60 authored Nov 16, 2023
1 parent 13db5fe commit 84654a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/config/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def IS_SUPPORT_V2_MIGRATION(self) -> bool:
SECONDS_PER_BLOCK=Decimal(12),
GENESIS_FORK_VERSION=Web3.to_bytes(hexstr=HexStr('0x00000000')),
IS_POA=False,
HOT_WALLET_MIN_BALANCE=Web3.to_wei('0.01', 'ether'),
HOT_WALLET_MIN_BALANCE=Web3.to_wei('0.03', 'ether'),
SHAPELLA_FORK_VERSION=Web3.to_bytes(hexstr=HexStr('0x03000000')),
SHAPELLA_EPOCH=194048,
),
Expand Down Expand Up @@ -114,7 +114,7 @@ def IS_SUPPORT_V2_MIGRATION(self) -> bool:
SECONDS_PER_BLOCK=Decimal(12),
GENESIS_FORK_VERSION=Web3.to_bytes(hexstr=HexStr('0x01017000')),
IS_POA=False,
HOT_WALLET_MIN_BALANCE=Web3.to_wei('0.01', 'ether'),
HOT_WALLET_MIN_BALANCE=Web3.to_wei('0.03', 'ether'),
SHAPELLA_FORK_VERSION=Web3.to_bytes(hexstr=HexStr('0x01017000')),
SHAPELLA_EPOCH=256,
),
Expand Down Expand Up @@ -148,7 +148,7 @@ def IS_SUPPORT_V2_MIGRATION(self) -> bool:
SECONDS_PER_BLOCK=Decimal(12),
GENESIS_FORK_VERSION=Web3.to_bytes(hexstr=HexStr('0x00001020')),
IS_POA=True,
HOT_WALLET_MIN_BALANCE=Web3.to_wei('0.01', 'ether'),
HOT_WALLET_MIN_BALANCE=Web3.to_wei('0.03', 'ether'),
SHAPELLA_FORK_VERSION=Web3.to_bytes(hexstr=HexStr('0x03001020')),
SHAPELLA_EPOCH=162304,
),
Expand Down Expand Up @@ -177,7 +177,7 @@ def IS_SUPPORT_V2_MIGRATION(self) -> bool:
SECONDS_PER_BLOCK=Decimal('6.8'),
GENESIS_FORK_VERSION=Web3.to_bytes(hexstr=HexStr('0x00000064')),
IS_POA=False,
HOT_WALLET_MIN_BALANCE=Web3.to_wei('0.01', 'ether'),
HOT_WALLET_MIN_BALANCE=Web3.to_wei('0.03', 'ether'),
SHAPELLA_FORK_VERSION=Web3.to_bytes(hexstr=HexStr('0x0')),
SHAPELLA_EPOCH=0, # todo
),
Expand Down
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 84654a4

Please sign in to comment.