Skip to content

Commit 41bbef0

Browse files
authored
Merge pull request #749 from lidofinance/feat/revert-5.2-5.3
Feat: Revert 5.2 and 5.3
2 parents b978d98 + 7f50620 commit 41bbef0

File tree

15 files changed

+53
-532
lines changed

15 files changed

+53
-532
lines changed

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,6 @@ In manual mode all sleeps are disabled and `ALLOW_REPORTING_IN_BUNKER_MODE` is T
203203
| `CSM_ORACLE_MAX_CONCURRENCY` | Max count of dedicated workers for CSM module | False | `2` |
204204
| `CACHE_PATH` | Directory to store cache for CSM module | False | `.` |
205205
206-
### Using bundling with private relays
207-
| Name | Description | Example value |
208-
|--------------------------------|------------------------------------|-------------------------------|
209-
| `PRIVATE_RELAYS_LIST` | List of private relays RPC | `http://relay1,http://relay2` |
210-
| `BUNDLE_GAS_LIMIT_FOR_EACH_TX` | Gas limit for bundled transactions | `7000000` |
211-
| `BUNDLE_TIMEOUT_SECONDS` | Bundling timeout | `1368` |
212-
213206
### Mainnet variables
214207
> LIDO_LOCATOR_ADDRESS=0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb
215208
> ALLOW_REPORTING_IN_BUNKER_MODE=False

assets/NodeOperatorRegistry.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/constants.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343
SHARE_RATE_PRECISION_E27 = 10**27
4444
TOTAL_BASIS_POINTS = 10000
4545

46-
# Staking modules inherited from NOR that support reward distribution
47-
CURATED_MODULE_TYPE = b'curated-onchain-v1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
48-
4946
# Local constants
5047
GWEI_TO_WEI = 10**9
5148
MAX_BLOCK_GAS_LIMIT = 30_000_000

src/modules/accounting/accounting.py

Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import logging
22
from collections import defaultdict
3-
from datetime import datetime
43
from time import sleep
5-
from typing import cast
64

7-
from eth_typing import ChecksumAddress
85
from hexbytes import HexBytes
96
from web3.exceptions import ContractCustomError
107
from web3.types import Wei
118

