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 1087 additions and 839 deletions
......@@ -27,9 +27,9 @@ use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
pub enum Event<IdtyId> {
pub enum Event<IdtyId, MetaData = ()> {
/// A membership has acquired
MembershipAcquired(IdtyId),
MembershipAcquired(IdtyId, MetaData),
/// A membership has expired
MembershipExpired(IdtyId),
/// A membership has renewed
......@@ -42,13 +42,6 @@ pub enum Event<IdtyId> {
PendingMembershipExpired(IdtyId),
}
#[derive(PartialEq)]
pub enum OriginPermission {
Allowed,
Forbidden,
Root,
}
#[cfg_attr(feature = "std", derive(Deserialize, Serialize))]
#[derive(Encode, Decode, Default, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub struct MembershipData<BlockNumber: Decode + Encode + TypeInfo> {
......
......@@ -14,18 +14,7 @@
// 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/>.
use crate::*;
use frame_support::pallet_prelude::{DispatchResultWithPostInfo, TypeInfo, Weight};
pub trait IsIdtyAllowedToClaimMembership<IdtyId> {
fn is_idty_allowed_to_claim_membership(idty_id: &IdtyId) -> bool;
}
impl<IdtyId> IsIdtyAllowedToClaimMembership<IdtyId> for () {
fn is_idty_allowed_to_claim_membership(_: &IdtyId) -> bool {
true
}
}
use frame_support::pallet_prelude::Weight;
pub trait IsIdtyAllowedToRenewMembership<IdtyId> {
fn is_idty_allowed_to_renew_membership(idty_id: &IdtyId) -> bool;
......@@ -47,94 +36,30 @@ impl<IdtyId> IsIdtyAllowedToRequestMembership<IdtyId> for () {
}
}
pub trait IsOriginAllowedToUseIdty<Origin, IdtyId> {
fn is_origin_allowed_to_use_idty(origin: &Origin, idty_id: &IdtyId) -> OriginPermission;
}
impl<Origin, IdtyId> IsOriginAllowedToUseIdty<Origin, IdtyId> for () {
fn is_origin_allowed_to_use_idty(_: &Origin, _: &IdtyId) -> OriginPermission {
OriginPermission::Allowed
}
}
pub trait IsInPendingMemberships<IdtyId> {
fn is_in_pending_memberships(idty_id: IdtyId) -> bool;
}
pub trait IsMember<IdtyId> {
fn is_member(idty_id: &IdtyId) -> bool;
}
impl<IdtyId> IsMember<IdtyId> for () {
fn is_member(_: &IdtyId) -> bool {
false
}
}
pub trait OnEvent<IdtyId> {
fn on_event(event: crate::Event<IdtyId>) -> Weight;
pub trait OnEvent<IdtyId, MetaData> {
fn on_event(event: &crate::Event<IdtyId, MetaData>) -> Weight;
}
impl<IdtyId> OnEvent<IdtyId> for () {
fn on_event(_: crate::Event<IdtyId>) -> Weight {
impl<IdtyId, MetaData> OnEvent<IdtyId, MetaData> for () {
fn on_event(_: &crate::Event<IdtyId, MetaData>) -> Weight {
0
}
}
pub trait MembershipAction<IdtyId, Origin> {
fn request_membership_(origin: Origin, idty_id: IdtyId) -> DispatchResultWithPostInfo;
fn claim_membership_(origin: Origin, idty_id: IdtyId) -> DispatchResultWithPostInfo;
fn renew_membership_(origin: Origin, idty_id: IdtyId) -> DispatchResultWithPostInfo;
fn revoke_membership_(origin: Origin, idty_id: IdtyId) -> DispatchResultWithPostInfo;
fn force_claim_membership(idty_id: IdtyId) -> Weight;
fn force_renew_membership(idty_id: IdtyId) -> Weight;
fn force_revoke_membership(idty_id: IdtyId) -> Weight;
pub trait MembersCount {
fn members_count() -> u32;
}
impl<IdtyId, Origin> MembershipAction<IdtyId, Origin> for () {
fn request_membership_(_: Origin, _: IdtyId) -> DispatchResultWithPostInfo {
Ok(().into())
}
fn claim_membership_(_: Origin, _: IdtyId) -> DispatchResultWithPostInfo {
Ok(().into())
}
fn renew_membership_(_: Origin, _: IdtyId) -> DispatchResultWithPostInfo {
Ok(().into())
}
fn revoke_membership_(_: Origin, _: IdtyId) -> DispatchResultWithPostInfo {
Ok(().into())
}
fn force_claim_membership(_: IdtyId) -> Weight {
0
}
fn force_renew_membership(_: IdtyId) -> Weight {
0
}
fn force_revoke_membership(_: IdtyId) -> Weight {
0
}
}
pub trait MembershipExternalStorage<BlockNumber: Decode + Encode + TypeInfo, IdtyId>:
IsMember<IdtyId>
{
fn insert(idty_id: IdtyId, membership_data: MembershipData<BlockNumber>);
fn get(idty_id: &IdtyId) -> Option<MembershipData<BlockNumber>>;
fn remove(idty_id: &IdtyId);
pub trait Validate<AccountId> {
fn validate(&self, account_id: &AccountId) -> bool;
}
static INVALID_CONF_MSG: &str = "invalid pallet configuration: if `MembershipExternalStorage` = (), you must set `ExternalizeMembershipStorage` to `false`.";
impl<BlockNumber: Decode + Encode + TypeInfo, IdtyId> MembershipExternalStorage<BlockNumber, IdtyId>
for ()
{
fn insert(_: IdtyId, _: MembershipData<BlockNumber>) {
panic!("{}", INVALID_CONF_MSG)
}
fn get(_: &IdtyId) -> Option<MembershipData<BlockNumber>> {
panic!("{}", INVALID_CONF_MSG)
}
fn remove(_: &IdtyId) {
panic!("{}", INVALID_CONF_MSG)
impl<AccountId> Validate<AccountId> for () {
fn validate(&self, _account_id: &AccountId) -> bool {
true
}
}
No preview for this file type
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
//
// Substrate-Libre-Currency 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,
// 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/>.
#[macro_export]
macro_rules! runtime_apis {
{$($custom:tt)*} => {
common_runtime::runtime_apis! {
$($custom)*
impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
fn authorities() -> Vec<sp_authority_discovery::AuthorityId> {
AuthorityDiscovery::authorities()
}
}
impl sp_consensus_babe::BabeApi<Block> for Runtime {
fn configuration() -> sp_consensus_babe::BabeGenesisConfiguration {
// The choice of `c` parameter (where `1 - c` represents the
// probability of a slot being empty), is done in accordance to the
// slot duration and expected target block time, for safely
// resisting network delays of maximum two seconds.
// <https://research.web3.foundation/en/latest/polkadot/BABE/Babe/#6-practical-results>
sp_consensus_babe::BabeGenesisConfiguration {
slot_duration: Babe::slot_duration(),
epoch_length: EpochDuration::get(),
c: BABE_GENESIS_EPOCH_CONFIG.c,
genesis_authorities: Babe::authorities().to_vec(),
randomness: Babe::randomness(),
allowed_slots: BABE_GENESIS_EPOCH_CONFIG.allowed_slots,
}
}
fn current_epoch_start() -> sp_consensus_babe::Slot {
Babe::current_epoch_start()
}
fn current_epoch() -> sp_consensus_babe::Epoch {
Babe::current_epoch()
}
fn next_epoch() -> sp_consensus_babe::Epoch {
Babe::next_epoch()
}
fn generate_key_ownership_proof(
_slot: sp_consensus_babe::Slot,
authority_id: sp_consensus_babe::AuthorityId,
) -> Option<sp_consensus_babe::OpaqueKeyOwnershipProof> {
use codec::Encode;
Historical::prove((sp_consensus_babe::KEY_TYPE, authority_id))
.map(|p| p.encode())
.map(sp_consensus_babe::OpaqueKeyOwnershipProof::new)
}
fn submit_report_equivocation_unsigned_extrinsic(
equivocation_proof: sp_consensus_babe::EquivocationProof<<Block as BlockT>::Header>,
key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof,
) -> Option<()> {
let key_owner_proof = key_owner_proof.decode()?;
Babe::submit_unsigned_equivocation_report(
equivocation_proof,
key_owner_proof,
)
}
}
}
};
}
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
//
// Substrate-Libre-Currency 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,
// 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/>.
#[macro_export]
macro_rules! pallets_config {
{$($custom:tt)*} => {
common_runtime::pallets_config!{
$($custom)*
impl pallet_authority_discovery::Config for Runtime {
type MaxAuthorities = MaxAuthorities;
}
impl pallet_authorship::Config for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
type UncleGenerations = UncleGenerations;
type FilterUncle = ();
type EventHandler = ImOnline;
}
impl pallet_babe::Config for Runtime {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;
// session module is the trigger
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = Session;
type KeyOwnerProofSystem = Historical;
type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::Proof;
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::IdentificationTuple;
type HandleEquivocation =
pallet_babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences, ReportLongevity>;
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
}
impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId;
type Event = Event;
type ValidatorSet = Historical;
type NextSessionRotation = Babe;
type ReportUnresponsiveness = Offences;
type UnsignedPriority = ImOnlineUnsignedPriority;
type WeightInfo = ();
type MaxKeys = MaxKeys;
type MaxPeerInHeartbeats = MaxPeerInHeartbeats;
type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize;
}
impl pallet_offences::Config for Runtime {
type Event = Event;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = ();
}
impl pallet_session::Config for Runtime {
type Event = Event;
type ValidatorId = AccountId;
type ValidatorIdOf = sp_runtime::traits::ConvertInto;
type ShouldEndSession = Babe;
type NextSessionRotation = Babe;
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, SessionManagerImpl>;
type SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = opaque::SessionKeys;
type WeightInfo = ();
}
impl pallet_session::historical::Config for Runtime {
type FullIdentification = ValidatorFullIdentification;
type FullIdentificationOf = FullIdentificationOfImpl;
}
impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = Babe;
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}
}
};
}
......@@ -11,6 +11,7 @@ runtime-benchmarks = [
'frame-support/runtime-benchmarks',
'frame-system/runtime-benchmarks',
'pallet-certification/runtime-benchmarks',
'pallet-duniter-wot/runtime-benchmarks',
'pallet-identity/runtime-benchmarks',
'pallet-membership/runtime-benchmarks',
'pallet-ud-accounts-storage/runtime-benchmarks',
......@@ -20,25 +21,41 @@ std = [
'codec/std',
'frame-support/std',
'frame-system/std',
'log/std',
'pallet-authority-members/std',
'pallet-babe/std',
'pallet-balances/std',
'pallet-certification/std',
'pallet-duniter-account/std',
'pallet-duniter-wot/std',
'pallet-identity/std',
'pallet-membership/std',
'pallet-provide-randomness/std',
'pallet-ud-accounts-storage/std',
'serde',
'sp-arithmetic/std',
'sp-core/std',
'sp-membership/std',
'sp-runtime/std',
'sp-std/std'
]
[dependencies]
pallet-authority-members = { path = '../../pallets/authority-members', default-features = false }
pallet-certification = { path = '../../pallets/certification', default-features = false }
pallet-duniter-account = { path = '../../pallets/duniter-account', default-features = false }
pallet-duniter-wot = { path = '../../pallets/duniter-wot', default-features = false }
pallet-identity = { path = '../../pallets/identity', default-features = false }
pallet-membership = { path = '../../pallets/membership', default-features = false }
pallet-provide-randomness = { path = '../../pallets/provide-randomness', default-features = false }
pallet-ud-accounts-storage = { path = '../../pallets/ud-accounts-storage', default-features = false }
sp-membership = { path = '../../primitives/membership', default-features = false }
# Crates.io
log = { version = "0.4.14", default-features = false }
smallvec = "1.6.1"
# substrate
# Substrate
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
[dependencies.codec]
......@@ -50,18 +67,28 @@ version = '2.3.1'
[dependencies.frame-support]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.frame-system]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-babe]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-balances]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-session]
default-features = false
features = ["historical"]
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.serde]
version = "1.0.101"
......@@ -71,29 +98,29 @@ features = ["derive"]
[dependencies.sp-arithmetic]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-consensus-babe]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-core]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-runtime]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-staking]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-std]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
......@@ -20,6 +20,66 @@ macro_rules! runtime_apis {
impl_runtime_apis! {
$($custom)*
impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
fn authorities() -> Vec<sp_authority_discovery::AuthorityId> {
AuthorityDiscovery::authorities()
}
}
impl sp_consensus_babe::BabeApi<Block> for Runtime {
fn configuration() -> sp_consensus_babe::BabeGenesisConfiguration {
// The choice of `c` parameter (where `1 - c` represents the
// probability of a slot being empty), is done in accordance to the
// slot duration and expected target block time, for safely
// resisting network delays of maximum two seconds.
// <https://research.web3.foundation/en/latest/polkadot/BABE/Babe/#6-practical-results>
use frame_support::traits::Get as _;
sp_consensus_babe::BabeGenesisConfiguration {
slot_duration: Babe::slot_duration(),
epoch_length: EpochDuration::get(),
c: BABE_GENESIS_EPOCH_CONFIG.c,
genesis_authorities: Babe::authorities().to_vec(),
randomness: Babe::randomness(),
allowed_slots: BABE_GENESIS_EPOCH_CONFIG.allowed_slots,
}
}
fn current_epoch_start() -> sp_consensus_babe::Slot {
Babe::current_epoch_start()
}
fn current_epoch() -> sp_consensus_babe::Epoch {
Babe::current_epoch()
}
fn next_epoch() -> sp_consensus_babe::Epoch {
Babe::next_epoch()
}
fn generate_key_ownership_proof(
_slot: sp_consensus_babe::Slot,
authority_id: sp_consensus_babe::AuthorityId,
) -> Option<sp_consensus_babe::OpaqueKeyOwnershipProof> {
use codec::Encode;
Historical::prove((sp_consensus_babe::KEY_TYPE, authority_id))
.map(|p| p.encode())
.map(sp_consensus_babe::OpaqueKeyOwnershipProof::new)
}
fn submit_report_equivocation_unsigned_extrinsic(
equivocation_proof: sp_consensus_babe::EquivocationProof<<Block as BlockT>::Header>,
key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof,
) -> Option<()> {
let key_owner_proof = key_owner_proof.decode()?;
Babe::submit_unsigned_equivocation_report(
equivocation_proof,
key_owner_proof,
)
}
}
impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
VERSION
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
//
// Substrate-Libre-Currency 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,
// 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/>.
use crate::entities::IdtyRight;
use crate::{BlockNumber, IdtyIndex};
use frame_support::traits::EnsureOrigin;
use pallet_certification::traits::IsIdtyAllowedToCreateCert;
use pallet_identity::IdtyStatus;
pub struct EnsureIdtyCallAllowedImpl<Runtime, IsIdtyAllowedToCreateCertImpl>(
core::marker::PhantomData<(Runtime, IsIdtyAllowedToCreateCertImpl)>,
);
impl<
Runtime: frame_system::Config<BlockNumber = BlockNumber>
+ pallet_identity::Config<IdtyIndex = IdtyIndex>,
IsIdtyAllowedToCreateCertImpl: IsIdtyAllowedToCreateCert<IdtyIndex>,
> pallet_identity::traits::EnsureIdtyCallAllowed<Runtime>
for EnsureIdtyCallAllowedImpl<Runtime, IsIdtyAllowedToCreateCertImpl>
{
fn can_create_identity(creator: IdtyIndex) -> bool {
IsIdtyAllowedToCreateCertImpl::is_idty_allowed_to_create_cert(creator)
}
}
pub struct AddStrongCertOrigin<Runtime>(core::marker::PhantomData<Runtime>);
impl<Runtime: pallet_identity::Config<IdtyIndex = IdtyIndex, IdtyRight = IdtyRight>>
EnsureOrigin<(Runtime::Origin, IdtyIndex, IdtyIndex)> for AddStrongCertOrigin<Runtime>
{
type Success = ();
fn try_origin(
o: (Runtime::Origin, IdtyIndex, IdtyIndex),
) -> Result<Self::Success, (Runtime::Origin, IdtyIndex, IdtyIndex)> {
match o.0.clone().into() {
Ok(frame_system::RawOrigin::Root) => Ok(()),
Ok(frame_system::RawOrigin::Signed(who)) => {
if let Some(issuer) = pallet_identity::Pallet::<Runtime>::identity(o.1) {
if let Some(allowed_key) = issuer.get_right_key(IdtyRight::StrongCert) {
if who == allowed_key {
if let Some(receiver) =
pallet_identity::Pallet::<Runtime>::identity(o.2)
{
match receiver.status {
IdtyStatus::ConfirmedByOwner | IdtyStatus::Validated => Ok(()),
IdtyStatus::Created | IdtyStatus::Expired => Err(o),
}
} else {
// Receiver not found
Err(o)
}
} else {
// Bad key
Err(o)
}
} else {
// Issuer has not right StrongCert
Err(o)
}
} else {
// Issuer not found
Err(o)
}
}
_ => Err(o),
}
}
}
pub struct DelStrongCertOrigin<Runtime>(core::marker::PhantomData<Runtime>);
impl<Runtime: frame_system::Config> EnsureOrigin<(Runtime::Origin, IdtyIndex, IdtyIndex)>
for DelStrongCertOrigin<Runtime>
{
type Success = ();
fn try_origin(
o: (Runtime::Origin, IdtyIndex, IdtyIndex),
) -> Result<Self::Success, (Runtime::Origin, IdtyIndex, IdtyIndex)> {
match o.0.clone().into() {
Ok(frame_system::Origin::<Runtime>::Root) => Ok(()),
_ => Err(o),
}
}
}
......@@ -14,7 +14,7 @@
// 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/>.
use crate::BlockNumber;
use crate::{Balance, BlockNumber};
use sp_runtime::Perbill;
/// This determines the average expected block time that we are targeting.
......@@ -40,6 +40,13 @@ pub const YEARS: BlockNumber = (SECS_PER_YEAR / SECS_PER_BLOCK) as BlockNumber;
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
frame_support::parameter_types! {
pub const DbWeight: frame_support::weights::RuntimeDbWeight = frame_support::weights::RuntimeDbWeight {
read: 25 * frame_support::weights::constants::WEIGHT_PER_MICROS, // ~25 µs
write: 100 * frame_support::weights::constants::WEIGHT_PER_MICROS, // ~100 µs
};
}
// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks.
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
......@@ -49,3 +56,8 @@ pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration =
c: PRIMARY_PROBABILITY,
allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryVRFSlots,
};
// 1 unit per item + 1 cent per byte
pub const fn deposit(items: u32, bytes: u32) -> Balance {
items as Balance * 100 + (bytes as Balance)
}
......@@ -14,36 +14,59 @@
// 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/>.
pub use pallet_identity::IdtyName;
use super::AccountId;
use frame_support::pallet_prelude::*;
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "std", derive(Deserialize, Serialize))]
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, RuntimeDebug, TypeInfo)]
pub enum IdtyRight {
CreateIdty,
LightCert,
StrongCert,
Ud,
#[macro_export]
macro_rules! declare_session_keys {
{} => {
pub mod opaque {
use super::*;
impl_opaque_keys! {
pub struct SessionKeys {
pub grandpa: Grandpa,
pub babe: Babe,
pub im_online: ImOnline,
pub authority_discovery: AuthorityDiscovery,
}
}
#[derive(Clone, codec::Decode, Debug, codec::Encode, Eq, PartialEq)]
pub struct SessionKeysWrapper(pub SessionKeys);
impl From<SessionKeysWrapper> for SessionKeys {
fn from(keys_wrapper: SessionKeysWrapper) -> SessionKeys {
keys_wrapper.0
}
}
impl scale_info::TypeInfo for SessionKeysWrapper {
type Identity = [u8; 128];
fn type_info() -> scale_info::Type {
Self::Identity::type_info()
}
}
}
}
}
impl Default for IdtyRight {
fn default() -> Self {
Self::Ud
}
#[cfg_attr(feature = "std", derive(Deserialize, Serialize))]
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo)]
pub struct SmithsMembershipMetaData<SessionKeysWrapper> {
pub owner_key: AccountId,
pub p2p_endpoint: sp_runtime::RuntimeString,
pub session_keys: SessionKeysWrapper,
}
impl pallet_identity::traits::IdtyRight for IdtyRight {
fn allow_owner_key(self) -> bool {
match self {
Self::CreateIdty | Self::LightCert | IdtyRight::StrongCert | Self::Ud => true,
//IdtyRight::StrongCert => false,
//_ => false,
}
}
fn create_idty_right() -> Self {
Self::CreateIdty
impl<SessionKeysWrapper> sp_membership::traits::Validate<AccountId>
for SmithsMembershipMetaData<SessionKeysWrapper>
{
fn validate(&self, who: &AccountId) -> bool {
&self.owner_key == who
}
}
......
......@@ -17,7 +17,7 @@
pub use frame_support::weights::{
Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
};
use sp_arithmetic::traits::{BaseArithmetic, Unsigned};
use sp_arithmetic::traits::{BaseArithmetic, Unsigned, Zero};
pub struct WeightToFeeImpl<T>(sp_std::marker::PhantomData<T>);
......@@ -35,4 +35,8 @@ where
degree: 1,
})
}
// Force disable fees
fn calc(_weight: &Weight) -> Self::Balance {
Zero::zero()
}
}
......@@ -14,145 +14,172 @@
// 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/>.
use crate::entities::IdtyRight;
use crate::BlockNumber;
use frame_support::instances::Instance1;
use frame_support::pallet_prelude::Get;
use frame_support::weights::Weight;
use pallet_identity::traits::IdtyEvent;
use super::entities::*;
use super::{AccountId, IdtyIndex};
use frame_support::dispatch::UnfilteredDispatchable;
use frame_support::instances::{Instance1, Instance2};
use frame_support::pallet_prelude::Weight;
use frame_support::Parameter;
use sp_runtime::traits::IsMember;
pub struct OnIdtyChangeHandler<Runtime>(core::marker::PhantomData<Runtime>);
impl<
IdtyIndex,
Runtime: pallet_identity::Config<IdtyIndex = IdtyIndex>
+ pallet_certification::Config<Instance1, IdtyIndex = IdtyIndex>,
> pallet_identity::traits::OnIdtyChange<Runtime> for OnIdtyChangeHandler<Runtime>
pub struct OnNewSessionHandler<Runtime>(core::marker::PhantomData<Runtime>);
impl<Runtime> pallet_authority_members::traits::OnNewSession for OnNewSessionHandler<Runtime>
where
Runtime: pallet_provide_randomness::Config,
{
fn on_idty_change(idty_index: IdtyIndex, idty_event: IdtyEvent<Runtime>) -> Weight {
let total_weight = 0;
match idty_event {
IdtyEvent::Created { creator } => {
// totad_weight += StrongCert::WeightInfo::add_cert();
let _ = <pallet_certification::Pallet<Runtime, Instance1>>::add_cert(
frame_system::Origin::<Runtime>::Root.into(),
creator,
idty_index,
);
}
IdtyEvent::Confirmed => {}
IdtyEvent::Validated => {}
IdtyEvent::Expired => {}
IdtyEvent::Removed => {}
};
total_weight
fn on_new_session(_index: sp_staking::SessionIndex) -> Weight {
pallet_provide_randomness::Pallet::<Runtime>::on_new_epoch();
0
}
}
pub struct OnRightKeyChangeHandler<Runtime>(core::marker::PhantomData<Runtime>);
pub struct OnMembershipEventHandler<Inner, Runtime>(core::marker::PhantomData<(Inner, Runtime)>);
type MembershipMetaData = pallet_duniter_wot::MembershipMetaData<AccountId>;
impl<
IdtyIndex,
Runtime: pallet_identity::Config<IdtyIndex = IdtyIndex, IdtyRight = IdtyRight>
Inner: sp_membership::traits::OnEvent<IdtyIndex, MembershipMetaData>,
Runtime: frame_system::Config<AccountId = AccountId>
+ pallet_identity::Config<IdtyIndex = IdtyIndex>
+ pallet_membership::Config<Instance1, MetaData = MembershipMetaData>
+ pallet_ud_accounts_storage::Config,
> pallet_identity::traits::OnRightKeyChange<Runtime> for OnRightKeyChangeHandler<Runtime>
> sp_membership::traits::OnEvent<IdtyIndex, MembershipMetaData>
for OnMembershipEventHandler<Inner, Runtime>
{
fn on_right_key_change(
_idty_index: IdtyIndex,
right: Runtime::IdtyRight,
old_key_opt: Option<Runtime::AccountId>,
new_key_opt: Option<Runtime::AccountId>,
) {
match right {
IdtyRight::Ud => <pallet_ud_accounts_storage::Pallet<Runtime>>::replace_account(
old_key_opt,
new_key_opt,
),
IdtyRight::CreateIdty => 0,
IdtyRight::LightCert => 0,
IdtyRight::StrongCert => 0,
};
fn on_event(membership_event: &sp_membership::Event<IdtyIndex, MembershipMetaData>) -> Weight {
(match membership_event {
sp_membership::Event::MembershipAcquired(idty_index, owner_key) => {
pallet_ud_accounts_storage::Pallet::<Runtime>::replace_account(
None,
Some(owner_key.0.clone()),
*idty_index,
)
}
sp_membership::Event::MembershipRevoked(idty_index) => {
pallet_ud_accounts_storage::Pallet::<Runtime>::remove_account(*idty_index)
}
_ => 0,
}) + Inner::on_event(membership_event)
}
}
pub struct OnNewStrongCertHandler<
FirstIssuableOn,
Runtime,
SetNextIssuableOnImpl,
const MIN_STRONG_CERT_FOR_UD: u32,
const MIN_STRONG_CERT_FOR_STRONG_CERT: u32,
>(core::marker::PhantomData<(FirstIssuableOn, Runtime, SetNextIssuableOnImpl)>);
pub struct OnSmithMembershipEventHandler<Inner, Runtime>(
core::marker::PhantomData<(Inner, Runtime)>,
);
impl<
FirstIssuableOn: Get<BlockNumber>,
IdtyIndex: Copy,
Runtime: frame_system::Config<BlockNumber = BlockNumber>
+ pallet_identity::Config<IdtyIndex = IdtyIndex, IdtyRight = IdtyRight>,
SetNextIssuableOnImpl: pallet_certification::traits::SetNextIssuableOn<BlockNumber, IdtyIndex>,
const MIN_STRONG_CERT_FOR_UD: u32,
const MIN_STRONG_CERT_FOR_STRONG_CERT: u32,
> pallet_certification::traits::OnNewcert<IdtyIndex>
for OnNewStrongCertHandler<
FirstIssuableOn,
Runtime,
SetNextIssuableOnImpl,
MIN_STRONG_CERT_FOR_UD,
MIN_STRONG_CERT_FOR_STRONG_CERT,
>
IdtyIndex: Copy + Parameter,
SessionKeysWrapper: Clone,
Inner: sp_membership::traits::OnEvent<IdtyIndex, SmithsMembershipMetaData<SessionKeysWrapper>>,
Runtime: frame_system::Config<AccountId = AccountId>
+ pallet_identity::Config<IdtyIndex = IdtyIndex>
+ pallet_authority_members::Config<KeysWrapper = SessionKeysWrapper, MemberId = IdtyIndex>
+ pallet_membership::Config<
Instance2,
MetaData = SmithsMembershipMetaData<SessionKeysWrapper>,
>,
> sp_membership::traits::OnEvent<IdtyIndex, SmithsMembershipMetaData<SessionKeysWrapper>>
for OnSmithMembershipEventHandler<Inner, Runtime>
{
fn on_new_cert(
_issuer: IdtyIndex,
_issuer_issued_count: u8,
receiver: IdtyIndex,
receiver_received_count: u32,
) -> frame_support::dispatch::Weight {
let total_weight = 0;
if receiver_received_count == MIN_STRONG_CERT_FOR_UD {
// total_weight += Identity::WeightInfo::add_right();
let _ = <pallet_identity::Pallet<Runtime>>::validate_identity(
frame_system::Origin::<Runtime>::Root.into(),
receiver,
sp_std::vec![IdtyRight::Ud],
);
} else if receiver_received_count == MIN_STRONG_CERT_FOR_STRONG_CERT {
// total_weight += Identity::WeightInfo::add_right();
let _ = <pallet_identity::Pallet<Runtime>>::add_right(
frame_system::Origin::<Runtime>::Root.into(),
receiver,
IdtyRight::StrongCert,
);
let _ = SetNextIssuableOnImpl::set_next_issuable_on(
receiver,
frame_system::Pallet::<Runtime>::block_number() + FirstIssuableOn::get(),
);
fn on_event(
membership_event: &sp_membership::Event<
IdtyIndex,
SmithsMembershipMetaData<SessionKeysWrapper>,
>,
) -> Weight {
(match membership_event {
sp_membership::Event::MembershipAcquired(
_idty_index,
SmithsMembershipMetaData {
owner_key,
session_keys,
..
},
) => {
let call = pallet_authority_members::Call::<Runtime>::set_session_keys {
keys: session_keys.clone(),
};
if let Err(e) = call.dispatch_bypass_filter(
frame_system::Origin::<Runtime>::Signed(owner_key.clone()).into(),
) {
sp_std::if_std! {
println!("fail to set session keys: {:?}", e)
}
}
0
}
sp_membership::Event::MembershipRevoked(idty_index) => {
let call = pallet_authority_members::Call::<Runtime>::remove_member {
member_id: *idty_index,
};
if let Err(e) =
call.dispatch_bypass_filter(frame_system::Origin::<Runtime>::Root.into())
{
sp_std::if_std! {
println!("faid to remove member: {:?}", e)
}
}
0
}
_ => 0,
}) + Inner::on_event(membership_event)
}
}
pub struct OnRemovedAuthorityMemberHandler<Runtime>(core::marker::PhantomData<Runtime>);
impl<Runtime> pallet_authority_members::traits::OnRemovedMember<IdtyIndex>
for OnRemovedAuthorityMemberHandler<Runtime>
where
Runtime: frame_system::Config + pallet_membership::Config<Instance2, IdtyId = IdtyIndex>,
{
fn on_removed_member(idty_index: IdtyIndex) -> Weight {
if let Err(e) = pallet_membership::Pallet::<Runtime, Instance2>::revoke_membership(
frame_system::RawOrigin::Root.into(),
Some(idty_index),
) {
sp_std::if_std! {
println!("fail to revoke membership: {:?}", e)
}
}
total_weight
0
}
}
pub struct OnRemovedStrongCertHandler<Runtime, const MIN_STRONG_CERT_FOR_UD: u32>(
core::marker::PhantomData<Runtime>,
);
impl<
IdtyIndex,
Runtime: pallet_identity::Config<IdtyIndex = IdtyIndex, IdtyRight = IdtyRight>,
const MIN_STRONG_CERT_FOR_UD: u32,
> pallet_certification::traits::OnRemovedCert<IdtyIndex>
for OnRemovedStrongCertHandler<Runtime, MIN_STRONG_CERT_FOR_UD>
pub struct RemoveIdentityConsumersImpl<Runtime>(core::marker::PhantomData<Runtime>);
impl<Runtime> pallet_identity::traits::RemoveIdentityConsumers<IdtyIndex>
for RemoveIdentityConsumersImpl<Runtime>
where
Runtime: pallet_identity::Config<IdtyIndex = IdtyIndex>
+ pallet_authority_members::Config<MemberId = IdtyIndex>
+ pallet_membership::Config<Instance1, IdtyId = IdtyIndex>
+ pallet_membership::Config<Instance2, IdtyId = IdtyIndex>,
{
fn on_removed_cert(
_issuer: IdtyIndex,
_issuer_issued_count: u8,
receiver: IdtyIndex,
receiver_received_count: u32,
_expiration: bool,
) -> frame_support::dispatch::Weight {
let total_weight = 0;
if receiver_received_count < MIN_STRONG_CERT_FOR_UD {
// total_weight += Identity::WeightInfo::del_right();
let _ = <pallet_identity::Pallet<Runtime>>::del_right(
frame_system::Origin::<Runtime>::Root.into(),
receiver,
IdtyRight::Ud,
fn remove_idty_consumers(idty_index: IdtyIndex) -> Weight {
// Remove smith member
if pallet_membership::Pallet::<Runtime, Instance2>::is_member(&idty_index) {
if let Err(e) = pallet_membership::Pallet::<Runtime, Instance2>::revoke_membership(
frame_system::RawOrigin::Root.into(),
Some(idty_index),
) {
log::error!(
target: "runtime::common",
"Logic error: fail to revoke smith membership in remove_idty_consumers(): {:?}",
e
);
}
}
// Remove "classic" member
if let Err(e) = pallet_membership::Pallet::<Runtime, Instance1>::revoke_membership(
frame_system::RawOrigin::Root.into(),
Some(idty_index),
) {
log::error!(
target: "runtime::common",
"Logic error: fail to revoke membership in remove_idty_consumers(): {:?}",
e
);
}
total_weight
0
}
}
......@@ -17,14 +17,16 @@
#![cfg_attr(not(feature = "std"), no_std)]
mod apis;
pub mod authorizations;
pub mod constants;
pub mod entities;
pub mod fees;
pub mod handlers;
mod pallets_config;
pub mod providers;
pub mod weights;
pub use pallet_duniter_account::GenesisAccountData;
pub use pallet_identity::{GenesisIdty, IdtyName, IdtyStatus, IdtyValue};
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
/// Some way of identifying an account on the chain. We intentionally make it equivalent
......@@ -61,13 +63,6 @@ pub type Index = u32;
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = sp_runtime::MultiSignature;
pub struct IdtyNameValidatorImpl;
impl pallet_identity::traits::IdtyNameValidator for IdtyNameValidatorImpl {
fn validate(idty_name: &pallet_identity::IdtyName) -> bool {
idty_name.0.len() >= 3 && idty_name.0.len() <= 64
}
}
pub struct FullIdentificationOfImpl;
impl sp_runtime::traits::Convert<AccountId, Option<entities::ValidatorFullIdentification>>
for FullIdentificationOfImpl
......@@ -77,35 +72,18 @@ impl sp_runtime::traits::Convert<AccountId, Option<entities::ValidatorFullIdenti
}
}
/// The implementation of SessionManager traits
/// For the moment, the implementation does nothing, which means that the set of authorities
/// remains eternally the same as the one defined in the chain spec.
// TODO: When we will have implemented the smith sub-wot, we will have to fill this implementation
// with a real logic based on the smith sub-wot.
pub struct SessionManagerImpl;
use crate::entities::ValidatorFullIdentification;
use sp_staking::SessionIndex;
impl pallet_session::SessionManager<AccountId> for SessionManagerImpl {
fn new_session(_new_index: SessionIndex) -> Option<sp_std::vec::Vec<AccountId>> {
None
pub struct GetCurrentEpochIndex<Runtime>(core::marker::PhantomData<Runtime>);
impl<Runtime: pallet_babe::Config> frame_support::pallet_prelude::Get<u64>
for GetCurrentEpochIndex<Runtime>
{
fn get() -> u64 {
pallet_babe::Pallet::<Runtime>::epoch_index()
}
fn start_session(_start_index: SessionIndex) {}
fn end_session(_end_index: SessionIndex) {}
}
impl pallet_session::historical::SessionManager<AccountId, ValidatorFullIdentification>
for SessionManagerImpl
{
fn new_session(
_new_index: SessionIndex,
) -> Option<sp_std::vec::Vec<(AccountId, ValidatorFullIdentification)>> {
None
}
fn new_session_genesis(
new_index: SessionIndex,
) -> Option<sp_std::vec::Vec<(AccountId, ValidatorFullIdentification)>> {
<Self as pallet_session::historical::SessionManager<_, _>>::new_session(new_index)
pub struct IdtyNameValidatorImpl;
impl pallet_identity::traits::IdtyNameValidator for IdtyNameValidatorImpl {
fn validate(idty_name: &pallet_identity::IdtyName) -> bool {
idty_name.0.len() >= 3 && idty_name.0.len() <= 64
}
fn start_session(_start_index: SessionIndex) {}
fn end_session(_end_index: SessionIndex) {}
}
......@@ -25,57 +25,57 @@ macro_rules! pallets_config {
pub const Version: RuntimeVersion = VERSION;
}
impl frame_system::Config for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = BaseCallFilter;
/// Block & extrinsics weights: base values and limits.
type BlockWeights = BlockWeights;
/// The maximum length of a block (in bytes).
type BlockLength = BlockLength;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The aggregated dispatch type that is available for extrinsics.
type Call = Call;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = AccountIdLookup<AccountId, ()>;
/// The index type for storing how many extrinsics an account has signed.
type Index = Index;
/// The index type for blocks.
type BlockNumber = BlockNumber;
/// The type for hashing blocks and tries.
type Hash = Hash;
/// The hashing algorithm used.
type Hashing = BlakeTwo256;
/// The header type.
type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// The ubiquitous event type.
type Event = Event;
/// The ubiquitous origin type.
type Origin = Origin;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
type BlockHashCount = BlockHashCount;
/// The weight of database operations that the runtime can invoke.
type DbWeight = RocksDbWeight;
/// Version of the runtime.
type Version = Version;
/// Converts a module to the index of the module in `construct_runtime!`.
///
/// This type is being generated by `construct_runtime!`.
type PalletInfo = PalletInfo;
/// What to do if a new account is created.
type OnNewAccount = ();
/// What to do if an account is fully reaped from the system.
type OnKilledAccount = ();
/// The data to be stored in an account.
type AccountData = pallet_balances::AccountData<Balance>;
/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = ();
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
type SS58Prefix = SS58Prefix;
/// The set code logic, just the default since we're not a parachain.
type OnSetCode = ();
impl frame_system::Config for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = BaseCallFilter;
/// Block & extrinsics weights: base values and limits.
type BlockWeights = BlockWeights;
/// The maximum length of a block (in bytes).
type BlockLength = BlockLength;
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The aggregated dispatch type that is available for extrinsics.
type Call = Call;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = AccountIdLookup<AccountId, ()>;
/// The index type for storing how many extrinsics an account has signed.
type Index = Index;
/// The index type for blocks.
type BlockNumber = BlockNumber;
/// The type for hashing blocks and tries.
type Hash = Hash;
/// The hashing algorithm used.
type Hashing = BlakeTwo256;
/// The header type.
type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// The ubiquitous event type.
type Event = Event;
/// The ubiquitous origin type.
type Origin = Origin;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
type BlockHashCount = BlockHashCount;
/// The weight of database operations that the runtime can invoke.
type DbWeight = DbWeight;
/// Version of the runtime.
type Version = Version;
/// Converts a module to the index of the module in `construct_runtime!`.
///
/// This type is being generated by `construct_runtime!`.
type PalletInfo = PalletInfo;
/// What to do if a new account is created.
type OnNewAccount = ();
/// What to do if an account is fully reaped from the system.
type OnKilledAccount = ();
/// The data to be stored in an account.
type AccountData = pallet_duniter_account::AccountData<Balance>;
/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = ();
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
type SS58Prefix = SS58Prefix;
/// The set code logic, just the default since we're not a parachain.
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
}
// SCHEDULER //
......@@ -109,54 +109,217 @@ macro_rules! pallets_config {
type NoPreimagePostponement = ();
}
// MONEY //
// ACCOUNT //
impl pallet_duniter_account::Config for Runtime {
type AccountIdToSalt = sp_runtime::traits::ConvertInto;
type Event = Event;
type MaxNewAccountsPerBlock = frame_support::pallet_prelude::ConstU32<1>;
type NewAccountPrice = frame_support::traits::ConstU64<300>;
}
// BLOCK CREATION //
impl pallet_babe::Config for Runtime {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;
// session module is the trigger
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = Session;
type KeyOwnerProofSystem = Historical;
type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::Proof;
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
pallet_babe::AuthorityId,
)>>::IdentificationTuple;
type HandleEquivocation =
pallet_babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences, ReportLongevity>;
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
}
impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = Babe;
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}
// MONEY MANAGEMENT //
impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks;
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
/// The type for recording an account's balance.
type Balance = Balance;
/// The ubiquitous event type.
type Event = Event;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
}
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type MaxLocks = MaxLocks;
type MaxReserves = frame_support::pallet_prelude::ConstU32<5>;
type ReserveIdentifier = [u8; 8];
/// The type for recording an account's balance.
type Balance = Balance;
/// The ubiquitous event type.
type Event = Event;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = Account;
type WeightInfo = common_runtime::weights::pallet_balances::WeightInfo<Runtime>;
}
pub struct HandleFees;
type NegativeImbalance = <Balances as frame_support::traits::Currency<AccountId>>::NegativeImbalance;
impl frame_support::traits::OnUnbalanced<NegativeImbalance> for HandleFees {
fn on_nonzero_unbalanced(amount: NegativeImbalance) {
use frame_support::traits::Currency as _;
if let Some(author) = Authorship::author() {
Balances::resolve_creating(&author, amount);
}
}
}
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, HandleFees>;
type TransactionByteFee = TransactionByteFee;
type OperationalFeeMultiplier = frame_support::traits::ConstU8<5>;
type WeightToFee = common_runtime::fees::WeightToFeeImpl<Balance>;
type FeeMultiplierUpdate = ();
}
type WeightToFee = common_runtime::fees::WeightToFeeImpl<Balance>;
type FeeMultiplierUpdate = ();
}
// CONSENSUS //
impl pallet_grandpa::Config for Runtime {
type Event = Event;
type Call = Call;
impl pallet_authority_discovery::Config for Runtime {
type MaxAuthorities = MaxAuthorities;
}
impl pallet_authority_members::Config for Runtime {
type Event = Event;
type KeysWrapper = opaque::SessionKeysWrapper;
type IsMember = SmithsMembership;
type OnNewSession = OnNewSessionHandler<Runtime>;
type OnRemovedMember = OnRemovedAuthorityMemberHandler<Runtime>;
type MemberId = IdtyIndex;
type MemberIdOf = Identity;
type MaxAuthorities = MaxAuthorities;
type MaxKeysLife = frame_support::pallet_prelude::ConstU32<1_000>;
type MaxOfflineSessions = frame_support::pallet_prelude::ConstU32<100>;
type RemoveMemberOrigin = EnsureRoot<Self::AccountId>;
}
impl pallet_authorship::Config for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
type UncleGenerations = UncleGenerations;
type FilterUncle = ();
type EventHandler = ImOnline;
}
impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId;
type Event = Event;
type ValidatorSet = Historical;
type NextSessionRotation = Babe;
type ReportUnresponsiveness = Offences;
type UnsignedPriority = ImOnlineUnsignedPriority;
type WeightInfo = ();
type MaxKeys = MaxKeys;
type MaxPeerInHeartbeats = MaxPeerInHeartbeats;
type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize;
}
impl pallet_offences::Config for Runtime {
type Event = Event;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = ();
}
impl pallet_session::Config for Runtime {
type Event = Event;
type ValidatorId = AccountId;
type ValidatorIdOf = sp_runtime::traits::ConvertInto;
type ShouldEndSession = Babe;
type NextSessionRotation = Babe;
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, AuthorityMembers>;
type SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = opaque::SessionKeys;
type WeightInfo = ();
}
impl pallet_session::historical::Config for Runtime {
type FullIdentification = ValidatorFullIdentification;
type FullIdentificationOf = FullIdentificationOfImpl;
}
impl pallet_grandpa::Config for Runtime {
type Event = Event;
type Call = Call;
type KeyOwnerProofSystem = ();
type KeyOwnerProofSystem = ();
type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
GrandpaId,
)>>::IdentificationTuple;
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
GrandpaId,
)>>::IdentificationTuple;
type HandleEquivocation = ();
type HandleEquivocation = ();
type WeightInfo = ();
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
}
}
// UTILITIES //
impl pallet_atomic_swap::Config for Runtime {
type Event = Event;
type SwapAction = pallet_atomic_swap::BalanceSwapAction<AccountId, Balances>;
type ProofLimit = frame_support::traits::ConstU32<255>;
}
impl pallet_provide_randomness::Config for Runtime {
type Currency = Balances;
type Event = Event;
type GetCurrentEpochIndex = GetCurrentEpochIndex<Self>;
type MaxRequests = frame_support::traits::ConstU32<1_000>;
type RequestPrice = frame_support::traits::ConstU64<200>;
type OnFilledRandomness = Account;
type OnUnbalanced = ();
type CurrentBlockRandomness = pallet_babe::CurrentBlockRandomness<Self>;
type RandomnessFromOneEpochAgo = pallet_babe::RandomnessFromOneEpochAgo<Self>;
}
// UTILITY //
parameter_types! {
// One storage item; key size 32, value size 8; .
pub const ProxyDepositBase: Balance = deposit(1, 8);
// Additional storage item size of 33 bytes.
pub const ProxyDepositFactor: Balance = deposit(0, 33);
pub const AnnouncementDepositBase: Balance = deposit(1, 8);
pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
}
impl pallet_proxy::Config for Runtime {
type Event = Event;
type Call = Call;
type Currency = Balances;
type ProxyType = ProxyType;
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = frame_support::traits::ConstU32<32>;
type MaxPending = frame_support::traits::ConstU32<32>;
type CallHasher = BlakeTwo256;
type AnnouncementDepositBase = AnnouncementDepositBase;
type AnnouncementDepositFactor = AnnouncementDepositFactor;
type WeightInfo = pallet_proxy::weights::SubstrateWeight<Self>;
}
impl pallet_multisig::Config for Runtime {
type Event = Event;
type Call = Call;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories;
type WeightInfo = pallet_multisig::weights::SubstrateWeight<Self>;
}
impl pallet_utility::Config for Runtime {
type Event = Event;
......@@ -165,84 +328,150 @@ macro_rules! pallets_config {
type WeightInfo = pallet_utility::weights::SubstrateWeight<Self>;
}
// MONEY CREATION //
// UNIVERSAL DIVIDEND //
impl pallet_universal_dividend::Config for Runtime {
type Currency = pallet_balances::Pallet<Runtime>;
type Event = Event;
type MembersCount = common_runtime::providers::UdAccountsProvider<Runtime>;
type MembersIds = common_runtime::providers::UdAccountsProvider<Runtime>;
type SquareMoneyGrowthRate = SquareMoneyGrowthRate;
type UdCreationPeriod = UdCreationPeriod;
impl pallet_universal_dividend::Config for Runtime {
type Currency = pallet_balances::Pallet<Runtime>;
type Event = Event;
type MembersCount = common_runtime::providers::UdAccountsProvider<Runtime>;
type MembersIds = common_runtime::providers::UdAccountsProvider<Runtime>;
type SquareMoneyGrowthRate = SquareMoneyGrowthRate;
type UdCreationPeriod = UdCreationPeriod;
type UdFirstReeval = UdFirstReeval;
type UdReevalPeriod = UdReevalPeriod;
type UdReevalPeriodInBlocks = UdReevalPeriodInBlocks;
type UdReevalPeriod = UdReevalPeriod;
type UdReevalPeriodInBlocks = UdReevalPeriodInBlocks;
type UnitsPerUd = frame_support::traits::ConstU64<1_000>;
}
}
impl pallet_ud_accounts_storage::Config for Runtime {}
impl pallet_ud_accounts_storage::Config for Runtime {}
// WEB OF TRUST //
use frame_support::instances::Instance1;
impl pallet_duniter_wot::Config<Instance1> for Runtime {
type FirstIssuableOn = WotFirstCertIssuableOn;
type IsSubWot = frame_support::traits::ConstBool<false>;
type MinCertForMembership = WotMinCertForMembership;
type MinCertForCreateIdtyRight = WotMinCertForCreateIdtyRight;
}
impl pallet_identity::Config for Runtime {
type ConfirmPeriod = ConfirmPeriod;
type Event = Event;
type AddRightOrigin = EnsureRoot<Self::AccountId>;
type DelRightOrigin = EnsureRoot<Self::AccountId>;
type EnsureIdtyCallAllowed = EnsureIdtyCallAllowedImpl<Runtime, StrongCert>;
type ConfirmPeriod = ConfirmPeriod;
type Event = Event;
type EnsureIdtyCallAllowed = Wot;
type IdtyCreationPeriod = IdtyCreationPeriod;
type IdtyDataProvider = ();
type IdtyData = ();
type IdtyNameValidator = IdtyNameValidatorImpl;
type IdtyIndex = IdtyIndex;
type IdtyValidationOrigin = EnsureRoot<Self::AccountId>;
type IdtyRight = IdtyRight;
type OnIdtyChange = OnIdtyChangeHandler<Runtime>;
type OnRightKeyChange = OnRightKeyChangeHandler<Runtime>;
type MaxNoRightPeriod = MaxNoRightPeriod;
type Membership = Membership;
}
type IdtyIndex = IdtyIndex;
type IdtyNameValidator = IdtyNameValidatorImpl;
type IdtyValidationOrigin = EnsureRoot<Self::AccountId>;
type IsMember = Membership;
type OnIdtyChange = Wot;
type MaxDisabledPeriod = MaxDisabledPeriod;
type RemoveIdentityConsumers = RemoveIdentityConsumersImpl<Self>;
}
impl pallet_membership::Config<frame_support::instances::Instance1> for Runtime {
type IsIdtyAllowedToClaimMembership = ();
type IsIdtyAllowedToRenewMembership = ();
type IsIdtyAllowedToRequestMembership = ();
type IsOriginAllowedToUseIdty = Identity;
type IsIdtyAllowedToRenewMembership = Wot;
type IsIdtyAllowedToRequestMembership = Wot;
type Event = Event;
type ExternalizeMembershipStorage = frame_support::traits::ConstBool<false>;
type IdtyId = IdtyIndex;
type OnEvent = Identity;
type MembershipExternalStorage = ();
type IdtyIdOf = Identity;
type MembershipPeriod = MembershipPeriod;
type MetaData = pallet_duniter_wot::MembershipMetaData<AccountId>;
type OnEvent = OnMembershipEventHandler<Wot, Runtime>;
type PendingMembershipPeriod = PendingMembershipPeriod;
type RenewablePeriod = RenewablePeriod;
type RevocationPeriod = frame_support::traits::ConstU32<0>;
}
impl pallet_certification::Config<frame_support::instances::Instance1> for Runtime {
type AddCertOrigin = AddStrongCertOrigin<Runtime>;
type CertPeriod = CertPeriod;
type DelCertOrigin = DelStrongCertOrigin<Runtime>;
type Event = Event;
type IdtyIndex = IdtyIndex;
type MaxByIssuer = MaxByIssuer;
type OnNewcert =
OnNewStrongCertHandler<FirstIssuableOn, Runtime, StrongCert, MIN_STRONG_CERT_FOR_UD, MIN_STRONG_CERT_FOR_STRONG_CERT>;
type OnRemovedCert = OnRemovedStrongCertHandler<Runtime, MIN_STRONG_CERT_FOR_UD>;
type CertRenewablePeriod = StrongCertRenewablePeriod;
type ValidityPeriod = ValidityPeriod;
}
impl pallet_certification::Config<Instance1> for Runtime {
type CertPeriod = CertPeriod;
type Event = Event;
type IdtyIndex = IdtyIndex;
type IdtyIndexOf = Identity;
type IsCertAllowed = Wot;
type MaxByIssuer = MaxByIssuer;
type MinReceivedCertToBeAbleToIssueCert = MinReceivedCertToBeAbleToIssueCert;
type OnNewcert = Wot;
type OnRemovedCert = Wot;
type CertRenewablePeriod = CertRenewablePeriod;
type ValidityPeriod = ValidityPeriod;
}
// MUNTISIG //
// SMITHS SUB-WOT //
impl pallet_multisig::Config for Runtime {
use frame_support::instances::Instance2;
impl pallet_duniter_wot::Config<Instance2> for Runtime {
type FirstIssuableOn = SmithsWotFirstCertIssuableOn;
type IsSubWot = frame_support::traits::ConstBool<true>;
type MinCertForMembership = SmithsWotMinCertForMembership;
type MinCertForCreateIdtyRight = frame_support::traits::ConstU32<0>;
}
impl pallet_membership::Config<Instance2> for Runtime {
type IsIdtyAllowedToRenewMembership = ();
type IsIdtyAllowedToRequestMembership = ();
type Event = Event;
type Call = Call;
type Currency = Balances;
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories;
type WeightInfo = pallet_multisig::weights::SubstrateWeight<Self>;
type IdtyId = IdtyIndex;
type IdtyIdOf = Identity;
type MembershipPeriod = SmithMembershipPeriod;
type MetaData = SmithsMembershipMetaData<opaque::SessionKeysWrapper>;
type OnEvent = OnSmithMembershipEventHandler<SmithsSubWot, Runtime>;
type PendingMembershipPeriod = SmithPendingMembershipPeriod;
type RenewablePeriod = SmithRenewablePeriod;
type RevocationPeriod = frame_support::traits::ConstU32<0>;
}
impl pallet_certification::Config<Instance2> for Runtime {
type CertPeriod = SmithCertPeriod;
type Event = Event;
type IdtyIndex = IdtyIndex;
type IdtyIndexOf = Identity;
type IsCertAllowed = SmithsSubWot;
type MaxByIssuer = SmithMaxByIssuer;
type MinReceivedCertToBeAbleToIssueCert = SmithMinReceivedCertToBeAbleToIssueCert;
type OnNewcert = SmithsSubWot;
type OnRemovedCert = SmithsSubWot;
type CertRenewablePeriod = SmithCertRenewablePeriod;
type ValidityPeriod = SmithValidityPeriod;
}
pub struct SmithMembersDefaultVote;
impl pallet_collective::DefaultVote for SmithMembersDefaultVote {
fn default_vote(
_prime_vote: Option<bool>,
_yes_votes: u32,
_no_votes: u32,
_len: u32,
) -> bool {
false
}
}
pub struct SmithMembersStorage;
impl sp_runtime::traits::IsMember<AccountId> for SmithMembersStorage {
fn is_member(account_id: &AccountId) -> bool {
use sp_runtime::traits::Convert as _;
if let Some(idty_index) = Identity::convert(account_id.clone()) {
pallet_membership::Pallet::<Runtime, Instance2>::is_member(&idty_index)
} else {
false
}
}
}
impl pallet_collective::MembersStorage<AccountId> for SmithMembersStorage {
fn members_count() -> u32 {
pallet_membership::Membership::<Runtime, Instance2>::count()
}
}
impl pallet_collective::Config<Instance2> for Runtime {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
type MotionDuration = frame_support::pallet_prelude::ConstU32<10_000>;
type MaxProposals = frame_support::pallet_prelude::ConstU32<10>;
type MaxMembers = frame_support::pallet_prelude::ConstU32<1_000>;
type MembersStorage = SmithMembersStorage;
type DefaultVote = SmithMembersDefaultVote;
type WeightInfo = ();
}
};
}
......@@ -14,7 +14,4 @@
// 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/>.
#![cfg_attr(not(feature = "std"), no_std)]
pub mod apis;
pub mod pallets_config;
pub mod pallet_balances;
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
//
// Substrate-Libre-Currency 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,
// 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/>.
//! Manually written file for temporary weights (polkadot x 10)
// TODO regenerate thi file with benchmarks:
//
// Executed Command:
// target/release/duniter
// benchmark
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_balances
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/gdev/src/weights/
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;
/// Weight functions for `pallet_balances`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
fn transfer() -> Weight {
(688_850_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn transfer_keep_alive() -> Weight {
(514_410_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn set_balance_creating() -> Weight {
(277_360_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn set_balance_killing() -> Weight {
(329_990_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn force_transfer() -> Weight {
(674_510_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn transfer_all() -> Weight {
(633_590_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: System Account (r:1 w:1)
fn force_unreserve() -> Weight {
(277_660_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
}
[build-dependencies.substrate-wasm-builder]
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[package]
authors = ['Axiom-Team Developers <https://axiom-team.fr>']
......@@ -32,15 +32,22 @@ std = [
'frame-support/std',
'frame-system-rpc-runtime-api/std',
'frame-system/std',
'pallet-atomic-swap/std',
'pallet-authority-discovery/std',
'pallet-authority-members/std',
'pallet-babe/std',
'pallet-balances/std',
'pallet-certification/std',
'pallet-collective/std',
'pallet-duniter-account/std',
'pallet-duniter-wot/std',
'pallet-grandpa/std',
'pallet-identity/std',
'pallet-im-online/std',
'pallet-membership/std',
'pallet-multisig/std',
'pallet-provide-randomness/std',
'pallet-proxy/std',
'pallet-session/std',
'pallet-sudo/std',
'pallet-universal-dividend/std',
......@@ -48,7 +55,6 @@ std = [
'pallet-transaction-payment-rpc-runtime-api/std',
'pallet-transaction-payment/std',
'common-runtime/std',
'common-runtime-except-gdev/std',
'serde',
'sp-api/std',
'sp-arithmetic/std',
......@@ -58,6 +64,7 @@ std = [
'sp-core/std',
'sp-inherents/std',
'sp-offchain/std',
'sp-membership/std',
'sp-runtime/std',
'sp-session/std',
'sp-std/std',
......@@ -66,13 +73,18 @@ std = [
]
[dependencies]
# local
common-runtime = { path = "../common", default-features = false }
pallet-authority-members = { path = '../../pallets/authority-members', default-features = false }
pallet-certification = { path = '../../pallets/certification', default-features = false }
pallet-duniter-account = { path = '../../pallets/duniter-account', default-features = false }
pallet-duniter-wot = { path = '../../pallets/duniter-wot', default-features = false }
pallet-identity = { path = '../../pallets/identity', default-features = false }
pallet-membership = { path = '../../pallets/membership', default-features = false }
pallet-provide-randomness = { path = '../../pallets/provide-randomness', default-features = false }
pallet-ud-accounts-storage = { path = '../../pallets/ud-accounts-storage', default-features = false }
pallet-universal-dividend = { path = '../../pallets/universal-dividend', default-features = false }
common-runtime = { path = "../common", default-features = false }
common-runtime-except-gdev = { path = "../common-except-gdev", default-features = false }
sp-membership = { path = '../../primitives/membership', default-features = false }
# substrate
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
......@@ -87,113 +99,128 @@ version = '2.3.1'
default-features = false
git = 'https://github.com/librelois/substrate.git'
optional = true
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.frame-executive]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.frame-support]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.frame-system]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.frame-system-benchmarking]
default-features = false
git = 'https://github.com/librelois/substrate.git'
optional = true
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.frame-system-rpc-runtime-api]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.hex-literal]
optional = true
version = '0.3.1'
[dependencies.pallet-atomic-swap]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-authority-discovery]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-authorship]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-babe]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-balances]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-collective]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-grandpa]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-im-online]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-offences]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-proxy]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-multisig]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-scheduler]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-session]
default-features = false
features = ["historical"]
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-sudo]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-timestamp]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-transaction-payment]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-transaction-payment-rpc-runtime-api]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-utility]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.serde]
......@@ -207,64 +234,64 @@ version = "1.6.1"
[dependencies.sp-api]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-arithmetic]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-authority-discovery]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-block-builder]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-consensus-babe]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-core]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-inherents]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-offchain]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-runtime]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-session]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-std]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-transaction-pool]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-version]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
......@@ -26,10 +26,8 @@ pub mod parameters;
pub use self::parameters::*;
pub use common_runtime::{
constants::*,
entities::{IdtyRight, ValidatorFullIdentification},
AccountId, Address, Balance, BlockNumber, FullIdentificationOfImpl, Hash, Header, IdtyIndex,
IdtyNameValidatorImpl, Index, Signature,
constants::*, entities::*, handlers::*, AccountId, Address, Balance, BlockNumber,
FullIdentificationOfImpl, GetCurrentEpochIndex, Hash, Header, IdtyIndex, Index, Signature,
};
pub use pallet_balances::Call as BalancesCall;
pub use pallet_identity::{IdtyStatus, IdtyValue};
......@@ -42,14 +40,7 @@ pub use pallet_universal_dividend;
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{KeyTypeId, Perbill, Permill};
use common_runtime::{
authorizations::{AddStrongCertOrigin, DelStrongCertOrigin, EnsureIdtyCallAllowedImpl},
handlers::{
OnIdtyChangeHandler, OnNewStrongCertHandler, OnRemovedStrongCertHandler,
OnRightKeyChangeHandler,
},
SessionManagerImpl,
};
use common_runtime::IdtyNameValidatorImpl;
use frame_system::EnsureRoot;
use pallet_grandpa::fg_primitives;
use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
......@@ -77,17 +68,7 @@ pub use frame_support::{
StorageValue,
};
pub mod opaque {
use super::*;
impl_opaque_keys! {
pub struct SessionKeys {
pub grandpa: Grandpa,
pub babe: Babe,
pub im_online: ImOnline,
pub authority_discovery: AuthorityDiscovery,
}
}
}
common_runtime::declare_session_keys! {}
// To learn more about runtime versioning and what each of the following value means:
// https://substrate.dev/docs/en/knowledgebase/runtime/upgrades#runtime-versioning
......@@ -105,7 +86,6 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1,
};
/// The version information used to identify this runtime when compiled natively.
......@@ -143,11 +123,62 @@ pub type Executive = frame_executive::Executive<
pub struct BaseCallFilter;
impl frame_support::traits::Contains<Call> for BaseCallFilter {
fn contains(call: &Call) -> bool {
!matches!(call, Call::Membership(_) | Call::Session(_))
!matches!(
call,
Call::System(
frame_system::Call::remark { .. } | frame_system::Call::remark_with_event { .. }
) | Call::Membership(
pallet_membership::Call::claim_membership { .. }
| pallet_membership::Call::revoke_membership { .. }
) | Call::Session(_)
| Call::SmithsMembership(pallet_membership::Call::claim_membership { .. })
)
}
}
common_runtime_except_gdev::pallets_config! {
/// The type used to represent the kinds of proxying allowed.
#[derive(
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
codec::Encode,
codec::Decode,
frame_support::RuntimeDebug,
codec::MaxEncodedLen,
scale_info::TypeInfo,
)]
#[allow(clippy::unnecessary_cast)]
pub enum ProxyType {
Any = 0,
TransferOnly = 1,
CancelProxy = 2,
}
impl Default for ProxyType {
fn default() -> Self {
Self::Any
}
}
impl frame_support::traits::InstanceFilter<Call> for ProxyType {
fn filter(&self, c: &Call) -> bool {
match self {
ProxyType::Any => true,
ProxyType::TransferOnly => {
matches!(c, Call::Balances(..) | Call::UniversalDividend(..))
}
ProxyType::CancelProxy => {
matches!(
c,
Call::Proxy(pallet_proxy::Call::reject_announcement { .. })
)
}
}
}
}
common_runtime::pallets_config! {
impl pallet_sudo::Config for Runtime {
type Event = Event;
type Call = Call;
......@@ -163,43 +194,52 @@ construct_runtime!(
{
// Basic stuff
System: frame_system::{Pallet, Call, Config, Storage, Event<T>} = 0,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 1,
Account: pallet_duniter_account::{Pallet, Storage, Config<T>, Event<T>} = 1,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 2,
// Babe must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 2,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
// Block creation
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned} = 3,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 4,
// Money management
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 5,
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 6,
TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 32,
// Consensus support.
Authorship: pallet_authorship::{Pallet, Call, Storage} = 10,
Offences: pallet_offences::{Pallet, Storage, Event} = 11,
Historical: session_historical::{Pallet} = 12,
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 13,
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event} = 14,
ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 15,
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 16,
AuthorityMembers: pallet_authority_members::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
Authorship: pallet_authorship::{Pallet, Call, Storage} = 11,
Offences: pallet_offences::{Pallet, Storage, Event} = 12,
Historical: session_historical::{Pallet} = 13,
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 14,
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event} = 15,
ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>} = 16,
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 17,
// Governance stuff.
Sudo: pallet_sudo::{Pallet, Call, Config<T>, Storage, Event<T>} = 20,
// Cunning utilities.
Utility: pallet_utility::{Pallet, Call, Event} = 30,
// Universal dividend.
UdAccountsStorage: pallet_ud_accounts_storage::{Pallet, Config<T>, Storage} = 40,
UniversalDividend: pallet_universal_dividend::{Pallet, Call, Config<T>, Storage, Event<T>} = 41,
// Universal dividend
UdAccountsStorage: pallet_ud_accounts_storage::{Pallet, Config<T>, Storage} = 30,
UniversalDividend: pallet_universal_dividend::{Pallet, Call, Config<T>, Storage, Event<T>} = 31,
// Web Of Trust
Identity: pallet_identity::{Pallet, Call, Config<T>, Storage, Event<T>} = 50,
Membership: pallet_membership::<Instance1>::{Pallet, Call, Config<T>, Storage, Event<T>} = 51,
StrongCert: pallet_certification::<Instance1>::{Pallet, Call, Config<T>, Storage, Event<T>} = 52,
Wot: pallet_duniter_wot::<Instance1>::{Pallet} = 40,
Identity: pallet_identity::{Pallet, Call, Config<T>, Storage, Event<T>} = 41,
Membership: pallet_membership::<Instance1>::{Pallet, Call, Config<T>, Storage, Event<T>} = 42,
Cert: pallet_certification::<Instance1>::{Pallet, Call, Config<T>, Storage, Event<T>} = 43,
// Smiths Sub-Wot
SmithsSubWot: pallet_duniter_wot::<Instance2>::{Pallet} = 50,
SmithsMembership: pallet_membership::<Instance2>::{Pallet, Call, Config<T>, Storage, Event<T>} = 52,
SmithsCert: pallet_certification::<Instance2>::{Pallet, Call, Config<T>, Storage, Event<T>} = 53,
SmithsCollective: pallet_collective::<Instance2>::{Pallet, Call, Config<T>, Storage, Event<T>, Origin<T>} = 54,
// Multisig dispatch.
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 60,
// Utilities
AtomicSwap: pallet_atomic_swap::{Pallet, Call, Storage, Event<T>} = 60,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 61,
ProvideRandomness: pallet_provide_randomness::{Pallet, Call, Storage, Event} = 62,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 63,
Utility: pallet_utility::{Pallet, Call, Event} = 64,
}
);
......@@ -221,4 +261,4 @@ where
// // Specific impls provided to the `runtime_apis!` macro.
// }
// ```
common_runtime_except_gdev::runtime_apis! {}
common_runtime::runtime_apis! {}
......@@ -29,7 +29,6 @@ parameter_types! {
pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
pub const SS58Prefix: u16 = 42;
pub const UncleGenerations: u32 = 0;
}
/*************/
......@@ -41,6 +40,11 @@ parameter_types! {
pub const MaxAuthorities: u32 = 100;
}
// Authorship
parameter_types! {
pub const UncleGenerations: u32 = 0;
}
// Timestamp
parameter_types! {
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
......@@ -68,7 +72,7 @@ parameter_types! {
// Balances
frame_support::parameter_types! {
pub const ExistentialDeposit: Balance = 500;
pub const ExistentialDeposit: Balance = 200;
pub const MaxLocks: u32 = 50;
}
......@@ -92,13 +96,17 @@ parameter_types! {
/* WOT */
/*******/
parameter_types! {
pub const WotFirstCertIssuableOn: BlockNumber = 30 * DAYS;
pub const WotMinCertForMembership: u32 = 5;
pub const WotMinCertForCreateIdtyRight: u32 = 5;
}
// Identity
pub const IDTY_CREATE_PERIOD: BlockNumber = 100;
parameter_types! {
pub const ConfirmPeriod: BlockNumber = 14 * DAYS;
pub const FirstIssuableOn: BlockNumber = 30* DAYS;
pub const IdtyCreationPeriod: BlockNumber = MONTHS;
pub const MaxNoRightPeriod: BlockNumber = YEARS;
pub const MaxDisabledPeriod: BlockNumber = YEARS;
pub const ValidationPeriod: BlockNumber = YEARS;
}
......@@ -110,15 +118,39 @@ parameter_types! {
}
// Certification
pub const MIN_STRONG_CERT_FOR_UD: u32 = 5;
pub const MIN_STRONG_CERT_FOR_STRONG_CERT: u32 = 5;
parameter_types! {
pub const CertPeriod: BlockNumber = 5 * DAYS;
pub const MaxByIssuer: u8 = 100;
pub const StrongCertRenewablePeriod: BlockNumber = 6 * MONTHS;
pub const MaxByIssuer: u32 = 100;
pub const MinReceivedCertToBeAbleToIssueCert: u32 = 5;
pub const CertRenewablePeriod: BlockNumber = 6 * MONTHS;
pub const ValidityPeriod: BlockNumber = 2 * YEARS;
}
/******************/
/* SMITHS SUB-WOT */
/******************/
parameter_types! {
pub const SmithsWotFirstCertIssuableOn: BlockNumber = 30 * DAYS;
pub const SmithsWotMinCertForMembership: u32 = 3;
}
// Membership
parameter_types! {
pub const SmithMembershipPeriod: BlockNumber = 73 * DAYS;
pub const SmithPendingMembershipPeriod: BlockNumber = 12 * DAYS;
pub const SmithRenewablePeriod: BlockNumber = 12 * DAYS;
}
// Certification
parameter_types! {
pub const SmithCertPeriod: BlockNumber = 5 * DAYS;
pub const SmithMaxByIssuer: u32 = 12;
pub const SmithMinReceivedCertToBeAbleToIssueCert: u32 = 5;
pub const SmithCertRenewablePeriod: BlockNumber = 12 * DAYS;
pub const SmithValidityPeriod: BlockNumber = 146 * DAYS;
}
// Multisig
parameter_types! {
pub const DepositBase: Balance = 1000;
......
[build-dependencies.substrate-wasm-builder]
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[package]
authors = ['Axiom-Team Developers <https://axiom-team.fr>']
......@@ -33,15 +33,28 @@ std = [
'frame-support/std',
'frame-system-rpc-runtime-api/std',
'frame-system/std',
'pallet-atomic-swap/std',
'pallet-authority-discovery/std',
'pallet-authority-members/std',
'pallet-babe/std',
'pallet-balances/std',
'pallet-certification/std',
'pallet-collective/std',
'pallet-duniter-test-parameters/std',
'pallet-duniter-account/std',
'pallet-duniter-wot/std',
'pallet-grandpa/std',
'pallet-identity/std',
'pallet-membership/std',
'pallet-grandpa/std',
'pallet-provide-randomness/std',
'pallet-im-online/std',
'pallet-multisig/std',
'pallet-proxy/std',
'pallet-session/std',
'pallet-sudo/std',
'pallet-universal-dividend/std',
'pallet-upgrade-origin/std',
'pallet-timestamp/std',
'pallet-transaction-payment-rpc-runtime-api/std',
'pallet-transaction-payment/std',
'common-runtime/std',
......@@ -54,6 +67,7 @@ std = [
'sp-core/std',
'sp-inherents/std',
'sp-offchain/std',
'sp-membership/std',
'sp-runtime/std',
'sp-session/std',
'sp-std/std',
......@@ -61,13 +75,26 @@ std = [
'sp-version/std',
]
[dev-dependencies]
sp-consensus-vrf = { git = 'https://github.com/librelois/substrate.git', branch = 'duniter-monthly-2022-02' }
sp-finality-grandpa = { git = 'https://github.com/librelois/substrate.git', branch = 'duniter-monthly-2022-02' }
sp-io = { git = 'https://github.com/librelois/substrate.git', branch = 'duniter-monthly-2022-02' }
sp-keyring = { git = 'https://github.com/librelois/substrate.git', branch = 'duniter-monthly-2022-02' }
[dependencies]
common-runtime = { path = "../common", default-features = false }
pallet-authority-members = { path = '../../pallets/authority-members', default-features = false }
pallet-certification = { path = '../../pallets/certification', default-features = false }
pallet-duniter-test-parameters = { path = '../../pallets/duniter-test-parameters', default-features = false }
pallet-duniter-account = { path = '../../pallets/duniter-account', default-features = false }
pallet-duniter-wot = { path = '../../pallets/duniter-wot', default-features = false }
pallet-identity = { path = '../../pallets/identity', default-features = false }
pallet-membership = { path = '../../pallets/membership', default-features = false }
pallet-provide-randomness = { path = '../../pallets/provide-randomness', default-features = false }
pallet-ud-accounts-storage = { path = '../../pallets/ud-accounts-storage', default-features = false }
pallet-universal-dividend = { path = '../../pallets/universal-dividend', default-features = false }
common-runtime = { path = "../common", default-features = false }
pallet-upgrade-origin = { path = '../../pallets/upgrade-origin', default-features = false }
sp-membership = { path = '../../primitives/membership', default-features = false }
# substrate
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
......@@ -82,82 +109,128 @@ version = '2.3.1'
default-features = false
git = 'https://github.com/librelois/substrate.git'
optional = true
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.frame-executive]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.frame-support]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.frame-system]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.frame-system-benchmarking]
default-features = false
git = 'https://github.com/librelois/substrate.git'
optional = true
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.frame-system-rpc-runtime-api]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.hex-literal]
optional = true
version = '0.3.1'
[dependencies.pallet-atomic-swap]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-authority-discovery]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-authorship]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-babe]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-balances]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-collective]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-grandpa]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-im-online]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-offences]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-multisig]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-proxy]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-scheduler]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-session]
default-features = false
features = ["historical"]
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-sudo]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-timestamp]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-transaction-payment]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-transaction-payment-rpc-runtime-api]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.pallet-utility]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.serde]
version = "1.0.101"
......@@ -167,64 +240,64 @@ features = ["derive"]
[dependencies.sp-api]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-arithmetic]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-authority-discovery]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-block-builder]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-consensus-babe]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-core]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-inherents]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-offchain]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-runtime]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-session]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-std]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-transaction-pool]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'
[dependencies.sp-version]
default-features = false
git = 'https://github.com/librelois/substrate.git'
branch = 'duniter-monthly-2022-01'
branch = 'duniter-monthly-2022-02'