Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api.query.identity.identityOf returns array for main Id and null for subId #4556

Closed
2 tasks done
dcolley opened this issue May 23, 2024 · 3 comments
Closed
2 tasks done
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.

Comments

@dcolley
Copy link
Contributor

dcolley commented May 23, 2024

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

Source:

https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fksm-rpc.stakeworld.io%2Fpeople#/chainstate

Accounts:
Main: HyLisujX7Cr6D7xzb6qadFdedLt8hmArB6ZVGJ6xsCUHqmx
Sub: JKhBBSWkr8BJKh5eFBtRux4hsDq4sAxvvmMU426qUA9aqEQ

  1. api.query.identity.identityOf returns an array. I would expect only 1 ID per account OR please document this behaviour going forward.
[
  {
    judgements: [
      [
        0
        Reasonable
      ]
    ]
    deposit: 6,688,333,305
    info: {
      display: {
        Raw: METASPAN
      }
      legal: None
      web: None
      matrix: None
      email: {
        Raw: [email protected]
      }
      pgpFingerprint: null
      image: None
      twitter: {
        Raw: @metaspan_io
      }
      github: None
      discord: None
    }
  }
  null
]
  1. identityOf for subId is empty
<none>

Steps to reproduce

Make a connection to People-kusama chain
Trigger the storage call for api.query.identity.identityOf via PJS, or js

@dcolley dcolley added I10-unconfirmed Issue might be valid, but it's not yet known. I2-bug The node fails to follow expected behavior. labels May 23, 2024
@bkchr
Copy link
Member

bkchr commented May 23, 2024

@TarikGul sounds like some PJS issue to me?

@TarikGul
Copy link
Member

@bkchr Yea this is polkadot-js/api related.

@dcolley This is totally expected as the return type of api.query.identity.identityOf is a Tuple: Option<ITuple<[PalletIdentityRegistration, Option<Bytes>]>>. This is mirrored from the chain as PJS decorates all its calls directly from the metadata.

When looking at the docs for identityOf:

	/// Information that is pertinent to identify the entity behind an account. First item is the
	/// registration, second is the account's primary username.
	///
	/// TWOX-NOTE: OK ― `AccountId` is a secure hash.
	#[pallet::storage]
	#[pallet::getter(fn identity)]
	pub(super) type IdentityOf<T: Config> = StorageMap<
		_,
		Twox64Concat,
		T::AccountId,
		(Registration<BalanceOf<T>, T::MaxRegistrars, T::IdentityInformation>, Option<Username<T>>),
		OptionQuery,
	>;

Apps also shows what the return types is going to be via here.

Screenshot 2024-05-23 at 10 35 37 AM

TL:DR The source of truth will always be the chain you are connected to, PJS just mirrors what the chain gives it. IMO i think we can close this as its totally expected, and documented on the storage calls in the sdk but also in PJS api augmented calls.

@dcolley
Copy link
Contributor Author

dcolley commented May 23, 2024

The spec of the call changed between 10.12.2 and 10.12.3 - no mention of this in the release notes.

10.12.2

identityOf: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<Option<PalletIdentityRegistration>>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;

10.12.3

identityOf: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<Option<ITuple<[PalletIdentityRegistration, Option<Bytes>]>>>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;

I have updated my code, thanks.

@dcolley dcolley closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.
Projects
None yet
Development

No branches or pull requests

3 participants