Thank you for your interest in contributing to Lux Node! This document provides guidelines and instructions for contributing to the project.
To start developing on Lux Node, you'll need a few things installed.
- Golang version >= 1.23.9
- gcc
- g++
On MacOS, a modern version of bash is required (e.g. via homebrew with brew install bash). The version installed by default is not compatible with Lux Node's shell scripts.
This repo uses the Task task runner to simplify usage and discoverability of development tasks. To list available tasks:
./scripts/run_task.shWe are committed to fostering a welcoming and inclusive community. Please be respectful and considerate in all interactions.
-
Do not open up a GitHub issue if it relates to a security vulnerability in Lux Node, and instead refer to our security policy.
-
Use welcoming and inclusive language
-
Be respectful of differing viewpoints and experiences
-
Gracefully accept constructive criticism
-
Focus on what is best for the community
-
Show empathy towards other community members
- Go 1.21.12 or higher
- Git
- Make
- GCC/G++ compiler
- If you want to start a discussion about the development of a new feature or the modification of an existing one, start a thread under GitHub discussions.
- Post a thread about your idea and why it should be added to Lux Node.
- Don't start working on a pull request until you've received positive feedback from the maintainers.
-
Clone your fork
git clone https://github.com/YOUR_USERNAME/node.git cd node -
Add upstream remote
git remote add upstream https://github.com/luxfi/node.git
-
Install dependencies
go mod download
-
Build the project
./scripts/build.sh
./scripts/run_task.sh generate-protobuf💁 The general direction is to reduce usage of mocks, so use the following with moderation.
Mocks are auto-generated using mockgen and //go:generate commands in the code.
-
To re-generate all mocks, use the command below from the root of the project:
./scripts/run_task.sh generate-mocks
-
To add an interface that needs a corresponding mock generated:
-
if the file
mocks_generate_test.goexists in the package where the interface is located, either:- modify its
//go:generate go run go.uber.org/mock/mockgento generate a mock for your interface (preferred); or - add another
//go:generate go run go.uber.org/mock/mockgento generate a mock for your interface according to specific mock generation settings
- modify its
-
if the file
mocks_generate_test.godoes not exist in the package where the interface is located, create it with content (adapt as needed):// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved. // See the file LICENSE for licensing terms. package mypackage //go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mocks_test.go . YourInterface
Notes:
- Ideally generate all mocks to
mocks_test.gofor the package you need to use the mocks for and do not export mocks to other packages. This reduces package dependencies, reduces production code pollution and forces to have locally defined narrow interfaces. - Prefer using reflect mode to generate mocks than source mode, unless you need a mock for an unexported interface, which should be rare.
- Ideally generate all mocks to
-
-
To remove an interface from having a corresponding mock generated:
- Edit the
mocks_generate_test.gofile in the directory where the interface is defined - If the
//go:generatemockgen command line:- generates a mock file for multiple interfaces, remove your interface from the line
- generates a mock file only for the interface, remove the entire line. If the file is empty, remove
mocks_generate_test.goas well.
- Edit the
- Code compiles without warnings
- All tests pass
- New tests added for new functionality
- Documentation updated if needed
- Code follows project style guidelines
./scripts/run_task.sh build./scripts/run_task.sh test-unit./scipts/run_task.sh lintDO NOT create public issues for security vulnerabilities.
Email security@lux.network with:
-
Description of the vulnerability
-
Steps to reproduce
-
Potential impact
-
Ask any question about Lux Node under GitHub discussions.
By contributing, you agree that your contributions will be licensed under the project's BSD 3-Clause License.