April 18, 2022: Vyper Pilled ππ
Vyper 0.3.2 Launch brings Dynamic Arrays, Solidity ABI Compatibility
Vyper version 0.3.2 has launched! With dynamic arrays, 100% Solidity ABI compatibility, and assorted gas savings, you might want to remember where you were when you heard of the announcement.
Dynamic Arrays
This feature is literally years in the making. This issue was first opened on Github in May of 2019, a bygone era when one could buy a whole Ethereum for $250 USTT and Bored Apes werenβt yet a glint in midwitsβ eyes.
For background here, arrays are used all the time in all varieties of programming languages to store lists of data. The constraints of storing data on the blockchain efficiently requires several tough workarounds to implement arrays.
Solidity was always very flexible to work with dynamic arrays. Vyper, however, is obsessed with security as a core principle and strictly nerfed these arrays from the outset. Potentially uncapped arrays were considered an attack vector. Whenever a smart contract could spiral to infinity, it becomes impossible to estimate gas limits. This could be exploited in a gas attack, so Vyper decided all arrays should be fixed length.
Even though Vyperβs approach is safer, the lack of flexibility is a pain point for developers moving from Solidity to Vyper. Even the Vyper documentation sample scripts showcase these constraints. In this case a blind auction contract caps bidders at an arbitrary 128 bids.
From a programming standpoint, this required some extra legwork to manage the bids. New bids would require creating an array with 128 empty bids. Working with the array often involved looping through the entire thing until it hit the current state.
This all means a task that is relatively trivial in Solidity would become an unexpected hassle for newcomers to Vyper. Hence the excitement that Vyper now supports dynamically sized arrays.
To be clear, the Vyper implementation of dynamically sized arrays still requires an upper limit β Vyper will likely never permit infinite upper bounds. The innovation here is the ease of working with arrays, which now act much more like the arrays to which python programmers are accustomed.
Solidity ABI Compatibility
The ability to support dynamic arrays had previously prevented an exact 1:1 mapping of ABIs between Vyper and Solidity. Now that Vyper supports dynamic arrays, the two are fully compatible.
The ABI, or application binary interface, is the means by which we interface with smart contracts. Smart contracts compile to an ugly mess of bytecode when they are deployed, so itβs impossible to interact with smart contracts without a roadmap of the smart contractβs functions and how to interact with them.
This fundamental incompatibility was the central thrust of this release:
Full ABI compatibility resolves yet another issue years in the making. Solidity remains dominant across Ethereum, making it very difficult for Vyper to natively interface with the entire ecosystem of smart contracts.
In fact, Vyperβs comprehensive implementation of ABIs now technically moves it into the lead in terms of full support of EVM ABI compatibility.
Optimization
Impressively, these new features do not come at the expense of performance. In fact, Vyper 0.3.2 is now even more efficient.
The efficiency of Vyper is fast becoming the killer feature of the programming language. In this stress test of a vanilla ERC20 token, Vyper blows Solidity out of the water.
With the next odd-numbered release focused on tweaks, weβll be eager to see just how low the floor can go here.
Reaction
This launch is Vyper pilling a number of devs.
Before now, developers could be forgiven for considering Solidity versus Vyper to be an apples vs. oranges situation. βVyper may be more efficient, but I really need full Solidity ABI compatibilityβ¦β
Gone are the days when Vyper is a quirky and substandard Solidity alternative. Arguably, Solidity is now a less efficient version of Vyper.
Even senior Solidity devs are taking a second look.
Support
In addition to the core team, the Vyper magic is made possible by a batch of new contributors.
Thanks also to the hard work of behind-the-scenes compiloooors.
This is also a big win for Vyperβs recent veFunder gauge. Curve Finance can offer superior performance in part due to being architected on Vyper, and in turn Curve is piping a small portion of its inflation directly to fund Vyperβs development. The rapid launch of Vyper version 0.3.2 may be the quickest return on investment in crypto history.
If you are interested in supporting Vyper, how can you help? One of the best ways is simply to expand the ecosystem by using Vyper. Itβs easy to get started.
Where to next though?
In addition to the Vyper documentation, a key resource is the material created by @BowTiedDevil:
The Vyper community remains short on such educational material. If you are technical, you can help the community by creating such material.
Our cheesy video wonβt cut it here. Lotβs of opportunity, and itβs easy to step up here. Free views for whomever records their own YouTube video detailing these differences in detail.
Another potential opportunity to contribute is to simply try to code your own sample scripts while concurrently documenting your efforts. Simply publish it as a blog post or video, and just like that youβll have launched the go-to resource for newbies to follow to get started with Vyper.
So get at it!