Skip to content

v0.9.0

Choose a tag to compare

@cargopete cargopete released this 30 Jul 18:44
· 4783 commits to main since this release
65889af

RFC-0029 is complete. In-place safe from 0.8.x and 0.7.x: no data migration, no config changes, and nothing in your nest changes unless you opt in.

Read this first, because the version number is misleading. 0.9.0 is a minor bump for a capability that is breaking, not for a change that breaks you. Upgrading an existing nest is the same binary swap it has always been - stop, replace, start. The breaking thing is a new declaration you have to choose, on a new nest, and this release exists to make choosing it safe.

Backfills can skip the block-header round trip entirely

block_timestamp is one of the seven implicit columns every table carries, and it is the most expensive one by a wide margin: it lives in the block header, which eth_getLogs does not return, so it costs a separate eth_getBlockByNumber per distinct block. RFC-0029 §4 measured it at roughly 85% of backfill wall clock; on the OBIB workload below it is now worse than that - see the A/B further down.

That is not because timestamps got slower. It is because everything around them got faster: adaptive windows (below) cut the log-fetching half to 321 requests for 22.2M blocks, so the timestamp half went from dominant to overwhelming. A "percentage of wall clock" is only meaningful against the wall clock it was measured on, and ours moved underneath it.

nuthatch init 0xA0b8…eB48 --no-timestamps

drops the column from every table and stops paying for it.

This is an init-time declaration and deliberately not a flag you can flip. Turning timestamps off removes a column from every table - breaking, for anyone querying it - and it changes the bytes of every sealed segment. Segments are content-addressed, so a nest that switches cannot reuse its own history and must re-index from scratch. For an existing nest, "faster backfill" and "re-index everything once" largely cancel out.

So the win is real but it is a new-nest win, which is a narrower claim than "backfills get faster", and we would rather say so than let you find out after the re-index.

Three guards enforce it, because a declaration nobody checks is a comment:

  1. The runtime refuses the flip. The nest records what it actually indexed; a start that disagrees bails, naming what the change is and what to do instead. Without this, pasting block_timestamps = false into an existing nuthatch.toml leaves one nest holding two schemas - rows and segments written before the edit carrying the column, everything after not - and nothing says so until a query hits the wrong half.
  2. schema_version = 2 guards against the previous binary. The runtime guard protects this build; it can do nothing about 0.8.x, which does not know the field and would parse a timestamp-free nest, ignore the declaration, and index timestamps into a store built without them. The version stamp makes that binary refuse the nest outright. A timestamped nest stays schema_version = 1 and remains readable by 0.8.x - the version records what a reader must understand, not which binary wrote it.
  3. The config refuses to be self-inconsistent. A file claiming v1 while declaring a v2-only feature is exactly the file an older binary accepts and gets wrong, so we will not be the source of one.

When it is clearly right: a new nest, over a long history, where you know every consumer and none of them ask a time-series question. When it is clearly wrong: anyone might later want "per day" or "per hour". Blocks give you ordering; only timestamps give you time. Unsure means keep them - the default is on for a reason.

The concurrent backfill path can now adapt its window

AdaptiveWindow has always sized the eth_getLogs range from what came back. It was bypassed on the pipelined path, which built its whole window list up front at a fixed width - so our fast path was the one that could not adapt.

That is worst exactly where it is most common: a contract deployed late in a chain's history has a long empty prefix, and at --window 10000 a 19.89M-block prefix costs ~1,989 requests that each return nothing. The controller grows 4× per empty response and covers the same ground in a handful of steps.

Two details that are not incidental:

  • The controller is fed raw log count, not decoded rows. It is sizing a response: a log matching no decoder still costs bytes on the wire and still counts against the provider's result cap. Feeding it decoded rows would make a nest with a narrow event allowlist (events = ["Transfer"] on a chatty contract) read dense history as empty and grow toward the ceiling - the one direction where an oversized window actually hurts.
  • This is only safe because seal boundaries are data-determined (RFC-0028 §4). take_sealable cuts at a row count and extends to a block boundary, reading nothing about the window width, so varying the width cannot vary segment identity. The two backfill paths now adapt on different feedback sequences and must still seal byte-identical segments; the path-equivalence test asserts precisely that.

A second backfill-killing defect, found by running the benchmark

If you index with timestamps at --concurrency 8, upgrade. This one aborts backfills, and it was
in the default configuration.

Error: seal-direct getLogs 20609360..=20709359 failed after 5 attempts
Caused by:
    0: getLogs 20634359..=20659358
    1: malformed response: error decoding response body

