Skip to content

Commit

Permalink
Merge branch 'main' into okwme/1870-fix-bank-denom-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
okwme authored Nov 18, 2022
2 parents 0e082c5 + 63e7e7c commit 7a0f17e
Show file tree
Hide file tree
Showing 27 changed files with 657 additions and 296 deletions.
20 changes: 8 additions & 12 deletions .codecov.yml → .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
#
# This codecov.yml is the default configuration for
# all repositories on Codecov. You may adjust the settings
# below in your own codecov.yml in your repository.
#
coverage:
precision: 2
round: down
range: 70...100

status:
# Learn more at https://docs.codecov.io/docs/commit-status
project:
default:
threshold: 1% # allow this much decrease on project
app:
target: 80%
paths: "app/"

changes: false

comment:
Expand All @@ -25,9 +17,13 @@ comment:
require_changes: true

ignore:
- "*.pb.go"
- "*.pb.gw.go"
- "*.md"
- "*.rst"
- "cmd/"
- "contrib/"
- "docs/"
- "networks/"
- "cmd"
- "client"
- "contrib"
- "docs"
- "proto"
- "tests/e2e"
2 changes: 2 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ on:
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
paths-ignore:
- "**/*.md"
schedule:
- cron: '0 * * * *'

Expand Down
37 changes: 22 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: Build & Test
name: Test

on:
workflow_call:
pull_request:
paths-ignore:
- "**/*.md"
- "docs/**"
push:
branches:
- main
paths-ignore:
- "**/*.md"
- "docs/**"

