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

ibc-go v5: cosmos-sdk 46 #1653

Merged
merged 88 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
800d530
begin changes needed for "real 46"
faddat Jul 5, 2022
0f64e06
46 updates
faddat Jul 5, 2022
8867120
46 updates
faddat Jul 5, 2022
30f7946
Delete .gitpod.yml
faddat Jul 5, 2022
0c77eab
46 updates
faddat Jul 5, 2022
1e79e0b
46 updates
faddat Jul 5, 2022
185adee
Update genesis_test.go
faddat Jul 5, 2022
11d96cb
update tests
faddat Jul 5, 2022
bdf7cc3
Merge branch 'real-46-branch' of https://github.com/notional-labs/ibc…
faddat Jul 5, 2022
ab06157
bring back the client client
faddat Jul 5, 2022
6704daf
fumpt
faddat Jul 5, 2022
42c1eac
genesis with val set
vuong177 Jul 5, 2022
78689e1
fix TestRandomizedGenState
nghuyenthevinh2000 Jul 5, 2022
32fa306
Merge branch 'main' into real-46-branch
faddat Jul 5, 2022
e300204
Merge branch 'main' into real-46-branch
faddat Jul 7, 2022
8e4f87e
use cosmos-sdk v0.46.0-rc2
faddat Jul 7, 2022
4b579fa
Merge branch 'main' into real-46-branch
faddat Jul 9, 2022
93cd207
Revert "Merge branch 'main' into real-46-branch"
faddat Jul 14, 2022
11e336c
Merge remote-tracking branch 'upstream/main' into real-46-branch
faddat Jul 16, 2022
b0b34cf
goimports
faddat Jul 16, 2022
ee64d56
fumpt
faddat Jul 16, 2022
06b8deb
Update testing/simapp/app.go
faddat Jul 19, 2022
8c2c541
Merge branch 'main' into real-46-branch
faddat Jul 19, 2022
df546ed
Update testing/simapp/simd/cmd/genaccounts.go
faddat Jul 19, 2022
eff83e2
make format
faddat Jul 19, 2022
626480f
tidy
faddat Jul 19, 2022
496a7f3
change import path
faddat Jul 19, 2022
d6ee5c9
remove gitpod artifact
faddat Jul 19, 2022
1f290e0
sdk.Int -> math.Int
faddat Jul 19, 2022
cf0997e
group sdk and tendermint imports
faddat Jul 19, 2022
869043d
Organize Governance Proposal Handlers
faddat Jul 19, 2022
802b1bc
Remove Extra line in msgs_test.go
faddat Jul 19, 2022
232cbb6
use test.yml from main branch
faddat Jul 19, 2022
1281e74
fix fee module ibc middleware
faddat Jul 19, 2022
8769f22
remove sdk_test.go and use Carlos' branch's antehandler
faddat Jul 20, 2022
2caf65f
various fixes
faddat Jul 20, 2022
8dc9b01
fix assignment to addr
faddat Jul 20, 2022
9f95dd5
revert change in misbehaviour_handle.go
vuong177 Jul 20, 2022
0c3b31f
Merge branch 'main' into real-46-branch
faddat Jul 20, 2022
6a063fe
e2e go.mod
faddat Jul 20, 2022
21cf683
e2e v4 module path
faddat Jul 20, 2022
55b166b
Merge branch 'main' into real-46-branch
faddat Jul 20, 2022
4bd8fdb
Merge branch 'main' into real-46-branch
faddat Jul 21, 2022
859eae7
Merge branch 'main' into real-46-branch
faddat Jul 21, 2022
374e043
fix import paths
faddat Jul 21, 2022
33be3d6
Merge branch 'main' into real-46-branch
faddat Jul 21, 2022
9441c40
Merge branch 'main' into real-46-branch
faddat Jul 22, 2022
d0ae698
goimports and gofumpt
faddat Jul 22, 2022
eb12e81
Merge branch 'main' into real-46-branch
faddat Jul 22, 2022
8afece8
Merge branch 'main' into real-46-branch
faddat Jul 26, 2022
4951539
Merge branch 'main' into real-46-branch
faddat Jul 26, 2022
2233d7b
46 final release
faddat Jul 26, 2022
a2d6e01
fix makefile
faddat Jul 26, 2022
e09af23
update proto file to v5
vuong177 Jul 26, 2022
0eb3fc0
Merge remote-tracking branch 'upstream/main' into real-46-branch
faddat Jul 27, 2022
771e422
Merge remote-tracking branch 'upstream/main' into real-46-branch
faddat Jul 27, 2022
0a11156
temp gitpod for protos
faddat Jul 27, 2022
8f3943d
work on protos
faddat Jul 27, 2022
92061fc
Merge remote-tracking branch 'upstream/main' into real-46-branch
faddat Jul 27, 2022
a6e2ce3
tidy
faddat Jul 27, 2022
272b708
Delete .gitpod.yml
faddat Jul 27, 2022
6f2e6df
Merge branch 'main' into real-46-branch
faddat Jul 28, 2022
cf43ee0
Merge remote-tracking branch 'upstream/main' into real-46-branch
faddat Jul 28, 2022
527d656
finish merge
faddat Jul 28, 2022
cbebf62
Merge branch 'main' into real-46-branch
faddat Jul 28, 2022
89e53d2
apply review suggestions, fix imports
colin-axner Jul 28, 2022
76ee58d
remove incorrect e2e import path
colin-axner Jul 28, 2022
2201809
fix incorrect import moving
colin-axner Jul 28, 2022
c4ca865
Merge pull request #75 from cosmos/colin/review-suggestions
faddat Jul 28, 2022
040aca9
Merge branch 'main' into real-46-branch
faddat Jul 28, 2022
acff013
refactor acknowledgement construction for SDK 0.46
Jul 28, 2022
ad9241a
Merge branch 'main' into real-46-branch
catShaark Jul 28, 2022
e31ec28
Merge pull request #76 from crodriguezvega/carlos/refactor-acknowledg…
faddat Jul 28, 2022
db99001
46 upgrade
faddat Jul 28, 2022
148c020
fix ics27 changes, import fixes
colin-axner Jul 28, 2022
9bc1af7
Merge branch 'main' into real-46-branch
faddat Jul 28, 2022
d0b020b
Merge pull request #77 from cosmos/colin/self-review
faddat Jul 28, 2022
993ce8b
re add ibcclient proposal route
catShaark Jul 28, 2022
f300949
Merge branch 'main' into real-46-branch
catShaark Jul 28, 2022
d36576c
Merge branch 'main' into real-46-branch
catShaark Jul 29, 2022
053141f
fix for make proto-all
Jul 30, 2022
7728fa1
Merge branch 'main' into real-46-branch
faddat Jul 30, 2022
70ee541
Merge pull request #79 from crodriguezvega/carlos/proto-fix
faddat Jul 30, 2022
d48007f
now both commands work, together!
faddat Jul 30, 2022
08f60a0
tidy
faddat Jul 30, 2022
171a81e
update swagger docs
faddat Aug 1, 2022
d11a462
appease codeql
faddat Aug 1, 2022
9af421e
update CONFIO_URL
faddat Aug 1, 2022
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
Prev Previous commit
Next Next commit
genesis with val set
  • Loading branch information
