From 385aff85f0c9d2e81f6307b37706f50df4e200ac Mon Sep 17 00:00:00 2001 From: Krishna Upadhyaya Date: Tue, 26 Jul 2022 02:18:37 +0530 Subject: [PATCH 1/6] Implemented heimdall gRPC client --- cmd/geth/chaincmd.go | 1 + cmd/utils/bor_flags.go | 9 ++++ cmd/utils/flags.go | 7 +-- consensus/bor/heimdallgrpc/checkpoint.go | 41 +++++++++++++++++ consensus/bor/heimdallgrpc/client.go | 37 +++++++++++++++ consensus/bor/heimdallgrpc/span.go | 57 ++++++++++++++++++++++++ consensus/bor/heimdallgrpc/state_sync.go | 49 ++++++++++++++++++++ consensus/bor/heimdallgrpc/type_utils.go | 42 +++++++++++++++++ eth/ethconfig/config.go | 3 ++ go.mod | 3 +- go.sum | 6 ++- internal/cli/server/config.go | 9 +++- internal/cli/server/flags.go | 6 +++ 13 files changed, 262 insertions(+), 8 deletions(-) create mode 100644 consensus/bor/heimdallgrpc/checkpoint.go create mode 100644 consensus/bor/heimdallgrpc/client.go create mode 100644 consensus/bor/heimdallgrpc/span.go create mode 100644 consensus/bor/heimdallgrpc/state_sync.go create mode 100644 consensus/bor/heimdallgrpc/type_utils.go diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index a178f6c751..fc2309d2db 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -108,6 +108,7 @@ The dumpgenesis command dumps the genesis block configuration in JSON format to // bor related flags utils.HeimdallURLFlag, utils.WithoutHeimdallFlag, + utils.HeimdallgRPCAddressFlag, }, Category: "BLOCKCHAIN COMMANDS", Description: ` diff --git a/cmd/utils/bor_flags.go b/cmd/utils/bor_flags.go index 34355532e1..6369b251c6 100644 --- a/cmd/utils/bor_flags.go +++ b/cmd/utils/bor_flags.go @@ -31,10 +31,18 @@ var ( Usage: "Run without Heimdall service (for testing purpose)", } + // HeimdallgRPCAddressFlag flag for heimdall gRPC address + HeimdallgRPCAddressFlag = cli.StringFlag{ + Name: "bor.heimdallgRPC", + Usage: "Address of Heimdall gRPC service", + Value: ":3132", + } + // BorFlags all bor related flags BorFlags = []cli.Flag{ HeimdallURLFlag, WithoutHeimdallFlag, + HeimdallgRPCAddressFlag, } ) @@ -57,6 +65,7 @@ func getGenesis(genesisPath string) (*core.Genesis, error) { 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) } // CreateBorEthereum Creates bor ethereum object from eth.Config diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 1a593888d6..68069eeba7 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -2024,9 +2024,10 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai engine = clique.New(config.Clique, chainDb) } else if config.Bor != nil { ethereum = CreateBorEthereum(ð.Config{ - Genesis: genesis, - HeimdallURL: ctx.GlobalString(HeimdallURLFlag.Name), - WithoutHeimdall: ctx.GlobalBool(WithoutHeimdallFlag.Name), + Genesis: genesis, + HeimdallURL: ctx.GlobalString(HeimdallURLFlag.Name), + WithoutHeimdall: ctx.GlobalBool(WithoutHeimdallFlag.Name), + HeimdallgRPCAddress: ctx.GlobalString(HeimdallgRPCAddressFlag.Name), }) engine = ethereum.Engine() } else { diff --git a/consensus/bor/heimdallgrpc/checkpoint.go b/consensus/bor/heimdallgrpc/checkpoint.go new file mode 100644 index 0000000000..ef25897237 --- /dev/null +++ b/consensus/bor/heimdallgrpc/checkpoint.go @@ -0,0 +1,41 @@ +package heimdallgrpc + +import ( + "context" + "math/big" + + "github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint" + + proto "github.com/maticnetwork/polyproto/heimdall" +) + +func (h *HeimdallGRPCClient) FetchCheckpointCount(ctx context.Context) (int64, error) { + res, err := h.client.FetchCheckpointCount(context.Background(), nil) + if err != nil { + return 0, err + } + + return res.Result.Result, nil +} + +func (h *HeimdallGRPCClient) FetchCheckpoint(ctx context.Context, number int64) (*checkpoint.Checkpoint, error) { + req := &proto.FetchCheckpointRequest{ + ID: number, + } + + res, err := h.client.FetchCheckpoint(context.Background(), req) + if err != nil { + return nil, err + } + + checkpoint := &checkpoint.Checkpoint{ + StartBlock: new(big.Int).SetUint64(res.Result.StartBlock), + EndBlock: new(big.Int).SetUint64(res.Result.EndBlock), + RootHash: ConvertH256ToHash(res.Result.RootHash), + Proposer: ConvertH160toAddress(res.Result.Proposer), + BorChainID: res.Result.BorChainID, + Timestamp: uint64(res.Result.Timestamp.GetSeconds()), + } + + return checkpoint, nil +} diff --git a/consensus/bor/heimdallgrpc/client.go b/consensus/bor/heimdallgrpc/client.go new file mode 100644 index 0000000000..a52fc20dca --- /dev/null +++ b/consensus/bor/heimdallgrpc/client.go @@ -0,0 +1,37 @@ +package heimdallgrpc + +import ( + "log" + + proto "github.com/maticnetwork/polyproto/heimdall" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +const ( + stateFetchLimit = 50 +) + +type HeimdallGRPCClient struct { + conn *grpc.ClientConn + client proto.HeimdallClient + closeCh chan struct{} +} + +func NewHeimdallGRPCClient(address string) *HeimdallGRPCClient { + conn, err := grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + log.Fatalf("Failed to connect to Heimdall gRPC server: %v", err) + } + + return &HeimdallGRPCClient{ + conn: conn, + client: proto.NewHeimdallClient(conn), + closeCh: make(chan struct{}), + } +} + +func (h *HeimdallGRPCClient) Close() { + close(h.closeCh) + h.conn.Close() +} diff --git a/consensus/bor/heimdallgrpc/span.go b/consensus/bor/heimdallgrpc/span.go new file mode 100644 index 0000000000..cfd9d7ffd9 --- /dev/null +++ b/consensus/bor/heimdallgrpc/span.go @@ -0,0 +1,57 @@ +package heimdallgrpc + +import ( + "context" + + "github.com/ethereum/go-ethereum/consensus/bor/heimdall/span" + "github.com/ethereum/go-ethereum/consensus/bor/valset" + + proto "github.com/maticnetwork/polyproto/heimdall" +) + +func (h *HeimdallGRPCClient) Span(ctx context.Context, spanID uint64) (*span.HeimdallSpan, error) { + req := &proto.SpanRequest{ + ID: spanID, + } + + res, err := h.client.Span(context.Background(), req) + if err != nil { + return nil, err + } + + return parseSpan(res.Result), nil +} + +func parseSpan(protoSpan *proto.Span) *span.HeimdallSpan { + resp := &span.HeimdallSpan{ + Span: span.Span{ + ID: protoSpan.ID, + StartBlock: protoSpan.StartBlock, + EndBlock: protoSpan.EndBlock, + }, + ValidatorSet: valset.ValidatorSet{}, + SelectedProducers: []valset.Validator{}, + ChainID: protoSpan.ChainID, + } + + for _, validator := range protoSpan.ValidatorSet.Validators { + resp.ValidatorSet.Validators = append(resp.ValidatorSet.Validators, parseValidator(validator)) + } + + resp.ValidatorSet.Proposer = parseValidator(protoSpan.ValidatorSet.Proposer) + + for _, validator := range protoSpan.SelectedProducers { + resp.SelectedProducers = append(resp.SelectedProducers, *parseValidator(validator)) + } + + return resp +} + +func parseValidator(validator *proto.Validator) *valset.Validator { + return &valset.Validator{ + ID: validator.ID, + Address: ConvertH160toAddress(validator.Address), + VotingPower: validator.VotingPower, + ProposerPriority: validator.ProposerPriority, + } +} diff --git a/consensus/bor/heimdallgrpc/state_sync.go b/consensus/bor/heimdallgrpc/state_sync.go new file mode 100644 index 0000000000..aaa4736548 --- /dev/null +++ b/consensus/bor/heimdallgrpc/state_sync.go @@ -0,0 +1,49 @@ +package heimdallgrpc + +import ( + "context" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus/bor/clerk" + + proto "github.com/maticnetwork/polyproto/heimdall" +) + +func (h *HeimdallGRPCClient) StateSyncEvents(fromID uint64, to int64) ([]*clerk.EventRecordWithTime, error) { + eventRecords := make([]*clerk.EventRecordWithTime, 0) + + req := &proto.StateSyncEventsRequest{ + FromID: fromID, + ToTime: uint64(to), + Limit: uint64(stateFetchLimit), + } + + res, err := h.client.StateSyncEvents(context.Background(), req) + if err != nil { + return nil, err + } + + for { + events, err := res.Recv() + if err != nil { + break + } + + for _, event := range events.Result { + eventRecord := &clerk.EventRecordWithTime{ + EventRecord: clerk.EventRecord{ + ID: event.ID, + Contract: common.HexToAddress(event.Contract), + Data: common.Hex2Bytes(event.Data[2:]), + TxHash: common.HexToHash(event.TxHash), + LogIndex: event.LogIndex, + ChainID: event.ChainID, + }, + Time: event.Time.AsTime(), + } + eventRecords = append(eventRecords, eventRecord) + } + } + + return eventRecords, nil +} diff --git a/consensus/bor/heimdallgrpc/type_utils.go b/consensus/bor/heimdallgrpc/type_utils.go new file mode 100644 index 0000000000..daa58da115 --- /dev/null +++ b/consensus/bor/heimdallgrpc/type_utils.go @@ -0,0 +1,42 @@ +package heimdallgrpc + +import ( + "encoding/binary" + + proto "github.com/maticnetwork/polyproto/heimdall" +) + +func ConvertH160toAddress(h160 *proto.H160) [20]byte { + var addr [20]byte + + binary.BigEndian.PutUint64(addr[0:], h160.Hi.Hi) + binary.BigEndian.PutUint64(addr[8:], h160.Hi.Lo) + binary.BigEndian.PutUint32(addr[16:], h160.Lo) + + return addr +} + +func ConvertAddressToH160(addr [20]byte) *proto.H160 { + return &proto.H160{ + Lo: binary.BigEndian.Uint32(addr[16:]), + Hi: &proto.H128{Lo: binary.BigEndian.Uint64(addr[8:]), Hi: binary.BigEndian.Uint64(addr[0:])}, + } +} + +func ConvertH256ToHash(h256 *proto.H256) [32]byte { + var hash [32]byte + + binary.BigEndian.PutUint64(hash[0:], h256.Hi.Hi) + binary.BigEndian.PutUint64(hash[8:], h256.Hi.Lo) + binary.BigEndian.PutUint64(hash[16:], h256.Lo.Hi) + binary.BigEndian.PutUint64(hash[24:], h256.Lo.Lo) + + return hash +} + +func ConvertHashToH256(hash [32]byte) *proto.H256 { + return &proto.H256{ + Lo: &proto.H128{Lo: binary.BigEndian.Uint64(hash[24:]), Hi: binary.BigEndian.Uint64(hash[16:])}, + Hi: &proto.H128{Lo: binary.BigEndian.Uint64(hash[8:]), Hi: binary.BigEndian.Uint64(hash[0:])}, + } +} diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index d51e293413..10616b60c5 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -216,6 +216,9 @@ type Config struct { // No heimdall service WithoutHeimdall bool + // Address to connect to Heimdall gRPC server + HeimdallgRPCAddress string + // Bor logs flag BorLogs bool diff --git a/go.mod b/go.mod index 8c5c18f8c7..85d4ba5ece 100644 --- a/go.mod +++ b/go.mod @@ -44,6 +44,7 @@ require ( github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e github.com/julienschmidt/httprouter v1.3.0 github.com/karalabe/usb v0.0.2 + github.com/maticnetwork/polyproto v0.0.1 github.com/mattn/go-colorable v0.1.8 github.com/mattn/go-isatty v0.0.12 github.com/mitchellh/cli v1.1.2 @@ -71,7 +72,7 @@ require ( golang.org/x/text v0.3.7 golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba golang.org/x/tools v0.1.10 - google.golang.org/grpc v1.47.0 + google.golang.org/grpc v1.48.0 google.golang.org/protobuf v1.28.0 gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 diff --git a/go.sum b/go.sum index e20575ddaa..90c3d5d229 100644 --- a/go.sum +++ b/go.sum @@ -337,6 +337,8 @@ github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2 github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/maticnetwork/polyproto v0.0.1 h1:qdxoyGd9EkYs910n4crEQqZETpvpRSrprlDYtdbZrqg= +github.com/maticnetwork/polyproto v0.0.1/go.mod h1:e1mU2EXSwEpn5jM7GfNwu3AupsV6WAGoPFFfswXOF0o= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -738,8 +740,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index fdf253a37e..522d4004ae 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -153,6 +153,9 @@ type HeimdallConfig struct { // Without is used to disable remote heimdall during testing Without bool `hcl:"without,optional"` + + // GRPCAddress is the address of the heimdall grpc server + GRPCAddress string `hcl:"grpc-address,optional"` } type TxPoolConfig struct { @@ -409,8 +412,9 @@ func DefaultConfig() *Config { }, }, Heimdall: &HeimdallConfig{ - URL: "http://localhost:1317", - Without: false, + URL: "http://localhost:1317", + Without: false, + GRPCAddress: ":3132", }, SyncMode: "full", GcMode: "full", @@ -652,6 +656,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (* } n.HeimdallURL = c.Heimdall.URL n.WithoutHeimdall = c.Heimdall.Without + n.HeimdallgRPCAddress = c.Heimdall.GRPCAddress // gas price oracle { diff --git a/internal/cli/server/flags.go b/internal/cli/server/flags.go index e85428b9ee..fd48d226f9 100644 --- a/internal/cli/server/flags.go +++ b/internal/cli/server/flags.go @@ -80,6 +80,12 @@ func (c *Command) Flags() *flagset.Flagset { Value: &c.cliConfig.Heimdall.Without, Default: c.cliConfig.Heimdall.Without, }) + f.StringFlag(&flagset.StringFlag{ + Name: "bor.heimdallgRPC", + Usage: "Address of Heimdall gRPC service", + Value: &c.cliConfig.Heimdall.GRPCAddress, + Default: c.cliConfig.Heimdall.GRPCAddress, + }) // txpool options f.SliceStringFlag(&flagset.SliceStringFlag{ From dbbacb8b19a27ed9a4f42dadfea6620807b923ac Mon Sep 17 00:00:00 2001 From: Krishna Upadhyaya Date: Tue, 26 Jul 2022 11:16:11 +0530 Subject: [PATCH 2/6] Using polyproto v0.0.2 and removed type utils --- consensus/bor/heimdallgrpc/checkpoint.go | 5 +-- consensus/bor/heimdallgrpc/span.go | 3 +- consensus/bor/heimdallgrpc/type_utils.go | 42 ------------------------ go.mod | 2 +- go.sum | 4 +-- 5 files changed, 8 insertions(+), 48 deletions(-) delete mode 100644 consensus/bor/heimdallgrpc/type_utils.go diff --git a/consensus/bor/heimdallgrpc/checkpoint.go b/consensus/bor/heimdallgrpc/checkpoint.go index ef25897237..eebf13a398 100644 --- a/consensus/bor/heimdallgrpc/checkpoint.go +++ b/consensus/bor/heimdallgrpc/checkpoint.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint" proto "github.com/maticnetwork/polyproto/heimdall" + protoutils "github.com/maticnetwork/polyproto/utils" ) func (h *HeimdallGRPCClient) FetchCheckpointCount(ctx context.Context) (int64, error) { @@ -31,8 +32,8 @@ func (h *HeimdallGRPCClient) FetchCheckpoint(ctx context.Context, number int64) checkpoint := &checkpoint.Checkpoint{ StartBlock: new(big.Int).SetUint64(res.Result.StartBlock), EndBlock: new(big.Int).SetUint64(res.Result.EndBlock), - RootHash: ConvertH256ToHash(res.Result.RootHash), - Proposer: ConvertH160toAddress(res.Result.Proposer), + RootHash: protoutils.ConvertH256ToHash(res.Result.RootHash), + Proposer: protoutils.ConvertH160toAddress(res.Result.Proposer), BorChainID: res.Result.BorChainID, Timestamp: uint64(res.Result.Timestamp.GetSeconds()), } diff --git a/consensus/bor/heimdallgrpc/span.go b/consensus/bor/heimdallgrpc/span.go index cfd9d7ffd9..1bc5a07021 100644 --- a/consensus/bor/heimdallgrpc/span.go +++ b/consensus/bor/heimdallgrpc/span.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/consensus/bor/valset" proto "github.com/maticnetwork/polyproto/heimdall" + protoutils "github.com/maticnetwork/polyproto/utils" ) func (h *HeimdallGRPCClient) Span(ctx context.Context, spanID uint64) (*span.HeimdallSpan, error) { @@ -50,7 +51,7 @@ func parseSpan(protoSpan *proto.Span) *span.HeimdallSpan { func parseValidator(validator *proto.Validator) *valset.Validator { return &valset.Validator{ ID: validator.ID, - Address: ConvertH160toAddress(validator.Address), + Address: protoutils.ConvertH160toAddress(validator.Address), VotingPower: validator.VotingPower, ProposerPriority: validator.ProposerPriority, } diff --git a/consensus/bor/heimdallgrpc/type_utils.go b/consensus/bor/heimdallgrpc/type_utils.go deleted file mode 100644 index daa58da115..0000000000 --- a/consensus/bor/heimdallgrpc/type_utils.go +++ /dev/null @@ -1,42 +0,0 @@ -package heimdallgrpc - -import ( - "encoding/binary" - - proto "github.com/maticnetwork/polyproto/heimdall" -) - -func ConvertH160toAddress(h160 *proto.H160) [20]byte { - var addr [20]byte - - binary.BigEndian.PutUint64(addr[0:], h160.Hi.Hi) - binary.BigEndian.PutUint64(addr[8:], h160.Hi.Lo) - binary.BigEndian.PutUint32(addr[16:], h160.Lo) - - return addr -} - -func ConvertAddressToH160(addr [20]byte) *proto.H160 { - return &proto.H160{ - Lo: binary.BigEndian.Uint32(addr[16:]), - Hi: &proto.H128{Lo: binary.BigEndian.Uint64(addr[8:]), Hi: binary.BigEndian.Uint64(addr[0:])}, - } -} - -func ConvertH256ToHash(h256 *proto.H256) [32]byte { - var hash [32]byte - - binary.BigEndian.PutUint64(hash[0:], h256.Hi.Hi) - binary.BigEndian.PutUint64(hash[8:], h256.Hi.Lo) - binary.BigEndian.PutUint64(hash[16:], h256.Lo.Hi) - binary.BigEndian.PutUint64(hash[24:], h256.Lo.Lo) - - return hash -} - -func ConvertHashToH256(hash [32]byte) *proto.H256 { - return &proto.H256{ - Lo: &proto.H128{Lo: binary.BigEndian.Uint64(hash[24:]), Hi: binary.BigEndian.Uint64(hash[16:])}, - Hi: &proto.H128{Lo: binary.BigEndian.Uint64(hash[8:]), Hi: binary.BigEndian.Uint64(hash[0:])}, - } -} diff --git a/go.mod b/go.mod index 85d4ba5ece..a8fd2f9a02 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e github.com/julienschmidt/httprouter v1.3.0 github.com/karalabe/usb v0.0.2 - github.com/maticnetwork/polyproto v0.0.1 + 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 diff --git a/go.sum b/go.sum index 90c3d5d229..53d933fb6c 100644 --- a/go.sum +++ b/go.sum @@ -337,8 +337,8 @@ github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2 github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/maticnetwork/polyproto v0.0.1 h1:qdxoyGd9EkYs910n4crEQqZETpvpRSrprlDYtdbZrqg= -github.com/maticnetwork/polyproto v0.0.1/go.mod h1:e1mU2EXSwEpn5jM7GfNwu3AupsV6WAGoPFFfswXOF0o= +github.com/maticnetwork/polyproto v0.0.2 h1:cPxuxbIDItdwGnucc3lZB58U8Zfe1mH73PWTGd15554= +github.com/maticnetwork/polyproto v0.0.2/go.mod h1:e1mU2EXSwEpn5jM7GfNwu3AupsV6WAGoPFFfswXOF0o= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= From 8de8a6815c9f3dd349c89f98a97376d4342d4d85 Mon Sep 17 00:00:00 2001 From: Krishna Upadhyaya Date: Tue, 26 Jul 2022 18:08:25 +0530 Subject: [PATCH 3/6] Integrated heimdall gRPC server flow --- cmd/utils/bor_flags.go | 2 +- consensus/bor/heimdallgrpc/client.go | 18 ++++++++---------- consensus/bor/heimdallgrpc/state_sync.go | 2 +- eth/ethconfig/config.go | 10 +++++++++- internal/cli/server/config.go | 2 +- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/cmd/utils/bor_flags.go b/cmd/utils/bor_flags.go index 6369b251c6..256df31e97 100644 --- a/cmd/utils/bor_flags.go +++ b/cmd/utils/bor_flags.go @@ -35,7 +35,7 @@ var ( HeimdallgRPCAddressFlag = cli.StringFlag{ Name: "bor.heimdallgRPC", Usage: "Address of Heimdall gRPC service", - Value: ":3132", + Value: "", } // BorFlags all bor related flags diff --git a/consensus/bor/heimdallgrpc/client.go b/consensus/bor/heimdallgrpc/client.go index a52fc20dca..caf7b14002 100644 --- a/consensus/bor/heimdallgrpc/client.go +++ b/consensus/bor/heimdallgrpc/client.go @@ -1,8 +1,7 @@ package heimdallgrpc import ( - "log" - + "github.com/ethereum/go-ethereum/log" proto "github.com/maticnetwork/polyproto/heimdall" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -13,25 +12,24 @@ const ( ) type HeimdallGRPCClient struct { - conn *grpc.ClientConn - client proto.HeimdallClient - closeCh chan struct{} + conn *grpc.ClientConn + client proto.HeimdallClient } func NewHeimdallGRPCClient(address string) *HeimdallGRPCClient { conn, err := grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { - log.Fatalf("Failed to connect to Heimdall gRPC server: %v", err) + log.Error("Failed to connect to Heimdall gRPC server: %v", err) + panic(err) } return &HeimdallGRPCClient{ - conn: conn, - client: proto.NewHeimdallClient(conn), - closeCh: make(chan struct{}), + conn: conn, + client: proto.NewHeimdallClient(conn), } } func (h *HeimdallGRPCClient) Close() { - close(h.closeCh) + log.Debug("Shutdown detected, Closing Heimdall gRPC client") h.conn.Close() } diff --git a/consensus/bor/heimdallgrpc/state_sync.go b/consensus/bor/heimdallgrpc/state_sync.go index aaa4736548..2f36895687 100644 --- a/consensus/bor/heimdallgrpc/state_sync.go +++ b/consensus/bor/heimdallgrpc/state_sync.go @@ -9,7 +9,7 @@ import ( proto "github.com/maticnetwork/polyproto/heimdall" ) -func (h *HeimdallGRPCClient) StateSyncEvents(fromID uint64, to int64) ([]*clerk.EventRecordWithTime, error) { +func (h *HeimdallGRPCClient) StateSyncEvents(ctx context.Context, fromID uint64, to int64) ([]*clerk.EventRecordWithTime, error) { eventRecords := make([]*clerk.EventRecordWithTime, 0) req := &proto.StateSyncEventsRequest{ diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 10616b60c5..adb36ffadd 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -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/heimdallgrpc" "github.com/ethereum/go-ethereum/consensus/clique" "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/core" @@ -249,7 +250,14 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, et if ethConfig.WithoutHeimdall { return bor.New(chainConfig, db, blockchainAPI, spanner, nil, genesisContractsClient) } else { - return bor.New(chainConfig, db, blockchainAPI, spanner, heimdall.NewHeimdallClient(ethConfig.HeimdallURL), genesisContractsClient) + var heimdallClient bor.IHeimdallClient + if ethConfig.HeimdallgRPCAddress != "" { + heimdallClient = heimdallgrpc.NewHeimdallGRPCClient(ethConfig.HeimdallgRPCAddress) + } else { + heimdallClient = heimdall.NewHeimdallClient(ethConfig.HeimdallURL) + } + + return bor.New(chainConfig, db, blockchainAPI, spanner, heimdallClient, genesisContractsClient) } } else { switch config.PowMode { diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index 522d4004ae..37caa4fcc2 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -414,7 +414,7 @@ func DefaultConfig() *Config { Heimdall: &HeimdallConfig{ URL: "http://localhost:1317", Without: false, - GRPCAddress: ":3132", + GRPCAddress: "", }, SyncMode: "full", GcMode: "full", From 00c2b3329cddebd37c4f1af72ed4762afea728ed Mon Sep 17 00:00:00 2001 From: Krishna Upadhyaya Date: Tue, 26 Jul 2022 18:15:21 +0530 Subject: [PATCH 4/6] fix lint --- consensus/bor/heimdallgrpc/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/consensus/bor/heimdallgrpc/client.go b/consensus/bor/heimdallgrpc/client.go index caf7b14002..b96ceb52d6 100644 --- a/consensus/bor/heimdallgrpc/client.go +++ b/consensus/bor/heimdallgrpc/client.go @@ -2,6 +2,7 @@ package heimdallgrpc import ( "github.com/ethereum/go-ethereum/log" + proto "github.com/maticnetwork/polyproto/heimdall" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" From f55f81635125b1cbfedd0b5d5c9845f971c0ded6 Mon Sep 17 00:00:00 2001 From: Krishna Upadhyaya Date: Wed, 27 Jul 2022 19:07:48 +0530 Subject: [PATCH 5/6] fixed context in gRPC code --- consensus/bor/heimdallgrpc/checkpoint.go | 4 ++-- consensus/bor/heimdallgrpc/span.go | 2 +- consensus/bor/heimdallgrpc/state_sync.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/consensus/bor/heimdallgrpc/checkpoint.go b/consensus/bor/heimdallgrpc/checkpoint.go index eebf13a398..0829468e9b 100644 --- a/consensus/bor/heimdallgrpc/checkpoint.go +++ b/consensus/bor/heimdallgrpc/checkpoint.go @@ -11,7 +11,7 @@ import ( ) func (h *HeimdallGRPCClient) FetchCheckpointCount(ctx context.Context) (int64, error) { - res, err := h.client.FetchCheckpointCount(context.Background(), nil) + res, err := h.client.FetchCheckpointCount(ctx, nil) if err != nil { return 0, err } @@ -24,7 +24,7 @@ func (h *HeimdallGRPCClient) FetchCheckpoint(ctx context.Context, number int64) ID: number, } - res, err := h.client.FetchCheckpoint(context.Background(), req) + res, err := h.client.FetchCheckpoint(ctx, req) if err != nil { return nil, err } diff --git a/consensus/bor/heimdallgrpc/span.go b/consensus/bor/heimdallgrpc/span.go index 1bc5a07021..d68c5c97a3 100644 --- a/consensus/bor/heimdallgrpc/span.go +++ b/consensus/bor/heimdallgrpc/span.go @@ -15,7 +15,7 @@ func (h *HeimdallGRPCClient) Span(ctx context.Context, spanID uint64) (*span.Hei ID: spanID, } - res, err := h.client.Span(context.Background(), req) + res, err := h.client.Span(ctx, req) if err != nil { return nil, err } diff --git a/consensus/bor/heimdallgrpc/state_sync.go b/consensus/bor/heimdallgrpc/state_sync.go index 2f36895687..aa10f0c5c3 100644 --- a/consensus/bor/heimdallgrpc/state_sync.go +++ b/consensus/bor/heimdallgrpc/state_sync.go @@ -18,7 +18,7 @@ func (h *HeimdallGRPCClient) StateSyncEvents(ctx context.Context, fromID uint64, Limit: uint64(stateFetchLimit), } - res, err := h.client.StateSyncEvents(context.Background(), req) + res, err := h.client.StateSyncEvents(ctx, req) if err != nil { return nil, err } From 0c0fb63491ea6beec3097a9f42557e4033843b56 Mon Sep 17 00:00:00 2001 From: Krishna Upadhyaya Date: Thu, 28 Jul 2022 18:11:59 +0530 Subject: [PATCH 6/6] Implemented retry middleware in heimdall gRPC --- consensus/bor/heimdallgrpc/checkpoint.go | 9 +++++++ consensus/bor/heimdallgrpc/client.go | 24 +++++++++++++++---- consensus/bor/heimdallgrpc/span.go | 5 ++++ go.mod | 12 +++++----- go.sum | 30 ++++++++++++++++++------ 5 files changed, 63 insertions(+), 17 deletions(-) diff --git a/consensus/bor/heimdallgrpc/checkpoint.go b/consensus/bor/heimdallgrpc/checkpoint.go index 0829468e9b..2c51efe736 100644 --- a/consensus/bor/heimdallgrpc/checkpoint.go +++ b/consensus/bor/heimdallgrpc/checkpoint.go @@ -5,17 +5,22 @@ import ( "math/big" "github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint" + "github.com/ethereum/go-ethereum/log" proto "github.com/maticnetwork/polyproto/heimdall" protoutils "github.com/maticnetwork/polyproto/utils" ) func (h *HeimdallGRPCClient) FetchCheckpointCount(ctx context.Context) (int64, error) { + log.Info("Fetching checkpoint count") + res, err := h.client.FetchCheckpointCount(ctx, nil) if err != nil { return 0, err } + log.Info("Fetched checkpoint count") + return res.Result.Result, nil } @@ -24,11 +29,15 @@ func (h *HeimdallGRPCClient) FetchCheckpoint(ctx context.Context, number int64) ID: number, } + log.Info("Fetching checkpoint", "number", number) + res, err := h.client.FetchCheckpoint(ctx, req) if err != nil { return nil, err } + log.Info("Fetched checkpoint", "number", number) + checkpoint := &checkpoint.Checkpoint{ StartBlock: new(big.Int).SetUint64(res.Result.StartBlock), EndBlock: new(big.Int).SetUint64(res.Result.EndBlock), diff --git a/consensus/bor/heimdallgrpc/client.go b/consensus/bor/heimdallgrpc/client.go index b96ceb52d6..7687b7f1c7 100644 --- a/consensus/bor/heimdallgrpc/client.go +++ b/consensus/bor/heimdallgrpc/client.go @@ -1,10 +1,15 @@ package heimdallgrpc import ( + "time" + "github.com/ethereum/go-ethereum/log" + grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry" proto "github.com/maticnetwork/polyproto/heimdall" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials/insecure" ) @@ -18,12 +23,23 @@ type HeimdallGRPCClient struct { } func NewHeimdallGRPCClient(address string) *HeimdallGRPCClient { - conn, err := grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials())) - if err != nil { - log.Error("Failed to connect to Heimdall gRPC server: %v", err) - panic(err) + opts := []grpc_retry.CallOption{ + grpc_retry.WithMax(10000), + grpc_retry.WithBackoff(grpc_retry.BackoffLinear(5 * time.Second)), + grpc_retry.WithCodes(codes.Internal, codes.Unavailable, codes.Aborted, codes.NotFound), } + conn, err := grpc.Dial(address, + grpc.WithStreamInterceptor(grpc_retry.StreamClientInterceptor(opts...)), + grpc.WithUnaryInterceptor(grpc_retry.UnaryClientInterceptor(opts...)), + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + if err != nil { + log.Crit("Failed to connect to Heimdall gRPC", "error", err) + } + + log.Info("Connected to Heimdall gRPC server", "address", address) + return &HeimdallGRPCClient{ conn: conn, client: proto.NewHeimdallClient(conn), diff --git a/consensus/bor/heimdallgrpc/span.go b/consensus/bor/heimdallgrpc/span.go index d68c5c97a3..b5c9ddf695 100644 --- a/consensus/bor/heimdallgrpc/span.go +++ b/consensus/bor/heimdallgrpc/span.go @@ -5,6 +5,7 @@ import ( "github.com/ethereum/go-ethereum/consensus/bor/heimdall/span" "github.com/ethereum/go-ethereum/consensus/bor/valset" + "github.com/ethereum/go-ethereum/log" proto "github.com/maticnetwork/polyproto/heimdall" protoutils "github.com/maticnetwork/polyproto/utils" @@ -15,11 +16,15 @@ func (h *HeimdallGRPCClient) Span(ctx context.Context, spanID uint64) (*span.Hei ID: spanID, } + log.Info("Fetching span", "spanID", spanID) + res, err := h.client.Span(ctx, req) if err != nil { return nil, err } + log.Info("Fetched span", "spanID", spanID) + return parseSpan(res.Result), nil } diff --git a/go.mod b/go.mod index 16619adcd1..2873c84042 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0 + github.com/BurntSushi/toml v1.1.0 github.com/JekaMas/go-grpc-net-conn v0.0.0-20220708155319-6aff21f2d13d github.com/VictoriaMetrics/fastcache v1.6.0 github.com/aws/aws-sdk-go-v2 v1.2.0 @@ -31,6 +32,7 @@ require ( github.com/google/uuid v1.2.0 github.com/gorilla/websocket v1.4.2 github.com/graph-gophers/graphql-go v1.3.0 + github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/hashicorp/go-bexpr v0.1.10 github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d github.com/hashicorp/hcl/v2 v2.10.1 @@ -68,7 +70,7 @@ require ( go.uber.org/goleak v1.1.12 golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 + golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 golang.org/x/text v0.3.7 golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba golang.org/x/tools v0.1.10 @@ -84,7 +86,6 @@ require ( 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/BurntSushi/toml v1.1.0 // 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 @@ -103,7 +104,6 @@ require ( 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-kit/kit v0.9.0 // indirect github.com/go-logfmt/logfmt v0.5.0 // indirect github.com/go-ole/go-ole v1.2.1 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect @@ -132,10 +132,10 @@ require ( go.opentelemetry.io/otel/trace v1.2.0 // indirect go.opentelemetry.io/proto/otlp v0.10.0 // indirect golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect - golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect - golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect + golang.org/x/net v0.0.0-20220728030405-41545e8bf201 // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect - google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect + google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index dbb615a0f1..735d615283 100644 --- a/go.sum +++ b/go.sum @@ -188,6 +188,7 @@ github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3a github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= @@ -254,6 +255,8 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY41SORZyNJ0= github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= @@ -315,6 +318,7 @@ github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F github.com/karalabe/usb v0.0.2 h1:M6QQBNxF+CQ8OFvxrT90BA0qBOXymndZnk5q235mFc4= github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= @@ -443,6 +447,7 @@ github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1 github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -463,7 +468,6 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= @@ -486,6 +490,7 @@ github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPyS github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xsleonard/go-merkle v1.1.0 h1:fHe1fuhJjGH22ZzVTAH0jqHLhTGhOq3wQjJN+8P0jQg= github.com/xsleonard/go-merkle v1.1.0/go.mod h1:cW4z+UZ/4f2n9IJgIiyDCdYguchoDyDAPmpuOWGxdGg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= @@ -509,10 +514,12 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe go.opentelemetry.io/proto/otlp v0.10.0 h1:n7brgtEbDvXEgGyKKo8SobKT1e9FewlDtXzkVP5djoE= go.opentelemetry.io/proto/otlp v0.10.0/go.mod h1:zG20xCK0szZ1xdokeSOwEcmlXu+x9kkdRe6N1DhKcfU= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -553,6 +560,7 @@ golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCc golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= @@ -573,6 +581,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -585,8 +594,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220728030405-41545e8bf201 h1:bvOltf3SADAfG05iRml8lAB3qjoEX5RCyN4K6G5v3N0= +golang.org/x/net v0.0.0-20220728030405-41545e8bf201/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -610,6 +619,7 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -641,11 +651,12 @@ golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -686,6 +697,8 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= @@ -729,9 +742,11 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b h1:SfSkJugek6xm7lWywqth4r2iTrYLpD8lOj1nMIIhMNM= +google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -739,6 +754,7 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=