Skip to content

Commit

Permalink
Fix proto build
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrit committed Apr 1, 2024
1 parent 5ae33cc commit 478cef6
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 28 deletions.
2 changes: 1 addition & 1 deletion integration_tests/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (c *chain) clientContext(nodeURI string, kb *keyring.Keyring, fromName stri
interfaceRegistry := sdkTypes.NewInterfaceRegistry()
interfaceRegistry.RegisterImplementations((*sdk.Msg)(nil),
&stakingtypes.MsgCreateValidator{},
&gravitytypes.MsgDelegateKeys{},
&gravitytypes.MsgDelegateKeys{},
)
interfaceRegistry.RegisterImplementations((*cryptotypes.PubKey)(nil), &secp256k1.PubKey{}, &ed25519.PubKey{})

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"fmt"
"os"

tmtypes "github.com/cometbft/cometbft/types"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
tmtypes "github.com/cometbft/cometbft/types"
)

func getGenDoc(path string) (*tmtypes.GenesisDoc, error) {
Expand Down
8 changes: 4 additions & 4 deletions integration_tests/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import (

"github.com/cosmos/cosmos-sdk/client"

tmcfg "github.com/cometbft/cometbft/config"
tmos "github.com/cometbft/cometbft/libs/os"
"github.com/cometbft/cometbft/p2p"
"github.com/cometbft/cometbft/privval"
sdkcrypto "github.com/cosmos/cosmos-sdk/crypto"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/hd"
Expand All @@ -26,10 +30,6 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/peggyjv/gravity-bridge/module/v4/app"
gravitytypes "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/types"
tmcfg "github.com/cometbft/cometbft/config"
tmos "github.com/cometbft/cometbft/libs/os"
"github.com/cometbft/cometbft/p2p"
"github.com/cometbft/cometbft/privval"
)

type validator struct {
Expand Down
6 changes: 5 additions & 1 deletion module/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ lint:
### Protobuf ###
###############################################################################

protoVer=0.13.1
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

proto-all: proto-format proto-lint proto-gen

proto-format:
Expand All @@ -93,7 +97,7 @@ proto-gen:
@echo "Generating Protobuf files"
# todo: figure out why this old method was failing
# $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen:v0.1 sh ./contrib/local/protocgen.sh
@sh ./contrib/local/protocgen.sh
@$(protoImage) sh ./contrib/local/protocgen.sh

proto-lint:
@$(DOCKER_BUF) lint --error-format=json
Expand Down
10 changes: 5 additions & 5 deletions module/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,8 @@ func NewGravityApp(

app.setupUpgradeHandlers()

app.sm = module.NewSimulationManager(
auth.NewAppModule(appCodec, app.accountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
app.sm = module.NewSimulationManager(
auth.NewAppModule(appCodec, app.accountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
bank.NewAppModule(
appCodec,
app.bankKeeper,
Expand All @@ -592,7 +592,7 @@ func NewGravityApp(
appCodec,
*app.capabilityKeeper,
false,
),
),
gov.NewAppModule(
appCodec,
&app.govKeeper,
Expand Down Expand Up @@ -632,7 +632,7 @@ func NewGravityApp(
evidence.NewAppModule(app.evidenceKeeper),
ibc.NewAppModule(app.ibcKeeper),
params.NewAppModule(app.paramsKeeper),
transferModule,
transferModule,
)

app.sm.RegisterStoreDecoders()
Expand Down Expand Up @@ -730,7 +730,7 @@ func (app *Gravity) ModuleAccountAddressesToNames(moduleAccounts []string) map[s
}

func (app *Gravity) ModuleNames() []string {
return app.mm.ModuleNames()
return app.mm.ModuleNames()
}

// BlockedAddrs returns all the app's module account addresses that are not
Expand Down
2 changes: 1 addition & 1 deletion module/app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func TestAppImportExport(t *testing.T) {

fmt.Printf("exporting genesis...\n")

// Exports all modules
// Exports all modules
appState, err := app.ExportAppStateAndValidators(false, []string{}, app.mm.ModuleNames())
require.NoError(t, err)

Expand Down
8 changes: 8 additions & 0 deletions module/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
plugins:
- name: gocosmos
out: .
opt: plugins=interfacetype+grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types
- name: grpc-gateway
out: .
opt: logtostderr=true,allow_colon_final_segments=true
3 changes: 3 additions & 0 deletions module/buf.work.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version: v1
directories:
- proto
2 changes: 1 addition & 1 deletion module/cmd/gravity/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func (a appCreator) appExport(
forZeroHeight bool,
jailAllowedAddrs []string,
appOpts servertypes.AppOptions,
modulesToExport []string,
modulesToExport []string,
) (servertypes.ExportedApp, error) {

var gravity *app.Gravity
Expand Down
2 changes: 1 addition & 1 deletion module/cmd/gravity/cmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
flagOutputDir = "output-dir"
flagNodeDaemonHome = "node-daemon-home"
flagStartingIPAddress = "starting-ip-address"
flagKeyAlgorithm = "key-algorithm"
flagKeyAlgorithm = "key-algorithm"
)

// get cmd to initialize all files for tendermint testnet and application
Expand Down
7 changes: 3 additions & 4 deletions module/contrib/local/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

set -eo pipefail

ROOT=$(git rev-parse --show-toplevel 2>/dev/null)

cd $ROOT/module/proto
echo "generating proto and gRPC gateway files..."
buf generate --template buf.gen.gogo.yaml
cd proto
buf mod update
cd ..
buf generate

# move proto files to the right places
xpath=$(head -n 1 go.mod | sed 's/^module //')
Expand Down
2 changes: 1 addition & 1 deletion module/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
github.com/cosmos/gogoproto v1.4.11
github.com/cosmos/ibc-go/v7 v7.3.2
github.com/ethereum/go-ethereum v1.10.22
github.com/gogo/protobuf v1.3.2
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/pkg/errors v0.9.1
Expand Down Expand Up @@ -90,6 +89,7 @@ require (
github.com/go-stack/stack v1.8.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion module/x/gravity/migrations/v1/types/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package types

import (
tmbytes "github.com/cometbft/cometbft/libs/bytes"
"github.com/ethereum/go-ethereum/common"
"github.com/cosmos/gogoproto/proto"
"github.com/ethereum/go-ethereum/common"
)

// EthereumTxConfirmation represents one validtors signature for a given
Expand Down
2 changes: 1 addition & 1 deletion module/x/gravity/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion module/x/gravity/types/gravity.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion module/x/gravity/types/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package types

import (
tmbytes "github.com/cometbft/cometbft/libs/bytes"
"github.com/ethereum/go-ethereum/common"
"github.com/cosmos/gogoproto/proto"
"github.com/ethereum/go-ethereum/common"
)

// EthereumTxConfirmation represents one validtors signature for a given
Expand Down
4 changes: 2 additions & 2 deletions module/x/gravity/types/msgs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions module/x/gravity/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 478cef6

Please sign in to comment.