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

Depositor rework #164

Merged
merged 22 commits into from
Sep 8, 2023
Merged

Depositor rework #164

merged 22 commits into from
Sep 8, 2023

Conversation

F4ever
Copy link
Member

@F4ever F4ever commented Aug 10, 2023

No description provided.

@F4ever F4ever requested a review from a team as a code owner August 22, 2023 01:40
@F4ever F4ever force-pushed the feat/depositor-rework branch 2 times, most recently from 4403e84 to 5d14be5 Compare August 22, 2023 01:45
.env.example Show resolved Hide resolved
.env.example Show resolved Hide resolved
src/blockchain/contracts/lido.py Outdated Show resolved Hide resolved
tests/bots/test_timeout.py Show resolved Hide resolved
src/metrics/metrics.py Show resolved Hide resolved
src/blockchain/web3_extentions/transaction.py Show resolved Hide resolved
src/blockchain/deposit_strategy/interface.py Show resolved Hide resolved
@infloop
Copy link
Contributor

infloop commented Sep 6, 2023

@F4ever some of your commits are unverified, pls check GPG

@F4ever F4ever merged commit 31512d7 into develop Sep 8, 2023
5 checks passed
F4ever added a commit that referenced this pull request Sep 8, 2023
F4ever added a commit that referenced this pull request Sep 8, 2023
Revert "Merge pull request #164 from lidofinance/feat/depositor-rework"
F4ever added a commit that referenced this pull request Sep 11, 2023
F4ever added a commit that referenced this pull request Sep 11, 2023
Revert "Revert "Merge pull request #164 from lidofinance/feat/deposit…
.env.example Show resolved Hide resolved
Comment on lines +31 to +32
FLASHBOTS_RPC=https://relay-goerli.flashbots.net
FLASHBOT_SIGNATURE=0xbb0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ffaa
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

| RABBIT_MQ_URL | - | RabbitMQ url |
| RABBIT_MQ_USERNAME | - | RabbitMQ username for virtualhost |
| RABBIT_MQ_PASSWORD | - | RabbitMQ password for virtualhost |
| -------------------------------------- | --- _kafka is not used at the moment_ --- | ----------------------------------------- |
Copy link
Contributor

Choose a reason for hiding this comment

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

image

these lines don't look good on github

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed
#173

- Set WEB3_RPC_ENDPOINTS
- Set WALLET_PRIVATE_KEY
- Set CREATE_TRANSACTIONS to true
- Set TRANSPORTS to rabbit
Copy link
Contributor

Choose a reason for hiding this comment

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

in many readme and sample.env (maybe somewhere else) the variable is listed as TRANSPORTS but in the code MESSAGE_TRANSPORTS

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@@ -0,0 +1,4256 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

We mostly use yarn (and therefore yarn.lock) in js/ts projects. I would suggest using it for consistency

guardians_list = self.w3.lido.deposit_security_module.get_guardians()

def message_filter(message: DepositMessage) -> bool:
if message['guardianAddress'] not in guardians_list:
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like we have an unspoken convention here that guardians should send addresses as a checksum address. I would suggest to explicitly convert both addresses to the same formats

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed #173


| ATTEST_MESSAGE_PREFIX | blockNumber | blockHash | depositRoot | stakingModuleId | nonce |
"""
response = self.functions.depositBufferedEther(
Copy link
Contributor

Choose a reason for hiding this comment

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

response -> tx

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed
#173

Comment on lines +126 to +128
is_active = self.w3.lido.staking_router.is_staking_module_active(module_id)
is_deposits_paused = self.w3.lido.staking_router.is_staking_module_deposits_paused(module_id)
return is_active and not is_deposits_paused
Copy link
Contributor

Choose a reason for hiding this comment

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

The pause check is excessive. A module can be in one of 3 states: active, deposits paused, stopped. Thus, if the module is active than deposits can not be paused

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, quite unexpected)

class StakingRouterContract(ContractInterface):
abi_path = './interfaces/StakingRouter.json'

def get_max_deposits_count(
Copy link
Contributor

Choose a reason for hiding this comment

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

unused duplicate for get_staking_module_deposits_count

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

return recommended_max_gas

def _get_pending_base_fee(self):
base_fee_per_gas = self.w3.eth.get_block('pending')['baseFeePerGas']
Copy link
Contributor

Choose a reason for hiding this comment

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

If I remember correctly we had an issue with unavailability of pending block in some node during oracle development and used latest block because of it. Don't we want to make it more bulletproof here too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, found comment in Oracle about Erigon.
Just tested with Erigon - no exceptions found (maybe they fixed it).
I've done 1000 requests in 15 minutes - no issues.

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.

3 participants