-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from initia-labs/feat/cosmos-50
- Loading branch information
Showing
370 changed files
with
19,343 additions
and
14,440 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ jobs: | |
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
go-version: 1.19 | ||
go-version: 1.21 | ||
- uses: technote-space/get-diff-action@v5 | ||
id: git_diff | ||
with: | ||
|
@@ -60,7 +60,7 @@ jobs: | |
- name: Setup go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
go-version: 1.21 | ||
# for private repo access | ||
- run: git config --global url.https://${GITHUB_ACCESS_TOKEN}:[email protected]/.insteadOf https://github.com/ | ||
- run: | | ||
|
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,29 +1,53 @@ | ||
package app | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec/legacy" | ||
"github.com/cosmos/cosmos-sdk/std" | ||
|
||
"cosmossdk.io/client/v2/autocli" | ||
"cosmossdk.io/core/appmodule" | ||
"cosmossdk.io/log" | ||
dbm "github.com/cosmos/cosmos-db" | ||
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" | ||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" | ||
"github.com/initia-labs/initia/app/params" | ||
moveconfig "github.com/initia-labs/initia/x/move/config" | ||
) | ||
|
||
var legacyCodecRegistered = false | ||
|
||
// MakeEncodingConfig creates an EncodingConfig for testing | ||
func MakeEncodingConfig() params.EncodingConfig { | ||
encodingConfig := params.MakeEncodingConfig() | ||
std.RegisterLegacyAminoCodec(encodingConfig.Amino) | ||
std.RegisterInterfaces(encodingConfig.InterfaceRegistry) | ||
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) | ||
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) | ||
|
||
if !legacyCodecRegistered { | ||
// authz module use this codec to get signbytes. | ||
// authz MsgExec can execute all message types, | ||
// so legacy.Cdc need to register all amino messages to get proper signature | ||
ModuleBasics.RegisterLegacyAminoCodec(legacy.Cdc) | ||
legacyCodecRegistered = true | ||
tempApp := NewInitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, moveconfig.DefaultMoveConfig(), simtestutil.EmptyAppOptions{}) | ||
encodingConfig := params.EncodingConfig{ | ||
InterfaceRegistry: tempApp.InterfaceRegistry(), | ||
Codec: tempApp.AppCodec(), | ||
TxConfig: tempApp.TxConfig(), | ||
Amino: tempApp.LegacyAmino(), | ||
} | ||
|
||
return encodingConfig | ||
} | ||
|
||
func AutoCliOpts() autocli.AppOptions { | ||
tempApp := NewInitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, moveconfig.DefaultMoveConfig(), simtestutil.EmptyAppOptions{}) | ||
modules := make(map[string]appmodule.AppModule, 0) | ||
for _, m := range tempApp.ModuleManager.Modules { | ||
if moduleWithName, ok := m.(module.HasName); ok { | ||
moduleName := moduleWithName.Name() | ||
if appModule, ok := moduleWithName.(appmodule.AppModule); ok { | ||
modules[moduleName] = appModule | ||
} | ||
} | ||
} | ||
|
||
return autocli.AppOptions{ | ||
Modules: modules, | ||
ModuleOptions: runtimeservices.ExtractAutoCLIOptions(tempApp.ModuleManager.Modules), | ||
AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), | ||
ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), | ||
ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), | ||
} | ||
} | ||
|
||
func BasicManager() module.BasicManager { | ||
tempApp := NewInitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, moveconfig.DefaultMoveConfig(), simtestutil.EmptyAppOptions{}) | ||
return tempApp.BasicModuleManager | ||
} |
Oops, something went wrong.