Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
feat(operator): enabled generic byte keys in operator (#112)
Browse files Browse the repository at this point in the history
* refactor(e2e): simplified code

* feat: added the feature

* refactor: removed some unneeded panics

* fix: misbehavior always generating fixtures

* feat: improved the feature

* feat: using jimterchaintest

* e2e: finished tests

* fix: e2e

* imp: updated genesis

* deps: removed jimterchaintest

* fix: non-build

* imp: updated genesis
  • Loading branch information
srdtrk authored Oct 10, 2024
1 parent c5c7aa3 commit 35b504c
Show file tree
Hide file tree
Showing 13 changed files with 189 additions and 160 deletions.
4 changes: 2 additions & 2 deletions contracts/script/genesis.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"trustedClientState": "00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000012754500000000000000000000000000000000000000000000000000000000001baf800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000673696d642d310000000000000000000000000000000000000000000000000000",
"trustedConsensusState": "0000000000000000000000000000000000000000000000000000000066fe705324693c5a7fc5c2e95d6b3e04ef6de62c866d0e6de27be6e789562fe9a2fc17d9c7a8f09141501bbc11fb7adb76f5e62126d7b7ab2a7c2b4394d0e1d5898297f7",
"trustedClientState": "00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000012754500000000000000000000000000000000000000000000000000000000001baf800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000673696d642d310000000000000000000000000000000000000000000000000000",
"trustedConsensusState": "0000000000000000000000000000000000000000000000000000000067071b41907ef591dea0b3d89e58af160a0bc8dbf47a961e4b8787acd5a776c2b24b911b97967645bdbe23b07071a81e9ff67163627a0821646915775e0cef745055ae3d",
"updateClientVkey": "0x00e983655058fc0461baa611927cc87955f8288c751b0d22c7ffabf18ff1c664",
"membershipVkey": "0x005029538c1c955aa2a20ff5c6ff4d998ad80df927ab1a4d5a49099c100b131a",
"ucAndMembershipVkey": "0x0023a5ccbeb5dcf75387531b19b91615393f231f111cae6c8a4ab6401ae5b180",
Expand Down
23 changes: 23 additions & 0 deletions e2e/interchaintestv8/e2esuite/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
msgv1 "cosmossdk.io/api/cosmos/msg/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"

abci "github.com/cometbft/cometbft/abci/types"

"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
)

Expand Down Expand Up @@ -40,6 +42,27 @@ func populateQueryReqToPath(ctx context.Context, chain *cosmos.CosmosChain) erro
return nil
}

func ABCIQuery(ctx context.Context, chain *cosmos.CosmosChain, req *abci.RequestQuery) (*abci.ResponseQuery, error) {
// Create a connection to the gRPC server.
grpcConn, err := grpc.Dial(
chain.GetHostGRPCAddress(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
return &abci.ResponseQuery{}, err
}

defer grpcConn.Close()

resp := &abci.ResponseQuery{}
err = grpcConn.Invoke(ctx, "cosmos.base.tendermint.v1beta1.Service/ABCIQuery", req, resp)
if err != nil {
return &abci.ResponseQuery{}, err
}

return resp, nil
}

// Queries the chain with a query request and deserializes the response to T
func GRPCQuery[T any](ctx context.Context, chain *cosmos.CosmosChain, req proto.Message, opts ...grpc.CallOption) (*T, error) {
path, ok := queryReqToPath[proto.MessageName(req)]
Expand Down
10 changes: 3 additions & 7 deletions e2e/interchaintestv8/e2esuite/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/cometbft/cometbft/crypto/ed25519"
"github.com/cometbft/cometbft/crypto/tmhash"
cometproto "github.com/cometbft/cometbft/proto/tendermint/types"
comettypes "github.com/cometbft/cometbft/types"
comettime "github.com/cometbft/cometbft/types/time"

tmclient "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v8/testing"
ibcmocks "github.com/cosmos/ibc-go/v8/testing/mock"

"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v8/chain/ethereum"
Expand Down Expand Up @@ -174,11 +173,8 @@ func (s *TestSuite) CreateTMClientHeader(
decodedKeyBz, err := base64.StdEncoding.DecodeString(privValidatorKeyFile.PrivKey.Value)
s.Require().NoError(err)

privKey := &ed25519.PrivKey{
Key: decodedKeyBz,
}

privVal := ibcmocks.PV{PrivKey: privKey}
privKey := ed25519.PrivKey(decodedKeyBz)
privVal := comettypes.NewMockPVWithParams(privKey, false, false)
privVals = append(privVals, privVal)

pubKey, err := privVal.GetPubKey()
Expand Down
12 changes: 5 additions & 7 deletions e2e/interchaintestv8/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ toolchain go1.22.3

require (
cosmossdk.io/api v0.7.5
cosmossdk.io/collections v0.4.0
cosmossdk.io/math v1.3.0
cosmossdk.io/x/tx v0.13.3
cosmossdk.io/x/upgrade v0.1.3
github.com/CosmWasm/wasmd v0.50.0
github.com/cometbft/cometbft v0.38.10
github.com/cosmos/cosmos-sdk v0.50.8
github.com/cosmos/gogoproto v1.5.0
github.com/cosmos/ibc-go/v8 v8.4.0
Expand All @@ -24,20 +26,18 @@ require (

require (
cloud.google.com/go v0.112.1 // indirect
cloud.google.com/go/compute v1.25.1 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/storage v1.38.0 // indirect
cosmossdk.io/client/v2 v2.0.0-beta.1 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/core v0.11.0 // indirect
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
cosmossdk.io/errors v1.0.1 // indirect
cosmossdk.io/log v1.3.1 // indirect
cosmossdk.io/store v1.1.0 // indirect
cosmossdk.io/x/circuit v0.1.0 // indirect
cosmossdk.io/x/evidence v0.1.0 // indirect
cosmossdk.io/x/feegrant v0.1.0 // indirect
cosmossdk.io/x/circuit v0.1.1 // indirect
cosmossdk.io/x/evidence v0.1.1 // indirect
cosmossdk.io/x/feegrant v0.1.1 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2 // indirect
Expand Down Expand Up @@ -71,7 +71,6 @@ require (
github.com/cockroachdb/pebble v1.1.1 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft v0.38.10 // indirect
github.com/cometbft/cometbft-db v0.10.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
Expand Down Expand Up @@ -258,7 +257,6 @@ require (
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.22.0 // indirect
google.golang.org/api v0.169.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
Expand Down
Loading

0 comments on commit 35b504c

Please sign in to comment.