Skip to content

Commit

Permalink
Disable treasury proposals (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmikolajczyk41 authored Apr 25, 2022
1 parent 61bdbce commit e97fb84
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
18 changes: 10 additions & 8 deletions bin/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ use sp_std::prelude::*;
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use frame_support::sp_runtime::Perquintill;
use frame_support::traits::EqualPrivilegeOnly;
use frame_support::traits::SortedMembers;
use frame_support::weights::constants::WEIGHT_PER_MILLIS;
use frame_support::PalletId;
pub use frame_support::{
construct_runtime, parameter_types,
traits::{
Expand All @@ -42,6 +37,12 @@ pub use frame_support::{
},
StorageValue,
};
use frame_support::{
sp_runtime::Perquintill,
traits::{EqualPrivilegeOnly, SortedMembers},
weights::constants::WEIGHT_PER_MILLIS,
PalletId,
};
use frame_system::{EnsureRoot, EnsureSignedBy};
pub use primitives::Balance;
use primitives::{
Expand Down Expand Up @@ -106,7 +107,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("aleph-node"),
impl_name: create_runtime_str!("aleph-node"),
authoring_version: 1,
spec_version: 11,
spec_version: 12,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 4,
Expand Down Expand Up @@ -526,8 +527,9 @@ pub const TREASURY_BURN: u32 = 0;
// The percentage of the amount of the proposal that the proposer should deposit.
// We agreed on non-progressive deposit.
pub const TREASURY_PROPOSAL_BOND: u32 = 0;
// The proposer should deposit max{`TREASURY_PROPOSAL_BOND`% of the proposal value, $10}.
pub const TREASURY_MINIMUM_BOND: Balance = 1000 * CENTS;
// The proposer should deposit max{`TREASURY_PROPOSAL_BOND`% of the proposal value, 100B tokens}.
// This should effectively block making proposals.
pub const TREASURY_MINIMUM_BOND: Balance = 100_000_000_000_000_000_000_000;
// Every 4h we implement accepted proposals.
pub fn treasury_spend_period() -> BlockNumber {
hours_as_block_num(4)
Expand Down
19 changes: 8 additions & 11 deletions e2e-tests/src/test/treasury.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use crate::{
fee::get_tx_fee_info,
transfer::{setup_for_transfer, transfer},
};
use codec::{Compact, Decode};
use aleph_client::{create_connection, wait_for_event, Connection};
use codec::{Compact, Decode};
use frame_support::PalletId;
use log::info;
use sp_core::Pair;
Expand Down Expand Up @@ -128,16 +128,13 @@ pub fn treasury_access(config: &Config) -> anyhow::Result<()> {
let beneficiary = AccountId::from(proposer.public());
let connection = create_connection(node).set_signer(proposer);

let proposals_counter_before = get_proposals_counter(&connection);
propose_treasury_spend(10u128, &beneficiary, &connection);
propose_treasury_spend(100u128, &beneficiary, &connection);
let proposals_counter = get_proposals_counter(&connection);
assert!(proposals_counter >= 2, "Proposal was not created");

let sudo = get_sudo(config);
let connection = connection.set_signer(sudo);

treasury_approve(proposals_counter - 2, &connection)?;
treasury_reject(proposals_counter - 1, &connection)?;
let proposals_counter_after = get_proposals_counter(&connection);
assert_eq!(
proposals_counter_before, proposals_counter_after,
"Proposal was created: deposit was not high enough"
);

Ok(())
}
Expand Down Expand Up @@ -175,7 +172,7 @@ fn get_proposals_counter(connection: &Connection) -> u32 {
connection
.get_storage_value("Treasury", "ProposalCount", None)
.unwrap()
.unwrap()
.unwrap_or(0)
}

type GovernanceTransaction = UncheckedExtrinsicV4<([u8; 2], Compact<u32>)>;
Expand Down

0 comments on commit e97fb84

Please sign in to comment.