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

Deposits accounting #626

Merged
merged 15 commits into from
Feb 20, 2023
Merged

Conversation

Psirex
Copy link
Contributor

@Psirex Psirex commented Feb 17, 2023

Deposit accounting & contracts changes:

  • StakingRouter now accepts the precise amount of deposits to make. If StakingRouter can't make the requested number of deposits, it will revert the transaction.

  • StakingRouter doesn't return ETH to the Lido contract after the deposit, so the Lido.receiveStakingRouterDepositRemainder() method was removed.

  • StakingRouter.getStakingModuleMaxDepositsCount() method signature changed. It now accepts two arguments: stakingModuleId and the max amount of ether that might be deposited.

  • IStakingModule.obtainDepositData() now must return the exact number of requested keys. If StakingModule doesn't have enough deposit data items, it MUST revert

  • IStakingModule.obtainDepositData() now doesn't return depositsCount as the first item. Only publicKeys and signatures returned now

  • Assertion that deposited correct amount of ETH was moved from the BeaconChainDepositor contract to StakingRouter for clarity

  • Lido._markAsUnbuffered() method was removed. Now, the buffered ether value is updated in place on deposit, like in other methods.

  • Assert for unaccounted ether was removed from Lido. Previously such a check was relevant cause the deposits happened in the Lido contract itself. In the current implementation, ETH is sent to StakingRouter, where deposits happen, which contains assert that exactly the received amount of ETH was deposited.

  • Lido._getUnaccountedEther() method was removed

  • Lido.getDepositableEther() returns a value not multiple to 32 ether

  • Check that stakingModuleId is less than type(uint24).max was removed from Lido.deposit() cause external interface of staking modules declares id as uint256

@TheDZhon TheDZhon mentioned this pull request Feb 18, 2023
26 tasks
@Psirex Psirex marked this pull request as ready for review February 19, 2023 22:58
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.

It's awesome 😮

Good to know that it saves a bytecode size also:
image

test/helpers/assert.js Show resolved Hide resolved
@TheDZhon TheDZhon merged commit 62572d2 into feature/shapella-upgrade-followups Feb 20, 2023
@TheDZhon TheDZhon deleted the fix/deposit-flow branch February 20, 2023 13:15
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.

2 participants