logos-co / nomos-node

Nomos blockchain node
38 stars 13 forks source link

Add missing error check: `LedgerError::ParentNotFound` #630

Open youngjoon-lee opened 3 months ago

youngjoon-lee commented 3 months ago

I found this when running the fuzz test in #629. If the parent of the block being processed is missing, we may encounter LedgerError::ParentNotFound as well as cryptarchia_engine::Error::ParentMissing. Although the real error handling logic is not implemented yet, I think both errors need to be checked for future implementations.

youngjoon-lee commented 2 months ago

In which cases do you encounter cryptarchia_ledger::LedgerError::ParentNotFound? I would not expect that to happen in a normal execution, as you would first get cryptarchia_engine::Error::ParentMissing

Since we're calling self.ledger.try_update first before calling self.consensus.receive_block, the cryptarchia_ledger::LedgerError::ParentNotFound can be returned.

youngjoon-lee commented 1 week ago

@zeegomo What do you think about this fix? I still think we need to handle ParentNotFound as this PR fixes.