Skip to content

Latest commit

 

History

History
248 lines (155 loc) · 12.2 KB

File metadata and controls

248 lines (155 loc) · 12.2 KB

Optimism Monorepo Contributing Guide

Documentation

Public developer documentation for docs.optimism.io lives in docs/public-docs/. To update the docs site, edit files in docs/public-docs/ and open a PR against develop. See docs/public-docs/DOCS_CONTRIBUTING.md for style guide and contribution standards.

What to Contribute

Welcome to the Optimism Monorepo Contributing Guide! If you're reading this then you might be interested in contributing to the Optimism Monorepo. Before diving into the specifics of this repository, you might be interested in taking a quick look at just a few of the ways that you can contribute. You can:

  • Report issues in this repository. Great bug reports are detailed and give clear instructions for how a developer can reproduce the problem. Write good bug reports and developers will love you.
    • IMPORTANT: If you believe your report impacts the security of this repository, refer to the canonical Security Policy document.
  • Fix issues that are tagged as D-good-first-issue or S-confirmed.
  • Larger projects are listed on this project board. Please talk to us if you're considering working on one of these, they may not be fully specified so it will reduce risk to discuss the approach and ensure that it's still relevant.
  • Help improve the Optimism Docs by reporting issues or adding missing sections.
  • Get involved in the protocol design process by joining discussions within the OP Stack Specs repository.

Contributions Related to Spelling and Grammar

At this time, we will not be accepting contributions that primarily fix spelling, stylistic or grammatical errors in documentation, code or elsewhere.

Pull Requests that ignore this guideline will be closed, and may be aggregated into new Pull Requests without attribution.

Trivial Changes Discouraged

We kindly ask contributors not to submit pull requests that only make trivial changes, such as:

  • Adjusting whitespace, punctuation, or formatting without substantive content changes
  • Renaming variables or refactoring code without a clear functional or readability benefit
  • Other one‑line or cosmetic edits that do not materially improve the project

Why we discourage trivial PRs

While we appreciate every attempt to contribute, small, non‑substantive PRs create significant review and merge overhead for maintainers without meaningfully improving the codebase or documentation. Reviewing, testing, and merging even a one‑word change takes real time and effort.

To keep maintainers focused on impactful contributions, we will:

  • Close trivial PRs that fall into the above categories
  • Aggregate minor typo or formatting fixes internally if needed, without attribution
  • Encourage contributors to instead take on meaningful issues, such as those labeled D-good-first-issue or S-confirmed

Better ways to help

If you’d like to contribute in a small but meaningful way:

  • Batch several fixes into one PR instead of submitting many tiny ones
  • Look for beginner‑friendly issues in our D-good-first-issue label
  • Improve documentation by adding missing explanations, examples, or clarifications rather than small grammar tweaks

This ensures your effort has a real impact and increases the chance your PR will be reviewed and merged quickly.

Code of Conduct

Interactions within this repository are subject to a Code of Conduct adapted from the Contributor Covenant.

Development Quick Start

Setting Up

Clone the repository and open it:

git clone git@github.com:ethereum-optimism/optimism.git
cd optimism

Software Dependencies

You will need to install a number of software dependencies to effectively contribute to the Optimism Monorepo. We use mise as a dependency manager for these tools. Once properly installed, mise will provide the correct versions for each tool. mise does not replace any other installations of these binaries and will only serve these binaries when you are working inside of the optimism directory.

Install mise

Install mise by following the instructions provided on the Getting Started page.

Trust the mise.toml file

mise requires that you explicitly trust the mise.toml file which lists the dependencies that this repository uses. After you've installed mise you'll be able to trust the file via:

mise trust mise.toml

Install dependencies

Use mise to install the correct versions for all of the required tools:

mise install

Installing updates

mise will notify you if any dependencies are outdated. Simply run mise install again to install the latest versions of the dependencies if you receive these notifications.

Building the Monorepo

You must install all of the required Software Dependencies to build the Optimism Monorepo. Once you've done so, run the following command to build:

just build

