-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Transient Stores and Store Refactor #1481
Conversation
c6fb76e
to
b8660aa
Compare
Codecov Report
@@ Coverage Diff @@
## develop #1481 +/- ##
===========================================
+ Coverage 63.42% 63.45% +0.02%
===========================================
Files 117 118 +1
Lines 6940 6972 +32
===========================================
+ Hits 4402 4424 +22
- Misses 2283 2292 +9
- Partials 255 256 +1 |
store/rootmultistore.go
Outdated
// Commits each store and returns a new commitInfo. | ||
func commitStores(version int64, storeMap map[StoreKey]CommitStore) commitInfo { | ||
storeInfos := make([]storeInfo, 0, len(storeMap)) | ||
storeInfos := make([]storeInfo, 0, len(storeMap)/2) |
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.
should be len(storeMap)/2*2
224579d
to
bd0f7e2
Compare
bd0f7e2
to
c183fc9
Compare
c183fc9
to
daed85e
Compare
move gasconfig to types, make GetKVStoreWithGas take GasConfig fix lint modify transientstore in progress add test for transientstore fix errors fix test fix errors and lint last fix
daed85e
to
e3de3e0
Compare
e3de3e0
to
8f00ab4
Compare
8f00ab4
to
31786cc
Compare
in progress in progress fix all keeper/handler/types, start working on test finalize rebase fixing clients add linear_cli.go, refactor relayer cli fix examples add wire, msg naming format, fix examples in progress in progress add client/store
31786cc
to
39509c7
Compare
move gasconfig to types, make GetKVStoreWithGas take GasConfig fix lint modify transientstore in progress add test for transientstore fix errors fix test fix errors and lint last fix in progress move transient to KVStore fix syntax errors finalize rebase remove NewMemDBStoreAdapter for lint
In this PR every operation that is applied to a KVStore has become methods of |
Ready for review. |
store/cachemultistore.go
Outdated
@@ -73,7 +73,12 @@ func (cms cacheMultiStore) GetKVStore(key StoreKey) KVStore { | |||
return cms.stores[key].(KVStore) | |||
} | |||
|
|||
// Implements Multistore. | |||
func (cms cacheMultiStore) GetTransientStore(key StoreKey) KVStore { | |||
return cms.stores[key].(KVStore) |
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.
is this supposed to be identical to GetKVStore?
39509c7
to
a8a1acf
Compare
move gasconfig to types, make GetKVStoreWithGas take GasConfig fix lint modify transientstore in progress add test for transientstore fix errors fix test fix errors and lint last fix in progress move transient to KVStore fix syntax errors finalize rebase remove NewMemDBStoreAdapter for lint apply requests apply requests apply requests add CHANGELOG add tests fix getter in progress finalize rebase fix lint partially apply requests assert -> require apply requests fix test Changelog => Pending add TransientStoreKey fix lint
in progress in progress fix all keeper/handler/types, start working on test finalize rebase fixing clients add linear_cli.go, refactor relayer cli fix examples add wire, msg naming format, fix examples in progress in progress add client/store in progress in progress cleanup finalize cleanup fix errors refactor ibc
bff248e
to
57ab2b3
Compare
57ab2b3
to
f27d375
Compare
move gasconfig to types, make GetKVStoreWithGas take GasConfig fix lint modify transientstore in progress add test for transientstore fix errors fix test fix errors and lint last fix in progress move transient to KVStore fix syntax errors finalize rebase remove NewMemDBStoreAdapter for lint apply requests apply requests apply requests add CHANGELOG add tests fix getter in progress finalize rebase fix lint partially apply requests assert -> require apply requests fix test Changelog => Pending add TransientStoreKey fix lint fix lint
f27d375
to
0cafe33
Compare
0cafe33
to
2c7a8b5
Compare
2c7a8b5
to
f76e8a7
Compare
f76e8a7
to
0936344
Compare
0936344
to
78164f7
Compare
move gasconfig to types, make GetKVStoreWithGas take GasConfig fix lint modify transientstore in progress add test for transientstore fix errors fix test fix errors and lint last fix in progress move transient to KVStore fix syntax errors finalize rebase remove NewMemDBStoreAdapter for lint apply requests apply requests apply requests add CHANGELOG add tests fix getter in progress finalize rebase fix lint partially apply requests assert -> require apply requests fix test Changelog => Pending add TransientStoreKey fix lint fix lint refactor *Store from context, add ReadKVStore delete immutablestore fix KVStore fix TransientStore remove StoreGetter fix errors
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.
utACK, another review would be good
I'll take a look @cwgoes |
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 left some general feedback, but nothing that would withstand a merge/approval.
PENDING.md
Outdated
@@ -30,6 +30,7 @@ FEATURES | |||
* [baseapp] Initialize validator set on ResponseInitChain | |||
* [cosmos-sdk-cli] Added support for cosmos-sdk-cli tool under cosmos-sdk/cmd | |||
* This allows SDK users to initialize a new project repository. | |||
* [store] Add transient store |
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.
@cwgoes is the convention to also link the PR # here? I think that'll be helpful in the CHANGELOG
types/gas.go
Outdated
|
||
// Default gas config for TransientStores | ||
func TransientGasConfig() GasConfig { | ||
// TODO: reduce the gas cost in transient store |
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.
To go along with the TODO, why not just return DefaultGasConfig()
for now as the values are identical?
store/transientstore.go
Outdated
|
||
// Implements CommitStore | ||
func (ts *transientStore) SetPruning(pruning PruningStrategy) { | ||
// Do nothing |
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.
Dont think we need this redundant comment 👍
store/rootmultistore.go
Outdated
@@ -440,6 +440,10 @@ func commitStores(version int64, storeMap map[StoreKey]CommitStore) commitInfo { | |||
// Commit | |||
commitID := store.Commit() | |||
|
|||
if commitID.IsZero() { |
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.
Was this ever addressed? It does indeed seem that the TransientStore
always returns zero. I can't think of a case where other commits would result in zero, but at least it'd be helpful to add a comment here 👍
Could we leverage GetStoreType
here instead?
store/rootmultistore.go
Outdated
@@ -322,10 +319,23 @@ func (rs *rootMultiStore) loadCommitStoreFromParams(id CommitID, params storePar | |||
// TODO: id? | |||
// return NewCommitMultiStore(db, id) | |||
case sdk.StoreTypeIAVL: | |||
_, ok := key.(*sdk.KVStoreKey) |
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.
Definitely out of scope of this PR, but I really think we should avoid using named return variables in large and/or complex functions/methods.
29b3945
to
44215b5
Compare
44215b5
to
17c5021
Compare
move gasconfig to types, make GetKVStoreWithGas take GasConfig fix lint modify transientstore in progress add test for transientstore fix errors fix test fix errors and lint last fix in progress move transient to KVStore fix syntax errors finalize rebase remove NewMemDBStoreAdapter for lint apply requests apply requests apply requests add CHANGELOG add tests fix getter in progress finalize rebase fix lint partially apply requests assert -> require apply requests fix test Changelog => Pending add TransientStoreKey fix lint fix lint refactor *Store from context, add ReadKVStore delete immutablestore fix KVStore fix TransientStore remove StoreGetter fix errors apply requests fix unused CommitStoreLoader error
17c5021
to
f9f8445
Compare
in progress in progress fix all keeper/handler/types, start working on test finalize rebase fixing clients add linear_cli.go, refactor relayer cli fix examples add wire, msg naming format, fix examples in progress in progress add client/store in progress in progress cleanup finalize cleanup fix errors refactor ibc
in progress in progress fix all keeper/handler/types, start working on test finalize rebase fixing clients add linear_cli.go, refactor relayer cli fix examples add wire, msg naming format, fix examples in progress in progress add client/store in progress in progress cleanup finalize cleanup fix errors refactor ibc
Closes: #1326