Skip to content

Commit

Permalink
Compile & tests should work
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinonard committed Jul 17, 2023
1 parent 026ccbd commit 5f92a43
Show file tree
Hide file tree
Showing 30 changed files with 117 additions and 54 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "p
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
pallet-message-queue = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }

# EVM & Ethereum
# (wasm)
Expand Down
8 changes: 6 additions & 2 deletions pallets/block-reward/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
use crate::{self as pallet_block_reward, NegativeImbalanceOf};

use frame_support::{
construct_runtime, parameter_types, sp_io::TestExternalities, traits::Currency, traits::Get,
weights::Weight, PalletId,
construct_runtime, parameter_types,
sp_io::TestExternalities,
traits::Currency,
traits::{ConstU32, Get},
weights::Weight,
PalletId,
};

use sp_core::H256;
Expand Down
2 changes: 1 addition & 1 deletion pallets/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use super::*;
use crate as collator_selection;
use frame_support::{
ord_parameter_types, parameter_types,
traits::{FindAuthor, GenesisBuild, ValidatorRegistration},
traits::{ConstU32, FindAuthor, GenesisBuild, ValidatorRegistration},
PalletId,
};
use frame_system as system;
Expand Down
1 change: 1 addition & 0 deletions pallets/custom-signatures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ default = ["std"]
std = [
"serde",
"parity-scale-codec/std",
"pallet-balances/std",
"scale-info/std",
"sp-io/std",
"sp-std/std",
Expand Down
5 changes: 3 additions & 2 deletions pallets/custom-signatures/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate as custom_signatures;
use assert_matches::assert_matches;
use custom_signatures::*;
use frame_support::{
traits::Contains,
traits::{ConstU32, Contains},
{assert_err, assert_ok, parameter_types},
};
use hex_literal::hex;
Expand Down Expand Up @@ -273,7 +273,8 @@ fn call_fixtures() {

let dest =
AccountId::from_ss58check("5GVwcV6EzxxYbXBm7H6dtxc9TCgL4oepMXtgqWYEc3VXJoaf").unwrap();
let call: RuntimeCall = pallet_balances::Call::<Runtime>::transfer { dest, value: 1000 }.into();
let call: RuntimeCall =
pallet_balances::Call::<Runtime>::transfer_allow_death { dest, value: 1000 }.into();
assert_eq!(
call.encode(),
hex!["0000c4305fb88b6ccb43d6552dc11d18e7b0ee3185247adcc6e885eb284adf6c563da10f"],
Expand Down
6 changes: 3 additions & 3 deletions pallets/dapps-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub(crate) const EXISTENTIAL_DEPOSIT: Balance = 2;
pub(crate) const MAX_NUMBER_OF_STAKERS: u32 = 4;
/// Value shouldn't be less than 2 for testing purposes, otherwise we cannot test certain corner cases.
pub(crate) const MINIMUM_STAKING_AMOUNT: Balance = 10;
pub(crate) const MINIMUM_REMAINING_AMOUNT: Balance = 1;
pub(crate) const MINIMUM_REMAINING_AMOUNT: Balance = EXISTENTIAL_DEPOSIT;
pub(crate) const MAX_UNLOCKING_CHUNKS: u32 = 4;
pub(crate) const UNBONDING_PERIOD: EraIndex = 3;
pub(crate) const MAX_ERA_STAKE_VALUES: u32 = 8;
Expand Down Expand Up @@ -197,13 +197,13 @@ impl ExternalityBuilder {
(3, 10000),
(4, 4900),
(5, 3800),
(6, 10),
(6, 20),
(7, 1000),
(8, 2000),
(9, 10000),
(10, 300),
(11, 400),
(20, 10),
(20, 20),
(540, EXISTENTIAL_DEPOSIT),
(1337, 1_000_000_000_000),
],
Expand Down
1 change: 1 addition & 0 deletions pallets/ethereum-checked/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ impl pallet_evm::Config for TestRuntime {
type FindAuthor = MockFindAuthor;
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<TestRuntime>;
type GasLimitPovSizeRatio = ConstU64<4>;
}

parameter_types! {
Expand Down
2 changes: 1 addition & 1 deletion pallets/pallet-xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use frame_support::{
construct_runtime, parameter_types,
traits::{Everything, Nothing},
traits::{ConstU32, Everything, Nothing},
weights::Weight,
};
use frame_system::EnsureRoot;
Expand Down
2 changes: 1 addition & 1 deletion pallets/xc-asset-config/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use crate::{self as pallet_xc_asset_config};

use frame_support::{construct_runtime, parameter_types, weights::Weight};
use frame_support::{construct_runtime, parameter_types, traits::ConstU32, weights::Weight};
use sp_core::H256;

use sp_io::TestExternalities;
Expand Down
1 change: 0 additions & 1 deletion precompiles/assets-erc20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
// along with AssetsERC20. If not, see <http://www.gnu.org/licenses/>.

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(test, feature(assert_matches))]

use fp_evm::{IsPrecompileResult, PrecompileHandle, PrecompileOutput};
use frame_support::traits::fungibles::approvals::Inspect as ApprovalInspect;
Expand Down
5 changes: 3 additions & 2 deletions precompiles/assets-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use super::*;

use frame_support::{
construct_runtime, parameter_types,
traits::{AsEnsureOriginWithArg, Everything},
traits::{AsEnsureOriginWithArg, ConstU64, Everything},
weights::Weight,
};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
Expand Down Expand Up @@ -205,7 +205,7 @@ impl pallet_timestamp::Config for Runtime {
}

parameter_types! {
pub const ExistentialDeposit: u128 = 0;
pub const ExistentialDeposit: u128 = 1;
}

impl pallet_balances::Config for Runtime {
Expand Down Expand Up @@ -250,6 +250,7 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = ();
type OnCreate = ();
type WeightInfo = ();
type GasLimitPovSizeRatio = ConstU64<4>;
}

// These parameters dont matter much as this will only be called by root with the forced arguments
Expand Down
1 change: 0 additions & 1 deletion precompiles/dapps-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
//! Astar dApps staking interface.

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(test, feature(assert_matches))]

use fp_evm::{PrecompileHandle, PrecompileOutput};
use parity_scale_codec::{Decode, Encode};
Expand Down
3 changes: 2 additions & 1 deletion precompiles/dapps-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use super::*;
use fp_evm::IsPrecompileResult;
use frame_support::{
construct_runtime, parameter_types,
traits::{Currency, OnFinalize, OnInitialize},
traits::{ConstU64, Currency, OnFinalize, OnInitialize},
weights::{RuntimeDbWeight, Weight},
PalletId,
};
Expand Down Expand Up @@ -253,6 +253,7 @@ impl pallet_evm::Config for TestRuntime {
type FindAuthor = ();
type OnCreate = ();
type WeightInfo = ();
type GasLimitPovSizeRatio = ConstU64<4>;
}

parameter_types! {
Expand Down
1 change: 0 additions & 1 deletion precompiles/sr25519/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// along with Astar. If not, see <http://www.gnu.org/licenses/>.

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(test, feature(assert_matches))]

use fp_evm::{PrecompileHandle, PrecompileOutput};
use pallet_evm::Precompile;
Expand Down
9 changes: 7 additions & 2 deletions precompiles/sr25519/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
use super::*;

use fp_evm::IsPrecompileResult;
use frame_support::{construct_runtime, parameter_types, traits::Everything, weights::Weight};
use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU32, ConstU64, Everything},
weights::Weight,
};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -169,7 +173,7 @@ impl pallet_timestamp::Config for Runtime {
}

