Skip to content

Commit

Permalink
Merge branch 'main' into reece/root-documents
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups authored Oct 16, 2023
2 parents aaf8702 + 2c47fa0 commit 5c38a32
Show file tree
Hide file tree
Showing 13 changed files with 270 additions and 211 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
version: v1.54
only-new-issues: true
args: --timeout=5m
args: --timeout=10m

clippy-lint:
defaults:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: release binary

on:
release:
types: [created]

env:
GO_VERSION: 1.21

jobs:
release-static-binary:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout interchaintest
uses: actions/checkout@v4

- name: Setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

# This must be go install vs make install as to not statically link the binary
# to the worker node.
- run: cd local-interchain && go mod tidy && go install ./...

- run: cp $HOME/go/bin/local-ic ./local-ic
- run: chmod +x ./local-ic

- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ github.token }}
files: |
local-ic
7 changes: 7 additions & 0 deletions chain/cosmos/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ type GenesisKV struct {
Value interface{} `json:"value"`
}

func NewGenesisKV(key string, value interface{}) GenesisKV {
return GenesisKV{
Key: key,
Value: value,
}
}

func ModifyGenesis(genesisKV []GenesisKV) func(ibc.ChainConfig, []byte) ([]byte, error) {
return func(chainConfig ibc.ChainConfig, genbz []byte) ([]byte, error) {
g := make(map[string]interface{})
Expand Down
36 changes: 5 additions & 31 deletions examples/cosmos/chain_export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
"go.uber.org/zap/zaptest"
)

func TestJunoStateExport(t *testing.T) {
Expand All @@ -29,39 +28,14 @@ func CosmosChainStateExportTest(t *testing.T, name, version string) {
numVals := 1
numFullNodes := 0

cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
{
Name: name,
ChainName: name,
Version: version,
ChainConfig: ibc.ChainConfig{
Denom: "ujuno",
},
NumValidators: &numVals,
NumFullNodes: &numFullNodes,
},
})

chains, err := cf.Chains(t.Name())
require.NoError(t, err)
// defaults to Juno
cfg := ibc.ChainConfig{}

chains := interchaintest.CreateChainWithConfig(t, numVals, numFullNodes, name, version, cfg)
chain := chains[0].(*cosmos.CosmosChain)

ic := interchaintest.NewInterchain().
AddChain(chain)

ctx := context.Background()
client, network := interchaintest.DockerSetup(t)

require.NoError(t, ic.Build(ctx, nil, interchaintest.InterchainBuildOptions{
TestName: t.Name(),
Client: client,
NetworkID: network,
SkipPathCreation: true,
}))
t.Cleanup(func() {
_ = ic.Close()
})
enableBlockDB := false
ctx, _, _, _ := interchaintest.BuildInitialChain(t, chains, enableBlockDB)

HaltChainAndExportGenesis(ctx, t, chain, nil, 3)
}
Expand Down
55 changes: 10 additions & 45 deletions examples/cosmos/chain_param_change_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cosmos_test

