Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
  • network/gtest-1100
  • 331-tests-de-distance-qui-ne-passent-plus
  • backup/network/gtest-1100
  • network/gtest-1110
  • tuxmain/gtest-fix-c2
  • set_UniversalDividendApi_in_RuntimeApiCollection
  • network/gtest-1000
  • upgradable-multisig
  • runtime/gtest-1000
  • network/gdev-800
  • cgeek/issue-297-cpu
  • gdev-800-tests
  • update-docker-compose-rpc-squid-names
  • fix-252
  • 1000i100-test
  • hugo/tmp-0.9.1
  • network/gdev-803
  • hugo/endpoint-gossip
  • network/gdev-802
  • hugo/distance-precompute
  • network/gdev-900
  • tuxmain/anonymous-tx
  • debug/podman
  • hugo/195-doc
  • hugo/195-graphql-schema
  • hugo-tmp-dockerfile-cache
  • release/client-800.2
  • release/runtime-800
  • feature/show_milestone
  • release/runtime-701
  • hugo-release/runtime-701
  • release/runtime-700
  • pini-check-password
  • tuxmain/benchmark-distance
  • release/runtime-600
  • feature/dc-dump
  • tests/distance-with-oracle
  • release/runtime-500
  • feature/distance-rule
  • release/hugo-chainspec-gdev5
  • release/runtime-401
  • 105_gitlab_container_registry
  • ci_cache
  • release/poka-chainspec-gdev5-pini-docker
  • release/poka-chainspec-gdev5
  • release/runtime-400
  • release/runtime-300
  • release/runtime-200
  • release/runtime-100
  • elois-duniter-storage
  • elois-compose-metrics
  • elois-smoldot
  • gdev-1000-test
  • gdev-800
  • gdev-800-0.8.0
  • gdev-802
  • gdev-803
  • gdev-900-0.10.0
  • gdev-900-0.10.1
  • gdev-900-0.9.0
  • gdev-900-0.9.1
  • gdev-900-0.9.2
  • gtest-1000
  • gtest-1000-0.11.0
  • gtest-1000-0.11.1
  • gtest-1100
  • gtest-1100-0.12.0
  • runtime-100
  • runtime-101
  • runtime-102
  • runtime-103
  • runtime-104
  • runtime-105
  • runtime-1110
  • runtime-200
  • runtime-201
  • runtime-300
  • runtime-301
  • runtime-302
  • runtime-303
  • runtime-400
  • runtime-401
  • runtime-500
  • runtime-600
  • runtime-700
  • runtime-701
  • runtime-800
  • runtime-800-backup
  • runtime-800-bis
  • runtime-801
  • v0.1.0
  • v0.2.0
  • v0.3.0
  • v0.4.0
  • v0.4.1
96 results

Target

Select target project
No results found
Select Git revision
  • master
  • elois-substrate-v0.9.23
  • elois-technical-commitee
  • elois-opti-cert
  • release/runtime-200
  • elois-fix-85
  • elois-rework-certs
  • elois-remove-renewable-period
  • poc-oneshot-accounts
  • hugo-cucumber-identity
  • elois-ci-binary-release
  • distance
  • release/runtime-100
  • ud-time-64
  • elois-duniter-storage
  • elois-compose-metrics
  • elois-smoldot
  • no-bootnodes
  • ts-types
  • runtime-100
  • runtime-101
  • runtime-102
  • runtime-103
  • runtime-104
  • runtime-105
  • runtime-200
  • runtime-201
  • v0.1.0
28 results
Show changes
448 files
+ 354574
18359
Compare changes
  • Side-by-side
  • Inline

Files

.cargo/config

deleted100644 → 0
+0 −5
Original line number Diff line number Diff line
[alias]
cucumber = "test -p duniter-end2end-tests --test cucumber_tests --"
tu = "test --workspace --exclude duniter-end2end-tests"
xtask = "run --package xtask --"

.cargo/config.toml

0 → 100644
+13 −0
Original line number Diff line number Diff line
[alias]
sanity-gdev = "test -Zgit=shallow-deps -p duniter-live-tests --test sanity_gdev -- --nocapture"
tu = "test -Zgit=shallow-deps --workspace --exclude duniter-end2end-tests --exclude duniter-live-tests --features constant-fees" # Unit tests with constant-fees
tf = "test -Zgit=shallow-deps --workspace --exclude duniter-end2end-tests --exclude duniter-live-tests test_fee" # Custom fee model tests
# `te` and `cucumber` are synonyms
te = "test -p duniter-end2end-tests --test cucumber_tests --features constant-fees --"
cucumber-build = "build -Zgit=shallow-deps --features constant-fees"
cucumber = "test -Zgit=shallow-deps -p duniter-end2end-tests --test cucumber_tests --"
ta = "test -Zgit=shallow-deps --workspace --exclude duniter-live-tests --features constant-fees"
tb = "test -Zgit=shallow-deps --features runtime-benchmarks -p"
rbp = "run -Zgit=shallow-deps --release --features runtime-benchmarks -- benchmark pallet --chain=dev --steps=50 --repeat=20 --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=. --pallet"
xtask = "run -Zgit=shallow-deps --package xtask --"
cucumber-node = "run -Zgit=shallow-deps -- --chain=gdev_dev --execution=Native --sealing=manual --force-authoring --rpc-cors=all --tmp --rpc-port 9944 --alice --features constant-fees"
+3 −1
Original line number Diff line number Diff line
@@ -4,4 +4,6 @@
.vscode
docker/Dockerfile
docker-compose.yml
target
arm-build/
**/target/
build/
+8 −0
Original line number Diff line number Diff line
This project is tracked on our hosted gitlab server at:
https://git.duniter.org/nodes/rust/duniter-v2s