The provider was innocent - that exact range returns a valid 3.5 MB body with 5,645 logs in 2.6 s to
curl. The failure was ours: the 20-second request timeout covers body streaming, so a
large-but-slow response fails while being read, with reqwest's opaque "error decoding response body"
and no cap marker anywhere in the text. We classified it Transient, which sent it down the
deliberately bounded speculative-split path instead of the unbounded classified one, where it ran out
of splits and retried five times at the same width.

This is 0.8.2's lesson wearing a second costume, one function further down from where we fixed it:
Transient is the absence of a classification, not a finding. A body-read timeout on a large
response is a size signal, just an implicit one - halving the range halves the bytes and the read
time, where retrying an identical width provably cannot help.

The distinction is the fix, and it cuts both ways: a body-read timeout now narrows; a body
syntax error stays transient, because garbage from a load balancer is no smaller in halves and
splitting a dead endpoint down to single blocks is the failure RFC-0028 was avoiding.

Why nothing caught it sooner. Every RPC test we have uses mocks, and a mock never streams a slow
multi-megabyte body. It also only fires when the timestamp fan-out competes with window concurrency for
the same connection pool - so a --no-timestamps run sails straight past it. It took an A/B against a
real provider to surface, which is the argument for benchmarking against one.

The number, and how to check it

RFC-0029 began when Sentio's OBIB benchmark was pointed at nuthatch and case 1 did not finish. It finishes now.

Wall clock 74.8 s (median of 3)
Records decoded 294,278
RPC requests 321, for 22,200,001 blocks
Peak RSS 320 MB
Provider / hardware stock Alchemy mainnet endpoint / 11-core laptop, 18 GB

Case 1 is Transfer from LBTC over blocks 0-22,200,000. Reports are committed in docs/bench/, the method is in RFC-0029 §11.1, and the nest is four lines of config plus init --no-timestamps - case 1 stores six fields and no timestamp, so the declaration matches the workload's own schema rather than being a benchmark trick.

294,278 is OBIB's own top-level README figure, matched to the record. Their case-1 README says 296,734 for five platforms and 296,278 for a sixth - a 2,456-record spread their repo does not reconcile. Every run of ours landed on 294,278, and a control run over a 3-block-shorter range found exactly two fewer, so our counts move precisely with the range. That is worth raising with them, and it matters more than the timing: a throughput number from a run that decoded the wrong records is worth nothing.

We tested the obvious confound rather than hoping. The first run took 289.9 s; the next took 74.8 s on the same range. A 3.9× swing on identical work looks exactly like provider-side caching of the queries we had just made - which would make 74.8 s a warm-cache figure and any comparison indefensible. Re-running over a never-fetched range took 77.0 s. Caching was not the explanation; the first run was degraded by 15 transport errors and their retry backoff. The control report ships alongside the result.

On comparing this to other indexers. Envio HyperIndex's 6.94 min and Sentio's 11.02 min on the same case are served from purpose-built columnar stores, not JSON-RPC - which is why OBIB normalises the endpoint. We are not claiming a placing. The claim is that a general-purpose-RPC indexer, on a laptop, against an endpoint anyone can rent, is in the same conversation as infrastructure built specifically to avoid RPC.

What the timestamped A/B says so far. The identical workload with block_timestamp has run past
21 minutes against the 75 seconds without it, and had not finished when these notes were written -
so the honest statement is a lower bound of >17x, not a ratio. It is also the run that surfaced the
defect above, which is its own answer about what the column costs at concurrency.

Still unmeasured, and recorded as such: the --concurrency 16 vs --concurrency 1 ratio RFC-0029
sets as an acceptance criterion.

Verifying the download

curl -fsSLO https://github.com/nightswatchhq/nuthatch/releases/download/v0.9.0/nuthatch-x86_64-unknown-linux-gnu.tar.gz
curl -fsSLO https://github.com/nightswatchhq/nuthatch/releases/download/v0.9.0/nuthatch-x86_64-unknown-linux-gnu.tar.gz.sha256
sha256sum -c nuthatch-x86_64-unknown-linux-gnu.tar.gz.sha256
Artifact Contains
nuthatch-x86_64-unknown-linux-gnu.tar.gz · :0.9.0 · :latest embedded - no database driver
nuthatch-scaled-x86_64-unknown-linux-gnu.tar.gz · :0.9.0-scaled scaled - worker, control, serve --hot-store