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

02-client update to latest from main #1106

Merged
merged 36 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8f62a47
refactor: allow the mock module to be used multiple times as base ibc…
colin-axner Feb 10, 2022
843b459
feat: adding Pack/Unpack acknowledgement helper fns (#895)
seantking Feb 10, 2022
fb2f041
imp: support custom keys for testing (#893)
fedekunze Feb 10, 2022
c27d5b5
chore: add ParsePacketFromEvents testing helper function (#904)
colin-axner Feb 14, 2022
afa2d90
fix: correctly claim capability for mock module, handle genesis expor…
colin-axner Feb 15, 2022
d31f92d
docs: update migration docs for upgrade proposal in relation to ICS27…
colin-axner Feb 15, 2022
f442721
chore(ica): add trail of bits audit report (#903)
crodriguezvega Feb 16, 2022
20dd5ca
testing: adding multiple sender accounts for testing purposes (#935)
seantking Feb 17, 2022
98f4d3a
Create test chain with multiple validators (#942)
AdityaSripal Feb 17, 2022
52e3ae5
add changelog entry for SDK bump
crodriguezvega Feb 18, 2022
d48f576
fix: classify client states without consensus states as expired (#941)
timlind Feb 22, 2022
01cd4ad
chore: fix broken link (#972)
colin-axner Feb 22, 2022
9fcf254
add backport actions for v1.3.x and v2.1.x (#958)
crodriguezvega Feb 22, 2022
08d38d4
Revert "feat: adding Pack/Unpack acknowledgement helper fns (#895)" (…
colin-axner Feb 23, 2022
ef34765
chore: update migration docs (#985)
colin-axner Feb 23, 2022
556cc01
chore: fix mispelled words (#991)
seantking Feb 24, 2022
04ab3cb
fix: remove go mod tidy from proto-gen script (#989)
seantking Feb 24, 2022
4545154
bug: support base denoms with slashes (#978)
crodriguezvega Feb 28, 2022
9d8be7c
upgrade ics23 to v0.7 (#948)
crodriguezvega Feb 28, 2022
6d6888b
ibctesting: make `testing.T` public (#1020)
fedekunze Feb 28, 2022
e1be19b
add changelog entry for #941
crodriguezvega Mar 1, 2022
f994d1e
fix package import (#1007)
crodriguezvega Mar 1, 2022
147e0f1
feat: Add a function to initialize the ICS27 module via an upgrade pr…
colin-axner Mar 1, 2022
f71a505
docs: add missing args to NewKeeper in integration docs (#1038)
daeMOn63 Mar 3, 2022
a55ca88
small fixes for v2 to v3 migration (#1016)
crodriguezvega Mar 4, 2022
029c6e9
add missing slash
crodriguezvega Mar 4, 2022
7ae90c2
build(deps): bump actions/checkout from 2.4.0 to 3 (#1045)
dependabot[bot] Mar 7, 2022
fc452ac
call packet.GetSequence() rather than passing the func as argument (#…
joe-bowman Mar 7, 2022
13df199
Add counterpartyChannelID param to IBCModule.OnChanOpenAck (#1086)
catShaark Mar 9, 2022
90a7e5f
fix mirgation docs (#1091)
colin-axner Mar 9, 2022
a7563c9
fix: handle testing update client errors (#1094)
fedekunze Mar 9, 2022
f0b94df
replace channel keeper with IBC keeper in AnteDecorator (#950)
crodriguezvega Mar 10, 2022
d40f1da
add backport rules for v1.4.x and v2.2.x (#1085)
crodriguezvega Mar 10, 2022
c32e4be
ibctesting: custom voting power reduction for testing (#939)
fedekunze Mar 11, 2022
a8e1f1b
Merge branch 'main' into 02-client-refactor
seantking Mar 11, 2022
a1d8680
Merge branch '02-client-refactor' into sean/02-client-update-to-latest
seantking Mar 11, 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
ibctesting: custom voting power reduction for testing (#939)
* ibctesting: custom voting power reduction for testing

* changelog

* fix

* make T public

* fix

* revert changes

* fix test
  • Loading branch information
fedekunze authored Mar 11, 2022
commit c32e4bea2500bee1d2fab4b2ad4908563f7f8a1c
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (core) [\#709](https://github.com/cosmos/ibc-go/pull/709) Replace github.com/pkg/errors with stdlib errors

### API Breaking


* (testing) [\#939](https://github.com/cosmos/ibc-go/pull/939) Support custom power reduction for testing.
* (modules/core/05-port) [\#1086](https://github.com/cosmos/ibc-go/pull/1086) Added `counterpartyChannelID` argument to IBCModule.OnChanOpenAck
* (channel) [\#848](https://github.com/cosmos/ibc-go/pull/848) Added `ChannelId` to MsgChannelOpenInitResponse
* (testing) [\#813](https://github.com/cosmos/ibc-go/pull/813) The `ack` argument to the testing function `RelayPacket` has been removed as it is no longer needed.
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIv
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M=
github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=
Expand Down Expand Up @@ -801,7 +800,6 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig=
github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4=
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM=
Expand Down Expand Up @@ -1313,7 +1311,6 @@ google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdr
google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU=
google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I=
google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw=
google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
Expand Down Expand Up @@ -1426,7 +1423,6 @@ google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg=
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
Expand Down
18 changes: 13 additions & 5 deletions testing/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,17 @@ func SetupTestingApp() (TestingApp, map[string]json.RawMessage) {
// that also act as delegators. For simplicity, each validator is bonded with a delegation
// of one consensus engine unit (10^6) in the default token of the simapp from first genesis
// account. A Nop logger is set in SimApp.
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, balances ...banktypes.Balance) TestingApp {
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, powerReduction sdk.Int, balances ...banktypes.Balance) TestingApp {
app, genesisState := DefaultTestingAppInit()

// 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.NewInt(1000000)
bondAmt := sdk.TokensFromConsensusPower(1, powerReduction)

for _, val := range valSet.Validators {
pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey)
Expand All @@ -87,21 +88,28 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs
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()))
}

// set validators and delegations
var stakingGenesis stakingtypes.GenesisState
app.AppCodec().MustUnmarshalJSON(genesisState[stakingtypes.ModuleName], &stakingGenesis)

bondDenom := stakingGenesis.Params.BondDenom

totalSupply := sdk.NewCoins()

// 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.Mul(sdk.NewInt(int64(len(valSet.Validators)))))},
Coins: sdk.Coins{sdk.NewCoin(bondDenom, bondAmt.Mul(sdk.NewInt(int64(len(valSet.Validators)))))},
})

// set validators and delegations
stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations)
genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis)
stakingGenesis = *stakingtypes.NewGenesisState(stakingGenesis.Params, validators, delegations)
genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(&stakingGenesis)

// update total supply
bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{})
Expand Down
15 changes: 6 additions & 9 deletions testing/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func NewTestChainWithValSet(t *testing.T, coord *Coordinator, chainID string, va
senderAccs = append(senderAccs, senderAcc)
}

app := SetupWithGenesisValSet(t, valSet, genAccs, chainID, genBals...)
app := SetupWithGenesisValSet(t, valSet, genAccs, chainID, sdk.DefaultPowerReduction, genBals...)

// create current header and call begin block
header := tmproto.Header{
Expand Down Expand Up @@ -453,6 +453,7 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64,
EvidenceHash: tmhash.Sum([]byte("evidence_hash")),
ProposerAddress: tmValSet.Proposer.Address, //nolint:staticcheck
}

hhash := tmHeader.Hash()
blockID := MakeBlockID(hhash, 3, tmhash.Sum([]byte("part_set")))
voteSet := tmtypes.NewVoteSet(chainID, blockHeight, 1, tmproto.PrecommitType, tmValSet)
Expand All @@ -467,16 +468,12 @@ func (chain *TestChain) CreateTMClientHeader(chainID string, blockHeight int64,

if tmValSet != nil {
valSet, err = tmValSet.ToProto()
if err != nil {
panic(err)
}
require.NoError(chain.T, err)
}

if tmTrustedVals != nil {
trustedVals, err = tmTrustedVals.ToProto()
if err != nil {
panic(err)
}
require.NoError(chain.T, err)
}

// The trusted fields may be nil. They may be filled before relaying messages to a client.
Expand Down Expand Up @@ -505,8 +502,8 @@ func MakeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) tmtypes.Bl
// sorting of ValidatorSet.
// The sorting is first by .VotingPower (descending), with secondary index of .Address (ascending).
func CreateSortedSignerArray(altPrivVal, suitePrivVal tmtypes.PrivValidator,
altVal, suiteVal *tmtypes.Validator) []tmtypes.PrivValidator {

altVal, suiteVal *tmtypes.Validator,
) []tmtypes.PrivValidator {
switch {
case altVal.VotingPower > suiteVal.VotingPower:
return []tmtypes.PrivValidator{altPrivVal, suitePrivVal}
Expand Down
12 changes: 2 additions & 10 deletions testing/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,7 @@ func (coord *Coordinator) ConnOpenInitOnBothChains(path *Path) error {
return err
}

if err := path.EndpointB.UpdateClient(); err != nil {
return err
}

return nil
return path.EndpointB.UpdateClient()
}

// ChanOpenInitOnBothChains initializes a channel on the source chain and counterparty chain
Expand All @@ -237,9 +233,5 @@ func (coord *Coordinator) ChanOpenInitOnBothChains(path *Path) error {
return err
}

if err := path.EndpointB.UpdateClient(); err != nil {
return err
}

return nil
return path.EndpointB.UpdateClient()
}
4 changes: 2 additions & 2 deletions testing/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (endpoint *Endpoint) QueryProof(key []byte) ([]byte, clienttypes.Height) {
}

// QueryProofAtHeight queries proof associated with this endpoint using the proof height
// providied
// provided
func (endpoint *Endpoint) QueryProofAtHeight(key []byte, height uint64) ([]byte, clienttypes.Height) {
// query proof on the counterparty using the latest height of the IBC client
return endpoint.Chain.QueryProofAtHeight(key, int64(height))
Expand Down Expand Up @@ -98,7 +98,7 @@ func (endpoint *Endpoint) CreateClient() (err error) {
consensusState = endpoint.Counterparty.Chain.LastHeader.ConsensusState()
case exported.Solomachine:
// TODO
// solo := NewSolomachine(Chain.T, endpoint.Chain.Codec, clientID, "", 1)
// solo := NewSolomachine(endpoint.Chain.T, endpoint.Chain.Codec, clientID, "", 1)
// clientState = solo.ClientState()
// consensusState = solo.ConsensusState()

Expand Down