jobs:
cleanup-runs:
Expand All @@ -18,43 +25,43 @@ jobs:
test-coverage-upload:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3.0.0
with:
go-version: 1.18
- uses: actions/checkout@v3.1.0
- uses: technote-space/get-diff-action@v6.0.1
- uses: technote-space/get-diff-action@v6.1.1
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/cache@v3.0.10
- uses: actions/cache@v3.0.11
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
restore-keys: |
${{ runner.os }}-go-
- name: build
run: make build
- uses: actions/setup-go@v3.3.1
with:
go-version: 1.18
- name: test & coverage report creation
run: |
make test-unit-cover
- name: filter out DONTCOVER
go test -v -coverprofile=coverage.txt -covermode=atomic -coverpkg=./... $(go list ./...)
- name: filter non-testable files
run: |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
excludelist+=" $(find ./ -type f -name '*.pb.go')"
excludelist+=" $(find ./ -type f -path './tests/mocks/*.go')"
excludelist+=" $(find ./ -type f -name '*.pb.gw.go')"
excludelist+=" $(find ./cmd -type d)"
excludelist+=" $(find ./tests -type d)"
for filename in ${excludelist}; do
filename=$(echo $filename | sed 's/^./github.com\/cosmos\/cosmos-sdk/g')
filename=${filename#".//"}
echo "Excluding ${filename} from coverage report..."
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
filename=$(echo "$filename" | sed 's/\//\\\//g')
sed -i.bak "/""$filename""/d" coverage.txt
done
- uses: codecov/codecov-action@v3.1.1
with:
file: ./coverage.txt # optional
file: ./coverage.txt
fail_ci_if_error: true

test-e2e:
Expand Down
1 change: 1 addition & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ func NewAppKeeper(
appKeepers.TransferKeeper,
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.DistrKeeper,
appKeepers.BankKeeper,
)

appKeepers.RouterModule = router.NewAppModule(appKeepers.RouterKeeper, transferIBCModule, 1,
Expand Down
2 changes: 0 additions & 2 deletions cmd/gaiad/cmd/testnet.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package cmd

// DONTCOVER

import (
"bufio"
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Updated Modules in V8 Rho
## New Modules in Rho V8
- [Global Fee](./globalfee.md)
- [Group](./group.md)
- [ICA-Mauth](./icamauth/)
- [ICA-Mauth](./icamauth.md)

23 changes: 14 additions & 9 deletions docs/modules/icamauth/README.md → docs/modules/icamauth.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# icamauth module
# Icamauth Module

## Introduction to Interchain Accounts
**Interchain Accounts** (ICA) is a standard that allows an account on a *controller* chain to create and securely control an address on a different *host* chain using the Inter Blockchain Protocol (IBC). Transactions native to the host chain are wrapped inside an IBC packet and sent from the Interchain Account Owner on the controller chain to be executed on the host chain.
Expand All @@ -14,7 +14,7 @@ The following command allows you to query all the allowed message types on a hos
gaiad q interchain-accounts host params
```

The following tutorial will demonstrate how to use Interchain Accounts through the [icamauth module](../../../x/icamauth).
The following tutorial will demonstrate how to use Interchain Accounts through the [icamauth module](../../x/icamauth).

## Setup preparation
We will run two Cosmos-SDK chains (controller chain: `test-0` and host chain: `test-1`) and a relayer to connect these two chains. We will create an account on chain `test-0` and call it `alice`, and register an Interchain Account (that we'll call `alice_ica`) on chain `test-1` for `alice` on chain `test-0`. We will also create a standard account, `bob` on chain `test-1`.
Expand All @@ -26,15 +26,20 @@ Through these 3 accounts, we can test if:
### Prepare to run two chains
We've simplified the setup process via several shell scripts. If you'd like to learn more about what's happening under the hood we suggest you inspect the files more closely.

Set up the two chains, create the keys for `alice` and `bob`, and start running both chains in different terminals:
Set up the two chains by [`init_chain_controller.sh`](https://github.com/cosmos/gaia/blob/main/docs/modules/icamauth_scripts/init_chain_controller.sh) and [`init_chain_host.sh`](https://github.com/cosmos/gaia/blob/main/docs/modules/icamauth_scripts/init_chain_host.sh), create the keys for `alice` and `bob`, and start running both chains in different terminals:
```shell
source ./docs/modules/icamauth/init_chain_controller.sh
cd gaia

source ./docs/modules/icamauth_scripts/init_chain_controller.sh
```
and ni another temrinal:
and in another terminal:
```shell
source ./docs/modules/icamauth/init_chain_host.sh
cd gaia

source ./docs/modules/icamauth_scripts/init_chain_host.sh
```


### Setting up a Hermes relayer
You can download or build the Hermes binary from the source code.
#### Download the Hermes binary
Expand Down Expand Up @@ -65,9 +70,9 @@ export PATH="$HOME/.hermes/bin:$PATH"
```

#### Create the IBC connection
Run the following command in `gaia/docs/modules/icamauth` directory to create an IBC connection:
Run the following script [`gaia/docs/modules/icamauth_scripts/hermes_setup.sh`](https://github.com/cosmos/gaia/blob/main/docs/modules/icamauth_scripts/hermes_setup.sh) to create an IBC connection:
```shell
cd ./docs/modules/icamauth
cd ./docs/modules/icamauth_scripts
source hermes_setup.sh
```

Expand Down Expand Up @@ -168,7 +173,7 @@ gaiad tx bank send $BOB $ALICE_ICA 100stake --gas-prices 0.025stake --home $HOME
Create a new IBC channel using Hermes:

```shell
hermes --config ./docs/modules/icamauth/rly-config.toml create channel --a-chain test-0 --a-connection connection-0 --a-port transfer --b-port transfer
hermes --config ./docs/modules/icamauth_scripts/rly-config.toml create channel --a-chain test-0 --a-connection connection-0 --a-port transfer --b-port transfer
```

Initiate the IBC token transfer:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

BINARY=$(which gaiad)
# please do not reveal your mnemonic in production !!!
MNEMONIC_RLY0=`cat docs/modules/icamauth/rly0-mnemonic.txt`
MNEMONIC_RLY0=`cat docs/modules/icamauth_scripts/rly0-mnemonic.txt`
MNEMONIC_ALICE="captain six loyal advice caution cost orient large mimic spare radar excess quote orchard error biology choice shop dish master quantum dumb accident between"
CHAINID_0=test-0
HOME_0=$HOME/test-0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

BINARY=$(which gaiad)
# please do not reveal your mnemonic in production !!!
MNEMONIC_RLY1=`cat docs/modules/icamauth/rly1-mnemonic.txt`
MNEMONIC_RLY1=`cat docs/modules/icamauth_scripts/rly1-mnemonic.txt`
MNEMONIC_BOB="uphold train large action document mixed exact cherry input evil sponsor digital used child engine fire attract sing little jeans decrease despair unfair what"
CHAINID_1=test-1
HOME_1=$HOME/test-1
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
cosmossdk.io/math v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.46.4
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/ibc-go/v5 v5.0.1
github.com/cosmos/ibc-go/v5 v5.1.0
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.2
github.com/golangci/golangci-lint v1.50.0
Expand All @@ -19,7 +19,7 @@ require (
github.com/spf13/cobra v1.6.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.14.0
github.com/strangelove-ventures/packet-forward-middleware/v5 v5.0.0-20221006203904-d5492a6827c1
github.com/strangelove-ventures/packet-forward-middleware/v5 v5.0.0-20221114155712-2a5b865b9ed1
github.com/stretchr/testify v1.8.1
github.com/tendermint/tendermint v0.34.22
github.com/tendermint/tm-db v0.6.7
Expand Down Expand Up @@ -292,7 +292,7 @@ require (

replace (
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.46.4
github.com/cosmos/ibc-go/v5 => github.com/cosmos/ibc-go/v5 v5.0.1
github.com/cosmos/ibc-go/v5 => github.com/cosmos/ibc-go/v5 v5.1.0
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/zondax/hid => github.com/zondax/hid v0.9.0
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4
github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw=
github.com/cosmos/iavl v0.19.4 h1:t82sN+Y0WeqxDLJRSpNd8YFX5URIrT+p8n6oJbJ2Dok=
github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
github.com/cosmos/ibc-go/v5 v5.0.1 h1:ZI5xCi6RDOL+hyu6Wx/w6JoAYFlOoK5hijsRTVWo+RA=
github.com/cosmos/ibc-go/v5 v5.0.1/go.mod h1:LX0DHLW3dfi/1e4BJzi8MGLWmQ4DSraPEgVjyo3VzAo=
github.com/cosmos/ibc-go/v5 v5.1.0 h1:m1NHXFkwwvNeJegZqtyox1WLinh+PMy4ivU/Cs9KjeA=
github.com/cosmos/ibc-go/v5 v5.1.0/go.mod h1:H6sV0/CkNRDtvSrhbsIgiog1WnSwhguGfg8x34MOVEk=
github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4=
github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY=
github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI=
Expand Down Expand Up @@ -1170,8 +1170,8 @@ github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRk
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc=
github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I=
github.com/strangelove-ventures/packet-forward-middleware/v5 v5.0.0-20221006203904-d5492a6827c1 h1:Ve6PLqMyJYm8iVihbY/HL5oFTcnY08iYGZRcGb6YTUI=
github.com/strangelove-ventures/packet-forward-middleware/v5 v5.0.0-20221006203904-d5492a6827c1/go.mod h1:JFis43ZqAGHmBYKtsbnNmm0Cq95sNuGFrBfXu2Lt5mw=
github.com/strangelove-ventures/packet-forward-middleware/v5 v5.0.0-20221114155712-2a5b865b9ed1 h1:iov20eblQwC+LdkIcHoYqhY5uc9cXdXBu8z/wwF6nFg=
github.com/strangelove-ventures/packet-forward-middleware/v5 v5.0.0-20221114155712-2a5b865b9ed1/go.mod h1:c0vbnItjuz9FBxlRI24oqtEoWXoNhKAY16IUgxTwhSY=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
Expand Down
2 changes: 2 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q
github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4=
github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+zgdYw=
github.com/strangelove-ventures/packet-forward-middleware/v5 v5.0.0-20221006203904-d5492a6827c1 h1:Ve6PLqMyJYm8iVihbY/HL5oFTcnY08iYGZRcGb6YTUI=
github.com/strangelove-ventures/packet-forward-middleware/v5 v5.0.0-20221006203904-d5492a6827c1/go.mod h1:JFis43ZqAGHmBYKtsbnNmm0Cq95sNuGFrBfXu2Lt5mw=
github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/sylvia7788/contextcheck v1.0.6/go.mod h1:9XDxwvxyuKD+8N+a7Gs7bfWLityh5t70g/GjdEt2N2M=
github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM=
Expand Down
30 changes: 30 additions & 0 deletions tests/e2e/e2e_exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,36 @@ func (s *IntegrationTestSuite) execBankSend(
s.executeGaiaTxCommand(ctx, c, gaiaCommand, valIdx, s.expectErrExecValidation(c, valIdx, expectErr))
}

type txBankSend struct {
from string
to string
amt string
fees string
log string
expectErr bool
}

func (s *IntegrationTestSuite) execBankSendBatch(
c *chain,
valIdx int,
txs ...txBankSend,
) int {
sucessBankSendCount := 0

for i := range txs {
s.T().Logf(txs[i].log)

s.execBankSend(c, valIdx, txs[i].from, txs[i].to, txs[i].amt, txs[i].fees, txs[i].expectErr)
if !txs[i].expectErr {
if !txs[i].expectErr {
sucessBankSendCount++
}
}
}

return sucessBankSendCount
}

func (s *IntegrationTestSuite) execWithdrawAllRewards(c *chain, valIdx int, payee, fees string, expectErr bool) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
Expand Down
44 changes: 44 additions & 0 deletions tests/e2e/e2e_globalfee_proposal_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package e2e

import (
"fmt"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

func (s *IntegrationTestSuite) govProposeNewGlobalfee(newGlobalfee sdk.DecCoins, proposalCounter int, submitter string, fees string) {
s.writeGovParamChangeProposalGlobalFees(s.chainA, newGlobalfee)
chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
// gov proposing new fees
s.T().Logf("Proposal number: %d", proposalCounter)
s.T().Logf("Submitting, deposit and vote legacy Gov Proposal: change global fee to %s", newGlobalfee.String())
s.submitLegacyGovProposal(chainAAPIEndpoint, submitter, fees, "param-change", proposalCounter, configFile(proposalGlobalFee))
s.depositGovProposal(chainAAPIEndpoint, submitter, fees, proposalCounter)
s.voteGovProposal(chainAAPIEndpoint, submitter, fees, proposalCounter, "yes", false)

// query the proposal status and new fee
s.Require().Eventually(
func() bool {
proposal, err := queryGovProposal(chainAAPIEndpoint, proposalCounter)
s.Require().NoError(err)
return proposal.GetProposal().Status == govv1beta1.StatusPassed
},
15*time.Second,
5*time.Second,
)

s.Require().Eventually(
func() bool {
globalFees, err := queryGlobalFees(chainAAPIEndpoint)
s.T().Logf("After gov new global fee proposal: %s", globalFees.String())
s.Require().NoError(err)

// attention: if global fee is empty, when query globalfee, it shows empty rather than default ante.DefaultZeroGlobalFee() = 0uatom.
return globalFees.IsEqual(newGlobalfee)
},
15*time.Second,
5*time.Second,
)
}
Loading

0 comments on commit 7a0f17e

Please sign in to comment.