The current github repository is a simple clone taken up to date at each push on the main gitlab repository.

All contributions should be performed on the main gitlab repository.

Pull requests and issues must be created on the main gitlab repository.
+5 −0
Original line number Diff line number Diff line
Please note that all issues must be opened at https://git.duniter.org/nodes/rust/duniter-v2s/issues/new?issue

If you open issue here, it will be closed.

Thank you for your understanding.
+9 −0
Original line number Diff line number Diff line
This project is tracked on our hosted gitlab server at: https://git.duniter.org/nodes/rust/duniter-v2s

The current github repository is a simple clone taken up to date at each push on the main gitlab repository.

All contributions should be performed on the main gitlab repository.

Pull requests proposed on github will be closed.

Thank you for your understanding.
+12 −0
Original line number Diff line number Diff line
# Initial disclaimer
This project is tracked on our hosted gitlab server at:
https://git.duniter.org/nodes/rust/duniter-v2s

The current github repository is a simple clone taken up to date at each push on the main gitlab repository.

All contributions should be performed on the main gitlab repository.

Pull requests and issues must be created on the main gitlab repository.

# Original README.md

.github/workflows/check.yml

deleted100644 → 0
+0 −44
Original line number Diff line number Diff line
name: Check Set-Up & Build

# Controls when the action will run.
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  check:
    # The type of runner that the job will run on
    runs-on: ubuntu-20.04

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      - name: Set-Up
        run: sudo apt install -y cmake pkg-config libssl-dev git build-essential clang libclang-dev curl

      - name: Install Rustup
        run: |
          curl https://sh.rustup.rs -sSf | sh -s -- -y
          source ~/.cargo/env
          rustup default stable
          rustup update nightly
          rustup update stable
          rustup target add wasm32-unknown-unknown --toolchain nightly

      - name: Check Build
        run: |
          SKIP_WASM_BUILD=1 cargo check --release

      - name: Check Build for Benchmarking
        run: >
          pushd node &&
          cargo check --features=runtime-benchmarks --release
