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

Eth steth #459

Merged
merged 22 commits into from
Jan 29, 2024
Merged

Eth steth #459

merged 22 commits into from
Jan 29, 2024

Conversation

sergeyWh1te
Copy link
Contributor

@sergeyWh1te sergeyWh1te commented Jan 17, 2024

Lido Ethereum StETH bot

Supported chains

  • Ethereum mainnet

Alerts

  1. StETH operations
    1. HandleBlock
      1. 🚨🚨🚨 Buffered ETH drain (checks each block)
      2. 🚨 Huge depositable ETH amount (checks every 100 blocks)
      3. ⚠️ High depositable ETH amount (checks every 100 blocks)
      4. ⚠️ Low deposit executor balance (checks every 100 blocks)
      5. ⚠️ Unspent staking limit below 10% (checks every 25 blocks)
      6. 📉 Unspent staking limit below 30% (checks every 25 blocks)
    2. HandleTransaction
      1. Deposit Security events
      2. 🚨 Deposit Security: Deposits paused
      3. 🚨 Deposit Security: Guardian quorum changed
      4. 🚨 Deposit Security: Owner changed
      5. ⚠️ Deposit Security: Deposits resumed
      6. ⚠️ Deposit Security: Guardian added
      7. ⚠️ Deposit Security: Guardian removed
      8. ⚠️ Deposit Security: Max deposits changed
      9. ⚠️ Deposit Security: Min deposit block distance changed
    3. Lido events
      1. 🚨🚨🚨 Lido: Stopped 🚨🚨🚨
      2. 🚨🚨🚨 Share rate unexpected has changed
      3. 🚨 Lido: Staking limit removed
      4. 🚨 Lido: Locator set
      5. ⚠️ Lido: Resumed
      6. 🚨 Lido: Staking paused
      7. ⚠️ Lido: Staking resumed
      8. ⚠️ Lido: Staking limit set
      9. ⚠️ Lido: Funds recovered to vault
      10. ⚠️ Lido: Contract version set
      11. ℹ️ Lido: Token rebased
    4. Insurance fund events
      1. 🚨 Insurance fund: ERC20 transferred
      2. 🚨 Insurance fund: Ownership transferred
      3. ⚠️ Insurance fund: ETH transferred
      4. ⚠️ Insurance fund: ERC1155 transferred
      5. ⚠️ Insurance fund: ERC721 transferred
    5. Burner events
      1. ℹ️ Lido Burner: ERC20 recovered
      2. ℹ️ Lido Burner: ERC721 recovered
  2. Withdrawals
    1. HandleBlock runs on each 100-th block or one per 20 minutes
      1. ⚠️ Withdrawals: % of stake limit is spent and unfinalized queue is on par with drained stake
        limit
      2. ⚠️ Withdrawals: unfinalized queue is more than 100_000 stETH
      3. ⚠️ Withdrawals: unfinalized queue wait time is more than 1 day
      4. ⚠️ Withdrawals: ${unclaimedSizeRate.times(100).toFixed(2)}% of finalized requests are unclaimed
      5. ⚠️ Withdrawals: unclaimed requests size is more than withdrawal queue balance
    2. HandleTransaction
      1. 🚨 Withdrawals: BUNKER MODE ON! 🚨
      2. 🚨 Withdrawals: contract was paused
      3. ⚠️ Withdrawals: BUNKER MODE OFF! ✅
      4. ℹ️ Huge stETH withdrawal requests batch
      5. ⚠️ Withdrawals: the sum of received withdrawal requests since the last rebase greater than 150_000 stETH (max
        staking limit)
      6. ⚠️ Withdrawals: claimed amount is more than requested
      7. ⚠️ Withdrawals: contract was unpaused
  3. GateSeal
    1. HandleBlock runs on each next block
      1. 🚨 GateSeal: actual address doesn't have PAUSE_ROLE for contracts
      2. 🚨 GateSeal: is expired!
      3. 🚨️ GateSeal: is expired. Update code!
      4. ⚠️ GateSeal: default GateSeal address in forta agent is expired
      5. ⚠️️ GateSeal: default GateSeal address in forta agent doesn't have PAUSE_ROLE for contracts
      6. ⚠️ GateSeal: is about to be expired
    2. HandleTransaction
      1. 🚨🚨🚨 GateSeal: is sealed 🚨🚨🚨
      2. 🚨 GateSeal: is expired
  4. Vaults
    1. Handleblock
      1. 🚨🚨🚨 Withdrawal Vault balance mismatch. [without oracle report]
      2. 🚨🚨🚨 Withdrawal Vault balance mismatch. [within oracle report]
      3. 🚨🚨🚨 EL Vault balance mismatch. [without oracle report]
      4. 🚨🚨🚨 EL Vault balance mismatch. [within oracle report]
      5. 💵 Withdrawal Vault Balance significant change (checks every on 100-th block)
      6. 💵 EL Vault Balance significant change
    2. HandleTransaction
      1. 🚨 Burner shares transfer

