Skip to content

Commit

Permalink
feat: update shibuya runtmie
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutoshvarma committed Feb 5, 2024
1 parent 849581a commit 8694d1a
Show file tree
Hide file tree
Showing 20 changed files with 118 additions and 58 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async-trait = "0.1.59"
clap = { version = "4.2.5", features = ["derive"] }
env_logger = "0.10.0"
futures = { version = "0.3.26" }
serde = { version = "1.0.151", default-features = false, features = ["derive"] }
serde = { version = "1.0.151", default-features = false, features = ["derive", "alloc"] }
serde_json = "1.0.92"
tokio = { version = "1.24.2", features = ["macros", "sync"] }
url = "2.2.2"
Expand Down Expand Up @@ -188,7 +188,7 @@ ethereum = { version = "0.14.0", default-features = false }
# Frontier
# (wasm)
fp-rpc = { git = "https://github.com/AstarNetwork/frontier", branch = "polkadot-v1.1.0", default-features = false }
fp-self-contained = { git = "https://github.com/AstarNetwork/frontier", branch = "polkadot-v1.1.0", default-features = false }
fp-self-contained = { git = "https://github.com/AstarNetwork/frontier", branch = "polkadot-v1.1.0", default-features = false, features = ["serde"] }
pallet-ethereum = { git = "https://github.com/AstarNetwork/frontier", branch = "polkadot-v1.1.0", default-features = false, features = ["forbid-evm-reentrancy"] }
pallet-evm = { git = "https://github.com/AstarNetwork/frontier", branch = "polkadot-v1.1.0", default-features = false, features = ["forbid-evm-reentrancy"] }
pallet-evm-precompile-blake2 = { git = "https://github.com/AstarNetwork/frontier", branch = "polkadot-v1.1.0", default-features = false }
Expand Down
15 changes: 13 additions & 2 deletions pallets/block-rewards-hybrid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ use astar_primitives::Balance;
use frame_support::pallet_prelude::*;
use frame_support::traits::{Currency, Get, Imbalance, OnTimestampSet};
use frame_system::{ensure_root, pallet_prelude::*};
use serde::{Deserialize, Serialize};
use sp_runtime::{
traits::{CheckedAdd, Zero},
Perbill,
Expand Down Expand Up @@ -279,8 +280,18 @@ pub mod pallet {
///
/// Note that if `ideal_dapps_staking_tvl` is set to `Zero`, entire `adjustable_percent` goes to the stakers.
///
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(
PartialEq,
Eq,
Clone,
Encode,
Decode,
RuntimeDebug,
TypeInfo,
MaxEncodedLen,
Serialize,
Deserialize,
)]
pub struct RewardDistributionConfig {
/// Base percentage of reward that goes to treasury
#[codec(compact)]
Expand Down
3 changes: 2 additions & 1 deletion pallets/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ pub mod pallet {
use pallet_session::SessionManager;
use sp_runtime::{traits::Convert, Perbill};
use sp_staking::SessionIndex;
use sp_std::prelude::*;

type BalanceOf<T> =
<<T as Config>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;
Expand Down Expand Up @@ -223,7 +224,7 @@ pub mod pallet {
let duplicate_invulnerables = self
.invulnerables
.iter()
.collect::<std::collections::BTreeSet<_>>();
.collect::<sp_std::collections::btree_set::BTreeSet<_>>();
assert!(
duplicate_invulnerables.len() == self.invulnerables.len(),
"duplicate invulnerables in genesis."
Expand Down
1 change: 1 addition & 0 deletions pallets/dapp-staking-migration/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use super::{Pallet as Migration, *};

use frame_benchmarking::{account as benchmark_account, v2::*};
use frame_support::{assert_ok, traits::Currency};
use sp_std::prelude::*;

/// Generate an unique smart contract using the provided index as a sort-of indetifier
fn smart_contract<T: pallet_dapps_staking::Config>(index: u8) -> T::SmartContract {
Expand Down
4 changes: 2 additions & 2 deletions pallets/dapp-staking-v3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ num-traits = { workspace = true }
parity-scale-codec = { workspace = true }

scale-info = { workspace = true }
serde = { workspace = true, optional = true }
serde = { workspace = true }
sp-arithmetic = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
Expand All @@ -33,7 +33,7 @@ pallet-balances = { workspace = true }
[features]
default = ["std"]
std = [
"serde",
"serde/std",
"log/std",
"parity-scale-codec/std",
"scale-info/std",
Expand Down
1 change: 1 addition & 0 deletions pallets/dapp-staking-v3/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use frame_benchmarking::v2::*;

use frame_support::assert_ok;
use frame_system::{Pallet as System, RawOrigin};
use sp_std::prelude::*;

use ::assert_matches::assert_matches;

Expand Down
19 changes: 16 additions & 3 deletions pallets/dapp-staking-v3/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
use frame_support::{pallet_prelude::*, BoundedBTreeMap, BoundedVec};
use parity_scale_codec::{Decode, Encode};
use serde::{Serialize, Deserialize}
use sp_arithmetic::fixed_point::FixedU64;
use sp_runtime::{
traits::{CheckedAdd, UniqueSaturatedInto, Zero},
Expand Down Expand Up @@ -1370,8 +1371,20 @@ where
}

/// Description of tier entry requirement.
#[derive(Encode, Decode, MaxEncodedLen, Copy, Clone, Debug, PartialEq, Eq, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(
Encode,
Decode,
MaxEncodedLen,
Copy,
Clone,
Debug,
PartialEq,
Eq,
TypeInfo,
Serialize,
Deserialize,
)]
// #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum TierThreshold {
/// Entry into tier is mandated by minimum amount of staked funds.
/// Value is fixed, and is not expected to change in between periods.
Expand Down Expand Up @@ -1530,7 +1543,7 @@ impl<NT: Get<u32>> TiersConfiguration<NT> {
// All vector length must match number of tiers.
&& number_of_tiers == self.reward_portion.len()
&& number_of_tiers == self.tier_thresholds.len()
// Total number of slots must match the sum of slots per tier.
// Total number of slots must match the sum of slots per tier.
&& self.slots_per_tier.iter().fold(0, |acc, x| acc + x) == self.number_of_slots
}

Expand Down
2 changes: 2 additions & 0 deletions pallets/dynamic-evm-base-fee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ frame-system = { workspace = true }
pallet-transaction-payment = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

# Frontier
fp-evm = { workspace = true }
Expand All @@ -40,6 +41,7 @@ std = [
"frame-system/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
"pallet-transaction-payment/std",
"pallet-balances/std",
"pallet-timestamp/std",
Expand Down
1 change: 1 addition & 0 deletions pallets/dynamic-evm-base-fee/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use fp_evm::FeeCalculator;
use frame_benchmarking::v2::*;
use frame_support::traits::Hooks;
use frame_system::{pallet_prelude::*, RawOrigin};
use sp_std::prelude::*;

#[benchmarks(
where
Expand Down
1 change: 1 addition & 0 deletions pallets/ethereum-checked/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use super::*;

use astar_primitives::ethereum_checked::EthereumTxInput;
use frame_benchmarking::v2::*;
use sp_std::prelude::*;

#[benchmarks]
mod benchmarks {
Expand Down
1 change: 1 addition & 0 deletions pallets/inflation/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use super::*;
use astar_primitives::BlockNumber;
use frame_benchmarking::v2::*;
use frame_system::{Pallet as System, RawOrigin};
use sp_std::prelude::*;

/// Assert that the last event equals the provided one.
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
Expand Down
17 changes: 15 additions & 2 deletions pallets/inflation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ use frame_support::{
DefaultNoBound,
};
use frame_system::{ensure_root, pallet_prelude::*};
use serde::{Deserialize, Serialize};
use sp_runtime::{traits::CheckedAdd, Perquintill};
use sp_std::marker::PhantomData;

Expand Down Expand Up @@ -518,8 +519,20 @@ pub struct InflationConfiguration {
/// Inflation parameters.
///
/// The parts of the inflation that go towards different purposes must add up to exactly 100%.
#[derive(Encode, Decode, MaxEncodedLen, Copy, Clone, Debug, PartialEq, Eq, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(
Encode,
Decode,
MaxEncodedLen,
Copy,
Clone,
Debug,
PartialEq,
Eq,
TypeInfo,
Serialize,
Deserialize,
)]
// #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct InflationParameters {
/// Maximum possible inflation rate, based on the total issuance at some point in time.
/// From this value, all the other inflation parameters are derived.
Expand Down
1 change: 1 addition & 0 deletions pallets/unified-accounts/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use super::*;
use frame_benchmarking::v2::*;
use frame_support::assert_ok;
use frame_system::RawOrigin;
use sp_std::prelude::*;

/// Assert that the last event equals the provided one.
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
Expand Down
2 changes: 0 additions & 2 deletions primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ pub type Hash = sp_core::H256;
/// [2^64; 2^128-1] Ecosystem assets
/// 2^128-1 Relay chain token (KSM)
pub type AssetId = u128;
/// Index of a transaction in the chain.
pub type Index = u32;
/// Block type.
pub type Block = sp_runtime::generic::Block<Header, sp_runtime::OpaqueExtrinsic>;
/// Index of a transaction in the chain.
Expand Down
8 changes: 4 additions & 4 deletions runtime/astar/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
pub use crate::precompiles::WhitelistedCalls;
pub use astar_primitives::{
evm::EvmRevertCodeHandler, xcm::AssetLocationIdConverter, AccountId, Address, AssetId, Balance,
BlockNumber, Hash, Header, Index, Signature,
BlockNumber, Hash, Header, Nonce, Signature,
};
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use frame_support::{
Expand Down Expand Up @@ -224,7 +224,7 @@ impl frame_system::Config for Runtime {
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = AccountIdLookup<AccountId, ()>;
/// The index type for storing how many extrinsics an account has signed.
type Index = Index;
type Index = Nonce;
/// The index type for blocks.
type BlockNumber = BlockNumber;
/// The type for hashing blocks and tries.
Expand Down Expand Up @@ -1217,8 +1217,8 @@ impl_runtime_apis! {
}
}

impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
fn account_nonce(account: AccountId) -> Index {
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
fn account_nonce(account: AccountId) -> Nonce {
System::account_nonce(account)
}
}
Expand Down
8 changes: 4 additions & 4 deletions runtime/local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ use sp_std::{collections::btree_map::BTreeMap, prelude::*};
use astar_primitives::{
dapp_staking::{CycleConfiguration, DAppId, EraNumber, PeriodNumber, SmartContract, TierId},
evm::{EvmRevertCodeHandler, HashedDefaultMappings},
Address, AssetId, Balance, BlockNumber, Hash, Header, Index,
Address, AssetId, Balance, BlockNumber, Hash, Header, Nonce,
};

pub use astar_primitives::{AccountId, Signature};
Expand Down Expand Up @@ -207,7 +207,7 @@ impl frame_system::Config for Runtime {
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = (AccountIdLookup<AccountId, ()>, UnifiedAccounts);
/// The index type for storing how many extrinsics an account has signed.
type Nonce = Index;
type Nonce = Nonce;
/// The index type for blocks.
type Block = Block;
/// The type for hashing blocks and tries.
Expand Down Expand Up @@ -1365,8 +1365,8 @@ impl_runtime_apis! {
}
}

impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
fn account_nonce(account: AccountId) -> Index {
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
fn account_nonce(account: AccountId) -> Nonce {
System::account_nonce(account)
}
}
Expand Down
Loading

0 comments on commit 8694d1a

Please sign in to comment.