Closed goshawk-3 closed 5 months ago
Option 1: Assumes that GetResource
msg brings the block certificate
.
function handleGetResource(hash):
begin
block = searchInLedgerCF(hash)
if block is not found:
block = searchInCandidatesCF(hash)
if block is found:
attachCertificate(block)
sendBlockToRequester(block, requester_addr)
end
*CF - RocksDB column Family
Option 2 Assumes that the Sender maintains a cache of received Quorum messages.
// in Receiver:
function handleGetResource(hash):
begin
block = searchInLedgerCF(hash)
if block is not found:
block = searchInCandidatesCF(hash)
if block is found:
// sends a candidate without certificate
sendCandidateToRequester(block, requester_addr)
end
// in Requester:
function handleCandidate(candidate_block)
begin
fetchCertificateFromCache(Hash)
block = attachCertificate(candidate_block)
on_block_event(block)
end
WRT Option 2:
Store/Persist Quorum Msg in RocksDB ColumnFamily. It will be deleted if it is fetched or it expires. On receiving a block without certificate, the requester looks for the corresponding Certificate in Quorum CF. Thus we can store many Quorums (on-disk) temporarily.
Describe the bug It has been discovered that there could be a timing conflict between the
flood_request
handling and block acceptance processes. Essentially, while a node is handling a GetResource(a.k.a GetData) request for ablock A
, it might simultaneously be in the process of accepting the sameblock A
, resulting in the failure of theGetResource
request.To Reproduce The scenario has been reproduced multiple times in
localnet
where network latency is zero however this is supposed to be a valid scenario in testnet network especially if EST(accept/finalize) call takes longer.Expected behaviour If a node knows the requested block (e.g it may be stored in Candidates CF ), it should be provided. The sooner it's provided, the more synchronized the network will become.
Logs/Screenshot
Additional context An identical problematic situation has been occurring in the ITN/testnet, where there is race between GetData request and block acceptance too.