Giter Club home page Giter Club logo

vulcan's Issues

Improve console

Currently we use the same API and a similar underlying implementation as forge-std console2. The difference is that we use a custom type constant that provides the log functions through a library and using ... for.

The reasoning was to allow extending the console by creating other libraries that add log functions for user defined types (structs, enums, etc). The downside is that it isn't consistent with the other modules (for other modules a library is imported instead of a custom type constant).

Figure out if there is a better way to achieve this.

Improve error messages

We should probably prepend the module and function that is throwing the error, e.g. revert("accounts.impersonate: ...")

Get rid of `selfdestruct` on `watchers`

Currently we are using selfdestruct on the stop functions in the Watcher contract. selfdestruct is deprecated so every time the Watcher contract gets compiled a warning appears which is annoying.

We need to find a way to get the same functionality for the stop function but without using selfdestruct

Scripts

  • Have a functional Script base contract
  • Brainstorm future features

Unsafe functions

We have two options:

  • Create an unsafe modifier for functions that should only be used in tests. This will make those functions revert at runtime when using them in Scripts.
  • Make it similar to stdStorage, they have a safe library and an unsafe one. We can have different entrypoints like script.sol and test.sol, and only use safe libs in script.

Update Readme

Update the readme file including:

  • Link to external documentation (if that's already setup)
  • How to install vulcan
  • How to use vulcan
  • Examples on how to use different namespaces
  • How to contribute to vulcan

Config module

Figure out if a new module makes sense for rpcUrl methods. It could also include other helpers such as isTest, isScript, etc. Another alternative would be to add these to an existing module such as ctx or env.

Format code

  • Format the whole codebase using forge fmt.
  • Update the ci configuration to either fail if the code is not formatted or to automatically create a PR with the formatted code

Investigate adding a global event watcher

It would be cool to have something like:

import {Test, events} from "vulcan/lib.sol";

contract TestMyContract is Test {
      function testMyContract() external {
          events.watch("Transfer(...)");
          // Do stuff...
          Log[] memory logs = events.getWatched("Transfer(...)")
      }
}

User-defined gas reporting

Foundry's built in gas reports leave a lot to be desired. Often times what I want to test in terms of gas usage is not 1:1 with tests, so creating individual tests just for the purposes of making a call to determine gas usage feels a little silly.

In our recently overhaul of MUD internals, we've added our own gas report tooling using a special // !gasreport line in our tests that wraps the next line in a gasleft() calculation, executes the test, and then records the gas usage to a file that we check in and compare in each PR to see how gas is changing. This works but is very slow and clunky.

I'd love for some official Solidity gas reporting support, something along the lines of:

function testBehavior() public {
  // calculates gas used by next line 
  reportGas('abi encode');
  abi.encode('hello world');

  // calculates gas within the start/end calls
  // block added for readability
  startReportGas('mint and burn');
  {
    mint();
    burn();
  }
  endReportGas();
}

Related:

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.