Skip to content

Commit

Permalink
Merge pull request #164 from terra-money/fix/pfm-integration
Browse files Browse the repository at this point in the history
fix: pfm integration + e2e
  • Loading branch information
emidev98 authored Aug 30, 2023
2 parents df5c6d2 + 6ada68d commit 9d05c3b
Show file tree
Hide file tree
Showing 6 changed files with 366 additions and 69 deletions.
1 change: 1 addition & 0 deletions .github/workflows/interchaine2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
# names of `make` commands to run tests
test:
- "test-e2e-pob"
- "test-e2e-pmf"
fail-fast: false

steps:
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ simulate:
test-e2e-pob:
cd interchaintest && go test -race -v -run TestPOB .

.PHONY: test test-all test-cover test-unit test-race simulate test-e2e-pob
test-e2e-pmf:
cd interchaintest && go test -race -v -run TestPMF .

.PHONY: test test-all test-cover test-unit test-race simulate test-e2e-pob test-e2e-pmf

###############################################################################
### Linting ###
Expand Down
31 changes: 17 additions & 14 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ type TerraApp struct {

// IBC hooks
IBCHooksKeeper *ibchookskeeper.Keeper
TransferStack *ibchooks.IBCMiddleware
TransferStack porttypes.Middleware
Ics20WasmHooks *ibchooks.WasmHooks
HooksICS4Wrapper ibchooks.ICS4Middleware

Expand Down Expand Up @@ -593,7 +593,21 @@ func NewTerraApp(

// Hooks Middleware
hooksTransferStack := ibchooks.NewIBCMiddleware(&transferIBCModule, &app.HooksICS4Wrapper)
app.TransferStack = &hooksTransferStack

// Packet forwarding middleware
app.RouterKeeper = *routerkeeper.NewKeeper(
appCodec,
app.keys[routertypes.StoreKey],
app.GetSubspace(routertypes.ModuleName),
app.TransferKeeper,
app.IBCKeeper.ChannelKeeper,
app.DistrKeeper,
app.BankKeeper,
app.IBCKeeper.ChannelKeeper,
)
pmfTransferStack := router.NewIBCMiddleware(hooksTransferStack, &app.RouterKeeper, 5, routerkeeper.DefaultForwardTransferPacketTimeoutTimestamp, routerkeeper.DefaultRefundTransferPacketTimeoutTimestamp)

app.TransferStack = &pmfTransferStack

app.IBCFeeKeeper = ibcfeekeeper.NewKeeper(
appCodec, keys[ibcfeetypes.StoreKey],
Expand Down Expand Up @@ -626,17 +640,6 @@ func NewTerraApp(
icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper)
icaHostStack := ibcfee.NewIBCMiddleware(icaHostIBCModule, app.IBCFeeKeeper)

app.RouterKeeper = *routerkeeper.NewKeeper(
appCodec,
app.keys[routertypes.StoreKey],
app.GetSubspace(routertypes.ModuleName),
app.TransferKeeper,
app.IBCKeeper.ChannelKeeper,
app.DistrKeeper,
app.BankKeeper,
app.IBCKeeper.ChannelKeeper,
)

// Create evidence Keeper for to register the IBC light client misbehaviour evidence route
evidenceKeeper := evidencekeeper.NewKeeper(
appCodec, keys[evidencetypes.StoreKey], app.StakingKeeper, app.SlashingKeeper,
Expand Down Expand Up @@ -687,7 +690,7 @@ func NewTerraApp(
ibcRouter := porttypes.NewRouter().
AddRoute(icacontrollertypes.SubModuleName, icaControllerStack).
AddRoute(icahosttypes.SubModuleName, icaHostStack).
AddRoute(ibctransfertypes.ModuleName, hooksTransferStack).
AddRoute(ibctransfertypes.ModuleName, pmfTransferStack).
AddRoute(wasmtypes.ModuleName, wasmStack)

app.IBCKeeper.SetRouter(ibcRouter)
Expand Down
61 changes: 61 additions & 0 deletions interchaintest/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package interchaintest

import (
"fmt"

"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v7/ibc"

"github.com/cosmos/cosmos-sdk/types/module/testutil"
)

var (
Denom = "uluna"
VotingPeriod = "15s"
MaxDepositPeriod = "10s"
Image = ibc.DockerImage{
Repository: "terramoneycore",
Version: "latest",
UidGid: "1025:1025",
}
IBCRelayerImage = "ghcr.io/cosmos/relayer"
IBCRelayerVersion = "main"
config = ibc.ChainConfig{
Type: "cosmos",
Name: "terra",
ChainID: "phoenix-1",
Images: []ibc.DockerImage{Image},
Bin: "terrad",
Bech32Prefix: "terra",
Denom: Denom,
CoinType: "330",
GasPrices: fmt.Sprintf("0%s", Denom),
GasAdjustment: 2.0,
TrustingPeriod: "112h",
NoHostMount: false,
ConfigFileOverrides: nil,
EncodingConfig: encoding(),
UsingNewGenesisCommand: true,
ModifyGenesis: cosmos.ModifyGenesis(defaultGenesisKV),
}
// SDK v47 Genesis
defaultGenesisKV = []cosmos.GenesisKV{
{
Key: "app_state.gov.params.voting_period",
Value: VotingPeriod,
},
{
Key: "app_state.gov.params.max_deposit_period",
Value: MaxDepositPeriod,
},
{
Key: "app_state.gov.params.min_deposit.0.denom",
Value: Denom,
},
}
)

func encoding() *testutil.TestEncodingConfig {
cfg := cosmos.DefaultEncoding()
return &cfg
}
Loading

0 comments on commit 9d05c3b

Please sign in to comment.