From 2ad6dcf53b14f3c1a7184533a4425b866a38295b Mon Sep 17 00:00:00 2001 From: Shivam Sharma Date: Fri, 20 Jan 2023 17:13:36 +0530 Subject: [PATCH 01/28] consensus/bor : add : devFakeAuthor flag --- consensus/bor/bor.go | 18 +++++++++++++++++- consensus/bor/valset/validator_set.go | 19 ++++++++++--------- eth/ethconfig/config.go | 10 ++++++++-- internal/cli/server/config.go | 7 +++++++ internal/cli/server/flags.go | 6 ++++++ miner/fake_miner.go | 2 +- 6 files changed, 49 insertions(+), 13 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index b6d643eeba..a920a1992d 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -227,7 +227,8 @@ type Bor struct { HeimdallClient IHeimdallClient // The fields below are for testing only - fakeDiff bool // Skip difficulty verifications + fakeDiff bool // Skip difficulty verifications + devFakeAuthor bool closeOnce sync.Once } @@ -245,6 +246,7 @@ func New( spanner Spanner, heimdallClient IHeimdallClient, genesisContracts GenesisContract, + devFakeAuthor bool, ) *Bor { // get bor config borConfig := chainConfig.Bor @@ -267,6 +269,7 @@ func New( spanner: spanner, GenesisContractsClient: genesisContracts, HeimdallClient: heimdallClient, + devFakeAuthor: devFakeAuthor, } c.authorizedSigner.Store(&signer{ @@ -480,6 +483,19 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t // nolint: gocognit func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) { // Search for a snapshot in memory or on disk for checkpoints + + signer := common.BytesToAddress(c.authorizedSigner.Load().signer.Bytes()) + if c.devFakeAuthor && signer.String() != "0x0000000000000000000000000000000000000000" { + log.Info("👨‍💻Using DevFakeAuthor", "signer", signer) + + val := valset.NewValidator(signer, 1000) + validatorset := valset.NewValidatorSet([]*valset.Validator{val}) + + snapshot := newSnapshot(c.config, c.signatures, number, hash, validatorset.Validators) + + return snapshot, nil + } + var snap *Snapshot headers := make([]*types.Header, 0, 16) diff --git a/consensus/bor/valset/validator_set.go b/consensus/bor/valset/validator_set.go index 0a6f7c4487..bfe177e2f8 100644 --- a/consensus/bor/valset/validator_set.go +++ b/consensus/bor/valset/validator_set.go @@ -305,7 +305,7 @@ func (vals *ValidatorSet) UpdateTotalVotingPower() error { // It recomputes the total voting power if required. func (vals *ValidatorSet) TotalVotingPower() int64 { if vals.totalVotingPower == 0 { - log.Info("invoking updateTotalVotingPower before returning it") + log.Debug("invoking updateTotalVotingPower before returning it") if err := vals.UpdateTotalVotingPower(); err != nil { // Can/should we do better? @@ -641,14 +641,15 @@ func (vals *ValidatorSet) UpdateValidatorMap() { // UpdateWithChangeSet attempts to update the validator set with 'changes'. // It performs the following steps: -// - validates the changes making sure there are no duplicates and splits them in updates and deletes -// - verifies that applying the changes will not result in errors -// - computes the total voting power BEFORE removals to ensure that in the next steps the priorities -// across old and newly added validators are fair -// - computes the priorities of new validators against the final set -// - applies the updates against the validator set -// - applies the removals against the validator set -// - performs scaling and centering of priority values +// - validates the changes making sure there are no duplicates and splits them in updates and deletes +// - verifies that applying the changes will not result in errors +// - computes the total voting power BEFORE removals to ensure that in the next steps the priorities +// across old and newly added validators are fair +// - computes the priorities of new validators against the final set +// - applies the updates against the validator set +// - applies the removals against the validator set +// - performs scaling and centering of priority values +// // If an error is detected during verification steps, it is returned and the validator set // is not changed. func (vals *ValidatorSet) UpdateWithChangeSet(changes []*Validator) error { diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 1265a67703..68fe9e9997 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -235,6 +235,9 @@ type Config struct { // OverrideTerminalTotalDifficulty (TODO: remove after the fork) OverrideTerminalTotalDifficulty *big.Int `toml:",omitempty"` + + // Develop Fake Author mode to produce blocks without authorisation + DevFakeAuthor bool `hcl:"devfakeauthor,optional" toml:"devfakeauthor,optional"` } // CreateConsensusEngine creates a consensus engine for the given chain configuration. @@ -255,8 +258,11 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, et spanner := span.NewChainSpanner(blockchainAPI, contract.ValidatorSet(), chainConfig, common.HexToAddress(chainConfig.Bor.ValidatorContract)) if ethConfig.WithoutHeimdall { - return bor.New(chainConfig, db, blockchainAPI, spanner, nil, genesisContractsClient) + return bor.New(chainConfig, db, blockchainAPI, spanner, nil, genesisContractsClient, ethConfig.DevFakeAuthor) } else { + if ethConfig.DevFakeAuthor { + log.Warn("Sanitizing DevFakeAuthor", "Use DevFakeAuthor with", "--bor.withoutheimdall") + } var heimdallClient bor.IHeimdallClient if ethConfig.HeimdallgRPCAddress != "" { heimdallClient = heimdallgrpc.NewHeimdallGRPCClient(ethConfig.HeimdallgRPCAddress) @@ -264,7 +270,7 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, et heimdallClient = heimdall.NewHeimdallClient(ethConfig.HeimdallURL) } - return bor.New(chainConfig, db, blockchainAPI, spanner, heimdallClient, genesisContractsClient) + return bor.New(chainConfig, db, blockchainAPI, spanner, heimdallClient, genesisContractsClient, false) } } else { switch config.PowMode { diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index 52461d9306..ce56107778 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -108,6 +108,9 @@ type Config struct { // Developer has the developer mode related settings Developer *DeveloperConfig `hcl:"developer,block" toml:"developer,block"` + + // Develop Fake Author mode to produce blocks without authorisation + DevFakeAuthor bool `hcl:"devfakeauthor,optional" toml:"devfakeauthor,optional"` } type P2PConfig struct { @@ -580,6 +583,7 @@ func DefaultConfig() *Config { Enabled: false, Period: 0, }, + DevFakeAuthor: false, } } @@ -713,6 +717,9 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (* n.RunHeimdall = c.Heimdall.RunHeimdall n.RunHeimdallArgs = c.Heimdall.RunHeimdallArgs + // Developer Fake Author for producing blocks without authorisation on bor consensus + n.DevFakeAuthor = c.DevFakeAuthor + // gas price oracle { n.GPO.Blocks = int(c.Gpo.Blocks) diff --git a/internal/cli/server/flags.go b/internal/cli/server/flags.go index e52077da97..19792a7bb1 100644 --- a/internal/cli/server/flags.go +++ b/internal/cli/server/flags.go @@ -95,6 +95,12 @@ func (c *Command) Flags() *flagset.Flagset { Value: &c.cliConfig.Heimdall.Without, Default: c.cliConfig.Heimdall.Without, }) + f.BoolFlag(&flagset.BoolFlag{ + Name: "bor.devfakeauthor", + Usage: "Run miner without validator set authorization [dev mode] : Use with '--bor.withoutheimdall'", + Value: &c.cliConfig.DevFakeAuthor, + Default: c.cliConfig.DevFakeAuthor, + }) f.StringFlag(&flagset.StringFlag{ Name: "bor.heimdallgRPC", Usage: "Address of Heimdall gRPC service", diff --git a/miner/fake_miner.go b/miner/fake_miner.go index 3ca2f5be77..a09d868b26 100644 --- a/miner/fake_miner.go +++ b/miner/fake_miner.go @@ -152,7 +152,7 @@ func NewFakeBor(t TensingObject, chainDB ethdb.Database, chainConfig *params.Cha chainConfig.Bor = params.BorUnittestChainConfig.Bor } - return bor.New(chainConfig, chainDB, ethAPIMock, spanner, heimdallClientMock, contractMock) + return bor.New(chainConfig, chainDB, ethAPIMock, spanner, heimdallClientMock, contractMock, false) } type mockBackend struct { From cb973283bcdc22429425b1ac3678f1815966a7c0 Mon Sep 17 00:00:00 2001 From: Raneet Debnath Date: Fri, 27 Jan 2023 16:05:37 +0530 Subject: [PATCH 02/28] core,eth,internal/cli,internal/ethapi: add --rpc.allow-unprotected-txs flag to allow txs to get replayed (for shadow node) --- core/tx_pool.go | 20 +++++++++++++---- core/types/transaction_signing.go | 36 +++++++++++++++++++++++++++++++ eth/backend.go | 4 +++- internal/cli/server/config.go | 12 +++++++---- internal/cli/server/flags.go | 7 ++++++ internal/ethapi/api.go | 7 +++++- 6 files changed, 76 insertions(+), 10 deletions(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index e98fd2e0ae..28a2c5bfb2 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -174,7 +174,8 @@ type TxPoolConfig struct { AccountQueue uint64 // Maximum number of non-executable transaction slots permitted per account GlobalQueue uint64 // Maximum number of non-executable transaction slots for all accounts - Lifetime time.Duration // Maximum amount of time non-executable transaction are queued + Lifetime time.Duration // Maximum amount of time non-executable transaction are queued + AllowUnprotectedTxs bool // Allow non-EIP-155 transactions } // DefaultTxPoolConfig contains the default configurations for the transaction @@ -191,7 +192,8 @@ var DefaultTxPoolConfig = TxPoolConfig{ AccountQueue: 64, GlobalQueue: 1024, - Lifetime: 3 * time.Hour, + Lifetime: 3 * time.Hour, + AllowUnprotectedTxs: false, } // sanitize checks the provided user configurations and changes anything that's @@ -759,7 +761,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { // Make sure the transaction is signed properly. from, err := types.Sender(pool.signer, tx) - if err != nil { + if err != nil && !pool.config.AllowUnprotectedTxs { return ErrInvalidSender } @@ -1096,6 +1098,11 @@ func (pool *TxPool) addTxs(txs []*types.Transaction, local, sync bool) []error { // Exclude transactions with invalid signatures as soon as // possible and cache senders in transactions before // obtaining lock + + if pool.config.AllowUnprotectedTxs { + pool.signer = types.NewFakeSigner(tx.ChainId()) + } + _, err = types.Sender(pool.signer, tx) if err != nil { errs = append(errs, ErrInvalidSender) @@ -1149,11 +1156,16 @@ func (pool *TxPool) addTx(tx *types.Transaction, local, sync bool) error { // Exclude transactions with invalid signatures as soon as // possible and cache senders in transactions before // obtaining lock + if pool.config.AllowUnprotectedTxs { + pool.signer = types.NewFakeSigner(tx.ChainId()) + } + _, err = types.Sender(pool.signer, tx) if err != nil { invalidTxMeter.Mark(1) - return + } else { + err = nil } }() diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index 959aba637a..8f3fd7a4c7 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -470,6 +470,42 @@ func (fs FrontierSigner) Hash(tx *Transaction) common.Hash { }) } +// FakeSigner implements the Signer interface and accepts unprotected transactions +type FakeSigner struct{ londonSigner } + +var _ Signer = FakeSigner{} + +func NewFakeSigner(chainId *big.Int) Signer { + signer := NewLondonSigner(chainId) + ls, _ := signer.(londonSigner) + + return FakeSigner{londonSigner: ls} +} + +func (f FakeSigner) Sender(tx *Transaction) (common.Address, error) { + return f.londonSigner.Sender(tx) +} + +func (f FakeSigner) SignatureValues(tx *Transaction, sig []byte) (r, s, v *big.Int, err error) { + return f.londonSigner.SignatureValues(tx, sig) +} + +func (f FakeSigner) ChainID() *big.Int { + return f.londonSigner.ChainID() +} + +// Hash returns 'signature hash', i.e. the transaction hash that is signed by the +// private key. This hash does not uniquely identify the transaction. +func (f FakeSigner) Hash(tx *Transaction) common.Hash { + return f.londonSigner.Hash(tx) +} + +// Equal returns true if the given signer is the same as the receiver. +func (f FakeSigner) Equal(Signer) bool { + // Always return true + return true +} + func decodeSignature(sig []byte) (r, s, v *big.Int) { if len(sig) != crypto.SignatureLength { panic(fmt.Sprintf("wrong size for signature: got %d, want %d", len(sig), crypto.SignatureLength)) diff --git a/eth/backend.go b/eth/backend.go index 824fec8914..869566a7ac 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -174,7 +174,9 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { // START: Bor changes eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil} if eth.APIBackend.allowUnprotectedTxs { - log.Info("Unprotected transactions allowed") + log.Debug(" ###########", "Unprotected transactions allowed") + + config.TxPool.AllowUnprotectedTxs = true } gpoParams := config.GPO if gpoParams.Default == nil { diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index ce56107778..67780c9423 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -254,6 +254,8 @@ type JsonRPCConfig struct { Graphql *APIConfig `hcl:"graphql,block" toml:"graphql,block"` HttpTimeout *HttpTimeouts `hcl:"timeouts,block" toml:"timeouts,block"` + + AllowUnprotectedTxs bool `hcl:"unprotectedtxs,optional" toml:"unprotectedtxs,optional"` } type GRPCConfig struct { @@ -504,10 +506,11 @@ func DefaultConfig() *Config { IgnorePrice: gasprice.DefaultIgnorePrice, }, JsonRPC: &JsonRPCConfig{ - IPCDisable: false, - IPCPath: "", - GasCap: ethconfig.Defaults.RPCGasCap, - TxFeeCap: ethconfig.Defaults.RPCTxFeeCap, + IPCDisable: false, + IPCPath: "", + GasCap: ethconfig.Defaults.RPCGasCap, + TxFeeCap: ethconfig.Defaults.RPCTxFeeCap, + AllowUnprotectedTxs: false, Http: &APIConfig{ Enabled: false, Port: 8545, @@ -1049,6 +1052,7 @@ func (c *Config) buildNode() (*node.Config, error) { InsecureUnlockAllowed: c.Accounts.AllowInsecureUnlock, Version: params.VersionWithCommit(gitCommit, gitDate), IPCPath: ipcPath, + AllowUnprotectedTxs: c.JsonRPC.AllowUnprotectedTxs, P2P: p2p.Config{ MaxPeers: int(c.P2P.MaxPeers), MaxPendingPeers: int(c.P2P.MaxPendPeers), diff --git a/internal/cli/server/flags.go b/internal/cli/server/flags.go index 19792a7bb1..a0fad2465d 100644 --- a/internal/cli/server/flags.go +++ b/internal/cli/server/flags.go @@ -364,6 +364,13 @@ func (c *Command) Flags() *flagset.Flagset { Default: c.cliConfig.JsonRPC.TxFeeCap, Group: "JsonRPC", }) + f.BoolFlag(&flagset.BoolFlag{ + Name: "rpc.allow-unprotected-txs", + Usage: "Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC", + Value: &c.cliConfig.JsonRPC.AllowUnprotectedTxs, + Default: c.cliConfig.JsonRPC.AllowUnprotectedTxs, + Group: "JsonRPC", + }) f.BoolFlag(&flagset.BoolFlag{ Name: "ipcdisable", Usage: "Disable the IPC-RPC server", diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 7df46b1f33..0f8494674f 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1856,7 +1856,8 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c // Print a log with full tx details for manual investigations and interventions signer := types.MakeSigner(b.ChainConfig(), b.CurrentBlock().Number()) from, err := types.Sender(signer, tx) - if err != nil { + + if err != nil && (!b.UnprotectedAllowed() || (b.UnprotectedAllowed() && err != types.ErrInvalidChainId)) { return common.Hash{}, err } @@ -2046,6 +2047,10 @@ func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs Transact for _, p := range pending { wantSigHash := s.signer.Hash(matchTx) pFrom, err := types.Sender(s.signer, p) + + if err != nil && (s.b.UnprotectedAllowed() && err == types.ErrInvalidChainId) { + err = nil + } if err == nil && pFrom == sendArgs.from() && s.signer.Hash(p) == wantSigHash { // Match. Re-sign and send the transaction. if gasPrice != nil && (*big.Int)(gasPrice).Sign() != 0 { From 9880d754c6244235ae339cc050d1f918098cf3e6 Mon Sep 17 00:00:00 2001 From: Pratik Patil Date: Tue, 7 Feb 2023 09:05:34 +0530 Subject: [PATCH 03/28] Added flag in Status to wait for backend, and fixed panic issue. (#708) * checking if backend is available during status call, and added a flag to wait if backend is not available * added test for status command (does not cover the whole code) --- internal/cli/debug_pprof.go | 4 +- internal/cli/server/proto/server.pb.go | 418 +++++++++++--------- internal/cli/server/proto/server.proto | 6 +- internal/cli/server/proto/server_grpc.pb.go | 16 +- internal/cli/server/service.go | 31 +- internal/cli/status.go | 22 +- internal/cli/status_test.go | 42 ++ 7 files changed, 342 insertions(+), 197 deletions(-) create mode 100644 internal/cli/status_test.go diff --git a/internal/cli/debug_pprof.go b/internal/cli/debug_pprof.go index a52c95139f..a979741fda 100644 --- a/internal/cli/debug_pprof.go +++ b/internal/cli/debug_pprof.go @@ -7,8 +7,6 @@ import ( "fmt" "strings" - empty "google.golang.org/protobuf/types/known/emptypb" - "github.com/ethereum/go-ethereum/internal/cli/flagset" "github.com/ethereum/go-ethereum/internal/cli/server/proto" ) @@ -148,7 +146,7 @@ func (d *DebugPprofCommand) Run(args []string) int { // append the status { - statusResp, err := clt.Status(ctx, &empty.Empty{}) + statusResp, err := clt.Status(ctx, &proto.StatusRequest{}) if err != nil { d.UI.Output(fmt.Sprintf("Failed to get status: %v", err)) return 1 diff --git a/internal/cli/server/proto/server.pb.go b/internal/cli/server/proto/server.pb.go index 3e928ac170..2a4919c72e 100644 --- a/internal/cli/server/proto/server.pb.go +++ b/internal/cli/server/proto/server.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.3 +// protoc-gen-go v1.28.1 +// protoc v3.21.12 // source: internal/cli/server/proto/server.proto package proto import ( - reflect "reflect" - sync "sync" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" ) const ( @@ -68,7 +67,7 @@ func (x DebugPprofRequest_Type) Number() protoreflect.EnumNumber { // Deprecated: Use DebugPprofRequest_Type.Descriptor instead. func (DebugPprofRequest_Type) EnumDescriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{18, 0} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{19, 0} } type TraceRequest struct { @@ -857,6 +856,53 @@ func (*ChainSetHeadResponse) Descriptor() ([]byte, []int) { return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{15} } +type StatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Wait bool `protobuf:"varint,1,opt,name=Wait,proto3" json:"Wait,omitempty"` +} + +func (x *StatusRequest) Reset() { + *x = StatusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusRequest) ProtoMessage() {} + +func (x *StatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_cli_server_proto_server_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. +func (*StatusRequest) Descriptor() ([]byte, []int) { + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16} +} + +func (x *StatusRequest) GetWait() bool { + if x != nil { + return x.Wait + } + return false +} + type StatusResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -873,7 +919,7 @@ type StatusResponse struct { func (x *StatusResponse) Reset() { *x = StatusResponse{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[16] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -886,7 +932,7 @@ func (x *StatusResponse) String() string { func (*StatusResponse) ProtoMessage() {} func (x *StatusResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[16] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -899,7 +945,7 @@ func (x *StatusResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead. func (*StatusResponse) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17} } func (x *StatusResponse) GetCurrentBlock() *Header { @@ -956,7 +1002,7 @@ type Header struct { func (x *Header) Reset() { *x = Header{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[17] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -969,7 +1015,7 @@ func (x *Header) String() string { func (*Header) ProtoMessage() {} func (x *Header) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[17] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -982,7 +1028,7 @@ func (x *Header) ProtoReflect() protoreflect.Message { // Deprecated: Use Header.ProtoReflect.Descriptor instead. func (*Header) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{18} } func (x *Header) GetHash() string { @@ -1012,7 +1058,7 @@ type DebugPprofRequest struct { func (x *DebugPprofRequest) Reset() { *x = DebugPprofRequest{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[18] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1025,7 +1071,7 @@ func (x *DebugPprofRequest) String() string { func (*DebugPprofRequest) ProtoMessage() {} func (x *DebugPprofRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[18] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1038,7 +1084,7 @@ func (x *DebugPprofRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DebugPprofRequest.ProtoReflect.Descriptor instead. func (*DebugPprofRequest) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{18} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{19} } func (x *DebugPprofRequest) GetType() DebugPprofRequest_Type { @@ -1073,7 +1119,7 @@ type DebugBlockRequest struct { func (x *DebugBlockRequest) Reset() { *x = DebugBlockRequest{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[19] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1086,7 +1132,7 @@ func (x *DebugBlockRequest) String() string { func (*DebugBlockRequest) ProtoMessage() {} func (x *DebugBlockRequest) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[19] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1099,7 +1145,7 @@ func (x *DebugBlockRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DebugBlockRequest.ProtoReflect.Descriptor instead. func (*DebugBlockRequest) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{19} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{20} } func (x *DebugBlockRequest) GetNumber() int64 { @@ -1115,6 +1161,7 @@ type DebugFileResponse struct { unknownFields protoimpl.UnknownFields // Types that are assignable to Event: + // // *DebugFileResponse_Open_ // *DebugFileResponse_Input_ // *DebugFileResponse_Eof @@ -1124,7 +1171,7 @@ type DebugFileResponse struct { func (x *DebugFileResponse) Reset() { *x = DebugFileResponse{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[20] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1137,7 +1184,7 @@ func (x *DebugFileResponse) String() string { func (*DebugFileResponse) ProtoMessage() {} func (x *DebugFileResponse) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[20] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1150,7 +1197,7 @@ func (x *DebugFileResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DebugFileResponse.ProtoReflect.Descriptor instead. func (*DebugFileResponse) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{20} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{21} } func (m *DebugFileResponse) GetEvent() isDebugFileResponse_Event { @@ -1216,7 +1263,7 @@ type StatusResponse_Fork struct { func (x *StatusResponse_Fork) Reset() { *x = StatusResponse_Fork{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[21] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1229,7 +1276,7 @@ func (x *StatusResponse_Fork) String() string { func (*StatusResponse_Fork) ProtoMessage() {} func (x *StatusResponse_Fork) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[21] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1242,7 +1289,7 @@ func (x *StatusResponse_Fork) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusResponse_Fork.ProtoReflect.Descriptor instead. func (*StatusResponse_Fork) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16, 0} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17, 0} } func (x *StatusResponse_Fork) GetName() string { @@ -1279,7 +1326,7 @@ type StatusResponse_Syncing struct { func (x *StatusResponse_Syncing) Reset() { *x = StatusResponse_Syncing{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[22] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1292,7 +1339,7 @@ func (x *StatusResponse_Syncing) String() string { func (*StatusResponse_Syncing) ProtoMessage() {} func (x *StatusResponse_Syncing) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[22] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1305,7 +1352,7 @@ func (x *StatusResponse_Syncing) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusResponse_Syncing.ProtoReflect.Descriptor instead. func (*StatusResponse_Syncing) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{16, 1} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{17, 1} } func (x *StatusResponse_Syncing) GetStartingBlock() int64 { @@ -1340,7 +1387,7 @@ type DebugFileResponse_Open struct { func (x *DebugFileResponse_Open) Reset() { *x = DebugFileResponse_Open{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[23] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1353,7 +1400,7 @@ func (x *DebugFileResponse_Open) String() string { func (*DebugFileResponse_Open) ProtoMessage() {} func (x *DebugFileResponse_Open) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[23] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1366,7 +1413,7 @@ func (x *DebugFileResponse_Open) ProtoReflect() protoreflect.Message { // Deprecated: Use DebugFileResponse_Open.ProtoReflect.Descriptor instead. func (*DebugFileResponse_Open) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{20, 0} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{21, 0} } func (x *DebugFileResponse_Open) GetHeaders() map[string]string { @@ -1387,7 +1434,7 @@ type DebugFileResponse_Input struct { func (x *DebugFileResponse_Input) Reset() { *x = DebugFileResponse_Input{} if protoimpl.UnsafeEnabled { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[24] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1400,7 +1447,7 @@ func (x *DebugFileResponse_Input) String() string { func (*DebugFileResponse_Input) ProtoMessage() {} func (x *DebugFileResponse_Input) ProtoReflect() protoreflect.Message { - mi := &file_internal_cli_server_proto_server_proto_msgTypes[24] + mi := &file_internal_cli_server_proto_server_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1413,7 +1460,7 @@ func (x *DebugFileResponse_Input) ProtoReflect() protoreflect.Message { // Deprecated: Use DebugFileResponse_Input.ProtoReflect.Descriptor instead. func (*DebugFileResponse_Input) Descriptor() ([]byte, []int) { - return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{20, 1} + return file_internal_cli_server_proto_server_proto_rawDescGZIP(), []int{21, 1} } func (x *DebugFileResponse_Input) GetData() []byte { @@ -1484,116 +1531,118 @@ var file_internal_cli_server_proto_server_proto_rawDesc = []byte{ 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x16, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0xe2, 0x03, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x33, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0d, 0x63, 0x75, - 0x72, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6e, - 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6e, - 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x79, 0x6e, 0x63, 0x4d, - 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x79, 0x6e, 0x63, 0x4d, - 0x6f, 0x64, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x79, 0x6e, 0x63, - 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x05, - 0x66, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x2e, 0x46, 0x6f, 0x72, 0x6b, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x6b, 0x73, 0x1a, 0x4c, - 0x0a, 0x04, 0x46, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, - 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x1a, 0x77, 0x0a, 0x07, - 0x53, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, - 0x0c, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0c, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x34, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, - 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, - 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xa2, 0x01, 0x0a, 0x11, - 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x70, 0x72, - 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x26, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, - 0x43, 0x50, 0x55, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x02, - 0x22, 0x2b, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xdd, 0x02, - 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, - 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4f, 0x70, 0x65, 0x6e, - 0x48, 0x00, 0x52, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x12, 0x36, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x48, 0x00, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, - 0x12, 0x2a, 0x0a, 0x03, 0x65, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x03, 0x65, 0x6f, 0x66, 0x1a, 0x88, 0x01, 0x0a, - 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x44, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, - 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x1b, 0x0a, 0x05, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x32, 0xdd, 0x04, - 0x0a, 0x03, 0x42, 0x6f, 0x72, 0x12, 0x3b, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, - 0x64, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, - 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x09, 0x50, 0x65, 0x65, 0x72, - 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, - 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, - 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, - 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1a, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, - 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x22, 0x23, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x57, 0x61, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x04, 0x57, 0x61, 0x69, 0x74, 0x22, 0xe2, 0x03, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x0c, 0x63, + 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x33, 0x0a, 0x0d, 0x63, + 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x08, 0x6e, 0x75, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, + 0x73, 0x79, 0x6e, 0x63, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x73, 0x79, 0x6e, 0x63, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x73, 0x79, 0x6e, 0x63, + 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x43, 0x0a, 0x0a, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x18, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, - 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0a, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x70, - 0x72, 0x6f, 0x66, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, - 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0a, 0x44, 0x65, 0x62, - 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, - 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x1c, 0x5a, - 0x1a, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x69, 0x6e, + 0x67, 0x12, 0x30, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x6f, 0x72, 0x6b, 0x52, 0x05, 0x66, 0x6f, + 0x72, 0x6b, 0x73, 0x1a, 0x4c, 0x0a, 0x04, 0x46, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x1a, 0x77, 0x0a, 0x07, 0x53, 0x79, 0x6e, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x24, 0x0a, 0x0d, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x63, 0x75, + 0x72, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x34, 0x0a, 0x06, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x22, 0xa2, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, + 0x75, 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, + 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66, + 0x69, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x26, 0x0a, + 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x4f, 0x4b, 0x55, 0x50, 0x10, + 0x00, 0x12, 0x07, 0x0a, 0x03, 0x43, 0x50, 0x55, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, + 0x41, 0x43, 0x45, 0x10, 0x02, 0x22, 0x2b, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x22, 0xdd, 0x02, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x04, 0x6f, 0x70, 0x65, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, + 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x12, 0x36, 0x0a, + 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x48, 0x00, 0x52, 0x05, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x2a, 0x0a, 0x03, 0x65, 0x6f, 0x66, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x03, 0x65, 0x6f, + 0x66, 0x1a, 0x88, 0x01, 0x0a, 0x04, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x44, 0x0a, 0x07, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x1b, 0x0a, 0x05, + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x32, 0xdb, 0x04, 0x0a, 0x03, 0x42, 0x6f, 0x72, 0x12, 0x3b, 0x0a, 0x08, 0x50, 0x65, + 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, + 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x41, 0x64, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, + 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, + 0x09, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, + 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, + 0x0b, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x48, + 0x65, 0x61, 0x64, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x53, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, + 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x06, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, + 0x68, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, + 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0a, 0x44, 0x65, 0x62, 0x75, + 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, + 0x65, 0x62, 0x75, 0x67, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x46, 0x69, + 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0a, + 0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x62, + 0x75, 0x67, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, + 0x42, 0x1c, 0x5a, 0x1a, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6c, + 0x69, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1609,7 +1658,7 @@ func file_internal_cli_server_proto_server_proto_rawDescGZIP() []byte { } var file_internal_cli_server_proto_server_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_internal_cli_server_proto_server_proto_msgTypes = make([]protoimpl.MessageInfo, 26) +var file_internal_cli_server_proto_server_proto_msgTypes = make([]protoimpl.MessageInfo, 27) var file_internal_cli_server_proto_server_proto_goTypes = []interface{}{ (DebugPprofRequest_Type)(0), // 0: proto.DebugPprofRequest.Type (*TraceRequest)(nil), // 1: proto.TraceRequest @@ -1628,50 +1677,51 @@ var file_internal_cli_server_proto_server_proto_goTypes = []interface{}{ (*Peer)(nil), // 14: proto.Peer (*ChainSetHeadRequest)(nil), // 15: proto.ChainSetHeadRequest (*ChainSetHeadResponse)(nil), // 16: proto.ChainSetHeadResponse - (*StatusResponse)(nil), // 17: proto.StatusResponse - (*Header)(nil), // 18: proto.Header - (*DebugPprofRequest)(nil), // 19: proto.DebugPprofRequest - (*DebugBlockRequest)(nil), // 20: proto.DebugBlockRequest - (*DebugFileResponse)(nil), // 21: proto.DebugFileResponse - (*StatusResponse_Fork)(nil), // 22: proto.StatusResponse.Fork - (*StatusResponse_Syncing)(nil), // 23: proto.StatusResponse.Syncing - (*DebugFileResponse_Open)(nil), // 24: proto.DebugFileResponse.Open - (*DebugFileResponse_Input)(nil), // 25: proto.DebugFileResponse.Input - nil, // 26: proto.DebugFileResponse.Open.HeadersEntry - (*emptypb.Empty)(nil), // 27: google.protobuf.Empty + (*StatusRequest)(nil), // 17: proto.StatusRequest + (*StatusResponse)(nil), // 18: proto.StatusResponse + (*Header)(nil), // 19: proto.Header + (*DebugPprofRequest)(nil), // 20: proto.DebugPprofRequest + (*DebugBlockRequest)(nil), // 21: proto.DebugBlockRequest + (*DebugFileResponse)(nil), // 22: proto.DebugFileResponse + (*StatusResponse_Fork)(nil), // 23: proto.StatusResponse.Fork + (*StatusResponse_Syncing)(nil), // 24: proto.StatusResponse.Syncing + (*DebugFileResponse_Open)(nil), // 25: proto.DebugFileResponse.Open + (*DebugFileResponse_Input)(nil), // 26: proto.DebugFileResponse.Input + nil, // 27: proto.DebugFileResponse.Open.HeadersEntry + (*emptypb.Empty)(nil), // 28: google.protobuf.Empty } var file_internal_cli_server_proto_server_proto_depIdxs = []int32{ 5, // 0: proto.ChainWatchResponse.oldchain:type_name -> proto.BlockStub 5, // 1: proto.ChainWatchResponse.newchain:type_name -> proto.BlockStub 14, // 2: proto.PeersListResponse.peers:type_name -> proto.Peer 14, // 3: proto.PeersStatusResponse.peer:type_name -> proto.Peer - 18, // 4: proto.StatusResponse.currentBlock:type_name -> proto.Header - 18, // 5: proto.StatusResponse.currentHeader:type_name -> proto.Header - 23, // 6: proto.StatusResponse.syncing:type_name -> proto.StatusResponse.Syncing - 22, // 7: proto.StatusResponse.forks:type_name -> proto.StatusResponse.Fork + 19, // 4: proto.StatusResponse.currentBlock:type_name -> proto.Header + 19, // 5: proto.StatusResponse.currentHeader:type_name -> proto.Header + 24, // 6: proto.StatusResponse.syncing:type_name -> proto.StatusResponse.Syncing + 23, // 7: proto.StatusResponse.forks:type_name -> proto.StatusResponse.Fork 0, // 8: proto.DebugPprofRequest.type:type_name -> proto.DebugPprofRequest.Type - 24, // 9: proto.DebugFileResponse.open:type_name -> proto.DebugFileResponse.Open - 25, // 10: proto.DebugFileResponse.input:type_name -> proto.DebugFileResponse.Input - 27, // 11: proto.DebugFileResponse.eof:type_name -> google.protobuf.Empty - 26, // 12: proto.DebugFileResponse.Open.headers:type_name -> proto.DebugFileResponse.Open.HeadersEntry + 25, // 9: proto.DebugFileResponse.open:type_name -> proto.DebugFileResponse.Open + 26, // 10: proto.DebugFileResponse.input:type_name -> proto.DebugFileResponse.Input + 28, // 11: proto.DebugFileResponse.eof:type_name -> google.protobuf.Empty + 27, // 12: proto.DebugFileResponse.Open.headers:type_name -> proto.DebugFileResponse.Open.HeadersEntry 6, // 13: proto.Bor.PeersAdd:input_type -> proto.PeersAddRequest 8, // 14: proto.Bor.PeersRemove:input_type -> proto.PeersRemoveRequest 10, // 15: proto.Bor.PeersList:input_type -> proto.PeersListRequest 12, // 16: proto.Bor.PeersStatus:input_type -> proto.PeersStatusRequest 15, // 17: proto.Bor.ChainSetHead:input_type -> proto.ChainSetHeadRequest - 27, // 18: proto.Bor.Status:input_type -> google.protobuf.Empty + 17, // 18: proto.Bor.Status:input_type -> proto.StatusRequest 3, // 19: proto.Bor.ChainWatch:input_type -> proto.ChainWatchRequest - 19, // 20: proto.Bor.DebugPprof:input_type -> proto.DebugPprofRequest - 20, // 21: proto.Bor.DebugBlock:input_type -> proto.DebugBlockRequest + 20, // 20: proto.Bor.DebugPprof:input_type -> proto.DebugPprofRequest + 21, // 21: proto.Bor.DebugBlock:input_type -> proto.DebugBlockRequest 7, // 22: proto.Bor.PeersAdd:output_type -> proto.PeersAddResponse 9, // 23: proto.Bor.PeersRemove:output_type -> proto.PeersRemoveResponse 11, // 24: proto.Bor.PeersList:output_type -> proto.PeersListResponse 13, // 25: proto.Bor.PeersStatus:output_type -> proto.PeersStatusResponse 16, // 26: proto.Bor.ChainSetHead:output_type -> proto.ChainSetHeadResponse - 17, // 27: proto.Bor.Status:output_type -> proto.StatusResponse + 18, // 27: proto.Bor.Status:output_type -> proto.StatusResponse 4, // 28: proto.Bor.ChainWatch:output_type -> proto.ChainWatchResponse - 21, // 29: proto.Bor.DebugPprof:output_type -> proto.DebugFileResponse - 21, // 30: proto.Bor.DebugBlock:output_type -> proto.DebugFileResponse + 22, // 29: proto.Bor.DebugPprof:output_type -> proto.DebugFileResponse + 22, // 30: proto.Bor.DebugBlock:output_type -> proto.DebugFileResponse 22, // [22:31] is the sub-list for method output_type 13, // [13:22] is the sub-list for method input_type 13, // [13:13] is the sub-list for extension type_name @@ -1878,7 +1928,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusResponse); i { + switch v := v.(*StatusRequest); i { case 0: return &v.state case 1: @@ -1890,7 +1940,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Header); i { + switch v := v.(*StatusResponse); i { case 0: return &v.state case 1: @@ -1902,7 +1952,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DebugPprofRequest); i { + switch v := v.(*Header); i { case 0: return &v.state case 1: @@ -1914,7 +1964,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DebugBlockRequest); i { + switch v := v.(*DebugPprofRequest); i { case 0: return &v.state case 1: @@ -1926,7 +1976,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DebugFileResponse); i { + switch v := v.(*DebugBlockRequest); i { case 0: return &v.state case 1: @@ -1938,7 +1988,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusResponse_Fork); i { + switch v := v.(*DebugFileResponse); i { case 0: return &v.state case 1: @@ -1950,7 +2000,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusResponse_Syncing); i { + switch v := v.(*StatusResponse_Fork); i { case 0: return &v.state case 1: @@ -1962,7 +2012,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DebugFileResponse_Open); i { + switch v := v.(*StatusResponse_Syncing); i { case 0: return &v.state case 1: @@ -1974,6 +2024,18 @@ func file_internal_cli_server_proto_server_proto_init() { } } file_internal_cli_server_proto_server_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DebugFileResponse_Open); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_cli_server_proto_server_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DebugFileResponse_Input); i { case 0: return &v.state @@ -1986,7 +2048,7 @@ func file_internal_cli_server_proto_server_proto_init() { } } } - file_internal_cli_server_proto_server_proto_msgTypes[20].OneofWrappers = []interface{}{ + file_internal_cli_server_proto_server_proto_msgTypes[21].OneofWrappers = []interface{}{ (*DebugFileResponse_Open_)(nil), (*DebugFileResponse_Input_)(nil), (*DebugFileResponse_Eof)(nil), @@ -1997,7 +2059,7 @@ func file_internal_cli_server_proto_server_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_internal_cli_server_proto_server_proto_rawDesc, NumEnums: 1, - NumMessages: 26, + NumMessages: 27, NumExtensions: 0, NumServices: 1, }, diff --git a/internal/cli/server/proto/server.proto b/internal/cli/server/proto/server.proto index 1520ab6536..fce787b1db 100644 --- a/internal/cli/server/proto/server.proto +++ b/internal/cli/server/proto/server.proto @@ -17,7 +17,7 @@ service Bor { rpc ChainSetHead(ChainSetHeadRequest) returns (ChainSetHeadResponse); - rpc Status(google.protobuf.Empty) returns (StatusResponse); + rpc Status(StatusRequest) returns (StatusResponse); rpc ChainWatch(ChainWatchRequest) returns (stream ChainWatchResponse); @@ -97,6 +97,10 @@ message ChainSetHeadRequest { message ChainSetHeadResponse { } +message StatusRequest { + bool Wait = 1; +} + message StatusResponse { Header currentBlock = 1; Header currentHeader = 2; diff --git a/internal/cli/server/proto/server_grpc.pb.go b/internal/cli/server/proto/server_grpc.pb.go index bd4ecb660d..a34b6fe557 100644 --- a/internal/cli/server/proto/server_grpc.pb.go +++ b/internal/cli/server/proto/server_grpc.pb.go @@ -1,18 +1,16 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.19.3 +// - protoc v3.21.12 // source: internal/cli/server/proto/server.proto package proto import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - emptypb "google.golang.org/protobuf/types/known/emptypb" ) // This is a compile-time assertion to ensure that this generated file @@ -29,7 +27,7 @@ type BorClient interface { PeersList(ctx context.Context, in *PeersListRequest, opts ...grpc.CallOption) (*PeersListResponse, error) PeersStatus(ctx context.Context, in *PeersStatusRequest, opts ...grpc.CallOption) (*PeersStatusResponse, error) ChainSetHead(ctx context.Context, in *ChainSetHeadRequest, opts ...grpc.CallOption) (*ChainSetHeadResponse, error) - Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StatusResponse, error) + Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) ChainWatch(ctx context.Context, in *ChainWatchRequest, opts ...grpc.CallOption) (Bor_ChainWatchClient, error) DebugPprof(ctx context.Context, in *DebugPprofRequest, opts ...grpc.CallOption) (Bor_DebugPprofClient, error) DebugBlock(ctx context.Context, in *DebugBlockRequest, opts ...grpc.CallOption) (Bor_DebugBlockClient, error) @@ -88,7 +86,7 @@ func (c *borClient) ChainSetHead(ctx context.Context, in *ChainSetHeadRequest, o return out, nil } -func (c *borClient) Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StatusResponse, error) { +func (c *borClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { out := new(StatusResponse) err := c.cc.Invoke(ctx, "/proto.Bor/Status", in, out, opts...) if err != nil { @@ -202,7 +200,7 @@ type BorServer interface { PeersList(context.Context, *PeersListRequest) (*PeersListResponse, error) PeersStatus(context.Context, *PeersStatusRequest) (*PeersStatusResponse, error) ChainSetHead(context.Context, *ChainSetHeadRequest) (*ChainSetHeadResponse, error) - Status(context.Context, *emptypb.Empty) (*StatusResponse, error) + Status(context.Context, *StatusRequest) (*StatusResponse, error) ChainWatch(*ChainWatchRequest, Bor_ChainWatchServer) error DebugPprof(*DebugPprofRequest, Bor_DebugPprofServer) error DebugBlock(*DebugBlockRequest, Bor_DebugBlockServer) error @@ -228,7 +226,7 @@ func (UnimplementedBorServer) PeersStatus(context.Context, *PeersStatusRequest) func (UnimplementedBorServer) ChainSetHead(context.Context, *ChainSetHeadRequest) (*ChainSetHeadResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChainSetHead not implemented") } -func (UnimplementedBorServer) Status(context.Context, *emptypb.Empty) (*StatusResponse, error) { +func (UnimplementedBorServer) Status(context.Context, *StatusRequest) (*StatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") } func (UnimplementedBorServer) ChainWatch(*ChainWatchRequest, Bor_ChainWatchServer) error { @@ -344,7 +342,7 @@ func _Bor_ChainSetHead_Handler(srv interface{}, ctx context.Context, dec func(in } func _Bor_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) + in := new(StatusRequest) if err := dec(in); err != nil { return nil, err } @@ -356,7 +354,7 @@ func _Bor_Status_Handler(srv interface{}, ctx context.Context, dec func(interfac FullMethod: "/proto.Bor/Status", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BorServer).Status(ctx, req.(*emptypb.Empty)) + return srv.(BorServer).Status(ctx, req.(*StatusRequest)) } return interceptor(ctx, in, info, handler) } diff --git a/internal/cli/server/service.go b/internal/cli/server/service.go index 37c1dc802f..1d530de10b 100644 --- a/internal/cli/server/service.go +++ b/internal/cli/server/service.go @@ -3,13 +3,14 @@ package server import ( "context" "encoding/json" + "errors" "fmt" "math/big" "reflect" "strings" + "time" grpc_net_conn "github.com/JekaMas/go-grpc-net-conn" - empty "google.golang.org/protobuf/types/known/emptypb" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" @@ -23,6 +24,9 @@ import ( const chunkSize = 1024 * 1024 * 1024 +var ErrUnavailable = errors.New("bor service is currently unavailable, try again later") +var ErrUnavailable2 = errors.New("bor service unavailable even after waiting for 10 seconds, make sure bor is running") + func sendStreamDebugFile(stream proto.Bor_DebugPprofServer, headers map[string]string, data []byte) error { // open the stream and send the headers err := stream.Send(&proto.DebugFileResponse{ @@ -164,7 +168,30 @@ func (s *Server) ChainSetHead(ctx context.Context, req *proto.ChainSetHeadReques return &proto.ChainSetHeadResponse{}, nil } -func (s *Server) Status(ctx context.Context, _ *empty.Empty) (*proto.StatusResponse, error) { +func (s *Server) Status(ctx context.Context, in *proto.StatusRequest) (*proto.StatusResponse, error) { + if s.backend == nil && !in.Wait { + return nil, ErrUnavailable + } + + // check for s.backend at an interval of 2 seconds + // wait for a maximum of 10 seconds (5 iterations) + if s.backend == nil && in.Wait { + i := 1 + + for { + time.Sleep(2 * time.Second) + + if s.backend == nil { + if i == 5 { + return nil, ErrUnavailable2 + } + } else { + break + } + i++ + } + } + apiBackend := s.backend.APIBackend syncProgress := apiBackend.SyncProgress() diff --git a/internal/cli/status.go b/internal/cli/status.go index 05e0313872..63386d9680 100644 --- a/internal/cli/status.go +++ b/internal/cli/status.go @@ -5,14 +5,28 @@ import ( "fmt" "strings" + "github.com/ethereum/go-ethereum/internal/cli/flagset" "github.com/ethereum/go-ethereum/internal/cli/server/proto" - - empty "google.golang.org/protobuf/types/known/emptypb" ) // StatusCommand is the command to output the status of the client type StatusCommand struct { *Meta2 + + wait bool +} + +func (c *StatusCommand) Flags() *flagset.Flagset { + flags := c.NewFlagSet("status") + + flags.BoolFlag(&flagset.BoolFlag{ + Name: "w", + Value: &c.wait, + Usage: "wait for Bor node to be available", + Default: false, + }) + + return flags } // MarkDown implements cli.MarkDown interface @@ -39,7 +53,7 @@ func (c *StatusCommand) Synopsis() string { // Run implements the cli.Command interface func (c *StatusCommand) Run(args []string) int { - flags := c.NewFlagSet("status") + flags := c.Flags() if err := flags.Parse(args); err != nil { c.UI.Error(err.Error()) return 1 @@ -51,7 +65,7 @@ func (c *StatusCommand) Run(args []string) int { return 1 } - status, err := borClt.Status(context.Background(), &empty.Empty{}) + status, err := borClt.Status(context.Background(), &proto.StatusRequest{Wait: c.wait}) if err != nil { c.UI.Error(err.Error()) return 1 diff --git a/internal/cli/status_test.go b/internal/cli/status_test.go new file mode 100644 index 0000000000..f45e050da8 --- /dev/null +++ b/internal/cli/status_test.go @@ -0,0 +1,42 @@ +package cli + +import ( + "testing" + + "github.com/mitchellh/cli" + "github.com/stretchr/testify/require" + + "github.com/ethereum/go-ethereum/internal/cli/server" +) + +func TestStatusCommand(t *testing.T) { + t.Parallel() + + // Start a blockchain in developer + config := server.DefaultConfig() + + // enable developer mode + config.Developer.Enabled = true + config.Developer.Period = 2 + + // start the mock server + srv, err := server.CreateMockServer(config) + require.NoError(t, err) + + defer server.CloseMockServer(srv) + + // get the grpc port + port := srv.GetGrpcAddr() + + command1 := &StatusCommand{ + Meta2: &Meta2{ + UI: cli.NewMockUi(), + addr: "127.0.0.1:" + port, + }, + wait: true, + } + + status := command1.Run([]string{"-w", "--address", command1.Meta2.addr}) + + require.Equal(t, 0, status) +} From c6d7f59c8bad22e51cd46be2d58f8c5c164a5b3b Mon Sep 17 00:00:00 2001 From: ephess Date: Tue, 7 Feb 2023 20:24:21 +1100 Subject: [PATCH 04/28] Revert "Reduce txArriveTimeout to 100ms" (#707) This reverts commit 243d231fe45bc02f33678bb4f69e941167d7f466. --- eth/fetcher/tx_fetcher.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/fetcher/tx_fetcher.go b/eth/fetcher/tx_fetcher.go index 8b97746b14..b10c0db9ee 100644 --- a/eth/fetcher/tx_fetcher.go +++ b/eth/fetcher/tx_fetcher.go @@ -55,11 +55,11 @@ const ( // txArriveTimeout is the time allowance before an announced transaction is // explicitly requested. - txArriveTimeout = 100 * time.Millisecond + txArriveTimeout = 500 * time.Millisecond // txGatherSlack is the interval used to collate almost-expired announces // with network fetches. - txGatherSlack = 20 * time.Millisecond + txGatherSlack = 100 * time.Millisecond ) var ( From a4f1ac15002722bf02bf32648f232dd44057d66d Mon Sep 17 00:00:00 2001 From: SHIVAM SHARMA Date: Thu, 9 Feb 2023 12:10:32 +0530 Subject: [PATCH 05/28] consensus/bor : add : devFakeAuthor flag (#697) --- consensus/bor/bor.go | 18 +++++++++++++++++- consensus/bor/valset/validator_set.go | 19 ++++++++++--------- eth/ethconfig/config.go | 10 ++++++++-- internal/cli/server/config.go | 7 +++++++ internal/cli/server/flags.go | 6 ++++++ miner/fake_miner.go | 2 +- 6 files changed, 49 insertions(+), 13 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index b6d643eeba..a920a1992d 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -227,7 +227,8 @@ type Bor struct { HeimdallClient IHeimdallClient // The fields below are for testing only - fakeDiff bool // Skip difficulty verifications + fakeDiff bool // Skip difficulty verifications + devFakeAuthor bool closeOnce sync.Once } @@ -245,6 +246,7 @@ func New( spanner Spanner, heimdallClient IHeimdallClient, genesisContracts GenesisContract, + devFakeAuthor bool, ) *Bor { // get bor config borConfig := chainConfig.Bor @@ -267,6 +269,7 @@ func New( spanner: spanner, GenesisContractsClient: genesisContracts, HeimdallClient: heimdallClient, + devFakeAuthor: devFakeAuthor, } c.authorizedSigner.Store(&signer{ @@ -480,6 +483,19 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t // nolint: gocognit func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) { // Search for a snapshot in memory or on disk for checkpoints + + signer := common.BytesToAddress(c.authorizedSigner.Load().signer.Bytes()) + if c.devFakeAuthor && signer.String() != "0x0000000000000000000000000000000000000000" { + log.Info("👨‍💻Using DevFakeAuthor", "signer", signer) + + val := valset.NewValidator(signer, 1000) + validatorset := valset.NewValidatorSet([]*valset.Validator{val}) + + snapshot := newSnapshot(c.config, c.signatures, number, hash, validatorset.Validators) + + return snapshot, nil + } + var snap *Snapshot headers := make([]*types.Header, 0, 16) diff --git a/consensus/bor/valset/validator_set.go b/consensus/bor/valset/validator_set.go index 0a6f7c4487..bfe177e2f8 100644 --- a/consensus/bor/valset/validator_set.go +++ b/consensus/bor/valset/validator_set.go @@ -305,7 +305,7 @@ func (vals *ValidatorSet) UpdateTotalVotingPower() error { // It recomputes the total voting power if required. func (vals *ValidatorSet) TotalVotingPower() int64 { if vals.totalVotingPower == 0 { - log.Info("invoking updateTotalVotingPower before returning it") + log.Debug("invoking updateTotalVotingPower before returning it") if err := vals.UpdateTotalVotingPower(); err != nil { // Can/should we do better? @@ -641,14 +641,15 @@ func (vals *ValidatorSet) UpdateValidatorMap() { // UpdateWithChangeSet attempts to update the validator set with 'changes'. // It performs the following steps: -// - validates the changes making sure there are no duplicates and splits them in updates and deletes -// - verifies that applying the changes will not result in errors -// - computes the total voting power BEFORE removals to ensure that in the next steps the priorities -// across old and newly added validators are fair -// - computes the priorities of new validators against the final set -// - applies the updates against the validator set -// - applies the removals against the validator set -// - performs scaling and centering of priority values +// - validates the changes making sure there are no duplicates and splits them in updates and deletes +// - verifies that applying the changes will not result in errors +// - computes the total voting power BEFORE removals to ensure that in the next steps the priorities +// across old and newly added validators are fair +// - computes the priorities of new validators against the final set +// - applies the updates against the validator set +// - applies the removals against the validator set +// - performs scaling and centering of priority values +// // If an error is detected during verification steps, it is returned and the validator set // is not changed. func (vals *ValidatorSet) UpdateWithChangeSet(changes []*Validator) error { diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 1265a67703..68fe9e9997 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -235,6 +235,9 @@ type Config struct { // OverrideTerminalTotalDifficulty (TODO: remove after the fork) OverrideTerminalTotalDifficulty *big.Int `toml:",omitempty"` + + // Develop Fake Author mode to produce blocks without authorisation + DevFakeAuthor bool `hcl:"devfakeauthor,optional" toml:"devfakeauthor,optional"` } // CreateConsensusEngine creates a consensus engine for the given chain configuration. @@ -255,8 +258,11 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, et spanner := span.NewChainSpanner(blockchainAPI, contract.ValidatorSet(), chainConfig, common.HexToAddress(chainConfig.Bor.ValidatorContract)) if ethConfig.WithoutHeimdall { - return bor.New(chainConfig, db, blockchainAPI, spanner, nil, genesisContractsClient) + return bor.New(chainConfig, db, blockchainAPI, spanner, nil, genesisContractsClient, ethConfig.DevFakeAuthor) } else { + if ethConfig.DevFakeAuthor { + log.Warn("Sanitizing DevFakeAuthor", "Use DevFakeAuthor with", "--bor.withoutheimdall") + } var heimdallClient bor.IHeimdallClient if ethConfig.HeimdallgRPCAddress != "" { heimdallClient = heimdallgrpc.NewHeimdallGRPCClient(ethConfig.HeimdallgRPCAddress) @@ -264,7 +270,7 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, et heimdallClient = heimdall.NewHeimdallClient(ethConfig.HeimdallURL) } - return bor.New(chainConfig, db, blockchainAPI, spanner, heimdallClient, genesisContractsClient) + return bor.New(chainConfig, db, blockchainAPI, spanner, heimdallClient, genesisContractsClient, false) } } else { switch config.PowMode { diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index 52461d9306..ce56107778 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -108,6 +108,9 @@ type Config struct { // Developer has the developer mode related settings Developer *DeveloperConfig `hcl:"developer,block" toml:"developer,block"` + + // Develop Fake Author mode to produce blocks without authorisation + DevFakeAuthor bool `hcl:"devfakeauthor,optional" toml:"devfakeauthor,optional"` } type P2PConfig struct { @@ -580,6 +583,7 @@ func DefaultConfig() *Config { Enabled: false, Period: 0, }, + DevFakeAuthor: false, } } @@ -713,6 +717,9 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (* n.RunHeimdall = c.Heimdall.RunHeimdall n.RunHeimdallArgs = c.Heimdall.RunHeimdallArgs + // Developer Fake Author for producing blocks without authorisation on bor consensus + n.DevFakeAuthor = c.DevFakeAuthor + // gas price oracle { n.GPO.Blocks = int(c.Gpo.Blocks) diff --git a/internal/cli/server/flags.go b/internal/cli/server/flags.go index e52077da97..19792a7bb1 100644 --- a/internal/cli/server/flags.go +++ b/internal/cli/server/flags.go @@ -95,6 +95,12 @@ func (c *Command) Flags() *flagset.Flagset { Value: &c.cliConfig.Heimdall.Without, Default: c.cliConfig.Heimdall.Without, }) + f.BoolFlag(&flagset.BoolFlag{ + Name: "bor.devfakeauthor", + Usage: "Run miner without validator set authorization [dev mode] : Use with '--bor.withoutheimdall'", + Value: &c.cliConfig.DevFakeAuthor, + Default: c.cliConfig.DevFakeAuthor, + }) f.StringFlag(&flagset.StringFlag{ Name: "bor.heimdallgRPC", Usage: "Address of Heimdall gRPC service", diff --git a/miner/fake_miner.go b/miner/fake_miner.go index 3ca2f5be77..a09d868b26 100644 --- a/miner/fake_miner.go +++ b/miner/fake_miner.go @@ -152,7 +152,7 @@ func NewFakeBor(t TensingObject, chainDB ethdb.Database, chainConfig *params.Cha chainConfig.Bor = params.BorUnittestChainConfig.Bor } - return bor.New(chainConfig, chainDB, ethAPIMock, spanner, heimdallClientMock, contractMock) + return bor.New(chainConfig, chainDB, ethAPIMock, spanner, heimdallClientMock, contractMock, false) } type mockBackend struct { From c46aae23daf0a1a172e08f97dcf2d7159e33eae5 Mon Sep 17 00:00:00 2001 From: Evgeny Danilenko <6655321@bk.ru> Date: Thu, 9 Feb 2023 11:07:44 +0400 Subject: [PATCH 06/28] add check for empty lists in txpool (#704) * add check * linters --- core/tx_list.go | 8 ++++++-- core/tx_pool.go | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/tx_list.go b/core/tx_list.go index e763777e33..fea4434b9b 100644 --- a/core/tx_list.go +++ b/core/tx_list.go @@ -351,9 +351,8 @@ func (m *txSortedMap) lastElement() *types.Transaction { m.cacheMu.Unlock() - cache = make(types.Transactions, 0, len(m.items)) - m.m.RLock() + cache = make(types.Transactions, 0, len(m.items)) for _, tx := range m.items { cache = append(cache, tx) @@ -373,6 +372,11 @@ func (m *txSortedMap) lastElement() *types.Transaction { hitCacheCounter.Inc(1) } + ln := len(cache) + if ln == 0 { + return nil + } + return cache[len(cache)-1] } diff --git a/core/tx_pool.go b/core/tx_pool.go index e98fd2e0ae..a3a10e7023 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -1539,6 +1539,7 @@ func (pool *TxPool) runReorg(ctx context.Context, done chan struct{}, reset *txp // remove any transaction that has been included in the block or was invalidated // because of another transaction (e.g. higher gas price). + //nolint:nestif if reset != nil { tracing.ElapsedTime(ctx, span, "new block", func(_ context.Context, innerSpan trace.Span) { @@ -1573,7 +1574,9 @@ func (pool *TxPool) runReorg(ctx context.Context, done chan struct{}, reset *txp tracing.ElapsedTime(ctx, innerSpan, "09 fill nonces", func(_ context.Context, innerSpan trace.Span) { for addr, list := range pool.pending { highestPending = list.LastElement() - nonces[addr] = highestPending.Nonce() + 1 + if highestPending != nil { + nonces[addr] = highestPending.Nonce() + 1 + } } }) From ad936ed3fc42acc540257fac4b2e521d3394c26f Mon Sep 17 00:00:00 2001 From: marcello33 Date: Thu, 9 Feb 2023 10:04:29 +0100 Subject: [PATCH 07/28] dev: chg: POS-215 move sonarqube to own ci (#733) --- .github/workflows/security-ci.yml | 26 ----------------- .github/workflows/security-sonarqube-ci.yml | 32 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/security-sonarqube-ci.yml diff --git a/.github/workflows/security-ci.yml b/.github/workflows/security-ci.yml index c85675a30b..a0237116d9 100644 --- a/.github/workflows/security-ci.yml +++ b/.github/workflows/security-ci.yml @@ -62,29 +62,3 @@ jobs: with: name: raw-report path: raw-report.json - - sonarqube: - name: SonarQube - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # Disabling shallow clone is recommended for improving relevancy of reporting. - fetch-depth: 0 - - # Triggering SonarQube analysis as results of it are required by Quality Gate check. - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - - # Check the Quality Gate status. - - name: SonarQube Quality Gate check - id: sonarqube-quality-gate-check - uses: sonarsource/sonarqube-quality-gate-action@master - # Force to fail step after specific time. - timeout-minutes: 5 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} diff --git a/.github/workflows/security-sonarqube-ci.yml b/.github/workflows/security-sonarqube-ci.yml new file mode 100644 index 0000000000..5a1afcbede --- /dev/null +++ b/.github/workflows/security-sonarqube-ci.yml @@ -0,0 +1,32 @@ +name: SonarQube CI +on: + push: + branches: + - develop + +jobs: + sonarqube: + name: SonarQube + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting. + fetch-depth: 0 + + # Triggering SonarQube analysis as results of it are required by Quality Gate check. + - name: SonarQube Scan + uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + + # Check the Quality Gate status. + - name: SonarQube Quality Gate check + id: sonarqube-quality-gate-check + uses: sonarsource/sonarqube-quality-gate-action@master + # Force to fail step after specific time. + timeout-minutes: 5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} From c4f33329ea2c692aa37a3b85ad30ce3168820695 Mon Sep 17 00:00:00 2001 From: Pratik Patil Date: Fri, 10 Feb 2023 08:49:32 +0530 Subject: [PATCH 08/28] Added verbosity flag, supports log-level as well, but will remove that in future. (#722) * changed log-level flag back to verbosity, and updated the conversion script * supporting both verbosity and log-level, with a message to deprecat log-level * converted verbosity to a int value --- builder/files/config.toml | 4 +-- docs/cli/bootnode.md | 4 ++- docs/cli/example_config.toml | 2 +- docs/cli/server.md | 8 +++++- internal/cli/bootnode.go | 23 +++++++++++++-- internal/cli/server/command.go | 27 ++++++++++++++++++ internal/cli/server/config.go | 6 +++- internal/cli/server/flags.go | 8 +++++- internal/cli/server/server.go | 28 ++++++++++++++++++- .../templates/mainnet-v1/archive/config.toml | 2 +- .../mainnet-v1/sentry/sentry/bor/config.toml | 2 +- .../sentry/validator/bor/config.toml | 2 +- .../mainnet-v1/without-sentry/bor/config.toml | 2 +- .../templates/testnet-v4/archive/config.toml | 2 +- .../testnet-v4/sentry/sentry/bor/config.toml | 2 +- .../sentry/validator/bor/config.toml | 2 +- .../testnet-v4/without-sentry/bor/config.toml | 2 +- scripts/getconfig.go | 8 +++--- 18 files changed, 112 insertions(+), 22 deletions(-) diff --git a/builder/files/config.toml b/builder/files/config.toml index 0f2919807f..215acc5612 100644 --- a/builder/files/config.toml +++ b/builder/files/config.toml @@ -3,8 +3,8 @@ chain = "mainnet" # chain = "mumbai" -# identity = "Pratiks-MacBook-Pro.local" -# log-level = "INFO" +# identity = "Annon-Identity" +# verbosity = 3 datadir = "/var/lib/bor/data" # ancient = "" # keystore = "/var/lib/bor/keystore" diff --git a/docs/cli/bootnode.md b/docs/cli/bootnode.md index 064de39014..e4111160a0 100644 --- a/docs/cli/bootnode.md +++ b/docs/cli/bootnode.md @@ -6,7 +6,9 @@ - ```v5```: Enable UDP v5 (default: false) -- ```log-level```: Log level (trace|debug|info|warn|error|crit) (default: info) +- ```verbosity```: Logging verbosity (5=trace|4=debug|3=info|2=warn|1=error|0=crit) (default: 3) + +- ```log-level```: log level (trace|debug|info|warn|error|crit), will be deprecated soon. Use verbosity instead (default: info) - ```nat```: port mapping mechanism (any|none|upnp|pmp|extip:) (default: none) diff --git a/docs/cli/example_config.toml b/docs/cli/example_config.toml index 64ef60ae12..9ed37da92d 100644 --- a/docs/cli/example_config.toml +++ b/docs/cli/example_config.toml @@ -4,7 +4,7 @@ chain = "mainnet" # Name of the chain to sync ("mumbai", "mainnet") or path to a genesis file identity = "Annon-Identity" # Name/Identity of the node (default = OS hostname) -log-level = "INFO" # Set log level for the server +verbosity = 3 # Logging verbosity for the server (5=trace|4=debug|3=info|2=warn|1=error|0=crit) (`log-level` was replaced by `verbosity`, and thus will be deprecated soon) datadir = "var/lib/bor" # Path of the data directory to store information ancient = "" # Data directory for ancient chain segments (default = inside chaindata) keystore = "" # Path of the directory where keystores are located diff --git a/docs/cli/server.md b/docs/cli/server.md index 5bc0ff1024..49c7114781 100644 --- a/docs/cli/server.md +++ b/docs/cli/server.md @@ -8,7 +8,9 @@ The ```bor server``` command runs the Bor client. - ```identity```: Name/Identity of the node -- ```log-level```: Set log level for the server (default: INFO) +- ```verbosity```: Logging verbosity for the server (5=trace|4=debug|3=info|2=warn|1=error|0=crit), default = 3 (default: 3) + +- ```log-level```: Log level for the server (trace|debug|info|warn|error|crit), will be deprecated soon. Use verbosity instead - ```datadir```: Path of the data directory to store information @@ -34,6 +36,10 @@ The ```bor server``` command runs the Bor client. - ```bor.heimdallgRPC```: Address of Heimdall gRPC service +- ```bor.runheimdall```: Run Heimdall service as a child process (default: false) + +- ```bor.runheimdallargs```: Arguments to pass to Heimdall service + - ```ethstats```: Reporting URL of a ethstats service (nodename:secret@host:port) - ```gpo.blocks```: Number of recent blocks to check for gas prices (default: 20) diff --git a/internal/cli/bootnode.go b/internal/cli/bootnode.go index d1dc1c2fd9..e6c8b33665 100644 --- a/internal/cli/bootnode.go +++ b/internal/cli/bootnode.go @@ -14,6 +14,7 @@ import ( "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/ethereum/go-ethereum/internal/cli/server" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/enode" @@ -27,6 +28,7 @@ type BootnodeCommand struct { listenAddr string v5 bool + verbosity int logLevel string nat string nodeKey string @@ -64,10 +66,16 @@ func (b *BootnodeCommand) Flags() *flagset.Flagset { Usage: "Enable UDP v5", Value: &b.v5, }) + flags.IntFlag(&flagset.IntFlag{ + Name: "verbosity", + Default: 3, + Usage: "Logging verbosity (5=trace|4=debug|3=info|2=warn|1=error|0=crit)", + Value: &b.verbosity, + }) flags.StringFlag(&flagset.StringFlag{ Name: "log-level", Default: "info", - Usage: "Log level (trace|debug|info|warn|error|crit)", + Usage: "log level (trace|debug|info|warn|error|crit), will be deprecated soon. Use verbosity instead", Value: &b.logLevel, }) flags.StringFlag(&flagset.StringFlag{ @@ -114,7 +122,18 @@ func (b *BootnodeCommand) Run(args []string) int { glogger := log.NewGlogHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(false))) - lvl, err := log.LvlFromString(strings.ToLower(b.logLevel)) + var logInfo string + + if b.verbosity != 0 && b.logLevel != "" { + b.UI.Warn(fmt.Sprintf("Both verbosity and log-level provided, using verbosity: %v", b.verbosity)) + logInfo = server.VerbosityIntToString(b.verbosity) + } else if b.verbosity != 0 { + logInfo = server.VerbosityIntToString(b.verbosity) + } else { + logInfo = b.logLevel + } + + lvl, err := log.LvlFromString(strings.ToLower(logInfo)) if err == nil { glogger.Verbosity(lvl) } else { diff --git a/internal/cli/server/command.go b/internal/cli/server/command.go index 9dc5f2e3af..0b66859503 100644 --- a/internal/cli/server/command.go +++ b/internal/cli/server/command.go @@ -10,6 +10,7 @@ import ( "github.com/maticnetwork/heimdall/cmd/heimdalld/service" "github.com/mitchellh/cli" + "github.com/pelletier/go-toml" "github.com/ethereum/go-ethereum/log" ) @@ -90,6 +91,32 @@ func (c *Command) extractFlags(args []string) error { } } + // nolint: nestif + // check for log-level and verbosity here + if c.configFile != "" { + data, _ := toml.LoadFile(c.configFile) + if data.Has("verbosity") && data.Has("log-level") { + log.Warn("Config contains both, verbosity and log-level, log-level will be deprecated soon. Use verbosity only.", "using", data.Get("verbosity")) + } else if !data.Has("verbosity") && data.Has("log-level") { + log.Warn("Config contains log-level only, note that log-level will be deprecated soon. Use verbosity instead.", "using", data.Get("log-level")) + config.Verbosity = VerbosityStringToInt(strings.ToLower(data.Get("log-level").(string))) + } + } else { + tempFlag := 0 + for _, val := range args { + if (strings.HasPrefix(val, "-verbosity") || strings.HasPrefix(val, "--verbosity")) && config.LogLevel != "" { + tempFlag = 1 + break + } + } + if tempFlag == 1 { + log.Warn("Both, verbosity and log-level flags are provided, log-level will be deprecated soon. Use verbosity only.", "using", config.Verbosity) + } else if tempFlag == 0 && config.LogLevel != "" { + log.Warn("Only log-level flag is provided, note that log-level will be deprecated soon. Use verbosity instead.", "using", config.LogLevel) + config.Verbosity = VerbosityStringToInt(strings.ToLower(config.LogLevel)) + } + } + c.config = &config return nil diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index ce56107778..f7af2cd0c8 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -49,6 +49,9 @@ type Config struct { // RequiredBlocks is a list of required (block number, hash) pairs to accept RequiredBlocks map[string]string `hcl:"eth.requiredblocks,optional" toml:"eth.requiredblocks,optional"` + // Verbosity is the level of the logs to put out + Verbosity int `hcl:"verbosity,optional" toml:"verbosity,optional"` + // LogLevel is the level of the logs to put out LogLevel string `hcl:"log-level,optional" toml:"log-level,optional"` @@ -448,7 +451,8 @@ func DefaultConfig() *Config { Chain: "mainnet", Identity: Hostname(), RequiredBlocks: map[string]string{}, - LogLevel: "INFO", + Verbosity: 3, + LogLevel: "", DataDir: DefaultDataDir(), Ancient: "", P2P: &P2PConfig{ diff --git a/internal/cli/server/flags.go b/internal/cli/server/flags.go index 19792a7bb1..4411eebd36 100644 --- a/internal/cli/server/flags.go +++ b/internal/cli/server/flags.go @@ -22,9 +22,15 @@ func (c *Command) Flags() *flagset.Flagset { Default: c.cliConfig.Identity, HideDefaultFromDoc: true, }) + f.IntFlag(&flagset.IntFlag{ + Name: "verbosity", + Usage: "Logging verbosity for the server (5=trace|4=debug|3=info|2=warn|1=error|0=crit), default = 3", + Value: &c.cliConfig.Verbosity, + Default: c.cliConfig.Verbosity, + }) f.StringFlag(&flagset.StringFlag{ Name: "log-level", - Usage: "Set log level for the server", + Usage: "Log level for the server (trace|debug|info|warn|error|crit), will be deprecated soon. Use verbosity instead", Value: &c.cliConfig.LogLevel, Default: c.cliConfig.LogLevel, }) diff --git a/internal/cli/server/server.go b/internal/cli/server/server.go index f0cea4de06..69ac08e993 100644 --- a/internal/cli/server/server.go +++ b/internal/cli/server/server.go @@ -68,6 +68,32 @@ func WithGRPCListener(lis net.Listener) serverOption { } } +func VerbosityIntToString(verbosity int) string { + mapIntToString := map[int]string{ + 5: "trace", + 4: "debug", + 3: "info", + 2: "warn", + 1: "error", + 0: "crit", + } + + return mapIntToString[verbosity] +} + +func VerbosityStringToInt(loglevel string) int { + mapStringToInt := map[string]int{ + "trace": 5, + "debug": 4, + "info": 3, + "warn": 2, + "error": 1, + "crit": 0, + } + + return mapStringToInt[loglevel] +} + //nolint:gocognit func NewServer(config *Config, opts ...serverOption) (*Server, error) { srv := &Server{ @@ -75,7 +101,7 @@ func NewServer(config *Config, opts ...serverOption) (*Server, error) { } // start the logger - setupLogger(config.LogLevel) + setupLogger(VerbosityIntToString(config.Verbosity)) var err error diff --git a/packaging/templates/mainnet-v1/archive/config.toml b/packaging/templates/mainnet-v1/archive/config.toml index 9eaafd3bee..387c90c7ce 100644 --- a/packaging/templates/mainnet-v1/archive/config.toml +++ b/packaging/templates/mainnet-v1/archive/config.toml @@ -1,6 +1,6 @@ chain = "mainnet" # identity = "node_name" -# log-level = "INFO" +# verbosity = 3 datadir = "/var/lib/bor/data" # ancient = "" # keystore = "" diff --git a/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml b/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml index 94dd6634f0..2e712ae912 100644 --- a/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml +++ b/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml @@ -1,6 +1,6 @@ chain = "mainnet" # identity = "node_name" -# log-level = "INFO" +# verbosity = 3 datadir = "/var/lib/bor/data" # ancient = "" # keystore = "" diff --git a/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml b/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml index 9c55683c96..4402250e5e 100644 --- a/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml +++ b/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml @@ -2,7 +2,7 @@ chain = "mainnet" # identity = "node_name" -# log-level = "INFO" +# verbosity = 3 datadir = "/var/lib/bor/data" # ancient = "" # keystore = "$BOR_DIR/keystore" diff --git a/packaging/templates/mainnet-v1/without-sentry/bor/config.toml b/packaging/templates/mainnet-v1/without-sentry/bor/config.toml index 573f1f3be8..34d712395d 100644 --- a/packaging/templates/mainnet-v1/without-sentry/bor/config.toml +++ b/packaging/templates/mainnet-v1/without-sentry/bor/config.toml @@ -2,7 +2,7 @@ chain = "mainnet" # identity = "node_name" -# log-level = "INFO" +# verbosity = 3 datadir = "/var/lib/bor/data" # ancient = "" # keystore = "$BOR_DIR/keystore" diff --git a/packaging/templates/testnet-v4/archive/config.toml b/packaging/templates/testnet-v4/archive/config.toml index 1762fdf117..b6156e5482 100644 --- a/packaging/templates/testnet-v4/archive/config.toml +++ b/packaging/templates/testnet-v4/archive/config.toml @@ -1,6 +1,6 @@ chain = "mumbai" # identity = "node_name" -# log-level = "INFO" +# verbosity = 3 datadir = "/var/lib/bor/data" # ancient = "" # keystore = "" diff --git a/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml b/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml index ae191cec2c..efad8735c7 100644 --- a/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml +++ b/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml @@ -1,6 +1,6 @@ chain = "mumbai" # identity = "node_name" -# log-level = "INFO" +# verbosity = 3 datadir = "/var/lib/bor/data" # ancient = "" # keystore = "" diff --git a/packaging/templates/testnet-v4/sentry/validator/bor/config.toml b/packaging/templates/testnet-v4/sentry/validator/bor/config.toml index b441cc137d..adfe245511 100644 --- a/packaging/templates/testnet-v4/sentry/validator/bor/config.toml +++ b/packaging/templates/testnet-v4/sentry/validator/bor/config.toml @@ -2,7 +2,7 @@ chain = "mumbai" # identity = "node_name" -# log-level = "INFO" +# verbosity = 3 datadir = "/var/lib/bor/data" # ancient = "" # keystore = "$BOR_DIR/keystore" diff --git a/packaging/templates/testnet-v4/without-sentry/bor/config.toml b/packaging/templates/testnet-v4/without-sentry/bor/config.toml index 05a254e184..9ad2a6828a 100644 --- a/packaging/templates/testnet-v4/without-sentry/bor/config.toml +++ b/packaging/templates/testnet-v4/without-sentry/bor/config.toml @@ -2,7 +2,7 @@ chain = "mumbai" # identity = "node_name" -# log-level = "INFO" +# verbosity = 3 datadir = "/var/lib/bor/data" # ancient = "" # keystore = "$BOR_DIR/keystore" diff --git a/scripts/getconfig.go b/scripts/getconfig.go index 09026a2479..0d44a84016 100644 --- a/scripts/getconfig.go +++ b/scripts/getconfig.go @@ -103,7 +103,7 @@ var flagMap = map[string][]string{ var nameTagMap = map[string]string{ "chain": "chain", "identity": "identity", - "log-level": "log-level", + "verbosity": "verbosity", "datadir": "datadir", "keystore": "keystore", "syncmode": "syncmode", @@ -215,15 +215,15 @@ var replacedFlagsMapFlagAndValue = map[string]map[string]map[string]string{ }, "verbosity": { "flag": { - "verbosity": "log-level", + "verbosity": "verbosity", }, "value": { - "0": "SILENT", + "0": "CRIT", "1": "ERROR", "2": "WARN", "3": "INFO", "4": "DEBUG", - "5": "DETAIL", + "5": "TRACE", }, }, } From 0ed78b9261b377653e0e201b3e5986903e3fd94e Mon Sep 17 00:00:00 2001 From: Dmitry <46797839+dkeysil@users.noreply.github.com> Date: Fri, 10 Feb 2023 13:48:32 +0800 Subject: [PATCH 09/28] Check if block is nil to prevent panic (#736) --- internal/ethapi/api.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 7df46b1f33..0c2f5ba2cb 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -628,6 +628,10 @@ func (s *PublicBlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, return nil, err } + if block == nil { + return nil, errors.New("block not found") + } + receipts, err := s.b.GetReceipts(ctx, block.Hash()) if err != nil { return nil, err From 53fd1fe912ff5051323547300caeb02772fb5ce3 Mon Sep 17 00:00:00 2001 From: Manav Darji Date: Mon, 13 Feb 2023 23:41:49 +0530 Subject: [PATCH 10/28] miner: use env for tracing instead of block object (#728) --- miner/worker.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index cc6a2e1eec..60903e1e25 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1501,9 +1501,9 @@ func (w *worker) commit(ctx context.Context, env *environment, interval func(), tracing.SetAttributes( span, - attribute.Int("number", int(block.Number().Uint64())), - attribute.String("hash", block.Hash().String()), - attribute.String("sealhash", w.engine.SealHash(block.Header()).String()), + attribute.Int("number", int(env.header.Number.Uint64())), + attribute.String("hash", env.header.Hash().String()), + attribute.String("sealhash", w.engine.SealHash(env.header).String()), attribute.Int("len of env.txs", len(env.txs)), attribute.Bool("error", err != nil), ) From 87deea068a084ea275140927a8b092330ea518a6 Mon Sep 17 00:00:00 2001 From: SHIVAM SHARMA Date: Tue, 14 Feb 2023 11:06:14 +0530 Subject: [PATCH 11/28] Add : mutex pprof profile (#731) * add : mutex pprof profile * rm : remove trace from default pprof profiles --- internal/cli/debug_pprof.go | 5 +++-- internal/cli/server/server.go | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/cli/debug_pprof.go b/internal/cli/debug_pprof.go index a979741fda..ca14604b97 100644 --- a/internal/cli/debug_pprof.go +++ b/internal/cli/debug_pprof.go @@ -129,8 +129,9 @@ func (d *DebugPprofCommand) Run(args []string) int { // Only take cpu and heap profiles by default profiles := map[string]string{ - "heap": "heap", - "cpu": "cpu", + "heap": "heap", + "cpu": "cpu", + "mutex": "mutex", } if !d.skiptrace { diff --git a/internal/cli/server/server.go b/internal/cli/server/server.go index 69ac08e993..808b524884 100644 --- a/internal/cli/server/server.go +++ b/internal/cli/server/server.go @@ -8,6 +8,7 @@ import ( "net" "net/http" "os" + "runtime" "strings" "time" @@ -96,6 +97,8 @@ func VerbosityStringToInt(loglevel string) int { //nolint:gocognit func NewServer(config *Config, opts ...serverOption) (*Server, error) { + runtime.SetMutexProfileFraction(5) + srv := &Server{ config: config, } From 6f153f05d79f3a0080a637d003a1079fa6a4d02f Mon Sep 17 00:00:00 2001 From: SHIVAM SHARMA Date: Tue, 14 Feb 2023 16:03:55 +0530 Subject: [PATCH 12/28] chg : commit tx logs from info to debug (#673) * chg : commit tx logs from info to debug * fix : minor changes * chg : miner : commitTransactions-stats moved from info to debug * lint : fix linters * refactor logging * miner : chg : UnauthorizedSignerError to debug * lint : fix lint * fix : log.Logger interface compatibility --------- Co-authored-by: Evgeny Danienko <6655321@bk.ru> --- internal/testlog/testlog.go | 32 +++++++++++++++++++++++++++++ log/logger.go | 41 +++++++++++++++++++++++++++++++++++++ log/root.go | 32 +++++++++++++++++++++++++++++ miner/worker.go | 33 +++++++++++++++++++++-------- 4 files changed, 129 insertions(+), 9 deletions(-) diff --git a/internal/testlog/testlog.go b/internal/testlog/testlog.go index a5836b8446..93d6f27086 100644 --- a/internal/testlog/testlog.go +++ b/internal/testlog/testlog.go @@ -148,3 +148,35 @@ func (l *logger) flush() { } l.h.buf = nil } + +func (l *logger) OnTrace(fn func(l log.Logging)) { + if l.GetHandler().Level() >= log.LvlTrace { + fn(l.Trace) + } +} + +func (l *logger) OnDebug(fn func(l log.Logging)) { + if l.GetHandler().Level() >= log.LvlDebug { + fn(l.Debug) + } +} +func (l *logger) OnInfo(fn func(l log.Logging)) { + if l.GetHandler().Level() >= log.LvlInfo { + fn(l.Info) + } +} +func (l *logger) OnWarn(fn func(l log.Logging)) { + if l.GetHandler().Level() >= log.LvlWarn { + fn(l.Warn) + } +} +func (l *logger) OnError(fn func(l log.Logging)) { + if l.GetHandler().Level() >= log.LvlError { + fn(l.Error) + } +} +func (l *logger) OnCrit(fn func(l log.Logging)) { + if l.GetHandler().Level() >= log.LvlCrit { + fn(l.Crit) + } +} diff --git a/log/logger.go b/log/logger.go index 2b96681a82..c2678259bf 100644 --- a/log/logger.go +++ b/log/logger.go @@ -106,6 +106,8 @@ type RecordKeyNames struct { Ctx string } +type Logging func(msg string, ctx ...interface{}) + // A Logger writes key/value pairs to a Handler type Logger interface { // New returns a new Logger that has this logger's context plus the given context @@ -124,6 +126,13 @@ type Logger interface { Warn(msg string, ctx ...interface{}) Error(msg string, ctx ...interface{}) Crit(msg string, ctx ...interface{}) + + OnTrace(func(l Logging)) + OnDebug(func(l Logging)) + OnInfo(func(l Logging)) + OnWarn(func(l Logging)) + OnError(func(l Logging)) + OnCrit(func(l Logging)) } type logger struct { @@ -198,6 +207,38 @@ func (l *logger) SetHandler(h Handler) { l.h.Swap(h) } +func (l *logger) OnTrace(fn func(l Logging)) { + if l.GetHandler().Level() >= LvlTrace { + fn(l.Trace) + } +} + +func (l *logger) OnDebug(fn func(l Logging)) { + if l.GetHandler().Level() >= LvlDebug { + fn(l.Debug) + } +} +func (l *logger) OnInfo(fn func(l Logging)) { + if l.GetHandler().Level() >= LvlInfo { + fn(l.Info) + } +} +func (l *logger) OnWarn(fn func(l Logging)) { + if l.GetHandler().Level() >= LvlWarn { + fn(l.Warn) + } +} +func (l *logger) OnError(fn func(l Logging)) { + if l.GetHandler().Level() >= LvlError { + fn(l.Error) + } +} +func (l *logger) OnCrit(fn func(l Logging)) { + if l.GetHandler().Level() >= LvlCrit { + fn(l.Crit) + } +} + func normalize(ctx []interface{}) []interface{} { // if the caller passed a Ctx object, then expand it if len(ctx) == 1 { diff --git a/log/root.go b/log/root.go index 9fb4c5ae0b..04b80f4a02 100644 --- a/log/root.go +++ b/log/root.go @@ -60,6 +60,38 @@ func Crit(msg string, ctx ...interface{}) { os.Exit(1) } +func OnTrace(fn func(l Logging)) { + if root.GetHandler().Level() >= LvlTrace { + fn(root.Trace) + } +} + +func OnDebug(fn func(l Logging)) { + if root.GetHandler().Level() >= LvlDebug { + fn(root.Debug) + } +} +func OnInfo(fn func(l Logging)) { + if root.GetHandler().Level() >= LvlInfo { + fn(root.Info) + } +} +func OnWarn(fn func(l Logging)) { + if root.GetHandler().Level() >= LvlWarn { + fn(root.Warn) + } +} +func OnError(fn func(l Logging)) { + if root.GetHandler().Level() >= LvlError { + fn(root.Error) + } +} +func OnCrit(fn func(l Logging)) { + if root.GetHandler().Level() >= LvlCrit { + fn(root.Crit) + } +} + // Output is a convenient alias for write, allowing for the modification of // the calldepth (number of stack frames to skip). // calldepth influences the reported line number of the log message. diff --git a/miner/worker.go b/miner/worker.go index 60903e1e25..39117cdb1e 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -39,6 +39,7 @@ import ( cmath "github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/common/tracing" "github.com/ethereum/go-ethereum/consensus" + "github.com/ethereum/go-ethereum/consensus/bor" "github.com/ethereum/go-ethereum/consensus/misc" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" @@ -952,12 +953,14 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP var breakCause string defer func() { - log.Warn("commitTransactions-stats", - "initialTxsCount", initialTxs, - "initialGasLimit", initialGasLimit, - "resultTxsCount", txs.GetTxs(), - "resultGapPool", env.gasPool.Gas(), - "exitCause", breakCause) + log.OnDebug(func(lg log.Logging) { + lg("commitTransactions-stats", + "initialTxsCount", initialTxs, + "initialGasLimit", initialGasLimit, + "resultTxsCount", txs.GetTxs(), + "resultGapPool", env.gasPool.Gas(), + "exitCause", breakCause) + }) }() for { @@ -1012,7 +1015,11 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP // Start executing the transaction env.state.Prepare(tx.Hash(), env.tcount) - start := time.Now() + var start time.Time + + log.OnDebug(func(log.Logging) { + start = time.Now() + }) logs, err := w.commitTransaction(env, tx) @@ -1037,7 +1044,10 @@ func (w *worker) commitTransactions(env *environment, txs *types.TransactionsByP coalescedLogs = append(coalescedLogs, logs...) env.tcount++ txs.Shift() - log.Info("Committed new tx", "tx hash", tx.Hash(), "from", from, "to", tx.To(), "nonce", tx.Nonce(), "gas", tx.Gas(), "gasPrice", tx.GasPrice(), "value", tx.Value(), "time spent", time.Since(start)) + + log.OnDebug(func(lg log.Logging) { + lg("Committed new tx", "tx hash", tx.Hash(), "from", from, "to", tx.To(), "nonce", tx.Nonce(), "gas", tx.Gas(), "gasPrice", tx.GasPrice(), "value", tx.Value(), "time spent", time.Since(start)) + }) case errors.Is(err, core.ErrTxTypeNotSupported): // Pop the unsupported transaction without shifting in the next from the account @@ -1136,7 +1146,12 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) { } // Run the consensus preparation with the default or customized consensus engine. if err := w.engine.Prepare(w.chain, header); err != nil { - log.Error("Failed to prepare header for sealing", "err", err) + switch err.(type) { + case *bor.UnauthorizedSignerError: + log.Debug("Failed to prepare header for sealing", "err", err) + default: + log.Error("Failed to prepare header for sealing", "err", err) + } return nil, err } // Could potentially happen if starting to mine in an odd state. From ec14a06dc27132c6f5401a75e58814fa501c549b Mon Sep 17 00:00:00 2001 From: SHIVAM SHARMA Date: Tue, 14 Feb 2023 16:06:39 +0530 Subject: [PATCH 13/28] Add : commit details to bor version (#730) * add : commit details to bor version * fix : MAKEFILE * undo : rm test-txpool-race * rm : params/build_date * rm : params/gitbranch and params/gitdate --- Makefile | 8 +++----- internal/cli/version.go | 2 +- params/version.go | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a8a4b66e8d..0f4d4afdd9 100644 --- a/Makefile +++ b/Makefile @@ -14,20 +14,18 @@ GORUN = env GO111MODULE=on go run GOPATH = $(shell go env GOPATH) GIT_COMMIT ?= $(shell git rev-list -1 HEAD) -GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) -GIT_TAG ?= $(shell git describe --tags `git rev-list --tags="v*" --max-count=1`) PACKAGE = github.com/ethereum/go-ethereum GO_FLAGS += -buildvcs=false -GO_FLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} -X ${PACKAGE}/params.GitBranch=${GIT_BRANCH} -X ${PACKAGE}/params.GitTag=${GIT_TAG}" +GO_LDFLAGS += -ldflags "-X ${PACKAGE}/params.GitCommit=${GIT_COMMIT} " TESTALL = $$(go list ./... | grep -v go-ethereum/cmd/) TESTE2E = ./tests/... -GOTEST = GODEBUG=cgocheck=0 go test $(GO_FLAGS) -p 1 +GOTEST = GODEBUG=cgocheck=0 go test $(GO_FLAGS) $(GO_LDFLAGS) -p 1 bor: mkdir -p $(GOPATH)/bin/ - go build -o $(GOBIN)/bor ./cmd/cli/main.go + go build -o $(GOBIN)/bor $(GO_LDFLAGS) ./cmd/cli/main.go cp $(GOBIN)/bor $(GOPATH)/bin/ @echo "Done building." diff --git a/internal/cli/version.go b/internal/cli/version.go index cd155f43a7..949599904e 100644 --- a/internal/cli/version.go +++ b/internal/cli/version.go @@ -46,7 +46,7 @@ func (c *VersionCommand) Synopsis() string { // Run implements the cli.Command interface func (c *VersionCommand) Run(args []string) int { - c.UI.Output(params.VersionWithMeta) + c.UI.Output(params.VersionWithMetaCommitDetails) return 0 } diff --git a/params/version.go b/params/version.go index 199e49095f..0e4afc7bcb 100644 --- a/params/version.go +++ b/params/version.go @@ -27,6 +27,10 @@ const ( VersionMeta = "stable" // Version metadata to append to the version string ) +var ( + GitCommit = "" +) + // Version holds the textual version string. var Version = func() string { return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) @@ -41,6 +45,16 @@ var VersionWithMeta = func() string { return v }() +// VersionWithCommitDetails holds the textual version string including the metadata and Git Details. +var VersionWithMetaCommitDetails = func() string { + v := Version + if VersionMeta != "" { + v += "-" + VersionMeta + } + v_git := fmt.Sprintf("Version : %s\nGitCommit : %s\n", v, GitCommit) + return v_git +}() + // ArchiveVersion holds the textual version string used for Geth archives. // e.g. "1.8.11-dea1ce05" for stable releases, or // From 2c35dcc5bbcb748534087bbee56a318ee30d86f7 Mon Sep 17 00:00:00 2001 From: Raneet Debnath Date: Wed, 15 Feb 2023 20:06:15 +0530 Subject: [PATCH 14/28] core,docs/cli,internal/cli/server: make docs --- core/tx_pool_test.go | 47 +++++++++++++++++++++++++++++++++++ docs/cli/server.md | 8 ++++++ internal/cli/server/config.go | 2 +- 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go index 63f712bb9c..b7893f2f8b 100644 --- a/core/tx_pool_test.go +++ b/core/tx_pool_test.go @@ -954,6 +954,53 @@ func TestTransactionQueueAccountLimiting(t *testing.T) { } } +// Test that txpool rejects unprotected txs by default +// FIXME: The below test causes some tests to fail randomly (probably due to parallel execution) +// +//nolint:paralleltest +func TestRejectUnprotectedTransaction(t *testing.T) { + //nolint:paralleltest + t.Skip() + + pool, key := setupTxPool() + defer pool.Stop() + + tx := dynamicFeeTx(0, 22000, big.NewInt(5), big.NewInt(2), key) + from := crypto.PubkeyToAddress(key.PublicKey) + + pool.chainconfig.ChainID = big.NewInt(5) + pool.signer = types.LatestSignerForChainID(pool.chainconfig.ChainID) + testAddBalance(pool, from, big.NewInt(0xffffffffffffff)) + + if err := pool.AddRemote(tx); !errors.Is(err, types.ErrInvalidChainId) { + t.Error("expected", types.ErrInvalidChainId, "got", err) + } +} + +// Test that txpool allows unprotected txs when AllowUnprotectedTxs flag is set +// FIXME: The below test causes some tests to fail randomly (probably due to parallel execution) +// +//nolint:paralleltest +func TestAllowUnprotectedTransactionWhenSet(t *testing.T) { + t.Skip() + + pool, key := setupTxPool() + defer pool.Stop() + + tx := dynamicFeeTx(0, 22000, big.NewInt(5), big.NewInt(2), key) + from := crypto.PubkeyToAddress(key.PublicKey) + + // Allow unprotected txs + pool.config.AllowUnprotectedTxs = true + pool.chainconfig.ChainID = big.NewInt(5) + pool.signer = types.LatestSignerForChainID(pool.chainconfig.ChainID) + testAddBalance(pool, from, big.NewInt(0xffffffffffffff)) + + if err := pool.AddRemote(tx); err != nil { + t.Error("expected", nil, "got", err) + } +} + // Tests that if the transaction count belonging to multiple accounts go above // some threshold, the higher transactions are dropped to prevent DOS attacks. // diff --git a/docs/cli/server.md b/docs/cli/server.md index 5bc0ff1024..f90e971b6c 100644 --- a/docs/cli/server.md +++ b/docs/cli/server.md @@ -32,8 +32,14 @@ The ```bor server``` command runs the Bor client. - ```bor.withoutheimdall```: Run without Heimdall service (for testing purpose) (default: false) +- ```bor.devfakeauthor```: Run miner without validator set authorization [dev mode] : Use with '--bor.withoutheimdall' (default: false) + - ```bor.heimdallgRPC```: Address of Heimdall gRPC service +- ```bor.runheimdall```: Run Heimdall service as a child process (default: false) + +- ```bor.runheimdallargs```: Arguments to pass to Heimdall service + - ```ethstats```: Reporting URL of a ethstats service (nodename:secret@host:port) - ```gpo.blocks```: Number of recent blocks to check for gas prices (default: 20) @@ -92,6 +98,8 @@ The ```bor server``` command runs the Bor client. - ```rpc.txfeecap```: Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) (default: 5) +- ```rpc.allow-unprotected-txs```: Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC (default: false) + - ```ipcdisable```: Disable the IPC-RPC server (default: false) - ```ipcpath```: Filename for IPC socket/pipe within the datadir (explicit paths escape it) diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index 67780c9423..980548c529 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -255,7 +255,7 @@ type JsonRPCConfig struct { HttpTimeout *HttpTimeouts `hcl:"timeouts,block" toml:"timeouts,block"` - AllowUnprotectedTxs bool `hcl:"unprotectedtxs,optional" toml:"unprotectedtxs,optional"` + AllowUnprotectedTxs bool `hcl:"allow-unprotected-txs,optional" toml:"allow-unprotected-txs,optional"` } type GRPCConfig struct { From 4917fde5be2a8c1eb5f6147b1900d52cefcd7dbd Mon Sep 17 00:00:00 2001 From: Raneet Debnath Date: Thu, 16 Feb 2023 09:59:22 +0530 Subject: [PATCH 15/28] builder,docs/cli,packaging: update toml files --- builder/files/config.toml | 3 ++- docs/cli/example_config.toml | 2 ++ packaging/templates/mainnet-v1/archive/config.toml | 2 ++ packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml | 2 ++ .../templates/mainnet-v1/sentry/validator/bor/config.toml | 2 ++ packaging/templates/mainnet-v1/without-sentry/bor/config.toml | 2 ++ packaging/templates/testnet-v4/archive/config.toml | 2 ++ packaging/templates/testnet-v4/sentry/sentry/bor/config.toml | 2 ++ .../templates/testnet-v4/sentry/validator/bor/config.toml | 2 ++ packaging/templates/testnet-v4/without-sentry/bor/config.toml | 2 ++ 10 files changed, 20 insertions(+), 1 deletion(-) diff --git a/builder/files/config.toml b/builder/files/config.toml index 0f2919807f..a59d986903 100644 --- a/builder/files/config.toml +++ b/builder/files/config.toml @@ -13,7 +13,7 @@ syncmode = "full" # snapshot = true # "bor.logs" = false # ethstats = "" - +# devfakeauthor = false # ["eth.requiredblocks"] [p2p] @@ -65,6 +65,7 @@ syncmode = "full" # ipcpath = "" # gascap = 50000000 # txfeecap = 5.0 +# allow-unprotected-txs = false # [jsonrpc.http] # enabled = false # port = 8545 diff --git a/docs/cli/example_config.toml b/docs/cli/example_config.toml index 64ef60ae12..449f545990 100644 --- a/docs/cli/example_config.toml +++ b/docs/cli/example_config.toml @@ -13,6 +13,7 @@ gcmode = "full" # Blockchain garbage collection mode ("full", "arch snapshot = true # Enables the snapshot-database mode "bor.logs" = false # Enables bor log retrieval ethstats = "" # Reporting URL of a ethstats service (nodename:secret@host:port) +devfakeauthor = false # Run miner without validator set authorization [dev mode] : Use with '--bor.withoutheimdall' (default: false) ["eth.requiredblocks"] # Comma separated block number-to-hash mappings to require for peering (=) (default = empty map) "31000000" = "0x2087b9e2b353209c2c21e370c82daa12278efd0fe5f0febe6c29035352cf050e" @@ -64,6 +65,7 @@ ethstats = "" # Reporting URL of a ethstats service (nodename:sec ipcpath = "" # Filename for IPC socket/pipe within the datadir (explicit paths escape it) gascap = 50000000 # Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite) txfeecap = 5.0 # Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) + allow-unprotected-txs = false # Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC (default: false) [jsonrpc.http] enabled = false # Enable the HTTP-RPC server port = 8545 # http.port diff --git a/packaging/templates/mainnet-v1/archive/config.toml b/packaging/templates/mainnet-v1/archive/config.toml index 9eaafd3bee..d69b044043 100644 --- a/packaging/templates/mainnet-v1/archive/config.toml +++ b/packaging/templates/mainnet-v1/archive/config.toml @@ -8,6 +8,7 @@ syncmode = "full" gcmode = "archive" # snapshot = true # ethstats = "" +# devfakeauthor = false # ["eth.requiredblocks"] @@ -57,6 +58,7 @@ gcmode = "archive" # ipcdisable = false # gascap = 50000000 # txfeecap = 5.0 + # allow-unprotected-txs = false [jsonrpc.http] enabled = true port = 8545 diff --git a/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml b/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml index 94dd6634f0..873a6b7390 100644 --- a/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml +++ b/packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml @@ -8,6 +8,7 @@ syncmode = "full" # gcmode = "full" # snapshot = true # ethstats = "" +# devfakeauthor = false # ["eth.requiredblocks"] @@ -57,6 +58,7 @@ syncmode = "full" # ipcdisable = false # gascap = 50000000 # txfeecap = 5.0 + # allow-unprotected-txs = false [jsonrpc.http] enabled = true port = 8545 diff --git a/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml b/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml index 9c55683c96..00891a80ba 100644 --- a/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml +++ b/packaging/templates/mainnet-v1/sentry/validator/bor/config.toml @@ -10,6 +10,7 @@ syncmode = "full" # gcmode = "full" # snapshot = true # ethstats = "" +# devfakeauthor = false # ["eth.requiredblocks"] @@ -59,6 +60,7 @@ syncmode = "full" # ipcdisable = false # gascap = 50000000 # txfeecap = 5.0 + # allow-unprotected-txs = false [jsonrpc.http] enabled = true port = 8545 diff --git a/packaging/templates/mainnet-v1/without-sentry/bor/config.toml b/packaging/templates/mainnet-v1/without-sentry/bor/config.toml index 573f1f3be8..7cdcb55095 100644 --- a/packaging/templates/mainnet-v1/without-sentry/bor/config.toml +++ b/packaging/templates/mainnet-v1/without-sentry/bor/config.toml @@ -10,6 +10,7 @@ syncmode = "full" # gcmode = "full" # snapshot = true # ethstats = "" +# devfakeauthor = false # ["eth.requiredblocks"] @@ -59,6 +60,7 @@ syncmode = "full" # ipcdisable = false # gascap = 50000000 # txfeecap = 5.0 + # allow-unprotected-txs = false [jsonrpc.http] enabled = true port = 8545 diff --git a/packaging/templates/testnet-v4/archive/config.toml b/packaging/templates/testnet-v4/archive/config.toml index 1762fdf117..871a3e526b 100644 --- a/packaging/templates/testnet-v4/archive/config.toml +++ b/packaging/templates/testnet-v4/archive/config.toml @@ -8,6 +8,7 @@ syncmode = "full" gcmode = "archive" # snapshot = true # ethstats = "" +# devfakeauthor = false # ["eth.requiredblocks"] @@ -57,6 +58,7 @@ gcmode = "archive" # ipcdisable = false # gascap = 50000000 # txfeecap = 5.0 + # allow-unprotected-txs = false [jsonrpc.http] enabled = true port = 8545 diff --git a/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml b/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml index ae191cec2c..2a63a8b4a1 100644 --- a/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml +++ b/packaging/templates/testnet-v4/sentry/sentry/bor/config.toml @@ -8,6 +8,7 @@ syncmode = "full" # gcmode = "full" # snapshot = true # ethstats = "" +# devfakeauthor = false # ["eth.requiredblocks"] @@ -57,6 +58,7 @@ syncmode = "full" # ipcdisable = false # gascap = 50000000 # txfeecap = 5.0 + # allow-unprotected-txs = false [jsonrpc.http] enabled = true port = 8545 diff --git a/packaging/templates/testnet-v4/sentry/validator/bor/config.toml b/packaging/templates/testnet-v4/sentry/validator/bor/config.toml index b441cc137d..bc72044730 100644 --- a/packaging/templates/testnet-v4/sentry/validator/bor/config.toml +++ b/packaging/templates/testnet-v4/sentry/validator/bor/config.toml @@ -10,6 +10,7 @@ syncmode = "full" # gcmode = "full" # snapshot = true # ethstats = "" +# devfakeauthor = false # ["eth.requiredblocks"] @@ -59,6 +60,7 @@ syncmode = "full" # ipcdisable = false # gascap = 50000000 # txfeecap = 5.0 + # allow-unprotected-txs = false [jsonrpc.http] enabled = true port = 8545 diff --git a/packaging/templates/testnet-v4/without-sentry/bor/config.toml b/packaging/templates/testnet-v4/without-sentry/bor/config.toml index 05a254e184..531c346735 100644 --- a/packaging/templates/testnet-v4/without-sentry/bor/config.toml +++ b/packaging/templates/testnet-v4/without-sentry/bor/config.toml @@ -10,6 +10,7 @@ syncmode = "full" # gcmode = "full" # snapshot = true # ethstats = "" +# devfakeauthor = false # ["eth.requiredblocks"] @@ -59,6 +60,7 @@ syncmode = "full" # ipcdisable = false # gascap = 50000000 # txfeecap = 5.0 + # allow-unprotected-txs = false [jsonrpc.http] enabled = true port = 8545 From 808259b4dc9d9bef21dce77d69a9dbdc13b3d4e1 Mon Sep 17 00:00:00 2001 From: marcello33 Date: Fri, 17 Feb 2023 13:08:10 +0100 Subject: [PATCH 16/28] mardizzone/hotfix-snyk: remove vcs build when running snyk (#745) --- .github/workflows/security-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/security-ci.yml b/.github/workflows/security-ci.yml index a0237116d9..e3815a0807 100644 --- a/.github/workflows/security-ci.yml +++ b/.github/workflows/security-ci.yml @@ -13,6 +13,7 @@ jobs: continue-on-error: true env: SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + GOFLAGS: "-buildvcs=false" with: args: --org=${{ secrets.SNYK_ORG }} --severity-threshold=medium --sarif-file-output=snyk.sarif - name: Upload result to GitHub Code Scanning From 9e9efe48f1214b997dd9e75f0a4dee035b5ee105 Mon Sep 17 00:00:00 2001 From: SHIVAM SHARMA Date: Fri, 24 Feb 2023 12:45:30 +0530 Subject: [PATCH 17/28] Feat : SetMaxPeers (#726) * init : add admin.setMaxPeers and getMaxPeers * lint : fix lint * add : some comments --- internal/web3ext/web3ext.go | 9 +++++++++ node/api.go | 24 ++++++++++++++++++++++++ p2p/server.go | 31 +++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 64ceb5c42e..316aff3b38 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -192,6 +192,15 @@ web3._extend({ name: 'stopWS', call: 'admin_stopWS' }), + new web3._extend.Method({ + name: 'getMaxPeers', + call: 'admin_getMaxPeers' + }), + new web3._extend.Method({ + name: 'setMaxPeers', + call: 'admin_setMaxPeers', + params: 1 + }), ], properties: [ new web3._extend.Property({ diff --git a/node/api.go b/node/api.go index 1b32399f63..d838404f7d 100644 --- a/node/api.go +++ b/node/api.go @@ -61,6 +61,30 @@ type privateAdminAPI struct { node *Node // Node interfaced by this API } +// This function sets the param maxPeers for the node. If there are excess peers attached to the node, it will remove the difference. +func (api *privateAdminAPI) SetMaxPeers(maxPeers int) (bool, error) { + // Make sure the server is running, fail otherwise + server := api.node.Server() + if server == nil { + return false, ErrNodeStopped + } + + server.SetMaxPeers(maxPeers) + + return true, nil +} + +// This function gets the maxPeers param for the node. +func (api *privateAdminAPI) GetMaxPeers() (int, error) { + // Make sure the server is running, fail otherwise + server := api.node.Server() + if server == nil { + return 0, ErrNodeStopped + } + + return server.MaxPeers, nil +} + // AddPeer requests connecting to a remote node, and also maintaining the new // connection at all times, even reconnecting if it is lost. func (api *privateAdminAPI) AddPeer(url string) (bool, error) { diff --git a/p2p/server.go b/p2p/server.go index 138975e54b..7de8504bdc 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -307,6 +307,35 @@ func (srv *Server) Peers() []*Peer { return ps } +// This function retrieves the peers that are not trusted-peers +func (srv *Server) getNonTrustedPeers() []*Peer { + allPeers := srv.Peers() + + nontrustedPeers := []*Peer{} + + for _, peer := range allPeers { + if !peer.Info().Network.Trusted { + nontrustedPeers = append(nontrustedPeers, peer) + } + } + + return nontrustedPeers +} + +// SetMaxPeers sets the maximum number of peers that can be connected +func (srv *Server) SetMaxPeers(maxPeers int) { + currentPeers := srv.getNonTrustedPeers() + if len(currentPeers) > maxPeers { + peersToDrop := currentPeers[maxPeers:] + for _, peer := range peersToDrop { + log.Warn("CurrentPeers more than MaxPeers", "removing", peer.ID()) + srv.RemovePeer(peer.Node()) + } + } + + srv.MaxPeers = maxPeers +} + // PeerCount returns the number of connected peers. func (srv *Server) PeerCount() int { var count int @@ -368,6 +397,8 @@ func (srv *Server) RemoveTrustedPeer(node *enode.Node) { case srv.removetrusted <- node: case <-srv.quit: } + // Disconnect the peer if maxPeers is breached. + srv.SetMaxPeers(srv.MaxPeers) } // SubscribeEvents subscribes the given channel to peer events From 4c68a7c6a1e0fdcb72a6abe7959b6648ba245a2c Mon Sep 17 00:00:00 2001 From: Krishna Upadhyaya Date: Thu, 2 Mar 2023 17:41:18 +0530 Subject: [PATCH 18/28] Update wiki link (#762) --- .github/ISSUE_TEMPLATE/bug.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index 7d34216478..8c23f0bd9f 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -6,7 +6,7 @@ labels: 'type:bug' assignees: '' --- -Our support team has aggregated some common issues and their solutions from past which are faced while running or interacting with a bor client. In order to prevent redundant efforts, we would encourage you to have a look at the [FAQ's section](https://docs.polygon.technology/docs/faq/technical-faqs) of our documentation mentioning the same, before filing an issue here. In case of additional support, you can also join our [discord](https://discord.com/invite/zdwkdvMNY2) server +Our support team has aggregated some common issues and their solutions from past which are faced while running or interacting with a bor client. In order to prevent redundant efforts, we would encourage you to have a look at the [FAQ's section](https://wiki.polygon.technology/docs/faq/technical-faqs/) of our documentation mentioning the same, before filing an issue here. In case of additional support, you can also join our [discord](https://discord.com/invite/zdwkdvMNY2) server