-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
IBC SDK Integration #5124
Closed
fedekunze
wants to merge
30
commits into
joon/ics-04-implementation
from
fedekunze/ibc-sdk-interface
Closed
IBC SDK Integration #5124
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
608a819
Bump gopkg.in/yaml.v2 from 2.2.2 to 2.2.3 (#5121)
dependabot-preview[bot] e2a3257
Merge commit 'fea2ba628ccd4a374cf7a33b0a10a5099f19bfc6' of https://gi…
fedekunze 60aa995
Merge branch 'joon/ics-04-implementation' of https://github.com/cosmo…
fedekunze d53afec
changes Fede removed by accident on #5057
fedekunze 1e45d0b
Merge PR #5137: IBC Multi-Verifier Cherry Pick
alexanderbez 7ba0b7e
Pass in chain-id properly to second cliCtx
jackzampolin 5719c35
Attempt to fix panic
jackzampolin 9eaa5d7
Explicitly set chain-id before each ctx call
jackzampolin 902cbae
Extra logging
jackzampolin d02becc
Change cliCtx initialization
jackzampolin 8b5e7e6
Fix build failure for cliCtx intitialization
jackzampolin 6e34599
Make sure right txbldr is being used
jackzampolin 1c0ae72
Remove loggin
jackzampolin 24877f8
Fix clictx generation in connection command
jackzampolin c620897
Undefined var error in channel command
jackzampolin 42b3079
Fix chain-id issue
jackzampolin 1addcdf
Fix chain-id issue
jackzampolin a927a7b
Demo working until flush
jackzampolin 59bfb70
cli send/receive debug in progress
mossid b0ad578
fix packet sending
mossid e690291
Update IBC CLI UX
jackzampolin 1a74d7f
Update x/ibc/02-client/msgs.go
jackzampolin 3d5c97e
Update x/ibc/02-client/client/cli/tx.go
jackzampolin cf4cc59
utilize ante for packet verification
mossid 8d74a34
Merge branch 'fedekunze/ibc-sdk-interface' of github.com:cosmos/cosmo…
mossid 11d4258
fix typo
mossid 142a15a
mv port.name string -> port.key *StoreKey
mossid d5159c6
fix next sequence query (#5187)
chengwenxi af28eeb
initialize map in ics-04 Manager type ensuring that demo is working
jackzampolin ee5d7f3
CLI UX for demo
jackzampolin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package context | ||
|
||
import ( | ||
"path/filepath" | ||
|
||
"github.com/pkg/errors" | ||
"github.com/tendermint/tendermint/libs/log" | ||
tmlite "github.com/tendermint/tendermint/lite" | ||
tmliteproxy "github.com/tendermint/tendermint/lite/proxy" | ||
rpcclient "github.com/tendermint/tendermint/rpc/client" | ||
) | ||
|
||
const ( | ||
verifierDir = ".lite_verifier" | ||
|
||
// DefaultVerifierCacheSize defines the default Tendermint cache size. | ||
DefaultVerifierCacheSize = 10 | ||
) | ||
|
||
// CreateVerifier returns a Tendermint verifier from a CLIContext object and | ||
// cache size. An error is returned if the CLIContext is missing required values | ||
// or if the verifier could not be created. A CLIContext must at the very least | ||
// have the chain ID and home directory set. If the CLIContext has TrustNode | ||
// enabled, no verifier will be created. | ||
func CreateVerifier(ctx CLIContext, cacheSize int) (tmlite.Verifier, error) { | ||
if ctx.TrustNode { | ||
return nil, nil | ||
} | ||
|
||
switch { | ||
case ctx.ChainID == "": | ||
return nil, errors.New("must provide a valid chain ID to create verifier") | ||
|
||
case ctx.HomeDir == "": | ||
return nil, errors.New("must provide a valid home directory to create verifier") | ||
|
||
case ctx.Client == nil && ctx.NodeURI == "": | ||
return nil, errors.New("must provide a valid RPC client or RPC URI to create verifier") | ||
} | ||
|
||
// create an RPC client based off of the RPC URI if no RPC client exists | ||
client := ctx.Client | ||
if client == nil { | ||
client = rpcclient.NewHTTP(ctx.NodeURI, "/websocket") | ||
} | ||
|
||
return tmliteproxy.NewVerifier( | ||
ctx.ChainID, filepath.Join(ctx.HomeDir, ctx.ChainID, verifierDir), | ||
client, log.NewNopLogger(), cacheSize, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package context_test | ||
|
||
import ( | ||
"io/ioutil" | ||
"testing" | ||
|
||
"github.com/cosmos/cosmos-sdk/client/context" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestCreateVerifier(t *testing.T) { | ||
tmpDir, err := ioutil.TempDir("", "example") | ||
require.NoError(t, err) | ||
|
||
testCases := []struct { | ||
name string | ||
ctx context.CLIContext | ||
expectErr bool | ||
}{ | ||
{"no chain ID", context.CLIContext{}, true}, | ||
{"no home directory", context.CLIContext{}.WithChainID("test"), true}, | ||
{"no client or RPC URI", context.CLIContext{HomeDir: tmpDir}.WithChainID("test"), true}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
t.Run(tc.name, func(t *testing.T) { | ||
verifier, err := context.CreateVerifier(tc.ctx, context.DefaultVerifierCacheSize) | ||
require.Equal(t, tc.expectErr, err != nil, err) | ||
|
||
if !tc.expectErr { | ||
require.NotNil(t, verifier) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arguements
is a misspelling ofarguments
(frommisspell
)