Skip to content
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
25 changes: 0 additions & 25 deletions .github/workflows/dockerimage.yml

This file was deleted.

67 changes: 6 additions & 61 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,13 @@ tests:

build: clean
mkdir -p build
go build -o build/heimdalld ./cmd/heimdalld
go build -o build/heimdallcli ./cmd/heimdallcli
go build -o build/bridge bridge/bridge.go
mv build/heimdalld build/deliveryd
mv build/heimdallcli build/deliverycli
go build -o build/deliveryd ./cmd/deliveryd
go build -o build/deliverycli ./cmd/deliverycli
@echo "====================================================\n==================Build Successful==================\n===================================================="

install:
go install $(BUILD_FLAGS) ./cmd/heimdalld
go install $(BUILD_FLAGS) ./cmd/heimdallcli
go install $(BUILD_FLAGS) bridge/bridge.go
mv $(GOPATH)/bin/heimdalld $(GOPATH)/bin/deliveryd
mv $(GOPATH)/bin/heimdallcli $(GOPATH)/bin/deliverycli
go install $(BUILD_FLAGS) ./cmd/deliveryd
go install $(BUILD_FLAGS) ./cmd/deliverycli

contracts:
abigen --abi=contracts/rootchain/rootchain.abi --pkg=rootchain --out=contracts/rootchain/rootchain.go
Expand All @@ -50,51 +44,6 @@ contracts:
abigen --abi=contracts/stakinginfo/stakinginfo.abi --pkg=stakinginfo --out=contracts/stakinginfo/stakinginfo.go
abigen --abi=contracts/validatorset/validatorset.abi --pkg=validatorset --out=contracts/validatorset/validatorset.go
abigen --abi=contracts/erc20/erc20.abi --pkg=erc20 --out=contracts/erc20/erc20.go


init-delivery:
./build/deliveryd init

show-account-delivery:
./build/deliveryd show-account

show-node-id:
./build/deliveryd tendermint show-node-id

run-delivery:
./build/deliveryd start

start-delivery:
mkdir -p ./logs &
./build/deliveryd start > ./logs/deliveryd.log &

reset-delivery:
./build/deliveryd unsafe-reset-all
./build/bridge purge-queue
rm -rf ~/.deliveryd/bridge

run-server:
./build/deliveryd rest-server

start-server:
mkdir -p ./logs &
./build/deliveryd rest-server > ./logs/deliveryd-rest-server.log &

start:
mkdir -p ./logs
bash docker/start.sh

run-bridge:
./build/bridge start --all

start-bridge:
mkdir -p logs &
./build/bridge start --all > ./logs/bridge.log &

start-all:
mkdir -p ./logs
bash docker/start-deliveryd.sh

#
# Code quality
#
Expand All @@ -113,13 +62,9 @@ endif
build-docker:
@echo Fetching latest tag: $(LATEST_GIT_TAG)
git checkout $(LATEST_GIT_TAG)
docker build -t "maticnetwork/heimdall:$(LATEST_GIT_TAG)" -f docker/Dockerfile .

push-docker:
@echo Pushing docker tag image: $(LATEST_GIT_TAG)
docker push "maticnetwork/heimdall:$(LATEST_GIT_TAG)"
docker build -t "delivery:$(LATEST_GIT_TAG)" -f docker/Dockerfile .

build-docker-develop:
docker build -t "maticnetwork/heimdall:develop" -f docker/Dockerfile.develop .
docker build -t "delivery:develop" -f docker/Dockerfile.develop .

