Skip to content
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

feat: Wormchain v0.47 #4034

Draft
wants to merge 122 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
edb1a71
Use ADRs for a record of project decisions.
jonathanpberger Jun 24, 2024
0490416
docs: add ADR for wasmvm versioning decision
jtieri Jun 24, 2024
252b775
Merge pull request #37 from strangelove-ventures/justin/adr-tools
jtieri Jun 24, 2024
796c3a0
Add ADR for Cosmos SDK v0.47 upgrade applied to wormhole-foundation C…
pharr117 Jul 10, 2024
2e1218d
Merge pull request #50 from strangelove-ventures/pharr117/adr-3-cosmo…
pharr117 Jul 12, 2024
ec8ac68
Update 0003-cosmos-sdk-v0-47-upgrade-will-be-implemented-in-wormhole-…
pharr117 Jul 12, 2024
a7ee1db
Merge pull request #53 from strangelove-ventures/pharr117-adr-3-patch-1
pharr117 Jul 12, 2024
faf241c
Add ADR for Tendermint to CometBFT migration applied to wormhole-foun…
pharr117 Jul 12, 2024
4ee01dc
Typo
pharr117 Jul 12, 2024
f9685ac
Merge pull request #54 from strangelove-ventures/pharr117/adr-4-comet…
pharr117 Jul 12, 2024
7024118
Begin work on v0.47.12 migration
joelsmith-2019 Jul 15, 2024
8d8f141
Update Go Version
joelsmith-2019 Jul 16, 2024
204efcf
Update PFM to v7
joelsmith-2019 Jul 17, 2024
6e2a67f
Fix PFM Imports
joelsmith-2019 Jul 17, 2024
727208b
Remove Tendermint References
joelsmith-2019 Jul 18, 2024
98bc7dd
Set Address Prefixes
joelsmith-2019 Jul 18, 2024
d060cfd
Add Debug & Config CMD
joelsmith-2019 Jul 19, 2024
d92ad9a
Setup Sim Modules,
joelsmith-2019 Jul 19, 2024
81b6a8d
Migrate App API (WIP)
joelsmith-2019 Jul 22, 2024
f624958
Migrate Testutil
joelsmith-2019 Jul 23, 2024
e8b7400
Migrate IBC Compasability MW
joelsmith-2019 Jul 23, 2024
36104b6
Migrate IBC Hooks Module
joelsmith-2019 Jul 23, 2024
e4413ce
Add Consensus Params Store Key
joelsmith-2019 Jul 24, 2024
d4bbf33
Migrate Token Factory
joelsmith-2019 Jul 24, 2024
0001064
Start Wormhole Module Migration
joelsmith-2019 Jul 24, 2024
d67e81e
Cleanup
joelsmith-2019 Jul 24, 2024
eeab029
Update IBC Hooks
joelsmith-2019 Jul 24, 2024
4994ebf
IBC-Go Migrations
joelsmith-2019 Jul 25, 2024
f8b7d62
Migrate Proto
joelsmith-2019 Jul 25, 2024
fed6918
Refactor Staking Init
joelsmith-2019 Jul 26, 2024
286c4d8
Update Proto Imports
joelsmith-2019 Jul 26, 2024
aa2b761
Add Wasmd Ante Handler
joelsmith-2019 Jul 29, 2024
2a0d75c
Add Upgrade Handler
joelsmith-2019 Jul 30, 2024
d3c7c04
Remove log
joelsmith-2019 Jul 30, 2024
1db313c
Minor API Migration
joelsmith-2019 Jul 31, 2024
67c3219
Update Proto File Structure
joelsmith-2019 Aug 1, 2024
f1551a5
Ignore wormchaind
joelsmith-2019 Aug 1, 2024
c0a8249
Replace via git hash
joelsmith-2019 Aug 1, 2024
10d95c6
Update proto
joelsmith-2019 Aug 1, 2024
9025dc9
Implement Ignite Proto Gen
joelsmith-2019 Aug 2, 2024
cff8529
Remove unnecessary buf configs
joelsmith-2019 Aug 2, 2024
5a0830f
Cmd cleanup
joelsmith-2019 Aug 5, 2024
57f99ba
Migrate Wormhole REST API
joelsmith-2019 Aug 6, 2024
6b380ab
Setup Interchaintest
joelsmith-2019 Aug 7, 2024
d3ba83b
Set Bech32 Prefixes
joelsmith-2019 Aug 7, 2024
807a68e
Fix Heighliner Image
joelsmith-2019 Aug 7, 2024
b4b61e5
Fix Gentx & Register Store Key
joelsmith-2019 Aug 8, 2024
c275366
Import Wormchain v45 ICT Suite
joelsmith-2019 Aug 9, 2024
1eb4221
Pass Existing Unit Tests
joelsmith-2019 Aug 13, 2024
f33f24c
Setup Ante Unit Tests
joelsmith-2019 Aug 13, 2024
0aa9009
Fix Unregistered Msg Server
joelsmith-2019 Aug 14, 2024
2a10f64
Add Wormchain ICT
joelsmith-2019 Aug 15, 2024
1f7762b
Test Message Proposal
joelsmith-2019 Aug 15, 2024
de4f2c6
Unit Test Wormhole Proposals
joelsmith-2019 Aug 16, 2024
f0a8492
Update Util Visibility
joelsmith-2019 Aug 16, 2024
be8b85f
Upgrade TokenFactory
joelsmith-2019 Aug 20, 2024
0d300d0
Append Genesis Subcommands
joelsmith-2019 Aug 21, 2024
1b2ec68
Add Cancel Upgrade Test
joelsmith-2019 Aug 21, 2024
e5375a1
Migrate Modules in Upgrade Handler
joelsmith-2019 Aug 22, 2024
fc923e2
Add Upgrade Failure Test
joelsmith-2019 Aug 22, 2024
b34da54
chore(fork): pull upstream changes (#65)
pharr117 Aug 23, 2024
b93b4de
Fix Home Dir & Cleanup
joelsmith-2019 Aug 26, 2024
807b91a
Add Upgrade Test (WIP)
joelsmith-2019 Aug 26, 2024
4d529f0
ICT Cleanup
joelsmith-2019 Aug 29, 2024
4e6a8db
Pass Malformed Payload Test
joelsmith-2019 Aug 30, 2024
8d5d939
Cleanup Middleware
joelsmith-2019 Aug 30, 2024
26deeb0
Update Cosmos Fork
joelsmith-2019 Sep 3, 2024
d5e2476
Cleanup
joelsmith-2019 Sep 3, 2024
914dc57
Add Wasmd Decorator ICT
joelsmith-2019 Sep 4, 2024
bc4639b
Add Wormhole Proposal Msg Tests
joelsmith-2019 Sep 4, 2024
6faeddc
Validate Active Guardian Index
joelsmith-2019 Sep 5, 2024
134407f
Add Docker File for Generating ICT Image
joelsmith-2019 Sep 5, 2024
7c220b3
Fix Wait for Blocks
joelsmith-2019 Sep 5, 2024
0985da1
Merge remote-tracking branch 'origin/main' into joel/wormchain-v0.47.12
joelsmith-2019 Sep 6, 2024
eeaa8ad
Use ADRs for a record of project decisions.
jonathanpberger Jun 24, 2024
ee23fb5
docs: add ADR for wasmvm versioning decision
jtieri Jun 24, 2024
07a0607
Add ADR for Cosmos SDK v0.47 upgrade applied to wormhole-foundation C…
pharr117 Jul 10, 2024
8bb4384
Update 0003-cosmos-sdk-v0-47-upgrade-will-be-implemented-in-wormhole-…
pharr117 Jul 12, 2024
5f73226
Add ADR for Tendermint to CometBFT migration applied to wormhole-foun…
pharr117 Jul 12, 2024
7002cca
Typo
pharr117 Jul 12, 2024
d5d6d96
Merge branch 'wormhole-foundation-main'
joelsmith-2019 Sep 6, 2024
599c956
Merge remote-tracking branch 'origin/main' into joel/wormchain-v0.47.12
joelsmith-2019 Sep 6, 2024
41d3715
Fix err check
joelsmith-2019 Sep 6, 2024
29ea36e
Add ICT Workflow
joelsmith-2019 Sep 6, 2024
de29e6f
Add jq and netcat
joelsmith-2019 Sep 10, 2024
4add7f4
Remove heighliner
joelsmith-2019 Sep 10, 2024
1799f12
Fix ICT
joelsmith-2019 Sep 11, 2024
2ca4787
Start PFM Unit Testing
joelsmith-2019 Sep 11, 2024
434fb9f
Add Working Directory to Workflow
joelsmith-2019 Sep 11, 2024
0bf3a41
Cleanup TODOs
joelsmith-2019 Sep 11, 2024
4914a07
Add PFM Format Unit Tests
joelsmith-2019 Sep 11, 2024
8b4cc6d
Add Keeper Test
joelsmith-2019 Sep 11, 2024
bcc1e67
Add Wormhole Module Unit Tests
joelsmith-2019 Sep 12, 2024
74b1a44
Add More Unit Tests
joelsmith-2019 Sep 12, 2024
ca40159
Fix unpinned docker files
joelsmith-2019 Sep 13, 2024
dbf021a
Fix spelling errors
joelsmith-2019 Sep 13, 2024
aed9eb7
Update go version for wormchain workflow
joelsmith-2019 Sep 13, 2024
a8ff4aa
Go mod tidy
joelsmith-2019 Sep 13, 2024
bb11cac
Update docker pin filter
joelsmith-2019 Sep 13, 2024
2cdc00f
Update Workflow Go Version
joelsmith-2019 Sep 13, 2024
60ecf26
Fix Incorrectly Merged db_test
joelsmith-2019 Sep 16, 2024
14fa7fb
Update Node Deps
joelsmith-2019 Sep 16, 2024
3652be8
Fix incorrectly merged db_test.go
joelsmith-2019 Sep 16, 2024
fc2dd50
Cleanup tests
joelsmith-2019 Sep 17, 2024
cc26a15
Fix spacing
joelsmith-2019 Sep 17, 2024
d3b6331
Merge branch 'wormhole-foundation:main' into main
pharr117 Sep 17, 2024
3f6278a
Fix Node Deps (WIP)
joelsmith-2019 Sep 17, 2024
eba107e
Update Cosmos SDK Fork Version
joelsmith-2019 Sep 17, 2024
49beda5
Merge pull request #77 from strangelove-ventures/joel/ibc-composabili…
joelsmith-2019 Sep 18, 2024
24eb4bd
Cleanup Tests & Comments
joelsmith-2019 Sep 18, 2024
26b55a4
Resolve Grafana Dependency Conflicts
joelsmith-2019 Sep 18, 2024
85a9dd7
Update Proto
joelsmith-2019 Sep 18, 2024
ac0854a
Revert Dockerfile Modifications
joelsmith-2019 Sep 19, 2024
8e21c71
cosmwasm: add wormchain ibc receiver tests (#81)
kakucodes Sep 19, 2024
f4acec9
Fix netcat installation
joelsmith-2019 Sep 19, 2024
d729b18
Fix Genesis File for Sdk v0.47
joelsmith-2019 Sep 19, 2024
b14bbb5
Pass Genesis Validation Checks
joelsmith-2019 Sep 19, 2024
d64bb6c
Fix Go Version w/ Ignite
joelsmith-2019 Sep 20, 2024
dcfb308
Update libp2p
joelsmith-2019 Sep 23, 2024
f649092
Merge branch 'main' into joel/wormchain-v0.47.12
joelsmith-2019 Sep 23, 2024
400a646
Revert to Hardcoded ChainIDSolana
joelsmith-2019 Sep 23, 2024
7887299
Merge pull request #78 from strangelove-ventures/joel/wormhole-module…
joelsmith-2019 Sep 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions wormchain/TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# TODO
- Create Crisis Store in Upgrade: https://github.com/cosmos/cosmos-sdk/blob/release/v0.47.x/UPGRADING.md#xcrisis
- Upgrade Handler for Consesus Params Keeper & Create New Store: https://github.com/cosmos/cosmos-sdk/blob/release/v0.47.x/UPGRADING.md#xconsensus
- Make Protobuff Changes / Replacements: https://github.com/cosmos/cosmos-sdk/blob/release/v0.47.x/UPGRADING.md#protobuf
431 changes: 285 additions & 146 deletions wormchain/app/app.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions wormchain/app/apptesting/mock_key.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package apptesting

import (
"github.com/tendermint/tendermint/crypto"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cometbft/cometbft/crypto"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmtypes "github.com/cometbft/cometbft/types"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
Expand Down
27 changes: 14 additions & 13 deletions wormchain/app/apptesting/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ import (
"time"

"github.com/CosmWasm/wasmd/x/wasm/keeper"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/crypto"
"github.com/cometbft/cometbft/crypto/ed25519"
"github.com/cometbft/cometbft/libs/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmtypes "github.com/cometbft/cometbft/types"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
Expand All @@ -14,14 +21,6 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
"github.com/tendermint/spm/cosmoscmd"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
"github.com/wormhole-foundation/wormchain/app"
appparams "github.com/wormhole-foundation/wormchain/app/params"
)
Expand All @@ -41,8 +40,8 @@ func (ao EmptyBaseAppOptions) Get(_ string) interface{} {

// DefaultConsensusParams defines the default Tendermint consensus params used
// in wormApp testing.
var DefaultConsensusParams = &abci.ConsensusParams{
Block: &abci.BlockParams{
var DefaultConsensusParams = &tmproto.ConsensusParams{
Block: &tmproto.BlockParams{
MaxBytes: 200000,
MaxGas: 2000000,
},
Expand Down Expand Up @@ -121,7 +120,7 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs

func setup(withGenesis bool, invCheckPeriod uint) (*app.App, app.GenesisState) {
db := dbm.NewMemDB()
encoding := cosmoscmd.MakeEncodingConfig(app.ModuleBasics)
encoding := app.MakeEncodingConfig()
wormApp := app.New(
log.NewNopLogger(),
db,
Expand All @@ -134,10 +133,10 @@ func setup(withGenesis bool, invCheckPeriod uint) (*app.App, app.GenesisState) {
EmptyBaseAppOptions{},
)
if withGenesis {
return wormApp.(*app.App), app.NewDefaultGenesisState(encoding.Marshaler)
return wormApp, app.NewDefaultGenesisState(encoding.Marshaler)
}

return wormApp.(*app.App), app.GenesisState{}
return wormApp, app.GenesisState{}
}

func genesisStateWithValSet(t *testing.T,
Expand Down Expand Up @@ -184,6 +183,7 @@ func genesisStateWithValSet(t *testing.T,
defaultStParams.MaxEntries,
defaultStParams.HistoricalEntries,
appparams.BondDenom,
defaultStParams.MinCommissionRate,
)

// set validators and delegations
Expand Down Expand Up @@ -213,6 +213,7 @@ func genesisStateWithValSet(t *testing.T,
balances,
totalSupply,
[]banktypes.Metadata{},
[]banktypes.SendEnabled{}, // TODO: JOEL - MAY NEED TO ADD A DENOM TO THE SEND ENABLED
joelsmith-2019 marked this conversation as resolved.
Show resolved Hide resolved
)

genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis)
Expand Down
38 changes: 20 additions & 18 deletions wormchain/app/apptesting/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ import (
"testing"
"time"

dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/crypto/ed25519"
"github.com/cometbft/cometbft/libs/log"
tmtypes "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/store/rootmulti"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/cosmos/cosmos-sdk/x/authz"
testutil "github.com/cosmos/cosmos-sdk/x/bank/testutil"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakinghelper "github.com/cosmos/cosmos-sdk/x/staking/testutil"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/libs/log"
tmtypes "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"

authzcodec "github.com/wormhole-foundation/wormchain/x/tokenfactory/types/authzcodec"

Expand All @@ -41,6 +41,8 @@ type KeeperTestHelper struct {
Ctx sdk.Context
QueryHelper *baseapp.QueryServiceTestHelper
TestAccs []sdk.AccAddress

StakingHelper *stakinghelper.Helper
}

var (
Expand All @@ -57,6 +59,9 @@ func (s *KeeperTestHelper) Setup() {
Ctx: s.Ctx,
}
s.TestAccs = CreateRandomAccounts(3)

s.StakingHelper = stakinghelper.NewHelper(s.Suite.T(), s.Ctx, s.App.StakingKeeper)
// TODO: JOEL - MAY NEED TO ADD THE DENOM?
}

func (s *KeeperTestHelper) SetupTestForInitGenesis() {
Expand Down Expand Up @@ -93,13 +98,13 @@ func (s *KeeperTestHelper) Commit() {

// FundAcc funds target address with specified amount.
func (s *KeeperTestHelper) FundAcc(acc sdk.AccAddress, amounts sdk.Coins) {
err := simapp.FundAccount(s.App.BankKeeper, s.Ctx, acc, amounts)
err := testutil.FundAccount(s.App.BankKeeper, s.Ctx, acc, amounts)
s.Require().NoError(err)
}

// FundModuleAcc funds target modules with specified amount.
func (s *KeeperTestHelper) FundModuleAcc(moduleName string, amounts sdk.Coins) {
err := simapp.FundModuleAccount(s.App.BankKeeper, s.Ctx, moduleName, amounts)
err := testutil.FundModuleAccount(s.App.BankKeeper, s.Ctx, moduleName, amounts)
s.Require().NoError(err)
}

Expand All @@ -117,12 +122,8 @@ func (s *KeeperTestHelper) SetupValidator(bondStatus stakingtypes.BondStatus) sd

s.FundAcc(sdk.AccAddress(valAddr), selfBond)

stakingHandler := staking.NewHandler(s.App.StakingKeeper)
stakingCoin := sdk.NewCoin(sdk.DefaultBondDenom, selfBond[0].Amount)
ZeroCommission := stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec())
msg, err := stakingtypes.NewMsgCreateValidator(valAddr, valPub, stakingCoin, stakingtypes.Description{}, ZeroCommission, sdk.OneInt())
s.Require().NoError(err)
res, err := stakingHandler(s.Ctx, msg)
msg := s.StakingHelper.CreateValidatorMsg(valAddr, valPub, selfBond[0].Amount)
res, err := s.StakingHelper.CreateValidatorWithMsg(s.Ctx, msg)
s.Require().NoError(err)
s.Require().NotNil(res)

Expand Down Expand Up @@ -182,7 +183,8 @@ func (s *KeeperTestHelper) BeginNewBlockWithProposer(proposer sdk.ValAddress) {
header := tmtypes.Header{Height: s.Ctx.BlockHeight() + 1, Time: newBlockTime}
newCtx := s.Ctx.WithBlockTime(newBlockTime).WithBlockHeight(s.Ctx.BlockHeight() + 1)
s.Ctx = newCtx
lastCommitInfo := abci.LastCommitInfo{

lastCommitInfo := abci.CommitInfo{
Votes: []abci.VoteInfo{{
Validator: abci.Validator{Address: valAddr, Power: 1000},
SignedLastBlock: true,
Expand All @@ -207,7 +209,7 @@ func (s *KeeperTestHelper) AllocateRewardsToValidator(valAddr sdk.ValAddress, re

// allocate reward tokens to distribution module
coins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, rewardAmt)}
err := simapp.FundModuleAccount(s.App.BankKeeper, s.Ctx, distrtypes.ModuleName, coins)
err := testutil.FundModuleAccount(s.App.BankKeeper, s.Ctx, distrtypes.ModuleName, coins)
s.Require().NoError(err)

// allocate rewards to validator
Expand Down Expand Up @@ -263,7 +265,7 @@ func TestMessageAuthzSerialization(t *testing.T, msg sdk.Msg) {

// Authz: Grant Msg
typeURL := sdk.MsgTypeURL(msg)
grant, err := authz.NewGrant(authz.NewGenericAuthorization(typeURL), someDate.Add(time.Hour))
grant, err := authz.NewGrant(someDate.Add(time.Hour), authz.NewGenericAuthorization(typeURL), nil)
require.NoError(t, err)

msgGrant := authz.MsgGrant{Granter: mockGranter, Grantee: mockGrantee, Grant: grant}
Expand Down
17 changes: 17 additions & 0 deletions wormchain/app/encoding.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package app

import (
"github.com/cosmos/cosmos-sdk/std"

"github.com/wormhole-foundation/wormchain/app/params"
)

// 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)
return encodingConfig
}
14 changes: 4 additions & 10 deletions wormchain/app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"log"

tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -15,10 +15,7 @@ import (

// ExportAppStateAndValidators exports the state of the application for a genesis
// file.
func (app *App) ExportAppStateAndValidators(
forZeroHeight bool, jailAllowedAddrs []string,
) (servertypes.ExportedApp, error) {

func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string) (servertypes.ExportedApp, error) {
// as if they could withdraw from the start of the next block
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})

Expand All @@ -30,22 +27,19 @@ func (app *App) ExportAppStateAndValidators(
app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs)
}

genState := app.mm.ExportGenesis(ctx, app.appCodec)
genState := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport)
appState, err := json.MarshalIndent(genState, "", " ")
if err != nil {
return servertypes.ExportedApp{}, err
}

validators, err := staking.WriteValidators(ctx, app.StakingKeeper)
if err != nil {
return servertypes.ExportedApp{}, err
}
return servertypes.ExportedApp{
AppState: appState,
Validators: validators,
Height: height,
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
}, nil
}, err
}

// prepare for fresh start at zero height
Expand Down
27 changes: 27 additions & 0 deletions wormchain/app/openapiconsole/console.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package openapiconsole

import (
"embed"
"html/template"
"net/http"
)

// index.tpl is the template file for the OpenAPI console
//
//go:embed index.tpl
var index embed.FS

// Handler returns an http handler that servers OpenAPI console for an OpenAPI spec at specURL.
func Handler(title, specURL string) http.HandlerFunc {
t, _ := template.ParseFS(index, "index.tpl")

return func(w http.ResponseWriter, _ *http.Request) {
t.Execute(w, struct { //nolint:errcheck
Title string
URL string
}{
title,
specURL,
})
}
}
25 changes: 25 additions & 0 deletions wormchain/app/openapiconsole/index.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>{{ .Title }}</title>
<link rel="stylesheet" type="text/css" href="//unpkg.com/swagger-ui-dist@3.40.0/swagger-ui.css" />
<link rel="icon" type="image/png" href="//unpkg.com/swagger-ui-dist@3.40.0/favicon-16x16.png" />
</head>
<body>
<div id="swagger-ui"></div>

<script src="//unpkg.com/swagger-ui-dist@3.40.0/swagger-ui-bundle.js"></script>
<script>
// init Swagger for faucet's openapi.yml.
window.onload = function() {
window.ui = SwaggerUIBundle({
url: {{ .URL }},
dom_id: "#swagger-ui",
deepLinking: true,
layout: "BaseLayout",
});
}
</script>
</body>
</html>
32 changes: 32 additions & 0 deletions wormchain/app/params/encoding.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package params

import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
)

// EncodingConfig specifies the concrete encoding types to use for a given app.
// This is provided for compatibility between protobuf and amino implementations.
type EncodingConfig struct {
InterfaceRegistry types.InterfaceRegistry
Marshaler codec.Codec
TxConfig client.TxConfig
Amino *codec.LegacyAmino
}

// makeEncodingConfig creates an EncodingConfig for an amino based test configuration.
func MakeEncodingConfig() EncodingConfig {
amino := codec.NewLegacyAmino()
interfaceRegistry := types.NewInterfaceRegistry()
marshaler := codec.NewProtoCodec(interfaceRegistry)
txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes)

return EncodingConfig{
InterfaceRegistry: interfaceRegistry,
Marshaler: marshaler,
TxConfig: txCfg,
Amino: amino,
}
}
2 changes: 1 addition & 1 deletion wormchain/app/v2_23_0_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

packetforwardtypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
ibccomposabilitytypes "github.com/wormhole-foundation/wormchain/x/ibc-composability-mw/types"
ibchookstypes "github.com/wormhole-foundation/wormchain/x/ibc-hooks/types"
tokenfactorytypes "github.com/wormhole-foundation/wormchain/x/tokenfactory/types"
Expand Down
Loading