Skip to content

Conversation

@rus-alex
Copy link
Contributor

Replaces exact state.StateDB struct with more general evmcore.StateDB interface.
This is necessary for easier maintain go-opera on different state db implementation (flat, erigon, etc.).

@rus-alex rus-alex requested review from hadv and uprendis December 12, 2022 17:25
Comment on lines 141 to 144
evmDb := gdb.EvmStore().EvmDb
if evmDb == nil {
panic("unknown EvmDb format")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might wrap these into a function in evmstore.Store to avoid duplicate code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better I will add different error messages which explain each case.

return nil, err
}

state, ok := evmcore.IsMptStateDB(statedb)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for asking, was just looking into the code and the consensus and found PRs.
How do you think, does it worth it to use generics+interfaces here to get rid of type assertion and have more strict type checks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be an over-engineering for now. All we need is check here does the proofs complies with the legacy format.
We should not return others kind of proofs because clients understand the legacy (MPT) only.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants