CSDB Keeper (#76)

- Implements Keeper. This is a wrapper around the "real" keeper (CSDB). Since we need to pass the context into the keeper we need to abstract the CSDB from the 
- Adds WithContext() to CSDB to support the above requirement
- Adds Keeper to app
This commit is contained in:
David Ansermino
2019-07-24 18:14:12 -04:00
committed by GitHub
parent 284c2a0333
commit d9d45b48b9
5 changed files with 278 additions and 21 deletions
+3 -4
View File
@@ -4,7 +4,6 @@ const (
// module name
ModuleName = "ethermint"
// TODO: Use this
// StoreKey to be used when creating the KVStore
StoreKey = ModuleName
)
EvmStoreKey = "evmstore"
EvmCodeKey = "evmcode"
)
+7 -2
View File
@@ -82,7 +82,7 @@ type CommitStateDB struct {
//
// CONTRACT: Stores used for state must be cache-wrapped as the ordering of the
// key/value space matters in determining the merkle root.
func NewCommitStateDB(ctx sdk.Context, ak auth.AccountKeeper, storageKey, codeKey sdk.StoreKey) (*CommitStateDB, error) {
func NewCommitStateDB(ctx sdk.Context, ak auth.AccountKeeper, storageKey, codeKey sdk.StoreKey) *CommitStateDB {
return &CommitStateDB{
ctx: ctx,
ak: ak,
@@ -93,7 +93,12 @@ func NewCommitStateDB(ctx sdk.Context, ak auth.AccountKeeper, storageKey, codeKe
logs: make(map[ethcmn.Hash][]*ethtypes.Log),
preimages: make(map[ethcmn.Hash][]byte),
journal: newJournal(),
}, nil
}
}
func (csdb *CommitStateDB) WithContext(ctx sdk.Context) *CommitStateDB {
csdb.ctx = ctx
return csdb
}
// ----------------------------------------------------------------------------