Contributing to Contower

Chat Badge Issues Badge

Contower is an evolving project in the Ethereum ecosystem, focused on bringing innovation and efficiency to blockchain operations. We welcome contributions from developers, writers, and enthusiasts who are interested in enhancing and expanding Contower's capabilities.

Getting Started

  1. Familiarize yourself with the how to contribute guide.
  2. Set up your development environment as described in setup instructions.
  3. Check out the open issues for areas where you can contribute.
  4. Before starting work on an issue, please comment on it to let others know you're working on it.
  5. Submit your contributions as a pull request for review.

Questions or discussions? Join us on Discord.

Contribution Guidelines

New to Contributing?

If you’re new to contributing or open-source, we recommend reading our docs for more detailed instructions.

Branches

Contower will permenantly have two branches:

  • stable: Our primary development branch. This is where we merge new features and changes after they have been tested and are ready for release.
  • unstable: Our secondary development branch. This is where we merge new features and changes before they are moved to stable.

Rust Development

Contower is developed in Rust, and we follow standard Rust conventions. Use clippy and rustfmt for linting and formatting:

$ cargo clippy --all
$ cargo fmt --all --check

Panics

It's crucial to avoid panics in a high-risk environment like the Internet. Panics in Contower represent a significant security vulnerability, especially if external users can trigger them.

Opt for Result or Option instead of panicking. For example, use array.get(1)? instead of array[1].

In situations where a panic is unlikely but still needs to be communicated to the compiler, prefer .expect("Descriptive message") over .unwrap(). It's important to include a comment explaining why a panic is not expected in such cases.

TODOs

Every TODO comment must be linked to a corresponding GitHub issue.


#![allow(unused)]
fn main() {
use std::error::Error;

struct MyExampleStruct;

impl MyExampleStruct {
    pub fn my_function(&mut self, _something: &[u8]) -> Result<String, Box<dyn Error>> {
        // TODO: Implement feature
        // Issue link: https://github.com/nodura/contower/issues/XX
        Ok("Example response".to_string())
    }
}
}

Comments

General Comments

  • Use line comments (//) rather than block comments (/* ... */).
  • Comments can be placed either before the item they refer to or after a space on the same line.

#![allow(unused)]
fn main() {
// Description of the struct
struct Contower {}
fn make_blockchain() {} // Inline comment after a space
}

Documentation Comments

  • Use /// for generating documentation comments.
  • Place these comments before attributes.

#![allow(unused)]
fn main() {
use std::path::PathBuf;

/// Configuration for the Contower instance, covering the core settings.
/// This general configuration can be extended by other components. #[derive(Clone)]
#[derive(Clone)]
pub struct ContowerConfig {
    pub data_dir: PathBuf,
    pub p2p_listen_port: u16,
}
}

Rust Learning Resources

Rust is a powerful, low-level language offering great control and performance. The Rust Book is an excellent guide to understanding Rust, including its style and usage.

Learning Rust can be challenging, but there are numerous resources available: