git.delta.rocks / unique-network / refs/commits / 0ee16a462778

difftreelog

feat add PoV estimate

Daniel Shiposha2022-11-21parent: #83762c9.patch.diff
in: master

19 files changed

modifiedCargo.lockdiffbeforeafterboth
5362 "substrate-wasm-builder",5362 "substrate-wasm-builder",
5363 "up-common",5363 "up-common",
5364 "up-data-structs",5364 "up-data-structs",
5365 "up-pov-estimate-rpc",
5365 "up-rpc",5366 "up-rpc",
5366 "up-sponsorship",5367 "up-sponsorship",
5367 "xcm",5368 "xcm",
5806 "sp-runtime",5807 "sp-runtime",
5807 "sp-std",5808 "sp-std",
5808 "up-data-structs",5809 "up-data-structs",
5810 "up-pov-estimate-rpc",
5809]5811]
58105812
5811[[package]]5813[[package]]
8917 "substrate-wasm-builder",8919 "substrate-wasm-builder",
8918 "up-common",8920 "up-common",
8919 "up-data-structs",8921 "up-data-structs",
8922 "up-pov-estimate-rpc",
8920 "up-rpc",8923 "up-rpc",
8921 "up-sponsorship",8924 "up-sponsorship",
8922 "xcm",8925 "xcm",
12824dependencies = [12827dependencies = [
12825 "anyhow",12828 "anyhow",
12826 "app-promotion-rpc",12829 "app-promotion-rpc",
12830 "frame-benchmarking",
12827 "jsonrpsee",12831 "jsonrpsee",
12832 "opal-runtime",
12828 "pallet-common",12833 "pallet-common",
12829 "pallet-evm",12834 "pallet-evm",
12830 "parity-scale-codec 3.2.1",12835 "parity-scale-codec 3.2.1",
12836 "quartz-runtime",
12831 "rmrk-rpc",12837 "rmrk-rpc",
12838 "sc-client-api",
12839 "sc-executor",
12840 "sc-rpc-api",
12841 "sc-service",
12832 "sp-api",12842 "sp-api",
12833 "sp-blockchain",12843 "sp-blockchain",
12834 "sp-core",12844 "sp-core",
12845 "sp-externalities",
12835 "sp-rpc",12846 "sp-rpc",
12836 "sp-runtime",12847 "sp-runtime",
12848 "sp-state-machine",
12849 "unique-runtime",
12850 "up-common",
12837 "up-data-structs",12851 "up-data-structs",
12852 "up-pov-estimate-rpc",
12838 "up-rpc",12853 "up-rpc",
12854 "zstd",
12839]12855]
1284012856
12841[[package]]12857[[package]]
12978 "substrate-prometheus-endpoint",12994 "substrate-prometheus-endpoint",
12979 "tokio",12995 "tokio",
12980 "try-runtime-cli",12996 "try-runtime-cli",
12997 "uc-rpc",
12981 "unique-rpc",12998 "unique-rpc",
12982 "unique-runtime",12999 "unique-runtime",
12983 "up-common",13000 "up-common",
12984 "up-data-structs",13001 "up-data-structs",
13002 "up-pov-estimate-rpc",
12985 "up-rpc",13003 "up-rpc",
12986]13004]
1298713005
13032 "uc-rpc",13050 "uc-rpc",
13033 "up-common",13051 "up-common",
13034 "up-data-structs",13052 "up-data-structs",
13053 "up-pov-estimate-rpc",
13035 "up-rpc",13054 "up-rpc",
13036]13055]
1303713056
13125 "substrate-wasm-builder",13144 "substrate-wasm-builder",
13126 "up-common",13145 "up-common",
13127 "up-data-structs",13146 "up-data-structs",
13147 "up-pov-estimate-rpc",
13128 "up-rpc",13148 "up-rpc",
13129 "up-sponsorship",13149 "up-sponsorship",
13130 "xcm",13150 "xcm",
13193 "struct-versioning",13213 "struct-versioning",
13194]13214]
13215
13216[[package]]
13217name = "up-pov-estimate-rpc"
13218version = "0.1.0"
13219dependencies = [
13220 "parity-scale-codec 3.2.1",
13221 "scale-info",
13222 "serde",
13223 "sp-api",
13224 "sp-core",
13225 "sp-runtime",
13226 "sp-std",
13227]
1319513228
13196[[package]]13229[[package]]
13197name = "up-rpc"13230name = "up-rpc"
modifiedclient/rpc/Cargo.tomldiffbeforeafterboth
7[dependencies]7[dependencies]
8pallet-common = { default-features = false, path = '../../pallets/common' }8pallet-common = { default-features = false, path = '../../pallets/common' }
9up-data-structs = { default-features = false, path = '../../primitives/data-structs' }9up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
10up-common = { default-features = false, path = '../../primitives/common' }
10up-rpc = { path = "../../primitives/rpc" }11up-rpc = { path = "../../primitives/rpc" }
11app-promotion-rpc = { path = "../../primitives/app_promotion_rpc" }12app-promotion-rpc = { path = "../../primitives/app_promotion_rpc" }
12rmrk-rpc = { path = "../../primitives/rmrk-rpc" }13rmrk-rpc = { path = "../../primitives/rmrk-rpc" }
14up-pov-estimate-rpc = { path = "../../primitives/pov-estimate-rpc", optional = true }
13codec = { package = "parity-scale-codec", version = "3.1.2" }15codec = { package = "parity-scale-codec", version = "3.1.2" }
14jsonrpsee = { version = "0.16.2", features = ["server", "macros"] }16jsonrpsee = { version = "0.16.2", features = ["server", "macros"] }
15anyhow = "1.0.57"17anyhow = "1.0.57"
1618zstd = { version = "0.11.2", default-features = false }
19
20sc-rpc-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
21sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
22sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
23sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
24sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
17sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }25sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
18sp-blockchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }26sp-blockchain = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
19sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }27sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
20sp-rpc = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }28sp-rpc = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
21sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }29sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
22pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }30pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }
31
32frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
33
34sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.36" }
35
36unique-runtime = { path = '../../runtime/unique', optional = true }
37quartz-runtime = { path = '../../runtime/quartz', optional = true }
38opal-runtime = { path = '../../runtime/opal' }
39
40[features]
41pov-estimate = [
42 'up-pov-estimate-rpc',
43 'unique-runtime?/pov-estimate',
44 'quartz-runtime?/pov-estimate',
45 'opal-runtime/pov-estimate',
46]
2347
modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
42pub use app_promotion_unique_rpc::AppPromotionApiServer;42pub use app_promotion_unique_rpc::AppPromotionApiServer;
43pub use rmrk_unique_rpc::RmrkApiServer;43pub use rmrk_unique_rpc::RmrkApiServer;
44
45#[cfg(feature = "pov-estimate")]
46pub mod pov_estimate;
4447
45#[rpc(server)]48#[rpc(server)]
46#[async_trait]49#[async_trait]
420 }423 }
421}424}
422425
426#[macro_export]
423macro_rules! define_struct_for_server_api {427macro_rules! define_struct_for_server_api {
424 ($name:ident) => {428 ($name:ident { $($arg:ident: $arg_ty:ty),+ $(,)? }) => {
425 pub struct $name<C, P> {429 pub struct $name<Client, Block: BlockT> {
426 client: Arc<C>,430 $($arg: $arg_ty),+,
427 _marker: std::marker::PhantomData<P>,431 _marker: std::marker::PhantomData<Block>,
428 }432 }
429433
430 impl<C, P> $name<C, P> {434 impl<Client, Block: BlockT> $name<Client, Block> {
431 pub fn new(client: Arc<C>) -> Self {435 pub fn new($($arg: $arg_ty),+) -> Self {
432 Self {436 Self {
433 client,437 $($arg),+,
434 _marker: Default::default(),438 _marker: Default::default(),
435 }439 }
436 }440 }
437 }441 }
438 };442 };
439}443}
440444
441define_struct_for_server_api!(Unique);445define_struct_for_server_api! {
446 Unique {
447 client: Arc<Client>
448 }
449}
450
442define_struct_for_server_api!(AppPromotion);451define_struct_for_server_api! {
452 AppPromotion {
453 client: Arc<Client>
454 }
455}
456
443define_struct_for_server_api!(Rmrk);457define_struct_for_server_api! {
458 Rmrk {
459 client: Arc<Client>
460 }
461}
444462
445macro_rules! pass_method {463macro_rules! pass_method {
446 (464 (
addedclient/rpc/src/pov_estimate.rsdiffbeforeafterboth

no changes

modifiednode/cli/Cargo.tomldiffbeforeafterboth
319pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }319pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }
320320
321unique-rpc = { default-features = false, path = "../rpc" }321unique-rpc = { default-features = false, path = "../rpc" }
322uc-rpc = { default-features = false, path = "../../client/rpc" }
322app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }323app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }
323rmrk-rpc = { path = "../../primitives/rmrk-rpc" }324rmrk-rpc = { path = "../../primitives/rmrk-rpc" }
325up-pov-estimate-rpc = { path = "../../primitives/pov-estimate-rpc", default-features = false }
324326
325[features]327[features]
326default = ["opal-runtime"]328default = ["opal-runtime"]
339 'try-runtime-cli/try-runtime',341 'try-runtime-cli/try-runtime',
340]342]
341sapphire-runtime = ['opal-runtime', 'opal-runtime/become-sapphire']343sapphire-runtime = ['opal-runtime', 'opal-runtime/become-sapphire']
344pov-estimate = [
345 'unique-runtime?/pov-estimate',
346 'quartz-runtime?/pov-estimate',
347 'opal-runtime/pov-estimate',
348 'uc-rpc/pov-estimate',
349 'unique-rpc/pov-estimate',
350]
342351
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
54#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]54#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]
55pub type DefaultChainSpec = OpalChainSpec;55pub type DefaultChainSpec = OpalChainSpec;
56
57pub enum RuntimeId {
58 #[cfg(feature = "unique-runtime")]
59 Unique,
60
61 #[cfg(feature = "quartz-runtime")]
62 Quartz,
63
64 Opal,
65 Unknown(String),
66}
6756
68#[cfg(not(feature = "unique-runtime"))]57#[cfg(not(feature = "unique-runtime"))]
69/// PARA_ID for Opal/Sapphire/Quartz58/// PARA_ID for Opal/Sapphire/Quartz
modifiednode/cli/src/command.rsdiffbeforeafterboth
33// limitations under the License.33// limitations under the License.
3434
35use crate::{35use crate::{
36 chain_spec::{self, RuntimeId, RuntimeIdentification, ServiceId, ServiceIdentification},36 chain_spec::{self, RuntimeIdentification, ServiceId, ServiceIdentification},
37 cli::{Cli, RelayChainCli, Subcommand},37 cli::{Cli, RelayChainCli, Subcommand},
38 service::{new_partial, start_node, start_dev_node},38 service::{new_partial, start_node, start_dev_node},
39};39};
66use sp_runtime::traits::{AccountIdConversion, Block as BlockT};66use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
67use std::{net::SocketAddr, time::Duration};67use std::{net::SocketAddr, time::Duration};
6868
69use up_common::types::opaque::Block;69use up_common::types::opaque::{Block, RuntimeId};
7070
71macro_rules! no_runtime_err {71macro_rules! no_runtime_err {
72 ($chain_name:expr) => {72 ($runtime_id:expr) => {
73 format!(73 format!(
74 "No runtime valid runtime was found for chain {}",74 "No runtime valid runtime was found for chain {:#?}",
75 $chain_name75 $runtime_id
76 )76 )
77 };77 };
78}78}
94 RuntimeId::Quartz => Box::new(chain_spec::QuartzChainSpec::from_json_file(path)?),94 RuntimeId::Quartz => Box::new(chain_spec::QuartzChainSpec::from_json_file(path)?),
9595
96 RuntimeId::Opal => chain_spec,96 RuntimeId::Opal => chain_spec,
97 RuntimeId::Unknown(chain) => return Err(no_runtime_err!(chain)),97 runtime_id => return Err(no_runtime_err!(runtime_id)),
98 }98 }
99 }99 }
100 })100 })
147 RuntimeId::Quartz => &quartz_runtime::VERSION,147 RuntimeId::Quartz => &quartz_runtime::VERSION,
148148
149 RuntimeId::Opal => &opal_runtime::VERSION,149 RuntimeId::Opal => &opal_runtime::VERSION,
150 RuntimeId::Unknown(chain) => panic!("{}", no_runtime_err!(chain)),150 runtime_id => panic!("{}", no_runtime_err!(runtime_id)),
151 }151 }
152 }152 }
153}153}
235 runner, $components, $cli, $cmd, $config, $( $code )*235 runner, $components, $cli, $cmd, $config, $( $code )*
236 ),236 ),
237237
238 RuntimeId::Unknown(chain) => Err(no_runtime_err!(chain).into())238 runtime_id => Err(no_runtime_err!(runtime_id).into())
239 }239 }
240 }}240 }}
241}241}
274 runner, $components, $cli, $cmd, $config, $( $code )*274 runner, $components, $cli, $cmd, $config, $( $code )*
275 ),275 ),
276276
277 RuntimeId::Unknown(chain) => Err(no_runtime_err!(chain).into())277 runtime_id => Err(no_runtime_err!(runtime_id).into())
278 }278 }
279 }}279 }}
280}280}
302 OpalRuntimeExecutor,302 OpalRuntimeExecutor,
303 >($config $(, $($args),+)?) $($code)*,303 >($config $(, $($args),+)?) $($code)*,
304304
305 RuntimeId::Unknown(chain) => Err(no_runtime_err!(chain).into()),305 runtime_id => Err(no_runtime_err!(runtime_id).into()),
306 }306 }
307 };307 };
308}308}
445 sp_io::SubstrateHostFunctions,445 sp_io::SubstrateHostFunctions,
446 <OpalRuntimeExecutor as NativeExecutionDispatch>::ExtendHostFunctions,446 <OpalRuntimeExecutor as NativeExecutionDispatch>::ExtendHostFunctions,
447 >>()),447 >>()),
448 RuntimeId::Unknown(chain) => return Err(no_runtime_err!(chain).into()),448 runtime_id => return Err(no_runtime_err!(runtime_id).into()),
449 },449 },
450 task_manager,450 task_manager,
451 ))451 ))
modifiednode/cli/src/service.rsdiffbeforeafterboth
66use fc_rpc_core::types::FilterPool;66use fc_rpc_core::types::FilterPool;
67use fc_mapping_sync::{MappingSyncWorker, SyncStrategy};67use fc_mapping_sync::{MappingSyncWorker, SyncStrategy};
6868
69use up_common::types::opaque::{69use up_common::types::opaque::*;
70 AuraId, RuntimeInstance, AccountId, Balance, Index, Hash, Block, BlockNumber,70use crate::chain_spec::RuntimeIdentification;
71};
7271
73// RMRK72// RMRK
74use up_data_structs::{73use up_data_structs::{
412 RmrkBaseInfo<AccountId>,411 RmrkBaseInfo<AccountId>,
413 RmrkPartType,412 RmrkPartType,
414 RmrkTheme,413 RmrkTheme,
415 > + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>414 > + up_pov_estimate_rpc::PovEstimateApi<Block>
415 + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
416 + sp_api::Metadata<Block>416 + sp_api::Metadata<Block>
417 + sp_offchain::OffchainWorkerApi<Block>417 + sp_offchain::OffchainWorkerApi<Block>
517 .for_each(|()| futures::future::ready(())),517 .for_each(|()| futures::future::ready(())),
518 );518 );
519519
520 let rpc_backend = backend.clone();
521 let runtime_id = parachain_config.chain_spec.runtime_id();
520 let rpc_builder = Box::new(move |deny_unsafe, subscription_task_executor| {522 let rpc_builder = Box::new(move |deny_unsafe, subscription_task_executor| {
521 let full_deps = unique_rpc::FullDeps {523 let full_deps = unique_rpc::FullDeps {
524 #[cfg(feature = "pov-estimate")]
525 runtime_id: runtime_id.clone(),
526
527 #[cfg(feature = "pov-estimate")]
528 exec_params: uc_rpc::pov_estimate::ExecutorParams {
529 wasm_method: parachain_config.wasm_method,
530 default_heap_pages: parachain_config.default_heap_pages,
531 max_runtime_instances: parachain_config.max_runtime_instances,
532 runtime_cache_size: parachain_config.runtime_cache_size,
533 },
534
535 #[cfg(feature = "pov-estimate")]
522 backend: rpc_frontier_backend.clone(),536 backend: rpc_backend.clone(),
537
538 eth_backend: rpc_frontier_backend.clone(),
523 deny_unsafe,539 deny_unsafe,
524 client: rpc_client.clone(),540 client: rpc_client.clone(),
525 pool: rpc_pool.clone(),541 pool: rpc_pool.clone(),
720 RmrkBaseInfo<AccountId>,736 RmrkBaseInfo<AccountId>,
721 RmrkPartType,737 RmrkPartType,
722 RmrkTheme,738 RmrkTheme,
723 > + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>739 > + up_pov_estimate_rpc::PovEstimateApi<Block>
740 + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
724 + sp_api::Metadata<Block>741 + sp_api::Metadata<Block>
725 + sp_offchain::OffchainWorkerApi<Block>742 + sp_offchain::OffchainWorkerApi<Block>
869 RmrkBaseInfo<AccountId>,886 RmrkBaseInfo<AccountId>,
870 RmrkPartType,887 RmrkPartType,
871 RmrkTheme,888 RmrkTheme,
872 > + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>889 > + up_pov_estimate_rpc::PovEstimateApi<Block>
890 + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
873 + sp_api::Metadata<Block>891 + sp_api::Metadata<Block>
874 + sp_offchain::OffchainWorkerApi<Block>892 + sp_offchain::OffchainWorkerApi<Block>
1040 let rpc_pool = transaction_pool.clone();1058 let rpc_pool = transaction_pool.clone();
1041 let rpc_network = network.clone();1059 let rpc_network = network.clone();
1042 let rpc_frontier_backend = frontier_backend.clone();1060 let rpc_frontier_backend = frontier_backend.clone();
1061 let rpc_backend = backend.clone();
1062 let runtime_id = config.chain_spec.runtime_id();
1043 let rpc_builder = Box::new(move |deny_unsafe, subscription_executor| {1063 let rpc_builder = Box::new(move |deny_unsafe, subscription_executor| {
1044 let full_deps = unique_rpc::FullDeps {1064 let full_deps = unique_rpc::FullDeps {
1065 #[cfg(feature = "pov-estimate")]
1066 runtime_id: runtime_id.clone(),
1067
1068 #[cfg(feature = "pov-estimate")]
1069 exec_params: uc_rpc::pov_estimate::ExecutorParams {
1070 wasm_method: config.wasm_method,
1071 default_heap_pages: config.default_heap_pages,
1072 max_runtime_instances: config.max_runtime_instances,
1073 runtime_cache_size: config.runtime_cache_size,
1074 },
1075
1076 #[cfg(feature = "pov-estimate")]
1045 backend: rpc_frontier_backend.clone(),1077 backend: rpc_backend.clone(),
1078 eth_backend: rpc_frontier_backend.clone(),
1046 deny_unsafe,1079 deny_unsafe,
1047 client: rpc_client.clone(),1080 client: rpc_client.clone(),
1048 pool: rpc_pool.clone(),1081 pool: rpc_pool.clone(),
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
55up-rpc = { path = "../../primitives/rpc" }55up-rpc = { path = "../../primitives/rpc" }
56app-promotion-rpc = { path = "../../primitives/app_promotion_rpc" }56app-promotion-rpc = { path = "../../primitives/app_promotion_rpc" }
57rmrk-rpc = { path = "../../primitives/rmrk-rpc" }57rmrk-rpc = { path = "../../primitives/rmrk-rpc" }
58up-pov-estimate-rpc = { path = "../../primitives/pov-estimate-rpc" }
58up-data-structs = { default-features = false, path = "../../primitives/data-structs" }59up-data-structs = { default-features = false, path = "../../primitives/data-structs" }
5960
60[dependencies.serde]61[dependencies.serde]
65default = []66default = []
66std = []67std = []
67unique-runtime = []68unique-runtime = []
69pov-estimate = ['uc-rpc/pov-estimate']
6870
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
40use sc_service::TransactionPool;40use sc_service::TransactionPool;
41use std::{collections::BTreeMap, sync::Arc};41use std::{collections::BTreeMap, sync::Arc};
4242
43use up_common::types::opaque::{Hash, AccountId, RuntimeInstance, Index, Block, BlockNumber, Balance};43use up_common::types::opaque::*;
4444
45// RMRK45// RMRK
46use up_data_structs::{46use up_data_structs::{
47 RmrkCollectionInfo, RmrkInstanceInfo, RmrkResourceInfo, RmrkPropertyInfo, RmrkBaseInfo,47 RmrkCollectionInfo, RmrkInstanceInfo, RmrkResourceInfo, RmrkPropertyInfo, RmrkBaseInfo,
48 RmrkPartType, RmrkTheme,48 RmrkPartType, RmrkTheme,
49};49};
50
51type FullBackend = sc_service::TFullBackend<Block>;
5052
51/// Extra dependencies for GRANDPA53/// Extra dependencies for GRANDPA
52pub struct GrandpaDeps<B> {54pub struct GrandpaDeps<B> {
83 /// EthFilterApi pool.85 /// EthFilterApi pool.
84 pub filter_pool: Option<FilterPool>,86 pub filter_pool: Option<FilterPool>,
87
88 #[cfg(feature = "pov-estimate")]
89 pub runtime_id: RuntimeId,
90 /// Executor params for PoV estimating
91 #[cfg(feature = "pov-estimate")]
92 pub exec_params: uc_rpc::pov_estimate::ExecutorParams,
85 /// Backend.93 /// Substrate Backend.
94 #[cfg(feature = "pov-estimate")]
86 pub backend: Arc<fc_db::Backend<Block>>,95 pub backend: Arc<FullBackend>,
96
97 /// Ethereum Backend.
98 pub eth_backend: Arc<fc_db::Backend<Block>>,
87 /// Maximum number of logs in a query.99 /// Maximum number of logs in a query.
88 pub max_past_logs: u32,100 pub max_past_logs: u32,
89 /// Maximum fee history cache size.101 /// Maximum fee history cache size.
162 RmrkPartType,174 RmrkPartType,
163 RmrkTheme,175 RmrkTheme,
164 >,176 >,
177 C::Api: up_pov_estimate_rpc::PovEstimateApi<Block>,
165 B: sc_client_api::Backend<Block> + Send + Sync + 'static,178 B: sc_client_api::Backend<Block> + Send + Sync + 'static,
166 B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,179 B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,
167 P: TransactionPool<Block = Block> + 'static,180 P: TransactionPool<Block = Block> + 'static,
182 #[cfg(not(feature = "unique-runtime"))]195 #[cfg(not(feature = "unique-runtime"))]
183 use uc_rpc::{RmrkApiServer, Rmrk};196 use uc_rpc::{RmrkApiServer, Rmrk};
197
198 #[cfg(feature = "pov-estimate")]
199 use uc_rpc::pov_estimate::{PovEstimateApiServer, PovEstimate};
184200
185 // use pallet_contracts_rpc::{Contracts, ContractsApi};201 // use pallet_contracts_rpc::{Contracts, ContractsApi};
186 use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};202 use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
201 deny_unsafe,217 deny_unsafe,
202 filter_pool,218 filter_pool,
219
220 #[cfg(feature = "pov-estimate")]
221 runtime_id,
222
223 #[cfg(feature = "pov-estimate")]
224 exec_params,
225
226 #[cfg(feature = "pov-estimate")]
203 backend,227 backend,
228
229 eth_backend,
204 max_past_logs,230 max_past_logs,
205 } = deps;231 } = deps;
206232
226 network.clone(),252 network.clone(),
227 signers,253 signers,
228 overrides.clone(),254 overrides.clone(),
229 backend.clone(),255 eth_backend.clone(),
230 is_authority,256 is_authority,
231 block_data_cache.clone(),257 block_data_cache.clone(),
232 fee_history_cache,258 fee_history_cache,
244 #[cfg(not(feature = "unique-runtime"))]270 #[cfg(not(feature = "unique-runtime"))]
245 io.merge(Rmrk::new(client.clone()).into_rpc())?;271 io.merge(Rmrk::new(client.clone()).into_rpc())?;
272
273 #[cfg(feature = "pov-estimate")]
274 io.merge(PovEstimate::new(client.clone(), backend, deny_unsafe, exec_params, runtime_id).into_rpc())?;
246275
247 if let Some(filter_pool) = filter_pool {276 if let Some(filter_pool) = filter_pool {
248 io.merge(277 io.merge(
249 EthFilter::new(278 EthFilter::new(
250 client.clone(),279 client.clone(),
251 backend,280 eth_backend,
252 filter_pool,281 filter_pool,
253 500_usize, // max stored filters282 500_usize, // max stored filters
254 max_past_logs,283 max_past_logs,
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
23evm-coder = { default-features = false, path = '../../crates/evm-coder' }23evm-coder = { default-features = false, path = '../../crates/evm-coder' }
24ethereum = { version = "0.14.0", default-features = false }24ethereum = { version = "0.14.0", default-features = false }
25pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }25pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }
26up-pov-estimate-rpc = { default-features = false, path = "../../primitives/pov-estimate-rpc" }
2627
27serde = { version = "1.0.130", default-features = false }28serde = { version = "1.0.130", default-features = false }
28scale-info = { version = "2.0.1", default-features = false, features = [29scale-info = { version = "2.0.1", default-features = false, features = [
39 "fp-evm-mapping/std",40 "fp-evm-mapping/std",
40 "up-data-structs/std",41 "up-data-structs/std",
41 "pallet-evm/std",42 "pallet-evm/std",
43 "up-pov-estimate-rpc/std",
42]44]
43runtime-benchmarks = [45runtime-benchmarks = [
44 "frame-benchmarking/runtime-benchmarks",46 "frame-benchmarking/runtime-benchmarks",
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
115 RmrkNftChild,115 RmrkNftChild,
116 CollectionPermissions,116 CollectionPermissions,
117};117};
118use up_pov_estimate_rpc::PovInfo;
118119
119pub use pallet::*;120pub use pallet::*;
120use sp_core::H160;121use sp_core::H160;
881 RmrkPartType,882 RmrkPartType,
882 RmrkBoundedTheme,883 RmrkBoundedTheme,
883 RmrkNftChild,884 RmrkNftChild,
885 // PoV Estimate Info
886 PovInfo,
884 )>,887 )>,
885 ),888 ),
886 QueryKind = OptionQuery,889 QueryKind = OptionQuery,
modifiedprimitives/common/src/types.rsdiffbeforeafterboth
2929
30 pub use super::{BlockNumber, Signature, AccountId, Balance, Index, Hash, AuraId};30 pub use super::{BlockNumber, Signature, AccountId, Balance, Index, Hash, AuraId};
31
32 #[derive(Debug, Clone)]
33 pub enum RuntimeId {
34 Unique,
35 Quartz,
36 Opal,
37 Unknown(sp_std::vec::Vec<u8>),
38 }
3139
32 /// Opaque block header type.40 /// Opaque block header type.
33 pub type Header = generic::Header<BlockNumber, BlakeTwo256>;41 pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
addedprimitives/pov-estimate-rpc/Cargo.tomldiffbeforeafterboth

no changes

addedprimitives/pov-estimate-rpc/src/lib.rsdiffbeforeafterboth

no changes

modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
39 use sp_runtime::{39 use sp_runtime::{
40 Permill,40 Permill,
41 traits::Block as BlockT,41 traits::Block as BlockT,
42 transaction_validity::{TransactionSource, TransactionValidity},42 transaction_validity::{TransactionSource, TransactionValidity, TransactionValidityError, InvalidTransaction},
43 ApplyExtrinsicResult, DispatchError,43 ApplyExtrinsicResult, DispatchError,
44 };44 };
45 use fp_rpc::TransactionStatus;45 use fp_rpc::TransactionStatus;
778 }778 }
779 }779 }
780
781 impl up_pov_estimate_rpc::PovEstimateApi<Block> for Runtime {
782 #[allow(unused_variables)]
783 fn pov_estimate(uxt: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
784 #[cfg(feature = "pov-estimate")]
785 return Executive::apply_extrinsic(uxt);
786
787 #[cfg(not(feature = "pov-estimate"))]
788 return Err(TransactionValidityError::Invalid(InvalidTransaction::Call))
789 }
790 }
780791
781 #[cfg(feature = "try-runtime")]792 #[cfg(feature = "try-runtime")]
782 impl frame_try_runtime::TryRuntime<Block> for Runtime {793 impl frame_try_runtime::TryRuntime<Block> for Runtime {
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
127 'pallet-base-fee/std',127 'pallet-base-fee/std',
128 'fp-rpc/std',128 'fp-rpc/std',
129 'up-rpc/std',129 'up-rpc/std',
130 'up-pov-estimate-rpc/std',
130 'app-promotion-rpc/std',131 'app-promotion-rpc/std',
131 'fp-evm-mapping/std',132 'fp-evm-mapping/std',
132 'fp-self-contained/std',133 'fp-self-contained/std',
184 'pallet-test-utils',185 'pallet-test-utils',
185]186]
186become-sapphire = []187become-sapphire = []
188pov-estimate = []
187189
188refungible = []190refungible = []
189scheduler = []191scheduler = []
468derivative = "2.2.0"470derivative = "2.2.0"
469pallet-unique = { path = '../../pallets/unique', default-features = false }471pallet-unique = { path = '../../pallets/unique', default-features = false }
470up-rpc = { path = "../../primitives/rpc", default-features = false }472up-rpc = { path = "../../primitives/rpc", default-features = false }
473up-pov-estimate-rpc = { path = "../../primitives/pov-estimate-rpc", default-features = false }
471app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }474app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }
472rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }475rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
473fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }476fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
122 'pallet-base-fee/std',122 'pallet-base-fee/std',
123 'fp-rpc/std',123 'fp-rpc/std',
124 'up-rpc/std',124 'up-rpc/std',
125 'up-pov-estimate-rpc/std',
125 'app-promotion-rpc/std',126 'app-promotion-rpc/std',
126 'fp-evm-mapping/std',127 'fp-evm-mapping/std',
127 'fp-self-contained/std',128 'fp-self-contained/std',
169]170]
170limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']171limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
171quartz-runtime = ['refungible', 'app-promotion', 'foreign-assets']172quartz-runtime = ['refungible', 'app-promotion', 'foreign-assets']
173pov-estimate = []
172174
173refungible = []175refungible = []
174scheduler = []176scheduler = []
461derivative = "2.2.0"463derivative = "2.2.0"
462pallet-unique = { path = '../../pallets/unique', default-features = false }464pallet-unique = { path = '../../pallets/unique', default-features = false }
463up-rpc = { path = "../../primitives/rpc", default-features = false }465up-rpc = { path = "../../primitives/rpc", default-features = false }
466up-pov-estimate-rpc = { path = "../../primitives/pov-estimate-rpc", default-features = false }
464app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }467app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }
465fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }468fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }
466fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }469fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.36" }
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
123 'pallet-base-fee/std',123 'pallet-base-fee/std',
124 'fp-rpc/std',124 'fp-rpc/std',
125 'up-rpc/std',125 'up-rpc/std',
126 'up-pov-estimate-rpc/std',
126 'app-promotion-rpc/std',127 'app-promotion-rpc/std',
127 'fp-evm-mapping/std',128 'fp-evm-mapping/std',
128 'fp-self-contained/std',129 'fp-self-contained/std',
170]171]
171limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']172limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
172unique-runtime = ['foreign-assets']173unique-runtime = ['foreign-assets']
174pov-estimate = []
173stubgen = ["evm-coder/stubgen"]175stubgen = ["evm-coder/stubgen"]
174176
175refungible = []177refungible = []
454derivative = "2.2.0"456derivative = "2.2.0"
455pallet-unique = { path = '../../pallets/unique', default-features = false }457pallet-unique = { path = '../../pallets/unique', default-features = false }
456up-rpc = { path = "../../primitives/rpc", default-features = false }458up-rpc = { path = "../../primitives/rpc", default-features = false }
459up-pov-estimate-rpc = { path = "../../primitives/pov-estimate-rpc", default-features = false }
457app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }460app-promotion-rpc = { path = "../../primitives/app_promotion_rpc", default-features = false }
458rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }461rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
459pallet-inflation = { path = '../../pallets/inflation', default-features = false }462pallet-inflation = { path = '../../pallets/inflation', default-features = false }