Skip to content

Commit

Permalink
Add more info
Browse files Browse the repository at this point in the history
  • Loading branch information
hwwhww committed Feb 28, 2023
1 parent 69fbe7f commit 4cadc61
Showing 1 changed file with 38 additions and 15 deletions.
53 changes: 38 additions & 15 deletions docs/new-feature.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
# How to add a new feature proposal in consensus-specs

1. Create a folder under `./specs/features`.
2. Choose the "previous fork" to extend: usually, use the scheduled or the lasted mainnet fork version.
3. Write down your proposed `beacon-chain.md` change:
- [Beacon Chain Spec Template](./beacon-chain-template.md)
- Reference to the previous fork content
4. Add `fork.md`: reference to the previous `fork.md` file.
5. Make it executable:
- Update [`constants.py`](https://github.com/ethereum/consensus-specs/blob/dev/tests/core/pyspec/eth2spec/test/helpers/constants.py) with the new feature name.
- Update [`setup.py`](https://github.com/ethereum/consensus-specs/blob/dev/setup.py):
- Add a new `SpecBuilder` with the new feature name constant
- Add the new `SpecBuilder` to `spec_builders`
- Add the path of the new markdown files in `finalize_options`
6. Bonus:
- Add `validator.md` if honest validator behavior changes with your change.
7. Need help? Tag spec elves to clean up your PR.
### 1. Create a folder under `./specs/_features`

For example, if it's an `EIP-9999` CL spec, you can create a `./specs/_features/eip9999` folder.

### 2. Choose the "previous fork" to extend: usually, use the scheduled or the latest mainnet fork version.

For example, if the latest fork is Capella, use `./specs/capella` content as your "previous fork".

### 3. Write down your proposed `beacon-chain.md` change
- You can either use [Beacon Chain Spec Template](./beacon-chain-template.md), or make a copy of the latest fork content and then edit it.
- Tips:
- We use [`doctoc`](https://www.npmjs.com/package/doctoc) tool to generate the table of content.
```
cd consensus-specs
doctoc specs
```
- The differences between "Constants", "Configurations", and "Presets":
- Constants: The constant that should never be changed.
- Configurations: The settings that we may change for different networks.
- Presets: The settings that we may change for testing.
- Readability and simplicity are more important than efficiency and optimization.
- Use simple Python rather than the fancy Python dark magic.

### 4. Add `fork.md`
You can refer to the previous fork's `fork.md` file.

### 5. Make it executable
- Update [`constants.py`](https://github.com/ethereum/consensus-specs/blob/dev/tests/core/pyspec/eth2spec/test/helpers/constants.py) with the new feature name.
- Update [`setup.py`](https://github.com/ethereum/consensus-specs/blob/dev/setup.py):
- Add a new `SpecBuilder` with the new feature name constant. e.g., `EIP9999SpecBuilder`
- Add the new `SpecBuilder` to `spec_builders` list.
- Add the path of the new markdown files in `finalize_options` function.

### Bonus
- Add `validator.md` if honest validator behavior changes with your change.

### Need help?
You can tag spec elves for cleaning up your PR. 🧚

0 comments on commit 4cadc61

Please sign in to comment.