feat: Rebrand Polkadot/Substrate references to PezkuwiChain
This commit systematically rebrands various references from Parity Technologies' Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk. Key changes include: - Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks. - Modified internal documentation and code comments to reflect PezkuwiChain naming and structure. - Replaced direct references to with or specific paths within the for XCM, Pezkuwi, and other modules. - Cleaned up deprecated issue and PR references in various and files, particularly in and modules. - Adjusted image and logo URLs in documentation to point to PezkuwiChain assets. - Removed or rephrased comments related to external Polkadot/Substrate PRs and issues. This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
@@ -0,0 +1,222 @@
|
||||
// This file is part of Bizinikiwi.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Tests for Whitelist Pallet
|
||||
|
||||
use crate::mock::*;
|
||||
use codec::Encode;
|
||||
use frame::{
|
||||
testing_prelude::*,
|
||||
traits::{QueryPreimage, StorePreimage},
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_whitelist_call_and_remove() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = RuntimeCall::System(pezframe_system::Call::remark { remark: vec![] });
|
||||
let encoded_call = call.encode();
|
||||
let call_hash = <Test as pezframe_system::Config>::Hashing::hash(&encoded_call[..]);
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::remove_whitelisted_call(RuntimeOrigin::root(), call_hash),
|
||||
crate::Error::<Test>::CallIsNotWhitelisted,
|
||||
);
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::whitelist_call(RuntimeOrigin::signed(1), call_hash),
|
||||
DispatchError::BadOrigin,
|
||||
);
|
||||
|
||||
assert_ok!(Whitelist::whitelist_call(RuntimeOrigin::root(), call_hash));
|
||||
|
||||
assert!(Preimage::is_requested(&call_hash));
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::whitelist_call(RuntimeOrigin::root(), call_hash),
|
||||
crate::Error::<Test>::CallAlreadyWhitelisted,
|
||||
);
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::remove_whitelisted_call(RuntimeOrigin::signed(1), call_hash),
|
||||
DispatchError::BadOrigin,
|
||||
);
|
||||
|
||||
assert_ok!(Whitelist::remove_whitelisted_call(RuntimeOrigin::root(), call_hash));
|
||||
|
||||
assert!(!Preimage::is_requested(&call_hash));
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::remove_whitelisted_call(RuntimeOrigin::root(), call_hash),
|
||||
crate::Error::<Test>::CallIsNotWhitelisted,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_whitelist_call_and_execute() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = RuntimeCall::System(pezframe_system::Call::remark_with_event { remark: vec![1] });
|
||||
let call_weight = call.get_dispatch_info().call_weight;
|
||||
let encoded_call = call.encode();
|
||||
let call_encoded_len = encoded_call.len() as u32;
|
||||
let call_hash = <Test as pezframe_system::Config>::Hashing::hash(&encoded_call[..]);
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::dispatch_whitelisted_call(
|
||||
RuntimeOrigin::root(),
|
||||
call_hash,
|
||||
call_encoded_len,
|
||||
call_weight
|
||||
),
|
||||
crate::Error::<Test>::CallIsNotWhitelisted,
|
||||
);
|
||||
|
||||
assert_ok!(Whitelist::whitelist_call(RuntimeOrigin::root(), call_hash));
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::dispatch_whitelisted_call(
|
||||
RuntimeOrigin::signed(1),
|
||||
call_hash,
|
||||
call_encoded_len,
|
||||
call_weight
|
||||
),
|
||||
DispatchError::BadOrigin,
|
||||
);
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::dispatch_whitelisted_call(
|
||||
RuntimeOrigin::root(),
|
||||
call_hash,
|
||||
call_encoded_len,
|
||||
call_weight
|
||||
),
|
||||
crate::Error::<Test>::UnavailablePreImage,
|
||||
);
|
||||
|
||||
assert_ok!(Preimage::note(encoded_call.into()));
|
||||
|
||||
assert!(Preimage::is_requested(&call_hash));
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::dispatch_whitelisted_call(
|
||||
RuntimeOrigin::root(),
|
||||
call_hash,
|
||||
call_encoded_len,
|
||||
call_weight - Weight::from_parts(1, 0)
|
||||
),
|
||||
crate::Error::<Test>::InvalidCallWeightWitness,
|
||||
);
|
||||
|
||||
assert_ok!(Whitelist::dispatch_whitelisted_call(
|
||||
RuntimeOrigin::root(),
|
||||
call_hash,
|
||||
call_encoded_len,
|
||||
call_weight
|
||||
));
|
||||
|
||||
assert!(!Preimage::is_requested(&call_hash));
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::dispatch_whitelisted_call(
|
||||
RuntimeOrigin::root(),
|
||||
call_hash,
|
||||
call_encoded_len,
|
||||
call_weight
|
||||
),
|
||||
crate::Error::<Test>::CallIsNotWhitelisted,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_whitelist_call_and_execute_failing_call() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = RuntimeCall::Whitelist(crate::Call::dispatch_whitelisted_call {
|
||||
call_hash: Default::default(),
|
||||
call_encoded_len: Default::default(),
|
||||
call_weight_witness: Weight::zero(),
|
||||
});
|
||||
let call_weight = call.get_dispatch_info().call_weight;
|
||||
let encoded_call = call.encode();
|
||||
let call_encoded_len = encoded_call.len() as u32;
|
||||
let call_hash = <Test as pezframe_system::Config>::Hashing::hash(&encoded_call[..]);
|
||||
|
||||
assert_ok!(Whitelist::whitelist_call(RuntimeOrigin::root(), call_hash));
|
||||
assert_ok!(Preimage::note(encoded_call.into()));
|
||||
assert!(Preimage::is_requested(&call_hash));
|
||||
assert_ok!(Whitelist::dispatch_whitelisted_call(
|
||||
RuntimeOrigin::root(),
|
||||
call_hash,
|
||||
call_encoded_len,
|
||||
call_weight
|
||||
));
|
||||
assert!(!Preimage::is_requested(&call_hash));
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_whitelist_call_and_execute_without_note_preimage() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = Box::new(RuntimeCall::System(pezframe_system::Call::remark_with_event {
|
||||
remark: vec![1],
|
||||
}));
|
||||
let call_hash = <Test as pezframe_system::Config>::Hashing::hash_of(&call);
|
||||
|
||||
assert_ok!(Whitelist::whitelist_call(RuntimeOrigin::root(), call_hash));
|
||||
assert!(Preimage::is_requested(&call_hash));
|
||||
|
||||
assert_ok!(Whitelist::dispatch_whitelisted_call_with_preimage(
|
||||
RuntimeOrigin::root(),
|
||||
call.clone()
|
||||
));
|
||||
|
||||
assert!(!Preimage::is_requested(&call_hash));
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::dispatch_whitelisted_call_with_preimage(RuntimeOrigin::root(), call),
|
||||
crate::Error::<Test>::CallIsNotWhitelisted,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_whitelist_call_and_execute_decode_consumes_all() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = RuntimeCall::System(pezframe_system::Call::remark_with_event { remark: vec![1] });
|
||||
let call_weight = call.get_dispatch_info().call_weight;
|
||||
let mut call = call.encode();
|
||||
// Appending something does not make the encoded call invalid.
|
||||
// This tests that the decode function consumes all data.
|
||||
call.extend(call.clone());
|
||||
let call_encoded_len = call.len() as u32;
|
||||
|
||||
let call_hash = <Test as pezframe_system::Config>::Hashing::hash(&call[..]);
|
||||
|
||||
assert_ok!(Preimage::note(call.into()));
|
||||
assert_ok!(Whitelist::whitelist_call(RuntimeOrigin::root(), call_hash));
|
||||
|
||||
assert_noop!(
|
||||
Whitelist::dispatch_whitelisted_call(
|
||||
RuntimeOrigin::root(),
|
||||
call_hash,
|
||||
call_encoded_len,
|
||||
call_weight
|
||||
),
|
||||
crate::Error::<Test>::UndecodableCall,
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user