mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Turn storage items into parameters (#2883)
* balances: Turn storage items into parameters. * contract: Turn storage items into parameters. * council: Turn storage items into parameters. * finality-tracker: Turn storage items into parameters. * treasury: Turn storage items into parameters. * democracy: Fix tests. * example: Fix tests. * executive: Fix tests. * staking: Fix tests. * Update runtime. * Update template-node. * Update runtime version. * Fix executor tests. * Fix node cli tests. * Address grumbles. * Add removed default values to docs. * Make gas price a storage item. * Set associated consts must be callable outside of build. * Fix not enough gas to pay for transfer fee. * Fix build. * Emit metadata. * Fix build. * Add default values for all parameter types. * Fix build. * Fix build. * Fix build. * Fix build.
This commit is contained in:
@@ -17,10 +17,14 @@
|
||||
//! Substrate chain configurations.
|
||||
|
||||
use primitives::{ed25519, sr25519, Pair, crypto::UncheckedInto};
|
||||
use node_primitives::{AccountId, AuraId};
|
||||
use node_runtime::{CouncilSeatsConfig, AuraConfig, DemocracyConfig, SystemConfig,
|
||||
SessionConfig, StakingConfig, StakerStatus, TimestampConfig, BalancesConfig, TreasuryConfig,
|
||||
SudoConfig, ContractsConfig, GrandpaConfig, IndicesConfig, Permill, Perbill, SessionKeys};
|
||||
use node_primitives::{AccountId, AuraId, Balance};
|
||||
use node_runtime::{
|
||||
AuraConfig, BalancesConfig, ContractsConfig, CouncilSeatsConfig, DemocracyConfig,
|
||||
GrandpaConfig, IndicesConfig, SessionConfig, StakingConfig, SudoConfig,
|
||||
SystemConfig, TimestampConfig,
|
||||
Perbill, SessionKeys, StakerStatus,
|
||||
DAYS, DOLLARS, MILLICENTS, SECS_PER_BLOCK,
|
||||
};
|
||||
pub use node_runtime::GenesisConfig;
|
||||
use substrate_service;
|
||||
use hex_literal::hex;
|
||||
@@ -88,17 +92,8 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
|
||||
hex!["9ee5e5bdc0ec239eb164f865ecc345ce4c88e76ee002e0f7e318097347471809"].unchecked_into(),
|
||||
];
|
||||
|
||||
const MILLICENTS: u128 = 1_000_000_000;
|
||||
const CENTS: u128 = 1_000 * MILLICENTS; // assume this is worth about a cent.
|
||||
const DOLLARS: u128 = 100 * CENTS;
|
||||
|
||||
const SECS_PER_BLOCK: u64 = 6;
|
||||
const MINUTES: u64 = 60 / SECS_PER_BLOCK;
|
||||
const HOURS: u64 = MINUTES * 60;
|
||||
const DAYS: u64 = HOURS * 24;
|
||||
|
||||
const ENDOWMENT: u128 = 10_000_000 * DOLLARS;
|
||||
const STASH: u128 = 100 * DOLLARS;
|
||||
const ENDOWMENT: Balance = 10_000_000 * DOLLARS;
|
||||
const STASH: Balance = 100 * DOLLARS;
|
||||
|
||||
GenesisConfig {
|
||||
system: Some(SystemConfig {
|
||||
@@ -106,15 +101,10 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
|
||||
changes_trie_config: Default::default(),
|
||||
}),
|
||||
balances: Some(BalancesConfig {
|
||||
transaction_base_fee: 1 * CENTS,
|
||||
transaction_byte_fee: 10 * MILLICENTS,
|
||||
balances: endowed_accounts.iter().cloned()
|
||||
.map(|k| (k, ENDOWMENT))
|
||||
.chain(initial_authorities.iter().map(|x| (x.0.clone(), STASH)))
|
||||
.collect(),
|
||||
existential_deposit: 1 * DOLLARS,
|
||||
transfer_fee: 1 * CENTS,
|
||||
creation_fee: 1 * CENTS,
|
||||
vesting: vec![],
|
||||
}),
|
||||
indices: Some(IndicesConfig {
|
||||
@@ -140,47 +130,16 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
|
||||
democracy: Some(DemocracyConfig::default()),
|
||||
council_seats: Some(CouncilSeatsConfig {
|
||||
active_council: vec![],
|
||||
candidacy_bond: 10 * DOLLARS,
|
||||
voter_bond: 1 * DOLLARS,
|
||||
voting_fee: 2 * DOLLARS,
|
||||
present_slash_per_voter: 1 * CENTS,
|
||||
carry_count: 6,
|
||||
presentation_duration: 1 * DAYS,
|
||||
approval_voting_period: 2 * DAYS,
|
||||
term_duration: 28 * DAYS,
|
||||
desired_seats: 0,
|
||||
decay_ratio: 0,
|
||||
inactive_grace_period: 1, // one additional vote should go by before an inactive voter can be reaped.
|
||||
}),
|
||||
timestamp: Some(TimestampConfig {
|
||||
minimum_period: SECS_PER_BLOCK / 2, // due to the nature of aura the slots are 2*period
|
||||
}),
|
||||
treasury: Some(TreasuryConfig {
|
||||
proposal_bond: Permill::from_percent(5),
|
||||
proposal_bond_minimum: 1 * DOLLARS,
|
||||
spend_period: 1 * DAYS,
|
||||
burn: Permill::from_percent(50),
|
||||
}),
|
||||
contracts: Some(ContractsConfig {
|
||||
signed_claim_handicap: 2,
|
||||
rent_byte_price: 4,
|
||||
rent_deposit_offset: 1000,
|
||||
storage_size_offset: 8,
|
||||
surcharge_reward: 150,
|
||||
tombstone_deposit: 16,
|
||||
transaction_base_fee: 1 * CENTS,
|
||||
transaction_byte_fee: 10 * MILLICENTS,
|
||||
transfer_fee: 1 * CENTS,
|
||||
creation_fee: 1 * CENTS,
|
||||
contract_fee: 1 * CENTS,
|
||||
current_schedule: Default::default(),
|
||||
gas_price: 1 * MILLICENTS,
|
||||
max_depth: 1024,
|
||||
block_gas_limit: 10_000_000,
|
||||
current_schedule: contracts::Schedule {
|
||||
call_base_cost: 1000,
|
||||
instantiate_base_cost: 1000,
|
||||
..Default::default()
|
||||
},
|
||||
}),
|
||||
sudo: Some(SudoConfig {
|
||||
key: endowed_accounts[0].clone(),
|
||||
@@ -264,8 +223,8 @@ pub fn testnet_genesis(
|
||||
]
|
||||
});
|
||||
|
||||
const STASH: u128 = 1 << 20;
|
||||
const ENDOWMENT: u128 = 1 << 20;
|
||||
const ENDOWMENT: Balance = 10_000_000 * DOLLARS;
|
||||
const STASH: Balance = 100 * DOLLARS;
|
||||
|
||||
let council_desired_seats = (endowed_accounts.len() / 2 - initial_authorities.len()) as u32;
|
||||
|
||||
@@ -278,11 +237,6 @@ pub fn testnet_genesis(
|
||||
ids: endowed_accounts.clone(),
|
||||
}),
|
||||
balances: Some(BalancesConfig {
|
||||
transaction_base_fee: 1,
|
||||
transaction_byte_fee: 0,
|
||||
existential_deposit: 500,
|
||||
transfer_fee: 0,
|
||||
creation_fee: 0,
|
||||
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect(),
|
||||
vesting: vec![],
|
||||
}),
|
||||
@@ -306,46 +260,19 @@ pub fn testnet_genesis(
|
||||
active_council: endowed_accounts.iter()
|
||||
.filter(|&endowed| initial_authorities.iter().find(|&(_, controller, ..)| controller == endowed).is_none())
|
||||
.map(|a| (a.clone(), 1000000)).collect(),
|
||||
candidacy_bond: 10,
|
||||
voter_bond: 2,
|
||||
voting_fee: 5,
|
||||
present_slash_per_voter: 1,
|
||||
carry_count: 4,
|
||||
presentation_duration: 10,
|
||||
approval_voting_period: 20,
|
||||
term_duration: 1000000,
|
||||
desired_seats: council_desired_seats,
|
||||
decay_ratio: council_desired_seats / 3,
|
||||
inactive_grace_period: 1,
|
||||
}),
|
||||
timestamp: Some(TimestampConfig {
|
||||
minimum_period: 2, // 2*2=4 second block time.
|
||||
}),
|
||||
treasury: Some(TreasuryConfig {
|
||||
proposal_bond: Permill::from_percent(5),
|
||||
proposal_bond_minimum: 1_000_000,
|
||||
spend_period: 12 * 60 * 24,
|
||||
burn: Permill::from_percent(50),
|
||||
}),
|
||||
contracts: Some(ContractsConfig {
|
||||
signed_claim_handicap: 2,
|
||||
rent_byte_price: 4,
|
||||
rent_deposit_offset: 1000,
|
||||
storage_size_offset: 8,
|
||||
surcharge_reward: 150,
|
||||
tombstone_deposit: 16,
|
||||
transaction_base_fee: 1,
|
||||
transaction_byte_fee: 0,
|
||||
transfer_fee: 0,
|
||||
creation_fee: 0,
|
||||
contract_fee: 21,
|
||||
gas_price: 1,
|
||||
max_depth: 1024,
|
||||
block_gas_limit: 10_000_000,
|
||||
current_schedule: contracts::Schedule {
|
||||
enable_println, // this should only be enabled on development chains
|
||||
..Default::default()
|
||||
},
|
||||
gas_price: 1 * MILLICENTS,
|
||||
}),
|
||||
sudo: Some(SudoConfig {
|
||||
key: root_key,
|
||||
|
||||
@@ -218,7 +218,7 @@ mod tests {
|
||||
use consensus::CompatibleDigestItem;
|
||||
use consensus_common::{Environment, Proposer, ImportBlock, BlockOrigin, ForkChoiceStrategy};
|
||||
use node_primitives::DigestItem;
|
||||
use node_runtime::{Call, BalancesCall, UncheckedExtrinsic};
|
||||
use node_runtime::{BalancesCall, Call, CENTS, UncheckedExtrinsic};
|
||||
use parity_codec::{Compact, Encode, Decode};
|
||||
use primitives::{
|
||||
crypto::Pair as CryptoPair, ed25519::Pair, blake2_256,
|
||||
@@ -350,7 +350,7 @@ mod tests {
|
||||
|
||||
let mut index = 0;
|
||||
let extrinsic_factory = |service: &SyncService<<Factory as ServiceFactory>::FullService>| {
|
||||
let amount = 1000;
|
||||
let amount = 5 * CENTS;
|
||||
let to = AddressPublic::from_raw(bob.public().0);
|
||||
let from = AddressPublic::from_raw(charlie.public().0);
|
||||
let genesis_hash = service.get().client().block_hash(0).unwrap().unwrap();
|
||||
|
||||
@@ -49,12 +49,15 @@ mod tests {
|
||||
use node_primitives::{Hash, BlockNumber, AccountId};
|
||||
use runtime_primitives::traits::{Header as HeaderT, Hash as HashT};
|
||||
use runtime_primitives::{generic::Era, ApplyOutcome, ApplyError, ApplyResult, Perbill};
|
||||
use {balances, indices, system, staking, timestamp, treasury, contracts};
|
||||
use {balances, contracts, indices, staking, system, timestamp};
|
||||
use contracts::ContractAddressFor;
|
||||
use system::{EventRecord, Phase};
|
||||
use node_runtime::{Header, Block, UncheckedExtrinsic, CheckedExtrinsic, Call, Runtime, Balances,
|
||||
BuildStorage, GenesisConfig, BalancesConfig, SessionConfig, StakingConfig, System,
|
||||
SystemConfig, GrandpaConfig, IndicesConfig, Event, SessionKeys, Treasury};
|
||||
use node_runtime::{
|
||||
Header, Block, UncheckedExtrinsic, CheckedExtrinsic, Call, Runtime, Balances,
|
||||
BuildStorage, GenesisConfig, BalancesConfig, SessionConfig, StakingConfig,
|
||||
System, SystemConfig, GrandpaConfig, IndicesConfig, ContractsConfig, Event,
|
||||
SessionKeys, Treasury, CENTS, DOLLARS, MILLICENTS
|
||||
};
|
||||
use wabt;
|
||||
use primitives::map;
|
||||
|
||||
@@ -77,6 +80,8 @@ mod tests {
|
||||
|
||||
const GENESIS_HASH: [u8; 32] = [69u8; 32];
|
||||
|
||||
const TX_FEE: u128 = 3 * CENTS + 460 * MILLICENTS;
|
||||
|
||||
type TestExternalities<H> = CoreTestExternalities<H, u64>;
|
||||
|
||||
fn alice() -> AccountId {
|
||||
@@ -131,7 +136,7 @@ mod tests {
|
||||
fn xt() -> UncheckedExtrinsic {
|
||||
sign(CheckedExtrinsic {
|
||||
signed: Some((alice(), 0)),
|
||||
function: Call::Balances(balances::Call::transfer::<Runtime>(bob().into(), 69)),
|
||||
function: Call::Balances(balances::Call::transfer::<Runtime>(bob().into(), 69 * DOLLARS)),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -147,18 +152,9 @@ mod tests {
|
||||
fn panic_execution_with_foreign_code_gives_error() {
|
||||
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(BLOATY_CODE, map![
|
||||
blake2_256(&<balances::FreeBalance<Runtime>>::key_for(alice())).to_vec() => {
|
||||
vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
vec![0u8; 16]
|
||||
},
|
||||
twox_128(<balances::TotalIssuance<Runtime>>::key()).to_vec() => {
|
||||
vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
},
|
||||
twox_128(<balances::ExistentialDeposit<Runtime>>::key()).to_vec() => {
|
||||
vec![0u8; 16]
|
||||
},
|
||||
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => {
|
||||
vec![0u8; 16]
|
||||
},
|
||||
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => {
|
||||
vec![0u8; 16]
|
||||
},
|
||||
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => {
|
||||
@@ -166,12 +162,6 @@ mod tests {
|
||||
},
|
||||
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => {
|
||||
vec![0u8; 32]
|
||||
},
|
||||
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => {
|
||||
vec![70u8; 16]
|
||||
},
|
||||
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => {
|
||||
vec![0u8; 16]
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -198,18 +188,9 @@ mod tests {
|
||||
fn bad_extrinsic_with_native_equivalent_code_gives_error() {
|
||||
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(COMPACT_CODE, map![
|
||||
blake2_256(&<balances::FreeBalance<Runtime>>::key_for(alice())).to_vec() => {
|
||||
vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
vec![0u8; 16]
|
||||
},
|
||||
twox_128(<balances::TotalIssuance<Runtime>>::key()).to_vec() => {
|
||||
vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
},
|
||||
twox_128(<balances::ExistentialDeposit<Runtime>>::key()).to_vec() => {
|
||||
vec![0u8; 16]
|
||||
},
|
||||
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => {
|
||||
vec![0u8; 16]
|
||||
},
|
||||
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => {
|
||||
vec![0u8; 16]
|
||||
},
|
||||
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => {
|
||||
@@ -217,12 +198,6 @@ mod tests {
|
||||
},
|
||||
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => {
|
||||
vec![0u8; 32]
|
||||
},
|
||||
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => {
|
||||
vec![70u8; 16]
|
||||
},
|
||||
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => {
|
||||
vec![0u8; 16]
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -249,18 +224,13 @@ mod tests {
|
||||
fn successful_execution_with_native_equivalent_code_gives_ok() {
|
||||
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(COMPACT_CODE, map![
|
||||
blake2_256(&<balances::FreeBalance<Runtime>>::key_for(alice())).to_vec() => {
|
||||
vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
(111 * DOLLARS).encode()
|
||||
},
|
||||
twox_128(<balances::TotalIssuance<Runtime>>::key()).to_vec() => {
|
||||
vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
(111 * DOLLARS).encode()
|
||||
},
|
||||
twox_128(<balances::ExistentialDeposit<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32],
|
||||
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => vec![0u8; 16]
|
||||
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32]
|
||||
]);
|
||||
|
||||
let r = executor().call::<_, NeverNativeValue, fn() -> _>(
|
||||
@@ -281,8 +251,8 @@ mod tests {
|
||||
assert!(r.is_ok());
|
||||
|
||||
runtime_io::with_externalities(&mut t, || {
|
||||
assert_eq!(Balances::total_balance(&alice()), 42);
|
||||
assert_eq!(Balances::total_balance(&bob()), 69);
|
||||
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - 1 * TX_FEE);
|
||||
assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -290,18 +260,13 @@ mod tests {
|
||||
fn successful_execution_with_foreign_code_gives_ok() {
|
||||
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(BLOATY_CODE, map![
|
||||
blake2_256(&<balances::FreeBalance<Runtime>>::key_for(alice())).to_vec() => {
|
||||
vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
(111 * DOLLARS).encode()
|
||||
},
|
||||
twox_128(<balances::TotalIssuance<Runtime>>::key()).to_vec() => {
|
||||
vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
(111 * DOLLARS).encode()
|
||||
},
|
||||
twox_128(<balances::ExistentialDeposit<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32],
|
||||
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => vec![0u8; 16]
|
||||
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32]
|
||||
]);
|
||||
|
||||
let r = executor().call::<_, NeverNativeValue, fn() -> _>(
|
||||
@@ -322,8 +287,8 @@ mod tests {
|
||||
assert!(r.is_ok());
|
||||
|
||||
runtime_io::with_externalities(&mut t, || {
|
||||
assert_eq!(Balances::total_balance(&alice()), 42);
|
||||
assert_eq!(Balances::total_balance(&bob()), 69);
|
||||
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - 1 * TX_FEE);
|
||||
assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -346,19 +311,14 @@ mod tests {
|
||||
ids: vec![alice(), bob(), charlie(), dave(), eve(), ferdie()],
|
||||
}),
|
||||
balances: Some(BalancesConfig {
|
||||
transaction_base_fee: 1,
|
||||
transaction_byte_fee: 0,
|
||||
balances: vec![
|
||||
(alice(), 111),
|
||||
(bob(), 100),
|
||||
(charlie(), 100_000_000),
|
||||
(dave(), 111),
|
||||
(eve(), 101),
|
||||
(ferdie(), 100),
|
||||
(alice(), 111 * DOLLARS),
|
||||
(bob(), 100 * DOLLARS),
|
||||
(charlie(), 100_000_000 * DOLLARS),
|
||||
(dave(), 111 * DOLLARS),
|
||||
(eve(), 101 * DOLLARS),
|
||||
(ferdie(), 100 * DOLLARS),
|
||||
],
|
||||
existential_deposit: 0,
|
||||
transfer_fee: 0,
|
||||
creation_fee: 0,
|
||||
vesting: vec![],
|
||||
}),
|
||||
session: Some(SessionConfig {
|
||||
@@ -372,9 +332,9 @@ mod tests {
|
||||
staking: Some(StakingConfig {
|
||||
current_era: 0,
|
||||
stakers: vec![
|
||||
(dave(), alice(), 111, staking::StakerStatus::Validator),
|
||||
(eve(), bob(), 100, staking::StakerStatus::Validator),
|
||||
(ferdie(), charlie(), 100, staking::StakerStatus::Validator)
|
||||
(dave(), alice(), 111 * DOLLARS, staking::StakerStatus::Validator),
|
||||
(eve(), bob(), 100 * DOLLARS, staking::StakerStatus::Validator),
|
||||
(ferdie(), charlie(), 100 * DOLLARS, staking::StakerStatus::Validator)
|
||||
],
|
||||
validator_count: 3,
|
||||
minimum_validator_count: 0,
|
||||
@@ -387,8 +347,10 @@ mod tests {
|
||||
democracy: Some(Default::default()),
|
||||
council_seats: Some(Default::default()),
|
||||
timestamp: Some(Default::default()),
|
||||
treasury: Some(Default::default()),
|
||||
contracts: Some(Default::default()),
|
||||
contracts: Some(ContractsConfig {
|
||||
current_schedule: Default::default(),
|
||||
gas_price: 1 * MILLICENTS,
|
||||
}),
|
||||
sudo: Some(Default::default()),
|
||||
grandpa: Some(GrandpaConfig {
|
||||
authorities: vec![],
|
||||
@@ -469,7 +431,7 @@ mod tests {
|
||||
},
|
||||
CheckedExtrinsic {
|
||||
signed: Some((alice(), 0)),
|
||||
function: Call::Balances(balances::Call::transfer(bob().into(), 69)),
|
||||
function: Call::Balances(balances::Call::transfer(bob().into(), 69 * DOLLARS)),
|
||||
},
|
||||
]
|
||||
)
|
||||
@@ -491,7 +453,7 @@ mod tests {
|
||||
},
|
||||
CheckedExtrinsic {
|
||||
signed: Some((alice(), 0)),
|
||||
function: Call::Balances(balances::Call::transfer(bob().into(), 69)),
|
||||
function: Call::Balances(balances::Call::transfer(bob().into(), 69 * DOLLARS)),
|
||||
},
|
||||
]
|
||||
);
|
||||
@@ -506,11 +468,11 @@ mod tests {
|
||||
},
|
||||
CheckedExtrinsic {
|
||||
signed: Some((bob(), 0)),
|
||||
function: Call::Balances(balances::Call::transfer(alice().into(), 5)),
|
||||
function: Call::Balances(balances::Call::transfer(alice().into(), 5 * DOLLARS)),
|
||||
},
|
||||
CheckedExtrinsic {
|
||||
signed: Some((alice(), 1)),
|
||||
function: Call::Balances(balances::Call::transfer(bob().into(), 15)),
|
||||
function: Call::Balances(balances::Call::transfer(bob().into(), 15 * DOLLARS)),
|
||||
}
|
||||
]
|
||||
);
|
||||
@@ -558,49 +520,21 @@ mod tests {
|
||||
runtime_io::with_externalities(&mut t, || {
|
||||
// block1 transfers from alice 69 to bob.
|
||||
// -1 is the default fee
|
||||
assert_eq!(Balances::total_balance(&alice()), 111 - 69 - 1);
|
||||
assert_eq!(Balances::total_balance(&bob()), 100 + 69);
|
||||
assert_eq!(System::events(), vec![
|
||||
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - 1 * TX_FEE);
|
||||
assert_eq!(Balances::total_balance(&bob()), 169 * DOLLARS);
|
||||
let events = vec![
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(0),
|
||||
event: Event::system(system::Event::ExtrinsicSuccess),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(1),
|
||||
event: Event::indices(
|
||||
indices::RawEvent::NewAccountIndex(Treasury::account_id(), 6)
|
||||
),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(1),
|
||||
event: Event::balances(
|
||||
balances::RawEvent::NewAccount(Treasury::account_id(), 0)
|
||||
),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(1),
|
||||
event: Event::indices(
|
||||
indices::RawEvent::NewAccountIndex(Default::default(), 7)
|
||||
),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(1),
|
||||
event: Event::balances(
|
||||
balances::RawEvent::NewAccount(Default::default(), 1)
|
||||
),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(1),
|
||||
event: Event::balances(balances::RawEvent::Transfer(
|
||||
alice().into(),
|
||||
bob().into(),
|
||||
69,
|
||||
0
|
||||
69 * DOLLARS,
|
||||
1 * CENTS
|
||||
)),
|
||||
topics: vec![],
|
||||
},
|
||||
@@ -609,22 +543,8 @@ mod tests {
|
||||
event: Event::system(system::Event::ExtrinsicSuccess),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
event: Event::treasury(treasury::RawEvent::Spending(0)),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
event: Event::treasury(treasury::RawEvent::Burnt(0)),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
event: Event::treasury(treasury::RawEvent::Rollover(0)),
|
||||
topics: vec![],
|
||||
},
|
||||
]);
|
||||
];
|
||||
assert_eq!(System::events(), events);
|
||||
});
|
||||
|
||||
executor().call::<_, NeverNativeValue, fn() -> _>(
|
||||
@@ -637,11 +557,11 @@ mod tests {
|
||||
|
||||
runtime_io::with_externalities(&mut t, || {
|
||||
// bob sends 5, alice sends 15 | bob += 10, alice -= 10
|
||||
// 111 - 69 - 1 - 10 - 1 = 30
|
||||
assert_eq!(Balances::total_balance(&alice()), 111 - 69 - 1 - 10 - 1);
|
||||
// 100 + 69 + 10 - 1 = 178
|
||||
assert_eq!(Balances::total_balance(&bob()), 100 + 69 + 10 - 1);
|
||||
assert_eq!(System::events(), vec![
|
||||
// 111 - 69 - 10 = 32
|
||||
assert_eq!(Balances::total_balance(&alice()), 32 * DOLLARS - 2 * TX_FEE);
|
||||
// 100 + 69 + 10 = 179
|
||||
assert_eq!(Balances::total_balance(&bob()), 179 * DOLLARS - 1 * TX_FEE);
|
||||
let events = vec![
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(0),
|
||||
event: Event::system(system::Event::ExtrinsicSuccess),
|
||||
@@ -653,8 +573,8 @@ mod tests {
|
||||
balances::RawEvent::Transfer(
|
||||
bob().into(),
|
||||
alice().into(),
|
||||
5,
|
||||
0
|
||||
5 * DOLLARS,
|
||||
1 * CENTS,
|
||||
)
|
||||
),
|
||||
topics: vec![],
|
||||
@@ -670,8 +590,8 @@ mod tests {
|
||||
balances::RawEvent::Transfer(
|
||||
alice().into(),
|
||||
bob().into(),
|
||||
15,
|
||||
0
|
||||
15 * DOLLARS,
|
||||
1 * CENTS,
|
||||
)
|
||||
),
|
||||
topics: vec![],
|
||||
@@ -681,22 +601,8 @@ mod tests {
|
||||
event: Event::system(system::Event::ExtrinsicSuccess),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
event: Event::treasury(treasury::RawEvent::Spending(0)),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
event: Event::treasury(treasury::RawEvent::Burnt(0)),
|
||||
topics: vec![],
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::Finalization,
|
||||
event: Event::treasury(treasury::RawEvent::Rollover(0)),
|
||||
topics: vec![],
|
||||
},
|
||||
]);
|
||||
];
|
||||
assert_eq!(System::events(), events);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -710,19 +616,18 @@ mod tests {
|
||||
|
||||
runtime_io::with_externalities(&mut t, || {
|
||||
// block1 transfers from alice 69 to bob.
|
||||
// -1 is the default fee
|
||||
assert_eq!(Balances::total_balance(&alice()), 111 - 69 - 1);
|
||||
assert_eq!(Balances::total_balance(&bob()), 100 + 69);
|
||||
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - 1 * TX_FEE);
|
||||
assert_eq!(Balances::total_balance(&bob()), 169 * DOLLARS);
|
||||
});
|
||||
|
||||
WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "Core_execute_block", &block2.0).unwrap();
|
||||
|
||||
runtime_io::with_externalities(&mut t, || {
|
||||
// bob sends 5, alice sends 15 | bob += 10, alice -= 10
|
||||
// 111 - 69 - 1 - 10 - 1 = 30
|
||||
assert_eq!(Balances::total_balance(&alice()), 111 - 69 - 1 - 10 - 1);
|
||||
// 100 + 69 + 10 - 1 = 178
|
||||
assert_eq!(Balances::total_balance(&bob()), 100 + 69 + 10 - 1);
|
||||
// 111 - 69 - 10 = 32
|
||||
assert_eq!(Balances::total_balance(&alice()), 32 * DOLLARS - 2 * TX_FEE);
|
||||
// 100 + 69 + 10 = 179
|
||||
assert_eq!(Balances::total_balance(&bob()), 179 * DOLLARS - 1 * TX_FEE);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -848,7 +753,7 @@ mod tests {
|
||||
CheckedExtrinsic {
|
||||
signed: Some((charlie(), 1)),
|
||||
function: Call::Contracts(
|
||||
contracts::Call::create::<Runtime>(10, 10_000, transfer_ch, Vec::new())
|
||||
contracts::Call::create::<Runtime>(1 * DOLLARS, 10_000, transfer_ch, Vec::new())
|
||||
),
|
||||
},
|
||||
CheckedExtrinsic {
|
||||
@@ -928,18 +833,13 @@ mod tests {
|
||||
fn panic_execution_gives_error() {
|
||||
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(BLOATY_CODE, map![
|
||||
blake2_256(&<balances::FreeBalance<Runtime>>::key_for(alice())).to_vec() => {
|
||||
vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
vec![0u8; 16]
|
||||
},
|
||||
twox_128(<balances::TotalIssuance<Runtime>>::key()).to_vec() => {
|
||||
vec![69u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
vec![0u8; 16]
|
||||
},
|
||||
twox_128(<balances::ExistentialDeposit<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32],
|
||||
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => vec![70u8; 16],
|
||||
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => vec![0u8; 16]
|
||||
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32]
|
||||
]);
|
||||
|
||||
let r = WasmExecutor::new()
|
||||
@@ -955,18 +855,13 @@ mod tests {
|
||||
fn successful_execution_gives_ok() {
|
||||
let mut t = TestExternalities::<Blake2Hasher>::new_with_code(COMPACT_CODE, map![
|
||||
blake2_256(&<balances::FreeBalance<Runtime>>::key_for(alice())).to_vec() => {
|
||||
vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
(111 * DOLLARS).encode()
|
||||
},
|
||||
twox_128(<balances::TotalIssuance<Runtime>>::key()).to_vec() => {
|
||||
vec![111u8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
(111 * DOLLARS).encode()
|
||||
},
|
||||
twox_128(<balances::ExistentialDeposit<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<balances::CreationFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<balances::TransferFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<indices::NextEnumSet<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32],
|
||||
twox_128(<balances::TransactionBaseFee<Runtime>>::key()).to_vec() => vec![0u8; 16],
|
||||
twox_128(<balances::TransactionByteFee<Runtime>>::key()).to_vec() => vec![0u8; 16]
|
||||
blake2_256(&<system::BlockHash<Runtime>>::key_for(0)).to_vec() => vec![0u8; 32]
|
||||
]);
|
||||
|
||||
let r = WasmExecutor::new()
|
||||
@@ -978,8 +873,8 @@ mod tests {
|
||||
assert_eq!(r, Ok(ApplyOutcome::Success));
|
||||
|
||||
runtime_io::with_externalities(&mut t, || {
|
||||
assert_eq!(Balances::total_balance(&alice()), 42);
|
||||
assert_eq!(Balances::total_balance(&bob()), 69);
|
||||
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - 1 * TX_FEE);
|
||||
assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@ pub type AccountIndex = u32;
|
||||
/// Balance of an account.
|
||||
pub type Balance = u128;
|
||||
|
||||
/// Type used for expressing timestamp.
|
||||
pub type Moment = u64;
|
||||
|
||||
/// Alias to the signature scheme used for Aura authority signatures.
|
||||
pub type AuraSignature = primitives::ed25519::Signature;
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ use support::{
|
||||
};
|
||||
use substrate_primitives::u32_trait::{_1, _2, _3, _4};
|
||||
use node_primitives::{
|
||||
AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, Signature, AuraId
|
||||
AccountId, AccountIndex, AuraId, Balance, BlockNumber, Hash, Index,
|
||||
Moment, Signature,
|
||||
};
|
||||
use grandpa::fg_primitives::{self, ScheduledChange};
|
||||
use client::{
|
||||
@@ -39,18 +40,20 @@ use runtime_primitives::traits::{
|
||||
BlakeTwo256, Block as BlockT, DigestFor, NumberFor, StaticLookup, Convert,
|
||||
};
|
||||
use version::RuntimeVersion;
|
||||
use council::{motions as council_motions};
|
||||
use council::{motions as council_motions, VoteIndex};
|
||||
#[cfg(feature = "std")]
|
||||
use council::seats as council_seats;
|
||||
#[cfg(any(feature = "std", test))]
|
||||
use version::NativeVersion;
|
||||
use substrate_primitives::OpaqueMetadata;
|
||||
use grandpa::{AuthorityId as GrandpaId, AuthorityWeight as GrandpaWeight};
|
||||
use finality_tracker::{DEFAULT_REPORT_LATENCY, DEFAULT_WINDOW_SIZE};
|
||||
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use runtime_primitives::BuildStorage;
|
||||
pub use timestamp::Call as TimestampCall;
|
||||
pub use balances::Call as BalancesCall;
|
||||
pub use contracts::Gas;
|
||||
pub use runtime_primitives::{Permill, Perbill, impl_opaque_keys};
|
||||
pub use support::StorageValue;
|
||||
pub use staking::StakerStatus;
|
||||
@@ -60,8 +63,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("node"),
|
||||
impl_name: create_runtime_str!("substrate-node"),
|
||||
authoring_version: 10,
|
||||
spec_version: 100,
|
||||
impl_version: 100,
|
||||
spec_version: 101,
|
||||
impl_version: 101,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
};
|
||||
|
||||
@@ -74,6 +77,10 @@ pub fn native_version() -> NativeVersion {
|
||||
}
|
||||
}
|
||||
|
||||
pub const MILLICENTS: Balance = 1_000_000_000;
|
||||
pub const CENTS: Balance = 1_000 * MILLICENTS; // assume this is worth about a cent.
|
||||
pub const DOLLARS: Balance = 100 * CENTS;
|
||||
|
||||
type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;
|
||||
|
||||
pub struct Author;
|
||||
@@ -91,19 +98,10 @@ pub type DealWithFees = SplitTwoWays<
|
||||
_1, Author, // 1 part (20%) goes to the block author.
|
||||
>;
|
||||
|
||||
pub struct CurrencyToVoteHandler;
|
||||
|
||||
impl CurrencyToVoteHandler {
|
||||
fn factor() -> u128 { (Balances::total_issuance() / u64::max_value() as u128).max(1) }
|
||||
}
|
||||
|
||||
impl Convert<u128, u64> for CurrencyToVoteHandler {
|
||||
fn convert(x: u128) -> u64 { (x / Self::factor()) as u64 }
|
||||
}
|
||||
|
||||
impl Convert<u128, u128> for CurrencyToVoteHandler {
|
||||
fn convert(x: u128) -> u128 { x * Self::factor() }
|
||||
}
|
||||
pub const SECS_PER_BLOCK: Moment = 6;
|
||||
pub const MINUTES: Moment = 60 / SECS_PER_BLOCK;
|
||||
pub const HOURS: Moment = MINUTES * 60;
|
||||
pub const DAYS: Moment = HOURS * 24;
|
||||
|
||||
impl system::Trait for Runtime {
|
||||
type Origin = Origin;
|
||||
@@ -129,6 +127,14 @@ impl indices::Trait for Runtime {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: Balance = 1 * DOLLARS;
|
||||
pub const TransferFee: Balance = 1 * CENTS;
|
||||
pub const CreationFee: Balance = 1 * CENTS;
|
||||
pub const TransactionBaseFee: Balance = 1 * CENTS;
|
||||
pub const TransactionByteFee: Balance = 10 * MILLICENTS;
|
||||
}
|
||||
|
||||
impl balances::Trait for Runtime {
|
||||
type Balance = Balance;
|
||||
type OnFreeBalanceZero = ((Staking, Contracts), Session);
|
||||
@@ -137,10 +143,15 @@ impl balances::Trait for Runtime {
|
||||
type TransactionPayment = DealWithFees;
|
||||
type DustRemoval = ();
|
||||
type TransferPayment = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type TransferFee = TransferFee;
|
||||
type CreationFee = CreationFee;
|
||||
type TransactionBaseFee = TransactionBaseFee;
|
||||
type TransactionByteFee = TransactionByteFee;
|
||||
}
|
||||
|
||||
impl timestamp::Trait for Runtime {
|
||||
type Moment = u64;
|
||||
type Moment = Moment;
|
||||
type OnTimestampSet = Aura;
|
||||
}
|
||||
|
||||
@@ -185,6 +196,20 @@ parameter_types! {
|
||||
pub const BondingDuration: staking::EraIndex = 24 * 28;
|
||||
}
|
||||
|
||||
pub struct CurrencyToVoteHandler;
|
||||
|
||||
impl CurrencyToVoteHandler {
|
||||
fn factor() -> u128 { (Balances::total_issuance() / u64::max_value() as u128).max(1) }
|
||||
}
|
||||
|
||||
impl Convert<u128, u64> for CurrencyToVoteHandler {
|
||||
fn convert(x: u128) -> u64 { (x / Self::factor()) as u64 }
|
||||
}
|
||||
|
||||
impl Convert<u128, u128> for CurrencyToVoteHandler {
|
||||
fn convert(x: u128) -> u128 { x * Self::factor() }
|
||||
}
|
||||
|
||||
impl staking::Trait for Runtime {
|
||||
type Currency = Balances;
|
||||
type CurrencyToVote = CurrencyToVoteHandler;
|
||||
@@ -196,14 +221,11 @@ impl staking::Trait for Runtime {
|
||||
type BondingDuration = BondingDuration;
|
||||
}
|
||||
|
||||
const MINUTES: BlockNumber = 6;
|
||||
const BUCKS: Balance = 1_000_000_000_000;
|
||||
|
||||
parameter_types! {
|
||||
pub const LaunchPeriod: BlockNumber = 28 * 24 * 60 * MINUTES;
|
||||
pub const VotingPeriod: BlockNumber = 28 * 24 * 60 * MINUTES;
|
||||
pub const EmergencyVotingPeriod: BlockNumber = 3 * 24 * 60 * MINUTES;
|
||||
pub const MinimumDeposit: Balance = 100 * BUCKS;
|
||||
pub const MinimumDeposit: Balance = 100 * DOLLARS;
|
||||
pub const EnactmentPeriod: BlockNumber = 30 * 24 * 60 * MINUTES;
|
||||
pub const CooloffPeriod: BlockNumber = 30 * 24 * 60 * MINUTES;
|
||||
}
|
||||
@@ -225,6 +247,18 @@ impl democracy::Trait for Runtime {
|
||||
type CooloffPeriod = CooloffPeriod;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const CandidacyBond: Balance = 10 * DOLLARS;
|
||||
pub const VotingBond: Balance = 1 * DOLLARS;
|
||||
pub const VotingFee: Balance = 2 * DOLLARS;
|
||||
pub const PresentSlashPerVoter: Balance = 1 * CENTS;
|
||||
pub const CarryCount: u32 = 6;
|
||||
// one additional vote should go by before an inactive voter can be reaped.
|
||||
pub const InactiveGracePeriod: VoteIndex = 1;
|
||||
pub const CouncilVotingPeriod: BlockNumber = 2 * DAYS;
|
||||
pub const DecayRatio: u32 = 0;
|
||||
}
|
||||
|
||||
impl council::Trait for Runtime {
|
||||
type Event = Event;
|
||||
type BadPresentation = ();
|
||||
@@ -232,6 +266,14 @@ impl council::Trait for Runtime {
|
||||
type BadVoterIndex = ();
|
||||
type LoserCandidate = ();
|
||||
type OnMembersChanged = CouncilMotions;
|
||||
type CandidacyBond = CandidacyBond;
|
||||
type VotingBond = VotingBond;
|
||||
type VotingFee = VotingFee;
|
||||
type PresentSlashPerVoter = PresentSlashPerVoter;
|
||||
type CarryCount = CarryCount;
|
||||
type InactiveGracePeriod = InactiveGracePeriod;
|
||||
type CouncilVotingPeriod = CouncilVotingPeriod;
|
||||
type DecayRatio = DecayRatio;
|
||||
}
|
||||
|
||||
impl council::motions::Trait for Runtime {
|
||||
@@ -240,6 +282,13 @@ impl council::motions::Trait for Runtime {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ProposalBond: Permill = Permill::from_percent(5);
|
||||
pub const ProposalBondMinimum: Balance = 1 * DOLLARS;
|
||||
pub const SpendPeriod: BlockNumber = 1 * DAYS;
|
||||
pub const Burn: Permill = Permill::from_percent(50);
|
||||
}
|
||||
|
||||
impl treasury::Trait for Runtime {
|
||||
type Currency = Balances;
|
||||
type ApproveOrigin = council_motions::EnsureMembers<_4, AccountId>;
|
||||
@@ -247,6 +296,28 @@ impl treasury::Trait for Runtime {
|
||||
type Event = Event;
|
||||
type MintedForSpending = ();
|
||||
type ProposalRejection = ();
|
||||
type ProposalBond = ProposalBond;
|
||||
type ProposalBondMinimum = ProposalBondMinimum;
|
||||
type SpendPeriod = SpendPeriod;
|
||||
type Burn = Burn;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const SignedClaimHandicap: BlockNumber = 2;
|
||||
pub const TombstoneDeposit: Balance = 16;
|
||||
pub const StorageSizeOffset: u32 = 8;
|
||||
pub const RentByteFee: Balance = 4;
|
||||
pub const RentDepositOffset: Balance = 1000;
|
||||
pub const SurchargeReward: Balance = 150;
|
||||
pub const ContractTransferFee: Balance = 1 * CENTS;
|
||||
pub const ContractCreationFee: Balance = 1 * CENTS;
|
||||
pub const ContractTransactionBaseFee: Balance = 1 * CENTS;
|
||||
pub const ContractTransactionByteFee: Balance = 10 * MILLICENTS;
|
||||
pub const ContractFee: Balance = 1 * CENTS;
|
||||
pub const CallBaseFee: Gas = 1000;
|
||||
pub const CreateBaseFee: Gas = 1000;
|
||||
pub const MaxDepth: u32 = 1024;
|
||||
pub const BlockGasLimit: Gas = 10_000_000;
|
||||
}
|
||||
|
||||
impl contracts::Trait for Runtime {
|
||||
@@ -257,6 +328,21 @@ impl contracts::Trait for Runtime {
|
||||
type ComputeDispatchFee = contracts::DefaultDispatchFeeComputor<Runtime>;
|
||||
type TrieIdGenerator = contracts::TrieIdFromParentCounter<Runtime>;
|
||||
type GasPayment = ();
|
||||
type SignedClaimHandicap = SignedClaimHandicap;
|
||||
type TombstoneDeposit = TombstoneDeposit;
|
||||
type StorageSizeOffset = StorageSizeOffset;
|
||||
type RentByteFee = RentByteFee;
|
||||
type RentDepositOffset = RentDepositOffset;
|
||||
type SurchargeReward = SurchargeReward;
|
||||
type TransferFee = ContractTransferFee;
|
||||
type CreationFee = ContractCreationFee;
|
||||
type TransactionBaseFee = ContractTransactionBaseFee;
|
||||
type TransactionByteFee = ContractTransactionByteFee;
|
||||
type ContractFee = ContractFee;
|
||||
type CallBaseFee = CallBaseFee;
|
||||
type CreateBaseFee = CreateBaseFee;
|
||||
type MaxDepth = MaxDepth;
|
||||
type BlockGasLimit = BlockGasLimit;
|
||||
}
|
||||
|
||||
impl sudo::Trait for Runtime {
|
||||
@@ -268,8 +354,15 @@ impl grandpa::Trait for Runtime {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const WindowSize: BlockNumber = DEFAULT_WINDOW_SIZE.into();
|
||||
pub const ReportLatency: BlockNumber = DEFAULT_REPORT_LATENCY.into();
|
||||
}
|
||||
|
||||
impl finality_tracker::Trait for Runtime {
|
||||
type OnFinalizationStalled = Grandpa;
|
||||
type WindowSize = WindowSize;
|
||||
type ReportLatency = ReportLatency;
|
||||
}
|
||||
|
||||
construct_runtime!(
|
||||
@@ -292,7 +385,7 @@ construct_runtime!(
|
||||
CouncilSeats: council_seats::{Config<T>},
|
||||
FinalityTracker: finality_tracker::{Module, Call, Inherent},
|
||||
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
|
||||
Treasury: treasury,
|
||||
Treasury: treasury::{Module, Call, Storage, Event<T>},
|
||||
Contracts: contracts,
|
||||
Sudo: sudo,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user