-
Notifications
You must be signed in to change notification settings - Fork 39
Leios prototype: In memory LeiosDb for ThreadNet #1837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: leios-prototype
Are you sure you want to change the base?
Conversation
1db18f3 to
94cdaff
Compare
| newInMemoryLeiosDb :: IOLike m => m (LeiosDbHandle m) | ||
| newInMemoryLeiosDb = do | ||
| stateVar <- | ||
| newTVarIO | ||
| InMemoryLeiosDb | ||
| { imTxCache = Map.empty | ||
| , imEbPoints = IntMap.empty | ||
| , imEbPointsInverse = IntMap.empty | ||
| , imEbBodies = IntMap.empty | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So imo, I don't have to know much about the rest to say that this is a contention point. The entire state is a single TVar, it doesn't have to be.
Instead, there's 2 tables transactions and endorser-block-points, meaning two distinct TVars, they are independent.
So the first thing to try is to make them into separate TVars.
The more advanced options would be to use stm-containers and then:
txCache could be STMContainers.Map TxHash TxCacheEntry
ebPoints could be STMContainers.Map SlotNot (Map EbHash EbId)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was even thinking to split the LeiosDb into two concepts: LeiosEBStore and LeiosTxCache. This would follow more closely the component architecture that we should validate in the prototype: https://github.com/input-output-hk/ouroboros-leios/blob/main/docs/leios-design/README.md#architecture
94cdaff to
a0fa090
Compare
This is high-level enough to be possible to be mocked. The in-memory implementation might not be correct just yet, but the interface seems to work. Also dropped some unused intermediary functions and abstractions.
a0fa090 to
5db4411
Compare
Because.. why not make Byron Leios compatible
|
This should compile now, but changes like 74ebf94 should have made @bladyjoker and me stop and reflect earlier and not change the abstract |
Various changes to get the
ThreadNettests to compile and run. Most notable is the refactor ofLeoisDbintoLeiosDbHandlethat is used to switch between the sqlite implementation for production (inIO) and an in-memory implementation for testing inIOSim.