Honey, I Shrunk the Test Run: Protocol-Native Execution Client System Tests, 10-??× Faster
Devcon·Sun, Nov 8, 2026, 12:00 AM
Transcript
All right, thanks everyone. Thanks a lot for the introduction, Bianca. Um yeah, um my name's Dan, Dan Saritops. Um I work at the specs team at the Ethereum Foundation, and as you heard from Yocum, um part of our work is uh facing researchers and people who prototype improvements for the protocol. And the other side of our work, on the other side is that we talk to uh client developers who um who who are actually implementing the protocol and implementing their nodes and need specs to uh So, what we do is we write specs and we generate tests from them, and this helps client developers uh to verify their implementation.
So, I'm going to tell you today a little bit um how we got from 122 hours at the beginning of the last month to 2.7 hours yesterday morning for our system tests. And so, we're talking about system tests, what is that anyway? Well, a system test is a way of testing the client as a fully instantiated uh bit of software as it would run on mainnet. And we test it a bit like a black box, and we try and do that through uh protocol interfaces in order to send our test blocks to the client in order to see how it behaves and that it passes the outcome.
And until recently, execution layer clients had two main ways of running these system tests uh against their client. And both of these run in an environment called Hive. And Hive's responsibility um is to orchestrate the clients in containers and make them available for the test harnesses, and it provides an API for test harnesses to spin up these clients and get them to interact in some way. Um you can do really crazy things. Um, that was really nice, written by Peter in 2016.
And then in 2017, uh, Martin wrote the first system test for Ethereum. Um, and it it was called consensus. It was then called RLP because it imported the blocks into the client by having the client read them upon startup from disk. So, it wrote that the the these blocks to RLP on disk. The client read them in and then it it it claimed to hook into the dev dev P2P import chain path, uh, in order to execute these tests.
Um, then just after the merge in 2023, the merge gave us, uh, a new and wonderful interface, uh, in order to send tests to clients. And that's through the engine API. And just as the consensus client sends new payloads to the execution client, um, this simulator does the same thing. This was added by Spencer, who's and and with some help from Mario and Felix are here in the audience today. Um, and it was really beautiful because it created a native interface in order to test clients.
But, um, just maybe not everyone's super familiar with, uh, clients and and system tests. So, I thought we'd put an analogy to this. And basically, um, it's like taking your car for a system drive. And so, like, um, let's say you've been prototyping your new car and, um, you've you've tested everything like in isolation. You've tested the handbrake.
You've tested the airbag. You know, the engine works. But, now you've built it all up and you put it all together. You've assembled it. And you want to take your Lambo out on the onto the test center and make sure it all works correctly.
And so, we can look at the axis in this as, um, as the car being the client is the car and, um, our test which contains pre-state, excitement through transactions, and then an expected post-state as a checklist. And we want to make sure that when we put the client through these paces, it meets these outcomes. We have a pit crew that sets up the car, a driver which really drives it through the actions it needs to complete, and an inspector who then checks the outcome. And so, why on earth are we doing all this? Is because I mean, do we really need to make it faster if we're just like releasing, you know, every 2 weeks?
Does it really matter? Well, it it matters for fork development. So, basically, if we can provide faster feedback, we can provide we can make faster forks. So, test gate every stage of development through throughout the fork. And um For So, for example, we if you have like 20 EIPs uh that go into a fork, the way we we implement this in the in the clients is we sort of layer up these EIPs incrementally, and for every stage we create a devnet, and then make sure the clients can interop on this devnet.
And the tests are basically one of the gates that allow devnet uh participation because if the clients can't pass these tests, then there'll just be chaos on the devnet. And so, it's really important to get fast feedback on this so that we can iterate through these devnets quickly, and then um complete the fork more quickly. So, unfortunately, there's a problem with our with our forks and our tests, and that's that um the number of tests we have per fork is growing quadratically. And so, as you can see in the colored legend, that um the number of tests is generally going up. Um but not only that, when we add tests for Cancun, um for Cancun, we only have to generate and run these tests for Cancun, but in the next fork, we need to generate the same tests, not only compatible for Cancun, but also compatible for Prague.
And we need to do that for every subsequent fork. And so, that means we have um to test every fork every fork's tests at every fork. And so, these this runtime for running the tests is growing quadratically. And so, we took a look at where the time's going and how we could optimize this. And when you break it down, we're basically spending, to put it short, most of the time in startup.
So, a hive will start the container uh for the client and prepare it with everything it needs, including all the accounts it needs to to uh run the tests. Um and it'll spend a lot of time booting up the client. And you can see from that little glowing yellow sliver that we're actually only spending about 2% of time in the tests. Um and so it seemed very clear where to try and optimize this. We should optimize uh the startup.
And so, the simplest idea would be, what if we can just run all the tests against one client? Um could we go back to the genesis state and then just run the next chain, the next test block sequence against the same client instance? And um after talking to Mario, it seems that actually this is very good at what clients do, because clients reorg back um at least during proof of work all the time. So, they have this capability built in. It's what they do very well.
And um luckily we don't have to do it as much during proof of stake, but they still reorg occasionally today. Um so, instead of starting a client, testing, and stopping, as you see on my left side, now we can start it once with a shared state for all the tests, and then we run all the tests in succession. And to go back to our test center analogy, basically what we were doing before is we're taking our Lambo out for a spin and then thought, "Oh, well, we can't use it for the next test. It's useless now." and just sent it to the scrapyard.
So, now we're basically reusing our car in order to do multiple checks against our prototype. Um that kind of made it sound a bit easy, and it turned out that clients uh like provide all that for us, and that's really nice, and we we took advantage of that. Um but it wasn't that easy because the hard part was actually generating and writing the tests. So the tests weren't really in the form in order to do this out the box. It wasn't just all for free.
And so the generating of the tests is a bit of a chicken and egg problem because all the accounts for a test go into the genesis. And so we need to know all the accounts that the test need, but the tests need to know the genesis because they need to know the state root. Um so this is um we managed to accomplish that by doing a two-sweep process. So in the first sweep of all the tests, we just collect all the accounts and um put them in a big list and and then generate the genesis. And this genesis can be used for all the accounts.
Um and then in the second sweep we basically generate the tests based on that grouped genesis that we created. Um and the other part that was uh probably took more work was the rewriting of the tests. And if you look at our car, basically the problem is that um it had some that the the checklist had required some sort of weird configuration that you couldn't apply to two tests because they were just incompatible. So like the first test said pro like the preset one on the radio had to be 87.5 FM.
You had to put two mangoes in the glove box and you had to have your AC on max. And the second test said but the preset should be at 102.5 FM. And you can't These are incompatible and they block each other and you can't run that on the same car. And that's the same uh problem we have with the tests.
You can't have any collision with P1. That won't work with one account. Otherwise, you'll have some conflict in the state. So since 2023, we've had programmatic test generation. And in this case, it was relatively easy to to have an iterator that can just give us new accounts for all the tests.
Um but there were some tests that caused difficulty and conflicted a little bit and we had to rewrite these manually. Um and in general, we have a a some older tests from Ethereum tests which are hard-coded YAML files and not so programmatically generated. And um these of course are a bit more work in order to get running in this shared state. So, to look at the improvements, now you can see we're really driving. Um so, to see where the time goes now, the top Gantt is the previous uh state uh like the the previous situation on the engine simulator.
[gasps]
But now on the new Engine X simulator, we use one container for one group of tests for Cancun, which is 8,519 tests. And you can see here that we do one startup and we run all these tests then in succession one after the other, bam bam bam bam. And we can run all these tests now in 4.6 minutes instead of for 1.5 hours on a natively compiled client.
But this really benefits clients which have a managed runtime because their startup is a little bit uh takes a little bit longer because they need to start up the JVM, uh for example, and so their startup is quite a bit longer. Um this is not about performance on mainnet, all these code paths are warmed up, and they're equally as performant and comparable to a natively compiled client. This is more about conformance tests, making sure that the handbrake turn works when you're on the test track. And you can see in the bottom chart that now we've amortized this cost for the startup and the client boot, and we're just running all the tests in quick succession. So, based on this one group, we're now running at 185 times faster.
And this is still a work in progress. So, and it's a fun game because now we can try and like reduce this group size. So, you can't put all the tests in one group, it just doesn't work. If there are some special tests that kind of do need a specific pre-state. Um like or or you have tests that modify like the um the block header values, and you just can't you can't really group them together cuz it's just it's it's too enchained in the state, you can't group them.
But you can still group them a lot, and so the game is now to try and reduce this number. And when we jump from 21.0.1 to 21.0.
2, we managed to make This is a work that Mario did recently. Um we managed to make a 23% reduction in these groups. What's really nice is what's so crazy is you can see that the run times of the like um these managed run time clients like Never mind and Besu, their run time basically tracks this from really closely because all that cost is in the startup, and we just amortized all of that and we're much faster. Um but you might say that seems like quite a lot of engineering work, and well done, mate. Like you've managed to like speed up the engine simulator, and now you've got this Engine X, very cool.
But you tell me I still need to run this RLP simulator that we saw back on the first slide, and that still takes me like a day. Um so we looked at it fresh, and we decided that we could we could now implement a better version of RLP, and actually send the blocks over the wire instead of just loading them from disk. And this is what WireX does. So it implements a mock dev P2P um peer, um which forces the client to uh retrieve the test chain over dev P2P full sync. And this really complements engine in a really nice way because this means that we have the two native protocol interfaces for ingesting tests covered.
Um and we get more much more coverage. So if you look at the sync machinery, we're now actually applying a real little sync instead of like just like sort of trying to hack it into the sync. And so we're really testing the whole state machine uh the fetches, the retries, and the timeouts of full sync. And in addition to that, Amsterdam introduces bells, and we can test the clients in two modes in Amsterdam and beyond forks. We can decide to either serve a bell to the client or to [snorts] withhold it, and we can test both paths for that, too.
So um we made some claims about how fast we got and um I hope you understand that now that what the protocol magic is. It's not really magic, but we we just made use of the protocol in in order to to make the test faster. But this chart is just for engine X. It's not for engine, it's just for engine X. And what you can see is in Osaka, we had we were quite fast already.
What was the problem? Well, uh Amsterdam came along and we got a bunch more tests and then we hit our quadratic quadratic problem. We got like another 25 K tests and then the runtimes jumped accordingly. And then we were busy with other things um and we implemented wire X. We're finishing up Amsterdam, getting ready for Bogota.
Um and then recently we we took to optimizing this a little bit more. So with Mario's change in the pre-allocation groups uh V21.02, you can see an immediate drop in the runtime. And then over the last few weeks I've been having a lot of fun to try and make this stuff as fast as possible and applying uh different optimizations in order to just squeeze out more juice from these simulators. And as a culmination of all this uh optimization, I finally decided to pump the hardware.
So I jumped the in the hive dashboard from eight VCPUs to 16 VCPUs and thanks to a mutex bug on the on the test database in hive that we fixed back in August, um we can really drop these results even higher by enabling more parallelization within hive. So we uh we put in quite a bit of work here and tried to optimize over many layers of the stack. Um on the top layer you can see on the right-hand side Mario's uh optimization in the pre-allocation groups. Um that caused problems cuz it got too fast, so we had to fix how we load uh the the test vectors into into into the simulator. Um then we also tried to pipeline, so actually now while the tests from one group is running, the next client is starting up in the background.
That provides a a bit of a speed up. Everything's competing for resources, so it's not one-to-one, but it it does seem to help. Um we fix some bugs. We also just check that the client is ready more quickly in Hive. So, back in the day, clients weren't as fast and and as good as they are today, and we were just asking if it was ready every 100 ms, every 100 ms, and now we check every 5 ms whether it's ready.
And so, now you really get a much more responsive clients with a faster speed-up. Um and we also uh try to help improve how clients start up as well, just so that they're faster ready. And then we did um one more optimization uh which it is not really an optimization in the sense we've just been talking about, but rather in how we trigger like generation of fresh results. And um before in the old system, because the test gen the test run was so slow, it no one you know, really cared about fast feedback, right? But these new simulators unlock a um a new paradigm.
They they they allow us to check the results much more quickly. And pre- previously, we basically had a cron job which would trigger. So, if you look at the blue bar, that's the So, if a client dev makes a a push to their master or to their development branch, um you the client image is what then gets built that we then test in Hive. And previously, we were just waiting and sitting around maybe for some indefinite amount of time up to 23 hours um in order to actually like uh trigger a test. Um and then afterwards, uh we didn't really care what happened with the test results, so we were just sitting around waiting for that as well.
And so, it might have taken 22 hours in order to get feedback on your build. Um and Spencer had a vision for this of how this could look and set it up so that now things are triggered automatically. And so, you can see that um we've managed to bring this feedback down to 22 minutes by chaining this and uh getting much faster feedback. So, I really think that client teams can now use the Hive dashboard um as a sort of a second backup CI uh in order to get just to make sure that things are are running smoothly. So, what would be next to do?
Well, as I said, with this game of decreasing these groups and trying to put more and more tests into the same group is still ongoing. Um and so uh the top two items go hand in hand. Completing and improving the tests from Ethereum tests and ensuring they're reported in and and improved in our repo now execution spec tests will help reduce the pre-allocation groups. Um jumping to the last point, WireX is only merge and beyond at the moment, but we're going to enable WireX for all forks from Frontier on, and that would hopefully allow us to deprecate consumer RP. Um and the last thing I would say that we're working on is um we shouldn't system test when we can module test.
And so uh Spencer and Filipe have been doing work on um faster module test interfaces that don't need a fully instantiated client and can sneak into the code in a good way and test via uh a tool called engine test in an efficient way. And Filipe's been pushing to try and standardize this to make it much more useful for for fuzzers, including one that he's been working on himself. So, the I mean, the takeaway is basically that if we have faster system tests, we're going to have happier devs, and we're going to have faster forks. So, um that's why we spent a lot of time on this, and I'm I'm really happy with results and also quite surprised. It's cool.
Um so thanks very much, and um I'd really like to say thank you to Spencer, who like has been an amazing sparring partner for all of this. Uh to Mario as well, but really to the whole specs team because they're just fully based. They're really the best team I've ever worked with. I love it so much. They're amazing.
A A thanks to the pandas who are like the other half of this puzzle who like really maintain a lot of infrastructure, the Eve client image building. They're also always chasing down these client teams to help keep the standards high. Especially Rafael who essentially set this whole system up with on the GitHub action side and made this really ugly system that we didn't even talk about before much much nicer and gave us a starting point for this work and also the hive dashboard which gives a a place for us to convene and show results very nicely. And of course thanks a lot to all the amazing client teams and to the people close to me at home who have put up with my obsession over the last month.
[snorts]
Thank you.
Test test test but do it fast please. That was a great session then. Thank you so much. We have some questions for you. Let's see.
If multiple tests share the same running client, how do you prevent one test from affecting another test's result?
Yeah, yeah, that's a great question and thank you very much and I mean I was probably too fast here and talked about Lambos too much but essentially um that's that's the trick that's the difficult bit, right? So um we have to make sure that the tests don't pollute each other and that no there's no address conflicts within two tests so that they when they touch part of the existing Genesis state that they um that they're somehow orthogonal and they don't conflict with each other. But it turns out that you can execute these tests in the client and then the client knows very well that when you change the tip of the chain that it knows very well to discard the previous chain. It it may be kept in cache for a while to avoid having to re-evaluate blocks that have been given to the client but they know very well how to handle the state. This is what they're heavily optimized for.
And it's a bit hard to prove equivalence between these two simulators but I I know I was skeptical but I've been keeping a close eye on these dashboards and recently after making sure that for example invalid block exceptions stuff match very well, you do seem to have parity between these two simulators from experience.
All right. Next question. How do you make sure that faster system test still behave exactly like a real Ethereum node running on mainnet?
Okay. I mean it's not running exactly like a real Ethereum node, right? Like it's running in isolation. It's a lonely client started up on its own in Docker and it only really gets to speak to the test harness. So there is a limit to what we can actually like do with this client.
Um but we try and use these native interfaces to make sure that at least the code paths that we're talking to the client through are exactly the same as mainnet. That's That's the main point.
Thank you for that. Next question. Could sharing one client instance between multiple tests hide certain bugs that would normally appear when running tests independently?
Until now uh so I don't think so and until now I haven't seen it, but I think the problem is maybe in the other direction that when you run one test on a client in isolation, you're really like you have very good reproducibility and when you're running multiple tests against one client, you could have side effects um potentially. But it I mean it's quite hard to pass the tests. Like if anything changes, you'll have a a mismatch in the in the block hash or the state root and that's detected and you'll see a cascading fail. It's basically catastrophic. You may not get a very useful test result, but everything will fail and you have to look at the first test that failed and then um see see what went wrong there and then proceed.
But, I think it's good to keep the engine simulator around as a backstop and maybe run it intermittently, but I do think you can basically depend on Engine X.
Anything you would want to see change in the clients to make testing easier?
Um, yeah, Felipe is addressing exactly this problem at the moment. He's drafted a spec as a PR in our repository, which is part of our documentation, which requests clients to have exactly the same flags, not for system testing, but for um um, for module testing. And um, these flags would enable us to he's asking them to maybe execute tests in a certain way. Um and and to give more a little bit more information back to complement the test result to make sure that they're executing the test in the right way.
I think we have time for one last question. Since testing became quite fast now, what's the current bottleneck on shipping faster forks?
Yeah, I mean, testing is one piece of the puzzle. Um uh coordination is um is is still, I'd say, the bigger biggest bottleneck. Um iterating and talking to people and perhaps I'd say maybe one of the hardest things is to um get alignment on the spec. So, uh sometimes we might one client team or client developer might interpret the spec in one way and another might interpret the other another way. And both could be interpreted as correct.
And so, they one of them might fail the tests, but then we have to decide which spec is correct. And so, all this discussion takes time and and care and thought. And maybe the researchers who wrote the EIP even need to think carefully about the implications for the feature that they they didn't realize yet.
Thank you so much. I think
Automatic transcript — names and jargon may be misspelled.