Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

missing offer event from event entity #169

Open
roiLeo opened this issue Mar 31, 2023 · 9 comments
Open

missing offer event from event entity #169

roiLeo opened this issue Mar 31, 2023 · 9 comments

Comments

@roiLeo
Copy link
Contributor

roiLeo commented Mar 31, 2023

Tested on https://squid.subsquid.io/snekk/v/004/graphql & https://squid.subsquid.io/snekk/v/005/graphql

query MyQuery {
  events(where: {interaction_eq: OFFER}) {
    interaction
    id
  }
}

result
[]

@roiLeo
Copy link
Contributor Author

roiLeo commented Apr 3, 2023

@vikiival any idea how to bypass [PROBLEM] Entity needs to be real from ensure(<NE>), not the first time I'm facing this fatal error on indexer

@vikiival
Copy link
Member

vikiival commented Apr 3, 2023

@vikiival any idea how to bypass [PROBLEM] Entity needs to be real from ensure(<NE>), not the first time I'm facing this fatal error on indexer

Hey It means that NFT you are requesting is not in the DB. If you want simple hack just do

if (!entity) {
  console.warn('Entity not found.. Skipping')
  return
}

@vikiival
Copy link
Member

vikiival commented Apr 3, 2023

I have it as fatal error because I want to ensure that everything is validated

@roiLeo
Copy link
Contributor Author

roiLeo commented Apr 4, 2023

Hey It means that NFT you are requesting is not in the DB. If you want simple hack just do

if (!entity) {
  console.warn('Entity not found.. Skipping')
  return
}

This hack doesn't work for me.
I have same issue as #127 (comment) as it try to withdraw offer on non-existing NFT (weird flex but ok)

It break when ensure nftEntity in handleOfferWithdraw

const nftEntity = ensure<NE>(await get(context.store, NE, tokenId));
if (!nftEntity) {
    return logger.warn(`[WITHDRAW OFFER] ${tokenId} entity not found.. Skipping`);
}
[WITHDRAW OFFER]: 679692
MarketplaceOfferWithdrawnEvent {
  _chain: Chain {
    description: {
      types: [Array],
      call: 182,
      digest: 11,
      digestItem: 13,
      event: 17,
      eventRecord: 16,
      eventRecordList: 15,
      signature: 494,
      storage: [Object],
      constants: [Object]
    },
    getClient: [Function (anonymous)],
    storageHashCache: Map(0) {},
    constantValueCache: Map(0) {},
    jsonCodec: JsonCodec { types: [Array] },
    scaleCodec: Codec { types: [Array] },
    events: Registry {
      types: [Array],
      definitions: [Object],
      hashes: [Object]
    },
    calls: Registry { types: [Array], definitions: [Object], hashes: {} }
  },
  event: {
    args: {
      class: '3132385849',
      instance: '1',
      who: '0x8cc1b91e8946862c2c79915a4bc004926510fcf71c422fde977c0b0e9d9be40e'
    },
    id: '0000679692-000006-bf5a6',
    indexInBlock: 6,
    name: 'Marketplace.OfferWithdrawn',
    phase: 'ApplyExtrinsic',
    pos: 10,
    extrinsic: {
      error: null,
      hash: '0x74dba45696daa745ed362caf66e9ef96100db5d75c2224737f87e251a7773dcb',
      id: '0000679692-000002-bf5a6',
      indexInBlock: 2,
      pos: 14,
      signature: [Object],
      success: true,
      version: 4,
      tip: 0n,
      call: [Object]
    },
    call: {
      args: [Object],
      error: null,
      id: '0000679692-000002-bf5a6',
      name: 'Marketplace.withdraw_offer',
      origin: [Object],
      pos: 13,
      success: true
    }
  }
}

@vikiival
Copy link
Member

vikiival commented Apr 4, 2023

Ensure does not throw errors 👀
It just casts any to T.

Wondering why do you have error for this? Which one do you use main or other release?

@roiLeo
Copy link
Contributor Author

roiLeo commented Apr 4, 2023

Ensure does not throw errors 👀 It just casts any to T.

hmmmm not sure about since one since it's the line I'm blocking on.

  const tokenId = tokenIdOf(event);
  logger.debug(`token: ${tokenId}`); //  token: 3132385849-1

  // IMO this line throw error
  const nftEntity = ensure<NE>(await get(context.store, NE, tokenId));

  if (!nftEntity) {
    logger.warn(`[WITHDRAW OFFER] ${tokenId} entity not found.. Skipping`);
    return;
  }

Wondering why do you have error for this?

because there is a block on chain with a WITHDRAW OFFER event that is related on a non-existing Nft Entity

Which one do you use main or other release?

Start from release-004 since main is outdated.

edit: don't you think it could come from getWithdrawOfferEvent? since we're handling only isV55 & isV81 event type

@vikiival
Copy link
Member

vikiival commented Apr 4, 2023

My bet is that your indexer is indexing basilisk instead of snek

{
  nftEntityById(id: "3132385849-1") {
    name
    blockNumber
  }
}

Snek

Screenshot 2023-04-04 at 11 43 23

Basilisk

Screenshot 2023-04-04 at 11 44 25

My .env

ARCHIVE_URL=https://basilisk-rococo-firesquid.play.hydration.cloud/graphql
NODE_URL=wss://rococo-basilisk-rpc.hydration.dev

@vikiival
Copy link
Member

vikiival commented Apr 4, 2023

since we're handling only isV55 & isV81 event type

Are there more types?

@roiLeo
Copy link
Contributor Author

roiLeo commented Apr 4, 2023

My bet is that your indexer is indexing basilisk instead of snek

lol I was afraid that was it

but my file is the default one set on repo (same as you)

ARCHIVE_URL=https://basilisk-rococo-firesquid.play.hydration.cloud/graphql
NODE_URL=wss://rococo-basilisk-rpc.hydration.dev

&

No migrations are pending
●  note      Welcome to the Processor! ROCOCO
08:59:47 INFO  sqd:processor last processed block was 679289
08:59:47 INFO  sqd:processor processing blocks from 679290
08:59:48 INFO  sqd:processor prometheus metrics are served at port 64728

Maybe someone withdraw offer on snek but token Id is on bsx.

Are there more types?

what about v71, v92

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants