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

Reproduce Juno Halt #7

Merged
merged 10 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ibc-test-framework
Binary file added assets/badcontract.wasm
Binary file not shown.
158 changes: 158 additions & 0 deletions cmd/custom.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
package cmd

import (
"fmt"
"strings"

"github.com/spf13/cobra"
"github.com/strangelove-ventures/ibc-test-framework/ibc"
"golang.org/x/sync/errgroup"
)

// customCmd represents the custom command
var customCmd = &cobra.Command{
Use: "custom",
Short: "Run with custom chain configurations",
Long: `This command allows you to provide all of the possible configuration parameters
for spinning up the source and destination chains
`,
Run: func(cmd *cobra.Command, args []string) {
flags := cmd.Flags()
relayerImplementationString, _ := flags.GetString("relayer")
testCasesString := args[0]

relayerImplementation := parseRelayerImplementation(relayerImplementationString)

srcType, _ := flags.GetString("src-type")
dstType, _ := flags.GetString("dst-type")

// only cosmos chains supported for now
switch srcType {
case "cosmos":
break
default:
panic(fmt.Sprintf("chain type not supported: %s", srcType))
}

switch dstType {
case "cosmos":
break
default:
panic(fmt.Sprintf("chain type not supported: %s", dstType))
}

srcVals, _ := flags.GetInt("src-vals")
dstVals, _ := flags.GetInt("dst-vals")

srcChainID, _ := flags.GetString("src-chain-id")
dstChainID, _ := flags.GetString("dst-chain-id")

srcName, _ := flags.GetString("src-name")
dstName, _ := flags.GetString("dst-name")

srcImage, _ := flags.GetString("src-image")
dstImage, _ := flags.GetString("dst-image")

srcVersion, _ := flags.GetString("src-version")
dstVersion, _ := flags.GetString("dst-version")

srcBinary, _ := flags.GetString("src-binary")
dstBinary, _ := flags.GetString("dst-binary")

srcBech32Prefix, _ := flags.GetString("src-bech32")
dstBech32Prefix, _ := flags.GetString("dst-bech32")

srcDenom, _ := flags.GetString("src-denom")
dstDenom, _ := flags.GetString("dst-denom")

srcGasPrices, _ := flags.GetString("src-gas-prices")
dstGasPrices, _ := flags.GetString("dst-gas-prices")

srcGasAdjustment, _ := flags.GetFloat64("src-gas-adjustment")
dstGasAdjustment, _ := flags.GetFloat64("dst-gas-adjustment")

srcTrustingPeriod, _ := flags.GetString("src-trusting-period")
dstTrustingPeriod, _ := flags.GetString("dst-trusting-period")

parallel, _ := flags.GetBool("parallel")

srcChainCfg := ibc.NewCosmosChainConfig(srcName, srcImage, srcBinary, srcBech32Prefix, srcDenom, srcGasPrices, srcGasAdjustment, srcTrustingPeriod)
dstChainCfg := ibc.NewCosmosChainConfig(dstName, dstImage, dstBinary, dstBech32Prefix, dstDenom, dstGasPrices, dstGasAdjustment, dstTrustingPeriod)

srcChainCfg.ChainID = srcChainID
dstChainCfg.ChainID = dstChainID

srcChainCfg.Version = srcVersion
dstChainCfg.Version = dstVersion

var testCases []func(testName string, srcChain ibc.Chain, dstChain ibc.Chain, relayerImplementation ibc.RelayerImplementation) error

for _, testCaseString := range strings.Split(testCasesString, ",") {
testCase, err := ibc.GetTestCase(testCaseString)
if err != nil {
panic(err)
}
testCases = append(testCases, testCase)
}

if parallel {
var eg errgroup.Group
for i, testCase := range testCases {
testCase := testCase
testName := fmt.Sprintf("Test%d", i)
srcChain := ibc.NewCosmosChain(testName, srcChainCfg, srcVals, 1)
dstChain := ibc.NewCosmosChain(testName, dstChainCfg, dstVals, 1)
eg.Go(func() error {
return testCase(testName, srcChain, dstChain, relayerImplementation)
})
}
if err := eg.Wait(); err != nil {
panic(err)
}
} else {
for i, testCase := range testCases {
testName := fmt.Sprintf("Test%d", i)
srcChain := ibc.NewCosmosChain(testName, srcChainCfg, srcVals, 1)
dstChain := ibc.NewCosmosChain(testName, dstChainCfg, dstVals, 1)
if err := testCase(testName, srcChain, dstChain, relayerImplementation); err != nil {
panic(err)
}
}
}
fmt.Println("PASS")
},
}

