Skip to content

Commit

Permalink
Progress 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinonard committed Jul 17, 2023
1 parent e9d5c0c commit 694d11a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 32 deletions.
11 changes: 8 additions & 3 deletions bin/collator/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

use fc_rpc::{
Eth, EthApiServer, EthBlockDataCacheTask, EthFilter, EthFilterApiServer, EthPubSub,
EthPubSubApiServer, Net, NetApiServer, OverrideHandle, Web3, Web3ApiServer,
EthPubSubApiServer, Net, NetApiServer, OverrideHandle, TxPool, TxPoolApiServer, Web3,
Web3ApiServer,
};
use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
use jsonrpsee::RpcModule;
Expand All @@ -45,6 +46,7 @@ use substrate_frame_rpc_system::{System, SystemApiServer};
use moonbeam_rpc_debug::{Debug, DebugServer};
#[cfg(feature = "evm-tracing")]
use moonbeam_rpc_trace::{Trace, TraceServer};
// TODO: get rid of this completely now that it's part of frontier?
#[cfg(feature = "evm-tracing")]
use moonbeam_rpc_txpool::{TxPool, TxPoolServer};

Expand Down Expand Up @@ -142,8 +144,8 @@ where
C: sc_client_api::BlockBackend<Block>,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ fp_rpc::ConvertTransactionRuntimeApi<Block>
+ fp_rpc::EthereumRuntimeRPCApi<Block>
+ ConvertTransactionRuntimeApi<Block>
+ EthereumRuntimeRPCApi<Block>
+ BlockBuilder<Block>
+ moonbeam_rpc_primitives_debug::DebugRuntimeApi<Block>
+ moonbeam_rpc_primitives_txpool::TxPoolRuntimeApi<Block>,
Expand Down Expand Up @@ -300,10 +302,12 @@ where

let max_past_logs: u32 = 10_000;
let max_stored_filters: usize = 500;
let tx_pool = TxPool::new(client.clone(), graph);
io.merge(
EthFilter::new(
client.clone(),
frontier_backend,
tx_pool.clone(),
filter_pool,
max_stored_filters,
max_past_logs,
Expand All @@ -327,6 +331,7 @@ where
)
.into_rpc(),
)?;
io.merge(tx_pool.into_rpc())?;

Ok(io)
}
2 changes: 1 addition & 1 deletion pallets/contracts-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ pub mod pallet {
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), &'static str> {
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
for value in CodeStorage::<T>::iter_values() {
ensure!(
value.determinism == Determinism::Enforced,
Expand Down
2 changes: 1 addition & 1 deletion pallets/pallet-xcm/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub mod v1 {
pub struct MigrateToV1<T>(sp_std::marker::PhantomData<T>);
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<sp_std::vec::Vec<u8>, &'static str> {
fn pre_upgrade() -> Result<sp_std::vec::Vec<u8>, sp_runtime::TryRuntimeError> {
ensure!(
StorageVersion::get::<Pallet<T>>() == 0,
"must upgrade linearly"
Expand Down
4 changes: 2 additions & 2 deletions pallets/xc-asset-config/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ impl<T: Config> OnRuntimeUpgrade for MigrationXcmV3<T> {
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
assert!(Pallet::<T>::on_chain_storage_version() < 2);
let id_to_location_entries: Vec<_> = AssetIdToLocation::<T>::iter().collect();

Ok(id_to_location_entries.encode())
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), &'static str> {
fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
assert_eq!(Pallet::<T>::on_chain_storage_version(), 2);

use xcm::VersionedMultiLocation;
Expand Down
26 changes: 1 addition & 25 deletions runtime/astar/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use frame_support::{
parameter_types,
traits::{
AsEnsureOriginWithArg, ConstBool, ConstU32, Contains, Currency, FindAuthor, Get, Imbalance,
InstanceFilter, Nothing, OnUnbalanced, Randomness, WithdrawReasons,
InstanceFilter, Nothing, OnFinalize, OnUnbalanced, Randomness, WithdrawReasons,
},
weights::{
constants::{
Expand Down Expand Up @@ -1094,30 +1094,6 @@ type EventRecord = frame_system::EventRecord<
<Runtime as frame_system::Config>::Hash,
>;

use frame_support::pallet_prelude::*;
pub struct PalletContractsV9<T: pallet_contracts::Config>(PhantomData<T>);
impl<T: pallet_contracts::Config> frame_support::traits::OnRuntimeUpgrade for PalletContractsV9<T> {
fn on_runtime_upgrade() -> Weight {
let version = <pallet_contracts::Pallet<T>>::on_chain_storage_version();

if version >= 9 {
return T::DbWeight::get().reads(1);
}

StorageVersion::new(9).put::<pallet_contracts::Pallet<T>>();
T::DbWeight::get().reads_writes(1, 1)
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), &'static str> {
ensure!(
<pallet_contracts::Pallet<T>>::on_chain_storage_version() == 9,
"pallet-contracts storage version must be 9 at the end of migration"
);
Ok(())
}
}

impl fp_self_contained::SelfContainedCall for RuntimeCall {
type SignedInfo = H160;

Expand Down

0 comments on commit 694d11a

Please sign in to comment.