trufnetwork / trufnetwork/node

Problem: settlement can't tell a capture was taken too early

Open
#1,435 0 comments 0 reactions 1 assignee View on GitHub

@MicBun is already working on this.

Since Sep 19, 2026.

Dominant language
Go
Stars
7
Forks
3
Avg merge
3h 2m
Merged PRs (30d)
13

Description

A market resolves on a captured query result. request_attestation takes that
capture and stores it in attestations; settle_market reads it back and decodes
an outcome from it.

The two are only loosely connected. request_attestation is a general primitive —
it refers to neither markets nor settle_time — it is PUBLIC, and the
query_components of any live market are readable from ob_queries. So a capture
of a market's query can be taken at any height, including well before the market
falls due, over a window that has not finished.

Settlement has no way to tell such a capture apart from one the settlement path
took after settle_time. attestations records created_height and
signed_height and no wall-clock time at all, while ob_queries.settle_time is a
unix timestamp, so the two cannot be compared from inside settle_market.

Why it matters for whichever capture is chosen

The requirement in

is that a market resolves against the value that existed at settle_time. The
ordering settlement uses to approximate that is chosen in:

Every ordering that settlement can express today is a proxy for that:

Ordering What an early capture does What a late capture does
Earliest created_height wins ignored
Latest signed_height ignored wins

Neither can express "at or after settle_time", because the comparison is not
available. The choice between them changes which direction is exposed, not whether
one is.

What this looks like today

Nothing has been captured early: 0 of 1,319 captures on mainnet were taken at a
height below their market's creation height, and the smallest gap is +34 blocks.
This is about a window that is open rather than one that is being used.

What would close it

Settlement needs to be able to tell whether a capture was taken within the window
the market settles on. A block timestamp recorded alongside created_height at
capture time would make the comparison expressible; so would anything else that
lets settle_market place a capture relative to settle_time.

Existing rows would need whatever is added to be backfilled, since the value is
not recoverable from attestations alone.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.