- Keep changes minimal and focused. Only modify code directly related to the task at hand. Do not refactor unrelated code, rename existing variables or functions for style, or bundle unrelated fixes into the same commit or PR.
- Do not add, remove, or update dependencies unless the task explicitly requires it.
Before every commit, run all of the following checks and ensure they pass:
Before committing, always run gofmt and goimports on all modified files:
gofmt -w <modified files>
goimports -w <modified files>Verify that all tools compile successfully:
make allThis builds all executables under cmd/, including keeper which has special build requirements.
While iterating during development, use -short for faster feedback:
go run ./build/ci.go test -shortBefore committing, run the full test suite without -short to ensure all tests pass, including the Ethereum execution-spec tests and all state/block test permutations:
go run ./build/ci.go testgo run ./build/ci.go lintThis runs additional style checks. Fix any issues before committing.
go run ./build/ci.go check_generateEnsures that all generated files (e.g., gen_*.go) are up to date. If this fails, first install the required code generators by running make devtools, then run the appropriate go generate commands and include the updated files in your commit.
go run ./build/ci.go check_baddepsVerifies that no forbidden dependencies have been introduced.
Do not commit binaries, whether they are produced by the main build or byproducts of investigations.
Commit messages must be prefixed with the package(s) they modify, followed by a short lowercase description:
<package(s)>: description
Examples:
core/vm: fix stack overflow in PUSH instructioneth, rpc: make trace configs optionalcmd/geth: add new flag for sync mode
Use comma-separated package names when multiple areas are affected. Keep the description concise.
PR titles follow the same convention as commit messages:
<list of modified paths>: description
Examples:
core/vm: fix stack overflow in PUSH instructioncore, eth: add arena allocator supportcmd/geth, internal/ethapi: refactor transaction argstrie/archiver: streaming subtree archival to fix OOM
Use the top-level package paths, comma-separated if multiple areas are affected. Only mention the directories with functional changes, interface changes that trickle all over the codebase should not generate an exhaustive list. The description should be a short, lowercase summary of the change.