git.delta.rocks / unique-network / refs/commits / 37e76bc01ac1

difftreelog

fix make runtime build on 0.9.42

Yaroslav Bolyukin2023-05-22parent: #6f7886b.patch.diff
in: master

11 files changed

modifiedCargo.lockdiffbeforeafterboth
13701dependencies = [13701dependencies = [
13702 "app-promotion-rpc",13702 "app-promotion-rpc",
13703 "fc-db",13703 "fc-db",
13704 "fc-mapping-sync",
13704 "fc-rpc",13705 "fc-rpc",
13705 "fc-rpc-core",13706 "fc-rpc-core",
13706 "fp-rpc",13707 "fp-rpc",
modifiedruntime/common/config/ethereum.rsdiffbeforeafterboth
4 traits::{FindAuthor},4 traits::{FindAuthor},
5 parameter_types, ConsensusEngineId,5 parameter_types, ConsensusEngineId,
6};6};
7use sp_runtime::{RuntimeAppPublic, Perbill};7use sp_runtime::{RuntimeAppPublic, Perbill, traits::ConstU32};
8use crate::{8use crate::{
9 runtime_common::{9 runtime_common::{
10 config::sponsoring::DefaultSponsoringRateLimit,10 config::sponsoring::DefaultSponsoringRateLimit,
84 type OnChargeTransaction = pallet_evm::EVMCurrencyAdapter<Balances, DealWithFees>;84 type OnChargeTransaction = pallet_evm::EVMCurrencyAdapter<Balances, DealWithFees>;
85 type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;85 type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;
86 type FindAuthor = EthereumFindAuthor<Aura>;86 type FindAuthor = EthereumFindAuthor<Aura>;
87 type Timestamp = crate::Timestamp;
88 type WeightInfo = pallet_evm::weights::SubstrateWeight<Self>;
87}89}
8890
89impl pallet_evm_migration::Config for Runtime {91impl pallet_evm_migration::Config for Runtime {
99 type RuntimeEvent = RuntimeEvent;101 type RuntimeEvent = RuntimeEvent;
100 type StateRoot = pallet_ethereum::IntermediateStateRoot<Self>;102 type StateRoot = pallet_ethereum::IntermediateStateRoot<Self>;
101 type PostLogContent = PostBlockAndTxnHashes;103 type PostLogContent = PostBlockAndTxnHashes;
104 // Space for revert reason. Ethereum transactions are not cheap, and overall size is much less
105 // than the substrate tx size, so we can afford this
106 type ExtraDataLength = ConstU32<32>;
102}107}
103108
104parameter_types! {109parameter_types! {
modifiedruntime/common/config/substrate.rsdiffbeforeafterboth
36use pallet_transaction_payment::{Multiplier, ConstFeeMultiplier};36use pallet_transaction_payment::{Multiplier, ConstFeeMultiplier};
37use crate::{37use crate::{
38 runtime_common::DealWithFees, Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, PalletInfo,38 runtime_common::DealWithFees, Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, PalletInfo,
39 System, Balances, Treasury, SS58Prefix, Version,39 System, Balances, SS58Prefix, Version,
40};40};
41use up_common::{types::*, constants::*};41use up_common::{types::*, constants::*};
4242
142 type Balance = Balance;142 type Balance = Balance;
143 /// The ubiquitous event type.143 /// The ubiquitous event type.
144 type RuntimeEvent = RuntimeEvent;144 type RuntimeEvent = RuntimeEvent;
145 // FIXME: Is () the new treasury?
145 type DustRemoval = Treasury;146 type DustRemoval = ();
146 type ExistentialDeposit = ExistentialDeposit;147 type ExistentialDeposit = ExistentialDeposit;
147 type AccountStore = System;148 type AccountStore = System;
148 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;149 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;
150 type HoldIdentifier = [u8; 16];
151 type FreezeIdentifier = [u8; 16];
152 type MaxHolds = ();
153 type MaxFreezes = ();
149}154}
150155
151parameter_types! {156parameter_types! {
modifiedruntime/common/config/xcm/mod.rsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17use frame_support::{17use frame_support::{
18 traits::{Everything, Nothing, Get, ConstU32},18 traits::{Everything, Nothing, Get, ConstU32, ProcessMessageError},
19 parameter_types,19 parameter_types,
20};20};
21use frame_system::EnsureRoot;21use frame_system::EnsureRoot;
114);114);
115115
116pub trait TryPass {116pub trait TryPass {
117<<<<<<< HEAD
118 fn try_pass<Call>(origin: &MultiLocation, message: &mut [Instruction<Call>]) -> Result<(), ()>;
119=======
120 fn try_pass<Call>(117 fn try_pass<Call>(
121 origin: &MultiLocation,118 origin: &MultiLocation,
122 message: &mut [Instruction<Call>],119 message: &mut [Instruction<Call>],
123 ) -> Result<(), ProcessMessageError>;120 ) -> Result<(), ProcessMessageError>;
124>>>>>>> fd33b0ac (fixup pallets)
125}121}
126122
127#[impl_trait_for_tuples::impl_for_tuples(30)]123#[impl_trait_for_tuples::impl_for_tuples(30)]
128impl TryPass for Tuple {124impl TryPass for Tuple {
129<<<<<<< HEAD
130 fn try_pass<Call>(origin: &MultiLocation, message: &mut [Instruction<Call>]) -> Result<(), ()> {
131=======
132 fn try_pass<Call>(125 fn try_pass<Call>(
133 origin: &MultiLocation,126 origin: &MultiLocation,
134 message: &mut [Instruction<Call>],127 message: &mut [Instruction<Call>],
135 ) -> Result<(), ProcessMessageError> {128 ) -> Result<(), ProcessMessageError> {
136>>>>>>> fd33b0ac (fixup pallets)
137 for_tuples!( #(129 for_tuples!( #(
138 Tuple::try_pass(origin, message)?;130 Tuple::try_pass(origin, message)?;
139 )* );131 )* );
159 message: &mut [Instruction<Call>],151 message: &mut [Instruction<Call>],
160 max_weight: Weight,152 max_weight: Weight,
161 weight_credit: &mut Weight,153 weight_credit: &mut Weight,
162 ) -> Result<(), ()> {154 ) -> Result<(), ProcessMessageError> {
163 Deny::try_pass(origin, message)?;155 Deny::try_pass(origin, message)?;
164 Allow::should_execute(origin, message, max_weight, weight_credit)156 Allow::should_execute(origin, message, max_weight, weight_credit)
165 }157 }
227 type SovereignAccountOf = LocationToAccountId;219 type SovereignAccountOf = LocationToAccountId;
228 type MaxLockers = ConstU32<8>;220 type MaxLockers = ConstU32<8>;
229 type WeightInfo = crate::weights::xcm::SubstrateWeight<Runtime>;221 type WeightInfo = crate::weights::xcm::SubstrateWeight<Runtime>;
222 type AdminOrigin = EnsureRoot<AccountId>;
230 #[cfg(feature = "runtime-benchmarks")]223 #[cfg(feature = "runtime-benchmarks")]
231 type ReachableDest = ReachableDest;224 type ReachableDest = ReachableDest;
232}225}
modifiedruntime/common/config/xcm/nativeassets.rsdiffbeforeafterboth
102 for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>102 for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>
103{103{
104 fn new() -> Self {104 fn new() -> Self {
105 // FIXME: benchmark
105 Self(0, Zero::zero(), PhantomData)106 Self(Weight::from_parts(0, 0), Zero::zero(), PhantomData)
106 }107 }
107108
108 fn buy_weight(&mut self, _weight: Weight, payment: Assets) -> Result<Assets, XcmError> {109 fn buy_weight(&mut self, _weight: Weight, payment: Assets) -> Result<Assets, XcmError> {
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
35 ) => {35 ) => {
36 use sp_std::prelude::*;36 use sp_std::prelude::*;
37 use sp_api::impl_runtime_apis;37 use sp_api::impl_runtime_apis;
38 use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160, Bytes};38 use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};
39 use sp_runtime::{39 use sp_runtime::{
40 Permill,40 Permill,
41 traits::Block as BlockT,41 traits::Block as BlockT,
251 OpaqueMetadata::new(Runtime::metadata().into())251 OpaqueMetadata::new(Runtime::metadata().into())
252 }252 }
253
254 fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
255 Runtime::metadata_at_version(version)
256 }
257
258 fn metadata_versions() -> sp_std::vec::Vec<u32> {
259 Runtime::metadata_versions()
260 }
253 }261 }
254262
255 impl sp_block_builder::BlockBuilder<Block> for Runtime {263 impl sp_block_builder::BlockBuilder<Block> for Runtime {
311 fn account_code_at(address: H160) -> Vec<u8> {319 fn account_code_at(address: H160) -> Vec<u8> {
312 use pallet_evm::OnMethodCall;320 use pallet_evm::OnMethodCall;
313 <Runtime as pallet_evm::Config>::OnMethodCall::get_code(&address)321 <Runtime as pallet_evm::Config>::OnMethodCall::get_code(&address)
314 .unwrap_or_else(|| EVM::account_codes(address))322 .unwrap_or_else(|| pallet_evm::AccountCodes::<Runtime>::get(address))
315 }323 }
316324
317 fn author() -> H160 {325 fn author() -> H160 {
321 fn storage_at(address: H160, index: U256) -> H256 {329 fn storage_at(address: H160, index: U256) -> H256 {
322 let mut tmp = [0u8; 32];330 let mut tmp = [0u8; 32];
323 index.to_big_endian(&mut tmp);331 index.to_big_endian(&mut tmp);
324 EVM::account_storages(address, H256::from_slice(&tmp[..]))332 pallet_evm::AccountStorages::<Runtime>::get(address, H256::from_slice(&tmp[..]))
325 }333 }
326334
327 #[allow(clippy::redundant_closure)]335 #[allow(clippy::redundant_closure)]
401 }409 }
402410
403 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {411 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {
404 Ethereum::current_transaction_statuses()412 pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
405 }413 }
406414
407 fn current_block() -> Option<pallet_ethereum::Block> {415 fn current_block() -> Option<pallet_ethereum::Block> {
408 Ethereum::current_block()416 pallet_ethereum::CurrentBlock::<Runtime>::get()
409 }417 }
410418
411 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {419 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {
412 Ethereum::current_receipts()420 pallet_ethereum::CurrentReceipts::<Runtime>::get()
413 }421 }
414422
415 fn current_all() -> (423 fn current_all() -> (
418 Option<Vec<TransactionStatus>>426 Option<Vec<TransactionStatus>>
419 ) {427 ) {
420 (428 (
421 Ethereum::current_block(),429 pallet_ethereum::CurrentBlock::<Runtime>::get(),
422 Ethereum::current_receipts(),430 pallet_ethereum::CurrentReceipts::<Runtime>::get(),
423 Ethereum::current_transaction_statuses()431 pallet_ethereum::CurrentTransactionStatuses::<Runtime>::get()
424 )432 )
425 }433 }
426434
653661
654 impl up_pov_estimate_rpc::PovEstimateApi<Block> for Runtime {662 impl up_pov_estimate_rpc::PovEstimateApi<Block> for Runtime {
655 #[allow(unused_variables)]663 #[allow(unused_variables)]
656 fn pov_estimate(uxt: Bytes) -> ApplyExtrinsicResult {664 fn pov_estimate(uxt: Vec<u8>) -> ApplyExtrinsicResult {
657 #[cfg(feature = "pov-estimate")]665 #[cfg(feature = "pov-estimate")]
658 {666 {
659 use codec::Decode;667 use codec::Decode;
660668
661 let uxt_decode = <<Block as BlockT>::Extrinsic as Decode>::decode(&mut &*uxt)669 let uxt_decode = <<Block as BlockT>::Extrinsic as Decode>::decode(&mut &uxt)
662 .map_err(|_| DispatchError::Other("failed to decode the extrinsic"));670 .map_err(|_| DispatchError::Other("failed to decode the extrinsic"));
663671
664 let uxt = match uxt_decode {672 let uxt = match uxt_decode {
modifiedruntime/common/weights/xcm.rsdiffbeforeafterboth
245 .saturating_add(T::DbWeight::get().writes(4_u64))245 .saturating_add(T::DbWeight::get().writes(4_u64))
246 }246 }
247
248 fn force_suspension() -> Weight {
249 Default::default()
250 }
247}251}
248252
249253
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
220orml-xcm-support = { workspace = true }220orml-xcm-support = { workspace = true }
221pallet-aura = { workspace = true }221pallet-aura = { workspace = true }
222pallet-authorship = { workspace = true }222pallet-authorship = { workspace = true }
223pallet-balances = { workspace = true }223pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
224pallet-preimage = { workspace = true }224pallet-preimage = { workspace = true }
225pallet-session = { workspace = true }225pallet-session = { workspace = true }
226pallet-sudo = { workspace = true }226pallet-sudo = { workspace = true }
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
212orml-xcm-support = { workspace = true }212orml-xcm-support = { workspace = true }
213pallet-aura = { workspace = true }213pallet-aura = { workspace = true }
214pallet-authorship = { workspace = true }214pallet-authorship = { workspace = true }
215pallet-balances = { workspace = true }215pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
216pallet-preimage = { workspace = true }216pallet-preimage = { workspace = true }
217pallet-session = { workspace = true }217pallet-session = { workspace = true }
218pallet-sudo = { workspace = true }218pallet-sudo = { workspace = true }
modifiedruntime/tests/Cargo.tomldiffbeforeafterboth
9refungible = []9refungible = []
1010
11[dependencies]11[dependencies]
12up-data-structs = { default-features = false, path = "../../primitives/data-structs" }12up-data-structs = { workspace = true }
1313
14sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }14sp-core = { workspace = true }
15sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }15sp-io = { workspace = true }
16sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }16sp-runtime = { workspace = true }
17sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }17sp-std = { workspace = true }
1818
19frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }19frame-support = { workspace = true }
20frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }20frame-system = { workspace = true }
2121
22pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }22pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
23pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }23pallet-timestamp = { workspace = true }
24pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }24pallet-transaction-payment = { workspace = true }
2525
26pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }26pallet-ethereum = { workspace = true }
27pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v0.9.42" }27pallet-evm = { workspace = true }
2828
29pallet-common.path = "../../pallets/common"29pallet-common = { workspace = true }
30pallet-fungible.path = "../../pallets/fungible"30pallet-fungible = { workspace = true }
31pallet-nonfungible.path = "../../pallets/nonfungible"31pallet-nonfungible = { workspace = true }
32pallet-refungible.path = "../../pallets/refungible"32pallet-refungible = { workspace = true }
33pallet-structure.path = "../../pallets/structure"33pallet-structure = { workspace = true }
34pallet-unique.path = "../../pallets/unique"34pallet-unique = { workspace = true }
3535
36pallet-evm-coder-substrate.path = "../../pallets/evm-coder-substrate"36pallet-evm-coder-substrate = { workspace = true }
3737
38parity-scale-codec = { version = "3.2.2", default-features = false, features = ["derive"] }38codec = { workspace = true }
39scale-info = "*"39scale-info = { workspace = true }
4040
41evm-coder = { workspace = true }41evm-coder = { workspace = true }
42up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.42" }42up-sponsorship = { workspace = true }
43xcm = { workspace = true }43xcm = { workspace = true }
44pallet-xcm = { workspace = true }44pallet-xcm = { workspace = true }
45pallet-configuration = { workspace = true }45pallet-configuration = { workspace = true }
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
211orml-xcm-support = { workspace = true }211orml-xcm-support = { workspace = true }
212pallet-aura = { workspace = true }212pallet-aura = { workspace = true }
213pallet-authorship = { workspace = true }213pallet-authorship = { workspace = true }
214pallet-balances = { workspace = true }214pallet-balances = { features = ["insecure_zero_ed"], workspace = true }
215pallet-preimage = { workspace = true }215pallet-preimage = { workspace = true }
216pallet-session = { workspace = true }216pallet-session = { workspace = true }
217pallet-sudo = { workspace = true }217pallet-sudo = { workspace = true }