Ephemery: Novel approach to public testnets / Mário Havel
EthPrague 2023 · June 2023 · 22:02
Mário Havel introduces Ephemery, a novel approach to public Ethereum testnets. At ETHPrague 2023 he explains how Ephemery provides a single testing infrastructure made up of ephemeral networks with deterministic parameters, an alternative to keeping long-lived public testnets running for protocol and application testing.
Speakers
Topics
From EthPrague 2023, hosted by ETHPrague.
Transcript
awesome whoa thank you so much for joining us this morning um really appreciate it especially those who've been partying long enough right and uh yeah it's honor to have you here and to talk about FM area which is a project that I've been working on um with the community in past few months and uh yeah um I'm Mario from ethereum Foundation protocol support and this is one of the things we do in protocol support try to support the core infrastructure test Nets and uh yeah before I talk to you about the test Nets we should Define them right we should know what I mean by testnets because maybe uh just to give you a quick background Tesla is a network where we test things because we have a blockchain
technology we have the ethereum with any other currencies which are real money and it's not good to test our applications which are being developed on the testnet or the actual the actual implementation of the cryptocurrency the ethereum clients have to be tested in environment which is as close to the production to the real deal but at the same time we don't we cannot lose their the real money right so we have test stats which is uh which are networks running similar or the same parameters as the mainnet as the as the real deal but uh with no real funds on it so uh we can we can we can uh go crazy we can test our apps we can test our validators
the infrastructure on testnet and speaking specifically about ethereum test Nets uh they have uh they have quite a bit of History uh we've seen over the years uh many many of them with more than robster and rincaby and now after the merge this is the current state um so before the merge uh the the old testnets were either deprecated uh deprecated or uh merged into the proof of stake and from those uh foreign it was the oldest proof of work uh tested at the time and it was killed here by the way in the hackerspace we met with
the get team and we merged the out of it and uh you get deprecated so it was the ripsten and we ended up with just two test stats Gurley and sepolia uh girlie actually started as a proof of authority test that it was a new project invented or restored at eat Berlin by afri and the community around there which was always basically we need to test that and with the Prater the beacon chain connected to girly uh it's been it's been the place for testing uh the beacon chain the merge uh over the past uh well two years or more right uh since before we can change so regularly now after the merge
is the only public test net with open validator Set uh that means that it's the only one where you can actually test your um your clients to run as a validator and and then switch to maina to try whether your voltator keys and the whole setup Works uh but being started in the 2018 it's uh it's quite old quite big uh which means that it has large State and uh most importantly lack of funds uh you heard about the huge fuck-ups with all the all the faucets empty and people actually selling Girl eat which is like a total fail of what testnet is supposed to be right it's supposed to be the this this uh completely free open network where anybody can just test
anything and on the other hand we have sepolia launched uh roughly a year ago more than a year ago so it's it's very yanked us not compared to girly uh and um I would say that it's the place to test your applications right now however uh sipolia has a closed violator set it doesn't allow anybody to run a validator it's mostly the client teams and the core devs running uh the volatility infrastructure so we make sure that it's stable so uh this is the state right now and the problem with not just two of these but all the distance that we deprecated and what is this eventually happening to to these is that they run into certain issues after a long time uh already
mentioned not enough Supply because the distance starts which is certain Supply which is distributed over the fastest faucets and it doesn't have a value people don't really uh think about sending it back or doing something of it it ends up just lost in bunch of test wallets and or locked in dead Beacon chain or or something so the supply display might be inefficient and we end up with empty faucets tweeting oh send me some sepolia please um yeah the uh there might be issue with the validator said with uh people not being properly incentivized to keep their violators running uh we might end up not reaching finality and have the issues to
keep the network even even finalizing um uh yeah the size with uh distance being few years old and people just deploying anything they want uh it can be pretty big right so it can take you some time to even run the node if you just want to test something you want to do it fast right so it takes the time to bootstrap the node and also uh uh you have a higher requirements to to even run it um so if somebody just wants to play uh with ethereum he still needs a bigger machine and these over time these test Nets will anyway end up deprecated now it's becoming more of a standard before it was ad hoc like we realized that it does not should be deprecated uh thanks
to afrinow uh the plan is to know the duplication ahead so the girl is being deprecated right now going to be replaced by holashki or holishovic which is named after the place that we are standing right now this part of track uh but it was started a year ago at eat Prague here and the whole show it's supposed to be supported for like two three years so we know exactly when it's going to be deprecated and with this in mind why can't we create actually a test net which is uh not deprecated deterministically or that we know one is going to get you down but what if we shut it down and automatically and reset every now and then and everybody everybody
um uh just counts with it so we go back to the Genesis every time uh and this fmri so this is a novel approach to the public test Nets that we've been working on and um yeah as I said basically it's an automatically reset test stat every given period the period can be arbitrary right can be a few weeks few months infinite Community agrees on uh the test Nets just drops everything and goes back to to zero to Genesis that means that all of the funds go back to uh the faucets all of the all of the validators are clean and there is just the Genesis set of validators which is supposed to be secure and this is the still the single
infrastructure it's still the same clients running the testnet which means that you have just the same book Explorer the same RPC and you connect to the to the same same network but it's a new network every let's say every week uh what we can what we can achieve here is a not just enough supply enough supply for for everybody because if you just waste all the supply this week it's just going to reset back and we have it we have it all back right uh what is great that we also can ensure that we have secure validated majority that will always finalize because uh we can just calculate how many validators we need uh to always keep the majority right so if there is the period to activate the
validator and uh we can make sure that I don't know we have 500k validators it would take one month to uh lose the 66 percent majority there so um so uh we know that if it's running for less than a month it will be always secure nobody can take over the test net even if we have all the funds for free all and would happen just now okay I'm sorry okay just wanted to show you this yeah so this is the resource repo uh just some general information I'm going to share more resources soon um yeah it's uh my GitHub FM role testnet and the the idea here is that
fmri is sort of implementation but the FM role test and I'll automatically reset test net is a specified concept which is implemented here but uh you can just run your own notes with the same specification or or forkit um so you can actually it's running right it's happening it's not just an idea it's been running since uh December last year actually it started the discussion uh was boosted by Defcon in Bogota with uh we had a chat with afri Denny Ryan but all the people from here actually lumir Muhammad who've been participating in the whole show it's at the stat and we ended up we came up with this idea and it started well thanks to PK 910 ramiroy from each Taker and other people
from Community who contributed started around uh December so we actually uh started testnet so it's running you can connect there I'm going to show you the links but what is it good for why would you like to use it first of all the short-term testing which means the applications which you need to test just right now just imagine how many freaking hello worlds is there on girly like we don't need that if you're just starting as a Dev or you're doing something at a hackathon right now and you you're just testing it you are not going to need it in one week or in in a month or something you can just deploy it to fmri and have it as a disposable disposable Tesla event structure so for a short interesting of your apps but also validators so if you
are trying to set up a validator and it's hard to get Hands-On some girl to eat and you don't want to wait till your uh notes uh bootstrap sync you can just you can just use FM array it's very easy and you can run as many values as you want because the faucets are very uh very rich and yeah it puts it sinks in a few minutes because it's just short and small and mostly empty chain uh yeah and I'm hoping that it's not going to stay empty because uh I would like some more folks to use it so please look into it uh and uh it's fun because you can just break everything you can try anything you want you can you can take all the funds you can deploy any apps you want it's just going to get deleted in a week so uh don't worry about it go
for it and yeah it's the weekly mechanism right now because it's still kind of a development phase with storage is like few hours few days development uh phase where we with each rested we test whether it survives uh the infrastructure the infra survives and now it's one week um it should be it should be more uh later on should uh ideally like a month uh you can on in the repo you can always see one is the next reset it's uh every week on Thursday 7 PM UTC um right now it's all written or like it's all handled by devops tooling basically so how it works is that we have bash Scripts which are handling the logic according
to the specification so uh it watches the period whether it's supposed to be resetted and uh in that moment it triggers the risk mechanism which stops the node deletes all its data updates the Genesis and starts starts the same node on a new network um also we are testing some implementations in actual clients because uh so there is EAP work in progress on this we would like to have this not just uh implemented in on the tooling side where you can uh run some external devops to link which handles the node but have have it implemented in the node in the client itself so there is like a test naive implementation in a goiterium and in lodestar right now
uh yeah uh you might think as a app developers that like it's hard to actually test your applications or on this test net when it's empty right when it resets every week but what we what we developed is a tool ink which automatically deploys uh automatically deploys um infrastructure applications some primit D5 Primitives and so on uh after each reset so as the network resets they will be automatically uh uni swap zero xplits some some uh um save right uh the contracts that everybody are using and you can actually contribute to the repo you can add any app that you want to
this deployer or run it by yourself yeah and yeah the specification is mostly done and the EAP is is still being discussed uh and uh yeah talking about the road map what we what we did uh so starting in December we had bunch of discussion about how it should be should look like and we are running the stable public network and uh we made a draft of the EAP and oh yeah we are also deploying The Primitives right now but also refunding validators so if you've been running the validator on the network when it was reseted you want to get the validator in the new genesis but you get the funds back so you don't have to go to the first again you can just pin the validator again I have to do the post again
um yeah and uh right now we are trying to we are trying to uh make it run we within the client itself and have um uh connect the the public chain uh to all there is there is the go ethereum Fork running on the public Channel already but we need to have a proper client pair doing this right um so how it works it defines uh two functions one is the Genesis and the reset so the Genesis basically uh is uh deterministic Genesis which uh creates the the new genesis state for each Network iteration so it's uh let me show you the how it works exactly
come on right so how to network how it's supposed to work um it always we first Define although the whole network is defined in what we call Genesis zero normally you have the test net the network defined in its Genesis right but here we need to update the Genesis whichever with every reset so we create the Genesis zero which can be hard-coded in a client or it can be uh like the the base template and uh this starts with some chain ID I don't know 1080 1000 or something right some number which probably which shouldn't uh shouldn't collide with any other public networks uh it has its Genesis time and uh we have to keep this variable this
information about a period about the one week one month how long the distance is going to run and now this uh based on this Genesis zero template whenever you store the client it checks the current time so it checks the latest time stamp and Compares it to the Genesis zero timestamp So based on uh this data it can tell how many iteration of this period happened so uh if it's the period is one month the Genesis zero uh was the network was started a year ago there was 12 iterations so the uh I will be 12.
and based on that we can calculate the current chain ID we iterate it so it will be the N plus 12 and uh and the timestamp will be just at a period times uh the period times the Dilemma of iterations uh above the Genesis timestamp so we we calculate deterministically you can always calculate what is the Genesis of the current network uh that you want to connect to so you can just uh start a client and it will trigger the idea is that when it's implements in the client you start it and it will trigger uh not just listen not just reading the the normal Genesis which is hard coded but using it as a template to calculate the the current Genesis
now there is the reset which actually needs to reset the network trigger the trigger the uh the database damp and uh and uh generate the new genesis by itself so this is not current to implement this in any client uh it's held only by the external tooling and the idea here is that if you want to actually uh do this the Genesis function is good enough because um the the automatic reset can be done using some script some Crown job basically very simply and this is something which the infrastructure structure need uh people who are actually running the Explorers or validators and so on uh they they need
this reset function and for you to actually run the node test your own validator uh you can well you can always just use RPC or you can just you can run the node easily based just on Genesis function uh why do we do this why we always need to generate the new genesis is because uh of security mostly the replay attack protection uh because if we keep the same Network you can just use the same transactions which have been recorded from the previous iteration and still money and and uh drain the drain the faucets and so on and the idea is here that we have the single specification which can be done either by the external script tooling or
Implement in the client and that means that we are right now running the the client implementations with this with this with this in it and uh those clients which just use the best scripts and they're compatible right so as we develop it more in the clients they can join the existing Network we don't need to Fork it into a new one or anything it's backwards forward compatible yeah so this is how it looks like and yeah the EAP is in process it's just draft PR I'm I'm I'm scared to merge my um for like uh to open the pull request for the first uh first EAP I'm doing but uh there is there is still some Community discussion about details and
specification I'm I'm still getting feedback from some client devs so you can find a PR 6916 and uh you can check the files you can read the EIP there it's uh it's all there cool um and yeah why I'm talking about this because I want you just not to use I would be very happy if you use it ever but also to maybe contribute so if you if you actually start using it I would be very happy if you let us know some issues feedback uh in the repository that I showed you can again open issues you can join our metrics uh Channel and yeah so if you run your know your validator please let
us know the experience and based on this you can actually identify what is missing right uh there is actually a few few things missing we are not running the forkmon we are not running the eat stats uh we have a bunch of explorers and so on deployed but there is maybe something that you are using and you you miss in the uh in the infrastructure around this net so you can you can contribute by starting this building this and uh yeah helping with a devops tooling which again I'm explaining that this is the best script implementation is the main one to use but you can do this uh in any other way that you prefer maybe you can do it in some ansible scripts maybe you can use some python or something to end up with a different but
uh better user experience handled uh alternative how to deploy the fmri client and yeah and ultimately uh if you can if you are into the client development and you'd like to look into implementing this uh this custom Network in uh some of the clients that will be very very helpful and the idea here is that you might be doing this with an EPF and I'm going to talk about this tomorrow as the very last talk of this conference but there is the ethereum protocol Fellowship happening right now if there is anybody interested in anything within the core political development if you're Technical and want to dive into this if you want to learn about core development please just pet me here find me here I'm really glad to
talk about this the applications are closing in one week on Friday and uh this is completely open permissionless program which can help you to dive into the core and even work with the current core devs and one of the projects that you can work on that I propose here is implementing this test net within the clients and helping if it's infrastructure right you can uh yeah you can use it for your short-term testing validator testing and it's all on fmri.dav so on this website very simple to remember right you have all the resources linked to those repos I'll link to our metrics chats we have a metrics server where we are discussing over development and if you are
interested in having the discussion please join us uh yeah maybe before I finish I would also like to mention that there is going to coordination call on Thursday we're going to attend it as fmri uh tested people but anybody who is interested in test Nets or helping with the with the the next iteration of the the public tested infrastructure can join and I guess that's it yeah thank you so much [Applause] [Music] thank you