Skip to content
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

Separate blockstore for state DB and chain DB #338

Closed
aakoshh opened this issue May 19, 2023 · 1 comment · Fixed by consensus-shipyard/fendermint#113
Closed

Separate blockstore for state DB and chain DB #338

aakoshh opened this issue May 19, 2023 · 1 comment · Fixed by consensus-shipyard/fendermint#113

Comments

@aakoshh
Copy link
Contributor

aakoshh commented May 19, 2023

There needs to be separate instances so the IPLD blockstore that gets bytes written to it for reasons other than transaction execution are not visible to the FVM actors.

In the FVM SDK we can open an IPLD block by CID and it looks it up in the blockstore. I note that there's a TODO about reachability there.

In Forest, when we create a new VM we pass it the blockstore of the StateManager which it shares with the ChainStore. This has the same DB as everything else, and is shared with the Libp2pService, where it's given for example to the Bitswap manager as well.

Fendermint also uses the same DB, although at the moment nothing other than block execution affects it, because the chain state is in Tendermint. But when we add the IPLD resolver this will change.

What happens if an actor is asking for a CID to be looked up, a CID it received from the outside world and didn't put into the store itself, and some nodes have it (courtesy of Bitswap), while others do not. They would have a different view of the world and calculate a different result from the same parent blocks.

In a BFT consensus like Tendermint, it would be a consensus failure that validators cannot back out of, it would split the chain.

We should use a semi-transparent block store here: the IPLD resolver should see state that the actors have written, but the actors should not see state only written by the IPLD resolver. It can be the same RocksDB but using different namespaces, and an abstraction over them. (Forest doesn't use namespaces but Fendermint does).

Luckily because Tendermint is forward only, at least we don't have to worry about cleaning up after orphaned blocks.

@aakoshh
Copy link
Contributor Author

aakoshh commented May 22, 2023

Apparently the reason this isn't an immediately looming problem on the mainnet is that currently users can only use the FEVM and the FEVM does not expose IPLD as part of the syscalls, so Ethereum smart contracts are fine.

@jsoares jsoares transferred this issue from consensus-shipyard/fendermint Dec 19, 2023
@jsoares jsoares closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants