Live reading scheduled for 8:30 AM PT
Twas bripto, and the slithy toves
Did gyre and gm among the weebs:
All MIMsy were the bagholders,
And the meme raths outdweeb.
“Beware the Titanoboa, my son!
The jaws that bite, no coils Esc!
Beware the Pudgpudg pengu, and shun
The fungible Bored Ape!”
—@CryptoCarroll, probably
Did you know that once upon a time there was a snek too big to step on?
Sixty million years hence, the South American Titanoboa grew 13-14 meters long, making it the largest snake yet discovered.
It’s fitting this reptile inspired the naming of a massive new Vyper feature.
You may have seen some noise about Titanoboa, let’s translate why this is of interest to the casual crypto follower.
The story traces back, as it so often does, to our esteemed warrior bunny.
The “EVM Burden” cited here is that running blockchains are moderately computationally taxing. Yes, Ethereum is so efficient you can run a complete EVM on a Raspberry Pi, but it will basically max out the device. Particularly taxing is the overhead in connecting to an RPC, (ie via Alchemy or Infura), which requires frequent network calls and ends up slowing down execution by several orders of magnitude.
If you are, say, running hundreds of thousands of iterations to optimize a smart contract, the burden of connecting to an RPC via EVM grows intense. When you can test this on your local machine, you could run this in minutes. The current work flow might involve starting some tests and then stepping away for several hours.
This burden may not affect simple contracts, like a left bell curve NFT drop, but if you want to rigorously probe a contract utilizing higher level Egorov invariants, you’ll start running up against these speed limits.
Smart contract developers have plenty of tools that provide improvements to the testing process. Readers who may be familiar with Brownie can perhaps understand how this fits into the equation. Brownie allows you to set up comprehensive tests written in Python, which already make developers’ lives better because you can easily zoom in on a single misbehaving test. The entire testing suite may take hours, but one single test might bork in a few seconds so it doesn’t terribly disrupt the dev’s workflow.
The bottleneck becomes re-running every test. As a matter of practice, you should do this whenever you make significant changes to the underlying smart contract. A powerful feature of Brownie is iterative testing over large ranges of values and test results, referred to as property-based testing. Running such tests can take hours for sufficiently complex contracts. So the dev clocks out early, slumbers while the full tests run, and wakes up to see what needs to be fixed over the sweet aroma of coffee. At this pace it can be “weeks” or “months” to launch.
The 0 to 1 innovation of Titanoboa (shorter: Boa) is to embed a simple and fast internal EVM against which Boa executes code directly. The internal EVM is quick and lightweight, basically processed as interpreted Vyper. It’s also a beautiful work environment.
The above tweet by @bantg inspired @big_tech_sux to slap together Boa in half a week:
Yes, all this in four days, faster than it takes you to dream up an excuse why you did no work this week.
Boa replicates the execution of a Vyper smart contracts purely within Python, as opposed to compiling and running against an external EVM. This solution misses on some of the more featureful aspects of a slow RPC, (such as testing against a forked mainnet), but in return, Boa strikes with lightning speed. Notice the below output is measured in microseconds (μs), not seconds or minutes.
Not only does Boa allow for incredibly fast execution of smart contracts for developers, but Boa gives devs access to more features to help in the debugging process. Executing scripts in raw Python allows devs to natively utilize any of the myriad development tools built for Python over the years, making Boa composability very promising.
Given that Boa is natively integrated into Python, as opposed to a bolted-on external appendage, the experience of working with Boa becomes seamless. Nodes are clunky, and something is always lost in the crosswise communication. Using Boa to work completely within pure Python is a pleasure.
One of the knocks against Vyper by Solidity devs had been insufficient tooling. However, I’m not aware of any native Solidity equivalent as fast or fully-featured as Boa. Not to revive a flame war, but perhaps the tables are turning when it comes to tooling?
The core of the problem is that simulating transactions an RPC is slow, slow, slow relative to straight Python. We’re talking about differences of microseconds. When you need to test against the EVM, the seconds turn to minutes turn to hours.
Vyper devs are, predictably, elated by the development.
Amidst a broader bear market, Vyper is shipping like we’re still in the bull.
Hot Vyper Summer confirmed!
If you want to try it out, it’s best to compile directly from Github. A PyPl repository exists to domain squat, but the latest build is kept directly within the Vyper repo to keep dev cycles faster.
If you’d like to help out, particularly if you have compiler or EVM experience, remember that team Vyper is hiring, thanks to veFunder!
A final shower thought. Smart contracts support the capability of running fairly advanced math. A promise of DeFi would seem to be smart contracts executing highly complex strategies. Yet very few DeFi offerings seem to encode higher level math. Of course Curve pops to mind, as does Dopex, but are there any other protocols out there that match or exceed these primitives in terms of utilizing the full potential of distributed computing to create truly novel applications? I’ll take my answer offline.