Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPNS resolve needs ability to purge cached records #10582

Open
3 tasks done
tennox opened this issue Nov 15, 2024 · 2 comments
Open
3 tasks done

IPNS resolve needs ability to purge cached records #10582

tennox opened this issue Nov 15, 2024 · 2 comments
Labels
help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up

Comments

@tennox
Copy link

tennox commented Nov 15, 2024

Checklist

Installation method

docker image

Version

#### CLI
Kubo version: 0.28.0
Repo version: 15
System version: amd64/linux
Golang version: go1.22.2
#### daemon (docker)

# ipfs version
ipfs version 0.32.0


### Config

```json
{
  "API": {
    "HTTPHeaders": {
      "Access-Control-Allow-Origin": [
        "http://localhost:3000",
        "http://localhost:5173",
        "http://localhost:5001",
        "http://127.0.0.1:5001",
        "https://webui.ipfs.io"
      ]
    }
  },
  "AcceleratedDHTClient": true,
  "Addresses": {
    "API": "/ip4/0.0.0.0/tcp/5001",
    "Announce": null,
    "AppendAnnounce": null,
    "Gateway": "/ip4/0.0.0.0/tcp/8080",
    "NoAnnounce": null,
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001",
      "/ip4/0.0.0.0/udp/4001/webrtc-direct",
      "/ip4/0.0.0.0/udp/4001/quic-v1",
      "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport",
      "/ip6/::/udp/4001/webrtc-direct",
      "/ip6/::/udp/4001/quic-v1",
      "/ip6/::/udp/4001/quic-v1/webtransport"
    ]
  },
  "AutoNAT": {},
  "Bootstrap": [
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
    "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
    "/ip4/104.131.131.82/udp/4001/quic-v1/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
  ],
  "DNS": {
    "Resolvers": {}
  },
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": true
    }
  },
  "Experimental": {
    "FilestoreEnabled": false,
    "Libp2pStreamMounting": false,
    "OptimisticProvide": false,
    "OptimisticProvideJobsPoolSize": 0,
    "P2pHttpProxy": false,
    "StrategicProviding": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "APICommands": [],
    "DeserializedResponses": null,
    "DisableHTMLErrors": null,
    "ExposeRoutingAPI": null,
    "HTTPHeaders": {},
    "NoDNSLink": false,
    "NoFetch": false,
    "PathPrefixes": [],
    "PublicGateways": null,
    "RootRedirect": ""
  },
  "Identity": {
    "PeerID": "12...kW"
  },
  "Internal": {},
  "Ipns": {
    "MaxCacheTTL": "1h",
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128,
    "UsePubsub": true
  },
  "Migration": {
    "DownloadSources": [],
    "Keep": ""
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "Peering": {
    "Peers": null
  },
  "Pinning": {
    "RemoteServices": {}
  },
  "Plugins": {
    "Plugins": null
  },
  "Provider": {
    "Strategy": ""
  },
  "Pubsub": {
    "DisableSigning": false,
    "Router": ""
  },
  "Reprovider": {},
  "Routing": {
    "AcceleratedDHTClient": false,
    "Methods": null,
    "Routers": null
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {},
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "RelayClient": {},
    "RelayService": {},
    "ResourceMgr": {},
    "Transports": {
      "Multiplexers": {},
      "Network": {},
      "Security": {}
    }
  }
}

Description

Context

I want to be able to trigger a refresh of my IPNS value. I tried lowering TTL & MaxCacheTTL (as suggested here) - but that will mean that the gateway has a ~40s delay for the first request after the cache entry was evicted.

So I thought: what if I regularily resovle the IPNS value without cache and thus refresh the cache?

ipfs name resolve k51qzi5uqu5dmi4ub822smfsajlh7utzcupuihc76py1zbzafe71rbmzm9jml3
/ipfs/bafybeih6fphlvcqaq6qmgsg7fky3vxxnyomtd6cmtvhrdtpob4m3v7pqou # old valueipfs name resolve --nocache --dhtt 10s k51qzi5uqu5dmi4ub822smfsajlh7utzcupuihc76py1zbzafe71rbmzm9jml3
/ipfs/bafybeighh3capanjwiug2aos6267krmv4czp2tdjzjn7wpfqnpe4jqpa4y # new valueipfs name resolve k51qzi5uqu5dmi4ub822smfsajlh7utzcupuihc76py1zbzafe71rbmzm9jml3
/ipfs/bafybeih6fphlvcqaq6qmgsg7fky3vxxnyomtd6cmtvhrdtpob4m3v7pqou # old value

It turns out kubo does find the new value, but appears to completely bypass the cache - also not updating it. That is unfortunate :/

@tennox tennox added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Nov 15, 2024
@gammazero
Copy link
Contributor

This is a sensible request but we should not change the way that --nocache works. instead, there should be something like --cache-purge to do what you are asking for.

@gammazero gammazero added help wanted Seeking public contribution on this issue P2 Medium: Good to have, but can wait until someone steps up and removed need/triage Needs initial labeling and prioritization labels Nov 19, 2024
@gammazero gammazero changed the title IPNS resolve --nocache doesn't update cache IPNS resolve needs ability to purge cached records Nov 19, 2024
@tennox
Copy link
Author

tennox commented Nov 19, 2024

Thanks. To be clear - it should not purge the cache, but update it when the value changed (i.e. there should not be a time in which there is no cache entry, which would delay gateway responses)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up
Projects
None yet
Development

No branches or pull requests

2 participants