Skip to content

Commit

Permalink
Frontier update for v0.3 (paritytech#103)
Browse files Browse the repository at this point in the history
* Remove optional node arguments for limiting past events

* `pallet_evm` now uses smart pointers for error handling

* Update runtime

* Update service Rpc handler

* Update dependencies

* Add tests websocket provider

* Fix existing tests fields

* Add test subscriptions

* Fix checker

* Prettier format

* Merge branch 'master' into tgmichel-v0.3

* backport test-revert-receipt from frontier paritytech#184

* fixes test setup after merge

* make test-revert-receipt pass

* make test revert receipt pass one more time for good measure 😉

* Add required `unsubscribe` per test step

* Try to make tests work

Co-authored-by: Joshy Orndorff <admin@joshyorndorff.com>
Co-authored-by: Alan Sapede <alan@scg-moonbuild-1.dev.purestake.tech>
  • Loading branch information
3 people authored Nov 11, 2020
1 parent 2b03529 commit 4d9946d
Show file tree
Hide file tree
Showing 20 changed files with 2,002 additions and 1,233 deletions.
1,562 changes: 859 additions & 703 deletions Cargo.lock

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions node/parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ structopt = "0.3.3"
ansi_term = "0.12.1"
serde = { version = "1.0.101", features = ["derive"] }
serde_json = "1.0"
jsonrpc-core = "14.0.3"
jsonrpc-pubsub = "14.0.3"
jsonrpc-core = "14.2.0"
jsonrpc-pubsub = "14.2.0"

# Parachain dependencies
moonbeam-runtime = { path = "../../runtime" }
Expand All @@ -45,7 +45,6 @@ sc-executor = { git = "https://github.com/paritytech/substrate", branch = "rococ
sc-service = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-transaction-graph = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch", version = "0.8.0-rc5" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
Expand All @@ -61,13 +60,13 @@ substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate",
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
evm = { package = "pallet-evm", git = "https://github.com/purestake/substrate", branch = "tgmichel-rococo-branch" }
evm = { package = "pallet-evm", git = "https://github.com/purestake/substrate", branch = "v0.3-hotfixes" }

ethereum = { version = "0.1.0", package = "pallet-ethereum", git = "https://github.com/purestake/frontier", branch = "v0.2-hotfixes" }
ethereum = { version = "0.1.0", package = "pallet-ethereum", git = "https://github.com/purestake/frontier", branch = "v0.3-hotfixes" }

frontier-rpc = { version = "0.1.0", git = "https://github.com/purestake/frontier", branch = "v0.2-hotfixes" }
frontier-rpc-primitives = { version = "0.1.0", git = "https://github.com/purestake/frontier", branch = "v0.2-hotfixes" }
frontier-consensus = { version = "0.1.0", git = "https://github.com/purestake/frontier", branch = "v0.2-hotfixes" }
frontier-rpc = { version = "0.1.0", git = "https://github.com/purestake/frontier", branch = "v0.3-hotfixes" }
frontier-rpc-primitives = { version = "0.1.0", git = "https://github.com/purestake/frontier", branch = "v0.3-hotfixes" }
frontier-consensus = { version = "0.1.0", git = "https://github.com/purestake/frontier", branch = "v0.3-hotfixes" }

# Cumulus dependencies
cumulus-consensus = { git = "https://github.com/paritytech/cumulus", rev = '8a445a425086fc927f946a72b245e829fba200d0' }
Expand Down
15 changes: 0 additions & 15 deletions node/parachain/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,6 @@ pub struct RunCmd {
pub parachain_id: Option<u32>,
}

#[derive(Debug, StructOpt)]
pub struct EthCmd {
/// Number of past blocks allowed for querying ethereum events.
#[structopt(long = "eth-block-limit")]
pub block_limit: Option<u32>,

/// Number of logs allowed for querying ethereum events.
#[structopt(long = "eth-log-limit")]
pub log_limit: Option<u32>,
}


impl std::ops::Deref for RunCmd {
type Target = sc_cli::RunCmd;

Expand All @@ -108,9 +96,6 @@ pub struct Cli {
/// Relaychain arguments
#[structopt(raw = true)]
pub relaychain_args: Vec<String>,

#[structopt(flatten)]
pub eth: EthCmd,
}

#[derive(Debug)]
Expand Down
2 changes: 0 additions & 2 deletions node/parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ pub fn run() -> Result<()> {
polkadot_config,
id,
cli.run.base.validator,
cli.eth.block_limit,
cli.eth.log_limit,
)
.map(|(x, _)| x)
})
Expand Down
21 changes: 4 additions & 17 deletions node/parachain/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use sc_consensus_manual_seal::rpc::{EngineCommand, ManualSeal, ManualSealApi};
use moonbeam_runtime::{Hash, AccountId, Index, opaque::Block, Balance};
use sp_api::ProvideRuntimeApi;
use sp_transaction_pool::TransactionPool;
use sc_transaction_graph::{Pool, ChainApi};
use sp_blockchain::{Error as BlockChainError, HeaderMetadata, HeaderBackend};
use sc_rpc_api::DenyUnsafe;
use sc_client_api::{
Expand All @@ -36,30 +35,24 @@ use sc_network::NetworkService;
use jsonrpc_pubsub::manager::SubscriptionManager;

/// Full client dependencies.
pub struct FullDeps<C, P, A: ChainApi> {
pub struct FullDeps<C, P> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Validated pool access.
pub graph_pool: Arc<Pool<A>>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
/// The Node authority flag
pub is_authority: bool,
/// Number of past blocks allowed for querying ethereum events.
pub eth_block_limit: Option<u32>,
/// Number of logs allowed for querying ethereum events.
pub eth_log_limit: Option<u32>,
/// Network service
pub network: Arc<NetworkService<Block, Hash>>,
/// Manual seal command sink
pub command_sink: Option<futures::channel::mpsc::Sender<EngineCommand<Hash>>>,
}

/// Instantiate all Full RPC extensions.
pub fn create_full<C, P, BE, A>(
deps: FullDeps<C, P, A>,
pub fn create_full<C, P, BE>(
deps: FullDeps<C, P>,
subscription_task_executor: SubscriptionTaskExecutor
) -> jsonrpc_core::IoHandler<sc_rpc::Metadata> where
BE: Backend<Block> + 'static,
Expand All @@ -74,7 +67,6 @@ pub fn create_full<C, P, BE, A>(
C::Api: frontier_rpc_primitives::EthereumRuntimeRPCApi<Block>,
<C::Api as sp_api::ApiErrorExt>::Error: fmt::Debug,
P: TransactionPool<Block=Block> + 'static,
A: ChainApi<Block=Block> + 'static,
{
use substrate_frame_rpc_system::{FullSystem, SystemApi};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
Expand All @@ -84,11 +76,8 @@ pub fn create_full<C, P, BE, A>(
let FullDeps {
client,
pool,
graph_pool,
deny_unsafe,
is_authority,
eth_block_limit,
eth_log_limit,
network,
command_sink
} = deps;
Expand All @@ -102,12 +91,10 @@ pub fn create_full<C, P, BE, A>(
io.extend_with(
EthApiServer::to_delegate(EthApi::new(
client.clone(),
graph_pool.clone(),
pool.clone(),
moonbeam_runtime::TransactionConverter,
network.clone(),
is_authority,
eth_block_limit,
eth_log_limit,
))
);
io.extend_with(
Expand Down
6 changes: 0 additions & 6 deletions node/parachain/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ pub fn new_partial(
moonbeam_runtime::opaque::Block,
Arc<FullClient>,
FullClient,
FullBackend,
>,
>,
sc_service::Error,
Expand Down Expand Up @@ -130,8 +129,6 @@ pub fn run_node(
mut polkadot_config: polkadot_collator::Configuration,
id: polkadot_primitives::v0::Id,
validator: bool,
eth_block_limit: Option<u32>,
eth_log_limit: Option<u32>
) -> sc_service::error::Result<(
TaskManager,
Arc<
Expand Down Expand Up @@ -205,11 +202,8 @@ pub fn run_node(
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: pool.clone(),
graph_pool: pool.pool().clone(),
deny_unsafe,
is_authority,
eth_block_limit,
eth_log_limit,
network: network.clone(),
command_sink: Some(command_sink.clone())
};
Expand Down
Loading

0 comments on commit 4d9946d

Please sign in to comment.