import (
"context"
"encoding/json"
"testing"

Expand All @@ -10,7 +9,6 @@ import (
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
)

func TestJunoParamChange(t *testing.T) {
Expand All @@ -29,54 +27,21 @@ func CosmosChainParamChangeTest(t *testing.T, name, version string) {

// SDK v45 params for Juno genesis
shortVoteGenesis := []cosmos.GenesisKV{
{
Key: "app_state.gov.voting_params.voting_period",
Value: votingPeriod,
},
{
Key: "app_state.gov.deposit_params.max_deposit_period",
Value: maxDepositPeriod,
},
{
Key: "app_state.gov.deposit_params.min_deposit.0.denom",
Value: "ujuno",
},
cosmos.NewGenesisKV("app_state.gov.voting_params.voting_period", votingPeriod),
cosmos.NewGenesisKV("app_state.gov.deposit_params.max_deposit_period", maxDepositPeriod),
cosmos.NewGenesisKV("app_state.gov.deposit_params.min_deposit.0.denom", "ujuno"),
}

cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
{
Name: name,
ChainName: name,
Version: version,
ChainConfig: ibc.ChainConfig{
Denom: "ujuno",
ModifyGenesis: cosmos.ModifyGenesis(shortVoteGenesis),
},
NumValidators: &numVals,
NumFullNodes: &numFullNodes,
},
})

chains, err := cf.Chains(t.Name())
require.NoError(t, err)
cfg := ibc.ChainConfig{
Denom: "ujuno",
ModifyGenesis: cosmos.ModifyGenesis(shortVoteGenesis),
}

chains := interchaintest.CreateChainWithConfig(t, numVals, numFullNodes, name, version, cfg)
chain := chains[0].(*cosmos.CosmosChain)

ic := interchaintest.NewInterchain().
AddChain(chain)

ctx := context.Background()
client, network := interchaintest.DockerSetup(t)

require.NoError(t, ic.Build(ctx, nil, interchaintest.InterchainBuildOptions{
TestName: t.Name(),
Client: client,
NetworkID: network,
SkipPathCreation: true,
}))
t.Cleanup(func() {
_ = ic.Close()
})
enableBlockDB := false
ctx, _, _, _ := interchaintest.BuildInitialChain(t, chains, enableBlockDB)

const userFunds = int64(10_000_000_000)
users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chain)
Expand Down
20 changes: 4 additions & 16 deletions examples/cosmos/chain_upgrade_ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,12 @@ func CosmosChainUpgradeIBCTest(t *testing.T, chainName, initialVersion, upgradeC

// SDK v45 params for Juno genesis
shortVoteGenesis := []cosmos.GenesisKV{
{
Key: "app_state.gov.voting_params.voting_period",
Value: votingPeriod,
},
{
Key: "app_state.gov.deposit_params.max_deposit_period",
Value: maxDepositPeriod,
},
{
Key: "app_state.gov.deposit_params.min_deposit.0.denom",
Value: "ujuno",
},
cosmos.NewGenesisKV("app_state.gov.voting_params.voting_period", votingPeriod),
cosmos.NewGenesisKV("app_state.gov.deposit_params.max_deposit_period", maxDepositPeriod),
cosmos.NewGenesisKV("app_state.gov.deposit_params.min_deposit.0.denom", "ujuno"),
}

cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
chains := interchaintest.CreateChainsWithChainSpecs(t, []*interchaintest.ChainSpec{
{
Name: chainName,
ChainName: chainName,
Expand All @@ -66,9 +57,6 @@ func CosmosChainUpgradeIBCTest(t *testing.T, chainName, initialVersion, upgradeC
},
})

chains, err := cf.Chains(t.Name())
require.NoError(t, err)

client, network := interchaintest.DockerSetup(t)

chain, counterpartyChain := chains[0].(*cosmos.CosmosChain), chains[1].(*cosmos.CosmosChain)
Expand Down
4 changes: 1 addition & 3 deletions examples/cosmos/light_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ func TestUpdateLightClients(t *testing.T) {
ctx := context.Background()

// Chains
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
chains := interchaintest.CreateChainsWithChainSpecs(t, []*interchaintest.ChainSpec{
{Name: "gaia", Version: gaiaVersion},
{Name: "osmosis", Version: osmosisVersion},
})

chains, err := cf.Chains(t.Name())
require.NoError(t, err)
gaia, osmosis := chains[0], chains[1]

// Relayer
Expand Down
8 changes: 1 addition & 7 deletions examples/cosmos/sdk_boundary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,7 @@ func TestSDKBoundaries(t *testing.T) {
t.Run(testname, func(t *testing.T) {
t.Parallel()

cf := interchaintest.NewBuiltinChainFactory(
zaptest.NewLogger(t),
tt.chainSpecs,
)

chains, err := cf.Chains(t.Name())
require.NoError(t, err)
chains := interchaintest.CreateChainsWithChainSpecs(t, tt.chainSpecs)

client, network := interchaintest.DockerSetup(t)

Expand Down
38 changes: 7 additions & 31 deletions examples/cosmos/state_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
)

func TestCosmosHubStateSync(t *testing.T) {
Expand Down Expand Up @@ -46,39 +45,16 @@ func CosmosChainStateSyncTest(t *testing.T, chainName, version string) {

configFileOverrides["config/app.toml"] = appTomlOverrides

cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
{
Name: chainName,
ChainName: chainName,
Version: version,
ChainConfig: ibc.ChainConfig{
ConfigFileOverrides: configFileOverrides,
},
NumFullNodes: &nf,
},
})

chains, err := cf.Chains(t.Name())
require.NoError(t, err)
cfg := ibc.ChainConfig{
ConfigFileOverrides: configFileOverrides,
}

chains := interchaintest.CreateChainWithConfig(t, 1, nf, chainName, version, cfg)

chain := chains[0].(*cosmos.CosmosChain)

ic := interchaintest.NewInterchain().
AddChain(chain)

ctx := context.Background()
client, network := interchaintest.DockerSetup(t)

require.NoError(t, ic.Build(ctx, nil, interchaintest.InterchainBuildOptions{
TestName: t.Name(),
Client: client,
NetworkID: network,
// BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(),
SkipPathCreation: true,
}))
t.Cleanup(func() {
_ = ic.Close()
})
enableBlockDB := false
ctx, _, _, _ := interchaintest.BuildInitialChain(t, chains, enableBlockDB)

// Wait for blocks so that nodes have a few state sync snapshot available
require.NoError(t, testutil.WaitForBlocks(ctx, stateSyncSnapshotInterval*2, chain))
Expand Down
Loading

0 comments on commit 5c38a32

Please sign in to comment.