func init() {
testCmd.AddCommand(customCmd)

customCmd.Flags().StringP("src-name", "s", "gaia", "Source chain name")
customCmd.Flags().String("src-type", "cosmos", "Type of source chain")
customCmd.Flags().String("src-bech32", "cosmos", "Bech32 prefix for source chain")
customCmd.Flags().String("src-denom", "uatom", "Native denomination for source chain")
customCmd.Flags().String("src-gas-prices", "0.01uatom", "Gas prices for source chain")
customCmd.Flags().Float64("src-gas-adjustment", 1.3, "Gas adjustment for source chain")
customCmd.Flags().String("src-trust", "504h", "Trusting period for source chain ")
customCmd.Flags().String("src-image", "ghcr.io/strangelove-ventures/heighliner/gaia", "Docker image for source chain")
customCmd.Flags().String("src-version", "v7.0.1", "Docker image version for source chain")
customCmd.Flags().String("src-binary", "gaiad", "Binary for source chain")
customCmd.Flags().String("src-chain-id", "srcchain-1", "Chain ID to use for the source chain")
customCmd.Flags().Int("src-vals", 4, "Number of Validator nodes on source chain")

customCmd.Flags().StringP("dst-name", "d", "gaia", "Destination chain name")
customCmd.Flags().String("dst-type", "cosmos", "Type of destination chain")
customCmd.Flags().String("dst-bech32", "cosmos", "Bech32 prefix for destination chain")
customCmd.Flags().String("dst-denom", "uatom", "Native denomination for destination chain")
customCmd.Flags().String("dst-gas-prices", "0.01uatom", "Gas prices for destination chain")
customCmd.Flags().Float64("dst-gas-adjustment", 1.3, "Gas adjustment for destination chain")
customCmd.Flags().String("dst-trust", "504h", "Trusting period for destination chain")
customCmd.Flags().String("dst-image", "ghcr.io/strangelove-ventures/heighliner/gaia", "Docker image for destination chain")
customCmd.Flags().String("dst-version", "v7.0.1", "Docker image version for destination chain")
customCmd.Flags().String("dst-binary", "gaiad", "Binary for destination chain")
customCmd.Flags().String("dst-chain-id", "dstchain-1", "Chain ID to use for the source chain")
customCmd.Flags().Int("dst-vals", 4, "Number of Validator nodes on destination chain")

customCmd.Flags().StringP("relayer", "r", "rly", "Relayer implementation to use (rly or hermes)")
customCmd.Flags().BoolP("parallel", "p", false, "Run tests in parallel")

}
1 change: 0 additions & 1 deletion cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ ibc-test-framework test --src osmosis:v7.0.4 --dst juno:v2.3.0 --relayer rly Rel
ibc-test-framework test -s osmosis:v7.0.4 -d juno:v2.3.0 -r rly RelayPacketTest
`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("IBC Test Framework")
flags := cmd.Flags()
srcChainNameVersion, _ := flags.GetString("src")
dstChainNameVersion, _ := flags.GetString("dst")
Expand Down
13 changes: 7 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/cosmos/cosmos-sdk v0.45.1
github.com/cosmos/ibc-go/v3 v3.0.0
github.com/ory/dockertest v3.3.5+incompatible
github.com/spf13/cobra v1.4.0
github.com/stretchr/testify v1.7.0
github.com/tendermint/tendermint v0.34.14
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
Expand Down Expand Up @@ -54,6 +55,7 @@ require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
Expand Down Expand Up @@ -95,7 +97,6 @@ require (
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/cobra v1.4.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.10.1 // indirect
Expand All @@ -109,12 +110,12 @@ require (
github.com/tendermint/tm-db v0.6.4 // indirect
github.com/zondax/hid v0.9.0 // indirect
go.etcd.io/bbolt v1.3.5 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
Expand Down
21 changes: 14 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,9 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64=
Expand Down Expand Up @@ -833,7 +834,6 @@ github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tL
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk=
github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0=
github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4=
github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
Expand Down Expand Up @@ -969,8 +969,9 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 h1:syTAU9FwmvzEoIYMqcPHOcVm4H3U5u90WsvuYgwpETU=
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -1067,8 +1068,10 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f h1:w6wWR0H+nyVpbSAQbzVEIACVyr/h8l/BEkY6Sokc7Eg=
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -1192,11 +1195,14 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 h1:5hpz5aRr+W1erYCL5JRhSUBJRph7l9XkNveoExlrKYk=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c=
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -1391,8 +1397,9 @@ google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ6
google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0=
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf h1:SVYXkUz2yZS9FWb2Gm8ivSlbNQzL2Z/NpPKE3RG2jWk=
google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
Expand Down
21 changes: 18 additions & 3 deletions ibc/Chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,21 @@ type Chain interface {
// sets up everything needed (validators, gentx, fullnodes, peering, additional accounts) for chain to start from genesis
Start(testName string, ctx context.Context, additionalGenesisWallets []WalletAmount) error

// start a chain with a provided genesis file. Will override validators for first 2/3 of voting power
StartWithGenesisFile(testName string, ctx context.Context, home string, pool *dockertest.Pool, networkID string, genesisFilePath string) error

// export state at specific height
ExportState(ctx context.Context, height int64) (string, error)

// retrieves rpc address that can be reached by other containers in the docker network
GetRPCAddress() string

// retrieves grpc address that can be reached by other containers in the docker network
GetGRPCAddress() string

// get current height
Height() (int64, error)

// creates a test key in the "user" node, (either the first fullnode or the first validator if no fullnodes)
CreateKey(ctx context.Context, keyName string) error

Expand All @@ -62,20 +71,26 @@ type Chain interface {
SendIBCTransfer(ctx context.Context, channelID, keyName string, amount WalletAmount, timeout *IBCTimeout) (string, error)

// takes file path to smart contract and initialization message. returns contract address
InstantiateContract(ctx context.Context, keyName string, amount WalletAmount, fileName, initMessage string) (string, error)
InstantiateContract(ctx context.Context, keyName string, amount WalletAmount, fileName, initMessage string, needsNoAdminFlag bool) (string, error)

// executes a contract transaction with a message using it's address
ExecuteContract(ctx context.Context, keyName string, contractAddress string, message string) error

// dump state of contract at block height
DumpContractState(ctx context.Context, contractAddress string, height int64) (*DumpContractStateResponse, error)

// create balancer pool
CreatePool(ctx context.Context, keyName string, contractAddress string, swapFee float64, exitFee float64, assets []WalletAmount) error

// waits for # of blocks to be produced
WaitForBlocks(number int64) error
// waits for # of blocks to be produced. Returns latest height
WaitForBlocks(number int64) (int64, error)

// fetch balance for a specific account address and denom
GetBalance(ctx context.Context, address string, denom string) (int64, error)

// get the fees in native denom for an amount of spent gas
GetGasFeesInNativeDenom(gasPaid int64) int64

// fetch transaction
GetTransaction(ctx context.Context, txHash string) (*types.TxResponse, error)
}
3 changes: 3 additions & 0 deletions ibc/Relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ type Relayer interface {
// setup channels, connections, and clients
LinkPath(ctx context.Context, pathName string) error

// update clients, such as after new genesis
UpdateClients(ctx context.Context, pathName string) error

// get channel IDs for chain
GetChannels(ctx context.Context, chainID string) ([]ChannelOutput, error)

Expand Down
Loading