Development (Forta specific)

Edit alerting-forta/<SUBMODULE>/forta.config.json and set jsonRpcUrl to your JSON-RPC provider. Install deps:

yarn install

Running in a live mode:

yarn start:dev

Testing on a specific block/range/transaction:

yarn block 13626668
yarn range '13626667..13626668'
yarn tx 0x2d2774c04e3faf9f17cd26e0978bb812081b9d0b5cc6fd8bf04cc441f92c0a8c

Copy link
Contributor

@arwer13 arwer13 left a comment

Choose a reason for hiding this comment

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

Going to review more, please don't merge yet if no hurry

ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
@sergeyWh1te
Copy link
Contributor Author

Going to review more, please don't merge yet if no hurry

I'm going to cover all code by tests. I ain't hurrying at all)

Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

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

Pretty good, thank you! 👍

Left some suggestions and considerations.

ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/src/utils/constants.testnet.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@arwer13 arwer13 left a comment

Choose a reason for hiding this comment

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

Huuuuge 🐘🚀

Left some comments, going to bake more later.
I know lots of the are related to the copied code, sorry. But it looks like a good opportunity to review and improved already existed codebase.

ethereum-steth-v2/src/agent.ts Outdated Show resolved Hide resolved
ethereum-steth-v2/src/agent.ts Show resolved Hide resolved
ethereum-steth-v2/src/app.ts Outdated Show resolved Hide resolved
ethereum-steth-v2/src/entity/gate_seal.ts Outdated Show resolved Hide resolved
ethereum-steth-v2/src/clients/eth_provider.ts Outdated Show resolved Hide resolved
ethereum-steth-v2/src/clients/eth_provider.ts Outdated Show resolved Hide resolved
ethereum-steth-v2/src/clients/eth_provider.ts Outdated Show resolved Hide resolved
ethereum-steth-v2/src/entity/metadata.ts Show resolved Hide resolved
arwer13
arwer13 previously approved these changes Jan 26, 2024
Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

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

Getting closer than ever before 👍

Please consider implementing the suggested changes for the sake of further perfection 😁

ethereum-steth-v2/src/services/vault/Vault.srv.ts Outdated Show resolved Hide resolved
ethereum-steth-v2/src/services/vault/Vault.srv.ts Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
ethereum-steth-v2/README.md Outdated Show resolved Hide resolved
TheDZhon
TheDZhon previously approved these changes Jan 29, 2024
Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

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

LGTM

vgorkavenko
vgorkavenko previously approved these changes Jan 29, 2024
@sergeyWh1te sergeyWh1te removed the request for review from dgusakov January 29, 2024 12:35
arwer13
arwer13 previously approved these changes Jan 29, 2024
bulbozaur
bulbozaur previously approved these changes Jan 29, 2024
@sergeyWh1te sergeyWh1te removed request for a team January 29, 2024 13:24
@sergeyWh1te sergeyWh1te merged commit e0d4f98 into main Jan 29, 2024
5 checks passed
@sergeyWh1te sergeyWh1te deleted the eth-steth branch January 29, 2024 13:25
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.

5 participants