Giter VIP home page Giter VIP logo

erc7546ucs-tdd-example's Introduction

ERC-7546 UCS TDD Example

Overview

This project was born to solve unconfortable UUPS-based testing/devops experience. UCS is a reusable, maintainable, and testable design pattern for upgradeable smart contracts.

The downside of UUPS testing are

  • You must be proxy-concerned.
  • One-implementation, one proxy.
  • Hardhat.
  • "BigNumber"
  • Slow.
  • State preparation via complex scenario.

The virtue of UCS testing are

  • Just unit test functions.
  • No proxies within your sight.
  • Foundry.
  • Just simply write Solidity.
  • Fast.
  • Fuzz-able state.
  • Each test case is loosely coupled, and changes will not be propagated.

Status

Intuitive and coflict-free state access

ProposeOp and MajorityVoteForProposal are sharing the same state. Functions can share their storage and you can treat UCS proxy as a singleton contract.

propose op majority vote for proposal op

Fuzzable state and faster test

The fuzz test of ExecuteProposalOp has "fuzzable" prerequisite state. This feature makes test faster because the total bytecodes which is generated by fuzzing feature is smaller unlike normal scenario testing.

execute op test execute

Code-size scallability and multi-tenancy

Upgradeable smart contracts are fat. It's upgrade logic is redundant and EVM's 24.576KB code size limit harnesses us to write great programs.

TallyForksOp example shows UCS is able to sustain several voting rule (even you can add token governance and quadratic voting!) in a singleton contract. You can even upgrade and clone such highly functional DAO proxies.

tallyforks test tallyforks

Performance

  • Commit 2ce217 forge test, solc 0.8.23, 2 files
    • Compilation time: 5.43s
    • Test running time: 105.02ms
  • Commit be2f7f forge test, solc 0.8.23, 8 files
    • Compilation time: 6.37s
    • Test running time: 110.27ms
  • You won't need to browse X (Twitter) every time you run test :)

Roadmap

  • More example like "ve" and "AA"

erc7546ucs-tdd-example's People

Contributors

shogochiai avatar kaihiroi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.