Fork and branch workflow
Create a feature branch
Create a branch for your work. Use a descriptive name, optionally prefixed with a GitHub issue number:
Run the linter before committing
Format your code with scalafmt and apply scalafix rules before every commit:This auto-formats code and organizes imports. The CI pipeline enforces the same checks and will fail if formatting is not applied.
Commit message format
Conventional Commits are required and enforced by commitlint using theconventional-changelog-conventionalcommits preset.
Format:
typemust be lowercasetypemust be one of the allowed values (see below)descriptionmust not be empty and must not end with a perioddescriptionmust not use sentence-case, start-case, pascal-case, or upper-case- Header line maximum length: 100 characters
- Body lines maximum length: 100 characters
| Type | When to use |
|---|---|
feat | A new feature |
fix | A bug fix |
refactor | Code change that is neither a feature nor a fix |
test | Adding or updating tests |
docs | Documentation only changes |
chore | Maintenance tasks |
build | Changes to build system or dependencies |
ci | CI configuration changes |
perf | Performance improvements |
style | Formatting changes (no logic change) |
revert | Revert a previous commit |
Code style
Code formatting is handled automatically bysbt runLinter, which runs both scalafmt and scalafix.
scalafmt settings (.scalafmt.conf)
scalafmt settings (.scalafmt.conf)
scalafix rules (.scalafix.conf)
scalafix rules (.scalafix.conf)
javax?, cats, scala, io.constellationnetwork, then everything else.How to add new features
The following guides map common extension tasks to the relevant files and modules. For full file-level details, see the Codebase Map.Add a new transaction type
Add a new transaction type
- Define the type in
modules/shared/src/main/scala/io/constellationnetwork/schema/ - Add Kryo and JSON serialization in
shared/kryo/andshared/json/ - Update validators in
modules/node-shared/domain/transaction/ - Add processing logic in
dag-l0/infrastructure/snapshot/
Add a new HTTP endpoint
Add a new HTTP endpoint
- Define the route in
modules/{module}/http/routes/ - Wire it into
modules/{module}/modules/HttpApi.scala - If it is a P2P endpoint, add a client in
http/p2p/clients/
Modify consensus
Modify consensus
- FSM state definitions live in
node-shared/infrastructure/consensus/state/ - Phase logic is in
node-shared/infrastructure/consensus/engine/ - Declarations are in
node-shared/infrastructure/consensus/declaration.scala
Add a new metagraph feature
Add a new metagraph feature
- Extend
CurrencyL0ApporCurrencyL1App - Override the relevant extension points:
dataApplication,rewards,transactionValidator, orcustomArtifacts - Use the
sdkmodule as a dependency withprovidedscope for stable API access
