nspcc-dev / nspcc-dev/neofs-node
Revise blockchain height check on startup
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 38
- Forks
- 51
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 38
Description
Inner Ring and Storage nodes check that height of the underlying blockchain height is greater or equal than the latest encountered one optionally persisted in the local storage (config and config respectively).
App requests current height by RPC, compares results with peristed one and fails if the local value is greater.
Which chain is stuck?
according to @aprasolova experience, we an encounter next error in log:
RPC block counter 738108 didn't reach expected height 2272533
It is not visible from the message which chain - main or side - is stuck. It's proposed to reflect blockchain kind in this log message.
Await or not await
it's possible that chain node currently synchronizes its state, and it hasn't reached up-to-date state yet. In this case NeoFS node will immediately fail. In fact, it could wait within some context (global or with some sane deadline) and free admin to periodically restart the app.
btw in code check function is called awaitHeight which syntactically implies a background wait, but in fact does not wait.
maybe there are other signs that will allow NeoFS to understand what exactly is happening at the moment and distinguish between freeze and synchronization, for example If so, then we could improve behavior and admin UX. @AnnaShaleva @roman-khimov
Blockchain reset
if chain was reset, and admin restarts the node - it will fail until fresh chain will reach the height not less than persisted one. In this case it's not obvious for admin that state should be reset too. As possible solution, we could also take into accout blockchain network magic, but it may be also left untouched.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pkg/morph/subscriber/subscriber.go at awaitHeight, then review the linked config entries in config/example/ir.yaml and config/example/node.yaml. Determine the agreed behavior for identifying the chain, waiting during synchronization, and handling a reset before changing the startup check. Done means the behavior and admin-facing error clearly distinguish these cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- blockchain, go
- Domain
- backend, blockchain, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100