Git Product home page Git Product logo

fuel-v1-contracts's Issues

[WIP] Consistent naming needed

  • Pointers (i.e. uint256 variables that point to a memory location) must have a Ptr suffix.
  • Getters must have distinct names, otherwise it's easy to have a collision with the obvious variable name.
// is
let varNameTemp := Class.varName(object)
// should be
let varName := Class.getVarName(object)
// or
let varName := Class.get_varName(object)
  • "Select" methods are opaque. Should be renamed to something like getFooAtProofIndex().
  • Names of inputs to provers and verifiers should be consistent. inputProof should be reserved for a transaction proof for an input. For state elements, use something like stateElement.
  • Pos -> Ptr consistent renaming.
  • Function names that do an action (e.g. compute something) should have that action in their name.
  • Use explicit Yul types.
  • Use . in function names consistently. . should only be used for implicit substructures (e.g. a block in a transaction proof, since Yul+ currently doesn't support that).
  • Use .. to scope top-level class methods (e.g. Class.method() becomes Class..method()), as a replacement for the usual :: scope operator.
  • Namespace methods consistently and correctly (e.g. UTXO should not be under TransactionProof).
  • Change call order for nested functions. May require using multiple return values. Note: major refactor.
// is
Class1.object2.method(object1, in2)
// should be
Class2.method(Class1.object2(object1), in2)
// or
Class2.method(object1, in2)

Patch: Fix funnel self-destruct

We will need to remove self-destruct, in favour of funnels which are just reused over time per user.

This way we don't have any code execution vulnerability surface.

Fix fee calculation

  1. When proving an invalid sum, the fee should use the transaction leaf length, not the entire list of transactions.
  2. The transaction leaf length should include the size of the length value, to ensure the root fee is aligned.

Document and refactor contract verification

Contract verification is currently not documented. The readme should include a section that details exactly how to run verification (most importantly, what environment variables to set).

Inline with above, the current verification flow requires a bunch of extra environment variables for deployment that aren't actually needed. The deploy/verify script needs to be refactored so verification happens via a different path than deployment, so only the minimum number of environment variables need to be set if you only want to verify.

Benchmarks: Reformat

Currently our benchmark data is displayed as such:

ok 8 - Transactions Submitted: 25000
ok 9 - Roots committed: 87
ok 10 - Blocks committed: 1
ok 11 - Cumulative gas used: 45709301
ok 12 - Ethereum blocks used: 5
ok 13 - @$100 USD per Block: $500 USD
ok 14 - @$50 USD per Block: $250 USD

We want it like this:

Transactions Submitted: 100000
Roots committed: 360
Blocks committed: 3
Cumulative gas used: 185387356
Ethereum blocks used: 23
@100 Gwei: 18.539 ETH
@$300 USD / ETH: $5562

Patch: up test coverage

We will need to up our test coverage:

  1. Add in simulations and scenarios tests
  2. Add more test coverage of multi-token multi-owner multi-type transactions and fraud proof cases
  3. Add more test coverage generally across all methods

Separate block header verifier

The block header verifier should be split up into a block header verify and root header verifier, instead of lumping them together.

Verification Script

npm run verify

A simple verification script that will allow you to plug in either an Etherscan or Infura key and verify the contract build and construction data.

Simplify block header verify to just compare hashes

Verifying the block header is not actually be needed, as it's verified on commitment. Simply hashing the header and comparing it to the known header hash at that height is be sufficient. The checks before that can be removed.

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.