Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,235 changes: 2,001 additions & 2,234 deletions Cargo.lock

Large diffs are not rendered by default.

148 changes: 74 additions & 74 deletions Cargo.toml

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion client/rpc/src/eth/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use ethereum_types::{H256, U256};
use jsonrpsee::core::{async_trait, RpcResult};
// Substrate
use sc_client_api::backend::{Backend, StorageProvider};
use sc_transaction_pool::{ChainApi, Pool};
use sc_transaction_pool::ChainApi;
use sc_transaction_pool_api::InPoolTransaction;
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
Expand All @@ -43,6 +43,8 @@ use fp_rpc::{EthereumRuntimeRPCApi, TransactionStatus};

use crate::{cache::EthBlockDataCacheTask, frontier_backend_client, internal_err};

type Pool<Api> = sc_transaction_pool::Pool<Api, ()>;

pub struct EthFilter<B: BlockT, C, BE, A: ChainApi> {
client: Arc<C>,
backend: Arc<dyn fc_api::Backend<B>>,
Expand Down
3 changes: 2 additions & 1 deletion client/rpc/src/eth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use jsonrpsee::core::{async_trait, RpcResult};
// Substrate
use sc_client_api::backend::{Backend, StorageProvider};
use sc_network_sync::SyncingService;
use sc_transaction_pool::{ChainApi, Pool};
use sc_transaction_pool::ChainApi;
use sc_transaction_pool_api::TransactionPool;
use sp_api::{CallApiAt, ProvideRuntimeApi};
use sp_block_builder::BlockBuilder as BlockBuilderApi;
Expand All @@ -59,6 +59,7 @@ use crate::{

pub use self::{execute::EstimateGasAdapter, filter::EthFilter};

type Pool<Api> = sc_transaction_pool::Pool<Api, ()>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what is this second param for?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! the second param is an EventHandler

// Configuration trait for RPC configuration.
pub trait EthConfig<B: BlockT, C>: Send + Sync + 'static {
type EstimateGasAdapter: EstimateGasAdapter + Send + Sync;
Expand Down
4 changes: 3 additions & 1 deletion client/rpc/src/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use ethereum_types::{H160, H256, U256};
use jsonrpsee::core::RpcResult;
use serde::Serialize;
// substrate
use sc_transaction_pool::{ChainApi, Pool};
use sc_transaction_pool::ChainApi;
use sc_transaction_pool_api::InPoolTransaction;
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
Expand All @@ -38,6 +38,8 @@ use fp_rpc::EthereumRuntimeRPCApi;

use crate::{internal_err, public_key};

type Pool<Api> = sc_transaction_pool::Pool<Api, ()>;

struct TxPoolTransactions {
ready: Vec<EthereumTransaction>,
future: Vec<EthereumTransaction>,
Expand Down
4 changes: 2 additions & 2 deletions frame/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub use ethereum::{
};
use ethereum_types::{Bloom, BloomInput, H160, H256, H64, U256};
use evm::ExitReason;
use scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
// Substrate
use frame_support::{
Expand Down Expand Up @@ -72,7 +72,7 @@ use fp_storage::{EthereumStorageSchema, PALLET_ETHEREUM_SCHEMA};
use pallet_evm::{BlockHashMapping, FeeCalculator, GasWeightMapping, Runner};

#[derive(Clone, Eq, PartialEq, RuntimeDebug)]
#[derive(Encode, Decode, MaxEncodedLen, TypeInfo)]
#[derive(Encode, Decode, DecodeWithMemTracking, MaxEncodedLen, TypeInfo)]
pub enum RawOrigin {
EthereumTransaction(H160),
}
Expand Down
2 changes: 1 addition & 1 deletion frame/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ impl<T: Config> Pallet<T> {
if let Some(caller_address) = caller {
T::CreateInnerOrigin::check_create_origin(&caller_address).map_err(|e| {
let error: &'static str = e.into();
ExitError::Other(Cow::Borrowed(error))
ExitError::Other(Cow::Borrowed(error).into())
})?;
}

Expand Down
8 changes: 8 additions & 0 deletions frame/evm/test-vector-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,21 @@ impl PrecompileHandle for MockHandle {
&self.context
}

fn origin(&self) -> H160 {
unimplemented!()
}

fn is_static(&self) -> bool {
self.is_static
}

fn gas_limit(&self) -> Option<u64> {
self.gas_limit
}

fn is_contract_being_constructed(&self, _address: H160) -> bool {
unimplemented!()
}
}

/// Tests a precompile against the ethereum consensus tests defined in the given file at filepath.
Expand Down
8 changes: 8 additions & 0 deletions precompiles/src/precompile_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@ impl<'a, H: PrecompileHandle> PrecompileHandle for RestrictiveHandle<'a, H> {
self.handle.context()
}

fn origin(&self) -> H160 {
self.handle.origin()
}

fn is_static(&self) -> bool {
self.handle.is_static()
}
Expand All @@ -484,6 +488,10 @@ impl<'a, H: PrecompileHandle> PrecompileHandle for RestrictiveHandle<'a, H> {
fn refund_external_cost(&mut self, ref_time: Option<u64>, proof_size: Option<u64>) {
self.handle.refund_external_cost(ref_time, proof_size)
}

fn is_contract_being_constructed(&self, address: H160) -> bool {
self.handle.is_contract_being_constructed(address)
}
}

/// Allows to know if a precompile is active or not.
Expand Down
9 changes: 9 additions & 0 deletions precompiles/src/testing/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use evm::{ExitRevert, ExitSucceed};
use fp_evm::{Context, ExitError, ExitReason, Log, PrecompileHandle, Transfer};
use sp_core::{H160, H256};

use super::Alice;
#[derive(Debug, Clone)]
pub struct Subcall {
pub address: H160,
Expand Down Expand Up @@ -213,4 +214,12 @@ impl PrecompileHandle for MockHandle {
}

fn refund_external_cost(&mut self, _ref_time: Option<u64>, _proof_size: Option<u64>) {}

fn origin(&self) -> H160 {
Alice.into()
}

fn is_contract_being_constructed(&self, _address: H160) -> bool {
false
}
}
13 changes: 10 additions & 3 deletions primitives/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern crate alloc;
use alloc::string::{String, ToString};
use core::fmt;

use scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
// Substrate
use sp_core::{crypto::AccountId32, ecdsa, RuntimeDebug, H160, H256};
Expand All @@ -38,7 +38,7 @@ use xcm::latest::{Junction, Location};
/// Conforms to H160 address and ECDSA key standards.
/// Alternative to H256->H160 mapping.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Default, Hash)]
#[derive(Encode, Decode, MaxEncodedLen, TypeInfo)]
#[derive(Encode, Decode, DecodeWithMemTracking, MaxEncodedLen, TypeInfo)]
pub struct AccountId20(pub [u8; 20]);

#[cfg(feature = "serde")]
Expand Down Expand Up @@ -186,7 +186,14 @@ impl From<AccountId20> for Location {
}

#[derive(Clone, Eq, PartialEq)]
#[derive(RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)]
#[derive(
RuntimeDebug,
Encode,
Decode,
DecodeWithMemTracking,
MaxEncodedLen,
TypeInfo
)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct EthereumSignature(ecdsa::Signature);

Expand Down
13 changes: 11 additions & 2 deletions primitives/self-contained/src/unchecked_extrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use frame_support::{
dispatch::{DispatchInfo, GetDispatchInfo},
traits::{ExtrinsicCall, InherentBuilder, SignedTransactionBuilder},
};
use scale_codec::{Decode, Encode};
use scale_codec::{Decode, Encode, DecodeWithMemTracking};
use scale_info::TypeInfo;
use sp_runtime::{
generic::{self, Preamble},
Expand All @@ -35,7 +35,16 @@ use crate::{CheckedExtrinsic, CheckedSignature, SelfContainedCall};

/// A extrinsic right from the external world. This is unchecked and so
/// can contain a signature.
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(
PartialEq,
Eq,
Clone,
Encode,
Decode,
DecodeWithMemTracking,
RuntimeDebug,
TypeInfo
)]
pub struct UncheckedExtrinsic<Address, Call, Signature, Extension>(
pub generic::UncheckedExtrinsic<Address, Call, Signature, Extension>,
);
Expand Down
4 changes: 3 additions & 1 deletion template/node/src/rpc/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use sc_client_api::{
use sc_network::service::traits::NetworkService;
use sc_network_sync::SyncingService;
use sc_rpc::SubscriptionTaskExecutor;
use sc_transaction_pool::{ChainApi, Pool};
use sc_transaction_pool::ChainApi;
use sc_transaction_pool_api::TransactionPool;
use sp_api::{CallApiAt, ProvideRuntimeApi};
use sp_block_builder::BlockBuilder as BlockBuilderApi;
Expand All @@ -25,6 +25,8 @@ pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool};
use fc_storage::StorageOverride;
use fp_rpc::{ConvertTransaction, ConvertTransactionRuntimeApi, EthereumRuntimeRPCApi};

type Pool<Api> = sc_transaction_pool::Pool<Api, ()>;

/// Extra dependencies for Ethereum compatibility.
pub struct EthDeps<B: BlockT, C, P, A: ChainApi, CT, CIDP> {
/// The client instance to use.
Expand Down
4 changes: 1 addition & 3 deletions template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ where
Some(WarpSyncConfig::WithProvider(warp_sync))
};

let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
let (network, system_rpc_tx, tx_handler_controller, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
net_config,
Expand Down Expand Up @@ -533,7 +533,6 @@ where
commands_stream,
)?;

network_starter.start_network();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this could have further implications. Can you look into other parts of the polkadot-sdk/frontier code and check how they managed this change (if they did)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be automatically started now

paritytech/polkadot-sdk#6400

log::info!("Manual Seal Ready");
return Ok(task_manager);
}
Expand Down Expand Up @@ -632,7 +631,6 @@ where
.spawn_blocking("grandpa-voter", None, grandpa_voter);
}

network_starter.start_network();
Ok(task_manager)
}

Expand Down