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: adding x/cwica module #542

Merged
merged 68 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
6172cc6
adding ica controller
spoo-bar Jan 23, 2024
236261b
adding interchaintxs proto files
spoo-bar Feb 6, 2024
0d041a6
add interchaintx module
spoo-bar Feb 7, 2024
905d783
Update app.go
spoo-bar Feb 7, 2024
c01fe29
adding types test
spoo-bar Feb 7, 2024
2540be9
adding params test
spoo-bar Feb 7, 2024
b65d28d
adding grpc tests
spoo-bar Feb 12, 2024
ce36af8
adding genesis test
spoo-bar Feb 12, 2024
81066a9
adding msgserver tests
spoo-bar Feb 12, 2024
c44b1e5
adding ibc handlers test
spoo-bar Feb 12, 2024
e4113f1
Merge branch 'main' into spoorthi/adding-ica-controller
spoo-bar Feb 12, 2024
4a4ca5b
init interchaintx test
spoo-bar Feb 13, 2024
4aca77d
test
spoo-bar Feb 13, 2024
69377a1
Update interchaintest.yaml
spoo-bar Feb 13, 2024
247ba31
Update interchaintxs_test.go
spoo-bar Feb 13, 2024
8dcf830
adding entire test case
spoo-bar Feb 13, 2024
11a2873
changing proto path
spoo-bar Feb 13, 2024
d884f6e
removing registration fees
spoo-bar Feb 15, 2024
c17e3ef
adding ibc route with ica controller
spoo-bar Feb 19, 2024
5b8c4ce
testing register account
spoo-bar Feb 19, 2024
e35da94
Merge branch 'main' into spoorthi/adding-ica-controller
spoo-bar Feb 19, 2024
a01854b
setting up chain2 gov
spoo-bar Feb 19, 2024
7008aa3
chain2 vote tests
spoo-bar Feb 20, 2024
276d918
some test refactoring
spoo-bar Feb 20, 2024
22cd729
more refactor
spoo-bar Feb 20, 2024
1cfca93
update test to match the contract
spoo-bar Feb 20, 2024
7c9dcb6
cleanup the tests
spoo-bar Feb 20, 2024
c95b69f
adding gh workflow test
spoo-bar Feb 20, 2024
8af69d4
rename proto
spoo-bar Feb 20, 2024
8d4559d
cleanup
spoo-bar Feb 20, 2024
4945df9
linting
spoo-bar Feb 20, 2024
d089f36
Updating CHANGELOG
spoo-bar Feb 20, 2024
495715b
adding module to upgrade handlers
spoo-bar Feb 20, 2024
f8d28b5
refactor sudo payload type
spoo-bar Feb 21, 2024
0093a38
endpoint renaming
spoo-bar Feb 21, 2024
5d995ac
fixing json encoding
spoo-bar Feb 21, 2024
29d3b68
rename request to packet
spoo-bar Feb 21, 2024
bb8a4fe
typo
spoo-bar Feb 21, 2024
a9148c5
using error standard
spoo-bar Feb 22, 2024
496f344
rename
spoo-bar Feb 22, 2024
0d291a0
Merge branch 'main' into spoorthi/adding-ica-controller
spoo-bar Feb 26, 2024
9a25b73
proto regen
spoo-bar Feb 26, 2024
6813433
Update ibc_handlers.go
spoo-bar Feb 26, 2024
fed6a8f
module rename
spoo-bar Feb 26, 2024
a7f68d4
interchaintest update
spoo-bar Feb 26, 2024
2fa7b8c
Update setup.go
spoo-bar Feb 26, 2024
73b9e7d
update setup.go
spoo-bar Feb 26, 2024
70b00b4
fixing cwica interchaintest
spoo-bar Feb 26, 2024
2488504
adding spec
spoo-bar Feb 27, 2024
2fbe7e5
removing interchain accounts id
spoo-bar Feb 27, 2024
66de321
fixing interchaintest
spoo-bar Feb 28, 2024
6624c0e
adding test to ensure multiple ica cant be registered for same connec…
spoo-bar Feb 28, 2024
9eff6d7
making test more comprehensive
spoo-bar Feb 28, 2024
36d1b6f
add docs
spoo-bar Feb 29, 2024
99cffcb
implement chan closed handler
spoo-bar Feb 29, 2024
712081c
cleanup
spoo-bar Mar 1, 2024
825e9c2
adding version during register interchain account
spoo-bar Mar 1, 2024
69447f3
Merge branch 'main' into spoorthi/adding-ica-controller
spoo-bar Mar 2, 2024
c3aea14
changing openack api
spoo-bar Mar 4, 2024
14483de
Merge branch 'spoorthi/adding-ica-controller' of https://github.com/a…
spoo-bar Mar 4, 2024
c6a90ac
cleanup proto
spoo-bar Mar 4, 2024
3852b47
movieg sudo payloads to proto
spoo-bar Mar 4, 2024
00bf839
fixing cwica test
spoo-bar Mar 4, 2024
d4101a4
oops
spoo-bar Mar 4, 2024
5742654
update spec
spoo-bar Mar 4, 2024
d3077c2
linting
spoo-bar Mar 4, 2024
57bb7ad
proto rename
spoo-bar Mar 4, 2024
db3c309
more cleanup
spoo-bar Mar 4, 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
35 changes: 34 additions & 1 deletion .github/workflows/interchaintest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,37 @@ jobs:
- name: Run chain conformance test
run: |
cd interchaintest
go test -v -race -run TestGaiaConformance
go test -v -race -run TestGaiaConformance

