Skip to content

Latest commit

 

History

History
76 lines (61 loc) · 4.21 KB

CONTRIBUTING.md

File metadata and controls

76 lines (61 loc) · 4.21 KB

Contributing Guide

We use the ISO Standard C++ programming language, specifically C++20. If you contribute to this project, your contributions will be made under our license.

C++ Core Guidelines

We follow the C++ Core Guidelines as much as possible.

Style Guide

We adhere to Google's C++ Style Guide with the following differences:

  • C++20 rather than C++17.
  • snake_case() for function names.
  • .cpp & .hpp file extensions for C++; .c & .h are reserved for C.
  • using namespace foo is allowed inside .cpp files, but not inside headers.
  • Exceptions are allowed outside the core library.
  • User-defined literals are allowed.
  • Maximum line length is 120, indentation is 4 spaces. Use make fmt to reformat according to the code style.
  • Add Apache copyright banners. Use make lint to check the proper banner style.
  • Use #pragma once in the headers instead of the classic #ifndef guards.

In addition to the Boost libraries permitted in the style guide, we allow:

  • Algorithm
  • Asio
  • Circular Buffer
  • DLL
  • Process
  • Signals2
  • System
  • Thread

clang-tidy runs on CI. The report is attached to the "ARTIFACTS" section of the linux-clang-tidy job that can be found here.

Code Structure

Apart from the submodules and some auxiliary directories, Silkworm contains the following components:

  • cmd
    The source code of Silkworm executable binaries.
  • silkworm/core
    This module contains the heart of the Ethereum protocol logic as described by the Yellow Paper. Source code within core is compatible with WebAssembly and cannot use C++ exceptions.
  • silkworm/infra
    This module contains common abstractions and facilities useful for networking, concurrency and system programming. This module depends on the core and interfaces modules.
  • silkworm/interfaces
    This module contains the definition of our internal gRPC interfaces based on Erigon architecture and their generated stubs and skeletons.
  • silkworm/node
    This module contains the database, the [staged sync] and other logic necessary to function as an Ethereum node. This module depends on the core module.
  • silkworm/sentry
    This module implements the networking and protocol stacks for the Sentry component for an Ethereum node based on Erigon architecture. This module depends on the core, infra and node modules.
  • silkworm/rpc
    This module implements the networking and protocol stacks for the RpcDaemon component for an Ethereum node based on Erigon architecture, exposing the vast majority of the Ethereum JSON RPC Execution API. This module depends on the core, infra and node modules.
  • silkworm/sync
    This module implements the networking and protocol stacks for the Consensus component for an Ethereum node based on Erigon architecture, exposing the portion of the Ethereum JSON RPC Execution API necessary to interact with any Consensus Layer client. This module depends on the core, infra, node and rpc modules.
  • silkworm/wasm
    This module allows the core the run on WebAssembly. This module depends on both the core and node modules.