fix: app wiring simulation failures (#12051)
This commit is contained in:
parent
803c5db9b4
commit
52fdb08d6a
|
@ -8,6 +8,8 @@ COPY go.mod go.sum /work/
|
||||||
COPY db/go.mod db/go.sum /work/db/
|
COPY db/go.mod db/go.sum /work/db/
|
||||||
COPY errors/go.mod errors/go.sum /work/errors/
|
COPY errors/go.mod errors/go.sum /work/errors/
|
||||||
COPY math/go.mod math/go.sum /work/math/
|
COPY math/go.mod math/go.sum /work/math/
|
||||||
|
COPY api/go.mod api/go.sum /work/api/
|
||||||
|
COPY core/go.mod core/go.sum /work/core/
|
||||||
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY ./ /work
|
COPY ./ /work
|
||||||
|
|
|
@ -7,6 +7,8 @@ COPY go.mod go.sum /work/
|
||||||
COPY db/go.mod db/go.sum /work/db/
|
COPY db/go.mod db/go.sum /work/db/
|
||||||
COPY errors/go.mod errors/go.sum /work/errors/
|
COPY errors/go.mod errors/go.sum /work/errors/
|
||||||
COPY math/go.mod math/go.sum /work/math/
|
COPY math/go.mod math/go.sum /work/math/
|
||||||
|
COPY api/go.mod api/go.sum /work/api/
|
||||||
|
COPY core/go.mod core/go.sum /work/core/
|
||||||
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY ./ /work
|
COPY ./ /work
|
||||||
|
|
5
go.mod
5
go.mod
|
@ -16,6 +16,7 @@ require (
|
||||||
github.com/confio/ics23/go v0.7.0
|
github.com/confio/ics23/go v0.7.0
|
||||||
github.com/cosmos/btcutil v1.0.4
|
github.com/cosmos/btcutil v1.0.4
|
||||||
github.com/cosmos/cosmos-proto v1.0.0-alpha7
|
github.com/cosmos/cosmos-proto v1.0.0-alpha7
|
||||||
|
github.com/cosmos/cosmos-sdk/container v1.0.0-alpha.4
|
||||||
github.com/cosmos/cosmos-sdk/db v1.0.0-beta.1
|
github.com/cosmos/cosmos-sdk/db v1.0.0-beta.1
|
||||||
github.com/cosmos/go-bip39 v1.0.0
|
github.com/cosmos/go-bip39 v1.0.0
|
||||||
github.com/cosmos/iavl v0.18.0
|
github.com/cosmos/iavl v0.18.0
|
||||||
|
@ -55,6 +56,7 @@ require (
|
||||||
github.com/tendermint/tendermint v0.35.4
|
github.com/tendermint/tendermint v0.35.4
|
||||||
github.com/tendermint/tm-db v0.6.6
|
github.com/tendermint/tm-db v0.6.6
|
||||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
|
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
|
||||||
|
golang.org/x/exp v0.0.0-20220428152302-39d4317da171
|
||||||
google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac
|
google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac
|
||||||
google.golang.org/grpc v1.46.2
|
google.golang.org/grpc v1.46.2
|
||||||
google.golang.org/protobuf v1.28.0
|
google.golang.org/protobuf v1.28.0
|
||||||
|
@ -62,8 +64,6 @@ require (
|
||||||
sigs.k8s.io/yaml v1.3.0
|
sigs.k8s.io/yaml v1.3.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require github.com/cosmos/cosmos-sdk/container v1.0.0-alpha.4
|
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go v0.100.2 // indirect
|
cloud.google.com/go v0.100.2 // indirect
|
||||||
cloud.google.com/go/compute v1.5.0 // indirect
|
cloud.google.com/go/compute v1.5.0 // indirect
|
||||||
|
@ -138,7 +138,6 @@ require (
|
||||||
github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 // indirect
|
github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 // indirect
|
||||||
go.etcd.io/bbolt v1.3.6 // indirect
|
go.etcd.io/bbolt v1.3.6 // indirect
|
||||||
go.opencensus.io v0.23.0 // indirect
|
go.opencensus.io v0.23.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20220428152302-39d4317da171 // indirect
|
|
||||||
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
|
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
|
||||||
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
|
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/gogo/protobuf/grpc"
|
"github.com/gogo/protobuf/grpc"
|
||||||
abci "github.com/tendermint/tendermint/abci/types"
|
abci "github.com/tendermint/tendermint/abci/types"
|
||||||
|
"golang.org/x/exp/slices"
|
||||||
|
|
||||||
runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1"
|
runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1"
|
||||||
|
|
||||||
|
@ -155,4 +156,16 @@ func (a *App) RegisterTendermintService(clientCtx client.Context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnsafeFindStoreKey FindStoreKey fetches a registered StoreKey from the App in linear time.
|
||||||
|
//
|
||||||
|
// NOTE: This should only be used in testing.
|
||||||
|
func (a *App) UnsafeFindStoreKey(storeKey string) storetypes.StoreKey {
|
||||||
|
i := slices.IndexFunc(a.storeKeys, func(s storetypes.StoreKey) bool { return s.Name() == storeKey })
|
||||||
|
if i == -1 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return a.storeKeys[i]
|
||||||
|
}
|
||||||
|
|
||||||
var _ servertypes.Application = &App{}
|
var _ servertypes.Application = &App{}
|
||||||
|
|
|
@ -416,6 +416,7 @@ func NewSimApp(
|
||||||
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
|
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
|
||||||
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
|
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
|
||||||
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
|
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
|
||||||
|
params.NewAppModule(app.ParamsKeeper),
|
||||||
evidence.NewAppModule(app.EvidenceKeeper),
|
evidence.NewAppModule(app.EvidenceKeeper),
|
||||||
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
|
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
|
||||||
groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
|
groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
|
||||||
|
@ -544,7 +545,17 @@ func (app *SimApp) InterfaceRegistry() codectypes.InterfaceRegistry {
|
||||||
//
|
//
|
||||||
// NOTE: This is solely to be used for testing purposes.
|
// NOTE: This is solely to be used for testing purposes.
|
||||||
func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey {
|
func (app *SimApp) GetKey(storeKey string) *storetypes.KVStoreKey {
|
||||||
return app.keys[storeKey]
|
kvsk := app.keys[storeKey]
|
||||||
|
if kvsk != nil {
|
||||||
|
return kvsk
|
||||||
|
}
|
||||||
|
|
||||||
|
sk := app.UnsafeFindStoreKey(storeKey)
|
||||||
|
kvStoreKey, ok := sk.(*storetypes.KVStoreKey)
|
||||||
|
if !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return kvStoreKey
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTKey returns the TransientStoreKey for the provided store key.
|
// GetTKey returns the TransientStoreKey for the provided store key.
|
||||||
|
|
|
@ -175,23 +175,23 @@ func TestAppImportExport(t *testing.T) {
|
||||||
fmt.Printf("comparing stores...\n")
|
fmt.Printf("comparing stores...\n")
|
||||||
|
|
||||||
storeKeysPrefixes := []StoreKeysPrefixes{
|
storeKeysPrefixes := []StoreKeysPrefixes{
|
||||||
{app.keys[authtypes.StoreKey], newApp.keys[authtypes.StoreKey], [][]byte{}},
|
{app.GetKey(authtypes.StoreKey), newApp.GetKey(authtypes.StoreKey), [][]byte{}},
|
||||||
{
|
{
|
||||||
app.keys[stakingtypes.StoreKey], newApp.keys[stakingtypes.StoreKey],
|
app.GetKey(stakingtypes.StoreKey), newApp.GetKey(stakingtypes.StoreKey),
|
||||||
[][]byte{
|
[][]byte{
|
||||||
stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey,
|
stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey,
|
||||||
stakingtypes.HistoricalInfoKey,
|
stakingtypes.HistoricalInfoKey,
|
||||||
},
|
},
|
||||||
}, // ordering may change but it doesn't matter
|
}, // ordering may change but it doesn't matter
|
||||||
{app.keys[slashingtypes.StoreKey], newApp.keys[slashingtypes.StoreKey], [][]byte{}},
|
{app.GetKey(slashingtypes.StoreKey), newApp.GetKey(slashingtypes.StoreKey), [][]byte{}},
|
||||||
{app.keys[minttypes.StoreKey], newApp.keys[minttypes.StoreKey], [][]byte{}},
|
{app.GetKey(minttypes.StoreKey), newApp.GetKey(minttypes.StoreKey), [][]byte{}},
|
||||||
{app.keys[distrtypes.StoreKey], newApp.keys[distrtypes.StoreKey], [][]byte{}},
|
{app.GetKey(distrtypes.StoreKey), newApp.GetKey(distrtypes.StoreKey), [][]byte{}},
|
||||||
{app.keys[banktypes.StoreKey], newApp.keys[banktypes.StoreKey], [][]byte{banktypes.BalancesPrefix}},
|
{app.GetKey(banktypes.StoreKey), newApp.GetKey(banktypes.StoreKey), [][]byte{banktypes.BalancesPrefix}},
|
||||||
{app.keys[paramtypes.StoreKey], newApp.keys[paramtypes.StoreKey], [][]byte{}},
|
{app.GetKey(paramtypes.StoreKey), newApp.GetKey(paramtypes.StoreKey), [][]byte{}},
|
||||||
{app.keys[govtypes.StoreKey], newApp.keys[govtypes.StoreKey], [][]byte{}},
|
{app.GetKey(govtypes.StoreKey), newApp.GetKey(govtypes.StoreKey), [][]byte{}},
|
||||||
{app.keys[evidencetypes.StoreKey], newApp.keys[evidencetypes.StoreKey], [][]byte{}},
|
{app.GetKey(evidencetypes.StoreKey), newApp.GetKey(evidencetypes.StoreKey), [][]byte{}},
|
||||||
{app.keys[capabilitytypes.StoreKey], newApp.keys[capabilitytypes.StoreKey], [][]byte{}},
|
{app.GetKey(capabilitytypes.StoreKey), newApp.GetKey(capabilitytypes.StoreKey), [][]byte{}},
|
||||||
{app.keys[authzkeeper.StoreKey], newApp.keys[authzkeeper.StoreKey], [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}},
|
{app.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, skp := range storeKeysPrefixes {
|
for _, skp := range storeKeysPrefixes {
|
||||||
|
|
Loading…
Reference in New Issue