Packages built on one branch may not be compatible with packages on a different branch. You should rebuild the monorepo whenever you move from one branch to another. Use the above command to rebuild the monorepo.

Running tests

Before running tests: follow the above instructions to get everything built.

Running unit tests (solidity)

cd packages/contracts-bedrock
just test

Running unit tests (Go)

Change directory to the package you want to run tests for, then:

go test ./...

Running e2e tests (Go)

See this document

Rust (kona, op-reth, op-alloy, …)

All Rust code lives in the unified rust/ Cargo workspace and is built and tested with just from that directory (e.g. cd rust && just build && just test). See docs/ai/rust-dev.md for the full build, test, lint, and workflow guide.

Running contract static analysis

We perform static analysis with slither. Slither is pinned in mise.toml. To run it locally, do:

cd packages/contracts-bedrock
mise exec -- slither . --config-file test/slither/slither.config.json

Labels

Labels are divided into categories with their descriptions annotated as <Category Name>: <description>.

The following are a comprehensive list of label categories.

  • Area labels (A-): Denote the general area for the related issue or PR changes.
  • Category labels (C-): Contextualize the type of issue or change.
  • Meta labels (M-): These add context to the issues or prs themselves primarily relating to process.
  • Difficulty labels (D-): Describe the associated implementation's difficulty level.
  • Status labels (S-): Specify the status of an issue or pr.

Labels also provide a versatile filter for finding tickets that need help or are open for assignment. This makes them a great tool for contributors!

Filtering for Work

To find tickets available for external contribution, take a look at the https://github.com/ethereum-optimism/optimism/labels/M-community label.

You can filter by the https://github.com/ethereum-optimism/optimism/labels/D-good-first-issue label to find issues that are intended to be easy to implement or fix.

Also, all labels can be seen by visiting the labels page

Modifying Labels

When altering label names or deleting labels there are a few things you must be aware of.

Workflow for Pull Requests

🚨 Before making any non-trivial change, please first open an issue describing the change to solicit feedback and guidance. This will increase the likelihood of the PR getting merged.

In general, the smaller the diff the easier it will be for us to review quickly.

In order to contribute, fork the appropriate branch, for non-breaking changes to production that is develop and for the next release that is normally release/X.X.X branch, see details about our branching model.

Additionally, if you are writing a new feature, please ensure you add appropriate test cases.

Follow the Development Quick Start to set up your local development environment.

Read any README files in the packages you are contributing to. Some packages have additional instructions that are not covered in this guide.

We require the Scoped Commits format for commit messages and PR titles — see Commit messages below.

Unless your PR is ready for immediate review and merging, please mark it as 'draft' (or simply do not open a PR yet).

Once ready for review, make sure to include a thorough PR description to help reviewers. You can read more about the guidelines for opening PRs in the PR Guidelines file.

Bonus: Add comments to the diff under the "Files Changed" tab on the PR page to clarify any sections where you think we might have questions about the approach taken.

Commit messages

We require the Scoped Commits format for commit messages and PR titles:

<scope>: <description>

[optional body]

[optional trailers]

The scope names the component, subsystem, or area the change touches — for example op-node, contracts-bedrock, docs, or ci. For a change spanning a few components, comma-separate the scopes without spaces (op-node,op-batcher: share event loop metrics); for tree-wide changes, use all.

Do not use Conventional Commits type prefixes (feat:, fix:, chore(scope):, ...). The part of the codebase a commit touches is what readers of the log — contributors, debuggers, incident responders — actually scan for, and a well-written description already conveys whether a change is a fix or a feature. See Stop Using Conventional Commits for the full rationale.

PRs are squash-merged with the PR title as the commit subject, so CI validates the PR title against this format. The exact rules live in .github/scripts/check-pr-title.sh.

Response time

We aim to provide a meaningful response to all PRs and issues from external contributors within 2 business days.

Rebasing

We use the git rebase command to keep our commit history tidy. Rebasing is an easy way to make sure that each PR includes a series of clean commits with descriptive commit messages See this tutorial for a detailed explanation of git rebase and how you should use it to maintain a clean commit history.