Skip to content

[Bug]: schemasRuntimeApi.getIntentById does not return schemas for intent in order #2657

@JoeCap08055

Description

@JoeCap08055

What happened?

Description

schemasRuntimeApi.getIntentById, when called with a second argument of true, is supposed to return the list of schemas in order of oldest => newest (as indicated by increasing numeric schema ID). It does not. This is because the storage keys are returned in the lexical order of the hashed key, not the underlying key value.

Additional ON TESTNET ONLY:
On Testnet, it's possible that the most recent schema for an Intent may not be the largest schemaID numerically, due to:

  • schemaIDs created organically on Testnet start at 16000, but schemas synced from Mainnet start at 1
    However, since syncing schemas from Mainnet => Testnet is a manual process anyway, this can be mitigated operationally by:
  • Any time we sync schemas from Mainnet => Testnet we delete schemas > 16000
    OR
  • Any time we sync schemas from Mainnet => Testnet we mark any schemas > 16000 as either Deprecated or Unsupported

This is not an issue on Mainnet because schema IDs are monotonically increasing, and it is not an issue on local Dev chains because they are short-lived--although there is a discontinuous gap between Genesis schemas (from 1) and locally-created schemas (from 16000), schemas would always monotonically increase from 16000 once the chain is started.

AC

  • schemasRuntimeApi.getIntentById(intentId, true) always returns the list of schemas in increasing sorted order by ID

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions