Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

7 changes: 5 additions & 2 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use sr_primitives::{
use sr_primitives::traits::{
NumberFor, BlakeTwo256, Block as BlockT, StaticLookup, Verify, ConvertInto, IdentifyAccount
};
use sr_primitives::weights::Weight;
use sr_api::impl_runtime_apis;
use aura_primitives::sr25519::AuthorityId as AuraId;
use grandpa::AuthorityList as GrandpaAuthorityList;
Expand All @@ -32,7 +31,11 @@ pub use sr_primitives::BuildStorage;
pub use timestamp::Call as TimestampCall;
pub use balances::Call as BalancesCall;
pub use sr_primitives::{Permill, Perbill};
pub use support::{StorageValue, construct_runtime, parameter_types, traits::Randomness};
pub use support::{
StorageValue, construct_runtime, parameter_types,
traits::Randomness,
weights::Weight,
};

/// An index to a block.
pub type BlockNumber = u32;
Expand Down
4 changes: 2 additions & 2 deletions bin/node-template/runtime/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ mod tests {
use super::*;

use primitives::H256;
use support::{impl_outer_origin, assert_ok, parameter_types};
use support::{impl_outer_origin, assert_ok, parameter_types, weights::Weight};
use sr_primitives::{
traits::{BlakeTwo256, IdentityLookup}, testing::Header, weights::Weight, Perbill,
traits::{BlakeTwo256, IdentityLookup}, testing::Header, Perbill,
};

impl_outer_origin! {
Expand Down
8 changes: 6 additions & 2 deletions bin/node/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ mod tests {
use super::Executor;
use {balances, contracts, indices, system, timestamp};
use codec::{Encode, Decode, Joiner};
use runtime_support::{Hashable, StorageValue, StorageMap, traits::Currency};
use runtime_support::{
Hashable, StorageValue, StorageMap,
traits::Currency,
weights::GetDispatchInfo,
};
use state_machine::TestExternalities as CoreTestExternalities;
use primitives::{
Blake2Hasher, NeverNativeValue, NativeOrEncoded, map,
Expand All @@ -43,7 +47,7 @@ mod tests {
use sr_primitives::{
Fixed64,
traits::{Header as HeaderT, Hash as HashT, Convert}, ApplyResult,
transaction_validity::InvalidTransaction, weights::GetDispatchInfo,
transaction_validity::InvalidTransaction,
};
use contracts::ContractAddressFor;
use substrate_executor::{NativeExecutor, WasmExecutionMethod};
Expand Down
5 changes: 2 additions & 3 deletions bin/node/runtime/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
//! Some configurable implementations as associated type for the substrate runtime.

use node_primitives::Balance;
use sr_primitives::weights::Weight;
use sr_primitives::traits::{Convert, Saturating};
use sr_primitives::{Fixed64, Perbill};
use support::traits::{OnUnbalanced, Currency, Get};
use support::{traits::{OnUnbalanced, Currency, Get}, weights::Weight};
use crate::{Balances, System, Authorship, MaximumBlockWeight, NegativeImbalance};

pub struct Author;
Expand Down Expand Up @@ -116,10 +115,10 @@ impl<T: Get<Perbill>> Convert<Fixed64, Fixed64> for TargetedFeeAdjustment<T> {
#[cfg(test)]
mod tests {
use super::*;
use sr_primitives::weights::Weight;
use sr_primitives::assert_eq_error_rate;
use crate::{MaximumBlockWeight, AvailableBlockRatio, Runtime};
use crate::{constants::currency::*, TransactionPayment, TargetBlockFullness};
use support::weights::Weight;

fn max() -> Weight {
MaximumBlockWeight::get()
Expand Down
7 changes: 4 additions & 3 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@

use rstd::prelude::*;
use support::{
construct_runtime, parameter_types, traits::{SplitTwoWays, Currency, Randomness}
construct_runtime, parameter_types,
weights::Weight,
traits::{SplitTwoWays, Currency, Randomness},
};
use primitives::u32_trait::{_1, _2, _3, _4};
use node_primitives::{AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, Moment, Signature};
use sr_api::impl_runtime_apis;
use sr_primitives::{Permill, Perbill, ApplyResult, impl_opaque_keys, generic, create_runtime_str};
use sr_primitives::curve::PiecewiseLinear;
use sr_primitives::transaction_validity::TransactionValidity;
use sr_primitives::weights::Weight;
use sr_primitives::traits::{
self, BlakeTwo256, Block as BlockT, NumberFor, StaticLookup, SaturatedConversion,
OpaqueKeys,
Expand Down Expand Up @@ -732,7 +733,7 @@ mod tests {

#[test]
fn block_hooks_weight_should_not_exceed_limits() {
use sr_primitives::weights::WeighBlock;
use support::weights::WeighBlock;
let check_for_block = |b| {
let block_hooks_weight =
<AllModules as WeighBlock<BlockNumber>>::on_initialize(b) +
Expand Down
2 changes: 1 addition & 1 deletion paint/authorship/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use support::dispatch::Result as DispatchResult;
use codec::{Encode, Decode};
use system::ensure_none;
use sr_primitives::traits::{Header as HeaderT, One, Zero};
use sr_primitives::weights::SimpleDispatchInfo;
use support::weights::SimpleDispatchInfo;
use inherents::{InherentIdentifier, ProvideInherent, InherentData, MakeFatalError};

/// The identifier for the `uncles` inherent.
Expand Down
2 changes: 1 addition & 1 deletion paint/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ use support::{
WithdrawReason, WithdrawReasons, LockIdentifier, LockableCurrency, ExistenceRequirement,
Imbalance, SignedImbalance, ReservableCurrency, Get,
},
weights::SimpleDispatchInfo,
dispatch::Result,
};
use sr_primitives::{
Expand All @@ -165,7 +166,6 @@ use sr_primitives::{
Zero, SimpleArithmetic, StaticLookup, Member, CheckedAdd, CheckedSub, MaybeSerializeDeserialize,
Saturating, Bounded,
},
weights::SimpleDispatchInfo,
};
use system::{IsDeadAccount, OnNewAccount, ensure_signed, ensure_root};

Expand Down
4 changes: 2 additions & 2 deletions paint/balances/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

#![cfg(test)]

use sr_primitives::{Perbill, traits::{ConvertInto, IdentityLookup}, testing::Header,
weights::{DispatchInfo, Weight}};
use sr_primitives::{Perbill, traits::{ConvertInto, IdentityLookup}, testing::Header};
use primitives::H256;
use runtime_io;
use support::{impl_outer_origin, parameter_types};
use support::traits::Get;
use support::weights::{Weight, DispatchInfo};
use std::cell::RefCell;
use crate::{GenesisConfig, Module, Trait};

Expand Down
2 changes: 1 addition & 1 deletion paint/collective/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use rstd::{prelude::*, result};
use primitives::u32_trait::Value as U32;
use sr_primitives::RuntimeDebug;
use sr_primitives::traits::{Hash, EnsureOrigin};
use sr_primitives::weights::SimpleDispatchInfo;
use support::weights::SimpleDispatchInfo;
use support::{
dispatch::{Dispatchable, Parameter}, codec::{Encode, Decode},
traits::{ChangeMembers, InitializeMembers}, decl_module, decl_event,
Expand Down
7 changes: 4 additions & 3 deletions paint/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ use codec::{Codec, Encode, Decode};
use runtime_io::hashing::blake2_256;
use sr_primitives::{
traits::{Hash, StaticLookup, Zero, MaybeSerializeDeserialize, Member, SignedExtension},
weights::DispatchInfo,
transaction_validity::{
ValidTransaction, InvalidTransaction, TransactionValidity, TransactionValidityError,
},
Expand All @@ -123,7 +122,8 @@ use sr_primitives::{
use support::dispatch::{Result, Dispatchable};
use support::{
Parameter, decl_module, decl_event, decl_storage, storage::child,
parameter_types, IsSubType
parameter_types, IsSubType,
weights::DispatchInfo,
};
use support::traits::{OnFreeBalanceZero, OnUnbalanced, Currency, Get, Time, Randomness};
use system::{ensure_signed, RawOrigin, ensure_root};
Expand Down Expand Up @@ -1034,6 +1034,7 @@ impl<T: Trait + Send + Sync> SignedExtension for CheckBlockGasLimit<T> {
type AccountId = T::AccountId;
type Call = <T as Trait>::Call;
type AdditionalSigned = ();
type Info = DispatchInfo;
Comment thread
kianenigma marked this conversation as resolved.
Outdated
type Pre = ();

fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) }
Expand All @@ -1042,7 +1043,7 @@ impl<T: Trait + Send + Sync> SignedExtension for CheckBlockGasLimit<T> {
&self,
_: &Self::AccountId,
call: &Self::Call,
_: DispatchInfo,
_: Self::Info,
_: usize,
) -> TransactionValidity {
let call = match call.is_sub_type() {
Expand Down
2 changes: 1 addition & 1 deletion paint/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ use codec::{Decode, Encode, KeyedVec};
use sr_primitives::{
Perbill, BuildStorage, transaction_validity::{InvalidTransaction, ValidTransaction},
traits::{BlakeTwo256, Hash, IdentityLookup, SignedExtension},
weights::{DispatchInfo, DispatchClass},
testing::{Digest, DigestItem, Header, UintAuthorityId, H256},
};
use support::{
assert_ok, assert_err, impl_outer_dispatch, impl_outer_event, impl_outer_origin, parameter_types,
storage::child, StorageMap, StorageValue, traits::{Currency, Get},
weights::{DispatchInfo, DispatchClass},
};
use std::{cell::RefCell, sync::atomic::{AtomicUsize, Ordering}};
use primitives::storage::well_known_keys;
Expand Down
2 changes: 1 addition & 1 deletion paint/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ use rstd::{result, convert::TryFrom};
use sr_primitives::{
RuntimeDebug,
traits::{Zero, Bounded, CheckedMul, CheckedDiv, EnsureOrigin, Hash, Dispatchable},
weights::SimpleDispatchInfo,
};
use codec::{Ref, Encode, Decode, Input, Output, Error};
use support::{
decl_module, decl_storage, decl_event, ensure,
Parameter,
weights::SimpleDispatchInfo,
traits::{
Currency, ReservableCurrency, LockableCurrency, WithdrawReason, LockIdentifier, Get,
OnFreeBalanceZero
Expand Down
4 changes: 2 additions & 2 deletions paint/elections-phragmen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2018"
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
sr-primitives = { path = "../../primitives/sr-primitives", default-features = false }
phragmen = { package = "substrate-phragmen", path = "../../primitives/phragmen", default-features = false }
paint-support = { path = "../support", default-features = false }
support = { package = "paint-support", path = "../support", default-features = false }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as soon as names are settled, one should make a PR and unify all of such imports.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we no longer want to do renames?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, but see my note:

as soon as names are settled, one should make a PR and unify all of such imports.

at least now that almost everywhere we use paint-support as support, having consistency is better IMO + makes sed-ing much easier. As mentioned, I'm more than happy to kill all of these as soon as we are done with paint -> palette.

system = { package = "paint-system", path = "../system", default-features = false }
rstd = { package = "sr-std", path = "../../primitives/sr-std", default-features = false }

Expand All @@ -23,7 +23,7 @@ serde = { version = "1.0.101" }
default = ["std"]
std = [
"codec/std",
"paint-support/std",
"support/std",
"sr-primitives/std",
"phragmen/std",
"system/std",
Expand Down
10 changes: 5 additions & 5 deletions paint/elections-phragmen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
use rstd::prelude::*;
use codec::Decode;
use sr_primitives::{print, traits::{Zero, StaticLookup, Bounded, Convert}};
use sr_primitives::weights::SimpleDispatchInfo;
use paint_support::{
use support::weights::SimpleDispatchInfo;
use support::{
decl_storage, decl_event, ensure, decl_module, dispatch,
storage::unhashed,
traits::{
Expand Down Expand Up @@ -667,7 +667,7 @@ impl<T: Trait> Module<T> {
mod tests {
use super::*;
use std::cell::RefCell;
use paint_support::{assert_ok, assert_noop, parameter_types, assert_eq_uvec};
use support::{assert_ok, assert_noop, parameter_types, assert_eq_uvec};
use primitives::H256;
use sr_primitives::{
Perbill, testing::Header, BuildStorage,
Expand Down Expand Up @@ -783,7 +783,7 @@ mod tests {
pub type Block = sr_primitives::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sr_primitives::generic::UncheckedExtrinsic<u32, u64, Call, ()>;

paint_support::construct_runtime!(
support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
Expand Down Expand Up @@ -863,7 +863,7 @@ mod tests {
#[test]
fn temp_migration_works() {
ExtBuilder::default().build().execute_with(|| {
use paint_support::storage::unhashed;
use support::storage::unhashed;
use codec::Encode;

let old_members = vec![1u64, 2];
Expand Down
2 changes: 1 addition & 1 deletion paint/elections/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ use sr_primitives::{
RuntimeDebug,
print,
traits::{Zero, One, StaticLookup, Bounded, Saturating},
weights::SimpleDispatchInfo,
};
use support::{
dispatch::Result, decl_storage, decl_event, ensure, decl_module,
weights::SimpleDispatchInfo,
traits::{
Currency, ExistenceRequirement, Get, LockableCurrency, LockIdentifier,
OnUnbalanced, ReservableCurrency, WithdrawReason, WithdrawReasons, ChangeMembers
Expand Down
2 changes: 1 addition & 1 deletion paint/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use support::{dispatch::Result, decl_module, decl_storage, decl_event};
use support::traits::{Currency, WithdrawReason, ExistenceRequirement};
use system::ensure_signed;
use sr_primitives::ModuleId;
use sr_primitives::weights::SimpleDispatchInfo;
use support::weights::SimpleDispatchInfo;
use sr_primitives::traits::{UniqueSaturatedInto, AccountIdConversion};
use primitives::{U256, H256, H160};
use evm::{ExitReason, ExitSucceed, ExitError};
Expand Down
13 changes: 8 additions & 5 deletions paint/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,14 @@
#![cfg_attr(not(feature = "std"), no_std)]

use rstd::marker::PhantomData;
use support::{dispatch::Result, decl_module, decl_storage, decl_event};
use support::{
dispatch::Result, decl_module, decl_storage, decl_event,
weights::{SimpleDispatchInfo, DispatchInfo, DispatchClass, ClassifyDispatch, WeighData, Weight},
};
use system::{ensure_signed, ensure_root};
use codec::{Encode, Decode};
use sr_primitives::{
traits::{SignedExtension, Bounded, SaturatedConversion},
weights::{SimpleDispatchInfo, DispatchInfo, DispatchClass, ClassifyDispatch, WeighData, Weight},
transaction_validity::{
ValidTransaction, TransactionValidityError, InvalidTransaction, TransactionValidity,
},
Expand Down Expand Up @@ -602,6 +604,7 @@ impl<T: Trait + Send + Sync> SignedExtension for WatchDummy<T> {
// other modules.
type Call = Call<T>;
type AdditionalSigned = ();
type Info = DispatchInfo;
type Pre = ();

fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) }
Expand All @@ -610,7 +613,7 @@ impl<T: Trait + Send + Sync> SignedExtension for WatchDummy<T> {
&self,
_who: &Self::AccountId,
call: &Self::Call,
_info: DispatchInfo,
_info: Self::Info,
len: usize,
) -> TransactionValidity {
// if the transaction is too big, just drop it.
Expand All @@ -636,12 +639,12 @@ impl<T: Trait + Send + Sync> SignedExtension for WatchDummy<T> {
mod tests {
use super::*;

use support::{assert_ok, impl_outer_origin, parameter_types};
use support::{assert_ok, impl_outer_origin, parameter_types, weights::GetDispatchInfo};
use primitives::H256;
// The testing primitives are very useful for avoiding having to work with signatures
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are required.
use sr_primitives::{
Perbill, weights::GetDispatchInfo, testing::Header,
Perbill, testing::Header,
traits::{BlakeTwo256, OnInitialize, OnFinalize, IdentityLookup},
};

Expand Down
Loading