Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into update-to-polkadot…
Browse files Browse the repository at this point in the history
…-0.9.34
  • Loading branch information
kacperzuk-neti committed Jan 24, 2023
2 parents 90eb84a + 9948889 commit b2bbeb8
Show file tree
Hide file tree
Showing 31 changed files with 1,057 additions and 498 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions bin/node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ pub fn testnet_genesis(

const ENDOWMENT: Balance = 10_000_000 * DOLLARS;
const STASH: Balance = ENDOWMENT / 1000;
const INITIAL_STAKE: Balance = 5000 * GRAINS_IN_LLM;


// Add Prefunded accounts
Expand Down Expand Up @@ -366,7 +367,7 @@ pub fn testnet_genesis(
.iter()
.take((num_endowed_accounts + 1) / 2)
.cloned()
.map(|member| (member, STASH))
.map(|member| (member, INITIAL_STAKE))
.collect(),
},
council: CouncilConfig::default(),
Expand Down Expand Up @@ -451,14 +452,21 @@ pub fn development_config() -> ChainSpec {
}

fn local_testnet_genesis() -> GenesisConfig {
let alice = get_account_id_from_seed::<sr25519::Public>("Alice");
let total_llm = 6000 * GRAINS_IN_LLM;
let locked_llm = 5000 * GRAINS_IN_LLM;
testnet_genesis(
vec![authority_keys_from_seed("Alice"), authority_keys_from_seed("Bob"), authority_keys_from_seed("Charlie")],
vec![],
get_account_id_from_seed::<sr25519::Public>("Alice"),
None,
None,
None,
vec![],
Some(alice.clone()),
vec![
(alice, total_llm, locked_llm),
(get_account_id_from_seed::<sr25519::Public>("Bob"), total_llm, locked_llm),
(get_account_id_from_seed::<sr25519::Public>("Charlie"), total_llm, locked_llm),
],
None,
)
}
Expand Down
5 changes: 5 additions & 0 deletions bin/node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ std = [
"frame-try-runtime?/std",
"sp-io/std",
"pallet-child-bounties/std",
"pallet-llm/std",
"pallet-liberland-legislation/std",
"pallet-liberland-initializer/std",
]
runtime-benchmarks = [
Expand Down Expand Up @@ -289,6 +291,9 @@ try-runtime = [
"pallet-uniques/try-runtime",
"pallet-vesting/try-runtime",
"pallet-whitelist/try-runtime",
"pallet-llm/try-runtime",
"pallet-liberland-legislation/try-runtime",
"pallet-liberland-initializer/try-runtime",
]
# Force `sp-sandbox` to call into the host resident executor. One still need to make sure
# that `sc-executor` gets the `wasmer-sandbox` feature which happens automatically when
Expand Down
9 changes: 6 additions & 3 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 4,
spec_version: 5,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -888,7 +888,6 @@ impl pallet_democracy::Config for Runtime {
// only do it once and it lasts only for the cool-off period.
type VetoOrigin = pallet_collective::EnsureMember<AccountId, TechnicalCollective>;
type CooloffPeriod = CooloffPeriod;
type Slash = Treasury;
type Scheduler = Scheduler;
type PalletsOrigin = OriginCaller;
type MaxVotes = ConstU32<100>;
Expand Down Expand Up @@ -1414,6 +1413,7 @@ parameter_types! {
parameter_types! {
pub const TOTALLLM: Balance = 70_000_000u128 * GRAINS_IN_LLM;
pub const PRERELEASELLM: Balance = 7_000_000u128 * GRAINS_IN_LLM;
pub const CitizenshipMinimum: Balance = 5_000_000u128 * GRAINS_IN_LLM;
}

impl pallet_liberland_initializer::Config for Runtime {}
Expand All @@ -1423,6 +1423,7 @@ impl pallet_llm::Config for Runtime {
type TotalSupply = TOTALLLM; //70 million in hardcap
type PreReleasedAmount = PRERELEASELLM; // PreRelease 7 million
type AssetId = u32;
type CitizenshipMinimumPooledLLM = CitizenshipMinimum;
}

impl pallet_nis::Config for Runtime {
Expand Down Expand Up @@ -1506,6 +1507,8 @@ parameter_types! {
impl pallet_liberland_legislation::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Citizenship = LLM;
type ConstitutionOrigin = pallet_democracy::EnsureReferendumProportionAtLeast<Self, 3, 4>;
type InternationalTreatyOrigin = pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 1, 2>; // FIXME what ratio?
}

impl pallet_state_trie_migration::Config for Runtime {
Expand Down Expand Up @@ -1546,7 +1549,6 @@ construct_runtime!(
Democracy: pallet_democracy,
Council: pallet_collective::<Instance1>,
TechnicalCommittee: pallet_collective::<Instance2>,
Elections: pallet_elections_phragmen,
TechnicalMembership: pallet_membership::<Instance1>,
Grandpa: pallet_grandpa,
Treasury: pallet_treasury,
Expand Down Expand Up @@ -1582,6 +1584,7 @@ construct_runtime!(
LLM: pallet_llm, //{Pallet, Storage, Event<T>}, // LLM Pallet
LiberlandLegislation: pallet_liberland_legislation,
LiberlandInitializer: pallet_liberland_initializer,
Elections: pallet_elections_phragmen,
}
);

Expand Down
3 changes: 2 additions & 1 deletion frame/democracy/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn funded_account<T: Config>(name: &'static str, index: u32) -> T::AccountId {
T::Currency::make_free_balance_be(&caller, balance);

// Liberland specific - make sure it's a citizen with politipooled LLM
T::LLInitializer::make_citizen(&caller, 1000u32.into());
T::LLInitializer::make_citizen(&caller, 5000u32.into());

caller
}
Expand All @@ -69,6 +69,7 @@ fn add_referendum<T: Config>(n: u32) -> (ReferendumIndex, H256) {
Democracy::<T>::inject_referendum(
T::LaunchPeriod::get(),
proposal,
DispatchOrigin::Root,
vote_threshold,
0u32.into(),
),
Expand Down
11 changes: 6 additions & 5 deletions frame/democracy/src/conviction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// File has been modified by Liberland in 2022. All modifications by Liberland are distributed under the MIT license.

// You should have received a copy of the MIT license along with this program. If not, see https://opensource.org/licenses/MIT

//! The conviction datatype.
use crate::types::Delegations;
Expand Down Expand Up @@ -113,11 +117,8 @@ impl Conviction {
self,
capital: B,
) -> Delegations<B> {
let votes = match self {
Conviction::None => capital.checked_div(&10u8.into()).unwrap_or_else(Zero::zero),
x => capital.checked_mul(&u8::from(x).into()).unwrap_or_else(B::max_value),
};
Delegations { votes, capital }
let votes = capital;
Delegations { votes, voters: 1, capital }
}
}

Expand Down
Loading

0 comments on commit b2bbeb8

Please sign in to comment.