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.
We follow the C++ Core Guidelines as much as possible.
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.
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 withincore
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 thecore
andinterfaces
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 thecore
module.silkworm/sentry
This module implements the networking and protocol stacks for theSentry
component for an Ethereum node based on Erigon architecture. This module depends on thecore
,infra
andnode
modules.silkworm/rpc
This module implements the networking and protocol stacks for theRpcDaemon
component for an Ethereum node based on Erigon architecture, exposing the vast majority of the Ethereum JSON RPC Execution API. This module depends on thecore
,infra
andnode
modules.silkworm/sync
This module implements the networking and protocol stacks for theConsensus
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 thecore
,infra
,node
andrpc
modules.silkworm/wasm
This module allows thecore
the run on WebAssembly. This module depends on both thecore
andnode
modules.