Skip to content

Commit

Permalink
updating makefile.
Browse files Browse the repository at this point in the history
  • Loading branch information
ranlavanet committed Aug 10, 2023
1 parent 0925a18 commit c3072f0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ $(call makedep,build install,lava-protocol,BUILD_SOURCE=./protocol)

build-%: BUILD_ARGS=-o $(BUILDDIR)/
build-% install-%: $(BUILDDIR)/
@mv $(GOPATH)/bin/lava-protocol $(GOPATH)/bin/protocol 2>/dev/null || true
go $(call prefix,-,$@) -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) $(BUILD_SOURCE)
@mv $(GOPATH)/bin/protocol $(GOPATH)/bin/lava-protocol 2>/dev/null || true

# dummy rule to prevent the above wildcard from catching {build,install}-all
$(call makedep,build install,all,)
Expand Down
18 changes: 18 additions & 0 deletions protocol/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
_ "net/http/pprof"
"os"

Expand All @@ -12,6 +13,7 @@ import (
"github.com/lavanet/lava/protocol/rpcconsumer"
"github.com/lavanet/lava/protocol/rpcprovider"
"github.com/lavanet/lava/protocol/statetracker"
"github.com/lavanet/lava/protocol/upgrade"
"github.com/spf13/cobra"
)

Expand All @@ -23,13 +25,17 @@ const (
func main() {
rootCmd := cmd.NewLavaProtocolRootCmd()

// version cobra command
cmdVersion := versionCommand()
// rpc consumer cobra command
cmdRPCConsumer := rpcconsumer.CreateRPCConsumerCobraCommand()
// rpc provider cobra command
cmdRPCProvider := rpcprovider.CreateRPCProviderCobraCommand()
// badge generator cobra command
badgeGenerator := badgegenerator.CreateBadgeGeneratorCobraCommand()

// Add Version Command
rootCmd.AddCommand(cmdVersion)
// Add RPC Consumer Command
rootCmd.AddCommand(cmdRPCConsumer)
// Add RPC Provider Command
Expand All @@ -56,3 +62,15 @@ func main() {
}
}
}

func versionCommand() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Print the version number",
Run: func(cmd *cobra.Command, args []string) {
// Print the lava-protocol version
version := upgrade.GetCurrentVersion()
fmt.Println(version.ProviderVersion) // currently we have only one version.
},
}
}
4 changes: 4 additions & 0 deletions protocol/upgrade/protocol_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ var lavaProtocolVersion = ProtocolVersion{
ProviderVersion: "0.21.0",
}

func GetCurrentVersion() ProtocolVersion {
return lavaProtocolVersion
}

func ValidateProtocolVersion(incoming *protocoltypes.Version) error {
// check min version
if incoming.ConsumerMin != lavaProtocolVersion.ConsumerVersion || incoming.ProviderMin != lavaProtocolVersion.ProviderVersion {
Expand Down
2 changes: 1 addition & 1 deletion scripts/init_chain.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# make install-lavad
# make install-all
killall -9 lavad
rm -rf ~/.lava
lavad init validator --chain-id lava
Expand Down
12 changes: 6 additions & 6 deletions scripts/start_env_dev.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

if [ -n "$1" ]; then
killall lava-protocol
make install-lavad-protocol
ignite chain build; lavad start
killall lavad lava-protocol
make install-all
lavad start 2>&1 | grep -e "- address:" | grep -e lava_ | grep -e ERR_
else
echo "dont use this script with vscode debugger"
killall lava-protocol
make install-lavad-protocol
ignite chain serve -v -r 2>&1 | grep -e lava_ -e ERR_ -e IGNITE] -e !
killall lavad lava-protocol
make install-all
./scripts/init_chain.sh 2>&1 | grep -e "- address:" | grep -e lava_ | grep -e ERR_
fi

0 comments on commit c3072f0

Please sign in to comment.