orbs-network / orbs-network-go

Orbs node virtual chain core reference implementation in Go
MIT License
47 stars 12 forks source link

Add a fork test on every commit in block storage #863

Open talkol opened 5 years ago

talkol commented 5 years ago

IMO we currently test for forks during CommitBlock only with the latest block

Forks are so dangerous that we should test for forks on every commit attempt

meaning:

when somebody calls BlockStorage.CommitBlock and block storage already has a block at this height, block storage should do a byte-wise compare of the block header (results header is enough)

if we want something more efficient it may be enough to compare the txBlockHash inside the results block header

electricmonk commented 5 years ago

@OdedWx do we need this for Q3?

OdedWx commented 5 years ago

BlockStorage should accept commits only for the latest block + 1. The above check is a debug optimization to identify an unintentional fork or an attack in order to report it. not an immediate priority.

electricmonk commented 5 years ago

The concern is not debug, but more of a production monitoring issue