Closed gnulib closed 5 years ago
We need to change above submitter sync protocol so that it does not save the unknown transactions into ToBeFetchedStack
while walking up the submitter's history. Instead, we want to walk up the history as much as needed without saving anything (so that no "overflow" attack can be done), then once we find a sequence that has all known transactions, we start processing down the history sequence and process all transaction for that sequence before moving to next (breadth first processing). In this process, if there is any double spending situation found, it will create a double spending alert (causing shard to flush and re-sync) and the submitter should be "black-listed" on the node.
SubmitterWalkUpRequestMsg
to peer with submitter ID and last sequenceSubmitterWalkUpRequestMsg
from a peer, respond back with SubmitterWalkUpResponseMsg
with all known pairs of shard-id/transaction-id for that submitter ID and seq in requestSubmitterWalkUpResponseMsg
from peer
SubmitterWalkUpRequestMsg
to peer with submitter ID and last sequenceSubmitterProcessDownRequestMsg
to peer with submitter ID and next seq to fetch all known shard/transaction from peerSubmitterProcessDownRequestMsg
from a peer, respond back with a SubmitterProcessDownResponseMsg
that has submitter id, seq and all transactions for that submitter/seqSubmitterProcessDownResponseMsg
from a peer
SubmitterTxQ
to process~ process the transaction as a network transactionPopSubmitterTxQ
event and transition to ProcessSubmitterQueue~ send a SubmitterProcessDownRequestMsg with next higher sequence to peer (All of below is not applicable since we are processing transaction right away and not keeping in any queue for later processing)
PopSubmitterTxQ
event
SubmitterTxRequestMsg
to peerSubmitterTxRequestMsg
, respond back with transaction details in SubmitterTxResponseMsg
SubmitterTxResponseMsg
PopSubmitterTxQ
event to process next item
Objective
Honest nodes with DLT stack should be in sync w.r.t. to transaction history for a submitter. If peer nodes exchange any transaction that has a last submitter transaction not known, they should reject the network transaction and instead initiate a submitter history sync.
Acceptance Criteria
As per "A simple double spending resolution protocol" rules described in #30, when a node receives a network transaction from a peer when the "last transaction" from submitter is not known, a submitter sync will be initiated with the peer as following:
ToBeFetchedStack
for the peer's connectionSubmitterHistoryRequest
message to the peer with "submitter ID" and previous "submitter Seq" (i.e. current seq - 1)SubmitterHistoryRequest
messageSubmitterHistoryResponse
message with all the "transaction id" for that submitter ID and sequence requestedSubmitterHistoryResponse
messageToBeFetchedStack
ToBeFetchedStack
(i.e. all transactions were known), thenToBeFetchedQueue
and send aSubmitterTxRequest
message to peer with ~Submitter ID, submitter seq and~ tx IDSubmitterHistoryRequest
message to the peer with "submitter ID" and previous "submitter Seq" (i.e. msg seq - 1)SubmitterTxRequest
messageSubmitterTxResponse
messageSubmitterTxResponse
messageToBeFetchedQueue
and send aSubmitterTxRequest
message to peer with ~Submitter ID, submitter seq and~ tx ID