Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
b6e6464
intitial frontier plumbing
lightclient May 31, 2021
5c11e98
sketch out evm structure
lightclient Jun 2, 2021
fb81a9e
add receipts, logs, crypto, and rlp
lightclient Jun 2, 2021
dff84e9
wip
lightclient Jun 2, 2021
feef9a1
add gitignore
lightclient Jun 3, 2021
5fb4305
add trie code
lightclient Jun 3, 2021
90a067b
many cleanups
lightclient Jun 3, 2021
f9362fc
calculates genesis alloc state
lightclient Jun 3, 2021
ab527a2
apply coinbase pay out
lightclient Jun 3, 2021
df6ff3c
Set up a basic build system
SamWilsn Jun 3, 2021
15e01a1
Reformat everything
SamWilsn Jun 3, 2021
48e603a
Fix as much as I am willing to today
SamWilsn Jun 3, 2021
fe4fd53
Add github action for testing
SamWilsn Jun 3, 2021
0c90689
Stricter linting; lint docstrings; add doc target
SamWilsn Jun 4, 2021
bcee4aa
First pass at typing and documenting the spec so far.
SamWilsn Jun 6, 2021
69d75f0
Make the documentation look a bit better.
SamWilsn Jun 7, 2021
06343c0
Deploy sphinx documentation to gh-pages
SamWilsn Jun 7, 2021
3f2febf
Import Uint from number so links work
SamWilsn Jun 8, 2021
b1fd56e
Update the readme with some instructions
SamWilsn Jun 8, 2021
17be6ab
Upload test coverage to codecov
SamWilsn Jun 9, 2021
de0ed17
move main.py to the top-level and use the spec as a lib
lightclient Jun 6, 2021
0c0a4ae
accept sequences in rlp encode and use correct types in t8n runner
lightclient Jun 6, 2021
3278013
delete fixtures
lightclient Jun 6, 2021
23bb5ad
add ethereum/tests as submodule
lightclient Jun 6, 2021
7aac820
touch up min runner
lightclient Jun 6, 2021
b131ac5
pass typechers, test still failing
lightclient Jun 6, 2021
6342302
fixture loaders working
lightclient Jun 6, 2021
5f83c5c
pull submodules in ci
lightclient Jun 7, 2021
7848bde
sanity check passing
lightclient Jun 7, 2021
6dd2060
almost there
lightclient Jun 7, 2021
075f6ca
fix lint nits
lightclient Jun 7, 2021
27347d0
calc receipt and state tries correctly
lightclient Jun 9, 2021
512bf2f
fix nits
lightclient Jun 9, 2021
8a2bb3d
remove unused import
lightclient Jun 9, 2021
9a070b6
reorg imports
lightclient Jun 9, 2021
c5f613b
clean up converter script
lightclient Jun 9, 2021
c70880c
make evm ops look nicer in docs
lightclient Jun 9, 2021
6595f6b
clear up pr comments
lightclient Jun 9, 2021
b6e0aff
set some shell options in b2t
lightclient Jun 9, 2021
bd28800
use to_bytes to convert uint to big endian bytes and use correct typing
lightclient Jun 9, 2021
2fa8428
add branch to git submodule and update ethereum/tests
lightclient Jun 9, 2021
f07d20e
Unit test Uint
SamWilsn Jun 9, 2021
eeaa819
refactor evm into new module
lightclient Jun 9, 2021
e580673
add doc strings and type annotations
lightclient Jun 9, 2021
dd760f0
throw oog if frame runs out of gas
lightclient Jun 9, 2021
c228947
remove glob imports
lightclient Jun 10, 2021
d66e1ed
Code review comments
SamWilsn Jun 10, 2021
2634d1b
Fix documentation for submodules
SamWilsn Jun 10, 2021
63bfd6a
Reorganize types; move big endian encoding
SamWilsn Jun 10, 2021
d6a5aa5
Added github template for isuues and PRs
voith Jun 11, 2021
5823bf4
Added a note for cloning submodules
voith Jun 11, 2021
0a464df
Update issue templates
SamWilsn Jun 11, 2021
1e009da
Add CC0 for the root; and CC-SA-BY for yellowpapers
SamWilsn Jun 11, 2021
e6ebc89
Replace manual to_bytes
SamWilsn Jun 10, 2021
82618e0
Separate Uint & U256 (closes #24)
SamWilsn Jun 11, 2021
b1920ad
Little bit of packaging clean-up
SamWilsn Jun 12, 2021
4a3db03
Improve templates and module/package docstrings.
SamWilsn Jun 15, 2021
a4c75c3
translate trie code to english
lightclient Jun 10, 2021
e1c144c
more trie tests passing
lightclient Jun 20, 2021
6db040f
clean up lint nits
lightclient Jun 20, 2021
92dd806
fix somu feedback
lightclient Jun 21, 2021
12f8ae2
address sam's feedback
lightclient Jun 21, 2021
c4213dc
Make rlp module more readable and organized.
Bhargavasomu Jun 19, 2021
3170431
Review comments till v2
Bhargavasomu Jun 21, 2021
a40af87
Remove pytest fixtures in lieu of individual test functions
Bhargavasomu Jun 21, 2021
9f20cfe
Change decimals to hex values
Bhargavasomu Jun 22, 2021
d208b3c
remove yellow papers from repo
lightclient Jun 22, 2021
59a3619
rearrange readme slightly
lightclient Jun 22, 2021
58ce043
Merge pull request #44 from quilt/housekeeping
lightclient Jun 22, 2021
b02b24d
fix some of piper's nits
lightclient Jun 22, 2021
4382738
Merge pull request #45 from quilt/review-feedback
lightclient Jun 23, 2021
5d90d61
Add upstream links to sphinx templates
SamWilsn Jun 23, 2021
609fdb0
Merge pull request #47 from quilt/attribute-templates
lightclient Jun 23, 2021
d473e68
Strip docstrings; undoc parameters (closes #26)
SamWilsn Jun 26, 2021
80ec2cf
Fix rendering of parameters
SamWilsn Jun 26, 2021
2ef7858
Fix a couple hyperlinks
SamWilsn Jun 26, 2021
b75b4c9
Merge pull request #50 from SamWilsn/undocstring
lightclient Jun 29, 2021
d308242
Verify transaction root and ommers hash in header before state transi…
Bhargavasomu Jun 24, 2021
a851556
Add rlp encodable dataclasses to RLP type
Bhargavasomu Jun 30, 2021
e3873fa
Merge pull request #49 from Bhargavasomu/patr_tx
SamWilsn Jun 30, 2021
2804350
Implement storage gas calculator and refund counter for SSTORE
Bhargavasomu Jun 28, 2021
799a8d1
Merge pull request #51 from Bhargavasomu/refund
SamWilsn Jun 30, 2021
9232055
create a tox command for live preview
lightclient Jun 30, 2021
7decbaf
rename project to 'ethereum'
lightclient Jun 30, 2021
d6a1ab2
rename evm to vm
lightclient Jun 30, 2021
13414e4
Add step to build docs in ci (#56)
lightclient Jun 30, 2021
7555cfb
Merge pull request #55 from lightclient/live-preview
lightclient Jun 30, 2021
dfc5646
Merge pull request #57 from lightclient/rename-project
lightclient Jun 30, 2021
7e7339a
fix broken doc rendering
lightclient Jul 1, 2021
efe41d6
Merge pull request #58 from lightclient/fix-docs
lightclient Jul 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/blank-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: Blank Issue
about: Create a blank issue.
---
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/incorrect-documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Incorrect/Incomplete Documentation
about: Report that the documentation is wrong or incomplete
title: ''
labels: C-bug, A-doc
assignees: ''

---

### Metadata

* **Hardfork**: hardfork-name

### What was wrong?

<!--
What is incorrect? Try to describe what is wrong, and where the issue is located.
-->

### Sources

<!--
Link to documentation describing the correct behavior. Good sources include (but aren't limited to):
* Specification code itself
* Yellow Paper
* Client Source Code (preferably examples from multiple clients)
* Ethereum Improvement Proposals
-->

### Additional Context

<!--
Add any other context about the problem here.
-->
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/incorrect-specification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Incorrect Specification
about: Create a report showing the specification is wrong
title: ''
labels: C-bug, A-spec
assignees: ''

---

### Metadata

* **Hardfork**: hardfork-name

### What was wrong?

<!--
What is incorrect? Try to describe what is wrong, and where the issue is located.
-->

### Sources

<!--
Link to documentation describing the correct behavior. Good sources include (but aren't limited to):
* Yellow Paper
* Client Source Code (preferably examples from multiple clients)
* Ethereum Improvement Proposals
-->

### Additional Context

<!--
Add any other context about the problem here.
-->
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/tooling-problem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Tooling Problem
about: Create a report of a problem with the project tooling
title: ''
labels: C-bug, A-tool
assignees: ''

---

### Metadata

* Python: <!-- Something like: CPython 3.7 or PyPy 7.3 -->
* Operating System: <!-- osx/linux/win/... -->

#### `pip freeze`

<!--
Run `pip freeze` and put the output below.
-->

```
<put the output from running pip freeze here>
```

### What was wrong?

<!--
Please include any of the following that are applicable:

* The command-line which produced the error
* The full output of the error
* What you were trying to accomplish
-->


### How can it be fixed?

<!--
Fill this section in if you know how this could or should be fixed.
-->

### Additional Context

<!--
Add any other context about the problem here.
-->
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### What was wrong?

Related to Issue #

### How was it fixed?


#### Cute Animal Picture

![Put a link to a cute animal picture inside the parenthesis-->]()
31 changes: 31 additions & 0 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: GitHub Pages

on:
push:
branches:
- master
- pyspec

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.7"

- name: Checkout
uses: actions/[email protected]

- name: Install Tox and any other packages
run: pip install tox

- name: Sphinx
run: tox -e doc

- name: Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: .tox/docs_out
37 changes: 37 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Python Specification

on: [push, pull_request, workflow_dispatch]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python: [3.7, pypy-3.7]

steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install Tox and any other packages
run: pip install tox
- name: Run Tox (PyPy)
if: ${{ matrix.python == 'pypy-3.7' }}
run: tox -e pypy3
- name: Run Tox (CPython)
if: ${{ matrix.python != 'pypy-3.7' }}
run: tox -e py3
- name: Upload coverage to Codecov
if: ${{ matrix.python != 'pypy-3.7' }}
uses: codecov/codecov-action@v1
with:
files: .tox/coverage.xml
flags: unittests
- name: Build docs
if: ${{ matrix.python != 'pypy-3.7' }}
run: tox -e doc
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
.DS_Store
__pycache__
.AppleDouble
.LSOverride

__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

*.manifest
*.spec

pip-log.txt
pip-delete-this-directory.txt

.tox/

/doc/_autosummary

.coverage
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "tests/fixtures"]
path = tests/fixtures
url = https://github.com/ethereum/tests
branch = develop
35 changes: 35 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Creative Commons Legal Code

## CC0 1.0 Universal

> CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.

Statement of Purpose

The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").

Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.

For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.

1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:

1. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
4. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
5. rights protecting the extraction, dissemination, use and reuse of data in a Work;
6. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.

2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.

3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.

4. Limitations and Disclaimers.

1. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.

82 changes: 80 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Description

This repository contains various specification related to the Ethereum 1.0 chain, specifically the specifications for [network upgrades](/network-upgrades) and the [JSON RPC API](/json-rpc).
This repository contains various specification related to the Ethereum 1.0 chain, specifically the [pyspec](/src/eth1spec/spec.py), specifications for [network upgrades](/network-upgrades), and the [JSON RPC API](/json-rpc).

## Ethereum Protocol Releases
### Ethereum Protocol Releases

| Version and Code Name | Block No. | Released | Incl EIPs | Specs | Blog |
|-----------------------|-----------|----------|-----------|-------|-------|
Expand All @@ -23,4 +23,82 @@ This repository contains various specification related to the Ethereum 1.0 chain
| Frontier Thawing | 200000 | 09/07/2015 | | | [Blog](https://blog.ethereum.org/2015/08/04/the-thawing-frontier/) |
| Frontier | 1 | 07/30/2015 | | | [Blog](https://blog.ethereum.org/2015/07/22/frontier-is-coming-what-to-expect-and-how-to-prepare/) |

## Consensus Specification (work-in-progress)

The consensus specification is a python implementation of Ethereum that prioritizes readability and simplicity. It [will] accompanied by both narrative and API level documentation of the various components written in restructured text and rendered using Sphinx....

* [Rendered specification](https://quilt.github.io/eth1.0-specs/)

## Usage

The Ethereum specification is maintained as a Python library, for better integration with tooling and testing.

Requires Python 3.7+

### Building

Building the documentation is most easily done through [`tox`](https://tox.readthedocs.io/en/latest/):

```bash
$ tox -e doc
```

The path to the generated HTML will be printed to the console.

#### Live Preview

A live preview of the documentation can be viewed locally on port `8000` with the following command:

```bash
$ tox -e doc-autobuild
```

### Development

Running the tests necessary to merge into the repository requires:

* Python 3.7.x (not 3.8 or later), and
* [PyPy 7.3.x](https://www.pypy.org/).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supporting pypy is noble but I would suggest a level of pragmatism if you run into things that this makes complex. It is probably ok for this spec to have a very specific version and implementation of python for which it is considered "correct".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, as a mostly pure python project, it should be pretty easy to maintain compatibility, and I'd like to at least attempt to until we hit something that makes it difficult.

Ideally, we want to this project to sync mainnet, and PyPy might help speed that up. If that fails miserably, we can maybe fall back on Cython.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the Python code is fully typed and basically only uses the standard library, then you could also compile it to C with mypyc for speed. It might not be as fast as pypy (though I haven't seen any benchmarks comparing them), but mypyc seems much more actively developed than pypy.


These version ranges are necessary because, at the time of writing, PyPy is only compatible with Python 3.7.

`eth1.0-specs` depends on a submodule that contains common tests that are run across all clients, so we need to clone the repo with the --recursive flag. Example:
```bash
$ git clone --recursive https://github.com/quilt/eth1.0-specs.git
```

Or, if you've already cloned the repository, you can fetch the submodules with:

```bash
$ git submodule update --init --recursive
```

The tests can be run with:
```bash
$ tox
```

The development tools can also be run outside of `tox`, and can automatically reformat the code:

```bash
$ pip install -e .[doc,lint,test] # Installs eth1spec, and development tools.
$ isort src # Organizes imports.
$ black src # Formats code.
$ flake8 # Reports style/spelling/documentation errors.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a convention in our python repositories of having a MAKE command that will do these things for you: make lint-roll

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far I've managed to avoid using make for anything ;)

tox does the checks, but as long as the actual build doesn't rely on make, I guess I'd be okay with a script to simplify auto-formatting.

$ mypy src # Verifies type annotations.
$ pytest # Runs tests.
```

It is recommended to use a [virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment) to keep your system Python installation clean.

## Contribution Guidelines

This specification aims to be:

1. **Correct** - Describe the _intended_ behavior of the Ethereum blockchain, and any deviation from that is a bug.
2. **Complete** - Capture the entirety of _consensus critical_ parts of Ethereum.
3. **Accessible** - Prioritize readability, clarity, and plain language over performance and brevity.

### Spelling

Attempt to use descriptive English words (or _very common_ abbreviations) in documentation and identifiers. If necessary, there is a custom dictionary `whitelist.txt`.
Loading