capsule-corp-ternoa / ternoa-subql-dictionary

Ternoa dictionary to query substrate on-chain data 🚚
https://dictionary-mainnet.ternoa.dev/
1 stars 3 forks source link

Incoherent Node id in events #36

Closed d4rk0snet closed 2 years ago

d4rk0snet commented 2 years ago

So here is my problem, in the dictionnary , you have a node id. but there is nowhere to map this node_id to the polkadot stash address of a validator node. The more disturbing is that when i retrieve the events info for PayoutStarted, the same stash address has 2 different node id. In my example , i asked for the payoutStarted Events. According to the polkadot documentation, in args i should get :

PayoutStarted(u32, AccountId32) interface: api.events.staking.PayoutStarted.is summary: The stakers' rewards are getting paid. [era_index, validator_stash]

So, if the nodeId is an internal id, at least we should have the same one for the same stash account and this is not the case.

Capture du 2022-08-26 00-12-22 Capture du 2022-08-26 00-12-50

Do you have any informations about it ?

ipapandinas commented 2 years ago

hi @d4rk0snet

the nodeId field is not related to the chain, it is a field handled by the database of the dictionary, I do not recommend to use this value.

If you want to filter PayoutStarted event for a specific address you can filter your query on argsValue:

{
  events(
    orderBy: [BLOCK_HEIGHT_DESC, EVENT_INDEX_DESC]
    filter: {
      and: [
        {
          call: { equalTo: "PayoutStarted" }
          argsValue: {
            contains: "TERNOA_ADDRESS" # 👈 use a Ternoa Address here
          }
        }
      ]
    }
  ) {
    nodes {
      call
      blockId
      argsValue
      argsName
    }
  }
}