Skip to content

Commit

Permalink
Update frontier version (#564)
Browse files Browse the repository at this point in the history
* Update frontier version, drop unused tx converter

* Cleanup DappStaking migration
  • Loading branch information
akru authored Feb 10, 2022
1 parent b360c32 commit 61add2a
Show file tree
Hide file tree
Showing 13 changed files with 227 additions and 388 deletions.
442 changes: 214 additions & 228 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/collator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "astar-collator"
version = "3.7.0"
version = "3.7.1"
authors = ["Stake Technologies <devops@stake.co.jp>"]
description = "Astar collator implementation in Rust."
build = "build.rs"
Expand Down
1 change: 0 additions & 1 deletion bin/collator/src/local/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ pub fn start_node(config: Configuration) -> Result<TaskManager, ServiceError> {
is_authority,
deny_unsafe,
frontier_backend: frontier_backend.clone(),
transaction_converter: local_runtime::TransactionConverter,
filter_pool: filter_pool.clone(),
fee_history_limit: FEE_HISTORY_LIMIT,
fee_history_cache: fee_history_cache.clone(),
Expand Down
1 change: 0 additions & 1 deletion bin/collator/src/parachain/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ where
is_authority,
deny_unsafe,
frontier_backend: frontier_backend.clone(),
transaction_converter: shiden_runtime::TransactionConverter,
filter_pool: filter_pool.clone(),
fee_history_limit: FEE_HISTORY_LIMIT,
fee_history_cache: fee_history_cache.clone(),
Expand Down
11 changes: 3 additions & 8 deletions bin/collator/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ where
}

/// Full client dependencies
pub struct FullDeps<C, P, T, A: ChainApi> {
pub struct FullDeps<C, P, A: ChainApi> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
Expand All @@ -99,8 +99,6 @@ pub struct FullDeps<C, P, T, A: ChainApi> {
pub is_authority: bool,
/// Frontier Backend.
pub frontier_backend: Arc<fc_db::Backend<Block>>,
/// Ethereum transaction conversion helper.
pub transaction_converter: T,
/// EthFilterApi pool.
pub filter_pool: FilterPool,
/// Maximum fee history cache size.
Expand All @@ -110,8 +108,8 @@ pub struct FullDeps<C, P, T, A: ChainApi> {
}

/// Instantiate all RPC extensions.
pub fn create_full<C, P, T, BE, A>(
deps: FullDeps<C, P, T, A>,
pub fn create_full<C, P, BE, A>(
deps: FullDeps<C, P, A>,
subscription_task_executor: SubscriptionTaskExecutor,
overrides: Arc<OverrideHandle<Block>>,
) -> jsonrpc_core::IoHandler<sc_rpc::Metadata>
Expand All @@ -131,7 +129,6 @@ where
+ fp_rpc::EthereumRuntimeRPCApi<Block>
+ BlockBuilder<Block>,
P: TransactionPool<Block = Block> + Sync + Send + 'static,
T: fp_rpc::ConvertTransaction<sp_runtime::OpaqueExtrinsic> + Sync + Send + 'static,
BE: Backend<Block> + 'static,
BE::State: StateBackend<BlakeTwo256>,
BE::Blockchain: BlockchainBackend<Block>,
Expand All @@ -146,7 +143,6 @@ where
deny_unsafe,
is_authority,
frontier_backend,
transaction_converter,
filter_pool,
fee_history_limit,
fee_history_cache,
Expand All @@ -170,7 +166,6 @@ where
client.clone(),
pool.clone(),
graph,
Some(transaction_converter),
network.clone(),
Default::default(),
overrides.clone(),
Expand Down
2 changes: 1 addition & 1 deletion runtime/astar/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "astar-runtime"
version = "3.7.0"
version = "3.7.1"
authors = ["Stake Technologies <devops@stake.co.jp>"]
edition = "2018"
build = "build.rs"
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 @@ -87,7 +87,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("astar"),
impl_name: create_runtime_str!("astar"),
authoring_version: 1,
spec_version: 5,
spec_version: 6,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down Expand Up @@ -648,30 +648,6 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = FindAuthorTruncated<Aura>;
}

pub struct TransactionConverter;

impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {
fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {
UncheckedExtrinsic::new_unsigned(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
)
}
}

impl fp_rpc::ConvertTransaction<sp_runtime::OpaqueExtrinsic> for TransactionConverter {
fn convert_transaction(
&self,
transaction: pallet_ethereum::Transaction,
) -> sp_runtime::OpaqueExtrinsic {
let extrinsic = UncheckedExtrinsic::new_unsigned(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
);
let encoded = extrinsic.encode();
sp_runtime::OpaqueExtrinsic::decode(&mut &encoded[..])
.expect("Encoded extrinsic is always valid")
}
}

impl pallet_ethereum::Config for Runtime {
type Event = Event;
type StateRoot = pallet_ethereum::IntermediateStateRoot;
Expand Down
2 changes: 1 addition & 1 deletion runtime/local/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "local-runtime"
version = "3.7.0"
version = "3.7.1"
authors = ["Stake Technologies <devops@stake.co.jp>"]
edition = "2018"
build = "build.rs"
Expand Down
24 changes: 0 additions & 24 deletions runtime/local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,30 +464,6 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = FindAuthorTruncated<Aura>;
}

pub struct TransactionConverter;

impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {
fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {
UncheckedExtrinsic::new_unsigned(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
)
}
}

impl fp_rpc::ConvertTransaction<sp_runtime::OpaqueExtrinsic> for TransactionConverter {
fn convert_transaction(
&self,
transaction: pallet_ethereum::Transaction,
) -> sp_runtime::OpaqueExtrinsic {
let extrinsic = UncheckedExtrinsic::new_unsigned(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
);
let encoded = extrinsic.encode();
sp_runtime::OpaqueExtrinsic::decode(&mut &encoded[..])
.expect("Encoded extrinsic is always valid")
}
}

impl pallet_ethereum::Config for Runtime {
type Event = Event;
type StateRoot = pallet_ethereum::IntermediateStateRoot;
Expand Down
2 changes: 1 addition & 1 deletion runtime/shibuya/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shibuya-runtime"
version = "3.7.0"
version = "3.7.1"
authors = ["Stake Technologies <devops@stake.co.jp>"]
edition = "2018"
build = "build.rs"
Expand Down
50 changes: 2 additions & 48 deletions runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use codec::{Decode, Encode};
use frame_support::{
construct_runtime, parameter_types,
traits::{Contains, Currency, FindAuthor, Imbalance, OnRuntimeUpgrade, OnUnbalanced},
traits::{Contains, Currency, FindAuthor, Imbalance, OnUnbalanced},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, WEIGHT_PER_SECOND},
DispatchClass, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients,
Expand Down Expand Up @@ -88,7 +88,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("shibuya"),
impl_name: create_runtime_str!("shibuya"),
authoring_version: 1,
spec_version: 28,
spec_version: 29,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down Expand Up @@ -658,30 +658,6 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = FindAuthorTruncated<Aura>;
}

pub struct TransactionConverter;

impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {
fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {
UncheckedExtrinsic::new_unsigned(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
)
}
}

impl fp_rpc::ConvertTransaction<sp_runtime::OpaqueExtrinsic> for TransactionConverter {
fn convert_transaction(
&self,
transaction: pallet_ethereum::Transaction,
) -> sp_runtime::OpaqueExtrinsic {
let extrinsic = UncheckedExtrinsic::new_unsigned(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
);
let encoded = extrinsic.encode();
sp_runtime::OpaqueExtrinsic::decode(&mut &encoded[..])
.expect("Encoded extrinsic is always valid")
}
}

impl pallet_ethereum::Config for Runtime {
type Event = Event;
type StateRoot = pallet_ethereum::IntermediateStateRoot;
Expand Down Expand Up @@ -775,30 +751,8 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
(DappsStakingMigrationV2,),
>;

// Migration for supporting unbonding period in dapps staking.
pub struct DappsStakingMigrationV2;

impl OnRuntimeUpgrade for DappsStakingMigrationV2 {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
pallet_dapps_staking::migrations::v2::stateful_migrate::<Runtime>(
RuntimeBlockWeights::get().max_block / 5 * 3,
)
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
pallet_dapps_staking::migrations::v2::pre_migrate::<Runtime, Self>()
}

#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_dapps_staking::migrations::v2::post_migrate::<Runtime, Self>()
}
}

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

Expand Down
2 changes: 1 addition & 1 deletion runtime/shiden/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shiden-runtime"
version = "3.7.0"
version = "3.7.1"
authors = ["Stake Technologies <devops@stake.co.jp>"]
edition = "2018"
build = "build.rs"
Expand Down
50 changes: 2 additions & 48 deletions runtime/shiden/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use codec::{Decode, Encode};
use frame_support::{
construct_runtime, parameter_types,
traits::{Contains, Currency, FindAuthor, Imbalance, OnRuntimeUpgrade, OnUnbalanced},
traits::{Contains, Currency, FindAuthor, Imbalance, OnUnbalanced},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, WEIGHT_PER_SECOND},
DispatchClass, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients,
Expand Down Expand Up @@ -87,7 +87,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("shiden"),
impl_name: create_runtime_str!("shiden"),
authoring_version: 1,
spec_version: 37,
spec_version: 38,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down Expand Up @@ -657,30 +657,6 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = FindAuthorTruncated<Aura>;
}

pub struct TransactionConverter;

impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {
fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {
UncheckedExtrinsic::new_unsigned(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
)
}
}

impl fp_rpc::ConvertTransaction<sp_runtime::OpaqueExtrinsic> for TransactionConverter {
fn convert_transaction(
&self,
transaction: pallet_ethereum::Transaction,
) -> sp_runtime::OpaqueExtrinsic {
let extrinsic = UncheckedExtrinsic::new_unsigned(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
);
let encoded = extrinsic.encode();
sp_runtime::OpaqueExtrinsic::decode(&mut &encoded[..])
.expect("Encoded extrinsic is always valid")
}
}

impl pallet_ethereum::Config for Runtime {
type Event = Event;
type StateRoot = pallet_ethereum::IntermediateStateRoot;
Expand Down Expand Up @@ -774,30 +750,8 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
(DappsStakingMigrationV2,),
>;

// Migration for supporting unbonding period in dapps staking.
pub struct DappsStakingMigrationV2;

impl OnRuntimeUpgrade for DappsStakingMigrationV2 {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
pallet_dapps_staking::migrations::v2::stateful_migrate::<Runtime>(
RuntimeBlockWeights::get().max_block / 5 * 3,
)
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
pallet_dapps_staking::migrations::v2::pre_migrate::<Runtime, Self>()
}

#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_dapps_staking::migrations::v2::post_migrate::<Runtime, Self>()
}
}

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

Expand Down

0 comments on commit 61add2a

Please sign in to comment.