-
Notifications
You must be signed in to change notification settings - Fork 193
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
WIP: switch to using merkle proofs to verify signing keys stored offchain #347
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
refactor: create functions to pad+concat an array of keys/sigs
feat: modify functions to invalidate keys to clear merkle root
…ate multiple batches
test: skip un-migrated tests
The number of keys used by the operator at the time of a given batch's use is used as a nonce.
This condition is already enforced by checks on the number of keys available
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a submission for the Open DeFI Hackathon project Off-Chain Storage & Management For Lido Validators' Keys
which aims to reduce the ETH transaction costs required for adding/using signing keys.
The general idea is that the public keys submitted by node operators are repeatedly hashed to calculate a merkle root which is then stored within the
NodeOperator
struct - reducing the storage usage to a single slot per node operator.Each leaf of the tree is made up of a batch of 8 keys to minimise the number of merkle proofs to be verified later. These batches of signing keys are emitted as events which can be picked up within the subgraph (Or pulled out of the transaction data manually or even published in a less flashy web3 way).
The process that node operators have to follow is unchanged except they must provide a number of signing keys which neatly divides by 8 (to avoid half-filled leaves). All existing tooling can be used with this minor modification.
Keeper bots can pull the list of keys+sigs provided by each node operator, select which node operators are due to be chosen next (according to the existing rules on stake, etc.), choose unused leaves of the merkle trees and calculate merkle proofs. These can then be submitted to
Lido.depositBufferedEther
to be verified and then used to stake buffered ETH.I've updated a number of the tests to make use of the new method of submitting. Most notably
lido.test.js
andnode-operator-registry.test.js
now use this new method of providing keys as a proof of concept. Feel free to reach out if you run into any issues testing this.There's a fair bit of work remaining to get to a production ready state:
Lido.depositBufferedEth
should be modified as its implementation doesn't really account for depositing in batches nicely.closes #341