hyperledger-iroha / iroha-dco

Iroha - A simple, decentralized ledger
http://iroha.tech
Apache License 2.0
988 stars 296 forks source link

MST: Limit stored transactions #2202

Closed MBoldyrev closed 5 years ago

MBoldyrev commented 5 years ago

Description of the Change

IR-431

MstState gets a limit of transactions it can store. The value is configured through iroha config file.

Benefits

Prevent unlimited growth of MST storage.

Possible Drawbacks

Some batches may get dropped. Malicious peer can keep other peers' MST states filled with fake batches, so that the legitimate batches will be dropped.

Usage Examples or Tests [optional]

Alternate Designs [optional]

Use something like circular buffer to allow newer batches push out the oldest ones.

igor-egorov commented 5 years ago

A comment before the code review regarding an alternative design:

Use something like circular buffer to allow newer batches push out the oldest ones.

I don't think that applying circular buffer here is a good solution. That case can cause a situation when a user puts half of the signatures to a transaction and then the transaction will disappear at some point in GetPendingTransactions query response. It will be neither passed to stateful validation nor "mst"-expired in case of circular buffer substitution. Probably for that case, we will have to introduce some additional status (what will look very weird for me).