Jan. 7, 2021: Vyper Dynamic Arrays ๐๐งฎ
It's Always a Great Market to Build or Support Builders
A heavily anticipated release for the Vyper language dropped last night. Vyper dynamic arrays, years in the making, got merged into the main branch yesterday.
For the uninitiated, smart contracts on Ethereum are executed as a very efficient but difficult to read EVM bytecode.
To make it easier for humans, Solidity and Vyper are tools that translate human readable code into this bytecode. Solidity launched first and has the most resources around it. Vyper emerged second to offer a language more like Python, as well as greater security and some additional optimizations. Both pretty much reduce to the same bytecode at the end of the day, we described these differences in more detail when Vyper 0.3 launched.
One of the biggest differences between Vyper and Solidity has been the difference in handling dynamically sized arrays. Vyper, being more focused on security, started with fixed size arrays in mind. If an array could grow to infinite size, theoretically itโs a security risk (although it practically runs up against the EVM cap). In contrast to Solidityโs permissiveness, Vyper required arrays be fixed size.
In some occasions, this can affect the contract structure. If youโve been following the Curve Brownie tutorial, you perhaps noticed the tortured contract design needed to work around these limitations. This specific issue gets noted directly as the handsome host is forced to fork his code in a horrendous manner to work around this limitation and build a contract to handle Curve pools of arbitrary coin counts:
The tech debt would end up snowballing as additional functionality was added. The new Vyper feature can turn the above block of code into nearly a single line:
liq_arr: DynArray[uint256, 4]
It appears when this is integrated into Vyper 0.3.2, this will make Vyper ABIs and Solidity ABIs fully compatible, allowing for more universal communication between all types of smart contracts.
Presumably the different interfaces we needed to create for 2pools, 3pools, and 4pools in the example above will also be squashed into one interface with such a dynamic array.
This integration took so long because this seemingly simple frontend adjustment required a lot of heavy duty refactoring to make this work efficiently on the backend. In fact, it took years to get this right. Code chads will enjoy reading through the Github commit documentation for details.
Itโs great work that will have direct practical impact. Among other things, some recent EIP standards relied heavily on dynamic arrays. This new release could, say, enable easier creation of a ERC1155 token using Vyper.
If youโre interested in trying your hand at smart contract development from scratch, consider starting in Vyper. Building and releasing projects using Vyper can have an outsized impact on growing the ecosystem. Plenty of opportunity to release projects that fill gaps in the ecosystem, like launching Vyper versions of various EIP specs.
Growth of Vyper projects is useful for promoting adoption across other services. Among other things, verifying source code on Etherscan is very important for allowing users to interact with contract. The Etherscan team does amazing work and is quite busy, so demonstrating growing demand for new versions of Vyper is important.
Even if youโre not a developer, thereโs a ton of ways you can help the ecosystem.
Donations are a particularly important way to support the community.
Assorted open-source blockchain tools support trillions of dollars worth of value, but often time the developers are doing so on a volunteer basis. Last year two Bitcoin devs stepped down, seemingly due to lack of funding.
Weโre surely likely to see more initiatives to help fund cryptocurrency core developers over the next few months. The Ethereum developers, for their part, are among the fastest and smartest people in the world and deserve to be compensated as such. If youโre getting rich off of the hard work of developers, consider giving back to the community.
Bitcoin: https://bitcoindevlist.com/
Ethereum: https://gitcoin.co/
Drop others in the comments
One final aside while weโre on the subject of development. We had to share this great thread on NatSpec commenting!