mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Heimdall App implementation (#646)
This commit is contained in:
parent
4c68a7c6a1
commit
39b37b6f5c
16 changed files with 347 additions and 89 deletions
|
|
@ -111,6 +111,7 @@ The dumpgenesis command dumps the genesis block configuration in JSON format to
|
|||
utils.HeimdallgRPCAddressFlag,
|
||||
utils.RunHeimdallFlag,
|
||||
utils.RunHeimdallArgsFlag,
|
||||
utils.UseHeimdallAppFlag,
|
||||
},
|
||||
Category: "BLOCKCHAIN COMMANDS",
|
||||
Description: `
|
||||
|
|
|
|||
|
|
@ -347,10 +347,6 @@ func geth(ctx *cli.Context) error {
|
|||
return fmt.Errorf("invalid command: %q", args[0])
|
||||
}
|
||||
|
||||
prepare(ctx)
|
||||
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()
|
||||
|
|
@ -360,6 +356,10 @@ func geth(ctx *cli.Context) error {
|
|||
}()
|
||||
}
|
||||
|
||||
prepare(ctx)
|
||||
stack, backend := makeFullNode(ctx)
|
||||
defer stack.Close()
|
||||
|
||||
startNode(ctx, stack, backend, false)
|
||||
stack.Wait()
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -50,6 +50,12 @@ var (
|
|||
Value: "",
|
||||
}
|
||||
|
||||
// UseHeimdallApp flag for using internall heimdall app to fetch data
|
||||
UseHeimdallAppFlag = cli.BoolFlag{
|
||||
Name: "bor.useheimdallapp",
|
||||
Usage: "Use child heimdall process to fetch data, Only works when bor.runheimdall is true",
|
||||
}
|
||||
|
||||
// BorFlags all bor related flags
|
||||
BorFlags = []cli.Flag{
|
||||
HeimdallURLFlag,
|
||||
|
|
@ -57,6 +63,7 @@ var (
|
|||
HeimdallgRPCAddressFlag,
|
||||
RunHeimdallFlag,
|
||||
RunHeimdallArgsFlag,
|
||||
UseHeimdallAppFlag,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -82,6 +89,7 @@ func SetBorConfig(ctx *cli.Context, cfg *eth.Config) {
|
|||
cfg.HeimdallgRPCAddress = ctx.GlobalString(HeimdallgRPCAddressFlag.Name)
|
||||
cfg.RunHeimdall = ctx.GlobalBool(RunHeimdallFlag.Name)
|
||||
cfg.RunHeimdallArgs = ctx.GlobalString(RunHeimdallArgsFlag.Name)
|
||||
cfg.UseHeimdallApp = ctx.GlobalBool(UseHeimdallAppFlag.Name)
|
||||
}
|
||||
|
||||
// CreateBorEthereum Creates bor ethereum object from eth.Config
|
||||
|
|
|
|||
|
|
@ -2037,6 +2037,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
|
|||
HeimdallgRPCAddress: ctx.GlobalString(HeimdallgRPCAddressFlag.Name),
|
||||
RunHeimdall: ctx.GlobalBool(RunHeimdallFlag.Name),
|
||||
RunHeimdallArgs: ctx.GlobalString(RunHeimdallArgsFlag.Name),
|
||||
UseHeimdallApp: ctx.GlobalBool(UseHeimdallAppFlag.Name),
|
||||
})
|
||||
engine = ethereum.Engine()
|
||||
} else {
|
||||
|
|
|
|||
52
consensus/bor/heimdallapp/checkpoint.go
Normal file
52
consensus/bor/heimdallapp/checkpoint.go
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package heimdallapp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math/big"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
|
||||
hmTypes "github.com/maticnetwork/heimdall/types"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func (h *HeimdallAppClient) FetchCheckpointCount(_ context.Context) (int64, error) {
|
||||
log.Info("Fetching checkpoint count")
|
||||
|
||||
res := h.hApp.CheckpointKeeper.GetACKCount(h.NewContext())
|
||||
|
||||
log.Info("Fetched checkpoint count")
|
||||
|
||||
return int64(res), nil
|
||||
}
|
||||
|
||||
func (h *HeimdallAppClient) FetchCheckpoint(_ context.Context, number int64) (*checkpoint.Checkpoint, error) {
|
||||
log.Info("Fetching checkpoint", "number", number)
|
||||
|
||||
res, err := h.hApp.CheckpointKeeper.GetCheckpointByNumber(h.NewContext(), uint64(number))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Info("Fetched checkpoint", "number", number)
|
||||
|
||||
return toBorCheckpoint(res), nil
|
||||
}
|
||||
|
||||
func (h *HeimdallAppClient) NewContext() types.Context {
|
||||
return h.hApp.NewContext(true, abci.Header{Height: h.hApp.LastBlockHeight()})
|
||||
}
|
||||
|
||||
func toBorCheckpoint(hdCheckpoint hmTypes.Checkpoint) *checkpoint.Checkpoint {
|
||||
return &checkpoint.Checkpoint{
|
||||
Proposer: hdCheckpoint.Proposer.EthAddress(),
|
||||
StartBlock: big.NewInt(int64(hdCheckpoint.StartBlock)),
|
||||
EndBlock: big.NewInt(int64(hdCheckpoint.EndBlock)),
|
||||
RootHash: hdCheckpoint.RootHash.EthHash(),
|
||||
BorChainID: hdCheckpoint.BorChainID,
|
||||
Timestamp: hdCheckpoint.TimeStamp,
|
||||
}
|
||||
}
|
||||
27
consensus/bor/heimdallapp/client.go
Normal file
27
consensus/bor/heimdallapp/client.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package heimdallapp
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
|
||||
"github.com/maticnetwork/heimdall/app"
|
||||
"github.com/maticnetwork/heimdall/cmd/heimdalld/service"
|
||||
)
|
||||
|
||||
const (
|
||||
stateFetchLimit = 50
|
||||
)
|
||||
|
||||
type HeimdallAppClient struct {
|
||||
hApp *app.HeimdallApp
|
||||
}
|
||||
|
||||
func NewHeimdallAppClient() *HeimdallAppClient {
|
||||
return &HeimdallAppClient{
|
||||
hApp: service.GetHeimdallApp(),
|
||||
}
|
||||
}
|
||||
|
||||
func (h *HeimdallAppClient) Close() {
|
||||
// Nothing to close as of now
|
||||
log.Warn("Shutdown detected, Closing Heimdall App conn")
|
||||
}
|
||||
86
consensus/bor/heimdallapp/span.go
Normal file
86
consensus/bor/heimdallapp/span.go
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
package heimdallapp
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
hmTypes "github.com/maticnetwork/heimdall/types"
|
||||
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdall/span"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/valset"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
)
|
||||
|
||||
func (h *HeimdallAppClient) Span(ctx context.Context, spanID uint64) (*span.HeimdallSpan, error) {
|
||||
log.Info("Fetching span", "spanID", spanID)
|
||||
|
||||
res, err := h.hApp.BorKeeper.GetSpan(h.NewContext(), spanID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Info("Fetched span", "spanID", spanID)
|
||||
|
||||
return toSpan(res), nil
|
||||
}
|
||||
|
||||
func toSpan(hdSpan *hmTypes.Span) *span.HeimdallSpan {
|
||||
return &span.HeimdallSpan{
|
||||
Span: span.Span{
|
||||
ID: hdSpan.ID,
|
||||
StartBlock: hdSpan.StartBlock,
|
||||
EndBlock: hdSpan.EndBlock,
|
||||
},
|
||||
ValidatorSet: toValidatorSet(hdSpan.ValidatorSet),
|
||||
SelectedProducers: toValidators(hdSpan.SelectedProducers),
|
||||
ChainID: hdSpan.ChainID,
|
||||
}
|
||||
}
|
||||
|
||||
func toValidatorSet(vs hmTypes.ValidatorSet) valset.ValidatorSet {
|
||||
return valset.ValidatorSet{
|
||||
Validators: toValidatorsRef(vs.Validators),
|
||||
Proposer: toValidatorRef(vs.Proposer),
|
||||
}
|
||||
}
|
||||
|
||||
func toValidators(vs []hmTypes.Validator) []valset.Validator {
|
||||
newVS := make([]valset.Validator, len(vs))
|
||||
|
||||
for i, v := range vs {
|
||||
newVS[i] = toValidator(v)
|
||||
}
|
||||
|
||||
return newVS
|
||||
}
|
||||
|
||||
func toValidatorsRef(vs []*hmTypes.Validator) []*valset.Validator {
|
||||
newVS := make([]*valset.Validator, len(vs))
|
||||
|
||||
for i, v := range vs {
|
||||
if v == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
newVS[i] = toValidatorRef(v)
|
||||
}
|
||||
|
||||
return newVS
|
||||
}
|
||||
|
||||
func toValidatorRef(v *hmTypes.Validator) *valset.Validator {
|
||||
return &valset.Validator{
|
||||
ID: v.ID.Uint64(),
|
||||
Address: v.Signer.EthAddress(),
|
||||
VotingPower: v.VotingPower,
|
||||
ProposerPriority: v.ProposerPriority,
|
||||
}
|
||||
}
|
||||
|
||||
func toValidator(v hmTypes.Validator) valset.Validator {
|
||||
return valset.Validator{
|
||||
ID: v.ID.Uint64(),
|
||||
Address: v.Signer.EthAddress(),
|
||||
VotingPower: v.VotingPower,
|
||||
ProposerPriority: v.ProposerPriority,
|
||||
}
|
||||
}
|
||||
64
consensus/bor/heimdallapp/state_sync.go
Normal file
64
consensus/bor/heimdallapp/state_sync.go
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
package heimdallapp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/maticnetwork/heimdall/clerk/types"
|
||||
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/clerk"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func (h *HeimdallAppClient) StateSyncEvents(ctx context.Context, fromID uint64, to int64) ([]*clerk.EventRecordWithTime, error) {
|
||||
totalRecords := make([]*clerk.EventRecordWithTime, 0)
|
||||
|
||||
hCtx := h.hApp.NewContext(true, abci.Header{Height: h.hApp.LastBlockHeight()})
|
||||
|
||||
for {
|
||||
fromRecord, err := h.hApp.ClerkKeeper.GetEventRecord(hCtx, fromID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
events, err := h.hApp.ClerkKeeper.GetEventRecordListWithTime(hCtx, fromRecord.RecordTime, time.Unix(to, 0), 1, stateFetchLimit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
totalRecords = append(totalRecords, toEvents(events)...)
|
||||
|
||||
if len(events) < stateFetchLimit {
|
||||
break
|
||||
}
|
||||
|
||||
fromID += uint64(stateFetchLimit)
|
||||
}
|
||||
|
||||
return totalRecords, nil
|
||||
}
|
||||
|
||||
func toEvents(hdEvents []types.EventRecord) []*clerk.EventRecordWithTime {
|
||||
events := make([]*clerk.EventRecordWithTime, len(hdEvents))
|
||||
|
||||
for i, ev := range hdEvents {
|
||||
events[i] = toEvent(ev)
|
||||
}
|
||||
|
||||
return events
|
||||
}
|
||||
|
||||
func toEvent(hdEvent types.EventRecord) *clerk.EventRecordWithTime {
|
||||
return &clerk.EventRecordWithTime{
|
||||
EventRecord: clerk.EventRecord{
|
||||
ID: hdEvent.ID,
|
||||
Contract: hdEvent.Contract.EthAddress(),
|
||||
Data: hdEvent.Data.Bytes(),
|
||||
TxHash: hdEvent.TxHash.EthHash(),
|
||||
LogIndex: hdEvent.LogIndex,
|
||||
ChainID: hdEvent.ChainID,
|
||||
},
|
||||
Time: hdEvent.RecordTime,
|
||||
}
|
||||
}
|
||||
|
|
@ -706,6 +706,14 @@ func (vals *ValidatorSet) StringIndented(indent string) string {
|
|||
indent)
|
||||
}
|
||||
|
||||
func (vals *ValidatorSet) SetTotalVotingPower(totalVotingPower int64) {
|
||||
vals.totalVotingPower = totalVotingPower
|
||||
}
|
||||
|
||||
func (vals *ValidatorSet) SetMap(validatorsMap map[common.Address]int) {
|
||||
vals.validatorsMap = validatorsMap
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
// Implements sort for sorting validators by address.
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/consensus/bor/contract"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdall" //nolint:typecheck
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdall/span"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdallapp"
|
||||
"github.com/ethereum/go-ethereum/consensus/bor/heimdallgrpc"
|
||||
"github.com/ethereum/go-ethereum/consensus/clique"
|
||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||
|
|
@ -227,6 +228,9 @@ type Config struct {
|
|||
// Arguments to pass to heimdall service
|
||||
RunHeimdallArgs string
|
||||
|
||||
// Use child heimdall process to fetch data, Only works when RunHeimdall is true
|
||||
UseHeimdallApp bool
|
||||
|
||||
// Bor logs flag
|
||||
BorLogs bool
|
||||
|
||||
|
|
@ -264,7 +268,9 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, et
|
|||
log.Warn("Sanitizing DevFakeAuthor", "Use DevFakeAuthor with", "--bor.withoutheimdall")
|
||||
}
|
||||
var heimdallClient bor.IHeimdallClient
|
||||
if ethConfig.HeimdallgRPCAddress != "" {
|
||||
if ethConfig.RunHeimdall && ethConfig.UseHeimdallApp {
|
||||
heimdallClient = heimdallapp.NewHeimdallAppClient()
|
||||
} else if ethConfig.HeimdallgRPCAddress != "" {
|
||||
heimdallClient = heimdallgrpc.NewHeimdallGRPCClient(ethConfig.HeimdallgRPCAddress)
|
||||
} else {
|
||||
heimdallClient = heimdall.NewHeimdallClient(ethConfig.HeimdallURL)
|
||||
|
|
|
|||
|
|
@ -33,9 +33,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
"github.com/ethereum/go-ethereum/eth/ethconfig"
|
||||
"github.com/ethereum/go-ethereum/node"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
)
|
||||
|
|
@ -211,31 +208,31 @@ var testTx2 = types.MustSignNewTx(testKey, types.LatestSigner(genesis.Config), &
|
|||
To: &common.Address{2},
|
||||
})
|
||||
|
||||
func newTestBackend(t *testing.T) (*node.Node, []*types.Block) {
|
||||
// Generate test chain.
|
||||
blocks := generateTestChain()
|
||||
// func newTestBackend(t *testing.T) (*node.Node, []*types.Block) {
|
||||
// // Generate test chain.
|
||||
// blocks := generateTestChain()
|
||||
|
||||
// Create node
|
||||
n, err := node.New(&node.Config{})
|
||||
if err != nil {
|
||||
t.Fatalf("can't create new node: %v", err)
|
||||
}
|
||||
// Create Ethereum Service
|
||||
config := ðconfig.Config{Genesis: genesis}
|
||||
config.Ethash.PowMode = ethash.ModeFake
|
||||
ethservice, err := eth.New(n, config)
|
||||
if err != nil {
|
||||
t.Fatalf("can't create new ethereum service: %v", err)
|
||||
}
|
||||
// Import the test chain.
|
||||
if err := n.Start(); err != nil {
|
||||
t.Fatalf("can't start test node: %v", err)
|
||||
}
|
||||
if _, err := ethservice.BlockChain().InsertChain(blocks[1:]); err != nil {
|
||||
t.Fatalf("can't import test blocks: %v", err)
|
||||
}
|
||||
return n, blocks
|
||||
}
|
||||
// // Create node
|
||||
// n, err := node.New(&node.Config{})
|
||||
// if err != nil {
|
||||
// t.Fatalf("can't create new node: %v", err)
|
||||
// }
|
||||
// // Create Ethereum Service
|
||||
// config := ðconfig.Config{Genesis: genesis}
|
||||
// config.Ethash.PowMode = ethash.ModeFake
|
||||
// ethservice, err := eth.New(n, config)
|
||||
// if err != nil {
|
||||
// t.Fatalf("can't create new ethereum service: %v", err)
|
||||
// }
|
||||
// // Import the test chain.
|
||||
// if err := n.Start(); err != nil {
|
||||
// t.Fatalf("can't start test node: %v", err)
|
||||
// }
|
||||
// if _, err := ethservice.BlockChain().InsertChain(blocks[1:]); err != nil {
|
||||
// t.Fatalf("can't import test blocks: %v", err)
|
||||
// }
|
||||
// return n, blocks
|
||||
// }
|
||||
|
||||
func generateTestChain() []*types.Block {
|
||||
db := rawdb.NewMemoryDatabase()
|
||||
|
|
@ -258,50 +255,50 @@ func generateTestChain() []*types.Block {
|
|||
func TestEthClient(t *testing.T) {
|
||||
t.Skip("bor due to burn contract")
|
||||
|
||||
backend, chain := newTestBackend(t)
|
||||
client, _ := backend.Attach()
|
||||
defer backend.Close()
|
||||
defer client.Close()
|
||||
// backend, chain := newTestBackend(t)
|
||||
// client, _ := backend.Attach()
|
||||
// defer backend.Close()
|
||||
// defer client.Close()
|
||||
|
||||
tests := map[string]struct {
|
||||
test func(t *testing.T)
|
||||
}{
|
||||
"Header": {
|
||||
func(t *testing.T) { testHeader(t, chain, client) },
|
||||
},
|
||||
"BalanceAt": {
|
||||
func(t *testing.T) { testBalanceAt(t, client) },
|
||||
},
|
||||
"TxInBlockInterrupted": {
|
||||
func(t *testing.T) { testTransactionInBlockInterrupted(t, client) },
|
||||
},
|
||||
"ChainID": {
|
||||
func(t *testing.T) { testChainID(t, client) },
|
||||
},
|
||||
"GetBlock": {
|
||||
func(t *testing.T) { testGetBlock(t, client) },
|
||||
},
|
||||
"StatusFunctions": {
|
||||
func(t *testing.T) { testStatusFunctions(t, client) },
|
||||
},
|
||||
"CallContract": {
|
||||
func(t *testing.T) { testCallContract(t, client) },
|
||||
},
|
||||
"CallContractAtHash": {
|
||||
func(t *testing.T) { testCallContractAtHash(t, client) },
|
||||
},
|
||||
"AtFunctions": {
|
||||
func(t *testing.T) { testAtFunctions(t, client) },
|
||||
},
|
||||
"TransactionSender": {
|
||||
func(t *testing.T) { testTransactionSender(t, client) },
|
||||
},
|
||||
}
|
||||
// tests := map[string]struct {
|
||||
// test func(t *testing.T)
|
||||
// }{
|
||||
// "Header": {
|
||||
// func(t *testing.T) { testHeader(t, chain, client) },
|
||||
// },
|
||||
// "BalanceAt": {
|
||||
// func(t *testing.T) { testBalanceAt(t, client) },
|
||||
// },
|
||||
// "TxInBlockInterrupted": {
|
||||
// func(t *testing.T) { testTransactionInBlockInterrupted(t, client) },
|
||||
// },
|
||||
// "ChainID": {
|
||||
// func(t *testing.T) { testChainID(t, client) },
|
||||
// },
|
||||
// "GetBlock": {
|
||||
// func(t *testing.T) { testGetBlock(t, client) },
|
||||
// },
|
||||
// "StatusFunctions": {
|
||||
// func(t *testing.T) { testStatusFunctions(t, client) },
|
||||
// },
|
||||
// "CallContract": {
|
||||
// func(t *testing.T) { testCallContract(t, client) },
|
||||
// },
|
||||
// "CallContractAtHash": {
|
||||
// func(t *testing.T) { testCallContractAtHash(t, client) },
|
||||
// },
|
||||
// "AtFunctions": {
|
||||
// func(t *testing.T) { testAtFunctions(t, client) },
|
||||
// },
|
||||
// "TransactionSender": {
|
||||
// func(t *testing.T) { testTransactionSender(t, client) },
|
||||
// },
|
||||
// }
|
||||
|
||||
t.Parallel()
|
||||
for name, tt := range tests {
|
||||
t.Run(name, tt.test)
|
||||
}
|
||||
// t.Parallel()
|
||||
// for name, tt := range tests {
|
||||
// t.Run(name, tt.test)
|
||||
// }
|
||||
}
|
||||
|
||||
func testHeader(t *testing.T, chain []*types.Block, client *rpc.Client) {
|
||||
|
|
|
|||
9
go.mod
9
go.mod
|
|
@ -11,6 +11,7 @@ require (
|
|||
github.com/aws/aws-sdk-go-v2/config v1.1.1
|
||||
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 v0.22.0-beta // indirect
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.2
|
||||
github.com/cespare/cp v1.1.1
|
||||
github.com/cloudflare/cloudflare-go v0.14.0
|
||||
|
|
@ -47,7 +48,7 @@ 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/heimdall v0.3.1-0.20230105132832-d0063f71e3f0
|
||||
github.com/maticnetwork/polyproto v0.0.2
|
||||
github.com/mattn/go-colorable v0.1.8
|
||||
github.com/mattn/go-isatty v0.0.12
|
||||
|
|
@ -85,8 +86,6 @@ require (
|
|||
pgregory.net/rapid v0.4.8
|
||||
)
|
||||
|
||||
require github.com/btcsuite/btcd v0.22.0-beta // indirect
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.65.0 // indirect
|
||||
cloud.google.com/go/pubsub v1.3.1 // indirect
|
||||
|
|
@ -145,7 +144,7 @@ require (
|
|||
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // 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/json-iterator/go v1.1.12
|
||||
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
|
||||
|
|
@ -183,7 +182,7 @@ require (
|
|||
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/tendermint v0.32.7
|
||||
github.com/tendermint/tm-db v0.2.0 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.5 // indirect
|
||||
github.com/tklauser/numcpus v0.2.2 // indirect
|
||||
|
|
|
|||
5
go.sum
5
go.sum
|
|
@ -144,7 +144,6 @@ github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN
|
|||
github.com/btcsuite/btcd/btcec/v2 v2.1.2 h1:YoYoC9J0jwfukodSBMzZYUVQ8PTiYg4BnOWiJVzTmLs=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||
|
|
@ -611,8 +610,8 @@ github.com/maticnetwork/cosmos-sdk v0.37.5-0.20220311095845-81690c6a53e7 h1:8NoE
|
|||
github.com/maticnetwork/cosmos-sdk v0.37.5-0.20220311095845-81690c6a53e7/go.mod h1:uW55Ru86N5o3L8SVkVL1TPE+mV/WRM2la8sC3TR/Ajc=
|
||||
github.com/maticnetwork/crand v1.0.2 h1:Af0tAivC8zrxXDpGWNWVT/0s1fOz8w0eRbahZgURS8I=
|
||||
github.com/maticnetwork/crand v1.0.2/go.mod h1:/NRNL3bj2eYdqpWmoIP5puxndTpi0XRxpj5ZKxfHjyg=
|
||||
github.com/maticnetwork/heimdall v0.3.0-beta1.0.20221123180730-457028136461 h1:XMznEUVoJVzrZjGzh252yNrmsEKLFgiXefWbhKRabJQ=
|
||||
github.com/maticnetwork/heimdall v0.3.0-beta1.0.20221123180730-457028136461/go.mod h1:IHC6KRjp1c9DLUXLB0+65Fdn+T55OV9y4VViCwYv4lk=
|
||||
github.com/maticnetwork/heimdall v0.3.1-0.20230105132832-d0063f71e3f0 h1:MYTAcBs4y88GEzesT8eAU472ZfQSLluW0qgkZTzNgwM=
|
||||
github.com/maticnetwork/heimdall v0.3.1-0.20230105132832-d0063f71e3f0/go.mod h1:A3bUSe9jjMQHEPPOUW1JytM3x2g3t+jvsbPY66KBPIs=
|
||||
github.com/maticnetwork/polyproto v0.0.2 h1:cPxuxbIDItdwGnucc3lZB58U8Zfe1mH73PWTGd15554=
|
||||
github.com/maticnetwork/polyproto v0.0.2/go.mod h1:e1mU2EXSwEpn5jM7GfNwu3AupsV6WAGoPFFfswXOF0o=
|
||||
github.com/maticnetwork/tendermint v0.26.0-dev0.0.20220923185258-3e7c7f86ce9f h1:iV69PJUEdwJJFXQvbADYVEMxDrkKAsPdHTg4U3F510I=
|
||||
|
|
|
|||
|
|
@ -130,13 +130,6 @@ func (c *Command) Run(args []string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
srv, err := NewServer(c.config, WithGRPCAddress())
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
c.srv = srv
|
||||
|
||||
if c.config.Heimdall.RunHeimdall {
|
||||
shutdownCtx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
|
@ -146,6 +139,13 @@ func (c *Command) Run(args []string) int {
|
|||
}()
|
||||
}
|
||||
|
||||
srv, err := NewServer(c.config, WithGRPCAddress())
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
c.srv = srv
|
||||
|
||||
return c.handleSignals()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,6 +177,9 @@ type HeimdallConfig struct {
|
|||
|
||||
// RunHeimdal args are the arguments to run heimdall with
|
||||
RunHeimdallArgs string `hcl:"bor.runheimdallargs,optional" toml:"bor.runheimdallargs,optional"`
|
||||
|
||||
// UseHeimdallApp is used to fetch data from heimdall app when running heimdall as a child process
|
||||
UseHeimdallApp bool `hcl:"bor.useheimdallapp,optional" toml:"bor.useheimdallapp,optional"`
|
||||
}
|
||||
|
||||
type TxPoolConfig struct {
|
||||
|
|
@ -720,6 +723,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
|||
n.HeimdallgRPCAddress = c.Heimdall.GRPCAddress
|
||||
n.RunHeimdall = c.Heimdall.RunHeimdall
|
||||
n.RunHeimdallArgs = c.Heimdall.RunHeimdallArgs
|
||||
n.UseHeimdallApp = c.Heimdall.UseHeimdallApp
|
||||
|
||||
// Developer Fake Author for producing blocks without authorisation on bor consensus
|
||||
n.DevFakeAuthor = c.DevFakeAuthor
|
||||
|
|
|
|||
|
|
@ -125,6 +125,12 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Value: &c.cliConfig.Heimdall.RunHeimdallArgs,
|
||||
Default: c.cliConfig.Heimdall.RunHeimdallArgs,
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
Name: "bor.useheimdallapp",
|
||||
Usage: "Use child heimdall process to fetch data, Only works when bor.runheimdall is true",
|
||||
Value: &c.cliConfig.Heimdall.UseHeimdallApp,
|
||||
Default: c.cliConfig.Heimdall.UseHeimdallApp,
|
||||
})
|
||||
|
||||
// txpool options
|
||||
f.SliceStringFlag(&flagset.SliceStringFlag{
|
||||
|
|
|
|||
Loading…
Reference in a new issue