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