vuong177 committed Jul 5, 2022
commit 42c1eac29fbc9ca9680b6a0a45b5a6d93092430b
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module github.com/cosmos/ibc-go/v4
replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

require (
cosmossdk.io/math v1.0.0-beta.2
github.com/armon/go-metrics v0.4.0
github.com/confio/ics23/go v0.7.0
github.com/cosmos/cosmos-sdk v0.46.0-rc1.0.20220704192804-f68653f13648
Expand All @@ -23,7 +24,6 @@ require (
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd
google.golang.org/grpc v1.47.0
google.golang.org/protobuf v1.28.0
cosmossdk.io/math v1.0.0-beta.2
gopkg.in/yaml.v2 v2.4.0
)

Expand Down
127 changes: 112 additions & 15 deletions testing/simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,25 @@ import (

bam "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"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/cosmos/ibc-go/v4/testing/mock"
"github.com/cosmos/ibc-go/v4/testing/simapp/helpers"
)

Expand Down Expand Up @@ -59,25 +64,117 @@ func setup(withGenesis bool, invCheckPeriod uint) (*SimApp, GenesisState) {

// Setup initializes a new SimApp. A Nop logger is set in SimApp.
func Setup(isCheckTx bool) *SimApp {
app, genesisState := setup(!isCheckTx, 5)
if !isCheckTx {
// init chain must be called to stop deliverState from being nil
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
if err != nil {
panic(err)
privVal := mock.NewPV()
pubKey, _ := privVal.GetPubKey()

// create validator set with single validator
validator := tmtypes.NewValidator(pubKey, 1)
valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator})

// generate genesis account
senderPrivKey := secp256k1.GenPrivKey()
acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0)
balance := banktypes.Balance{
Address: acc.GetAddress().String(),
Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))),
}