129
from src import variables
13-
from src.constants import SHARE_RATE_PRECISION_E27, CURATED_MODULE_TYPE
10+
from src.constants import SHARE_RATE_PRECISION_E27
1411
from src.modules.accounting.third_phase.extra_data import ExtraDataService
1512
from src.modules.accounting.third_phase.types import ExtraData, FormatList
1613
from src.modules.accounting.types import (
@@ -34,7 +31,6 @@
3431
from src.metrics.prometheus.duration_meter import duration_meter
3532
from src.modules.submodules.types import ZERO_HASH
3633
from src.providers.execution.contracts.accounting_oracle import AccountingOracleContract
37-
from src.providers.execution.contracts.staking_module import NodeOperatorRegistry
3834
from src.services.validator_state import LidoValidatorStateService
3935
from src.modules.submodules.consensus import ConsensusModule, InitialEpochIsYetToArriveRevert
4036
from src.modules.submodules.oracle_module import BaseModule, ModuleExecuteDelay
@@ -44,7 +40,6 @@
4440
from src.utils.cache import global_lru_cache as lru_cache
4541
from src.utils.units import gwei_to_wei
4642
from src.variables import ALLOW_REPORTING_IN_BUNKER_MODE
47-
from src.web3py.extensions.tx_bundle import TransactionBundle
4843
from src.web3py.types import Web3
4944
from src.web3py.extensions.lido_validators import StakingModule
5045

@@ -302,9 +297,8 @@ def simulate_rebase_after_report(
302297
)
303298

304299
def get_shares_to_burn(self, blockstamp: ReferenceBlockStamp) -> int:
305-
# shares_data = self.w3.lido_contracts.burner.get_shares_requested_to_burn(blockstamp.block_hash)
306-
# return shares_data.cover_shares + shares_data.non_cover_shares
307-
return 0
300+
shares_data = self.w3.lido_contracts.burner.get_shares_requested_to_burn(blockstamp.block_hash)
301+
return shares_data.cover_shares + shares_data.non_cover_shares
308302

309303
def _get_slots_elapsed_from_last_report(self, blockstamp: ReferenceBlockStamp):
310304
chain_conf = self.get_chain_config(blockstamp)
@@ -415,51 +409,3 @@ def _combine_report_parts(
415409
extra_data_hash=extra_data.data_hash,
416410
extra_data_items_count=extra_data.items_count,
417411
)
418-
419-
420-
# --- TX bundling ---
421-
@staticmethod
422-
def _use_private_relays(blockstamp: ReferenceBlockStamp) -> bool:
423-
# If BUNDLE_SEND_TIMEOUT seconds have passed since the reference slot was validated, use the classic flow to send the transaction.
424-
return bool(variables.PRIVATE_RELAYS_LIST) and datetime.now().timestamp() <= blockstamp.block_timestamp + variables.BUNDLE_TIMEOUT_SECONDS
425-
426-
def _get_sm_contract(self, address: ChecksumAddress) -> NodeOperatorRegistry:
427-
return cast(
428-
NodeOperatorRegistry,
429-
self.w3.eth.contract(
430-
address=address,
431-
ContractFactoryClass=NodeOperatorRegistry,
432-
)
433-
)
434-
435-
def _process_report_data(self, blockstamp: ReferenceBlockStamp, report_data: tuple, report_hash: HexBytes):
436-
if not self._use_private_relays(blockstamp):
437-
super()._process_report_data(blockstamp, report_data, report_hash)
438-
return
439-
440-
if not self._is_main_data_submittable(report_hash):
441-
return
442-
443-
contract_version = self.report_contract.get_contract_version(blockstamp.block_hash)
444-
445-
logger.info({'msg': f'Send report data via private relay. Contract version: [{contract_version}]'})
446-
txs = [self.report_contract.submit_report_data(report_data, contract_version)]
447-
448-
logger.info({'msg': 'Bundle extra data transactions.'})
449-
extra_data = self.get_extra_data(blockstamp)
450-
if extra_data.format == FormatList.EXTRA_DATA_FORMAT_LIST_EMPTY.value:
451-
txs.append(self.report_contract.submit_report_extra_data_empty())
452-
else:
453-
for tx_data in extra_data.extra_data_list:
454-
txs.append(self.report_contract.submit_report_extra_data_list(tx_data))
455-
456-
logger.info({'msg': 'Bundle reward distribution transactions.'})
457-
staking_modules = self.w3.lido_contracts.staking_router.get_staking_modules()
458-
for staking_module in staking_modules:
459-
ism: NodeOperatorRegistry = self._get_sm_contract(staking_module.staking_module_address)
460-
461-
if ism.get_type() == CURATED_MODULE_TYPE:
462-
txs.append(ism.distribute_reward())
463-
464-
logger.info({'msg': f'Prepared bundle. Txs count: {len(txs)}'})
465-
TransactionBundle.send_tx_bundle(self.w3, txs)

src/modules/submodules/consensus.py

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -310,24 +310,11 @@ def _process_report_hash(self, blockstamp: ReferenceBlockStamp, report_hash: Hex
310310
return None
311311

312312
def _process_report_data(self, blockstamp: ReferenceBlockStamp, report_data: tuple, report_hash: HexBytes):
313-
if not self._is_main_data_submittable(report_hash):
314-
return
315-
316-
self._sleep_delay(blockstamp)
317-
318-
contract_version = self.report_contract.get_contract_version(blockstamp.block_hash)
319-
320-
logger.info({'msg': f'Send report data. Contract version: [{contract_version}]'})
321-
# If data already submitted transaction will be locally reverted, no need to check status manually
322-
self._submit_report(report_data, contract_version)
323-
324-
def _is_main_data_submittable(self, report_hash: HexBytes) -> bool:
325-
"""Checks if provided data can be submitted to the contract"""
326313
latest_blockstamp, member_info = self._get_latest_data()
327314

328315
if member_info.current_frame_consensus_report == ZERO_HASH:
329316
logger.info({'msg': 'Quorum is not ready.'})
330-
return False
317+
return
331318

332319
if HexBytes(member_info.current_frame_consensus_report) != report_hash:
333320
msg = 'Oracle`s hash differs from consensus report hash.'
@@ -336,16 +323,11 @@ def _is_main_data_submittable(self, report_hash: HexBytes) -> bool:
336323
'consensus_report_hash': HexBytes(member_info.current_frame_consensus_report).hex(),
337324
'report_hash': report_hash.hex(),
338325
})
339-
return False
326+
return
340327

