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
Showing
with 97 additions and 91 deletions
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
use sc_cli::{Error, SubstrateCli};
use sp_io::hashing::twox_128;
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
pub mod chain_spec;
pub mod cli;
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
//! Duniter Node CLI.
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
//! A collection of node-specific RPC methods.
//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
use common_runtime::{AccountId, Balance, Block, BlockNumber, Hash, Header, Index};
use sc_client_api::{AuxStore, Backend as BackendT, BlockchainEvents, KeyIterator, UsageProvider};
......
......@@ -2,7 +2,7 @@
authors = ['librelois <c@elo.tf>']
description = 'FRAME pallet authority members.'
edition = "2021"
homepage = 'https://substrate.dev'
homepage = 'https://duniter.org'
license = 'AGPL-3.0'
name = 'pallet-authority-members'
readme = 'README.md'
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::type_complexity)]
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
use super::*;
use crate::{self as pallet_authority_members};
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
use super::*;
use crate::mock::*;
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
use super::SessionIndex;
use frame_support::pallet_prelude::Weight;
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
//! Various basic types for use in the certification pallet.
......
......@@ -2,7 +2,7 @@
authors = ['librelois <c@elo.tf>']
description = 'FRAME pallet certification.'
edition = "2021"
homepage = 'https://substrate.dev'
homepage = 'https://duniter.org'
license = 'AGPL-3.0'
name = 'pallet-certification'
readme = 'README.md'
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
#![cfg_attr(not(feature = "std"), no_std)]
......@@ -90,9 +90,11 @@ pub mod pallet {
// GENESIS STUFF //
#[pallet::genesis_config]
#[allow(clippy::type_complexity)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
pub apply_cert_period_at_genesis: bool,
pub certs_by_receiver: BTreeMap<T::IdtyIndex, BTreeMap<T::IdtyIndex, T::BlockNumber>>,
pub certs_by_receiver:
BTreeMap<T::IdtyIndex, BTreeMap<T::IdtyIndex, Option<T::BlockNumber>>>,
}
#[cfg(feature = "std")]
......@@ -128,7 +130,8 @@ pub mod pallet {
received_count: issuers.len() as u32,
});
for (issuer, removable_on) in issuers {
let mut issuers_: Vec<_> = Vec::with_capacity(issuers.len());
for (issuer, maybe_removable_on) in issuers {
// Count issued certs
cert_meta_by_issuer
.entry(*issuer)
......@@ -139,9 +142,13 @@ pub mod pallet {
})
.issued_count += 1;
// Compute and store removable_on
let removable_on = maybe_removable_on.unwrap_or_else(T::ValidityPeriod::get);
issuers_.push((*issuer, removable_on));
// Prepare CertsRemovableOn
certs_removable_on
.entry(*removable_on)
.entry(removable_on)
.or_default()
.push((*issuer, *receiver));
......@@ -158,9 +165,8 @@ pub mod pallet {
}
// Write CertsByReceiver
let mut issuers: Vec<_> = issuers.iter().collect();
issuers.sort();
CertsByReceiver::<T, I>::insert(receiver, issuers);
issuers_.sort();
CertsByReceiver::<T, I>::insert(receiver, issuers_);
}
// Write StorageIdtyCertMeta
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
use crate::{self as pallet_certification};
use frame_support::{
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
use crate::mock::Event as RuntimeEvent;
use crate::mock::*;
......@@ -42,8 +42,8 @@ fn test_cannot_certify_self() {
apply_cert_period_at_genesis: true,
certs_by_receiver: btreemap![
0 => btreemap![
1 => 5,
2 => 5,
1 => Some(5),
2 => Some(5),
],
],
})
......@@ -63,16 +63,16 @@ fn test_genesis_build() {
apply_cert_period_at_genesis: true,
certs_by_receiver: btreemap![
0 => btreemap![
1 => 7,
2 => 9,
1 => Some(7),
2 => Some(9),
],
1 => btreemap![
0 => 10,
2 => 3,
0 => Some(10),
2 => Some(3),
],
2 => btreemap![
0 => 5,
1 => 4,
0 => Some(5),
1 => Some(4),
],
],
})
......@@ -132,16 +132,16 @@ fn test_cert_period() {
apply_cert_period_at_genesis: true,
certs_by_receiver: btreemap![
0 => btreemap![
1 => 10,
2 => 10,
1 => Some(10),
2 => Some(10),
],
1 => btreemap![
0 => 10,
2 => 10,
0 => Some(10),
2 => Some(10),
],
2 => btreemap![
0 => 10,
1 => 10,
0 => Some(10),
1 => Some(10),
],
],
})
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
pub trait IsCertAllowed<IdtyIndex> {
fn is_cert_allowed(issuer: IdtyIndex, receiver: IdtyIndex) -> bool;
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
//! Various basic types for use in the certification pallet.
......
......@@ -2,7 +2,7 @@
authors = ['librelois <c@elo.tf>']
description = 'FRAME pallet duniter account.'
edition = "2021"
homepage = 'https://substrate.dev'
homepage = 'https://duniter.org'
license = 'AGPL-3.0'
name = 'pallet-duniter-account'
readme = 'README.md'
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
// This file is part of Duniter-v2S.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// 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.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
#![cfg_attr(not(feature = "std"), no_std)]
......