CreateContext() can be called with any height that is greater than or equal to Height, meaning it is impossible to know the ValidatorSet for given height if height is greater than Height.
When ConsensusMsgs with "future" heights are received, it gets funneled to HandleMessage(), and this would result in a lock until the first call to GetNextStateRootHash() is resolved.
It is hard to know the full extent of the problem as this may cause issues on very non-trivial edge cases. The issue is farther exacerbated by having the value of Height becoming further asynchronous with the state of BlockChain the ConsensusContext is referencing.
There are numerous issues related to this problem.
CreateContext()
can create aContext
with a wrongValidatorSet
https://github.com/planetarium/libplanet/blob/7bbce0e6f6f5c3477c0d7ebb8a283040a3d20bf9/Libplanet.Net/Consensus/ConsensusContext.cs#L455-L461CreateContext()
can be called with anyheight
that is greater than or equal toHeight
, meaning it is impossible to know theValidatorSet
for given height ifheight
is greater thanHeight
.HandleMessage()
can lock the entireConsensusContext
https://github.com/planetarium/libplanet/blob/7bbce0e6f6f5c3477c0d7ebb8a283040a3d20bf9/Libplanet.Net/Consensus/ConsensusContext.cs#L252-L275ConsensusMsg
s with "future" heights are received, it gets funneled toHandleMessage()
, and this would result in a lock until the first call toGetNextStateRootHash()
is resolved.It is hard to know the full extent of the problem as this may cause issues on very non-trivial edge cases. The issue is farther exacerbated by having the value of
Height
becoming further asynchronous with the state ofBlockChain
theConsensusContext
is referencing.