341328
if self.is_main_data_submitted(latest_blockstamp):
342329
logger.info({'msg': 'Main data already submitted.'})
343-
return False
344-
345-
return True
346-
347-
def _sleep_delay(self, blockstamp: ReferenceBlockStamp):
348-
latest_blockstamp = self._get_latest_blockstamp()
330+
return
349331

350332
slots_to_sleep = self._get_slot_delay_before_data_submit(latest_blockstamp)
351333
if slots_to_sleep:
@@ -355,11 +337,21 @@ def _sleep_delay(self, blockstamp: ReferenceBlockStamp):
355337
for _ in range(slots_to_sleep):
356338
sleep(chain_configs.seconds_per_slot)
357339

358-
latest_blockstamp = self._get_latest_blockstamp()
340+
latest_blockstamp, member_info = self._get_latest_data()
359341
if self.is_main_data_submitted(latest_blockstamp):
360342
logger.info({'msg': 'Main data already submitted.'})
361343
return
362344

345+
if self.is_main_data_submitted(latest_blockstamp):
346+
logger.info({'msg': 'Main data already submitted.'})
347+
return
348+
349+
contract_version = self.report_contract.get_contract_version(blockstamp.block_hash)
350+
351+
logger.info({'msg': f'Send report data. Contract version: [{contract_version}]'})
352+
# If data already submitted transaction will be locally reverted, no need to check status manually
353+
self._submit_report(report_data, contract_version)
354+
363355
def _get_latest_data(self) -> tuple[BlockStamp, MemberInfo]:
364356
latest_blockstamp = self._get_latest_blockstamp()
365357
logger.debug({'msg': 'Get latest blockstamp.', 'value': latest_blockstamp})

src/providers/execution/contracts/staking_module.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/services/exit_order_iterator.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,10 @@ def _no_predicate(self, node_operator: NodeOperatorStats) -> tuple:
270270

271271
@staticmethod
272272
def _no_force_predicate(node_operator: NodeOperatorStats) -> int:
273-
# return ValidatorExitIterator._get_expected_validators_diff(
274-
# node_operator.predictable_validators,
275-
# node_operator.force_exit_to,
276-
# )
277-
return 0
273+
return ValidatorExitIterator._get_expected_validators_diff(
274+
node_operator.predictable_validators,
275+
node_operator.force_exit_to,
276+
)
278277

279278
@staticmethod
280279
def _no_soft_predicate(node_operator: NodeOperatorStats) -> int:

src/variables.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,6 @@
8585

8686
CACHE_PATH: Final = Path(os.getenv("CACHE_PATH", "."))
8787

88-
PRIVATE_RELAYS_LIST = []
89-
if PRIVATE_RELAYS_STR := os.getenv('PRIVATE_RELAYS_LIST', ''):
90-
PRIVATE_RELAYS_LIST = PRIVATE_RELAYS_STR.split(',')
91-
92-
BUNDLE_GAS_LIMIT_FOR_EACH_TX = int(os.getenv('BUNDLE_GAS_LIMIT_FOR_EACH_TX', 7_000_000))
93-
# Time in seconds after which bundling will be skipped and the default method will be used to send the transactions.
94-
BUNDLE_TIMEOUT_SECONDS = int(os.getenv('BUNDLE_TIMEOUT_SECONDS', 15 * 60 + 2 * 32 * 12))
9588

9689
def check_all_required_variables(module: OracleModule):
9790
errors = check_uri_required_variables()
@@ -151,7 +144,6 @@ def raise_from_errors(errors):
151144
'HEALTHCHECK_SERVER_PORT': HEALTHCHECK_SERVER_PORT,
152145
'MAX_CYCLE_LIFETIME_IN_SECONDS': MAX_CYCLE_LIFETIME_IN_SECONDS,
153146
'CACHE_PATH': CACHE_PATH,
154-
'PRIVATE_RELAYS_LIST': PRIVATE_RELAYS_LIST,
155147
}.items()
156148
}
157149

src/web3py/extensions/tx_bundle.py

Lines changed: 0 additions & 112 deletions
This file was deleted.

0 commit comments

Comments
 (0)