Before You Start
You can engage with the community on the DFINITY Forum.Contribution License Agreement
All contributors must agree to the terms outlined in: If this is your first contribution to a DFINITY repository, you’ll be prompted to sign the CLA when you submit your pull request.Getting Started
1. Fork the Repository
Fork
Fork the dfinity/ic repository to your GitHub account.
Keep Updated
If you already have a fork, ensure it’s up to date with the latest changes from the main repository.
2. Set Up Development Environment
System Requirements
- Architecture: x86-64
- Memory: Minimum 16 GB RAM/SWAP
- Disk: 100 GB available space
- OS: Ubuntu 22.04 or newer
- Container Runtime: Podman
Enter Dev Container
3. Local Testing
Before submitting your PR, run tests locally to avoid long feedback loops:- Quick Check
- Unit Tests
- Bazel Tests
Submitting a Pull Request
Protected Files
Refer to.github/repo_policies/EXTERNAL_CONTRIB_BLACKLIST for the list of protected files.
PR Workflow
PR Description Template
Provide a comprehensive PR description:CI/CD Process for External Contributors
Security Restrictions
CI does not run automatically on PRs from external contributors for security reasons.
How CI Works
CI Pipeline
The CI pipeline runs:- Code formatting checks (rustfmt)
- Linting (clippy)
- Unit tests
- Integration tests
- Bazel build verification
- System tests (for internal changes)
Coding Standards
Rust Style Guide
The project uses standard Rust formatting and linting tools:Formatting
Formatting
- Use
rustfmtwith the project’srustfmt.tomlconfiguration - Run
cargo fmtbefore committing - Line length limit defined in
rustfmt.toml
Linting
Linting
- Use
clippywith the project’sclippy.tomlconfiguration - Address all clippy warnings
- Run
cargo clippy --all-targets --all-features
Documentation
Documentation
- Document all public APIs with doc comments
- Include examples in doc comments where appropriate
- Add module-level documentation explaining purpose and design
Testing
Testing
- Write unit tests for new functionality
- Add integration tests for cross-component features
- Ensure tests are deterministic and reproducible
Code Organization
- Keep modules focused - Each module should have a single, clear purpose
- Use appropriate visibility - Mark items as
pubonly when necessary - Follow naming conventions - Use snake_case for functions/variables, PascalCase for types
- Minimize dependencies - Only add necessary external crates
Dependency Management
-
Verify necessity - Ensure the crate is truly needed
- Check if similar functionality exists in already-imported crates
- Confirm the crate is well-maintained and from reputable authors
-
Maintain consistency - Use workspace dependencies
- Add new crates to
[workspace.dependencies]in rootCargo.toml - Reference with
new-crate = { workspace = true }in packageCargo.toml
- Add new crates to
- Avoid version fragmentation - When bumping dependencies, update across the entire repository
- Keep toolchain updated - Maintain rust-lang versions for both Bazel and Cargo
Review Process
What Reviewers Look For
Timeline Expectations
- Initial review: Within 1-2 weeks for most PRs
- Follow-up reviews: Within a few days for revisions
- Merging: After all reviewers approve and CI passes
Large or complex PRs may take longer to review. Consider breaking large changes into smaller, incremental PRs.
Addressing Review Feedback
- Respond to comments - Acknowledge feedback and explain your approach
- Make requested changes - Update your code based on reviewer suggestions
- Ask questions - If feedback is unclear, ask for clarification
- Push updates - Push new commits to your PR branch (don’t force-push unless requested)
Building the Project
Quick Build Commands
- Full Build
- Binaries Only
- Replica
- Bazel
Open Source Licensing
All code in the Internet Computer repository is licensed under:- Apache 2.0 - Most components
- IC Community Source License - Certain restrictive components (see
licenses/IC-1.0.txt) - IC Shared Community Source License - Certain shared components (see
licenses/IC-shared-1.0.txt)
Getting Help
Forum
Ask questions and discuss ideas
HACKING.md
Quick reference for common tasks
Security Policy
Report security vulnerabilities
Testing Guide
Learn about testing infrastructure
Community Standards
Code of Conduct
We expect all contributors to:- Be respectful and inclusive
- Provide constructive feedback
- Focus on what’s best for the community
- Show empathy towards others
Communication Channels
- Forum: forum.dfinity.org - General discussions, questions, and announcements
- GitHub Issues: Bug reports and feature requests
- Pull Requests: Code contributions and technical discussions
Related Resources
Workspace Structure
Understand the monorepo organization
Testing
Comprehensive testing guide
Security
Security policy and reporting