Giter Site home page Giter Site logo

fuellabs / fuel-v1-contracts Goto Github PK

View Code? Open in Web Editor NEW
85.0 9.0 18.0 4.24 MB

⚡ The Fuel optimistic rollup in Yul+ for the Ethereum Virtual Machine

Home Page: https://docs.fuel.sh

License: Apache License 2.0

JavaScript 81.53% Solidity 18.47%
optimistic rollups ethereum layer-2

fuel-v1-contracts's Introduction

Fuel

Fuel

Fuel is a high-performance optimistic rollup optimized for ERC-20 transfers and swaps, designed for interoperable performance, scalability, and efficiency.

Node.js CI License Community

Features

  • Completely decentralized: non-custodial, censorship resistant, and permissionless
  • The most scalable optimistic rollup in the world, with unique UTXO-based design
  • Up to 10,000 TPS surge intake capacity
  • Send and receive using any Ethereum address, no registration required
  • ETH and all ERC-20 tokens are supported
  • Non-custodial token swaps between any tokens
  • Fees can be paid in any token, not just ETH
  • HTLCs for cross-chain atomic swaps and additional usecases
  • Withdrawals in under 10 minutes using atomic swaps
  • Interoperable, any contract or address can use, verify, and control assets on Fuel

See the detailed specification for a more intimate overview of the design decisions behind Fuel.

Building From Source

Install Dependencies

Install Node.js >= v10.16.0.

Then run:

npm install

Build

npm run build

Run Tests

Run all tests using:

npm test

Run Benchmarks

Run all benchmarks using:

npm run benchmark

Run Verify

Verify the Mainnet deployment of Fuel using:

npm run verify

Specify an Infura Project ID key as fuel_v1_default_infura in your environment variables.

fuel-v1-contracts's People

Contributors

adlerjohn avatar leviathanbeak avatar silentcicero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fuel-v1-contracts's Issues

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.

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.

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.

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.

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

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.

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.

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

[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)

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.