-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
make state module public
ethcore/src/state/mod.rs
Outdated
@@ -186,8 +194,8 @@ impl AccountEntry { | |||
/// checkpoint can be discateded with `discard_checkpoint`. All of the orignal | |||
/// backed-up values are moved into a parent checkpoint (if any). | |||
/// | |||
pub struct State { | |||
db: StateDB, | |||
pub struct State<B> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not B: Backend
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More general > less general. This is a common pattern among e.g. structures in std
: constrain the generic parameters only when introducing functionality that depends on those constraints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd agree if there was some generic functionality, but State
is pretty much useless without a backend. Attempting to use it with unsupported type will leave you with a bare struct which does not really represent the State
abstraction. I think it would be better to explicitly disallow that.
Closes #4616.
This is intended to allow us to enact state changes on general databases/caches, rather than just the single
StateDB
.Also opens the door to executing EVMs over different account storage models, by moving the trie lookups fully into the backend, which may be done in the future.