Skip to content
Snippets Groups Projects
Commit f08c090b authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

rename NewOwnerKeyPayload

parent 6dc639c7
No related branches found
No related tags found
No related merge requests found
Pipeline #34046 waiting for manual action
......@@ -687,7 +687,7 @@ new_key_sig: T::Signature
Change identity owner key.
- `new_key`: the new owner key.
- `new_key_sig`: the signature of the encoded form of `NewOwnerKeyPayload`.
- `new_key_sig`: the signature of the encoded form of `IdtyIndexAccountIdPayload`.
Must be signed by `new_key`.
The origin should be the old identity owner key.
......
......@@ -21,8 +21,8 @@ use codec::Encode;
use frame_support::instances::{Instance1, Instance2};
use frame_support::{assert_noop, assert_ok};
use pallet_identity::{
IdtyName, IdtyStatus, NewOwnerKeyPayload, RevocationPayload, NEW_OWNER_KEY_PAYLOAD_PREFIX,
REVOCATION_PAYLOAD_PREFIX,
IdtyIndexAccountIdPayload, IdtyName, IdtyStatus, RevocationPayload,
NEW_OWNER_KEY_PAYLOAD_PREFIX, REVOCATION_PAYLOAD_PREFIX,
};
use sp_runtime::testing::TestSignature;
......@@ -123,7 +123,7 @@ fn test_smith_member_cant_change_its_idty_address() {
run_to_block(2);
let genesis_hash = System::block_hash(0);
let new_key_payload = NewOwnerKeyPayload {
let new_key_payload = IdtyIndexAccountIdPayload {
genesis_hash: &genesis_hash,
idty_index: 3u32,
old_owner_key: &3u64,
......
......@@ -161,7 +161,7 @@ benchmarks! {
// Change key a first time to add an old-old key
let genesis_hash = frame_system::Pallet::<T>::block_hash(T::BlockNumber::zero());
let new_key_payload = NewOwnerKeyPayload {
let new_key_payload = IdtyIndexAccountIdPayload {
genesis_hash: &genesis_hash,
idty_index: account.index,
old_owner_key: &account.key,
......@@ -176,7 +176,7 @@ benchmarks! {
// The sufficients for the old_old key will drop to 0 during benchmark
let caller_origin: <T as frame_system::Config>::RuntimeOrigin = RawOrigin::Signed(caller.clone()).into();
let genesis_hash = frame_system::Pallet::<T>::block_hash(T::BlockNumber::zero());
let new_key_payload = NewOwnerKeyPayload {
let new_key_payload = IdtyIndexAccountIdPayload {
genesis_hash: &genesis_hash,
idty_index: account.index,
old_owner_key: &caller_public,
......@@ -199,7 +199,7 @@ benchmarks! {
// Change key
// The sufficients for the old key will drop to 0 during benchmark
let genesis_hash = frame_system::Pallet::<T>::block_hash(T::BlockNumber::zero());
let new_key_payload = NewOwnerKeyPayload {
let new_key_payload = IdtyIndexAccountIdPayload {
genesis_hash: &genesis_hash,
idty_index: account.index,
old_owner_key: &account.key,
......
......@@ -417,7 +417,7 @@ pub mod pallet {
/// Change identity owner key.
///
/// - `new_key`: the new owner key.
/// - `new_key_sig`: the signature of the encoded form of `NewOwnerKeyPayload`.
/// - `new_key_sig`: the signature of the encoded form of `IdtyIndexAccountIdPayload`.
/// Must be signed by `new_key`.
///
/// The origin should be the old identity owner key.
......@@ -460,7 +460,7 @@ pub mod pallet {
};
let genesis_hash = frame_system::Pallet::<T>::block_hash(T::BlockNumber::zero());
let new_key_payload = NewOwnerKeyPayload {
let new_key_payload = IdtyIndexAccountIdPayload {
genesis_hash: &genesis_hash,
idty_index,
old_owner_key: &idty_value.owner_key,
......@@ -622,7 +622,7 @@ pub mod pallet {
let idty_index =
IdentityIndexOf::<T>::get(&who).ok_or(Error::<T>::IdtyIndexNotFound)?;
let genesis_hash = frame_system::Pallet::<T>::block_hash(T::BlockNumber::zero());
let payload = NewOwnerKeyPayload {
let payload = IdtyIndexAccountIdPayload {
genesis_hash: &genesis_hash,
idty_index,
old_owner_key: &account_id,
......
......@@ -16,7 +16,7 @@
use crate::mock::*;
use crate::{
Error, GenesisIdty, IdtyName, IdtyValue, NewOwnerKeyPayload, RevocationPayload,
Error, GenesisIdty, IdtyIndexAccountIdPayload, IdtyName, IdtyValue, RevocationPayload,
LINK_IDTY_PAYLOAD_PREFIX, NEW_OWNER_KEY_PAYLOAD_PREFIX, REVOCATION_PAYLOAD_PREFIX,
};
use codec::Encode;
......@@ -211,7 +211,7 @@ fn test_change_owner_key() {
.execute_with(|| {
let genesis_hash = System::block_hash(0);
let old_owner_key = account(1).id;
let mut new_key_payload = NewOwnerKeyPayload {
let mut new_key_payload = IdtyIndexAccountIdPayload {
genesis_hash: &genesis_hash,
idty_index: 1u64,
old_owner_key: &old_owner_key,
......@@ -363,7 +363,7 @@ fn test_link_account() {
.execute_with(|| {
let genesis_hash = System::block_hash(0);
let account_id = account(10).id;
let payload = NewOwnerKeyPayload {
let payload = IdtyIndexAccountIdPayload {
genesis_hash: &genesis_hash,
idty_index: 1u64,
old_owner_key: &account_id,
......@@ -425,7 +425,7 @@ fn test_idty_revocation_with_old_key() {
})
.execute_with(|| {
let genesis_hash = System::block_hash(0);
let new_key_payload = NewOwnerKeyPayload {
let new_key_payload = IdtyIndexAccountIdPayload {
genesis_hash: &genesis_hash,
idty_index: 1u64,
old_owner_key: &account(1).id,
......@@ -475,7 +475,7 @@ fn test_idty_revocation_with_old_key_after_old_key_expiration() {
})
.execute_with(|| {
let genesis_hash = System::block_hash(0);
let new_key_payload = NewOwnerKeyPayload {
let new_key_payload = IdtyIndexAccountIdPayload {
genesis_hash: &genesis_hash,
idty_index: 1u64,
old_owner_key: &account(1).id,
......
......@@ -124,9 +124,9 @@ pub struct IdtyValue<BlockNumber, AccountId, IdtyData> {
/// payload to define a new owner key
#[derive(Clone, Copy, Encode, RuntimeDebug)]
pub struct NewOwnerKeyPayload<'a, AccountId, IdtyIndex, Hash> {
pub struct IdtyIndexAccountIdPayload<'a, AccountId, IdtyIndex, Hash> {
/// hash of the genesis block
// Avoid replay attack between networks
// Avoid replay attack across networks
pub genesis_hash: &'a Hash,
/// identity index
pub idty_index: IdtyIndex,
......@@ -137,7 +137,7 @@ pub struct NewOwnerKeyPayload<'a, AccountId, IdtyIndex, Hash> {
#[derive(Clone, Copy, Encode, Decode, PartialEq, Eq, TypeInfo, RuntimeDebug)]
pub struct RevocationPayload<IdtyIndex, Hash> {
/// hash of the genesis block
// Avoid replay attack between networks
// Avoid replay attack across networks
pub genesis_hash: Hash,
/// identity index
pub idty_index: IdtyIndex,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment