Ly Gravity

Null Is Not Zero: Autopsy of a Risk Engine That Returned Nothing and Rendered Green

CryptoLion • • Finance

Nine sections. Zero information points. A schema-valid payload.

That was the complete output of a second-stage analysis framework I dissected in January. The upstream parser had handed it a template with every field inert — domain label: unclassified. Domain confidence: not evaluated. Information-point list: empty. The framework did the only correct thing available to it. It refused. It printed a status of BLOCKED, and it enumerated, in advance, the three ways it could have proceeded anyway: fabricated project names, invented TVL figures, token allocations pulled from air. It declined all three.

Then the consumer layer ate it.

The scoring service downstream of that framework reads nine dimension scores, takes a weighted mean, and writes a risk number to a dashboard. Nine N/As went in. A 2.3 out of 10 came out. The badge rendered green. Over the seven days I watched that pipe, it emitted forty-one composite scores. Eleven of those were built on payloads with fewer than three evaluable dimensions. All eleven rendered green. No alert fired. No human was paged. The JSON validated. The schema, technically, was satisfied.

Nothing about the underlying assets had changed in those seven days. What changed was that a data pipe broke, and the break produced a number that was indistinguishable, in shape and color, from a number produced by actual analysis.

This is not a story about a broken parser. Parsers break constantly and the world absorbs it. This is a story about the default value — the most dangerous primitive in crypto infrastructure, and the one nobody puts in scope.

The default is not a fallback. It is an assertion you never made.

The context here matters because most readers will file this under "dashboard bug" and move on. It isn't. What I was looking at was the same failure class that has frozen half a billion dollars of ETH, drained a lending market on Avalanche, and quietly mispriced collateral on a top-five chain — just expressed in a research pipeline rather than a Solidity contract. The mechanism is identical in every case. A read operation returns something that is not a value. The caller coerces it into a number. The number is zero, or it is the last known number, or it is a floor parameter chosen in a calmer regime. The system proceeds, because proceeding is the default, and defaults do not generate exceptions.

Crypto has spent a decade hardening its cryptography and almost none of it hardening its nulls. We audit reentrancy. We audit access control. We do not audit what happens when the data isn't there.

Type confusion is where this starts, and it starts earlier than most people think.

In JavaScript, the language Stack most of these dashboards on, undefined comes from absence, null comes from assignment, and 0 comes from computation. Three different provenances, one numeric type. The coercions are asymmetric in ways that break intuition: Number(null) is 0, but Number(undefined) is NaN. null >= 0 evaluates true while null > 0 evaluates false. null == 0 is false. So a comparison guard written as if (x > 0) will reject null, but a guard written as if (x >= 0) will accept it, and the two guards read identically to a reviewer at 2 a.m.

Then JSON removes the evidence. JSON has no undefined and no NaN. Serialize an object with a missing key and the key simply vanishes. Serialize one with a NaN and you get null, or a dropped field, depending on the library. By the time the payload crosses one process boundary, "this field was never populated" and "this field was explicitly empty" are the same bytes on the wire. The distinction I spent the first half of my career defending — between unknown and known to be zero — does not survive a single JSON.stringify.

A validator that permits absence is not a validator. It is a comment.

Now the arithmetic, which is where the damage compounds.

SQL was designed before anyone thought carefully about this, and its treatment of NULL is not a bug but a philosophy: unknown values propagate as unknown. Except in aggregates, where they vanish. SUM ignores NULLs. AVG ignores NULLs — and it also subtracts them from the denominator. That is the whole problem in one sentence. Take a thirty-day average TVL series where the indexing layer drops out for three days during a liquidity crunch, and those three days carry a real 40 million while the other twenty-seven carry 100 million. True thirty-day mean: 94.0 million. Mean as computed with NULLs silently excluded: 100.0 million. A 6.4% overstatement, produced by no bug at all, merely by the standard behavior of the standard aggregate function in the standard database.

