mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
dev: Provide Heimdall URL as flag instead of in genesis (#46)
This commit is contained in:
parent
7ade6115db
commit
4401581ef1
10 changed files with 33 additions and 10 deletions
|
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/maticnetwork/bor/cmd/utils"
|
||||
"github.com/maticnetwork/bor/dashboard"
|
||||
"github.com/maticnetwork/bor/eth"
|
||||
"github.com/maticnetwork/bor/log"
|
||||
"github.com/maticnetwork/bor/node"
|
||||
"github.com/maticnetwork/bor/params"
|
||||
whisper "github.com/maticnetwork/bor/whisper/whisperv6"
|
||||
|
|
@ -150,6 +151,8 @@ func enableWhisper(ctx *cli.Context) bool {
|
|||
|
||||
func makeFullNode(ctx *cli.Context) *node.Node {
|
||||
stack, cfg := makeConfigNode(ctx)
|
||||
cfg.Eth.HeimdallURL = ctx.String(utils.HeimdallURLFlag.Name)
|
||||
log.Info("Connecting to heimdall service on...", "heimdallURL", cfg.Eth.HeimdallURL)
|
||||
utils.RegisterEthService(stack, &cfg.Eth)
|
||||
|
||||
if ctx.GlobalBool(utils.DashboardEnabledFlag.Name) {
|
||||
|
|
|
|||
|
|
@ -190,6 +190,10 @@ var (
|
|||
utils.MetricsInfluxDBPasswordFlag,
|
||||
utils.MetricsInfluxDBTagsFlag,
|
||||
}
|
||||
|
||||
borFlags = []cli.Flag{
|
||||
utils.HeimdallURLFlag,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
@ -233,6 +237,7 @@ func init() {
|
|||
app.Flags = append(app.Flags, debug.Flags...)
|
||||
app.Flags = append(app.Flags, whisperFlags...)
|
||||
app.Flags = append(app.Flags, metricsFlags...)
|
||||
app.Flags = append(app.Flags, borFlags...)
|
||||
|
||||
app.Before = func(ctx *cli.Context) error {
|
||||
logdir := ""
|
||||
|
|
|
|||
|
|
@ -246,6 +246,10 @@ var AppHelpFlagGroups = []flagGroup{
|
|||
Name: "METRICS AND STATS",
|
||||
Flags: metricsFlags,
|
||||
},
|
||||
{
|
||||
Name: "BOR",
|
||||
Flags: borFlags,
|
||||
},
|
||||
{
|
||||
Name: "WHISPER (EXPERIMENTAL)",
|
||||
Flags: whisperFlags,
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ func (w *wizard) makeGenesis() {
|
|||
Sprint: 60,
|
||||
ValidatorContract: "0x0000000000000000000000000000000000001000",
|
||||
StateReceiverContract: "0x0000000000000000000000000000000000001001",
|
||||
Heimdall: "http://localhost:1317",
|
||||
}
|
||||
|
||||
// We also need the initial list of signers
|
||||
|
|
|
|||
|
|
@ -741,6 +741,13 @@ var (
|
|||
Usage: "External EVM configuration (default = built-in interpreter)",
|
||||
Value: "",
|
||||
}
|
||||
|
||||
// Bor Specific flags
|
||||
HeimdallURLFlag = cli.StringFlag{
|
||||
Name: "heimdall",
|
||||
Usage: "URL of Heimdall service",
|
||||
Value: "http://localhost:1317",
|
||||
}
|
||||
)
|
||||
|
||||
// MakeDataDir retrieves the currently requested data directory, terminating
|
||||
|
|
@ -1161,7 +1168,6 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
|
|||
setNodeUserIdent(ctx, cfg)
|
||||
setDataDir(ctx, cfg)
|
||||
setSmartCard(ctx, cfg)
|
||||
|
||||
if ctx.GlobalIsSet(ExternalSignerFlag.Name) {
|
||||
cfg.ExternalSigner = ctx.GlobalString(ExternalSignerFlag.Name)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,6 +257,7 @@ func New(
|
|||
chainConfig *params.ChainConfig,
|
||||
db ethdb.Database,
|
||||
ethAPI *ethapi.PublicBlockChainAPI,
|
||||
heimdallURL string,
|
||||
) *Bor {
|
||||
// get bor config
|
||||
borConfig := chainConfig.Bor
|
||||
|
|
@ -271,7 +272,7 @@ func New(
|
|||
signatures, _ := lru.NewARC(inmemorySignatures)
|
||||
vABI, _ := abi.JSON(strings.NewReader(validatorsetABI))
|
||||
sABI, _ := abi.JSON(strings.NewReader(stateReceiverABI))
|
||||
heimdallClient, _ := NewHeimdallClient(chainConfig.Bor.Heimdall)
|
||||
heimdallClient, _ := NewHeimdallClient(heimdallURL)
|
||||
|
||||
c := &Bor{
|
||||
chainConfig: chainConfig,
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@
|
|||
"producerDelay": 4,
|
||||
"sprint": 1,
|
||||
"validatorContract": "0x0000000000000000000000000000000000001000",
|
||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
||||
"heimdall": "http://localhost:1317"
|
||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001"
|
||||
}
|
||||
},
|
||||
"nonce": "0x0",
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
|
|||
}
|
||||
eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams)
|
||||
ethAPI := ethapi.NewPublicBlockChainAPI(eth.APIBackend)
|
||||
eth.engine = CreateConsensusEngine(ctx, chainConfig, &config.Ethash, config.Miner.Notify, config.Miner.Noverify, chainDb, ethAPI)
|
||||
eth.engine = CreateConsensusEngine(ctx, chainConfig, config, chainDb, ethAPI)
|
||||
|
||||
bcVersion := rawdb.ReadDatabaseVersion(chainDb)
|
||||
var dbVer = "<nil>"
|
||||
|
|
@ -252,8 +252,12 @@ func makeExtraData(extra []byte) []byte {
|
|||
return extra
|
||||
}
|
||||
|
||||
// CreateConsensusEngine creates the required type of consensus engine instance for an Ethereum service
|
||||
func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainConfig, config *ethash.Config, notify []string, noverify bool, db ethdb.Database, ee *ethapi.PublicBlockChainAPI) consensus.Engine {
|
||||
// func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainConfig, config *ethash.Config, notify []string, noverify bool, db ethdb.Database, ee *ethapi.PublicBlockChainAPI) consensus.Engine {
|
||||
func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainConfig, ethConfig *Config, db ethdb.Database, ee *ethapi.PublicBlockChainAPI) consensus.Engine {
|
||||
config := ðConfig.Ethash
|
||||
notify := ethConfig.Miner.Notify
|
||||
noverify := ethConfig.Miner.Noverify
|
||||
|
||||
// If proof-of-authority is requested, set it up
|
||||
if chainConfig.Clique != nil {
|
||||
return clique.New(chainConfig.Clique, db)
|
||||
|
|
@ -261,7 +265,7 @@ func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainCo
|
|||
|
||||
// If Matic Bor is requested, set it up
|
||||
if chainConfig.Bor != nil {
|
||||
return bor.New(chainConfig, db, ee)
|
||||
return bor.New(chainConfig, db, ee, ethConfig.HeimdallURL)
|
||||
}
|
||||
|
||||
// Otherwise assume proof-of-work
|
||||
|
|
|
|||
|
|
@ -154,4 +154,7 @@ type Config struct {
|
|||
|
||||
// CheckpointOracle is the configuration for checkpoint oracle.
|
||||
CheckpointOracle *params.CheckpointOracleConfig
|
||||
|
||||
// URL to connect to Heimdall node
|
||||
HeimdallURL string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -321,7 +321,6 @@ type BorConfig struct {
|
|||
Sprint uint64 `json:"sprint"` // Epoch length to proposer
|
||||
ValidatorContract string `json:"validatorContract"` // Validator set contract
|
||||
StateReceiverContract string `json:"stateReceiverContract"` // State receiver contract
|
||||
Heimdall string `json:"heimdall"` // heimdall light client url
|
||||
}
|
||||
|
||||
// String implements the stringer interface, returning the consensus engine details.
|
||||
|
|
|
|||
Loading…
Reference in a new issue