Code Monkey home page Code Monkey logo

eth1.0-specs's People

Contributors

samwilsn avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

samwilsn

eth1.0-specs's Issues

Separate pyspec test coverage from `ethereum/tests` coverage

Ideally we want every line of the spec tested in a format that is compatible with real world clients (like the ethereum/tests tests.)

To get a good idea of how much of the spec is covered by reusable tests, we should separate out the coverage reports for the pytest runs and the ethereum/tests runs.

Document code and style conventions

We should formalize any coding or style decisions not covered by black into a document somewhere in the repository.

For now, this issue can be a temporary place to collect these kind of decisions:

  • Name functions with short imperative phrases, avoiding extra words which don't add information (choose fetch instead of do_fetch).
  • Use exceptions for errors which are handled in-protocol (ex. OutOfGas), and assert for everything else.
  • Never use type: ignore unless absolutely necessary.

Audit integer type usage

Once #34 is merged, someone needs to go through every use of Uint and U256 and decide if it's using the correct type by comparing against the yellowpaper and/or client code.

Consider using Enum for Nibbles type

Currently, the trie implementation uses a bytes type for the sequence of nibbles, with the stated validation rules that each byte may be no larger than 15. This requirement doesn't appear to actually be enforced and it would be ideal if the type definitions actually constrained the inputs via the type system rather than runtime validation.

I would suggest using an enum.IntEnum for this:

class Nibble(enum.IntEnum):
    NIBBLE_0 = 0x0
    NIBBLE_1 = 0x1
    ...
    NIBBLE_F = 0xf

Nibbles = List[Nibble]

Not only will this give you strong guarantees on anything that needs to take a Nibbles type as an input, but it also lets you have runtime validation for free

def bytes_to_nibbles(value: bytes) -> Nibbles:
    return [Nibble(v) for v in value]  # will raise a TypeError if the value isn't part of the Enum)

Rewrite trie for clarity

The current trie code has inherited the language from the yellow paper. It's pretty opaque, it would be useful to go through and rewrite/clean up.

Rewrite RLP for clarity

The RLP code has inherited the naming scheme of the yellow paper. It would be good to rewrite for clarity.

Exclude the docstring from source snippets in generated documentation

I'm thinking this can be done as a sphinx extension that subclasses literalinclude and somehow adjusts the line filter to skip the docstring.

The documentation currently has snippets like:

def BE_inverse(b: Bytes) -> Uint:
    """
    Converts a sequence of bytes into an arbitrarily sized unsigned integer `x`
    from its big endian representation.

    Parameters
    ----------
    b : `eth1spec.eth_types.Bytes`
        Bytes to decode.

    Returns
    -------
    x : `eth1spec.number.Uint`
        The byte sequence `b`, interpreted as a big endian unsigned integer.
    """
    if verbose:
        print("BE_inverse(", b.hex(), ")")
    x = 0
    for n in range(len(b)):
        # x+=b[n]*2**(len(b)-1-n)
        x += b[n] * 2 ** (8 * (len(b) - 1 - n))
    return Uint(x)

But we want them to look like:

def BE_inverse(b: Bytes) -> Uint:
    if verbose:
        print("BE_inverse(", b.hex(), ")")
    x = 0
    for n in range(len(b)):
        # x+=b[n]*2**(len(b)-1-n)
        x += b[n] * 2 ** (8 * (len(b) - 1 - n))
    return Uint(x)

Live doc view

Maybe this is already possible, but it would be help get a simple command setup that will host the docs as you live edit.

Create a hardfork-aware "runner" that can sync mainnet

I'd like to see a tool that sits above the eth1spec packages which can handle syncing mainnet, including the transitions between hardforks.

This, perhaps obviously, requires some kind of knowledge of hardforks and transition code. We've been thinking that we can put each hardfork on its own git branch, and tie them all together in a descendant package.

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.