Widen the outage to five days — an ordinary subgraph reindex, nothing exotic — and the true mean is 86.7 million against a reported 100.0 million. Fifteen percent. And the bias is not random. It is directional, because outages cluster with volatility, and volatility clusters with the exact periods when you need the number to be correct.

The only number that changed was the denominator, and the denominator is the part nobody logs.

The composite score has the same anatomy. Suppose a nine-dimension framework evaluates three dimensions and scores them 7, 8, and 6 on a scale where higher means riskier. Sum: 21. If the aggregation divides by the number of dimensions actually evaluated, you get 7.0 — elevated, flag it, read the disclosure. If the aggregation divides by nine, because the schema has nine fields and the code says nine, you get 2.33 — moderate-low, green badge, ship it. Identical inputs. Opposite conclusions. The difference is not in the data, not in the model, and not in the weights. It is a coalesce in a dashboard config file that someone wrote in fifteen minutes and nobody has read since.

I have seen this pattern in three separate vendor pipelines now. In each case the fix was one line. In each case the finding was rated informational, because nothing had broken yet.

Crypto has an on-chain version of this and it has already been priced.

In May 2022, a major oracle feed for a collapsing asset returned a floor. The aggregator's answer is not the median of reported prices; it is max(minAnswer, min(median, maxAnswer)), and that floor had been set at a tenth of a dollar back when a tenth of a dollar was an absurd tail scenario. When the asset traded at fractions of a cent, the feed did not error. It did not go stale. It returned 0.10, a valid number, correctly signed, freshly timestamped, inside its heartbeat window. Every downstream protocol that checked updatedAt got a green light.

A lending market on BNB Chain liquidated against that floor for weeks and ended with roughly eleven million dollars of unrecoverable debt. A smaller market on Avalanche was drained completely — the attack was, in essence, borrow against an asset the oracle insisted was worth ten thousand times its market price. The oracle was not hacked. Nobody broke a signature. A risk parameter chosen for one regime silently became a mispricing engine in another, and the system's only defense was a staleness check that the value comfortably passed.

Entropy wins. Always check the fees — and check what the number is when the number is a floor.

This is not a 2022 curiosity. It is the same disease, and my own audit history is full of it.

When I tore through the MKR collateralization logic in Solidity v0.4.11 back in late 2017, the thing that kept me up was not the collateral ratio math. It was that arithmetic in that compiler version could not fail. Subtraction below zero wrapped. Multiplication past 2^256 wrapped. You did not get an exception. You got a number, well-typed, plausible, wrong by a factor of 10^77. The following April, a token contract's batchTransfer did exactly that and minted a balance of 2^255 out of an overflow in a multiplication of two quantities that individually looked reasonable. Checked arithmetic arrived in 0.8.0 in December 2020, and the first thing half the ecosystem did was wrap hot paths in unchecked for the gas — reintroducing the exact property the compiler had just removed. Silent wraparound is a default value. It is the default value of the machine's integer type, reached by a path the developer believed was unreachable.

Uninitialized state is the same family, with a longer rap sheet. In Solidity, mapping(address => uint256) returns zero for any key never written. Enum variables default to their first member — which is NONE if you named it carefully and ACTIVE if you did not. In July 2017, a multisignature wallet library shipped with its initializer unprotected on the library contract itself, and the library had never been initialized, because libraries usually aren't. An attacker called initWallet on it, became its owner, and invoked kill. The self-destruct propagated into every wallet that delegated to the library. Roughly 513,774 ETH, frozen in a single transaction, by a function that should have reverted and instead succeeded because the state it read was empty and empty was permissive.

I did a four-month reconstruction of a collapsed exchange's withdrawal engine after 2022, and the thing that still bothers me is not the fraud. It's the read path. The routing logic could not distinguish "no settlement record exists" from "settlement record says proceed." Both reads returned an empty result set. The code's branching treated empty as proceed. That is not a clever fraud, it's a null check that was never written, and it survived four years of internal review because the happy path always had a record and the unhappy path always looked like a withdrawal that was merely slow.

