Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyspec framework #219

Merged
merged 90 commits into from
Jul 6, 2021
Merged

Pyspec framework #219

merged 90 commits into from
Jul 6, 2021

Conversation

lightclient
Copy link
Member

This is the initial framework for an eth1 pyspec.

Ethereum 1.0 lacks a comprehensive and accessible specification. This creates several pain points, but the most prevalent is that intricate core changes must spend a significant amount of time describing the current state of Ethereum, before even defining the proposed changes.

The Ethereum 2.0 spec has been a great example of "spec driven development". Eventually, we'd like to merge the two specs into a uniform, all encompassing specification. Until then, we've taken the liberty to experiment with a couple slightly different approaches than the eth2 specs:

  • generate documentation from code -- the eth2 spec is a collection of markdown files that can be transpiled into an executable python project. My understanding is that this was a natural evolution of the spec, which started as mark down and slowly became more explicit, until the point where if the code snippets were concatenated, they could actually run and generate tests. Since we're starting from scratch, we can make an unbiased decision. While we agree that a "narrative" spec is desirable, we are confident that Sphinx will give us complete control over the look and flow of the spec. It will require more effort than markdown, but we believe it will drastically simplify other portions of the toolchain (e.g. type checking and linting), make the raw spec more readable and maintainable, and allow us to use more tools that already exist instead of writing our own.
  • non-forking code -- the eth2 spec generally understands the concept of "forks" and handles them accordingly. We would like the eth1 spec to completely ignore the concept of forks and instead allow it to be "the latest version of ethereum". We believe this will lead to a simpler spec and simpler proposals for core changes. Forks are an unavoidable part of Ethereum though, so we'd like to support them via a release mechanism. For example, 1.x.x would be Frontier, 2.x.x would be Homestead, etc. We plan to write a handler program that runs specific releases up until a fork block and then shuttle the current state of the chain into the next release.

So, with that said, we are currently working on implementing the Frontier release of Ethereum. This is very much a work-in-progress still and everything is up for discussion. We feel the sooner this work is in the open, the sooner we can get feedback from the community and potentially find additional contributors.

As of this PR, we've successfully:

  • generated the mainnet genesis state root
  • passed a load of RLP and trie tests
  • passed a simple add + sstore test

We'll generally try to avoid writing our own tests wherever possible and instead rely on the ethereum/tests format. We plan to support the t8n interface so that the spec can generate test cases. We'd also like to eventually sync mainnet, but that may require some work arounds.

We're excited to hear people's thoughts and feedback :)

lightclient and others added 30 commits June 22, 2021 19:00
There's going to be a lot wrong with this. The documentation is
laughably sparse. The type annotations are loose at best, and completely
bonkers at worst.

I haven't actually tried to validate a block, so this commit probably
breaks everything...

At least the scaffolding is in place though!
lightclient and others added 10 commits June 23, 2021 11:54
Add upstream links to sphinx templates
Since the docstrings are rendered as HTML, there's really no reason to
include them in the code snippets. This commit adds a dependency on
undocliteral, a hacky tool to strip docstrings when using
literalinclude.

This commit also removes the types from parameters in docstrings. The
signatures are annotated and checked with mypy, so including the types
in the docstrings is just duplicated information that can get out of
sync.
Hide docstrings in included source code
…tioning

	- Add RLP encoding for the custom dataclasses in rlp module
	- Improve tests so that it verifies rlp and hash values for
	  blocks and headers
	- Verify state post state transition by blocks
Verify transaction root and ommers hash in header before state transitioning
@pipermerriam
Copy link
Member

I would nominate that this get merged soon so that additional changes can be done in smaller units and directly targeting this repository rather than the quilt fork.

@SamWilsn
Copy link
Collaborator

Agreed! None of us can actually do the merge though.

@pipermerriam
Copy link
Member

Still seeing a stream of commits coming in. You wanna give me a poke when you're ready with something stable.

@lightclient
Copy link
Member Author

@pipermerriam we can keep it stable until Monday if someone wants to merge this. I'm guessing by then, we'll have some more PRs that we'll want to get merged.

@timbeiko
Copy link
Collaborator

timbeiko commented Jul 6, 2021

@lightclient happy to merge this now if you think it's ready to go!

@lightclient
Copy link
Member Author

lightclient commented Jul 6, 2021

@timbeiko it's ready! :)

@timbeiko timbeiko merged commit f302484 into ethereum:master Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants