Skip to content

v3.13.3

Choose a tag to compare

@github-actions github-actions released this 30 Sep 21:05
· 3128 commits to main since this release
f523682

Nuthatch 3.13.3 makes nuthatch check tell the truth about incremental entities, and fixes what that
uncovered. It began as three faults found by running every example in the documentation against 3.13.2
and grew, because each fix showed check and dev disagreeing somewhere else: check passed entities
dev would not start, refused entities dev ran, and every entity nuthatch port-emit has ever
written could not start at all. It also stops log lines keeping an RPC URL's password, and stops
nest bundle publishing credentials. Anyone who authors entities, ports a subgraph, or puts credentials
in RPC URLs should take it.

Compatibility and upgrade

Replace the binary and restart. There is no storage migration and no NID change. What an operator may
notice:

  • Some entities dev could never run now refuse to start, with the reason, instead of faulting on their
    first row: an expression built directly from columns and literals that fails on every row (fee + '1',
    WHERE fee on an integer, SUM of an address), or a name that differs only in case from a decoded
    table. nuthatch check names the same
    things first.
  • nuthatch check passes entities it used to refuse, such as SUM(tokensRewards) over a uint256, and
    refuses ones it used to pass, in each case because it now agrees with dev.
  • An entity with no rows yet is an empty relation on /sql rather than a missing table, and its
    columns keep the types its SQL gives them whatever their values.
  • nuthatch nest bundle refuses a nuthatch.toml holding a webhook secret or a URL that looks keyed.
    --allow-secrets overrides it.
  • A nest port-emit wrote names its running totals <entity>_totals, not <entity>. Re-run
    port-emit; the old files could not have started.

check agrees with dev (#1587, #1590, #1591, #1598, #1599)

nuthatch check validated an entity with its own rules and never ran the compiler dev starts it with.
It now lowers and binds every entity through the same code, so the two refuse the same things in the same
words. Along the way:

  • Every decoded integer reaches SQL as exact decimal text, while the circuit reads it as a checked 128-bit
    integer, so SUM(tokensRewards) failed check and ran under dev. check now reads the columns an
    entity uses the way the circuit does, and scans every stored row of them for a value too large for
    128 bits, sealed history and, when no running nuthatch holds the store, the hot tail too, which the circuit faults on even in a row a WHERE would drop.
  • check failed every entity on a fresh nest, one that had indexed nothing yet, with "failed to prepare
    query".
  • A table or column named in a different case bound under check and was refused by dev; both now
    accept it, and refuse a name that matches two spellings.
  • The compiler now refuses, at start, an expression it can prove fails on every row whatever the data.
    The check is deliberately partial: a refusal is always right, but it does not look inside CASE or
    COALESCE, or reason about NULL, so some expressions that always fail, such as
    CASE WHEN TRUE THEN fee + '1' ELSE fee END, still pass it and fault at runtime, loudly, as before.
  • An authored view that reads an entity now checks, and binds on a fresh nest.
  • On a warm connection, an entity that had faulted still answered from the relation an earlier query
    had built. It now answers from none.

Reorgs, restarts and faults, against a chain broken on purpose (#1601, #1602, #1603)

This release was also run against a local fork of mainnet, forcing reorgs at depths 1 to 8, reorgs
below the seal, kill -9 during rollback, moves interrupted mid-join and entities pushed past their
bounds. Hot reorgs, crash recovery and interrupted moves all converged exactly. Three things did not:

  • After a warm restart on a quiet chain, /ready reported the nest at block 0 and, once the stall grace
    ran out, answered 503 as wedged, though it was caught up. The restored position now reaches the
    metrics at start.
  • An entity that faulted on the last block before the chain went quiet left its nest reported healthy
    on /nests and nuthatch_nest_health until another block arrived. The fault is now picked up while
    the cursor waits.
  • A reorg is served until a reorg check finds it: about half a second in the run, but with no fixed
    bound, since an idle cursor re-checks an unchanged tip at most every 12 seconds and a failing RPC
    delays it further. Below the seal that means the abandoned sealed rows are served until the nest
    halts. The operator guide now says so, and the halt no longer calls a fork deeper than every stored
    checkpoint "a reorg to block 0".

port-emit entities could not start (#1595)

nuthatch port-emit wrote each running total as a query over a union of tables, which the entity
compiler refuses, so dev stopped on the first one. check passed them, which is how it went unseen. A
total fed by one table is now an entity, <entity>_totals; one fed by several is a view of that name,
summed when read, since the compiler maintains one table or an inner join of two.

Log lines kept a URL's password

RPC failures are logged with the URL reduced to its host, so a key in the path or query never reaches a
log. The reduction kept anything before the host: https://alice:SECRET@rpc.example.com/path was logged
as https://alice:SECRET@rpc.example.com. If you have used an RPC URL with a user:password@ in it,
check what your logs retained.

Bundles published credentials (#1589)

nest bundle packs nuthatch.toml verbatim, so a keyed RPC URL or a webhook secret in it was published
with the bundle; the documentation said the opposite. bundle now refuses such a file and names each
credential, redacted. The test is a heuristic (userinfo, a key-named query parameter, a long token in the
path) and will not recognise every key, so keep credentials out of the file and pass endpoints at run
time with --rpc. Bundles already published are unchanged; if one carried a credential, rotate it.

A trailing slash on a mount answered 404 (#1588)

In a runtime, /usdc/ answered an empty 404 while /usdc answered 200, including when the mount
was suspended. A trailing slash now answers as the route without it.

Documentation

The documentation and the book were checked against 3.13.2 by running their examples, and 28 findings
were corrected (#1569).