Public IPs shared by two farms can disappear from GraphQL
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- graphql, typescript
Research direction
Start by inspecting the PublicIp entity and the farmUpdated handler, focusing on the address-only lookup and the cleanup at the end of the update. Change the entity key and both operations to include the farm, then verify that shared addresses remain visible for each farm and plan the required resync for the new entity IDs.
Written by the indexing model from the issue text.
Description
What happens
When the same public IP is registered on more than one farm, the indexer can end up
dropping that IP completely — it disappears from GraphQL even though the chain still
has it.
Why
PublicIp is stored one row per IP address, with no farm in the key. In
farmUpdated we look the IP up by address alone:
const savedIP = await ctx.store.get(PublicIp, { where: { ip: ip.ip.toString() }, ... })
So the row belongs to whichever farm claimed the IP first. Any farm that claims it
later finds the row already taken and skips it — no row is created for that farm.
Then, when the first farm eventually gives the IP up, the cleanup step at the end of
farmUpdated deletes the row. Nobody recreates it, so the IP is gone for good even
though it is still assigned to the second farm on chain.
Example (devnet)
125.25.25.2/16 was claimed by farm 2586 (block 10132677), then farm 4291
(block 10142664), then farm 2591 (block 10449919). On chain it currently belongs to
farm 2591. In GraphQL it does not exist at all.
How much it affects us
Small, and only in this one situation — it needs the same IP on two farms, which
shouldn't normally happen.
- devnet: 48 IPs sit on more than one farm. 7 chain IPs are missing from GraphQL.
- mainnet: 3 IPs sit on more than one farm (all shared between farms 44 and 3630).
1 chain IP is missing from GraphQL, and those 3 only ever show under farm 44.
Not a regression
This is long-standing behaviour, not something v2.13.0 introduced. The same code is
in v2.12.3. v2.13.0 actually improved things: before the resync devnet was missing 10
IPs, now it is missing 7, and the 32 IPs that had the wrong gateway are all correct
now. No IP is missing today that wasn't missing before.
Filing this so the remaining case isn't forgotten — it does not need to block anything.
Suggested fix
Key PublicIp by farm + IP instead of IP alone, so two farms can hold the same
address, and scope the lookup and the cleanup in farmUpdated to the farm being
updated. This changes entity IDs, so it needs a resync to take effect.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from threefoldtech/ledger_graphql
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
threefoldtech/ledger_graphql#202 ·
-
type_feature
Difficulty 5/5 Over a week Newbie friendliness 20/100
threefoldtech/ledger_graphql#189 · 1 comment ·
-
type_feature
Difficulty 5/5 Over a week Newbie friendliness 25/100
threefoldtech/ledger_graphql#188 ·
-
type_story
Difficulty 5/5 Over a week Newbie friendliness 20/100
threefoldtech/ledger_graphql#187 · 3 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
threefoldtech/ledger_graphql#122 · 1 comment ·
All issues in threefoldtech/ledger_graphql
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·