-
Notifications
You must be signed in to change notification settings - Fork 333
Pyspec framework #219
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
Changes from all commits
b6e6464
5c11e98
fb81a9e
dff84e9
feef9a1
5fb4305
90a067b
f9362fc
ab527a2
df6ff3c
15e01a1
48e603a
fe4fd53
0c90689
bcee4aa
69d75f0
06343c0
3f2febf
b1fd56e
17be6ab
de0ed17
0c0a4ae
3278013
23bb5ad
7aac820
b131ac5
6342302
5f83c5c
7848bde
6dd2060
075f6ca
27347d0
512bf2f
8a2bb3d
9a070b6
c5f613b
c70880c
6595f6b
b6e0aff
bd28800
2fa8428
f07d20e
eeaa819
e580673
dd760f0
c228947
d66e1ed
2634d1b
63bfd6a
d6a5aa5
5823bf4
0a464df
1e009da
e6ebc89
82618e0
b1920ad
4a3db03
a4c75c3
e1c144c
6db040f
92dd806
12f8ae2
c4213dc
3170431
a40af87
9f20cfe
d208b3c
59a3619
58ce043
b02b24d
4382738
5d90d61
609fdb0
d473e68
80ec2cf
2ef7858
b75b4c9
d308242
a851556
e3873fa
2804350
799a8d1
9232055
7decbaf
d6a1ab2
13414e4
7555cfb
dfc5646
7e7339a
efe41d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
name: Blank Issue | ||
about: Create a blank issue. | ||
--- |
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. | ||
--> |
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. | ||
--> |
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. | ||
--> |
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-->]() |
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 |
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 |
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 |
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 | ||
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. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | | ||
|-----------------------|-----------|----------|-----------|-------|-------| | ||
|
@@ -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/) | ||
lightclient marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## 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/). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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". There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have a convention in our python repositories of having a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So far I've managed to avoid using
|
||
$ 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`. |
Uh oh!
There was an error while loading. Please reload this page.