Skip to content

Conversation

@martintomazic
Copy link
Contributor

Closes #6382

How to test:

Run stateless client node with at least one configured runtime (triggers history reindex).

Prior to this fix, if you set your trust root to be younger than your configured provider's last retained height, your indexer will get stuck. This PR should fix this.

@netlify
Copy link

netlify bot commented Nov 2, 2025

Deploy Preview for oasisprotocol-oasis-core canceled.

Name Link
🔨 Latest commit 4546610
🔍 Latest deploy log https://app.netlify.com/projects/oasisprotocol-oasis-core/deploys/6907dd65b79db60007bf2ecf

@martintomazic martintomazic force-pushed the martin/fix/stateless-client/last-retained-height branch from 56168db to 4546610 Compare November 2, 2025 22:38
@martintomazic martintomazic marked this pull request as ready for review November 2, 2025 23:04
@martintomazic
Copy link
Contributor Author

This may cause reverse issues now, e.g. if your provider has less history then your configured trust.

Log when configuring trust height that is 9 days old against my localhost provider that has history from 8 days ago:

{"caller":"indexer.go:237","err":"failed to reindex batch: failed to get runtime state: failed to get state root: failed to get transactions from any provider: rpc error: code = Unknown desc = cometbft: block query failed: height 29025440 is not available, lowest height is 29051682","height":29165710,"level":"warn","module":"runtime/history/indexer","msg":"failed to reindex blocks","runtime_id":"000000000000000000000000000000000000000000000000a6d1e3ebf60dff6c","ts":"2025-11-03T10:07:47.573477627Z"}

I believe this change is still correct, and the log is expected.

It is your responsibility to configure correct trust against the configured providers. Sure we could find a minimum of your trust and all providers last retained height. But then there is composed provider, scorer etc. Also what if the one provider with most retained history suddenly stops serving... Worst case you again rely on this log so we don't solve anything with complicating things.

Nevertheless, my suggestion is to reflect this requirement under Setting trust root for stateless client node - "configured trust should be younger than your providers last retained height, taking their pruning and your speed of reindexing into account". See existing discussion oasisprotocol/docs#1472 (comment). Realistically if you configure a recent/latest trust as suggested this is not a problem at all.

@peternose
Copy link
Contributor

peternose commented Nov 3, 2025

Yes, I was thinking about that during review, and the node should probably switch to another provider if data cannot be found. Another option would be to take max, but that raises problems as you would need to contact all providers.

@martintomazic
Copy link
Contributor Author

Another option would be to take max, but that raises problems as you would need to contact all providers.

And even with that you are not safe as the max may prune right after. I suggest merging this for now, and encourage to use very recent if not latest trust root given that anything else is impractical and slow.

@martintomazic martintomazic merged commit f5a234b into master Nov 3, 2025
5 checks passed
@martintomazic martintomazic deleted the martin/fix/stateless-client/last-retained-height branch November 3, 2025 11:55
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.

oasis-node/stateless: Incorrect GetLastRetainedHeight may block runtime history reindex

4 participants