From d36a2dc195b8e5b7d7e1ba228f6dfa8e94eac8e8 Mon Sep 17 00:00:00 2001 From: salman01zp Date: Thu, 18 Jan 2024 18:48:51 +0530 Subject: [PATCH] fix staking-precompile tests --- precompiles/staking/src/mock.rs | 2 +- precompiles/staking/src/tests.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/precompiles/staking/src/mock.rs b/precompiles/staking/src/mock.rs index ce1c6f1df..0f503392c 100644 --- a/precompiles/staking/src/mock.rs +++ b/precompiles/staking/src/mock.rs @@ -77,7 +77,7 @@ type Block = frame_system::mocking::MockBlock; pub type AccountId = <::Signer as IdentifyAccount>::AccountId; const PRECOMPILE_ADDRESS_BYTES: [u8; 32] = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ]; #[derive( diff --git a/precompiles/staking/src/tests.rs b/precompiles/staking/src/tests.rs index b294cca5d..deeab70f0 100644 --- a/precompiles/staking/src/tests.rs +++ b/precompiles/staking/src/tests.rs @@ -35,7 +35,7 @@ fn max_validator_count_works() { precompiles() .prepare_test( TestAccount::Alex, - H160::from_low_u64_be(5), + H160::from_low_u64_be(1), PCall::max_validator_count {}, ) .expect_cost(0) @@ -50,7 +50,7 @@ fn current_era_works() { start_session(3); assert_eq!(active_era(), 2); precompiles() - .prepare_test(TestAccount::Alex, H160::from_low_u64_be(5), PCall::current_era {}) + .prepare_test(TestAccount::Alex, H160::from_low_u64_be(1), PCall::current_era {}) .expect_cost(0) .expect_no_logs() .execute_returns(3u32); @@ -61,7 +61,7 @@ fn current_era_works() { fn validator_count_works() { new_test_ext(vec![1, 2, 3, 4]).execute_with(|| { precompiles() - .prepare_test(TestAccount::Alex, H160::from_low_u64_be(5), PCall::validator_count {}) + .prepare_test(TestAccount::Alex, H160::from_low_u64_be(1), PCall::validator_count {}) .expect_cost(0) .expect_no_logs() .execute_returns(4u32); @@ -74,7 +74,7 @@ fn max_nominator_count_works() { precompiles() .prepare_test( TestAccount::Alex, - H160::from_low_u64_be(5), + H160::from_low_u64_be(1), PCall::max_nominator_count {}, ) .expect_cost(0) @@ -89,7 +89,7 @@ fn is_validator_works() { precompiles() .prepare_test( TestAccount::Alex, - H160::from_low_u64_be(5), + H160::from_low_u64_be(1), PCall::is_validator { validator: H160::from(TestAccount::Alex).into() }, ) .expect_cost(0) @@ -109,7 +109,7 @@ fn eras_total_rewards_should_work() { precompiles() .prepare_test( TestAccount::Alex, - H160::from_low_u64_be(5), + H160::from_low_u64_be(1), PCall::eras_total_reward_points { era_index }, ) .expect_cost(0) @@ -128,7 +128,7 @@ fn nominate_should_work() { precompiles() .prepare_test( TestAccount::Alex, - H160::from_low_u64_be(5), + H160::from_low_u64_be(1), PCall::nominate { targets: vec![H256::from(mock_pub_key(1))] }, ) .expect_no_logs() @@ -149,7 +149,7 @@ fn bond_should_work() { precompiles() .prepare_test( TestAccount::Eve, - H160::from_low_u64_be(5), + H160::from_low_u64_be(1), PCall::bond { value: U256::from(100), payee: H256([