Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies to polkadot-v1.1.0 #186

Merged
merged 3 commits into from
Oct 9, 2023
Merged
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
1,092 changes: 688 additions & 404 deletions Cargo.lock

Large diffs are not rendered by default.

133 changes: 67 additions & 66 deletions Cargo.toml

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions client/consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<Block: BlockT, I: Clone + BlockImport<Block>, C> Clone for FrontierBlockImp
impl<B, I, C> FrontierBlockImport<B, I, C>
where
B: BlockT,
I: BlockImport<B, Transaction = sp_api::TransactionFor<C, B>>,
I: BlockImport<B>,
I::Error: Into<ConsensusError>,
C: ProvideRuntimeApi<B>,
C::Api: BlockBuilderApi<B> + EthereumRuntimeRPCApi<B>,
Expand All @@ -98,13 +98,12 @@ where
impl<B, I, C> BlockImport<B> for FrontierBlockImport<B, I, C>
where
B: BlockT,
I: BlockImport<B, Transaction = sp_api::TransactionFor<C, B>> + Send + Sync,
I: BlockImport<B> + Send + Sync,
I::Error: Into<ConsensusError>,
C: ProvideRuntimeApi<B> + Send + Sync,
C::Api: BlockBuilderApi<B> + EthereumRuntimeRPCApi<B>,
{
type Error = ConsensusError;
type Transaction = sp_api::TransactionFor<C, B>;

async fn check_block(
&mut self,
Expand All @@ -115,7 +114,7 @@ where

async fn import_block(
&mut self,
block: BlockImportParams<B, Self::Transaction>,
block: BlockImportParams<B>,
) -> Result<ImportResult, Self::Error> {
// We validate that there are only one frontier log. No other
// actions are needed and mapping syncing is delegated to a separate
Expand Down
8 changes: 2 additions & 6 deletions client/rpc/src/eth/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ use sc_client_api::backend::{Backend, StorageProvider};
use sc_transaction_pool::ChainApi;
use sp_api::{
ApiExt, CallApiAt, CallApiAtParams, CallContext, Extensions, ProvideRuntimeApi,
StorageTransactionCache,
};
use sp_block_builder::BlockBuilder as BlockBuilderApi;
use sp_blockchain::HeaderBackend;
use sp_inherents::CreateInherentDataProviders;
use sp_io::hashing::{blake2_128, twox_128};
use sp_runtime::{traits::Block as BlockT, DispatchError, SaturatedConversion};
use sp_runtime::{traits::{Block as BlockT, HashingFor}, DispatchError, SaturatedConversion};
use sp_state_machine::OverlayedChanges;
// Frontier
use fc_rpc_core::types::*;
Expand Down Expand Up @@ -241,14 +240,11 @@ where
api_version,
state_overrides,
)?;
let storage_transaction_cache =
RefCell::<StorageTransactionCache<B, C::StateBackend>>::default();
let params = CallApiAtParams {
at: substrate_hash,
function: "EthereumRuntimeRPCApi_call",
arguments: encoded_params,
overlayed_changes: &RefCell::new(overlayed_changes),
storage_transaction_cache: &storage_transaction_cache,
call_context: CallContext::Offchain,
recorder: &None,
extensions: &RefCell::new(Extensions::new()),
Expand Down Expand Up @@ -888,7 +884,7 @@ where
block_hash: B::Hash,
api_version: u32,
state_overrides: Option<BTreeMap<H160, CallStateOverride>>,
) -> RpcResult<OverlayedChanges> {
) -> RpcResult<OverlayedChanges<HashingFor<B>>> {
let mut overlayed_changes = OverlayedChanges::default();
if let Some(state_overrides) = state_overrides {
for (address, state_override) in state_overrides {
Expand Down
6 changes: 3 additions & 3 deletions client/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub mod frontier_backend_client {
use sp_io::hashing::{blake2_128, twox_128};
use sp_runtime::{
generic::BlockId,
traits::{Block as BlockT, UniqueSaturatedInto, Zero},
traits::{Block as BlockT, UniqueSaturatedInto, Zero, HashingFor},
};
use sp_state_machine::OverlayedChanges;
// Frontier
Expand All @@ -95,7 +95,7 @@ pub mod frontier_backend_client {

fn set_overlayed_changes(
client: &C,
overlayed_changes: &mut OverlayedChanges,
overlayed_changes: &mut OverlayedChanges<HashingFor<B>>,
block: B::Hash,
_version: u32,
address: H160,
Expand Down Expand Up @@ -148,7 +148,7 @@ pub mod frontier_backend_client {

fn set_overlayed_changes(
client: &C,
overlayed_changes: &mut OverlayedChanges,
overlayed_changes: &mut OverlayedChanges<HashingFor<B>>,
block: B::Hash,
_version: u32,
address: H160,
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 @@ -44,14 +44,14 @@ use fp_evm::{
};
use fp_storage::{EthereumStorageSchema, PALLET_ETHEREUM_SCHEMA};
use frame_support::{
codec::{Decode, Encode, MaxEncodedLen},
dispatch::{DispatchInfo, DispatchResultWithPostInfo, Pays, PostDispatchInfo},
scale_info::TypeInfo,
pallet_prelude::TypeInfo,
traits::{EnsureOrigin, Get, PalletInfoAccess, Time},
weights::Weight,
};
use frame_system::{pallet_prelude::OriginFor, CheckWeight, WeightInfo};
use pallet_evm::{BlockHashMapping, FeeCalculator, GasWeightMapping, Runner};
use scale_codec::{Decode, Encode, MaxEncodedLen};
use sp_runtime::{
generic::DigestItem,
traits::{DispatchInfoOf, Dispatchable, One, Saturating, UniqueSaturatedInto, Zero},
Expand Down
1 change: 0 additions & 1 deletion frame/ethereum/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

use ethereum::{TransactionAction, TransactionSignature};
use frame_support::{
dispatch::Dispatchable,
parameter_types,
traits::{ConstU32, FindAuthor},
weights::Weight,
Expand Down
2 changes: 2 additions & 0 deletions frame/evm/precompile/dispatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ frame-support = { workspace = true }
# Frontier
fp-evm = { workspace = true }
pallet-evm = { workspace = true }
sp-runtime = { workspace = true }
scale-codec = { package = "parity-scale-codec", workspace = true }

[dev-dependencies]
scale-codec = { package = "parity-scale-codec", workspace = true }
Expand Down
5 changes: 3 additions & 2 deletions frame/evm/precompile/dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ mod mock;
mod tests;

use alloc::format;
use scale_codec::{Decode, DecodeLimit};
use sp_runtime::traits::Dispatchable;
use core::marker::PhantomData;
use fp_evm::{
ExitError, ExitSucceed, Precompile, PrecompileFailure, PrecompileHandle, PrecompileOutput,
PrecompileResult,
};
use frame_support::{
codec::{Decode, DecodeLimit as _},
dispatch::{DispatchClass, Dispatchable, GetDispatchInfo, Pays, PostDispatchInfo},
dispatch::{DispatchClass, GetDispatchInfo, Pays, PostDispatchInfo},
traits::{ConstU32, Get},
};
use pallet_evm::{AddressMapping, GasWeightMapping};
Expand Down
2 changes: 1 addition & 1 deletion frame/evm/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ benchmarks! {

let x in 1..10000000;

use frame_benchmarking::vec;
use sp_std::vec;
use rlp::RlpStream;
use sp_core::{H160, U256};

Expand Down
3 changes: 2 additions & 1 deletion frame/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ use impl_trait_for_tuples::impl_for_tuples;
use scale_info::TypeInfo;
// Substrate
use frame_support::{
dispatch::{DispatchResultWithPostInfo, MaxEncodedLen, Pays, PostDispatchInfo},
dispatch::{DispatchResultWithPostInfo, Pays, PostDispatchInfo},
pallet_prelude::MaxEncodedLen,
traits::{
tokens::{
currency::Currency,
Expand Down
6 changes: 3 additions & 3 deletions primitives/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
// Substrate
use sp_core::{H160, H256, U256};
use sp_runtime::{traits::Block as BlockT, Permill, RuntimeDebug};
use sp_runtime::{traits::{Block as BlockT, HashingFor}, Permill, RuntimeDebug};
use sp_state_machine::OverlayedChanges;
use sp_std::vec::Vec;

Expand All @@ -51,7 +51,7 @@ pub trait RuntimeStorageOverride<B: BlockT, C>: Send + Sync {

fn set_overlayed_changes(
client: &C,
overlayed_changes: &mut OverlayedChanges,
overlayed_changes: &mut OverlayedChanges<HashingFor<B>>,
block: B::Hash,
version: u32,
address: H160,
Expand All @@ -69,7 +69,7 @@ impl<B: BlockT, C> RuntimeStorageOverride<B, C> for () {

fn set_overlayed_changes(
_client: &C,
_overlayed_changes: &mut OverlayedChanges,
_overlayed_changes: &mut OverlayedChanges<HashingFor<B>>,
_block: B::Hash,
_version: u32,
_address: H160,
Expand Down
2 changes: 0 additions & 2 deletions template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ sc-consensus-grandpa = { workspace = true }
sc-consensus-manual-seal = { workspace = true }
sc-executor = { workspace = true }
sc-network = { workspace = true }
sc-network-common = { workspace = true }
sc-network-sync = { workspace = true }
sc-offchain = { workspace = true }
sc-rpc = { workspace = true }
Expand All @@ -56,7 +55,6 @@ sp-session = { workspace = true, features = ["default"] }
sp-state-machine = { workspace = true, features = ["default"] }
sp-timestamp = { workspace = true, features = ["default"] }
sp-transaction-pool = { workspace = true, features = ["default"] }
sp-trie = { workspace = true, features = ["default"] }
# These dependencies are used for RPC
frame-system-rpc-runtime-api = { workspace = true }
pallet-transaction-payment-rpc = { workspace = true }
Expand Down
7 changes: 0 additions & 7 deletions template/node/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Substrate
use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch, NativeVersion};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_runtime::traits::BlakeTwo256;
// Local
use frontier_template_runtime::{opaque::Block, AccountId, Balance, Nonce};

Expand Down Expand Up @@ -43,8 +42,6 @@ pub trait BaseRuntimeApiCollection:
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
+ sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
where
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
}

Expand All @@ -56,7 +53,6 @@ where
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
+ sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>,
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
}

Expand All @@ -68,8 +64,6 @@ pub trait RuntimeApiCollection:
+ sp_consensus_grandpa::GrandpaApi<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
where
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
}

Expand All @@ -81,6 +75,5 @@ where
+ sp_consensus_grandpa::GrandpaApi<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>,
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
}
8 changes: 2 additions & 6 deletions template/node/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ use std::{

use futures::{future, prelude::*};
// Substrate
use sc_client_api::{BlockchainEvents, StateBackendFor};
use sc_client_api::BlockchainEvents;
use sc_executor::NativeExecutionDispatch;
use sc_network_sync::SyncingService;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sp_api::ConstructRuntimeApi;
use sp_runtime::traits::BlakeTwo256;
// Frontier
pub use fc_consensus::FrontierBlockImport;
use fc_rpc::{EthTask, OverrideHandle};
Expand Down Expand Up @@ -113,8 +112,6 @@ pub trait EthCompatRuntimeApiCollection:
sp_api::ApiExt<Block>
+ fp_rpc::ConvertTransactionRuntimeApi<Block>
+ fp_rpc::EthereumRuntimeRPCApi<Block>
where
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
}

Expand All @@ -123,7 +120,6 @@ where
Api: sp_api::ApiExt<Block>
+ fp_rpc::ConvertTransactionRuntimeApi<Block>
+ fp_rpc::EthereumRuntimeRPCApi<Block>,
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
}

Expand All @@ -146,7 +142,7 @@ pub async fn spawn_frontier_tasks<RuntimeApi, Executor>(
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>>,
RuntimeApi: Send + Sync + 'static,
RuntimeApi::RuntimeApi:
EthCompatRuntimeApiCollection<StateBackend = StateBackendFor<FullBackend, Block>>,
EthCompatRuntimeApiCollection,
Executor: NativeExecutionDispatch + 'static,
{
// Spawn main mapping sync worker background task.
Expand Down
Loading