Skip to content
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

Added flags to run heimdall as a child process #597

Merged
merged 32 commits into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5eea894
Added flags to run heimdall as a child process
0xKrishna Nov 24, 2022
fc48365
Fix: Lint
0xKrishna Nov 25, 2022
6f3b367
Fix btcd package dependency for CI
0xKrishna Nov 28, 2022
28716b5
Update btcd package version
0xKrishna Nov 29, 2022
1e62a45
Merge branch 'develop' into run-heimdall-flags
0xKrishna Dec 5, 2022
79ca0e5
Try removing ambigious importts
0xKrishna Dec 6, 2022
de08a24
dev: fix: lint fix for parallel tests
marcello33 Dec 6, 2022
54a0d0a
remove delete for ambigious import
0xKrishna Dec 6, 2022
c77a3a0
Merge branch 'develop' into run-heimdall-flags
0xKrishna Dec 6, 2022
ff90276
Remove unwanted space
0xKrishna Dec 6, 2022
e72725e
go mod tidy
JekaMas Dec 6, 2022
114322d
try replace
JekaMas Dec 6, 2022
8d489b1
try replace
JekaMas Dec 6, 2022
e0f9150
use vendor
JekaMas Dec 6, 2022
91df8cf
rename vendor
JekaMas Dec 6, 2022
2aa8544
tidy
JekaMas Dec 6, 2022
f5eae76
vendor btcec
JekaMas Dec 6, 2022
fea93ec
clean up
JekaMas Dec 6, 2022
a969ff8
remove submodule
JekaMas Dec 6, 2022
a9da3d0
remove submodule
JekaMas Dec 6, 2022
b8453a4
remove submodule
JekaMas Dec 6, 2022
e6ac395
remove submodule
JekaMas Dec 6, 2022
419aa59
remove vendor & added replacer in test
0xKrishna Dec 9, 2022
f8ed5d5
go mod tidy
0xKrishna Dec 9, 2022
e5c99a6
added replacer
0xKrishna Dec 9, 2022
789f3c0
Update replacer
0xKrishna Dec 9, 2022
f14476a
Update replacer
0xKrishna Dec 9, 2022
070bff1
Merge branch 'develop' into run-heimdall-flags
0xKrishna Dec 20, 2022
7169942
Merge branch 'develop' into run-heimdall-flags
0xKrishna Dec 20, 2022
5a05ad9
Skip TestGolangBindings
0xKrishna Dec 20, 2022
fe72efe
Typo fix
0xKrishna Dec 20, 2022
35d0ed7
Remove unwanted changes
0xKrishna Dec 20, 2022
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
2 changes: 2 additions & 0 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ The dumpgenesis command dumps the genesis block configuration in JSON format to
utils.HeimdallURLFlag,
utils.WithoutHeimdallFlag,
utils.HeimdallgRPCAddressFlag,
utils.RunHeimdallFlag,
utils.RunHeimdallArgsFlag,
},
Category: "BLOCKCHAIN COMMANDS",
Description: `
Expand Down
18 changes: 18 additions & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
package main

import (
"context"
"fmt"
"os"
"os/signal"
"sort"
"strconv"
"strings"
"syscall"
"time"

"github.com/ethereum/go-ethereum/accounts"
Expand All @@ -44,6 +47,7 @@ import (
_ "github.com/ethereum/go-ethereum/eth/tracers/js"
_ "github.com/ethereum/go-ethereum/eth/tracers/native"

"github.com/maticnetwork/heimdall/cmd/heimdalld/service"
"gopkg.in/urfave/cli.v1"
)

Expand Down Expand Up @@ -347,6 +351,15 @@ func geth(ctx *cli.Context) error {
stack, backend := makeFullNode(ctx)
defer stack.Close()

if ctx.GlobalBool(utils.RunHeimdallFlag.Name) {
shutdownCtx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
defer stop()
0xKrishna marked this conversation as resolved.
Show resolved Hide resolved

go func() {
service.NewHeimdallService(shutdownCtx, getHeimdallArgs(ctx))
}()
}

startNode(ctx, stack, backend, false)
stack.Wait()
JekaMas marked this conversation as resolved.
Show resolved Hide resolved
return nil
Expand Down Expand Up @@ -477,3 +490,8 @@ func unlockAccounts(ctx *cli.Context, stack *node.Node) {
unlockAccount(ks, account, i, passwords)
}
}

func getHeimdallArgs(ctx *cli.Context) []string {
heimdallArgs := strings.Split(ctx.GlobalString(utils.RunHeimdallArgsFlag.Name), ",")
return append([]string{"start"}, heimdallArgs...)
}
16 changes: 16 additions & 0 deletions cmd/utils/bor_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,25 @@ var (
Value: "",
}

// RunHeimdallFlag flag for running heimdall internally from bor
RunHeimdallFlag = cli.BoolFlag{
Name: "bor.runheimdall",
Usage: "Run Heimdall service as a child process",
}

RunHeimdallArgsFlag = cli.StringFlag{
Name: "bor.runheimdallargs",
Usage: "Arguments to pass to Heimdall service",
Value: "",
}

// BorFlags all bor related flags
BorFlags = []cli.Flag{
HeimdallURLFlag,
WithoutHeimdallFlag,
HeimdallgRPCAddressFlag,
RunHeimdallFlag,
RunHeimdallArgsFlag,
}
)

Expand All @@ -66,6 +80,8 @@ func SetBorConfig(ctx *cli.Context, cfg *eth.Config) {
cfg.HeimdallURL = ctx.GlobalString(HeimdallURLFlag.Name)
cfg.WithoutHeimdall = ctx.GlobalBool(WithoutHeimdallFlag.Name)
cfg.HeimdallgRPCAddress = ctx.GlobalString(HeimdallgRPCAddressFlag.Name)
cfg.RunHeimdall = ctx.GlobalBool(RunHeimdallFlag.Name)
cfg.RunHeimdallArgs = ctx.GlobalString(RunHeimdallArgsFlag.Name)
}

// CreateBorEthereum Creates bor ethereum object from eth.Config
Expand Down
2 changes: 2 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2035,6 +2035,8 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
HeimdallURL: ctx.GlobalString(HeimdallURLFlag.Name),
WithoutHeimdall: ctx.GlobalBool(WithoutHeimdallFlag.Name),
HeimdallgRPCAddress: ctx.GlobalString(HeimdallgRPCAddressFlag.Name),
RunHeimdall: ctx.GlobalBool(RunHeimdallFlag.Name),
RunHeimdallArgs: ctx.GlobalString(RunHeimdallArgsFlag.Name),
})
engine = ethereum.Engine()
} else {
Expand Down
6 changes: 6 additions & 0 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ type Config struct {
// Address to connect to Heimdall gRPC server
HeimdallgRPCAddress string

// Run heimdall service as a child process
RunHeimdall bool

// Arguments to pass to heimdall service
RunHeimdallArgs string

// Bor logs flag
BorLogs bool

Expand Down
114 changes: 95 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ require (
github.com/aws/aws-sdk-go-v2/credentials v1.1.1
github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1
github.com/btcsuite/btcd/btcec/v2 v2.1.2
github.com/cespare/cp v0.1.0
github.com/cespare/cp v1.1.1
github.com/cloudflare/cloudflare-go v0.14.0
github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f
github.com/davecgh/go-spew v1.1.1
github.com/deckarep/golang-set v1.8.0
github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf
github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48
github.com/edsrzf/mmap-go v1.0.0
github.com/fatih/color v1.7.0
github.com/fatih/color v1.9.0
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff
github.com/go-stack/stack v1.8.0
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08
github.com/go-stack/stack v1.8.1
github.com/golang-jwt/jwt/v4 v4.3.0
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.4
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa
github.com/google/gofuzz v1.2.0
github.com/google/uuid v1.2.0
github.com/gorilla/websocket v1.4.2
github.com/graph-gophers/graphql-go v1.3.0
Expand All @@ -38,7 +38,7 @@ require (
github.com/hashicorp/hcl/v2 v2.10.1
github.com/holiman/bloomfilter/v2 v2.0.3
github.com/holiman/uint256 v1.2.0
github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204
github.com/huin/goupnp v1.0.3
github.com/imdario/mergo v0.3.11
github.com/influxdata/influxdb v1.8.3
github.com/influxdata/influxdb-client-go/v2 v2.4.0
Expand All @@ -47,50 +47,121 @@ require (
github.com/julienschmidt/httprouter v1.3.0
github.com/karalabe/usb v0.0.2
github.com/maticnetwork/crand v1.0.2
github.com/maticnetwork/heimdall v0.3.0-beta1.0.20221123180730-457028136461
github.com/maticnetwork/polyproto v0.0.2
github.com/mattn/go-colorable v0.1.8
github.com/mattn/go-isatty v0.0.12
github.com/mitchellh/cli v1.1.2
github.com/mitchellh/go-homedir v1.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7
github.com/prometheus/tsdb v0.7.1
github.com/rjeczalik/notify v0.9.1
github.com/peterh/liner v1.2.0
github.com/prometheus/tsdb v0.10.0
github.com/rjeczalik/notify v0.9.2
github.com/rs/cors v1.7.0
github.com/ryanuber/columnize v2.1.2+incompatible
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4
github.com/status-im/keycard-go v0.0.0-20211109104530-b0e0482ba91d
github.com/stretchr/testify v1.8.0
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef
github.com/tyler-smith/go-bip39 v1.1.0
github.com/xsleonard/go-merkle v1.1.0
go.opentelemetry.io/otel v1.2.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.2.0
go.opentelemetry.io/otel/sdk v1.2.0
go.uber.org/goleak v1.1.12
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6
golang.org/x/text v0.3.8
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
golang.org/x/tools v0.1.12
gonum.org/v1/gonum v0.11.0
google.golang.org/grpc v1.48.0
google.golang.org/protobuf v1.28.0
google.golang.org/protobuf v1.28.1
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6
gopkg.in/urfave/cli.v1 v1.20.0
gotest.tools v2.2.0+incompatible
pgregory.net/rapid v0.4.8
)

require (
cloud.google.com/go v0.65.0 // indirect
cloud.google.com/go/pubsub v1.3.1 // indirect
github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae // indirect
github.com/RichardKnop/machinery v1.7.4 // indirect
github.com/RichardKnop/redsync v1.2.0 // indirect
github.com/aws/aws-sdk-go v1.29.15 // indirect
github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/cbergoon/merkletree v0.2.0 // indirect
github.com/cosmos/cosmos-sdk v0.37.4 // indirect
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 // indirect
github.com/cosmos/ledger-cosmos-go v0.10.3 // indirect
github.com/cosmos/ledger-go v0.9.2 // indirect
github.com/etcd-io/bbolt v1.3.3 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-kit/kit v0.10.0 // indirect
github.com/go-redis/redis v6.15.7+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/gomodule/redigo v2.0.0+incompatible // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/kelseyhightower/envconfig v1.4.0 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/libp2p/go-buffer-pool v0.0.2 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rakyll/statik v0.1.7 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/cobra v0.0.5 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.4.0 // indirect
github.com/streadway/amqp v0.0.0-20200108173154-1c71cc93ed71 // indirect
github.com/stumble/gorocksdb v0.0.3 // indirect
github.com/tendermint/btcd v0.1.1 // indirect
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect
github.com/tendermint/go-amino v0.15.0 // indirect
github.com/tendermint/iavl v0.12.4 // indirect
github.com/tendermint/tendermint v0.32.7 // indirect
github.com/tendermint/tm-db v0.2.0 // indirect
github.com/xdg/scram v1.0.3 // indirect
github.com/xdg/stringprep v1.0.3 // indirect
github.com/zondax/hid v0.9.0 // indirect
go.mongodb.org/mongo-driver v1.3.0 // indirect
go.opencensus.io v0.22.6 // indirect
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
google.golang.org/api v0.34.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
)

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 // indirect
github.com/Masterminds/goutils v1.1.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect
github.com/agext/levenshtein v1.2.1 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 // indirect
Expand All @@ -101,27 +172,26 @@ require (
github.com/aws/smithy-go v1.1.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/deepmap/oapi-codegen v1.8.2 // indirect
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.0.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/opentracing/opentracing-go v1.1.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -142,4 +212,10 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/cosmos/cosmos-sdk => github.com/maticnetwork/cosmos-sdk v0.37.5-0.20220311095845-81690c6a53e7

replace github.com/tendermint/tendermint => github.com/maticnetwork/tendermint v0.26.0-dev0.0.20220923185258-3e7c7f86ce9f

replace github.com/ethereum/go-ethereum => github.com/maticnetwork/bor v0.2.18-0.20220922050621-c91d4ca1fa4f

replace github.com/Masterminds/goutils => github.com/Masterminds/goutils v1.1.1
Loading