Skip to content

Commit

Permalink
chore: fix merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jim380 committed Jan 26, 2024
1 parent 7aeac46 commit 53a85cd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 38 deletions.
5 changes: 4 additions & 1 deletion go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
Expand Down Expand Up @@ -985,6 +986,7 @@ golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -1033,6 +1035,7 @@ golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k=
golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
Expand Down Expand Up @@ -1088,4 +1091,4 @@ mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jC
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RFiZMMsLVL+A96Nvptar8Fj71is=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
4 changes: 2 additions & 2 deletions interchaintest/chain_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package interchaintest
import (
"testing"

"cosmossdk.io/math"
"github.com/sedaprotocol/seda-chain/interchaintest/conformance"
"github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
"github.com/stretchr/testify/require"

"github.com/sedaprotocol/seda-chain/interchaintest/conformance"
)

func TestChainStart(t *testing.T) {
Expand Down
37 changes: 11 additions & 26 deletions interchaintest/chain_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ import (
"testing"
"time"

upgradetypes "cosmossdk.io/x/upgrade/types"
"cosmossdk.io/math"
"github.com/docker/docker/client"
"github.com/sedaprotocol/seda-chain/interchaintest/conformance"
"github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/testutil"
"github.com/stretchr/testify/require"

cosmosproto "github.com/cosmos/gogoproto/proto"

"github.com/sedaprotocol/seda-chain/interchaintest/conformance"
upgradetypes "cosmossdk.io/x/upgrade/types"
)

const (
Expand Down Expand Up @@ -44,7 +43,6 @@ func TestChainUpgrade(t *testing.T) {
}

func BasicUpgradeTest(t *testing.T, upgradeVersion, upgradeRepo, upgradeName string) {
t.Helper()
if testing.Short() {
t.Skip("skipping in short mode")
}
Expand Down Expand Up @@ -86,7 +84,6 @@ func BasicUpgradeTest(t *testing.T, upgradeVersion, upgradeRepo, upgradeName str
}

func UpgradeNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, client *client.Client, haltHeight uint64, upgradeRepo, upgradeVersion string) {
t.Helper()
stopNodes(t, ctx, chain)
upgradeNodes(t, ctx, chain, client, upgradeRepo, upgradeVersion)
startNodes(t, ctx, chain)
Expand All @@ -95,8 +92,7 @@ func UpgradeNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain,
}

func fundChainUser(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) ibc.Wallet {
t.Helper()
const userFunds = int64(10_000_000_000)
userFunds := math.NewInt(10_000_000_000)
users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chain)
return users[0]
}
Expand All @@ -119,7 +115,6 @@ func getTestGenesis() []cosmos.GenesisKV {
}

func stopNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) {
t.Helper()
t.Log("stopping node(s)")
err := chain.StopAllNodes(ctx)
if err != nil {
Expand All @@ -128,13 +123,11 @@ func stopNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) {
}

func upgradeNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, client *client.Client, upgradeRepo, upgradeVersion string) {
t.Helper()
t.Log("upgrading node(s)")
chain.UpgradeVersion(ctx, client, upgradeRepo, upgradeVersion)
}

func startNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) {
t.Helper()
t.Log("starting node(s)")
err := chain.StartAllNodes(ctx)
if err != nil {
Expand All @@ -143,7 +136,6 @@ func startNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) {
}

func waitForBlocks(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) {
t.Helper()
timeoutCtx, timeoutCtxCancel := context.WithTimeout(ctx, time.Second*60)
defer timeoutCtxCancel()

Expand All @@ -154,7 +146,6 @@ func waitForBlocks(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain)
}

func checkHeight(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, haltHeight uint64) {
t.Helper()
height, err := chain.Height(ctx)
if err != nil {
t.Fatalf("error fetching height after upgrade: %v", err)
Expand All @@ -165,10 +156,7 @@ func checkHeight(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, h
}
}

//nolint:staticcheck // SA4009 disable static check here
func ValidatorVoting(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, proposalID string, currentHeight, haltHeight uint64) {
t.Helper()

func ValidatorVoting(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, proposalID string, currentHeight uint64, haltHeight uint64) {
err := chain.VoteOnProposalAllValidators(ctx, proposalID, cosmos.ProposalVoteYes)
require.NoError(t, err, "failed to submit votes")

Expand Down Expand Up @@ -197,23 +185,20 @@ func ValidatorVoting(t *testing.T, ctx context.Context, chain *cosmos.CosmosChai
}

func SubmitUpgradeProposal(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, upgradeName string) (uint64, string) {
t.Helper()
currentHeight, err := chain.Height(ctx)
require.NoError(t, err, "error fetching height before submit upgrade proposal")

haltHeight := currentHeight + haltHeightDelta

upgradeMsg := []cosmosproto.Message{
&upgradetypes.MsgSoftwareUpgrade{
Authority: "seda10d07y265gmmuvt4z0w9aw880jnsr700jvvla4j", // gov module account; seda-chaind q auth module-account gov
Plan: upgradetypes.Plan{
Name: upgradeName,
Height: int64(haltHeight),
},
upgradeMsg := &upgradetypes.MsgSoftwareUpgrade{
Authority: "seda10d07y265gmmuvt4z0w9aw880jnsr700jvvla4j", // gov module account; seda-chaind q auth module-account gov
Plan: upgradetypes.Plan{
Name: upgradeName,
Height: int64(haltHeight),
},
}

proposal, err := chain.BuildProposal(upgradeMsg,
proposal, err := chain.BuildProposal([]cosmos.ProtoMessage{upgradeMsg},
"Chain Upgrade 1", // title
"Summary desc", // summary
"ipfs://CID", // metadata
Expand Down
14 changes: 5 additions & 9 deletions interchaintest/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ import (
"fmt"
"testing"

"cosmossdk.io/math"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/cosmos/cosmos-sdk/types/module/testutil"
ibclocalhost "github.com/cosmos/ibc-go/v8/modules/light-clients/09-localhost"
"github.com/docker/docker/client"
"github.com/sedaprotocol/seda-chain/interchaintest/types"
"github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/testreporter"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/cosmos/cosmos-sdk/types/module/testutil"
ibclocalhost "github.com/cosmos/ibc-go/v8/modules/light-clients/09-localhost"

"github.com/sedaprotocol/seda-chain/interchaintest/types"
)

var (
Expand Down Expand Up @@ -92,14 +91,12 @@ func sedaEncoding() *testutil.TestEncodingConfig {

// CreateChains generates this branch's chain (ex: from the commit)
func CreateChains(t *testing.T, numVals, numFullNodes int) []ibc.Chain {
t.Helper()
cfg := SedaCfg
cfg.Images = []ibc.DockerImage{dockerImage}
return CreateChainsWithCustomConfig(t, numVals, numFullNodes, cfg)
}

func CreateChainsWithCustomConfig(t *testing.T, numVals, numFullNodes int, config ibc.ChainConfig) []ibc.Chain {
t.Helper()
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
{
Name: SedaCfg.Name,
Expand All @@ -120,7 +117,6 @@ func CreateChainsWithCustomConfig(t *testing.T, numVals, numFullNodes int, confi
}

func BuildAllChains(t *testing.T, chains []ibc.Chain) (*interchaintest.Interchain, context.Context, *client.Client, string) {
t.Helper()
ic := interchaintest.NewInterchain()

for _, chain := range chains {
Expand Down

0 comments on commit 53a85cd

Please sign in to comment.