Skip to content

tfchain-client-js: read wrappers crash / return un-decoded data on current runtime (entity storage, node decode, null handling) #1102

@sameh-farouk

Description

@sameh-farouk

Found via live devnet testing (spec 157) while fixing #1090 (twin ip). The same stale-runtime-assumption class affects several other tfgridModule read wrappers. Fixed in #1101.

Bugs

  1. Entity lookups query dead storage (critical — breaks activation-service).

    • getEntityIDByNameentitiesByNameID (renamed to entityIdByName)
    • getEntityIDByPubkeyentitiesByPubkeyID (renamed to entityIdByAccountID)
    • Both throw is not a function. activation-service's createEntity calls both (name/pubkey conflict pre-checks), so createEntity is broken against the current runtime. Return shape also changed (not-found decodes to null, not 0).
  2. Null crashes on non-existent ids. getEntity/getNode/getTwin do res.id on a null decode → Cannot read properties of null. Should throw a clean No such <x>.

  3. getNode returns un-decoded data.

    • Public config: reads res.public_config (snake; actual key is publicConfig) with a flat {ipv4,ipv6,gw4,gw6} shape; actual shape is nested { ip4:{ip,gw}, ip6:{ip,gw}, domain } → returned as hex.
    • city/country are nested under location (not top-level) → never decoded.
  4. getPricingPolicyById returns the policy name as raw hex (never hex2a-decoded).

Notes

  • Corrects the earlier "activation-service is API-compatible with the v2 client" assessment — the methods exist but query dead storage; only a live call exposed it. Relevant to Publish tfgrid-api-client 2.13.0 to npm #1099.
  • This client is barely maintained (used almost only by activation-service), which is why the read side drifted from the runtime.

Fixed and verified live on devnet in #1101.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions