Denver Lift-Off 03: Megapools | Rocket Pool DAO Event 03 March 2024

Denver Lift-Off 2024 · March 2024 · 29:47

Rocket Pool's senior smart contract engineer presents Megapools, a research proposal to replace one contract per validator with a single contract per node operator. The talk explains why minipools were built this way, how EIP-4788 exposes beacon block roots to the EVM so state proofs can verify validator balances trustlessly, and what that means for gas, deposits, dissolution and migration. A Q&A covers EIP-7251, compounding and break-even costs.

Topics

From Denver Lift-Off 2024, hosted by Rocket Pool.

Transcript

hey good morning everybody uh thanks back for the intro uh as you said I'm the senior Cy engineer for rocker pool my primary primary role with rocket pool is to develop the smart contracts that uh Power rocket pool uh another part of what I do though is uh research and development of ideas that will help the protocol grow and things like technical feasibility testing of ideas presented by the community and driving them from sort of uh idea to implementation and deployment uh today I'm going to be talking about Mega pools as Pat said thank you uh I've prepared a research page on our uh research repository um a

couple months ago um and yeah I'm just going to go over what uh what what that idea is uh actually before I get started um I just want to clarify from Grant's slides made it seem like meaps were coming in Houston uh but it's actually um not coming in Houston it'll hopefully be in another upgrade such as satin um so before I get into uh exactly how Mega pools the idea Works uh I just want to quickly go over the current situation and uh what like the limitation and drawbacks uh of uh manyi pools are specifically in the protocol uh anyone here running to more Min pools

will be acutely aware of uh some of the painting points that come out of uh the design um so I'm going to talk about why we pick that design in the first place and uh what Mega pools is going to do in the future uh so I'm not going to go into everything about rocket pool uh I just wanted to focus on uh the mini pools uh the and the points that are specifically related to what Mega pools are going to help us fix um so most people probably know but uh every single rocker pool validator on our protocol has its own smart contract deploy so if a single mode operator has 100 validators that's 100 separate smart contracts 100 separate

deployments 100 separate distributions if you want to distribute your your rewards um the the reason it's done this way I'll go over in a minute but uh we basically need every validator to have its own unique withdrawal credentials um and uh I just want to also make this point about the OD because I come back to a bit later but currently the OD down um checks to make sure that the withdrawal credentials are correct on every deposit and that's a trusted do reform by have orle down called a scrub check okay so you might be thinking that uh single contract for every single

validator is very inefficient and wasteful and that's true um it was implemented this way simply out of necessity there was no real better way to achieve um achieve the goals that we needed um because there's no way natively to differentiate between capital and rewards for b g so as I mentioned it's very inefficient um for these main reasons three reasons uh contract creation every single validator requires a deployment of a smart contract onto the EDM um again multiple distribution transactions are required to distribute your gas to distribute your rewards sorry and uh if you not opted into

automatic updates on the delegate uh it also requires a single transaction to every single vehicle to upgrade it um yeah uh and we did improve a a little bit in uh in a previous uh upgrade um to use a dual proxy design to minimize the gas for deployment but uh at the present day it still takes about 1.3 million gas to to make a deposit in Crea at this point um yes so I I made that mention about the distinction between rewards and capital um so the reason why we can't sort of differentiate between the

two is because uh on the beaten chains just validators have a single valids so it starts at the 32 e that you deposit and then it grows as the rewards the fruit um yeah both both of those um whether it's Capital Awards get distributed to the validator withdrawal credentials um the exception to that is the execution layer Awards tip and MV and that um so the problem is that if the min has a balance of 16 e uh how do we know whether that was 16 e worth of approv Wass over several years or whether that was the Val slash down to 30 down to 68 for out so in order to distinguish between these um we kind of

make this assumption we treat any balance less than 8 e as rewards and any balance equal to or greater than 8 e as potentially SL Capital that's between 8 and 32 SL Capital um and this is a compromise which requires some additional safety Fe safety measures as well so um for example the smart no doesn't let a mini pool uh get over one e it automatically will start Distributing it and that's because uh if it got close to 8 then um be potentially treated SL Capital instead of what it actually is um we need to why do we even need to worry about the difference between

rewards and Capital well mainly just because rewards are distributed with a commission involved and on the final withdrawal the capital needs to be distributed proportionately without the commissioner and if a note operator is slashed then uh there is that risk first so we need to handle those situation um yeah quick summary uh so every holidat has its own evm contract he uses a withdrawal credential address um we're using the smart contract balance as sort of a inaccurate estimate of the state of the the validator um Le chain because we can't access that state at the moment um and it was done this

way not because it's necessarily a great idea but just because there's no other way to achieve that goal at the time um and it's a inefficient but necessary cized so I just mentioned that the validat balances and validat state isn't available to us on the evm and that's where uh e 47 can block into so uh it's a proposal an ethereum improvement proposal by Alex Ang Danny Martin my client um and Sh up here commit to the hash tree of each block in the corresponding execution payload that store each of these in the smart

contract so it's kind of pretty technically dense but I'll just walk through what it does in minut it and importantly um it's included in the D for which is on hosy now and Main that in well it might actually be this month April March April um so that was yeah the abstract is very short and dentist with information so I'll just explain uh the problem and what that disolve So currently the beacon state is a completely separate from the execution state so the validators statuses with balances and everything is is totally inate cing to the execution aware of

smart contracts execute um that Beacon state contains some information that we would like to have on the execution such as the pub Nance status Etc and there's presently no way natively to access that information on the beacon chain from the execution uh up until now that is um the beacon State can be thought of as a giant uh data structure where each of the fields can either be U additional objects or arrays or um you can think it as a big tree and if you take that in that tree you can perform this process

called mization on it which uh results in just a single 32 by hash rep in the entire state it obviously doesn't contain the entire State it's just the cryptographic represent ation of that state and um that's what uh 4788 intends to put on the execution player Forest um so there's kind of two parts to this IP it's um the first step is that they extending the blockheads to include parent beacon block um and then secondly the more important side is that there's a contract deployed to the execution layer which uh allows other contracts to call it and querly the past 8,191 beat block Roots which is

approximately one day wor history um just a technical implementation Point um you might notice that it's the uh beacon block route or the beacon State Route um and that's just a technical technical reason for that but uh it essentially means the same thing we can access the state route just through a another layer of the proof um so I'm just mentioned in the proof which which is a a cool feature of Merle trees uh you can essentially prove the existence of certain data uh within the tree by providing a short um proof to back to the root so uh now that we are getting 478 we have this way to give

uh the evm access to the data that's on the beacon chain um and it can be verified um in this sort of round of our AC um and so therefore we can trust trustless on data from the vacan chain which is previously accessable to us uh so yeah that was kind of a bit of a technical technical overview of that um IP so why why we care about this for Rocket po um well we no longer have to rely on this suboptimal solution of a separate uh mini mini pool for every single validator um we can use State proofs to verify the actual validator balances and Stakes instead of uh implying it based on the the Min pool

balance and the entire process is trustless so we don't have to rely on an oracle to perform that uh yeah so we don't need a separate withdraw credentials to keep track of all their balances separately and that's where uh meaps com into play so I just want to mention first of all that uh this is still in like a research level it's there's no government's proposal or anything like that at this appoint in time um so some of these ideas are kind of high level but they will they'll get flushed out as we finish up with Houston and start working on hiips or further sting so the high level idea of Mega pools is that we replace the individual Min pool uh

contracts with a single per uh per not operated smart contract and all the validator credential all the validator withdrawal credentials will for single vo operator will point to just one one contract um instead of of mini pool balances uh we rely on state proofs um to prove the state of the validator um and so it doesn't apply any trusted Oracle duties it's fully trustless um and What needs significant gas reduction for distributions of multiple validators and a single contract deployment um so I I'll just sort of

walk through the now um which is all available in that research repository um so the first step is there to setup uh so no is not deploy me a contract which is a onetime uh operation to set up the contract and it will have similar gas cost to a current mini pool deploy um and we can just make it automatically done as part of the first deposit uh one very unfortunate thing is that current vles will not be able to migrate to this medical system it'll require a sh validators to do so because there's no method to change wither credentials from an existing ZX 01 withdraw credentials with new

one uh the deposit process will be very similar to the current minol deposit process um except obviously we're not deing new contract of the deposit um the node operator deposit is just um directed to the map instead and the mega pool will have its own internal fq um of deposits so it can handle multiple at once and then um that mle validator will enter the usual or previously Min Cube but do for that uh and then once they're assigned funds once they get to the front of the queue then they will uh submit a state proof proving that their validated withdrawal credentials are

pointing to the correct metol um so importantly here that removes one of the oal duties the scrub Dy that I mentioned earlier um but it doesn't really reduce the um the time that we have currently in the the scrub J because it takes uh eight or so hours for the deposit to appear appear in the stadium so we're still going to have that waiting period it's just not going to be a Oracle Duty anyal so it's a trust L thing that's done by the uh so there's a same situation as we currently have where the deposit hits the mini pool and then uh the node operator goes offline or they something's broken and then the the

funds can't just sit there forever so we'll have a similar process for dissolution as well um and that dissolution just sends the heat back to the deposit pool to be assigned to another node operator um to avoid relying on the o down for this uh we could incentivize it so that other node operators can uh perform this action if uh if the original owning node operator doesn't respond in a Tim fashion uh to exit validator pretty similar again to start with so the not operator will subit a voluntary exit message on the beacon chain um Smart Mode will then monitor for blocks monitor blocks for rocker pool validator

voluntary exits um and if it detects a voluntary exit uh of one of its own validators then it again submits another state proof proving that the withdrawal exists in a recent block um so if after some amount of time uh which is not not strictly defined at this point but uh after some amount of time if the node operator who owns that validator doesn't submit that state proof then uh another node operator will be able to um submit it and they'll be incentivized to do so after some uh only a valid State proof uh sorry once a valid State proof is submitted to

the MEAP pool then megapol enters into this special withdrawing State uh which I'll explain a second um but first of all uh I'll go over the uh voring Capital after you've exited so uh once a validator has fully exited uh there's going to be a corresponding withdrawal uh entry in the execution payload of a recent block so again with another state proof it's a common theme Here lot of State proofs uh we can provide the mega with the exact withdrawable balance of the validator um and then we can perform the slashing if required or the proportional distribution of capital if required while it's in that uh was in that withdrawing State um once all the

validators as a part of that Mega pool exits this Loring State then uh Mega pool exit that withdrawing State um so while it while MEAP is in this special withdrawing State uh you can no longer distribute rewards um so we're just waiting for the exit to happen and the capital to be returned to the smart contract at that point um the distribution of rewards uh this is the most simple part of it so this is um this is the biggest Improvement that Mega pools sort of bring um so as long as the mega Pool isn't in the special withdrawing state where it's awaiting the capital to be returned from the beacon chain um you can just call

distribut at any point and the entire balance of the mega ised rewards um so all consensus layer rewards and execution layer uh for all the validators under a node can be sent to this one address um and that removes the need for the current uh distributor that we have at the moment which distributes any uh of course uh if you're oped into the smity that's not true but in the other case it is and then all rewards um so consent Slayer Awards M Awards everything all comes to this one contract it's distributed by a single call and uh it be relatively cheap call um to

distribute all your rewards across all your validators it's a massive Improvement uh I don't know how well you can see that but it's just a diagram out of the research stock I'll just show the uh the process there's a couple of sort of internal steps there um one of the things I want to point out is um we kind of introducing this new Watcher role for n operators so as I mentioned there's some situations where uh a not operator doesn't respond with this L proof in time and we need to incentivize another group of people to submit it um if they fail to do so so the proposal doesn't go deeply into into the mechanics of that um still things we need to eye out but

uh there's obviously ways we can incentivize it so the benefits from doing this uh I think I mentioned it a few times but it massively reduces the gas uh requiring to distribute U multiple validators from the same mode operator uh it removes another OD Duty which we love doing um want to get rid of all them z um so that gets rid of the scub checking Duty replaces it with the state proofs uh if just as distribution is so much easier now you don't have to call 100 contracts if you have 100 validators then uh we can hopefully get node operators doing it more often and uh because if you have

a small amount of rewards across all number of validators and it costs a certain amount of gas to call each uh distribute function then you're going to wait until the balance gets to a level where it makes sense but if all the rewards come into the same time track then uh you're more likely to to P it because it uh it's not giving away so much in gas uh and what that will do is uh hopefully unlock some of the unproductive e and it back to the deposit P to become productive again not that we have a problem with u size at the moment but uh still it's nice to think about and uh this last point is an interesting one so uh if we have all of the uh all of the state for the all validators in a single contract it's it

makes it easier for us to look into things like cross collateralization um of of mini pools not Min pools anymore so uh currently each mini pool is kind of its own little Silo of capital um and we can we're kind of limited to uh slashing per Silo whereas if we put them all together there's potential that we could reduce the bond um as it's spread across the the bond of multiple vales instead of just uh individual ones so how do how does that translate to scaling said that Mega are going to help the scale well uh less friction for node operators uh obviously an increased

return for node operators if you're not wasting all that money on gas then obviously your return on investment is higher um and again with that cost collateralization of bonds uh we could look at lowering the bond even further um and I think Mega pools also work really well with some of the other proposals that are coming out at the moment such as the ones in the rapid research integrator um so I think there's a lot of um comity between this idea and and some of the ideas that are that are out there now um so challenges at the moment are mostly technical in nature um so the usual things such as actually implementing it uh do I have a proof of concept um but it's it's very basic