.PHONY: contracts build
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ $ deliveryd start
$ deliveryd rest-server
```

### Run-bridge
```bash
$ deliveryd bridge
```

7 changes: 0 additions & 7 deletions bridge/bridge.go

This file was deleted.

24 changes: 9 additions & 15 deletions bridge/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cmd

import (
"fmt"
"os"
"path/filepath"

"github.com/spf13/cobra"
Expand All @@ -28,9 +26,13 @@ var rootCmd = &cobra.Command{
},
}

func BridgeCommands() *cobra.Command {
return rootCmd
}

// InitTendermintViperConfig sets global viper configuration needed to heimdall
func InitTendermintViperConfig(cmd *cobra.Command) {
tendermintNode, _ := cmd.Flags().GetString(helper.NodeFlag)
tendermintNode, _ := cmd.Flags().GetString(helper.TendermintNodeFlag)
homeValue, _ := cmd.Flags().GetString(helper.HomeFlag)
withDeliveryConfigValue, _ := cmd.Flags().GetString(helper.WithDeliveryConfigFlag)
bridgeDBValue, _ := cmd.Flags().GetString(bridgeDBFlag)
Expand All @@ -43,7 +45,7 @@ func InitTendermintViperConfig(cmd *cobra.Command) {
}

// set to viper
viper.Set(helper.NodeFlag, tendermintNode)
viper.Set(helper.TendermintNodeFlag, tendermintNode)
viper.Set(helper.HomeFlag, homeValue)
viper.Set(helper.WithDeliveryConfigFlag, withDeliveryConfigValue)
viper.Set(bridgeDBFlag, bridgeDBValue)
Expand All @@ -54,19 +56,11 @@ func InitTendermintViperConfig(cmd *cobra.Command) {
helper.InitDeliveryConfig("")
}

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}

func init() {
var logger = helper.Logger.With("module", "bridge/cmd/")
rootCmd.PersistentFlags().StringP(helper.NodeFlag, "n", "tcp://localhost:26657", "Node to connect to")
rootCmd.PersistentFlags().String(helper.HomeFlag, os.ExpandEnv("$HOME/.deliveryd"), "directory for config and data")

rootCmd.PersistentFlags().StringP(helper.TendermintNodeFlag, "n", helper.DefaultTendermintNode, "Node to connect to")
rootCmd.PersistentFlags().String(helper.HomeFlag, helper.DefaultNodeHome, "directory for config and data")
rootCmd.PersistentFlags().String(
helper.WithDeliveryConfigFlag,
"",
Expand Down
4 changes: 2 additions & 2 deletions bridge/setu/broadcaster/broadcaster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func TestBroadcastToHeimdall(t *testing.T) {
t.Parallel()
cdc := app.MakeCodec()
// cli context
tendermintNode := "tcp://localhost:26657"
viper.Set(helper.NodeFlag, tendermintNode)
tendermintNode := helper.DefaultTendermintNode
viper.Set(helper.TendermintNodeFlag, tendermintNode)
viper.Set("log_level", "info")
// cliCtx := cliContext.NewCLIContext().WithCodec(cdc)
// cliCtx.BroadcastMode = client.BroadcastSync
Expand Down
4 changes: 2 additions & 2 deletions cmd/heimdallcli/main.go → cmd/deliverycli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ var (
)

func initTendermintViperConfig(cmd *cobra.Command) {
tendermintNode, _ := cmd.Flags().GetString(helper.NodeFlag)
tendermintNode, _ := cmd.Flags().GetString(helper.TendermintNodeFlag)
homeValue, _ := cmd.Flags().GetString(helper.HomeFlag)
withDeliveryConfigValue, _ := cmd.Flags().GetString(helper.WithDeliveryConfigFlag)

// set to viper
viper.Set(helper.NodeFlag, tendermintNode)
viper.Set(helper.TendermintNodeFlag, tendermintNode)
viper.Set(helper.HomeFlag, homeValue)
viper.Set(helper.WithDeliveryConfigFlag, withDeliveryConfigValue)

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions cmd/heimdalld/main.go → cmd/deliveryd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (

"github.com/maticnetwork/heimdall/app"
authTypes "github.com/maticnetwork/heimdall/auth/types"
hmbridge "github.com/maticnetwork/heimdall/bridge/cmd"
"github.com/maticnetwork/heimdall/helper"
restServer "github.com/maticnetwork/heimdall/server"
hmTypes "github.com/maticnetwork/heimdall/types"
Expand Down Expand Up @@ -156,6 +157,7 @@ func main() {
rootCmd.AddCommand(showAccountCmd())
rootCmd.AddCommand(showPrivateKeyCmd())
rootCmd.AddCommand(restServer.ServeCommands(cdc, restServer.RegisterRoutes))
rootCmd.AddCommand(hmbridge.BridgeCommands())
rootCmd.AddCommand(VerifyGenesis(ctx, cdc))
rootCmd.AddCommand(initCmd(ctx, cdc))
rootCmd.AddCommand(testnetCmd(ctx, cdc))
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion helper/call_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// Test - to decode signers from checkpoint sigs data
func TestCheckpointsigs(t *testing.T) {
tendermintNode := "tcp://localhost:26657"
viper.Set(NodeFlag, tendermintNode)
viper.Set(TendermintNodeFlag, tendermintNode)
viper.Set("log_level", "info")
InitDeliveryConfig(os.ExpandEnv("$HOME/.deliveryd"))

Expand Down
4 changes: 2 additions & 2 deletions helper/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

const (
NodeFlag = "node"
TendermintNodeFlag = "node"
WithDeliveryConfigFlag = "with-delivery-config"
HomeFlag = "home"
FlagClientHome = "home-client"
Expand Down Expand Up @@ -97,7 +97,7 @@ const (

DefaultBttcChainID string = "15001"

DefaultChain string = "mainnet"
DefaultChain = "mainnet"

secretFilePerm = 0600
)
Expand Down
2 changes: 1 addition & 1 deletion helper/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func TestHeimdallConfig(t *testing.T) {
// cli context
tendermintNode := "tcp://localhost:26657"
viper.Set(NodeFlag, tendermintNode)
viper.Set(TendermintNodeFlag, tendermintNode)
viper.Set("log_level", "info")
// cliCtx := cliContext.NewCLIContext().WithCodec(cdc)
// cliCtx.BroadcastMode = client.BroadcastSync
Expand Down
2 changes: 1 addition & 1 deletion server/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func ServeCommands(cdc *codec.Codec, registerRoutesFn func(*lcd.RestServer)) *co
cmd.Flags().String(client.FlagListenAddr, "tcp://0.0.0.0:1317", "The address for the server to listen on")
cmd.Flags().Bool(client.FlagTrustNode, true, "Trust connected full node (don't verify proofs for responses)")
cmd.Flags().String(client.FlagChainID, "", "The chain ID to connect to")
cmd.Flags().String(client.FlagNode, "tcp://localhost:26657", "Address of the node to connect to")
cmd.Flags().String(client.FlagNode, helper.DefaultTendermintNode, "Address of the node to connect to")
cmd.Flags().Int(client.FlagMaxOpenConnections, 1000, "The number of maximum open connections")

return cmd
Expand Down