And the null does not have to be in the ledger. In 2025 I spent five months inside the recursive SNARK verification of a rollup I won't name, and the edge case I eventually filed was not in the curve arithmetic or the Fiat-Shamir transcript. It was in the public-input vector. A verification key that accepts a vector of the correct length but does not constrain every element against the expected statement will happily accept a proof for a statement whose inputs are zero — because zero is a valid field element, and the verifier had no notion of a public input that was supposed to be there. The proof was sound. The statement was empty. Cryptographic soundness protects the proof, not the claim.

Oracle staleness deserves its own paragraph because it is the most widely deployed version of the mistake. Every consumer of a price feed is supposed to check updatedAt against a heartbeat. Many do. Fewer check whether the round they read is the round they think they read — answeredInRound was deprecated in newer aggregator versions precisely because people were misusing it, and when it went away, the check that depended on it went away with it. A round that is three days old but inside a seven-day heartbeat returns a valid struct, with a valid price, and a valid timestamp. It is not stale by the only definition the contract enforces. It is stale by the only definition that matters.

Machine learning pipelines have industrialised the same coercion. fillna(0) is one line and it converts a missing feature into a real observation. Gradient-boosted trees handle NaN natively — they learn a default direction per split, which is a learned treatment of absence rather than an asserted one — but the moment you impute zero upstream, the model cannot recover the distinction. It learns that this feature is sometimes zero, and it fits a split around it, and the split means something entirely different from what the analyst intended. During my DeFi Summer detour into Uniswap v2's constant product curve, the lesson that stuck wasn't the loss formula — it was the reference point. Impermanent loss at a 2x price ratio is 5.72%, and at 4x it is 20%, and those two numbers, quoted without the ratio, are indistinguishable from each other and from noise. Impermanent loss is real. Do your math. But also: a number without its denominator is not a number, it's an advertisement.

My EIP-1559 simulations in August 2021 taught me the same thing at protocol scale. The base fee adjustment targets 15 million gas per block and moves at most 12.5% per block. My sims found non-linear deflationary pressure at low traffic — outcomes that the simple "burn reduces supply" narrative could not express, because the narrative had been fitted in a high-traffic regime and never tested at the boundary. Every model is correct inside the regime where it was fitted. The failures live at the boundary, and boundaries are exactly where defaults get chosen and never revisited.

So here is where I stop agreeing with the people who want to fix this.

The obvious response to an empty payload is a gate: validate, short-circuit, alert, retry. The report I dissected actually recommended precisely that — a null check between stage one and stage two, a length-zero short circuit, a confidence threshold that routes to human review. All correct. All insufficient.

Because the retry loop is the vulnerability. A retry that eventually returns a payload does not return a valid payload. It returns the last cached one. A backfill that fills yesterday's hole with the last known value converts a data gap into a false continuity — the series becomes unbroken, and the break becomes invisible, which is strictly worse than an obvious hole. A human review queue that gets cleared by an operator under time pressure becomes a rubber stamp inside a week; I have watched that happen in three organisations. Every remediation for the empty payload is a machine for manufacturing the exact default-value bug we just catalogued on-chain.

The uncomfortable inversion is this: the framework that refused was the most valuable component in the stack. It abstained. Abstention is the only output that carries no fabricated information. It cost the operator a decision and saved them from a false belief, and in a sideways market, where the honest answer to most questions is "there is no signal yet," abstention is the modal correct answer.

Now price it. A research vendor charges for coverage. If it returns "insufficient data" on thirty percent of its universe, it loses thirty percent of its perceived utility, and the seats go to the vendor that always has a number. Abstention has negative marginal revenue. Given that incentive structure, the equilibrium is not accuracy — it is fabricated completeness, produced by well-intentioned engineers writing coalesce statements. Nobody in that chain is lying. They are responding to a price signal.

The auditors do it too. "No critical findings" is read by every client as "safe". The two statements are not the same, and the gap between them is where the next nine-figure loss is currently sitting, unpriced.

2017 vibes. Proceed with skepticism.

So the fix has to be structural, not procedural — and it has to live in the type system, because procedures get skipped under deadline and types do not. Absence needs to be a first-class state that propagates all the way up the stack without ever being coerced. Option in Rust. Result with an explicit Unavailable variant. Three-valued logic in the query layer, with AVG that returns NULL when the denominator drops below a declared threshold instead of silently shrinking. Schemas with required keys and a validator that rejects on absence rather than tolerating it. And at the very top, a scoring layer that is physically incapable of emitting a number when the input count falls below the minimum — not configured not to, incapable. A dashboard that renders grey when it does not know, and stays grey until somebody resolves it.

The prediction I'll put my name on: the first nine-figure loss of the agentic era will not be a reentrancy, a key compromise, or a bridge verification bug. It will be a default value that propagated through four systems that each individually believed the layer below them. An agent reads a stale price, or an absent balance, or a floor parameter, and executes against it with perfect mechanical discipline and zero judgment about provenance. The cryptography will hold. The claim will be empty.

Which leaves one question worth asking of every pipeline you depend on, and it is not "does it produce numbers." It is: what does it produce when it has nothing, and who downstream knows the difference?

If nobody knows, you are not measuring risk. You are measuring the latency of your own ignorance.

Market Prices

BTC Bitcoin
$59,831.1 +1.52%
ETH Ethereum
$1,657.29 +0.26%
SOL Solana
$72.45 +1.13%
BNB BNB Chain
$565.52 +2.35%
XRP XRP Ledger
$0.9461 +0.96%
DOGE Dogecoin
$0.0584 -0.65%
ADA Cardano
$0.1481 +1.65%
AVAX Avalanche
$6.5 -0.20%
DOT Polkadot
$0.6667 +2.18%
LINK Chainlink
$8.91 -2.65%

Fear & Greed

12

Extreme Fear

Market Sentiment

Event Calendar

{{年份}}
22
03
unlock Optimism Unlock

Circulating supply increases by about 2%

28
03
unlock Arbitrum Token Unlock

92 million ARB released

08
04
upgrade Solana Firedancer

Independent validator client goes live on mainnet

12
05
halving BCH Halving

Block reward halving event

30
04
upgrade Celestia Mainnet Upgrade

Improves data availability sampling efficiency

15
04
halving Bitcoin Halving

Block reward reduced to 3.125 BTC

10
05
upgrade Ethereum Pectra Upgrade

Raises validator limit and account abstraction

18
03
unlock Sui Token Unlock

Team and early investor shares released

Altseason Index

42

Bitcoin Season

BTC Dominance Altseason

Gas Tracker

Ethereum 28 Gwei
BNB Chain 3 Gwei
Polygon 42 Gwei
Arbitrum 0.5 Gwei
Optimism 0.3 Gwei

Market Cap

All →
# Coin Price
1
Bitcoin BTC
$59,831.1
1
Ethereum ETH
$1,657.29
1
Solana SOL
$72.45
1
BNB Chain BNB
$565.52
1
XRP Ledger XRP
$0.9461
1
Dogecoin DOGE
$0.0584
1
Cardano ADA
$0.1481
1
Avalanche AVAX
$6.5
1
Polkadot DOT
$0.6667
1
Chainlink LINK
$8.91

🐋 Whale Tracker

🔵
0x4d7b...7774
1h ago
Stake
14,738 BNB
🔴
0xeaac...ce1c
12m ago
Out
920,424 USDT
🔵
0x5d93...9352
3h ago
Stake
342,408 DOGE

💡 Smart Money

0x6e58...b39d
Top DeFi Miner
+$3.7M
75%
0x5c7f...a11e
Institutional Custody
+$0.9M
81%
0xdd7b...a901
Experienced On-chain Trader
+$1.7M
85%

Tools

All →