there's obviously a lot of work to be done um uh before we even do that obviously we need to fully spe spec it out um and then yeah implementation testing security aits all that sort of stuff uh I mentioned that I kind of glossed over the incentivization system for the watches so that's a needs to be flushed out of it as well um and yeah this one is interesting so uh the way meral proofs work they're kind of uh link to the structure the verification process has lad to the structure of the of the um object of the tree um so any changes well not any changes but some changes to

the V State could actually uh invalidate the uh verification system um so that that means we can't um we can't fify the um process uh we need to be able to change it uh as a the adap of time so in every hard for so far except for Dan they made changes to the vacon St um so it's it's not an uncommon thing for them to do so that's just something we have to be aware of and then you're probably seeing burel trees on the ethereum road map um there something that's probably coming in the future but uh that would invalidate the system as well we have to redesign around it so fortunately we're we're not going to be able to get rid of

uh upgrading anytime soon I don't think but you up and I mentioned that there's no migration path possible which is kind of a bummer for a lot of people uh is like I don't really see a path forward there at the moment unless something comes out of the the W um so when Mega pools then um as I mentioned it requires 4788 and that's in dun which we know is uh imminent uh we're wrapping up development on Houston at the moment um so final stages of audits and whatnot um May we'll talk more about that Surly um so we just need

feedback on the research and design finalize some of those hand wavy Parts like the incentivization produce a formal specification and upip go through the governance process then implementation testing and then hopefully that uh I'd like to see that potentially get into the Saturn upgrade which is doing fall in Houston okay that's that's me I went a little bit quicker through that than I thought okay so we're going to take some questions and I'm going to walk around the room with the two Ms got speaking the

so okay we're going to go to ver first I have a lot of questions but um so I'll just I'll just ask them all and you can okay I'll just ask them all and then you can uh answer the ones you want to um with the existing mini pools if you end up with 8 eth or more worth of rewards what happens um with that smart contract that has the beacon State Roots how is is that like a pre-compile or like is that updated with with gassy transactions or how's that work um is there any reason to make the Watchers operators as Watchers but why not just let anyone be them and will

migration to megapol me mandatory or is there are you imagining a state where we have a mix of mins and meaps okay um so question one was 8 WS so uh if that happen uh the is treated SL so you will be yeah you would be it would be treated as if you were SL 80 yeah so that's why we have the uh smart node monitoring for the balance of the need po so get over one e next one was about the uh the beacon State contract yeah yeah that's a good one so they're actually kind of doing it slightly different to previous approaches um there's this um special

contract that's deployed out this address on the evm and then prior to the execution of transactions in that block um part of the specification for the ethereum execution layer is that they have to call this um function on this contract which is so it's kind of like a promile it's kind of like one but it's actually an address it's not as well but they nor start at zero where this is yeah just an what shers could be anyone yeah so um there's no reason there has to be no operators it just makes sense because they're already running a smart mode stack um if someone wanted to run the smart mode stack without running rocket pool then yeah there there's no specific

reason why was lied to yeah mini pools and mega pools at at the same time yes um so I mean it's up for discussion obviously but uh we obviously already have thousands of me pools so we can't um we can't just force everyone out and tell them to come back in also um it's really a benefit of their own so it's kind of The Operators um Choice whether they want to upgrade but uh that's for existing mini bols but I think um once they're deployed no one can be a to grade Vehicles cuz no real benefit um to create any pools after the instruction okay next question from the

audience let's go up here I also have a few questions but I wasn't SM write them down um I'll try and remember thank you for talking um how is this going to be changed with uh if EIP 7251 which I believe is increasing the max max effective balance um is it really just doing what that is earlier um yeah so um we'll we'll need to make changes in response to that um but uh there's no specific uh um hurdles that I to okay similar to that would uh rewards

compound or would be basically the same thing we would sit on Till You Get Enough for eight and then do another one yeah uh so so uh it's to how it is now the rewards will get schemed as the meeting chain into the meol contract um and they they're not automated compounding there but you have to distribute them out and Deo other people it's not like an automated compounding system okay and last question is um let's say you're running 100 validators and you needed to in order to go into the mega pool you'd have you said you'd have to exit and then restart a new one have you looked at for a given gas price um how long would take to break even on the saving of cost assuming that you're

doing rocket sweet which I use to right no I haven't done any um looking at that because uh it does kind of depend on some of the implementation um factors so how much the distribute actually costs and how much the deploy actually costs without it being developed I don't know what those numbers are this time but it's something that we can certainly do once we get a bit further against thank you okay next the audience sneaking anyone online no good okay K thanks a lot okay thank

you everyone

Related talks