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

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
Show changes
Commits on Source (2)
  • Hugo Trentesaux's avatar
    ref(node): remove cmd.shared_params.dev special case (!130) · 9adbdf90
    Hugo Trentesaux authored and Pascal Engélibert's avatar Pascal Engélibert committed
    * remove cmd.shared_params.dev special case
    
    since --dev is a shortcut for --chain=dev
    and that case is managed in load_spec
    there is no need to manage it separately
    9adbdf90
  • Hugo Trentesaux's avatar
    Document pallets in readme (!122) · 1d2bb1b9
    Hugo Trentesaux authored
    * improve authority doc
    
    * more doc
    
    * update onshot accounts readme
    
    * doc xtask
    
    * doc runtime
    
    * doc todo
    
    * doc todo
    
    * doc pallets
    
    * doc todo
    
    * doc ud
    
    * doc oneshot
    
    * doc authority members
    
    * doc certification
    
    * doc wot
    
    * doc membership
    
    * doc identity
    
    * fix typo
    
    * doc duniter-account
    1d2bb1b9
Showing
with 181 additions and 26 deletions
......@@ -187,30 +187,7 @@ pub fn run() -> sc_cli::Result<()> {
match &cli.subcommand {
Some(Subcommand::BuildSpec(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| {
if cmd.shared_params.dev {
match config.chain_spec.runtime_type() {
#[cfg(feature = "g1")]
RuntimeType::G1 => cmd.run(
Box::new(chain_spec::g1::development_chain_spec()?),
config.network,
),
#[cfg(feature = "gtest")]
RuntimeType::GTest => cmd.run(
Box::new(chain_spec::gtest::development_chain_spec()?),
config.network,
),
#[cfg(feature = "gdev")]
RuntimeType::GDev => cmd.run(
Box::new(chain_spec::gdev::development_chain_spec()?),
config.network,
),
_ => panic!("unknown runtime"),
}
} else {
cmd.run(config.chain_spec, config.network)
}
})
runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
}
Some(Subcommand::CheckBlock(cmd)) => {
let runner = cli.create_runner(cmd)?;
......
# Duniter pallets
Duniter uses some [parity pallets](https://github.com/duniter/substrate/tree/master/frame) available in our substrate fork, and some defined here. Each pallet has its own readme, but here is a summary:
## Business processes pallets
These pallets are at the core of Duniter/Ğ1 currency
- **`authority-members`** Duniter authorities are not selected with staking but through a smith web of trust.
- **`certification`** Certifications are the "edges" of Duniter's dynamic directed graph. They mean the acceptation of a Licence.
- **`duniter-account`** Duniter customized the `AccountData` defined in the `Balances` pallet to introduce a `RandomId`.
- **`duniter-wot`** Merges identities, membership, certifications and distance pallets to implement Duniter Web of Trust.
- **`duniter-distance`** Offchain worker used to compute distance criterion.
- **`identity`** Identities are the "nodes" of Duniter's dynamic directed graph. They are one-to-one mapping to human being.
- **`membership`** Membership defines the state of identities. They can be member or not of the different WoTs.
- **`universal-dividend`** UD is at the basis of Ğ1 "libre currency". It is both a kind of "basic income" and a measure unit.
## Functional pallets
- **`duniter-test-parameters`** Test parameters only used in ĞDev to allow tweaking parameters more easily.
- **`oneshot-account`** Oneshot accounts are light accounts only used once for anonimity or convenience use case.
- **`provide-randomness`** Lets blockchain users ask for a verifiable random number.
- **`upgrade-origin`** Allows some origins to dispatch a call as root.
\ No newline at end of file
# Duniter authority members pallet
In a permissioned network, we have to define the set of authorities, and among these authorities, the ones taking part in the next session. That's what authority members pallet does. In practice:
- it manages a `Members` set with some custom rules
- it implements the `SessionManager` trait from the session frame pallet
## Entering the set of authorities
To become part of Duniter authorities, one has to complete these steps:
1. become member of the main web of trust
1. request membership to the smith sub wot
1. get enough certs to get smith membership
1. claim membership to the set of authorities
Then one can "go online" and "go offline" to enter or leave two sessions after.
## Staying in the set of authorities
If a smith is offline more than `MaxOfflineSessions`, he leaves the set of authorities.
\ No newline at end of file
......@@ -521,6 +521,7 @@ impl<T: Config> pallet_session::SessionManager<T::ValidatorId> for Pallet<T> {
if members_ids_to_add.is_empty() {
if members_ids_to_del.is_empty() {
// when no change to the set of autorities, return None
return None;
} else {
for member_id in &members_ids_to_del {
......@@ -540,6 +541,7 @@ impl<T: Config> pallet_session::SessionManager<T::ValidatorId> for Pallet<T> {
Self::deposit_event(Event::IncomingAuthorities(members_ids_to_add.clone()));
}
// updates the list of OnlineAuthorities and returns the list of their key
Some(
OnlineAuthorities::<T>::mutate(|members_ids| {
for member_id in members_ids_to_del {
......
# Duniter certification pallet
Duniter certifications are the *edges* in the Duniter [Web of Trust](../duniter-wot/). They can have different meanings:
- in the case of the main WoT, they mean "I have met this person IRL and trust them" (see Ğ1 Licence)
- in the case of the smith sub-WoT, they mean "I trust this person to be able to run Duniter securely" (see smith Licence)
This pallet manages certifications creation, deletion...
\ No newline at end of file
# Duniter account pallet
Duniter customizes the `AccountData` of the `Balances` Substrate pallet. In particular, it adds a field `RandomId`.
## RandomID
The RandomId field was added with the idea to provide a unique id that can not be controlled by user to serve as a basis for robust identification. The discussion is available on the forum.
https://forum.duniter.org/t/la-solution-pour-des-identicones-securisees-le-random-id/9126
## Account creation fee
DuniterAccount defines a creation fee that is preleved to the account one block after its creation. This fee goes to the treasury.
## Sufficient
DuniterAccount tweaks the substrate AccountInfo to allow identity accounts to exist without existential deposit. This allows to spare the creation fee.
\ No newline at end of file
......@@ -20,11 +20,17 @@ use scale_info::TypeInfo;
use sp_core::H256;
use sp_runtime::traits::Zero;
// see `struct AccountData` for details in substrate code
#[derive(Clone, Decode, Default, Encode, Eq, MaxEncodedLen, PartialEq, RuntimeDebug, TypeInfo)]
pub struct AccountData<Balance> {
/// A random identifier that can not be chosen by the user
// this intends to be used as a robust identification system
pub(super) random_id: Option<H256>,
// see Substrate AccountData
pub(super) free: Balance,
// see Substrate AccountData
pub(super) reserved: Balance,
// see Substrate AccountData
fee_frozen: Balance,
}
......
# Duniter test parameters
This pallet allows ĞDev runtime to tweak parameter values instead of having it runtime constants.
\ No newline at end of file
# Duniter Web of Trust pallet
Duniter WoT is at the core of its identity system and is a big improvement compared to PGP WoT. It is a dynamic directed graph whose nodes are [identities](../identity/) and edges [certifications](../certification/).
There are two instances:
- the main WoT, for every human
- the smith sub-WoT, for authorities
It has both static and dynamic rules, controlling the condition to join and remain [member](../membership/).
- static rules
- minimum number of received certifications (min indegree)
- maximum number of emited certifications (max outdegree)
- distance criterion (see distance pallet)
- dynamic rules
- time interval between two certifications
- certification duration (see certification pallet)
- membership renewal (see membership pallet)
This pallet's main role is to check the Web of Trust rules.
\ No newline at end of file
......@@ -271,9 +271,9 @@ where
}
}
// Membership revocation cases:
// - Triggered by identity removal: the identity underlying will by removed by the
// - Triggered by main identity removal: the underlying identity will be removed by the
// caller.
// - Triggered by the membership pallet: it's ondly possible for the sub-wot, so we
// - Triggered by the membership pallet: it's only possible for a sub-wot, so we
// should not remove the underlying identity
// So, in any case, we must do nothing
sp_membership::Event::<IdtyIndex, MetaData>::MembershipRevoked(_) => {}
......
# Duniter identity pallet
Duniter has a builtin identity system that does not work with external registrar compared to [parity identity pallet](https://github.com/paritytech/substrate/tree/master/frame/identity).
## Duniter identity
A Duniter identity contains:
- its **owner key** (that can change)
- an optional **old owner key** with the date of the key change
- a **status** that can be
- created (by an existing identity)
- confirmed (by owner, comes with a name)
- validated (that has become member in the allowed timeframe)
It also contains:
- the block number at which it can emit its **next certification**
- the block number at which it can be **removed from storage**
It also contains attached data defined by the runtime that can be for example
- the number of the first UD it is eligible to
### Name
Each identity is declared with a name emited on confirmation event. Duniter keeps a list of identity names hash to ensure unicity.
### Owner key
The idea of the owner key is to allow the user to keep a fixed identity while changing the keys for security reasons. For example when a device with the keys might have been compromised. There is a limit to the frequency of owner key change and the old owner key can still revoke the identity for a given period.
### Status / removable date
The status is a temporary value allowing to prune identities before they become member. When an identity is not valiated (not member of the WoT for instance), it can be removed when the date is reached. The remove date of a validated identity is block zero.
### Next certification
The next certification is a rate limit to the emission of certification (and then identity creation).
### Revokation
Revoking an identity basically means deleting it.
\ No newline at end of file
# Duniter membership pallet
Duniter membership is related to duniter Web of Trust and more specific than [parity membership pallet](https://github.com/paritytech/substrate/tree/master/frame/membership). It is used only internally by the identity, WoT, and distance pallets. In particular, it is adding the concept of "pending membership" which is an intermediate state where the identity is waiting to become member.
\ No newline at end of file
# Duniter oneshot account pallet
Duniter provides light accounts without `AccountInfo` (nonce, consumers, providers, sufficients, free, reserved, misc_frozen, fee_frozen) that can only be consumed once. This should reduce transaction weight and then fees. The use case is anonymous accounts or physical supports.
\ No newline at end of file
# Duniter provide randomness pallet
TODO
\ No newline at end of file
# Duniter universal dividend pallet
One of the main features of Duniter is the Universal Dividend based on the Relative Theory of Money. It is both a daily monetary creation and a measure unit.
This pallet provides functions to create UDs and transfer an amount of currency counted in UD. It should be noted that the UD is not actually created every day on every account which would be very resource consuming but must be claimed by the member in a given extrinsic.
\ No newline at end of file
# Duniter upgrade origin pallet
TODO
\ No newline at end of file
# Primitives
TODO
\ No newline at end of file
# Resources
Files used for different purpose like tests.
\ No newline at end of file
# Runtimes
Duniter client can run several runtimes.
- ĞDev is for development purpose
- ĞTest is to prepare Ğ1 migration and test features before deploying on Ǧ1
- Ğ1 is the production currency
# Scripts
Scripts not moved to xtasks because they only depend on Docker and not Rust.
\ No newline at end of file