Skip to content

Release: develop -> main - #130

Merged
TaprootFreak merged 1 commit into
mainfrom
develop
Aug 31, 2026
Merged

Release: develop -> main#130
TaprootFreak merged 1 commit into
mainfrom
develop

Conversation

@github-actions

Copy link
Copy Markdown

Automatic Release PR

This PR was automatically created after changes were pushed to develop.

Commits: 1 new commit(s)

Checklist

  • Review all changes
  • Verify CI passes
  • Approve and merge when ready for production

…efresh (#129)

* Read isClosed and principal live from chain in positions refresh

The positions refresh already overwrites collateralBalance, virtualPrice
and interest with the live contract state but copied closed and principal
verbatim from the indexer. The indexer only updates those two fields in
its MintingUpdate handler, so a position whose last MintingUpdate never
reached the index stayed open with a stale principal in /positions/list
and /positions/open although the contract reported it as closed with
zero debt.

Read isClosed() and principal() per position in the same batched refresh
and fall back to the indexed values only when the RPC call fails.

* Keep closed monotonic when merging indexed and live flag

closed is only ever set to true on-chain, so OR the indexed flag with
the live isClosed() result instead of replacing it. A stale read from an
eventually consistent RPC node can then never reopen a position that the
index already knows as closed.

* Clarify comment on live principal and closed reads

State the motivation once and spell out that principal replaces the
indexed value while closed is OR-ed with it.

* Keep an observed closed flag across refresh cycles

The indexed closed flag is fetched fresh on every refresh, so a failed
live read in a later cycle would have dropped a closure that an earlier
cycle had already observed. OR the previously cached flag into the
merge so that a position seen as closed stays closed.

---------

Co-authored-by: TaprootFreakAI <315477232+TaprootFreakAI@users.noreply.github.com>
@TaprootFreak
TaprootFreak merged commit 2d6fb19 into main Aug 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants