Skip to content

Commit

Permalink
apply IBC_CHANNEL_UPGRADE_TIMEOUT patch to simd and improve test-chan…
Browse files Browse the repository at this point in the history
…nel-upgrade for tm2eth

Signed-off-by: Masanori Yoshida <[email protected]>
  • Loading branch information
siburu committed Sep 11, 2024
1 parent c511226 commit faa7a9c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
2 changes: 2 additions & 0 deletions tests/cases/docker-compose-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ services:
container_name: tendermint-chain0-mock
environment:
USE_MOCK_CLIENT: 1
IBC_CHANNEL_UPGRADE_TIMEOUT: 30000000000
tendermint-chain1-mock:
<<: *tendermint-chain1
container_name: tendermint-chain1-mock
environment:
USE_MOCK_CLIENT: 1
IBC_CHANNEL_UPGRADE_TIMEOUT: 30000000000

# Ethereum
ethereum-geth0:
Expand Down
23 changes: 12 additions & 11 deletions tests/cases/tm2eth/scripts/test-channel-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,19 @@ checkResult orig mockapp-5

echo '##### case 8 #####'
fields="$ALT_FIELDS --version mockapp-6"
$RLY tx channel-upgrade init ibc01 ibc0 $fields
$RLY eth upgrade propose ibc01 ibc1 $fields $TIMEOUT_FLAGS
$RLY tx channel-upgrade init ibc01 ibc1 $fields
retry 10 $RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHCOMPLETE --target-dst-state FLUSHING
sleep 30 # ibc1 exceeds upgrade.timeout.timestamp
retry 10 $RLY tx channel-upgrade execute ibc01 # ibc0 <= chanUpgradeTimeout, ibc1 <= chanUpgradeCancel
checkResult orig mockapp-5

echo '##### case 9 #####'
$RLY tx channel-upgrade init ibc01 ibc0 $fields
$RLY eth upgrade propose ibc01 ibc1 $fields --timeout-height 0-0 --timeout-timestamp `date -d 30sec +%s%N`
$RLY tx channel-upgrade init ibc01 ibc1 $fields
retry 10 $RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHING --target-dst-state FLUSHING
sleep 30 # ibc0 exceeds upgrade.timeout.timestamp
retry 10 $RLY tx channel-upgrade execute ibc01 # ibc1 <= chanUpgradeTimeout, ibc0 <= chanUpgradeCancel
sleep 30 # Both chains exceed upgrade.timeout.timestamp
retry 10 $RLY tx channel-upgrade execute ibc01 # ibc0,ibc1 <= chanUpgradeTimeout
checkResult orig mockapp-5

# echo '##### case 9 #####'
# $RLY tx channel-upgrade init ibc01 ibc0 $altSrcOpts
# $RLY eth upgrade propose ibc01 ibc1 $altDstOpts $TIMEOUT_FLAGS
# $RLY tx channel-upgrade init ibc01 ibc1 $altDstOpts
# retry 10 $RLY tx channel-upgrade execute ibc01 --target-src-state FLUSHING --target-dst-state FLUSHING
# sleep 20 # Both chains exceed upgrade.timeout.timestamp
# retry 10 $RLY tx channel-upgrade execute ibc01 # ibc0,ibc1 <= chanUpgradeTimeout
# checkResult orig
10 changes: 9 additions & 1 deletion tests/chains/tendermint/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"os"
"path/filepath"
"strconv"

dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/gogoproto/proto"
Expand Down Expand Up @@ -896,8 +897,15 @@ func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*ab
ibcGenesisState.ClientGenesis.Params.AllowedClients = append(
ibcGenesisState.ClientGenesis.Params.AllowedClients,
mockclienttypes.Mock)
genesisState[ibcexported.ModuleName] = app.appCodec.MustMarshalJSON(&ibcGenesisState)
}
if upgTimeout := os.Getenv("IBC_CHANNEL_UPGRADE_TIMEOUT"); len(upgTimeout) > 0 {
upgTimeoutTimestampNsec, err := strconv.ParseInt(upgTimeout, 10, 64)
if err != nil {
panic(err)
}
ibcGenesisState.ChannelGenesis.Params.UpgradeTimeout.Timestamp = uint64(upgTimeoutTimestampNsec)
}
genesisState[ibcexported.ModuleName] = app.appCodec.MustMarshalJSON(&ibcGenesisState)
}

if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()); err != nil {
Expand Down

0 comments on commit faa7a9c

Please sign in to comment.