app := SetupWithGenesisValSet(valSet, []authtypes.GenesisAccount{acc}, balance)

return app
}

// SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts
// that also act as delegators. For simplicity, each validator is bonded with a delegation
// of one consensus engine unit in the default token of the simapp from first genesis
// account. A Nop logger is set in SimApp.
func SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp {

app, genesisState := setup(true, 5)
genesisState = genesisStateWithValSet(app, genesisState, valSet, genAccs, balances...)

stateBytes, _ := json.MarshalIndent(genesisState, "", " ")

// init chain will set the validator set and initialize the genesis accounts
app.InitChain(
abci.RequestInitChain{
Validators: []abci.ValidatorUpdate{},
ConsensusParams: DefaultConsensusParams,
AppStateBytes: stateBytes,
},
)

// commit genesis changes
app.Commit()
app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{
Height: app.LastBlockHeight() + 1,
AppHash: app.LastCommitID().Hash,
ValidatorsHash: valSet.Hash(),
NextValidatorsHash: valSet.Hash(),
}})

return app
}

func genesisStateWithValSet(app *SimApp, genesisState GenesisState,
valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount,
balances ...banktypes.Balance,
) GenesisState {
// set genesis accounts
authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs)
genesisState[authtypes.ModuleName] = app.AppCodec().MustMarshalJSON(authGenesis)

validators := make([]stakingtypes.Validator, 0, len(valSet.Validators))
delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators))

bondAmt := sdk.DefaultPowerReduction

for _, val := range valSet.Validators {
pk, _ := cryptocodec.FromTmPubKeyInterface(val.PubKey)
pkAny, _ := codectypes.NewAnyWithValue(pk)
validator := stakingtypes.Validator{
OperatorAddress: sdk.ValAddress(val.Address).String(),
ConsensusPubkey: pkAny,
Jailed: false,
Status: stakingtypes.Bonded,
Tokens: bondAmt,
DelegatorShares: sdk.OneDec(),
Description: stakingtypes.Description{},
UnbondingHeight: int64(0),
UnbondingTime: time.Unix(0, 0).UTC(),
Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
MinSelfDelegation: sdk.ZeroInt(),
}
validators = append(validators, validator)
delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec()))

// Initialize the chain
app.InitChain(
abci.RequestInitChain{
Validators: []abci.ValidatorUpdate{},
ConsensusParams: DefaultConsensusParams,
AppStateBytes: stateBytes,
},
)
}
// set validators and delegations
stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)
genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis)

return app
totalSupply := sdk.NewCoins()
for _, b := range balances {
// add genesis acc tokens to total supply
totalSupply = totalSupply.Add(b.Coins...)
}

for range delegations {
// add delegated tokens to total supply
totalSupply = totalSupply.Add(sdk.NewCoin(sdk.DefaultBondDenom, bondAmt))
}

// add bonded amount to bonded pool module account
balances = append(balances, banktypes.Balance{
Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(),
Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt)},
})

// update total supply
bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{})
genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis)

return genesisState
}

// SetupWithGenesisAccounts initializes a new SimApp with the provided genesis
Expand Down