How Superform Uses Virtual TestNets for End-to-End Testing to Ship Faster With Confidence
"Our process for Superform v2 has been mostly focused on how to ship new features faster and be more confident that what we’re shipping is secure. Doing it on Virtual TestNets made it possible and way more affordable."
Vikram Arun
Co-founder of Superform
Designed to make DeFi more accessible to retail users, Superform is a full-scale neo-bank, fully decentralized and built on natively crypto rails. It aims to onboard DeFi newcomers in a simple, streamlined way while enabling them to interact and earn using complex strategies. Superform users can swap, earn, deposit, and spend assets across chains in just a few clicks.
In the background, Superform consists of two important components – the Core protocol and SuperVaults built on top of the protocol. The Superform Core involves modular hook contracts and ERC-7579 modules that compress the hooks into ERC-4337 user op bundles. The modules then execute these bundles. The use of modules brings flexibility and modularity to Superform users, who can install them in their smart accounts to expand core functionalities.
On top of the hooks, the Superform team built SuperVaults, validator-secured vaults that can execute strategies across chains. The SuperVaults have managers who can perform certain actions on the funds deposited into a vault while a validator network updates the price share. This approach gives Superform users secure, flexible access to vaults, as well as a permissionless way to create them.
To ensure the security and correctness of the v2 protocol, the Superform team runs extensive end-to-end tests on Virtual TestNets, a full replica synced with a production chain. Additionally, Superfrom uses Virtual TestNets as a public testing infrastructure for the v2 launch, allowing users to interact with the application without spending real assets.
The challenges of cross-chain testing in production
As a cross-chain application, Superform experienced challenges testing on a public infrastructure.
For v1, the Superform team deployed their protocol to ten different mainnets. The process entailed deploying their contracts to mainnets in stealth so the team could test the execution and integration under realistic conditions. While testing in production was a common practice, it eventually became too expensive and risky, especially with malicious actors on the lookout to break the code upon deployment.
On the other hand, deploying and testing on public testnets such as Sepolia wasn’t possible. Since Sepolia doesn’t have bridging routes and liquidity available, the team cannot test cross-chain interactions. It also lacks the full mainnet data essential for testing realistic scenarios.
So, the Superform engineering team needed a way to test on mainnets without using real funds. Initially, they used Tenderly’s Simulation API to simulate transactions, override chain states, and get test tokens for internal testing that would otherwise be too expensive on mainnets. However, once Virtual TestNets were launched, the Superform team quickly transitioned to using them as their development and testing infrastructure.
“It was really easy to integrate Virtual TestNets in our existing workflows, requiring a simple RPC replacement. We can now run the same smoke tests, send mock balances, and see what certain flows would look like in production.”– Vikram Arun, co-founder of Superform
How Superform runs end-to-end tests on Virtual TestNets
The Superform v2 has more components than v1, requiring more extensive end-to-end testing. Virtual TestNets significantly improved the integration process for the team, allowing them to integrate all Superform components – the core protocol, frontend, and backend – on a common development infrastructure.
“Our process for Superform v2 has been mostly focused on how to ship new features faster and be more confident that what we’re shipping is secure. Doing it on Virtual TestNets made it possible and way more affordable.” – Vikram Arun
First, the Superform protocol team deploys new contracts to Virtual TestNets. Once tested on the protocol side, the backend team can then plug in and test the ERC-4337 user op bundlers as well. Finally, the frontend team can seamlessly integrate using the Virtual TestNet RPC, testing the entire integration on a shared, consistent state.
If everything executes as expected, the Superform pushes the integration to a staging environment with a mainnet contract deployment and connects it with their data pipeline. Once the final checks are done, the team deploys the entire setup to production, knowing everything works as expected.
How Virtual TestNet state syncing facilitates secure deployments for Superform
The development and testing of SuperVaults have a lot of dependencies since they entail depositing into third-party vaults and require up-to-date oracle prices.
With their previous setup in Foundry, the team realized that redemption checks in the SuperVaults were based on a highly fluctuating price per share of a vault. However, they couldn’t reproduce this flow in Foundry since they had to use a mock price.
On the other hand, when interacting with third-party contracts on Virtual TestNets, the Superform team can test on a state synced with the production chain:
- The Superform engineers get complete onchain data that mirrors the most recent conditions of the forked chain by turning on State Sync on Virtual TestNets.
- They can test with values that match the mainnet state, such as up-to-date oracle prices.
- With a full mainnet replica, the Superform team can preview the execution as if in production, minimizing the risk of unexpected failures or overlooked bugs.
How the fully integrated dev toolkit speeds up issue resolution
Additionally, the Superform team has been able to further speed up their development and testing processes thanks to the built-in explorer and contract verification on Virtual TestNets. The fully integrated dev toolkit allows the team to simulate different transactions within Virtual TestNets and inspect the execution directly in the Tenderly Dashboard.
“Virtual TestNets win from a development perspective over just deploying to a testnet because of the explorer and essential tooling all integrated into one UI.” – Vikram Arun
For instance, the Superform users can simply share a link to failed transaction simulations on a Virtual TestNet so that the team can troubleshoot them. The developers can also use the built-in explorer to inspect failed transactions and determine whether the issue was due to a bad parameter or a misconfiguration in a hook.
How users interact with the Superform app on Virtual TestNets
The Superform deployed their v2 on a Virtual TestNet under their own domain, opening it for public beta testing. As a full replica of a production chain, Virtual TestNets provide a realistic, yet safe environment for users to interact with Superform without spending real assets. The users set up smart accounts on Virtual TestNets by either linking their existing EOAs or creating an embedded smart wallet.
Whenever users create accounts, the Superform developers watch and index those events from the Virtual TestNet RPC using Goldsky. Next, they send users 10 different test tokens via a simple script so they can try out the application. Via the Superform testnet portal, the team also gives users a flow of transactions to test out on the Virtual TestNet.
“Virtual TestNets have been really helpful in crafting a UX experience for our end users. Seeing real vaults such as the Morpho Steakhouse and being able to deposit and interact with real protocol contracts was really cool.” – Vikram Arun
By staging their application for public testing on Virtual TestNets, the Superform team was able to collect valuable feedback on their product in just a couple of months.
“I’m really glad we switched to Virtual TestNets. We’ve been running public testing for two months, and we’ve been able to clear out a lot of bugs on our frontend and in our offchain architecture. Overall, this helped us get feature requests and valuable feedback on our app in general.” – Vikram Arun
The next step for SuperVault testing
The SuperVaults use hook contracts and the Superform Core protocol to execute actions and make money. With the v2 launch, it will be permissionless to add new hooks, allowing users, for instance, to add a looping hook on Morpho.
The Superform team intends to test these interactions on Virtual TestNets first to protect users’ assets, potentially saving millions of dollars. Virtual TestNet features such as State Sync are essential for testing realistic integrations with vaults and third-party protocols such as Morpho.
“We’re excited to keep using Virtual TestNets. They helped us test out a lot of stuff that would otherwise cost us a lot of money in production.” – Vikram Arun
With Tenderly’s support, the Superform team has an advanced development and testing infrastructure to test real-world interactions in their application. Aside from creating the best possible experience for their users, having infrastructure that replicates production conditions can help minimize the risk of critical errors and prevent potential losses caused by overlooked dependencies.
To give Virtual TestNets a try, head over to the Tenderly Dashboard and fork a chain within milliseconds!