TrueFi Engineering
Published in

TrueFi Engineering

Smart Contracts testing still sucks, how we want to make it better

Despite these challenging times, we remain very optimistic about the future of Ethereum ecosystem. Earlier this year, when ETH price crashed, MakerDAO challenges arose. More recently, dForce protocol and Hegic have been hacked. And yet, we perceive it as a healthy part of ecosystem growth. As it is being tested, new problems arise and they need to be solved. Yet another important step in a long journey to a wide adoption.

Despite great optimism on the product’s side, we see many problems behind the curtains. One very close to our hearts relates to tooling for smart contracts development, which seems to be lagging behind. Not only is writing smart contracts still slow, error prone and somewhat cumbersome, but also we consider testing smart contracts challenging and at times even annoying.

We believe that smart contracts testing should be easy and fun. Good tests encourage developers to test more, build better code and refactor more often, which is highly correlated with better security and low development costs. Still, we find progress in terms of tooling somewhat disappointing.

What we find exciting is that, though written a while ago, our tool Waffle is now getting more and more popular. We discover over and over again that yet another acknowledged project is using it.

Waffle is also the default testing framework for BuidlerNomic Labs’ building tool, with its adoption growing faster and faster.

While we see Waffle as a great start to build a better experience for smart contract developers, it doesn’t meet our high expectations on what a good tooling for writing tests should look like, yet.

And so, we are very glad to announce that our initial efforts have been appreciated and we have received a grant from Ethereum foundation to work on better testing experience with Waffle.

Grant: Waffle new exciting features

We will be working on Waffle version 3.0 and introducing exciting new features, including:

  • Support for mocks, so that you can create a dynamic mock quickly from javascript e.g.
const mockContract = await deployMockContract(wallet, Contract.interface);
await mockContract.mock.add.returns(2);
await mockContract.mock.mul.withArgs(2, 2).returns(4);
await mockContract.mock.div.withArgs(3, 0).reverts();
  • Support for fakes and putting expectations on function calls e.g:
expect('functionName').to.be.calledOnContract(contract)
expect('functionName').to.be.calledOnContractWith(contract, ...args)
  • Support for testing with ENS
  • Support for contract flattening
  • Simplify configuration files
  • Support Ethers.js version 5.x
  • And more!

Other awesome features

There are other Waffle features we were working on in the meantime and we hope they will make you as excited as we are. Two honorable mentions are:

  • Support for Vyper compilation
  • Show file name and line number when revert occurs, e.g.

Acknowledgements

We would like to take the opportunity to thank the Nomic Labs team, who are at the frontier of Ethereum tooling. Their support made it all possible for us.

So, what’s next?

We are working hard and will deliver the features described above. We will post updates soon. Stay tuned!

Did you like the post? 👏👏👏

We are Ethworks!

Truly remarkable team for your blockchain project.

Find us on Twitter and Dribbble.

--

--

--

Team working on TrueFi talks about OSS (useDApp and Waffle), good software engineering practices and more!

Recommended from Medium

What could kill blockchain? 3 big challenges it has to overcome.

On stress tests and improving the IOTA networks

Status Report 08/25

Blockchain Application Review — Credit Management and Credit Ratings

Can Morpheus Labs Influence The Growth of Blockchain?

MOFI Features

Winners of Alastria Open Call! Building value through diverse DLT capabilities

Recapitulation of LEAF DeFi AMA event held at AMA LOVERS CLUB group chat

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Marek Kirejczyk

Marek Kirejczyk

Ethereum blockchain Engineer. Ethworks, Universal Login.

More from Medium

Building your first Dapp with Solidity on the Polygon Blockchain

Transaction-Dependency

A Spacewalk with IPFS and Geeky Farmers

Mastering Blockchain Development: Hardhat Implementation on Testing Smart Contract With TypeScript