|
1 | 1 | # Contribution Guide
|
2 | 2 |
|
3 |
| -Thank you for considering contributing to EigenLayer! To ensure a smooth and efficient collaboration, please adhere to the following guidelines when submitting a pull request (PR): |
| 3 | +Thank you for considering contributing to EigenLayer! This guide will help you set up your development environment and submit high-quality pull requests (PRs). |
4 | 4 |
|
5 |
| -## Requirements |
| 5 | +## Setting Up Your Environment |
6 | 6 |
|
7 |
| -- Foundry |
8 |
| -- Git |
9 |
| -- Node.js |
| 7 | +### Requirements |
10 | 8 |
|
11 |
| -## Setup Repo |
| 9 | +- Foundry |
| 10 | +- Git |
| 11 | +- Node.js |
| 12 | + |
| 13 | +### Fork and Clone the Repository |
| 14 | + |
| 15 | +1. Fork the repository following [GitHub's instructions](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) |
| 16 | +2. Clone your forked repository: |
12 | 17 |
|
13 | 18 | ```bash
|
14 |
| -git clone https://github.com/Layr-Labs/eigenlayer-contracts.git |
| 19 | +git clone https://github.com/<your_github_id>/eigenlayer-contracts.git |
| 20 | +cd eigenlayer-contracts |
15 | 21 | ```
|
16 | 22 |
|
17 | 23 | ### Install Dependencies
|
18 | 24 |
|
| 25 | +Set up your local development environment: |
| 26 | + |
19 | 27 | ```bash
|
20 | 28 | npm install
|
21 | 29 | npx husky install
|
22 | 30 | forge install
|
23 | 31 | ```
|
24 | 32 |
|
25 |
| -### Environment Variables |
| 33 | +### Run Tests |
26 | 34 |
|
27 |
| -Some of the tests and features of this repository require environment variables to be set up. |
| 35 | +Verify your setup by running the test suite: |
28 | 36 |
|
29 |
| -Copy the .env.example file to create a .env and populate it with the appropriate environment values that you have control over. |
| 37 | +```bash |
| 38 | +forge test |
| 39 | +``` |
30 | 40 |
|
31 |
| -## Development Workflow |
| 41 | +Congratulations! You've successfully set up your repository and run the tests. |
32 | 42 |
|
33 |
| -- **Testing**: Ensure that your code is well-tested. Write unit and integration tests as appropriate. |
34 |
| -- **Branching**: Create a feature branch from the `dev` branch for your work. The `dev` branch contains the most up-to-date code for upcoming releases. |
35 |
| -- **Pull Requests**: Once your feature or fix is complete and tested, submit a PR to merge your feature branch into the `dev` branch. |
36 |
| -- **Code Review**: After your PR is approved, squash your commits into a single commit before merging to maintain a clean and concise commit history. |
| 43 | +## Submitting a Pull Request |
37 | 44 |
|
38 |
| -## Commit Message Format |
| 45 | +### Configure Remote Repositories |
39 | 46 |
|
40 |
| -When squashing and merging your commits, please follow the commit message convention below: |
| 47 | +All PRs should be submitted from your forked repository. Add the official EigenLayer repository as your upstream remote: |
41 | 48 |
|
| 49 | +```bash |
| 50 | +git remote add upstream https://github.com/Layr-Labs/eigenlayer-contracts.git |
42 | 51 | ```
|
43 |
| -<type>(<scope>): <subject> (#<PR number>) |
44 | 52 |
|
45 |
| -<motivation> |
| 53 | +Verify your configuration: |
46 | 54 |
|
47 |
| -<modifications> |
| 55 | +```bash |
| 56 | +git remote -v |
| 57 | +``` |
48 | 58 |
|
49 |
| -<result> |
| 59 | +You should see: |
| 60 | +``` |
| 61 | +origin https://github.com/<your_github_id>/eigenlayer-contracts.git (fetch) |
| 62 | +origin https://github.com/<your_github_id>/eigenlayer-contracts.git (push) |
| 63 | +upstream https://github.com/Layr-Labs/eigenlayer-contracts.git (fetch) |
| 64 | +upstream https://github.com/Layr-Labs/eigenlayer-contracts.git (push) |
50 | 65 | ```
|
51 | 66 |
|
52 |
| -- **Type**: Indicates the nature of the change. |
53 |
| -- **Scope**: Specifies the section or module of the codebase affected (optional). |
54 |
| -- **Subject**: A brief description of the change. |
55 |
| -- **PR Number**: Reference to the pull request associated with this change. |
56 |
| -- **Motivation**: Describe the context and reason for the change. |
57 |
| -- **Modifications**: Detail the specific changes made. |
58 |
| -- **Result**: Explain the outcome or effects of the change. |
| 67 | +### Create Your PR |
59 | 68 |
|
60 |
| -### Example |
| 69 | +1. Create a new branch from your target upstream branch |
| 70 | +2. Make your code changes |
| 71 | +3. Commit your changes |
| 72 | +4. Push to your forked repository |
| 73 | +5. Create a PR from your branch to the appropriate branch in the upstream repository |
61 | 74 |
|
62 |
| -An example of a commit message: |
| 75 | +### PR Title Format |
63 | 76 |
|
| 77 | +Format your PR title as follows: |
| 78 | + |
| 79 | +``` |
| 80 | +<type>: <subject> |
64 | 81 | ```
|
65 |
| -feat(StrategyManager): Implement new withdrawal flow (#123) |
66 | 82 |
|
| 83 | +Where: |
| 84 | +- **Type**: Indicates the nature of the change |
| 85 | +- **Subject**: A brief description of the change |
| 86 | + |
| 87 | +Use one of these types: |
| 88 | + |
| 89 | +| Type | Description | |
| 90 | +|------|-------------| |
| 91 | +| **feat** | A new feature | |
| 92 | +| **fix** | A bug fix | |
| 93 | +| **docs** | Documentation-only changes | |
| 94 | +| **style** | Changes that don't affect code meaning (formatting) | |
| 95 | +| **refactor** | Code changes that neither fix bugs nor add features | |
| 96 | +| **ci** | Changes to continuous integration configuration | |
| 97 | +| **perf** | Performance improvements | |
| 98 | +| **test** | Adding or correcting tests | |
| 99 | +| **chore** | Changes to build process or auxiliary tools | |
| 100 | +| **release** | Merging a release-dev branch to `main` | |
| 101 | + |
| 102 | +Remember to set the appropriate PR label as well. |
| 103 | + |
| 104 | +### PR Description Template |
| 105 | + |
| 106 | +Use this template for your PR description: |
| 107 | + |
| 108 | +```markdown |
67 | 109 | **Motivation:**
|
| 110 | +- Describe the context and reason for the change |
| 111 | + |
| 112 | +**Modifications:** |
| 113 | +- Detail the specific changes made |
| 114 | + |
| 115 | +**Result:** |
| 116 | +- Explain the outcome or effects of the change |
| 117 | +``` |
| 118 | + |
| 119 | +#### Example PR: |
68 | 120 |
|
| 121 | +```markdown |
| 122 | +feat: Implement new withdrawal flow in StrategyManager |
| 123 | + |
| 124 | +**Motivation:** |
69 | 125 | The current withdrawal process is inefficient and leads to delays for users.
|
70 | 126 |
|
71 | 127 | **Modifications:**
|
72 |
| -
|
73 |
| -- Refactored the `withdraw` function in `StrategyManager.sol`. |
74 |
| -- Updated associated unit tests to reflect changes. |
75 |
| -- Modified documentation to explain the new withdrawal process. |
| 128 | +- Refactored the `withdraw` function in `StrategyManager.sol` |
| 129 | +- Updated associated unit tests to reflect changes |
| 130 | +- Modified documentation to explain the new withdrawal process |
76 | 131 |
|
77 | 132 | **Result:**
|
78 |
| -
|
79 | 133 | The withdrawal process is now more efficient, reducing wait times for users.
|
80 | 134 | ```
|
81 | 135 |
|
82 |
| -### Commit Types |
| 136 | +## Testing and Continuous Integration |
83 | 137 |
|
84 |
| -Use the following types for your commit messages: |
| 138 | +- All PRs should include appropriate test coverage |
| 139 | +- Write unit and integration tests that verify your changes |
| 140 | +- Ensure all existing tests continue to pass |
85 | 141 |
|
86 |
| -- **feat**: A new feature. |
87 |
| -- **fix**: A bug fix. |
88 |
| -- **docs**: Documentation-only changes. |
89 |
| -- **style**: Changes that do not affect the meaning of the code (e.g., formatting). |
90 |
| -- **refactor**: A code change that neither fixes a bug nor adds a feature. |
91 |
| -- **perf**: A code change that improves performance. |
92 |
| -- **test**: Adding missing or correcting existing tests. |
93 |
| -- **chore**: Changes to the build process or auxiliary tools and libraries. |
| 142 | +For first-time external contributors: A maintainer will review your PR and manually approve CI to run. |
94 | 143 |
|
95 | 144 | By following these guidelines, you help maintain the quality and readability of the EigenLayer codebase. We appreciate your contributions and look forward to collaborating with you!
|
96 |
| - |
|
0 commit comments