parameter_types! {
pub const ExistentialDeposit: u128 = 0;
pub const ExistentialDeposit: u128 = 1;
}

impl pallet_balances::Config for Runtime {
Expand Down Expand Up @@ -214,6 +218,7 @@ impl pallet_evm::Config for Runtime {
type OnCreate = ();
type FindAuthor = ();
type WeightInfo = ();
type GasLimitPovSizeRatio = ConstU64<4>;
}

// Configure a mock runtime to test the pallet.
Expand Down
1 change: 1 addition & 0 deletions precompiles/substrate-ecdsa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ homepage.workspace = true
repository.workspace = true

[dependencies]
assert_matches = { workspace = true }
log = { workspace = true }
num_enum = { workspace = true }
precompile-utils = { workspace = true, default-features = false }
Expand Down
1 change: 0 additions & 1 deletion precompiles/substrate-ecdsa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// along with Astar. If not, see <http://www.gnu.org/licenses/>.

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(test, feature(assert_matches))]

use fp_evm::{PrecompileHandle, PrecompileOutput};
use pallet_evm::Precompile;
Expand Down
9 changes: 7 additions & 2 deletions precompiles/substrate-ecdsa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
use super::*;

use fp_evm::IsPrecompileResult;
use frame_support::{construct_runtime, parameter_types, traits::Everything, weights::Weight};
use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU32, ConstU64, Everything},
weights::Weight,
};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -169,7 +173,7 @@ impl pallet_timestamp::Config for Runtime {
}