+11 −1
Original line number Diff line number Diff line
@@ -15,7 +15,8 @@
# node modules
**/node_modules/**

# build folder
# build folders
arm-build
build

# Temporary files
@@ -26,3 +27,12 @@ tmp

# Log files
*.log

# Ignore output folder
output/
g1-dump.tgz
/release/

node/specs/gdev-raw.json
node/specs/gtest-raw.json
node/specs/g1-raw.json
+223 −191
Original line number Diff line number Diff line
# Runner tags:
# - podman: use 'podman' to build multiplatform images

stages:
  - schedule
  - labels
  - quality
  - build
  - tests
  - release
  - deploy
  - deploy_readme

# Job templates for release builds (without tags/image, set by jobs)
.release_rules:
  stage: release
  rules:
    - if: $CI_COMMIT_TAG
      when: never
    - if: $CI_COMMIT_BRANCH =~ /^network\//
      when: manual
    - when: never

.debian_build_template:
  extends: .release_rules
  before_script:
    # Install build dependencies
    - apt-get update -qq && apt-get install -y -qq protobuf-compiler clang libclang-dev
  script:
    - cargo xtask client-build-deb $NETWORK

.rpm_build_template:
  extends: .release_rules
  before_script:
    # Install RPM build tools and dependencies
    - apt-get update -qq && apt-get install -y -qq rpm protobuf-compiler clang libclang-dev
  script:
    - cargo xtask client-build-rpm $NETWORK

.docker_deploy_template:
  extends: .release_rules
  image: docker:latest
  variables:
    DOCKER_HOST: unix:///var/run/docker.sock
  before_script:
    # Install Rust and build dependencies
    - apk add --no-cache curl bash gcc musl-dev
    - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal
    - source $HOME/.cargo/env
    - docker info
  script:
    - cargo xtask client-docker-deploy $NETWORK --arch $ARCH

# Release build jobs
release_debian_arm:
  extends:
    - .env_arm
    - .debian_build_template
  needs: []
  artifacts:
    paths:
      - target/debian/*.deb

release_debian_x64:
  extends:
    - .env
    - .debian_build_template
  needs: []
  artifacts:
    paths:
      - target/debian/*.deb

release_rpm_arm:
  extends:
    - .env_arm
    - .rpm_build_template
  needs: []
  artifacts:
    paths:
      - target/generate-rpm/*.rpm

release_rpm_x64:
  extends:
    - .env
    - .rpm_build_template
  needs: []
  artifacts:
    paths:
      - target/generate-rpm/*.rpm

release_docker_arm:
  extends: .docker_deploy_template
  needs: []
  tags:
    - linuxARM
  variables:
    ARCH: arm64

release_docker_x64:
  extends: .docker_deploy_template
  needs: []
  tags:
    - kepler
  variables:
    ARCH: amd64

release_docker_manifest:
  stage: release
  rules:
    - if: $CI_COMMIT_TAG
      when: never
    - if: $CI_COMMIT_BRANCH =~ /^network\//
      when: on_success  # Auto-start when dependencies succeed
    - when: never
  needs:
    - job: release_docker_arm
      optional: false
    - job: release_docker_x64
      optional: false
  tags:
    - kepler
  image: docker:latest
  variables:
    DOCKER_HOST: unix:///var/run/docker.sock
  before_script:
    - apk add --no-cache bash grep sed
  script:
    - docker login -u duniterteam -p $DUNITERTEAM_PASSWD docker.io
    - |
      # Extract runtime from NETWORK (e.g., gtest-1100 -> gtest)
      RUNTIME=$(echo $NETWORK | sed 's/-[0-9].*//')
      
      # Get client version from node/Cargo.toml
      CLIENT_VERSION=$(grep '^version = ' node/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
      
      # Get runtime version from runtime/$RUNTIME/src/lib.rs
      RUNTIME_VERSION=$(grep 'spec_version:' runtime/$RUNTIME/src/lib.rs | sed 's/.*spec_version: \([0-9]*\).*/\1/')
      
      IMAGE_NAME="duniter/duniter-v2s-${NETWORK}"
      TAG="${RUNTIME_VERSION}-${CLIENT_VERSION}"
      
      echo "Creating multi-arch manifest for ${IMAGE_NAME}:${TAG}"
      
      # Use buildx imagetools to create multi-arch tags from existing images
      # This works even if the source images are manifest lists
      docker buildx imagetools create \
        --tag ${IMAGE_NAME}:${TAG} \
        ${IMAGE_NAME}:${TAG}-amd64 \
        ${IMAGE_NAME}:${TAG}-arm64
      
      echo "✅ Multi-arch tag created: ${IMAGE_NAME}:${TAG}"
      
      # Also create :latest tag
      docker buildx imagetools create \
        --tag ${IMAGE_NAME}:latest \
        ${IMAGE_NAME}:${TAG}-amd64 \
        ${IMAGE_NAME}:${TAG}-arm64
      
      echo "✅ Multi-arch tag created: ${IMAGE_NAME}:latest"

workflow:
  rules:
    - changes:
        - docker/Dockerfile
        - end2end-tests/**/*
        - node/**/*
        - pallets/**/*
        - runtime/**/*
        - .gitlab-ci.yml
        - Cargo.toml
        - Cargo.lock
        - resources/*.yaml

.env:
  image: paritytech/ci-linux:production
  tags:
    - elois-neutron

fmt_and_clippy:
sanity_tests:
  extends: .env
  rules:
    - if: $CI_COMMIT_REF_NAME =~ /^wip*$/
      when: manual
    - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH == "master"'
      when: never
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - when: manual
  stage: quality
  script:
    - cargo fmt -- --version
    - cargo fmt -- --check
    - cargo clippy -- -V
    - cargo clippy --all --tests -- -D warnings

build_debug:
  extends: .env
  rules:
    - if: $CI_COMMIT_TAG
      when: never
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == "master"'
      changes:
      - Cargo.lock
    - if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_TOPIC=="sanity-tests"'
    - when: never
  stage: build
  stage: schedule
  script:
    - cargo clean -p duniter
    - cargo build --locked
    - mkdir build
    - mv target/debug/duniter build/duniter
  artifacts:
    paths:
      - build/
    expire_in: 3 day
  cache:
    - key:
        files:
          - Cargo.lock
      paths:
        - target/debug
      policy: push
    - cargo sanity-${CURRENCY}

build_debug_with_cache:
check_labels:
  extends: .env
  stage: labels
  rules:
    - changes:
      - Cargo.lock
      when: never
    - if: $CI_COMMIT_TAG
      when: never
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == "master"'
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - when: never
  stage: build
  script:
    - cargo clean -p duniter
    - cargo build --locked
    - mkdir build
    - mv target/debug/duniter build/duniter
  artifacts:
    paths:
      - build/
    expire_in: 3 day
  cache:
    - key:
        files:
          - Cargo.lock
      paths:
        - target/debug
      policy: pull
    - ./scripts/check_labels.sh $CI_MERGE_REQUEST_LABELS $CI_MERGE_REQUEST_MILESTONE

build_release:
check_metadata:
  extends: .env
  stage: tests
  rules:
    - if: "$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v*/"
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - when: never
  stage: build
  script:
    - cargo build --locked --release
    - mkdir build
    - mv target/release/duniter build/duniter
  artifacts:
    paths:
      - build/
    expire_in: 3 day
    - ./scripts/check_metadata.sh

build_release_manual:
.env:
  image: paritytech/ci-unified:bullseye-1.88.0
  tags:
    - kepler

.env_arm:
  image: rust:latest  # Rust image for ARM builds
  tags:
    - linuxARM

fmt_and_clippy:
  extends: .env
  rules:
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_REF_NAME =~ /^wip*$/
      when: manual
    - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH == "master"'
      when: never
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      when: always
    - when: manual
  stage: build
  allow_failure: true
  stage: quality
  script:
    - cargo build --locked --release
    - mkdir build
    - mv target/release/duniter build/duniter
  artifacts:
    paths:
      - build/
    expire_in: 3 day
    - cargo fmt -- --version
    - cargo fmt -- --check
    - cargo clippy -- -V
    - cargo clippy -Zgit=shallow-deps --features runtime-benchmarks --all --tests -- -D warnings

tests_debug:
run_benchmarks:
  extends: .env
  stage: tests
  rules:
    - if: $CI_COMMIT_REF_NAME =~ /^wip*$/
      when: manual
@@ -132,116 +235,45 @@ tests_debug:
      when: never
    - if: '$CI_MERGE_REQUEST_ID || $CI_COMMIT_BRANCH == "master"'
    - when: manual
  stage: tests
  variables:
    DUNITER_BINARY_PATH: "../build/duniter"
    DUNITER_END2END_TESTS_SPAWN_NODE_TIMEOUT: "20"
  script:
    - cargo test --workspace --exclude duniter-end2end-tests
    - cargo cucumber -i balance*
    - cargo cucumber -i monetary*
    - cargo cucumber -i transfer*
  after_script:
    - cd target/debug/deps/
    - rm cucumber_tests-*.d
    - mv cucumber_tests* ../../../build/duniter-cucumber
  artifacts:
    paths:
      - build/
    expire_in: 3 day
    - cargo build -Zgit=shallow-deps --release --features runtime-benchmarks
    - target/release/duniter benchmark storage --chain=dev --mul=2 --state-version=1 --weight-path=./runtime/g1/src/weights/ --batch-size=100
    - target/release/duniter benchmark overhead --chain=dev --wasm-execution=compiled --warmup=1 --repeat=100 --weight-path=./runtime/g1/src/weights/
    - target/release/duniter benchmark pallet --chain=dev --steps=5 --repeat=2 --pallet="*" --extrinsic="*" --wasm-execution=compiled --output=./runtime/g1/src/weights/
    - cargo build -Zgit=shallow-deps --release --features runtime-benchmarks # Check if autogenerated weights work

tests_release:
gtest_build:
  stage: build
  extends: .env
  rules:
    - if: "$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v*/"
    - when: never
  stage: tests
  variables:
    DUNITER_BINARY_PATH: "../build/duniter"
    DUNITER_END2END_TESTS_SPAWN_NODE_TIMEOUT: "20"
  script:
    - cargo test --workspace --exclude duniter-end2end-tests
    - cargo cucumber -i balance*
    - cargo cucumber -i monetary*
    - cargo cucumber -i transfer*
  after_script:
    - cd target/debug/deps/
    - rm cucumber_tests-*.d
    - mv cucumber_tests* ../../../build/duniter-cucumber
  artifacts:
    paths:
      - build/
    expire_in: 3 day
  dependencies:
    - build_release

.docker-build-app-image:
  stage: deploy
  image: docker:18.06
  tags:
    - redshift
  services:
    - docker:18.06-dind
  before_script:
    - docker info
  script:
    - docker pull $CI_REGISTRY_IMAGE:$IMAGE_TAG || true
    - docker build --cache-from $CI_REGISTRY_IMAGE:$IMAGE_TAG --pull -t "$CI_REGISTRY_IMAGE:$IMAGE_TAG" -f $DOCKERFILE_PATH .
    - docker login -u "duniterteam" -p "$DUNITERTEAM_PASSWD"
    - docker tag "$CI_REGISTRY_IMAGE:$IMAGE_TAG" "duniter/duniter-v2s:$IMAGE_TAG"
    - docker push "duniter/duniter-v2s:$IMAGE_TAG"

deploy_docker_test_image:
  extends: .docker-build-app-image
  rules:
    - if: $CI_COMMIT_REF_NAME =~ /^wip*$/
      when: manual
    - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH == "master"'
    - if: $CI_COMMIT_TAG
      when: never
    - if: $CI_COMMIT_BRANCH =~ /^(release\/runtime-)[0-9].*/
      when: never
    - if: '$CI_MERGE_REQUEST_ID || $CI_COMMIT_BRANCH == "master"'
    - when: manual
  allow_failure: true
  variables:
    DOCKERFILE_PATH: "docker/Dockerfile"
    IMAGE_TAG: "test-image-$CI_COMMIT_SHORT_SHA"
    DEBIAN_FRONTEND: noninteractive
  script:
    - cargo build -Zgit=shallow-deps --no-default-features --features gtest

deploy_docker_debug_sha:
  extends: .docker-build-app-image
  rules:
    - if: $CI_COMMIT_TAG
      when: never
    - if: $CI_COMMIT_BRANCH == "master"
  variables:
    DOCKERFILE_PATH: "docker/Dockerfile"
    IMAGE_TAG: "debug-sha-$CI_COMMIT_SHORT_SHA"
  after_script:
    - docker login -u "duniterteam" -p "$DUNITERTEAM_PASSWD"
    - docker tag "duniter/duniter-v2s:$IMAGE_TAG" "duniter/duniter-v2s:debug-latest"
    - docker push "duniter/duniter-v2s:debug-latest"

deploy_docker_release_sha:
  extends: .docker-build-app-image
tests:
  stage: tests
  extends: .env
  rules:
    - if: $CI_COMMIT_REF_NAME =~ /^wip*$/
      when: manual
    - if: $CI_COMMIT_TAG
      when: never
    - if: '$CI_MERGE_REQUEST_ID || $CI_COMMIT_BRANCH == "master"'
    - when: manual
  allow_failure: true
  variables:
    DOCKERFILE_PATH: "docker/Dockerfile"
    IMAGE_TAG: "sha-$CI_COMMIT_SHORT_SHA"
  dependencies:
    - build_release_manual

deploy_docker_release_tag:
  extends: .docker-build-app-image
  rules:
    - if: "$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v*/"
    - when: never
  variables:
    DOCKERFILE_PATH: "docker/Dockerfile"
    IMAGE_TAG: "$CI_COMMIT_TAG"
  after_script:
    - docker login -u "duniterteam" -p "$DUNITERTEAM_PASSWD"
    - docker tag "duniter/duniter-v2s:$IMAGE_TAG" "duniter/duniter-v2s:latest"
    - docker push "duniter/duniter-v2s:latest"
  dependencies:
    - build_release
    DEBIAN_FRONTEND: noninteractive
  script:
    - export RUST_MIN_STACK=16777216 # 16MB stack size otherwise CI fail during LLVM's Thin LTO (Link Time Optimization) phase
    - cargo tu
    - cargo tf
    - cargo cucumber-build
    - cargo cucumber
Original line number Diff line number Diff line
---
name: Report a Bug
about: Report a problem with this template.
about: Report a problem with duniter-v2s.
title: ""
labels: bug
assignees: ""
@@ -8,9 +8,7 @@ assignees: ""

**Description**

_Tell us what happened. In particular, be specific about any changes you made to this template.
Ideally, provide a link to your project's GitHub repository. Please note that we are not able to
support all conceivable changes to this template project, but the more information you are able to
_Tell us what happened. Please elaborate, the more information you are able to
provide the more equipped we will be to help._

**Steps to Reproduce**
@@ -33,7 +31,7 @@ _Describe the environment in which you encountered this bug. Use the list below
and add additional information if you think it's relevant._

- Operating system:
- Template version/tag:
- Git commit/tag:
- Rust version (run `rustup show`):

**Logs, Errors or Screenshots**
Original line number Diff line number Diff line
---
name: Suggest a Feature
about: Suggest a new feature or an improvement to an existing feature for this template.
about: Suggest a new feature or an improvement to an existing feature for duniter-v2s.
title: ""
labels: enhancement
assignees: ""
@@ -9,8 +9,8 @@ assignees: ""
**Motivation**

_Describe the need or frustration that motivated you to make this suggestion. Please note that the
goal of this project is to provide a general-purpose template project, so please take care when
suggesting features that may be specific to a particular use case._
goal of this project is to bring the Ğ1 blockchain itself, so please take care when
suggesting features that may not concern the Ğ1 currency._

**Suggested Solution**

Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ USER duniter
# check if executable works in this container
RUN /usr/local/bin/duniter --version

EXPOSE 30333 9933 9944
EXPOSE 30333 9944
VOLUME ["/duniter"]

ENTRYPOINT ["/usr/local/bin/duniter"]
Original line number Diff line number Diff line
@@ -9,7 +9,12 @@
      "request": "launch",
      "name": "Debug unit tests in library 'duniter'",
      "cargo": {
        "args": ["test", "--no-run", "--lib", "--package=duniter"],
        "args": [
          "test",
          "--no-run",
          "--lib",
          "--package=duniter"
        ],
        "filter": {
          "name": "duniter",
          "kind": "lib"
@@ -23,13 +28,20 @@
      "request": "launch",
      "name": "Debug executable 'duniter'",
      "cargo": {
        "args": ["build"],
        "args": [
          "build"
        ],
        "filter": {
          "name": "duniter",
          "kind": "bin"
        }
      },
      "args": ["--tmp", "--dev", "--execution", "Native"],
      "args": [
        "--tmp",
        "--dev",
        "--execution",
        "Native"
      ],
      "cwd": "${workspaceFolder}"
    },
    {
@@ -37,7 +49,12 @@
      "request": "launch",
      "name": "Debug unit tests in executable 'duniter'",
      "cargo": {
        "args": ["test", "--no-run", "--bin=duniter", "--package=duniter"],
        "args": [
          "test",
          "--no-run",
          "--bin=duniter",
          "--package=duniter"
        ],
        "filter": {
          "name": "duniter",
          "kind": "bin"
@@ -51,7 +68,12 @@
      "request": "launch",
      "name": "Debug unit tests in library 'gdev-runtime'",
      "cargo": {
        "args": ["test", "--no-run", "--lib", "--package=gdev-runtime"],
        "args": [
          "test",
          "--no-run",
          "--lib",
          "--package=gdev-runtime"
        ],
        "filter": {
          "name": "gdev-runtime",
          "kind": "lib"
@@ -65,7 +87,12 @@
      "request": "launch",
      "name": "Debug unit tests in library 'pallet-certification'",
      "cargo": {
        "args": ["test", "--no-run", "--lib", "--package=pallet-certification"],
        "args": [
          "test",
          "--no-run",
          "--lib",
          "--package=pallet-certification"
        ],
        "filter": {
          "name": "pallet-certification",
          "kind": "lib"
@@ -78,29 +105,15 @@
      "type": "lldb",
      "request": "launch",
      "name": "Debug unit tests in library 'pallet-identity'",
      "cargo": {
        "args": ["test", "--no-run", "--lib", "--package=pallet-identity"],
        "filter": {
          "name": "pallet-identity",
          "kind": "lib"
        }
      },
      "args": [],
      "cwd": "${workspaceFolder}"
    },
    {
      "type": "lldb",
      "request": "launch",
      "name": "Debug unit tests in library 'pallet-ud-accounts-storage'",
      "cargo": {
        "args": [
          "test",
          "--no-run",
          "--lib",
          "--package=pallet-ud-accounts-storage"
          "--package=pallet-identity"
        ],
        "filter": {
          "name": "pallet-ud-accounts-storage",
          "name": "pallet-identity",
          "kind": "lib"
        }
      },
Original line number Diff line number Diff line
{
  "editor.formatOnSave": true,
  "editor.rulers": [100],
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "editor.rulers": [
    100
  ],
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
    "editor.defaultFormatter": "vscode.json-language-features"
  },
  "[yaml]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
@@ -18,5 +14,6 @@
    "port_p2p": 19931,
    "port_rpc": 19932,
    "port_ws": 19933
  }
  },
  "rust-analyzer.showUnlinkedFileNotification": false
}
 No newline at end of file
+18 −20
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ Before contributing, please make sure that your development environment is prope

[Setting up your development environment]

Sign-ups on our gitlab are disabled. If you would like to contribute, please ask for its creation on [the technical forum].
Sign-ups on our gitlab are disabled. If you would like to contribute, please ask for an account on [the technical forum].

When contributing to this repository, please first discuss the change you wish to make via issue or
via [the technical forum] before making a change.
@@ -13,40 +13,38 @@ Please note we have a specific workflow, please follow it in all your interactio

## Developer documentation

Please read [Developer documentation] before contribute.
Please read [Developer documentation] before contributing.

## Workflow

- If there is an unassigned issue about the thing you want to contribute to, assign the issue to yourself.
- Create a branch based on `master` and prefixed with your nickname. Give your branch a short name indicating the subject.
- Create an MR from your branch to `master`.
- Never contribute to a branch of ahother contributor! If the contributor make a `git rebase` your commit will be lost !
- Create an MR from your branch to `master`. Prefix the title with `Draft: ` until it's ready to be merged.
- If the MR is related to an issue, mention the issue in the description using the `#42` syntax.
- Never push to a branch of another contributor! If the contributor makes a `git rebase` your commit will be lost!
- Before you push your commit:
  - Apply formatters (rustfmt and prettier) and linter (clippy)
  - Document your code.
  - Document your code
  - Apply the [project's git conventions]

## Merge Process

1. Ensure you rebased your branch on the latest `master` commit to avoid any merge conflicts.

2. Ensure that you respect the [commit naming conventions].

3. Ensure that all automated tests pass with the `npm test` command.

4. Update the documentation with details of changes to the interface, this includes new environment
    variables, exposed ports, useful file locations and container parameters.

5. Push your branch on the gitlab and create a merge request. Briefly explain the purpose of your contribution in the description of the merge request.

6. Tag a Duniter reviewer so they will review your contribution. If you still have no news after several weeks, tag another reviewer or/and talk about your contribution on [the technical forum].
1. Ensure that you respect the [commit naming conventions].
1. Ensure that all automated tests pass with the `cargo test` command.
1. Ensure that the code is well formatted `cargo fmt` and complies with the good practices `cargo clippy`. If you have been working on tests, check everything with `cargo clippy --all --tests`.
1. Update the documentation with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
1. Push your branch on the gitlab and create a merge request. Briefly explain the purpose of your contribution in the description of the merge request.
1. Mark the MR as ready (or remove the `Draft: ` prefix) only when you think it can be reviewed or merged.
1. Assign a Duniter reviewer so they will review your contribution. If you still have no news after several weeks, ask explicitly for a review, or tag another reviewer or/and talk about your contribution on [the technical forum].

## List of Duniter's reviewers

- @librelois
- @HugoTrentesaux
- @tuxmain

[commit naming conventions]: ./docs/dev/git-conventions.md#naming-commits
[Developer documentation]: ./docs/dev/index.md
[Developer documentation]: ./docs/dev/
[project's git conventions]: ./docs/dev/git-conventions.md
[Setting up your development environment]: ./docs/setup.md
[Setting up your development environment]: ./docs/dev/setup.md
[the technical forum]: https://forum.duniter.org
+12633 −5906

File changed.

Preview size limit exceeded, changes collapsed.

+214 −124

File changed.

Preview size limit exceeded, changes collapsed.

+82 −176
Original line number Diff line number Diff line
# Duniter v2s

A rewriting of duniter based on [Substrate](https://www.substrate.io/) framework.

duniter-v2s is under active development, only a test network called "ĞDev" is deployed.
🆙 A rewriting of [Duniter v1](https://duniter.org) in the [Substrate](https://www.substrate.io/) framework.

⚠️ Duniter-v2s is under active development.

🚧 A test network called "ĞDev" is deployed, allowing to test wallets and indexers.

<div align="center">
    <img alt="logov2" src="https://duniter.fr/img/duniterv2.svg" width="128" height="128"/>
</div>

## Documentation

Multiple documentation sources are available depending on the level of detail you need.

- Full technical Rust doc (auto-generated with `cargo xtask gen-doc`) : https://doc-duniter-org.ipns.pagu.re/duniter/
- User and client developer doc (official website) : https://duniter.org/wiki/duniter-v2/
- Internal documentation (within git repository), see table of contents below : [./doc](./doc)

### Internal documentation TOC

- [README](./README.md) (this file)
  - [Use](#use)
  - [Contribute](#contribute)
  - [License](#license)
- [docs](./docs/) internal documentation
  - [api](./docs/api/) API
    - [manual](./docs/api/manual.md) manage account and identities
    - [runtime-calls](./docs/api/runtime-calls.md) the calls you can submit through the RPC API
    - [runtime-errors](./docs/api/runtime-errors.md) the errors you can get submitting a call
    - [runtime-events](./docs/api/runtime-events.md) the events you can get submitting a call
  - [dev](./docs/dev/) developer documentation
    - [beginner-walkthrough](./docs/dev/beginner-walkthrough.md)
    - [git-conventions](./docs/dev/git-conventions.md)
    - [pallet_conventions](./docs/dev/pallet_conventions.md)
    - [launch-a-live-network](./docs/dev/launch-a-live-network.md)
    - [setup](./docs/dev/setup.md)
    - [compilation features](./docs/dev/compilation.md)
    - [verify-runtime-code](./docs/dev/verify-runtime-code.md)
    - [weights-benchmarking](./docs/dev/weights-benchmarking.md)
    - [upgrade-substrate](./docs/dev/upgrade-substrate.md)
    - [replay-block](./docs/test/replay-block.md)
  - [user](./docs/user/) user documentation
    - [autocompletion](./docs/user/autocompletion.md)
    - [debian installation](./docs/user/installation_debian.md)
    - [distance](./docs/user/distance.md)
    - [fees](./docs/user/fees.md)
  - [packaging](./docs/packaging/) packaging
    - [build-for-arm](./docs/packaging/build-for-arm.md) build for ARM architecture
    - [build-debian](./docs/packaging/build-deb.md) build a native Debian package
- [docker](./docker/) docker-related documentation
- [end2end-tests](./end2end-tests/) automated end to end tests written with cucumber
- [live-tests](./live-tests/) sanity checks to test the storage of a live chain

## Use

@@ -10,65 +59,41 @@ duniter-v2s is under active development, only a test network called "ĞDev" is d

The easiest way is to use the docker image.

Minimal command to deploy a **temporary** mirror peer:
Minimal command to deploy a temporary mirror peer:

```docker
docker run -it -p9944:9944 -e DUNITER_CHAIN_NAME=gdev duniter/duniter-v2s:v0.1.0 --tmp --execution=Wasm
docker run -it -p9944:9944 -e DUNITER_CHAIN_NAME=gdev duniter/duniter-v2s-gdev-800:latest
```

To go further, read [How to deploy a permanent mirror node on ĞDev network](./docs/user/mirror.md).
To go further, read [How to deploy a permanent mirror node on ĞDev network 🔗](https://duniter.org/wiki/duniter-v2/#run-a-mirror-node).

### Create your local blockchain

It can be useful to deploy your local blockchain, for instance to have a controled environement
to develop/test an application that interact with the blockchain.
It can be useful to deploy your local blockchain, for instance to have a controlled environment to develop/test an application that interacts with the blockchain.

```docker
docker run -it -p9944:9944 duniter/duniter-v2s:v0.1.0 --tmp
docker run -it -p9944:9944 duniter/duniter-v2s-gdev-800:latest
```

Or use the `docker-compose.yml` at the root of this repository.
Or use the [`docker-compose.yml`](./docker-compose.yml) at the root of this repository.

#### Control when your local blockchain should produce blocks

By default, your local blockchain produce a new block every 6 seconds, which is not practical in some cases.

You can decide when to produce blocks with the cli option `--sealing`, , there are 2 possible modes:

* `--sealing=instant`: produce a block immediately upon receiving a transaction into the transaction pool
* `--sealing=manual`: produce a block upon receiving an RPC request (method `engine_createBlock`).

### Autocompletion
By default, your local blockchain produces a new block every 6 seconds, which is not practical in some cases.

See [autocompletion](./docs/user/autocompletion.md).
You can decide when to produce blocks with the cli option `--sealing` which has two modes:

## Test
- `--sealing=instant`: produce a block immediately upon receiving a transaction into the transaction pool
- `--sealing=manual`: produce a block upon receiving an RPC request (method `engine_createBlock`).

### Test a specific commit
### Shell autocompletion

At each commit on master, an image with the tag `debug-sha-********` is published, where `********`
corresponds to the first 8 hash characters of the commit.

Usage:

```docker
docker run -it -p9944:9944 --name duniter-v2s duniter/duniter-v2s:debug-sha-b836f1a6
```

Then open `https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944` in a browser.

Enable detailed logging:

```docker
docker run -it -p9944:9944 --name duniter-v2s \
  -e RUST_LOG=debug \
  -e RUST_BACKTRACE=1 \
  -lruntime=debug \
  duniter/duniter-v2s:debug-sha-b836f1a6
```
See [autocompletion](./docs/user/autocompletion.md) to generate shell autocompletion for duniter commands.

## Contribute

If you are beginner in Rust and need a well guided tutorial, follow the [beginner walkthrough](./docs/dev/beginner-walkthrough.md).

Before any contribution, please read carefully the [CONTRIBUTING](./CONTRIBUTING.md) file and our [git conventions](./docs/dev/git-conventions.md).

### Setup your dev environment
@@ -77,7 +102,7 @@ First, complete the [basic setup instructions](./docs/dev/setup.md).

### Build

NOTE: You must first follow the instructions in the [Setup] section (#setup).
NOTE: You must first follow the instructions in the [Setup](#setup-your-dev-environment) section.

Use the following command to build the node without launching it:

@@ -90,20 +115,11 @@ cargo build
Use Rust's native `cargo` command to build and launch the node:

```sh
cargo run -- --dev --tmp
cargo run -- --dev
```

This will deploy a local blockchain with test accounts (Alice, Bob, etc) in the genesis.

## Single-Node Development Chain

This command will start the single-node development chain with persistent state:

```bash
./target/debug/duniter --dev --tmp
```

Then open `https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944` in a browser.
Open `https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944` to watch and interact with your node.

Start the development chain with detailed logging:

@@ -111,134 +127,24 @@ Start the development chain with detailed logging:
RUST_LOG=debug RUST_BACKTRACE=1 ./target/debug/duniter -lruntime=debug --dev
```

## Multi-Node Local Testnet

If you want to see the multi-node consensus algorithm in action, refer to
[our Start a Private Network tutorial](https://substrate.dev/docs/en/tutorials/start-a-private-network/).

### Purge previous lacal testnet
## License

```
./target/debug/duniter purge-chain --base-path /tmp/alice --chain local
./target/debug/duniter purge-chain --base-path /tmp/bob --chain local
See [LICENSE](./LICENSE)

```
CopyLeft 2021-2023 Axiom-Team

### Start Alice's node
Some parts borrowed from Polkadot (Parity Technologies (UK) Ltd.)

```bash
./target/debug/duniter \
  --base-path /tmp/alice \
  --chain local \
  --alice \
  --port 30333 \
  --ws-port 9945 \
  --rpc-port 9933 \
  --node-key 0000000000000000000000000000000000000000000000000000000000000001 \
  --validator
```
Duniter-v2S is free software: you can redistribute it and/or modify
it under the terms of the **GNU Affero General Public License** as published by
the Free Software Foundation, **version 3** of the License.

### Start Bob's node
Duniter-v2S is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

```bash
./target/debug/duniter \
  --base-path /tmp/bob \
  --chain local \
  --bob \
  --port 30334 \
  --ws-port 9946 \
  --rpc-port 9934 \
  --validator \
  --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp
You should have received a copy of the GNU Affero General Public License
along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
```

## Project Structure

A Substrate project such as this consists of a number of components that are spread across a few
directories.

### Node

A blockchain node is an application that allows users to participate in a blockchain network.
Substrate-based blockchain nodes expose a number of capabilities:

- Networking: Substrate nodes use the [`libp2p`](https://libp2p.io/) networking stack to allow the
  nodes in the network to communicate with one another.
- Consensus: Blockchains must have a way to come to
  [consensus](https://substrate.dev/docs/en/knowledgebase/advanced/consensus) on the state of the
  network. Substrate makes it possible to supply custom consensus engines and also ships with
  several consensus mechanisms that have been built on top of
  [Web3 Foundation research](https://research.web3.foundation/en/latest/polkadot/NPoS/index.html).
- RPC Server: A remote procedure call (RPC) server is used to interact with Substrate nodes.

There are several files in the `node` directory - take special note of the following:

- [`chain_spec.rs`](./node/src/chain_spec.rs): A
  [chain specification](https://substrate.dev/docs/en/knowledgebase/integrate/chain-spec) is a
  source code file that defines a Substrate chain's initial (genesis) state. Chain specifications
  are useful for development and testing, and critical when architecting the launch of a
  production chain. Take note of the `development_chain_spec` and `testnet_genesis` functions, which
  are used to define the genesis state for the local development chain configuration. These
  functions identify some
  [well-known accounts](https://substrate.dev/docs/en/knowledgebase/integrate/subkey#well-known-keys)
  and use them to configure the blockchain's initial state.
- [`service.rs`](./node/src/service.rs): This file defines the node implementation. Take note of
  the libraries that this file imports and the names of the functions it invokes. In particular,
  there are references to consensus-related topics, such as the
  [longest chain rule](https://substrate.dev/docs/en/knowledgebase/advanced/consensus#longest-chain-rule),
  the [Babe](https://substrate.dev/docs/en/knowledgebase/advanced/consensus#babe) block authoring
  mechanism and the
  [GRANDPA](https://substrate.dev/docs/en/knowledgebase/advanced/consensus#grandpa) finality
  gadget.

After the node has been [built](#build), refer to the embedded documentation to learn more about the
capabilities and configuration parameters that it exposes:

```shell
./target/debug/duniter --help
```

### Runtime

In Substrate, the terms
"[runtime](https://substrate.dev/docs/en/knowledgebase/getting-started/glossary#runtime)" and
"[state transition function](https://substrate.dev/docs/en/knowledgebase/getting-started/glossary#stf-state-transition-function)"
are analogous - they refer to the core logic of the blockchain that is responsible for validating
blocks and executing the state changes they define. The Substrate project in this repository uses
the [FRAME](https://substrate.dev/docs/en/knowledgebase/runtime/frame) framework to construct a
blockchain runtime. FRAME allows runtime developers to declare domain-specific logic in modules
called "pallets". At the heart of FRAME is a helpful
[macro language](https://substrate.dev/docs/en/knowledgebase/runtime/macros) that makes it easy to
create pallets and flexibly compose them to create blockchains that can address
[a variety of needs](https://www.substrate.io/substrate-users/).

Review the [FRAME runtime implementation](./runtime/src/lib.rs) included in this template and note
the following:

- This file configures several pallets to include in the runtime. Each pallet configuration is
  defined by a code block that begins with `impl $PALLET_NAME::Config for Runtime`.
- The pallets are composed into a single runtime by way of the
  [`construct_runtime!`](https://crates.parity.io/frame_support/macro.construct_runtime.html)
  macro, which is part of the core
  [FRAME Support](https://substrate.dev/docs/en/knowledgebase/runtime/frame#support-library)
  library.

### Pallets

The runtime in this project is constructed using many FRAME pallets that ship with the
[core Substrate repository](https://github.com/paritytech/substrate/tree/master/frame) and a
template pallet that is [defined in the `pallets`](./pallets/template/src/lib.rs) directory.

A FRAME pallet is compromised of a number of blockchain primitives:

- Storage: FRAME defines a rich set of powerful
  [storage abstractions](https://substrate.dev/docs/en/knowledgebase/runtime/storage) that makes
  it easy to use Substrate's efficient key-value database to manage the evolving state of a
  blockchain.
- Dispatchables: FRAME pallets define special types of functions that can be invoked (dispatched)
  from outside of the runtime in order to update its state.
- Events: Substrate uses [events](https://substrate.dev/docs/en/knowledgebase/runtime/events) to
  notify users of important changes in the runtime.
- Errors: When a dispatchable fails, it returns an error.
- Config: The `Config` configuration interface is used to define the types and parameters upon
  which a FRAME pallet depends.
+42 −0
Original line number Diff line number Diff line
[package]
edition.workspace = true
homepage.workspace = true
license.workspace = true
description = "Duniter client distance"
name = "dc-distance"
readme = "README.md"
version = "1.0.0"
repository.workspace = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[features]
std = [
	"frame-support/std",
	"pallet-distance/std",
	"sp-core/std",
	"sp-distance/std",
	"sp-runtime/std",
]
runtime-benchmarks = [
	"frame-support/runtime-benchmarks",
	"pallet-distance/runtime-benchmarks",
	"sp-runtime/runtime-benchmarks",
]
try-runtime = [
	"frame-support/try-runtime",
	"pallet-distance/try-runtime",
	"sp-distance/try-runtime",
	"sp-runtime/try-runtime",
]

[dependencies]
frame-support = { workspace = true }
log = { workspace = true }
pallet-distance = { workspace = true }
sc-client-api = { workspace = true }
sp-core = { workspace = true }
sp-distance = { workspace = true }
sp-runtime = { workspace = true }
thiserror = { workspace = true }