ssbc / ssb-ebt

secure scuttlebutt replication with epidemic-broadcast-trees
MIT License
18 stars 10 forks source link

Replace obz with p-defer #53

Closed arj03 closed 3 years ago

arj03 commented 3 years ago

When trying to write a test that uses ssb-db2 I ran into a race condition where the ebt state clock was set after a publish (sbot.post) call was handled, meaning we would end up with an incorrect state because the vector clock overwrites the current state. Furthermore that was a problem in request and block where they are using the clock to figure out what to do, but the clock might not have been properly loaded at the time of the request or block call. This PR fixes those 3 cases.

Lastly this PR changes our synchonization mechanism to be p-defer so promise bases instead of obz. We don't really need all that functionality, the only thing we are interested in is that the clock has been set before we start doing things that needs the state.