parameter_types! {
pub const ExistentialDeposit: u128 = 0;
pub const ExistentialDeposit: u128 = 1;
}

impl pallet_balances::Config for Runtime {
Expand Down Expand Up @@ -214,6 +218,7 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = ();
type OnCreate = ();
type WeightInfo = ();
type GasLimitPovSizeRatio = ConstU64<4>;
}

// Configure a mock runtime to test the pallet.
Expand Down
1 change: 1 addition & 0 deletions precompiles/xcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ xcm = { workspace = true }
xcm-executor = { workspace = true }

[dev-dependencies]
assert_matches = { workspace = true }
derive_more = { workspace = true }
hex-literal = { workspace = true }
scale-info = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion precompiles/xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// along with Astar. If not, see <http://www.gnu.org/licenses/>.

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(test, feature(assert_matches))]

use fp_evm::{PrecompileHandle, PrecompileOutput};
use frame_support::{
Expand Down
5 changes: 3 additions & 2 deletions precompiles/xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use super::*;
use fp_evm::IsPrecompileResult;
use frame_support::{
construct_runtime, parameter_types,
traits::{AsEnsureOriginWithArg, Everything, Nothing},
traits::{AsEnsureOriginWithArg, ConstU64, Everything, Nothing},
weights::Weight,
};
use frame_system::EnsureRoot;
Expand Down Expand Up @@ -221,7 +221,7 @@ impl pallet_timestamp::Config for Runtime {
}

parameter_types! {
pub const ExistentialDeposit: u128 = 0;
pub const ExistentialDeposit: u128 = 1;
}

impl pallet_balances::Config for Runtime {
Expand Down Expand Up @@ -319,6 +319,7 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = ();
type OnCreate = ();
type WeightInfo = ();
type GasLimitPovSizeRatio = ConstU64<4>;
}

parameter_types! {
Expand Down
2 changes: 1 addition & 1 deletion precompiles/xcm/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with Astar. If not, see <http://www.gnu.org/licenses/>.

use core::assert_matches::assert_matches;
use assert_matches::assert_matches;

use crate::mock::*;
use crate::*;
Expand Down
1 change: 0 additions & 1 deletion precompiles/xvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// along with Astar. If not, see <http://www.gnu.org/licenses/>.

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(test, feature(assert_matches))]

use fp_evm::{PrecompileHandle, PrecompileOutput};
use frame_support::dispatch::{Dispatchable, GetDispatchInfo, PostDispatchInfo};
Expand Down
9 changes: 7 additions & 2 deletions precompiles/xvm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
use super::*;

use fp_evm::IsPrecompileResult;
use frame_support::{construct_runtime, parameter_types, traits::Everything, weights::Weight};
use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU32, ConstU64, Everything},
weights::Weight,
};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -180,7 +184,7 @@ impl pallet_timestamp::Config for Runtime {
}

parameter_types! {
pub const ExistentialDeposit: u128 = 0;
pub const ExistentialDeposit: u128 = 1;
}

impl pallet_balances::Config for Runtime {
Expand Down Expand Up @@ -225,6 +229,7 @@ impl pallet_evm::Config for Runtime {
type FindAuthor = ();
type OnCreate = ();
type WeightInfo = ();
type GasLimitPovSizeRatio = ConstU64<4>;
}

impl pallet_xvm::Config for Runtime {
Expand Down
3 changes: 3 additions & 0 deletions tests/xcm-simulator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ polkadot-primitives = { workspace = true }

# XCM
cumulus-pallet-xcm = { workspace = true }
pallet-message-queue = { workspace = true }
pallet-xcm = { workspace = true }
polkadot-core-primitives = { workspace = true }
polkadot-parachain = { workspace = true }
Expand Down Expand Up @@ -77,6 +78,7 @@ std = [
"pallet-dapps-staking/std",
"pallet-proxy/std",
"pallet-utility/std",
"pallet-message-queue/std",
"orml-xtokens/std",
"orml-traits/std",
"orml-xcm-support/std",
Expand All @@ -94,4 +96,5 @@ runtime-benchmarks = [
"polkadot-parachain/runtime-benchmarks",
"orml-xtokens/runtime-benchmarks",
"astar-primitives/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
]
Loading

0 comments on commit 5f92a43

Please sign in to comment.