-
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
tests(integration): port x/bank tests to server/v2 app #21912
Open
kocubinski
wants to merge
70
commits into
main
Choose a base branch
from
kocu/v2-integration-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 69 commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
da84451
audit NewIntegrationApp usages
kocubinski eb347f6
Update v2-audit.md
kocubinski 2e9835c
very basic port
kocubinski b0cc5a5
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski 14686ba
merge fix
kocubinski 74358ca
basic construction seems to be working
kocubinski ba91038
refactor: remove viper as a direct dependency
kocubinski c4d0834
remove unused interface
kocubinski a080b2e
not sure how this ended up so big
kocubinski f09a8fe
clean up
kocubinski ce51d9e
go mod tidy all
kocubinski 441423d
lint fix
kocubinski 7e508c3
fix simapp v1 build with core replace
kocubinski 99c2a5c
add comment
kocubinski a6e0c1f
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/app-v2-…
kocubinski e0c9e3d
go mod tidy all
kocubinski 8c4d79d
Merge branch 'kocu/app-v2-config' into kocu/v2-integration-tests
kocubinski 2d28d64
wip
kocubinski 0e71ce3
fix(runtime/v2): provide default factory options if unset in app builder
kocubinski 3ad2a6e
fix simapp/v2 usage
kocubinski d8a6ed7
whitespace?
kocubinski de2a723
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski a47a286
tidy
kocubinski c8ea058
fix test
kocubinski 2410c04
Merge branch 'kocu/default-factory-opts' into kocu/v2-integration-tests
kocubinski 8d3698f
config fix
kocubinski 57040e2
need comet service bindings
kocubinski 995974c
looks like a valid construction
kocubinski 69598d4
genesis service
kocubinski 29b0ebe
genesis working
kocubinski a977338
refactor(stf): rm RunWithCtx
kocubinski 30814ac
migrate export genesis and remove stf.RunWithCtx
kocubinski ef50b4f
revert line wrapping
kocubinski 177a0da
small refactor move genesis services
kocubinski 25f0244
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/rm-stf-…
kocubinski 45ff83a
go mod tidy all
kocubinski 16a0e99
revert vscode change
kocubinski 8d1014e
Merge branch 'main' into kocu/rm-stf-run-with-ctx
kocubinski 9fe1020
update genesis service
kocubinski 80db042
clean up
kocubinski 57ec239
fix typo
kocubinski c20649d
fix test
kocubinski ea930ac
fix test
kocubinski c508350
Merge branch 'kocu/rm-stf-run-with-ctx' into kocu/v2-integration-tests
kocubinski 8b9b66c
fix merge badness
kocubinski e0eb0ef
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski b6d6f75
kinda working
kocubinski d8fc366
passin with lots of debug printlns
kocubinski 00dd82a
working integration test!
kocubinski 74e8eed
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski 710a1aa
clean up
kocubinski ae35d88
port another test
kocubinski eb1f49e
port remaining bank tests
kocubinski e37ff14
revert whitespace changes
kocubinski 7e6b4db
moar whitespace
kocubinski d3e474c
why did x/upgrade get touched?
kocubinski 8292c98
godocs
kocubinski de81b74
Merge branch 'main' into kocu/v2-integration-tests
kocubinski 706a591
more cleanup but stuck on gas service
kocubinski 9e42ec8
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski db41984
tests passing
kocubinski 869a492
rever gas addition to stf query return
kocubinski a8f7d8e
clean up
kocubinski 6a9e803
revert whitespace
kocubinski 9cf71f4
godocs
kocubinski 47136de
runtime/v2 clean up
kocubinski 52c502a
add comment
kocubinski 8d34c75
clean up
kocubinski 55e77a5
linting
kocubinski 4c9de97
Merge branch 'main' of github.com:cosmos/cosmos-sdk into kocu/v2-inte…
kocubinski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,16 @@ package runtime | |
import ( | ||
"errors" | ||
"fmt" | ||
"path/filepath" | ||
|
||
"cosmossdk.io/core/server" | ||
"cosmossdk.io/core/store" | ||
"cosmossdk.io/log" | ||
"cosmossdk.io/server/v2/stf" | ||
storev2 "cosmossdk.io/store/v2" | ||
"cosmossdk.io/store/v2/db" | ||
"cosmossdk.io/store/v2/proof" | ||
"cosmossdk.io/store/v2/root" | ||
) | ||
|
||
// NewKVStoreService creates a new KVStoreService. | ||
|
@@ -59,6 +64,57 @@ type Store interface { | |
LastCommitID() (proof.CommitID, error) | ||
} | ||
|
||
// StoreBuilder is a builder for a store/v2 RootStore satisfying the Store interface. | ||
type StoreBuilder struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's smart, I like the abstraction! Makes it more readble too. |
||
store Store | ||
} | ||
|
||
// Build creates a new store/v2 RootStore. | ||
func (sb *StoreBuilder) Build( | ||
logger log.Logger, | ||
storeKeys []string, | ||
config server.DynamicConfig, | ||
options root.Options, | ||
) (Store, error) { | ||
if sb.store != nil { | ||
return sb.store, nil | ||
} | ||
home := config.GetString(flagHome) | ||
scRawDb, err := db.NewDB( | ||
db.DBType(config.GetString("store.app-db-backend")), | ||
"application", | ||
filepath.Join(home, "data"), | ||
nil, | ||
) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create SCRawDB: %w", err) | ||
} | ||
|
||
factoryOptions := &root.FactoryOptions{ | ||
Logger: logger, | ||
RootDir: home, | ||
Options: options, | ||
StoreKeys: append(storeKeys, "stf"), | ||
SCRawDB: scRawDb, | ||
} | ||
|
||
rs, err := root.CreateRootStore(factoryOptions) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create root store: %w", err) | ||
} | ||
sb.store = rs | ||
return sb.store, nil | ||
} | ||
|
||
// Get returns the Store. Build must be called before calling Get or the result will be nil. | ||
func (sb *StoreBuilder) Get() Store { | ||
return sb.store | ||
} | ||
kocubinski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
func ProvideStoreBuilder() *StoreBuilder { | ||
return &StoreBuilder{} | ||
} | ||
kocubinski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// StoreLoader allows for custom loading of the store, this is useful when upgrading the store from a previous version | ||
type StoreLoader func(store Store) error | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shal we use those in app_di (v1 & v2) to simplify things?