mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Substrate 3.0 (#232)
* Update substrate deps to 3.0.0 and 0.9.0 * Update substrate wasm tools * Fixing errors for 3.0.0 compat * Fixing more errors for 3.0.0 compat * Use MultiAddress for test runtime * Fmt * Fix node test * Pin Funty * Update AccountInfo struct * Add comment about funty pin
This commit is contained in:
@@ -11,35 +11,35 @@ repository = "https://github.com/paritytech/substrate/"
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "1.3.5", default-features = false, features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
|
||||
|
||||
frame-executive = { version = "2.0.0", default-features = false }
|
||||
frame-support = { version = "2.0.0", default-features = false }
|
||||
frame-system = { version = "2.0.0", default-features = false }
|
||||
pallet-aura = { version = "2.0.0", default-features = false }
|
||||
pallet-balances = { version = "2.0.0", default-features = false }
|
||||
pallet-grandpa = { version = "2.0.0", default-features = false }
|
||||
pallet-randomness-collective-flip = { version = "2.0.0", default-features = false }
|
||||
pallet-staking = { version = "2.0.0", default-features = false }
|
||||
pallet-sudo = { version = "2.0.0", default-features = false }
|
||||
pallet-timestamp = { version = "2.0.0", default-features = false }
|
||||
pallet-transaction-payment = { version = "2.0.0", default-features = false }
|
||||
frame-executive = { version = "3.0.0", default-features = false }
|
||||
frame-support = { version = "3.0.0", default-features = false }
|
||||
frame-system = { version = "3.0.0", default-features = false }
|
||||
pallet-aura = { version = "3.0.0", default-features = false }
|
||||
pallet-balances = { version = "3.0.0", default-features = false }
|
||||
pallet-grandpa = { version = "3.0.0", default-features = false }
|
||||
pallet-randomness-collective-flip = { version = "3.0.0", default-features = false }
|
||||
pallet-staking = { version = "3.0.0", default-features = false }
|
||||
pallet-sudo = { version = "3.0.0", default-features = false }
|
||||
pallet-timestamp = { version = "3.0.0", default-features = false }
|
||||
pallet-transaction-payment = { version = "3.0.0", default-features = false }
|
||||
serde = { version = "1.0.116", optional = true, features = ["derive"] }
|
||||
sp-api = { version = "2.0.0", default-features = false }
|
||||
sp-block-builder = { version = "2.0.0", default-features = false }
|
||||
sp-consensus-aura = { version = "0.8.0", default-features = false }
|
||||
sp-core = { version = "2.0.0", default-features = false }
|
||||
sp-inherents = { version = "2.0.0", default-features = false }
|
||||
sp-io = { version = "2.0.0", default-features = false }
|
||||
sp-offchain = { version = "2.0.0", default-features = false }
|
||||
sp-runtime = { version = "2.0.0", default-features = false }
|
||||
sp-session = { version = "2.0.0", default-features = false }
|
||||
sp-std = { version = "2.0.0", default-features = false }
|
||||
sp-transaction-pool = { version = "2.0.0", default-features = false }
|
||||
sp-version = { version = "2.0.0", default-features = false }
|
||||
sp-api = { version = "3.0.0", default-features = false }
|
||||
sp-block-builder = { version = "3.0.0", default-features = false }
|
||||
sp-consensus-aura = { version = "0.9.0", default-features = false }
|
||||
sp-core = { version = "3.0.0", default-features = false }
|
||||
sp-inherents = { version = "3.0.0", default-features = false }
|
||||
sp-io = { version = "3.0.0", default-features = false }
|
||||
sp-offchain = { version = "3.0.0", default-features = false }
|
||||
sp-runtime = { version = "3.0.0", default-features = false }
|
||||
sp-session = { version = "3.0.0", default-features = false }
|
||||
sp-std = { version = "3.0.0", default-features = false }
|
||||
sp-transaction-pool = { version = "3.0.0", default-features = false }
|
||||
sp-version = { version = "3.0.0", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
substrate-wasm-builder-runner = "1.0.6"
|
||||
substrate-wasm-builder = "3.0.0"
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
|
||||
@@ -14,12 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use substrate_wasm_builder_runner::WasmBuilder;
|
||||
use substrate_wasm_builder::WasmBuilder;
|
||||
|
||||
fn main() {
|
||||
WasmBuilder::new()
|
||||
.with_current_project()
|
||||
.with_wasm_builder_from_crates("1.0.11")
|
||||
.export_heap_base()
|
||||
.import_memory()
|
||||
.build()
|
||||
|
||||
@@ -41,12 +41,11 @@ use sp_runtime::{
|
||||
generic,
|
||||
impl_opaque_keys,
|
||||
traits::{
|
||||
AccountIdLookup,
|
||||
BlakeTwo256,
|
||||
Block as BlockT,
|
||||
IdentifyAccount,
|
||||
IdentityLookup,
|
||||
NumberFor,
|
||||
Saturating,
|
||||
Verify,
|
||||
},
|
||||
transaction_validity::{
|
||||
@@ -169,29 +168,32 @@ pub fn native_version() -> NativeVersion {
|
||||
}
|
||||
}
|
||||
|
||||
const AVERAGE_ON_INITIALIZE_WEIGHT: Perbill = Perbill::from_percent(10);
|
||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||
|
||||
parameter_types! {
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
pub const BlockHashCount: BlockNumber = 2400;
|
||||
/// We allow for 2 seconds of compute with a 6 second average block time.
|
||||
pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
|
||||
/// Assume 10% of weight for average on_initialize calls.
|
||||
pub MaximumExtrinsicWeight: Weight =
|
||||
AvailableBlockRatio::get().saturating_sub(AVERAGE_ON_INITIALIZE_WEIGHT)
|
||||
* MaximumBlockWeight::get();
|
||||
pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights
|
||||
::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
|
||||
pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
|
||||
::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
|
||||
pub const SS58Prefix: u8 = 42;
|
||||
}
|
||||
|
||||
impl frame_system::Trait for Runtime {
|
||||
impl frame_system::Config for Runtime {
|
||||
/// The basic call filter to use in dispatchable.
|
||||
type 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 = IdentityLookup<AccountId>;
|
||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||
/// The index type for storing how many extrinsics an account has signed.
|
||||
type Index = Index;
|
||||
/// The index type for blocks.
|
||||
@@ -208,26 +210,14 @@ impl frame_system::Trait for Runtime {
|
||||
type Origin = Origin;
|
||||
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
|
||||
type BlockHashCount = BlockHashCount;
|
||||
/// Maximum weight of each block.
|
||||
type MaximumBlockWeight = MaximumBlockWeight;
|
||||
/// The weight of database operations that the runtime can invoke.
|
||||
type DbWeight = RocksDbWeight;
|
||||
/// The weight of the overhead invoked on the block import process, independent of the
|
||||
/// extrinsics included in that block.
|
||||
type BlockExecutionWeight = BlockExecutionWeight;
|
||||
/// The base weight of any extrinsic processed by the runtime, independent of the
|
||||
/// logic of that extrinsic. (Signature verification, nonce increment, fee, etc...)
|
||||
type ExtrinsicBaseWeight = ExtrinsicBaseWeight;
|
||||
/// The maximum weight that a single extrinsic of `Normal` dispatch class can have,
|
||||
/// idependent of the logic of that extrinsics. (Roughly max block weight - average on
|
||||
/// initialize cost).
|
||||
type MaximumExtrinsicWeight = MaximumExtrinsicWeight;
|
||||
/// Maximum size of all encoded transactions (in bytes) that are allowed in one block.
|
||||
type MaximumBlockLength = MaximumBlockLength;
|
||||
/// Portion of the block weight that is available to all normal transactions.
|
||||
type AvailableBlockRatio = AvailableBlockRatio;
|
||||
/// 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.
|
||||
@@ -236,15 +226,15 @@ impl frame_system::Trait for Runtime {
|
||||
type AccountData = pallet_balances::AccountData<Balance>;
|
||||
/// Weight information for the extrinsics of this pallet.
|
||||
type SystemWeightInfo = ();
|
||||
/// Provides information about the pallet setup in the runtime.
|
||||
type PalletInfo = PalletInfo;
|
||||
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
|
||||
type SS58Prefix = SS58Prefix;
|
||||
}
|
||||
|
||||
impl pallet_aura::Trait for Runtime {
|
||||
impl pallet_aura::Config for Runtime {
|
||||
type AuthorityId = AuraId;
|
||||
}
|
||||
|
||||
impl pallet_grandpa::Trait for Runtime {
|
||||
impl pallet_grandpa::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
|
||||
@@ -266,7 +256,7 @@ parameter_types! {
|
||||
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
||||
}
|
||||
|
||||
impl pallet_timestamp::Trait for Runtime {
|
||||
impl pallet_timestamp::Config for Runtime {
|
||||
/// A timestamp: milliseconds since the unix epoch.
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = Aura;
|
||||
@@ -278,7 +268,7 @@ parameter_types! {
|
||||
pub const ExistentialDeposit: u128 = 500;
|
||||
}
|
||||
|
||||
impl pallet_balances::Trait for Runtime {
|
||||
impl pallet_balances::Config for Runtime {
|
||||
/// The type for recording an account's balance.
|
||||
type Balance = Balance;
|
||||
/// The ubiquitous event type.
|
||||
@@ -294,15 +284,14 @@ parameter_types! {
|
||||
pub const TransactionByteFee: Balance = 1;
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment::Trait for Runtime {
|
||||
type Currency = pallet_balances::Module<Runtime>;
|
||||
type OnTransactionPayment = ();
|
||||
impl pallet_transaction_payment::Config for Runtime {
|
||||
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
|
||||
type TransactionByteFee = TransactionByteFee;
|
||||
type WeightToFee = IdentityFee<Balance>;
|
||||
type FeeMultiplierUpdate = ();
|
||||
}
|
||||
|
||||
impl pallet_sudo::Trait for Runtime {
|
||||
impl pallet_sudo::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
}
|
||||
@@ -316,7 +305,7 @@ construct_runtime!(
|
||||
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
||||
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
|
||||
Aura: pallet_aura::{Module, Config<T>, Inherent},
|
||||
Aura: pallet_aura::{Module, Config<T>},
|
||||
Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},
|
||||
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
|
||||
TransactionPayment: pallet_transaction_payment::{Module, Storage},
|
||||
@@ -325,7 +314,7 @@ construct_runtime!(
|
||||
);
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = AccountId;
|
||||
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||
/// Block header type as expected by this runtime.
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
/// Block type as expected by this runtime.
|
||||
|
||||
Reference in New Issue
Block a user