hashgraph / hedera-services

Crypto, token, consensus, file, and smart contract services for the Hedera public ledger
Apache License 2.0
295 stars 125 forks source link

Self-contained `State` module #15574

Open imalygin opened 1 week ago

imalygin commented 1 week ago

This is the logical continuation of the Public Merkle API initiative (#10988). Also, it overlaps with #14772.

Currently, a Block node would have to not only use the swirlds-state-api module but also swirlds-platform-core as a dependency, which, in turn, contains functionality that is not relevant in the context of the state (consensus, gossip, transaction handling).

We need a State module that has not only a set of API interfaces but also all the necessary implementations to represent the full Merkle state.

### Tasks
- [ ] Break up `swirlds-state-api` into `swirlds-state-api` and ``swirlds-state-api-impl`
- [ ] Create a design doc outlining all the necceary changes required for this module
- [ ] https://github.com/hashgraph/hedera-services/issues/15638
poulok commented 2 days ago

We discussed at DevCon that this State Module may also need to include the management of states similarly to the SwirldStateManager which keeps a thread-safe reference to the mutable state and the latest immutable state, but more than that. It could include logic that does things like ensure that only a single loaded state is mutable and that it is always the latest one even if the user of the module loads another, older state from disk.