cwica_tests:
name: Interchain transactions test
needs: [build_images]
runs-on: ubuntu-latest

steps:
- name: Checkout archway-network/archway/interchaintest
uses: actions/checkout@v3
with:
fetch-depth: 0
sparse-checkout: interchaintest

- name: Setup up Golang
uses: actions/setup-go@v4
with:
go-version-file: 'interchaintest/go.mod'

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Download current image
uses: actions/download-artifact@v3
with:
name: action_image_artifact_archway_local

- name: Load current image
run: docker load --input archway_local

- name: Run interchain transactions test
run: |
cd interchaintest
go test -v -race -run TestCWICA
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Contains all the PRs that improved the code without changing the behaviors.
- [#532](https://github.com/archway-network/archway/pull/532) - Adding ADR-009 for x/callback module
- [#527](https://github.com/archway-network/archway/pull/527) - Add x/cwfees module.
- [#541](https://github.com/archway-network/archway/pull/541) - Update the interchaintest framework to v7
- [#542](https://github.com/archway-network/archway/pull/542) - Adding x/cwica module
- [#543](https://github.com/archway-network/archway/pull/543) - Bumping sdk to v0.47.9
- [#544](https://github.com/archway-network/archway/pull/544) - Bumping sdk to v0.47.10

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ proto-gen:
proto-format:
@echo "Formatting Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace \
--workdir /workspace $(PROTO_FORMATTER_IMAGE) \
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
--workdir /workspace $(PROTO_BUILDER_IMAGE) \
find ./ -name *.proto -exec clang-format -i {} \;

proto-swagger-gen:
@echo "Generating Protobuf Swagger files"
Expand Down
47 changes: 45 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ import (
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller"
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
Expand Down Expand Up @@ -136,6 +139,10 @@ import (
trackingKeeper "github.com/archway-network/archway/x/tracking/keeper"
trackingTypes "github.com/archway-network/archway/x/tracking/types"

cwica "github.com/archway-network/archway/x/cwica"
cwicakeeper "github.com/archway-network/archway/x/cwica/keeper"
cwicatypes "github.com/archway-network/archway/x/cwica/types"

"github.com/CosmWasm/wasmd/x/wasm"

archwayappparams "github.com/archway-network/archway/app/params"
Expand Down Expand Up @@ -209,6 +216,7 @@ var (
genmsg.AppModule{},
callback.AppModuleBasic{},
cwfees.AppModule{},
cwica.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -304,7 +312,7 @@ func NewArchwayApp(
govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
feegrant.StoreKey, authzkeeper.StoreKey, wasmdTypes.StoreKey, consensusparamtypes.StoreKey,
icahosttypes.StoreKey, ibcfeetypes.StoreKey, crisistypes.StoreKey, group.StoreKey, nftkeeper.StoreKey,
icacontrollertypes.StoreKey, icahosttypes.StoreKey, ibcfeetypes.StoreKey, crisistypes.StoreKey, group.StoreKey, nftkeeper.StoreKey, cwicatypes.StoreKey,

trackingTypes.StoreKey, rewardsTypes.StoreKey, callbackTypes.StoreKey, cwfees.ModuleName,
)
Expand Down Expand Up @@ -342,6 +350,7 @@ func NewArchwayApp(
)

scopedIBCKeeper := app.Keepers.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName)
scopedICAControllerKeeper := app.Keepers.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName)
scopedICAHostKeeper := app.Keepers.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName)
scopedTransferKeeper := app.Keepers.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedWasmKeeper := app.Keepers.CapabilityKeeper.ScopeToModule(wasmdTypes.ModuleName)
Expand Down Expand Up @@ -469,6 +478,17 @@ func NewArchwayApp(

transferModule := transfer.NewAppModule(app.Keepers.TransferKeeper)

app.Keepers.ICAControllerKeeper = icacontrollerkeeper.NewKeeper(
appCodec,
keys[icacontrollertypes.StoreKey],
app.getSubspace(icacontrollertypes.SubModuleName),
app.Keepers.IBCKeeper.ChannelKeeper,
app.Keepers.IBCKeeper.ChannelKeeper,
&app.Keepers.IBCKeeper.PortKeeper,
scopedICAControllerKeeper,
app.MsgServiceRouter(),
)

app.Keepers.ICAHostKeeper = icahostkeeper.NewKeeper(
appCodec,
keys[icahosttypes.StoreKey],
Expand Down Expand Up @@ -576,11 +596,27 @@ func NewArchwayApp(

app.Keepers.CWFeesKeeper = cwfees.NewKeeper(appCodec, keys[cwfees.ModuleName], app.Keepers.WASMKeeper)

app.Keepers.CWICAKeeper = *cwicakeeper.NewKeeper(
appCodec,
keys[cwicatypes.StoreKey],
app.Keepers.IBCKeeper.ChannelKeeper,
app.Keepers.IBCKeeper.ConnectionKeeper,
app.Keepers.ICAControllerKeeper,
app.Keepers.WASMKeeper,
govModuleAddr,
)

var transferStack porttypes.IBCModule
transferStack = transfer.NewIBCModule(app.Keepers.TransferKeeper)
transferStack = ibcfee.NewIBCMiddleware(transferStack, app.Keepers.IBCFeeKeeper)

// Create Interchain Accounts Stack

var icaControllerStack porttypes.IBCModule
icaControllerStack = cwica.NewIBCModule(app.Keepers.CWICAKeeper)
icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, app.Keepers.ICAControllerKeeper)
//icaControllerStack = ibcfee.NewIBCMiddleware(icaControllerStack, app.Keepers.IBCFeeKeeper)

// RecvPacket, message that originates from core IBC and goes down to app, the flow is:
// channel.RecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket
var icaHostStack porttypes.IBCModule
Expand All @@ -595,6 +631,8 @@ func NewArchwayApp(
ibcRouter := porttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack)
ibcRouter.AddRoute(wasmdTypes.ModuleName, wasmStack)
ibcRouter.AddRoute(cwicatypes.ModuleName, icaControllerStack)
ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerStack)
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostStack)
app.Keepers.IBCKeeper.SetRouter(ibcRouter)

Expand Down Expand Up @@ -644,13 +682,14 @@ func NewArchwayApp(
params.NewAppModule(app.Keepers.ParamsKeeper),
transferModule,
ibcfee.NewAppModule(app.Keepers.IBCFeeKeeper),
ica.NewAppModule(nil, &app.Keepers.ICAHostKeeper),
ica.NewAppModule(&app.Keepers.ICAControllerKeeper, &app.Keepers.ICAHostKeeper),
consensus.NewAppModule(appCodec, app.Keepers.ConsensusParamsKeeper),
tracking.NewAppModule(app.appCodec, app.Keepers.TrackingKeeper),
rewards.NewAppModule(app.appCodec, app.Keepers.RewardsKeeper),
cwfees.NewAppModule(app.Keepers.CWFeesKeeper),
genmsg.NewAppModule(app.MsgServiceRouter()),
callback.NewAppModule(app.appCodec, app.Keepers.CallbackKeeper, app.Keepers.WASMKeeper),
cwica.NewAppModule(appCodec, app.Keepers.CWICAKeeper, app.Keepers.AccountKeeper),
crisis.NewAppModule(&app.Keepers.CrisisKeeper, skipGenesisInvariants, app.getSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
)

Expand Down Expand Up @@ -691,6 +730,7 @@ func NewArchwayApp(
rewardsTypes.ModuleName,
callbackTypes.ModuleName,
cwfees.ModuleName, // does not have being blocker.
cwicatypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand Down Expand Up @@ -727,6 +767,7 @@ func NewArchwayApp(
// invariants checks are always the last to run
crisistypes.ModuleName,
cwfees.ModuleName, // does not have end blocker
cwicatypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -770,6 +811,7 @@ func NewArchwayApp(
callbackTypes.ModuleName,
// invariants checks are always the last to run
crisistypes.ModuleName,
cwicatypes.ModuleName,
)

// Uncomment if you want to set a custom migration order here.
Expand Down Expand Up @@ -1033,6 +1075,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable())
paramsKeeper.Subspace(wasmdTypes.ModuleName)
paramsKeeper.Subspace(rewardsTypes.ModuleName)

Expand Down
4 changes: 4 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ import (

"github.com/archway-network/archway/x/cwfees"

icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
ibcfeekeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper"
ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"

callbackKeeper "github.com/archway-network/archway/x/callback/keeper"
cwicaKeeper "github.com/archway-network/archway/x/cwica/keeper"
rewardsKeeper "github.com/archway-network/archway/x/rewards/keeper"
trackingKeeper "github.com/archway-network/archway/x/tracking/keeper"
)
Expand All @@ -49,6 +51,7 @@ type ArchwayKeepers struct {
ConsensusParamsKeeper consensusparamkeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
IBCFeeKeeper ibcfeekeeper.Keeper
ICAControllerKeeper icacontrollerkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
Expand All @@ -61,4 +64,5 @@ type ArchwayKeepers struct {
RewardsKeeper rewardsKeeper.Keeper
CWFeesKeeper cwfees.Keeper
CallbackKeeper callbackKeeper.Keeper
CWICAKeeper cwicaKeeper.Keeper
}
5 changes: 5 additions & 0 deletions app/upgrades/latest/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"

"github.com/archway-network/archway/app/keepers"
"github.com/archway-network/archway/app/upgrades"
callbackTypes "github.com/archway-network/archway/x/callback/types"
"github.com/archway-network/archway/x/cwfees"
cwicatypes "github.com/archway-network/archway/x/cwica/types"
)

// This upgrade handler is used for all the current changes to the protocol
Expand All @@ -34,6 +37,8 @@ var Upgrade = upgrades.Upgrade{
Added: []string{
callbackTypes.ModuleName,
cwfees.ModuleName,
icacontrollertypes.StoreKey,
cwicatypes.ModuleName,
},
},
}
2 changes: 1 addition & 1 deletion docs/static/swagger.min.json

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion interchaintest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,15 @@ Now go to Archway repo root and run
```sh
cd interchaintest
go test -v -race -run TestChainUpgrade
```
```

## CWICA test

To run the IBC conformance test locally go to Archway repo root and

```sh
cd interchaintest
go test -v -race -run TestCWICA
```

The contract binary used for testing is located in the artifacts folder and the source is available at https://github.com/archway-network/test-contracts
Binary file added interchaintest/artifacts/cwica.wasm
Binary file not shown.
Loading
Loading