Skip to content

Conversation

@ch1bo
Copy link

@ch1bo ch1bo commented Jan 23, 2026

Various changes to get the ThreadNet tests to compile and run. Most notable is the refactor of LeoisDb into LeiosDbHandle that is used to switch between the sqlite implementation for production (in IO) and an in-memory implementation for testing in IOSim.

Comment on lines +110 to +119
newInMemoryLeiosDb :: IOLike m => m (LeiosDbHandle m)
newInMemoryLeiosDb = do
stateVar <-
newTVarIO
InMemoryLeiosDb
{ imTxCache = Map.empty
, imEbPoints = IntMap.empty
, imEbPointsInverse = IntMap.empty
, imEbBodies = IntMap.empty
}
Copy link
Contributor

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)

Copy link
Author

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

@jasagredo jasagredo removed their request for review January 26, 2026 16:44
@bladyjoker bladyjoker linked an issue Jan 27, 2026 that may be closed by this pull request
4 tasks
@ch1bo ch1bo force-pushed the ch1bo/leios-prototype-threadnet branch from 94cdaff to a0fa090 Compare January 29, 2026 07:36
@ch1bo ch1bo requested review from bladyjoker and removed request for amesgen, dnadales, fraser-iohk, geo2a and jorisdral January 29, 2026 14:34
ch1bo added 5 commits January 29, 2026 15:49
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.
@ch1bo ch1bo force-pushed the ch1bo/leios-prototype-threadnet branch from a0fa090 to 5db4411 Compare January 29, 2026 14:50
@ch1bo
Copy link
Author

ch1bo commented Jan 29, 2026

This should compile now, but changes like 74ebf94 should have made @bladyjoker and me stop and reflect earlier and not change the abstract forgeBlock interface and likely stick into the forge loop via a new SupportLeios type class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prototype EB production

3 participants