Take the graph that reads a token's supply, and one sqlite C

Market cap and fully diluted value printed a dash on every token page. The
supply behind both was never read for a token already indexed: a real symbol
was taken as proof the row was finished. graph v1.2.31 asks what is actually
missing, keeps every field it already had, and reports a supply in whole
tokens whatever the source. Asking is what a start does now, so the flag that
used to gate it is gone.

The same pin brings the sqlite the whole process opens under one name.
csqlite is the house amalgamation, registered "sqlite3"; upstream mattn
compiled a second copy of that same C and the link failed on darwin, while
the hanzoai/sqlite wrapper takes "sqlite" — already modernc's, which arrives
with hanzoai/replicate — and panics in init. One C, three packages, no
argument.

Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
2026-08-13 15:13:29 -07:00
co-authored by Hanzo Dev
parent 9101f05419
commit 4a38efb267
4 changed files with 36 additions and 20 deletions
+3 -3
View File
@@ -4,10 +4,10 @@ go 1.26.5
require (
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674
github.com/luxfi/graph v1.2.27
github.com/luxfi/indexer v1.5.4
github.com/hanzoai/csqlite v0.1.2
github.com/luxfi/graph v1.2.31
github.com/luxfi/indexer v1.5.6
github.com/luxfi/mdns v0.1.1
github.com/mattn/go-sqlite3 v2.0.3+incompatible
gopkg.in/yaml.v3 v3.0.1
)
+6 -4
View File
@@ -124,6 +124,8 @@ github.com/hablullah/go-hijri v1.0.2 h1:drT/MZpSZJQXo7jftf5fthArShcaMtsal0Zf/dnm
github.com/hablullah/go-hijri v1.0.2/go.mod h1:OS5qyYLDjORXzK4O1adFw9Q5WfhOcMdAKglDkcTxgWQ=
github.com/hablullah/go-juliandays v1.0.0 h1:A8YM7wIj16SzlKT0SRJc9CD29iiaUzpBLzh5hr0/5p0=
github.com/hablullah/go-juliandays v1.0.0/go.mod h1:0JOYq4oFOuDja+oospuc61YoX+uNEn7Z6uHYTbBzdGc=
github.com/hanzoai/csqlite v0.1.2 h1:4DzdgUfKADhzEP66Y30/HwepuBLrwt7NsemJMfrPGl4=
github.com/hanzoai/csqlite v0.1.2/go.mod h1:H31a/O6VXuklR9UBkgY++bmAK5uzVfXPqU0F6P9Wsos=
github.com/hanzoai/ltx v0.5.1 h1:jWamJSHg1RtvcarevSJ/W5lyPJfRB4vBYXDuxyyOup0=
github.com/hanzoai/ltx v0.5.1/go.mod h1:rWgoDyQiB5d+GOGYncKrQu6uS7Gnoh0xlm1hCU5rq5E=
github.com/hanzoai/lz4/v4 v4.1.22 h1:NjK1Umwaxb5lnoFB44iGPtGj58y/PLucNcCc2gE8q4I=
@@ -179,12 +181,12 @@ github.com/luxfi/database v1.21.1 h1:GNnoWVa82l+n2dK7x2aG8LR2NEToq6ZCRX0sQjmK0OM
github.com/luxfi/database v1.21.1/go.mod h1:Gc7Z2OPrrcYLnAL8B1trOnguXauOlSDV5tkviLN6Xec=
github.com/luxfi/geth v1.20.1 h1:QUGQr4AKvADjwMi7t8a0OfoyxShgEcI9pwie1jFYfm0=
github.com/luxfi/geth v1.20.1/go.mod h1:GV5bIMEgWviRN+jPXERyVpI16H3iHqPcdIokDoZdrvU=
github.com/luxfi/graph v1.2.27 h1:0f9Ka2B66xAa5Kvx+1qOlNYgSkCjplhIflhItcU7lng=
github.com/luxfi/graph v1.2.27/go.mod h1:zyR+rKsUeIWbY5MYP3YEEHR4HoHUm0LWNvjlUSkYlX8=
github.com/luxfi/graph v1.2.31 h1:JcCTerzKs8CqhXQzn3DDEUOMMsC1R0ud+XrX570v5K8=
github.com/luxfi/graph v1.2.31/go.mod h1:l5g8jQ7hdwTDG31SmFnMzb8AKn4B8flxFIDvggw+RTY=
github.com/luxfi/ids v1.3.2 h1:c6Rft5kZB4XqiCtWaGH47bfhaNFm3FGRfhEzI01GVeI=
github.com/luxfi/ids v1.3.2/go.mod h1:+5l8cYMbKpORJbQ2r98CYJo9TQATgUdnmzpYFZWMwwc=
github.com/luxfi/indexer v1.5.4 h1:AKsS5KhBZ4BV+1VliMrigfIzl7wDoh1/eCbfCd2/VHo=
github.com/luxfi/indexer v1.5.4/go.mod h1:j43mbcKk+w9fYwli1wPmvcpu8fNmjbig/+R4kHlV4Zw=
github.com/luxfi/indexer v1.5.6 h1:gkW4UhvDj5Qak6JTVSUq06uBmPjiWO60Y1K6ytqy27Q=
github.com/luxfi/indexer v1.5.6/go.mod h1:oypCgtib03LylLJY5TQYct8CAhm16gew6d83PusPFoc=
github.com/luxfi/log v1.4.3 h1:xkUKRWvQ4ZwvlUC2e0/RTtHYZOYSMvSQ9W9lbjwBmiI=
github.com/luxfi/log v1.4.3/go.mod h1:myIkufyiQomSQH34K981kbz6cG4WUoerRUh7F4XhlQI=
github.com/luxfi/math v1.5.1 h1:FDOY75e4vn/Xra1ij99xOS/9XdxQGCPP6HONHRkCwfg=
+9 -1
View File
@@ -11,7 +11,15 @@ import (
"testing"
"time"
_ "github.com/mattn/go-sqlite3"
// ONE sqlite C library in this binary, under a name nothing else claims.
// This process links graph and indexer as well as its own store, and
// csqlite is the house build of the amalgamation all three now open —
// registered as "sqlite3". Upstream mattn compiles a second copy of the
// same C, and defining every sqlite3_* symbol twice fails at link on
// darwin. Not its hanzoai/sqlite wrapper either: that registers
// "sqlite", and so does modernc.org/sqlite, which arrives with
// hanzoai/replicate — two packages under one name is a panic in init.
_ "github.com/hanzoai/csqlite"
)
// statsChains is the two-chain registry the stats tests resolve hosts against:
+18 -12
View File
@@ -13,7 +13,15 @@ import (
"sync"
"time"
_ "github.com/mattn/go-sqlite3"
// ONE sqlite C library in this binary, under a name nothing else claims.
// This process links graph and indexer as well as its own store, and
// csqlite is the house build of the amalgamation all three now open —
// registered as "sqlite3". Upstream mattn compiles a second copy of the
// same C, and defining every sqlite3_* symbol twice fails at link on
// darwin. Not its hanzoai/sqlite wrapper either: that registers
// "sqlite", and so does modernc.org/sqlite, which arrives with
// hanzoai/replicate — two packages under one name is a panic in init.
_ "github.com/hanzoai/csqlite"
"github.com/luxfi/graph/engine"
graphidx "github.com/luxfi/graph/indexer"
@@ -410,17 +418,15 @@ func (s *ChainSupervisor) runSubgraph(ctx context.Context, cfg ChainConfig, sg S
// tell which chain a line came from — or which chain had gone quiet.
Label: cfg.Slug + "/" + sg.Name,
}, store)
// One-shot enrichment of Token rows persisted by an older graph build with the
// address placeholder (symbol == shortAddr). Opt-in via BACKFILL_TOKENS=1; runs
// before Run so live indexing is not racing the same SeedToken writes. Cheap:
// ≤3 eth_calls per placeholder token, no re-sync. New tokens are enriched on
// first sight regardless of this flag.
if os.Getenv("BACKFILL_TOKENS") == "1" {
if n, err := idx.BackfillTokens(ctx); err != nil {
log.Printf("[%s/%s] token backfill: %v (enriched=%d)", cfg.Slug, sg.Name, err, n)
} else {
log.Printf("[%s/%s] token backfill: enriched=%d", cfg.Slug, sg.Name, n)
}
// What a start is for: ask the chain about the Token rows still short an
// answer — a symbol an earlier read never got, a supply a build that never
// asked for one left empty. Before Run, so live indexing is not racing the
// same writes. A row with everything on it costs nothing, which is why this
// is simply what a start does rather than something to remember to turn on.
if n, err := idx.BackfillTokens(ctx); err != nil {
log.Printf("[%s/%s] token backfill: %v (settled=%d)", cfg.Slug, sg.Name, err, n)
} else {
log.Printf("[%s/%s] token backfill: settled=%d", cfg.Slug, sg.Name, n)
}
go func() {
if err := idx.Run(ctx); err != nil && ctx.Err() == nil {