informalsystems / tendermint-rs

Client libraries for Tendermint/CometBFT in Rust!
Apache License 2.0
617 stars 225 forks source link

light-client: improve LightStore API #428

Open romac opened 4 years ago

romac commented 4 years ago

The current LightStore API is a bit underpowered, and forces us to implement ad-hoc method like get_non_failed or latest_trusted_or_verified to keep the downstream code clean.

It would be nice to have a slightly more powerful, perhaps query-based, API that would remove the need for such ad-hoc methods.

Additionally, the sled-based light store should be guarded under a feature flag, in order to plan for potential other databases or just help downstream dependencies avoid the dependency on sled if they don't need it.

romac commented 4 years ago

Something else to keep in mind and think hard about when designing the new API/abstraction:

@xla: Generally what I think we see here is that we let the actual domain of block storage creep into our higher level abstractions, which is informed too much by the key/value store semantics and it's physicality. — https://github.com/informalsystems/tendermint-rs/pull/419#discussion_r452765452

xla commented 4 years ago

Maybe a broader look at the LightStore would include hiding/reducing the dependency on Sled, ie. https://github.com/informalsystems/tendermint-rs/pull/430#discussion_r452745330

romac commented 4 years ago

We should also keep https://github.com/informalsystems/tendermint-rs/pull/449#issuecomment-659527984 in mind.