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
Loading items

Target

Select target project
  • nodes/rust/duniter-v2s
  • llaq/lc-core-substrate
  • pini-gh/duniter-v2s
  • vincentux/duniter-v2s
  • mildred/duniter-v2s
  • d0p1/duniter-v2s
  • bgallois/duniter-v2s
  • Nicolas80/duniter-v2s
8 results
Select Git revision
Loading items
Show changes
Showing
with 531 additions and 245 deletions
# Compilation
Duniter is compiled using the Rust compiler. For a general overview, refer to the [Rustc Dev Guide](https://rustc-dev-guide.rust-lang.org/overview.html).
Substrate and Duniter provide a set of features enabling or disabling parts of the code using conditional compilation. More information on conditional compilation can be found [here](https://doc.rust-lang.org/reference/conditional-compilation.html), or by enabling or disabling compilation of packages. Below is a list of all available features:
## External
- **runtime-benchmarks**: Compiles the runtime with benchmarks for extrinsics benchmarking.
- **try-runtime**: Compiles the runtime for tests and verifies operations in a simulated environment.
- **std**: Enables the Rust standard library.
## Duniter
- **gdev**: Sets `gdev-runtime` and `std` used to build the development chain.
- **gtest**: Sets `gtest-runtime` and `std` used to build the test chain.
- **g1**: Sets `g1-runtime` and `std` used to build the production chain.
- **constant-fees**: Uses a constant and predictable weight-to-fee conversion only for testing.
- **embed**: Enables hardcoded live chainspecs loaded from "../specs/gtest-raw.json" file.
- **native**: Compiles the runtime into native-platform executable only for debugging purposes.
Note: By default, Duniter will be compiled using the `gdev` feature and including the compilation of the distance oracle. Since the three Duniter chains are mutually exclusive, it is mandatory to disable the default feature to compile `gtest` and `g1` as follows:
- `cargo build --no-default-features --features gtest`
- `cargo build --no-default-features --features g1`
- `cargo build --no-default-features -p distance-oracle --features std`
...@@ -15,10 +15,10 @@ The summary gives an overview of the rules described below. Reading it will help ...@@ -15,10 +15,10 @@ The summary gives an overview of the rules described below. Reading it will help
## Naming commits ## Naming commits
Every commit must follow [conventional commit specification v1.0.0]. Every commit must comply with [conventional commit specification v1.0.0].
The commit name hase to be meaningful in the context of commit history reread. It should not make reference to a specific MR or discussion. The commit name has to be meaningful in the context of commit history reread. It should not make reference to a specific MR or discussion.
Among other, commit history is used in changlogs and to follow the project progress, that's why it has to be self-explanatory. Among other, commit history is used in changlogs and to track the project progress, that's why it has to be self-explanatory.
If you have a new need, please contact the main developers to add a type together. If you have a new need, please contact the main developers to add a type together.
## Update strategy ## Update strategy
...@@ -28,18 +28,13 @@ We only use **rebases**, *merges* are strictly fordbidden ! ...@@ -28,18 +28,13 @@ We only use **rebases**, *merges* are strictly fordbidden !
Every time the `master` branch is updated, you must rebase each of your working branch on it. For each of them: Every time the `master` branch is updated, you must rebase each of your working branch on it. For each of them:
1. Go on your branch 1. Go on your branch
2. Run a rebase on master: 1. Rebase on master with `git rebase master`
1. If you see conflicts, fix them by editing the sources. Once it is done, you must:
1. commit the files that were in conflict
1. continue the rebase with `git rebase --continue`
1. Keep doing until you don't have any more conflict after `git rebase --continue`.
git rebase master To prevent accidental merge commits, we recommend to force the `--ff-only` option on the merge command:
3. If you see conflicts, fix them by editing the sources. Once it is done, you must:
a. commit the files that were in conflict
b. continue the rebase with `git rebase --continue`
c. Do 3. again for each commit that will be in conflict.
4. When you don't have any conflict anymore after `git rebase --continue`, then the rebase succeeded. Then rebase a remaning branch.
To prevent accidental merge commits, we recommend that force the `--ff-only` option on the merge command:
git config --global merge.ff only git config --global merge.ff only
...@@ -58,20 +53,24 @@ any problem with your material. ...@@ -58,20 +53,24 @@ any problem with your material.
After complying with the above criteria in your commits, you should check that your branch is up to date with the target branch (`master` in this example). As this branch is moving forward frequently, it is possible that new commits may have occurred while you were working on your branch (named YOUR_BRANCH, here). If this is the case or in case of doubt, to update your branch with respect to `master`, do the following: After complying with the above criteria in your commits, you should check that your branch is up to date with the target branch (`master` in this example). As this branch is moving forward frequently, it is possible that new commits may have occurred while you were working on your branch (named YOUR_BRANCH, here). If this is the case or in case of doubt, to update your branch with respect to `master`, do the following:
```bash
git checkout master # switch to master branch git checkout master # switch to master branch
git pull # updates the remote branch based on remote git pull # updates the remote branch based on remote
git checkout YOU_BRANCH # switch back to your branch git checkout YOU_BRANCH # switch back to your branch
git rebase master # rebase you work on master branch git rebase master # rebase you work on master branch
```
In case of conflict during rebase that you can not solve, contact a lead developer telling them the hash of the commit on which YOUR_BRANCH is currently based so they can reproduce the rebase and see the conflicts. While waiting for their answer, you can cancel the rebase and work on YOUR_BRANCH without updating: In case of conflict during rebase that you can not solve, contact a lead developer telling them the hash of the commit on which YOUR_BRANCH is currently based so they can reproduce the rebase and see the conflicts. While waiting for their answer, you can cancel the rebase and work on YOUR_BRANCH without updating:
```
git rebase --abort git rebase --abort
```
It is better to take your time before integrating a new contribution because the history of the master branch cannot be modified: it is a protected branch. Each commit on this branch remains there *ad vitam aeternam* that is why we make sure to keep a clear and understandable commit history. It is better to take your time before integrating a new contribution because the history of the master branch cannot be modified: it is a protected branch. Each commit on this branch remains there *ad vitam aeternam* that is why we make sure to keep a clear and understandable commit history.
## Discussion in a merge request ## Discussion in a merge request
On Gitlab, a discussion is opened for each merge request. It will allow you to discuss the changes you have made. Feel free to identify someone by writing @pseudo so that they are notified of your request. Don't be impatient, the review of your contribution may take more or less time depending on its content! On Gitlab, a discussion is opened for each merge request. It will allow you to discuss the changes you have made. Feel free to tag someone by writing @pseudo so that they are notified of your request. Don't be impatient, the review of your contribution may take more or less time depending on its content!
The general discussion is used to comment on the merge request as a whole, for example to tag a developer for a proofreading request. When it comes to discussing a specific change in the code, you should go to the "Changes" tab of the merge request and comment under the code extract involved. This makes it easier to break down the resolution of problems raised by the merge request via the "comment resolution" feature. Each segment can be marked as resolved, but only the reviewer is allowed to do so! The general discussion is used to comment on the merge request as a whole, for example to tag a developer for a proofreading request. When it comes to discussing a specific change in the code, you should go to the "Changes" tab of the merge request and comment under the code extract involved. This makes it easier to break down the resolution of problems raised by the merge request via the "comment resolution" feature. Each segment can be marked as resolved, but only the reviewer is allowed to do so!
...@@ -81,7 +80,8 @@ When you finished developing, you must compile, run linter and run all tests: ...@@ -81,7 +80,8 @@ When you finished developing, you must compile, run linter and run all tests:
cargo fmt cargo fmt
cargo clippy cargo clippy
cd tests && npm test cargo tu
cargo cucumber
Then commit everything. Then commit everything.
...@@ -93,7 +93,7 @@ If you have a pile of commits, use the useful interactive rebase to clean up you ...@@ -93,7 +93,7 @@ If you have a pile of commits, use the useful interactive rebase to clean up you
There you can rename the `wip:` commits, you can "fixup" commits that go together, you can rename and re-order commits,... There you can rename the `wip:` commits, you can "fixup" commits that go together, you can rename and re-order commits,...
After an interactive rebase, your local git history is different that yours in Gitlab, so you need a force push to make it to Gitlab: After an interactive rebase, your local git history differs from Gitlab's version, so you need a force push to make it to Gitlab:
git push -f git push -f
......
docs/dev/img/release-pipeline.png

44.1 KiB

This diff is collapsed.
# Duniter Pallet Conventions
## Call
Custom Duniter pallet calls should adhere to the standard Substrate naming convention:
- `action_` for regular calls (e.g., `create_identity`).
- `force_action_` for calls with a privileged origin (e.g., `force_set_distance_status`).
## Error
In the event of a call failure, it should trigger a pallet error with a self-explanatory name, for instance, `IdtyNotFound`.
## Event
Successful calls should deposit a system event to notify external entities of the change. The event name should be self-explanatory and structured in the form of a Rust struct with named fields, ensuring clarity in autogenerated documentation. An example is:
```rust
IdtyRemoved {
idty_index: T::IdtyIndex,
reason: IdtyRemovalReason<T::IdtyRemovalOtherReason>,
}
```
## Hook
Hooks are inherently infallible, and no errors should be emitted within them. To monitor progression from inside the hook, events can be employed to inform external entities about changes or no-changes.
## Internal Function
Internal functions should adhere to the following naming convention:
- `do_action_` for regular functions executing the base logic of a call (e.g., `do_remove_identity_`). These functions should directly emit events and trigger errors as needed.
- `force_action_` for privileged functions that bypass any checks. This can be useful for specific benchmarking functions.
- `check_` for functions performing checks and triggering errors in case of failure.
This diff is collapsed.
# How to replay a block # How to replay a block
You can use `try-runtime` subcommand to replay a block against a real satte from a live network. WARN: try-runtime is not properly implemented
You can use `try-runtime` subcommand to replay a block against a real state from a live network.
1. Checkout the git tag of the runtime version at the block you want to replay 1. Checkout the git tag of the runtime version at the block you want to replay
2. Build duniter with feature `try-runtime`: `cargo build --features try-runtime` 2. Build duniter with feature `try-runtime`: `cargo build --features try-runtime`
...@@ -9,13 +11,13 @@ You can use `try-runtime` subcommand to replay a block against a real satte from ...@@ -9,13 +11,13 @@ You can use `try-runtime` subcommand to replay a block against a real satte from
5. Replay the block a first time to get the state: 5. Replay the block a first time to get the state:
``` ```
duniter try-runtime --exectuion=Native execute-block --block-at 0x2633026e3e428b010cfe08d215b6253843a9fe54db28748ca56de37e6a83c644 live -s tmp/snapshot1 -u ws://localhost:9944 duniter try-runtime --execution=Native execute-block --block-at 0x2633026e3e428b010cfe08d215b6253843a9fe54db28748ca56de37e6a83c644 live -s tmp/snapshot1 -u ws://localhost:9944
``` ```
6. Then, replay the block as many times as you need against your local snapshot: 6. Then, replay the block as many times as you need against your local snapshot:
``` ```
duniter try-runtime --exectuion=Native execute-block --block-at 0x2633026e3e428b010cfe08d215b6253843a9fe54db28748ca56de37e6a83c644 --block-ws-uri ws://localhost:9944 snap -s tmp/snapshot1 duniter try-runtime --execution=Native execute-block --block-at 0x2633026e3e428b010cfe08d215b6253843a9fe54db28748ca56de37e6a83c644 --block-ws-uri ws://localhost:9944 snap -s tmp/snapshot1
``` ```
try-runtime does not allow (for now) to store the block locally, only the storage can be stored. try-runtime does not allow (for now) to store the block locally, only the storage can be stored.
...@@ -35,7 +35,7 @@ Use a terminal shell to execute the following commands: ...@@ -35,7 +35,7 @@ Use a terminal shell to execute the following commands:
```bash ```bash
sudo apt update sudo apt update
# May prompt for location information # May prompt for location information
sudo apt install -y cmake pkg-config libssl-dev git build-essential clang libclang-dev curl sudo apt install -y cmake pkg-config libssl-dev git build-essential clang libclang-dev curl protobuf-compiler
``` ```
### Arch Linux ### Arch Linux
...@@ -79,3 +79,16 @@ rustup update nightly ...@@ -79,3 +79,16 @@ rustup update nightly
rustup update stable rustup update stable
rustup target add wasm32-unknown-unknown --toolchain nightly rustup target add wasm32-unknown-unknown --toolchain nightly
``` ```
### Installing mold linker to decrease build time
Mold (modern linker) (https://github.com/rui314/mold) decreases the build time. Install it through your system package for example then add the following to your `~/.cargo/config`:
```toml
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=/usr/bin/mold"]
```
(see https://forum.duniter.org/t/decrease-duniter-build-time/10170 on the forum)
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.