From d1671d6175dc00960381eeb8a5a4281e11203e70 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Sat, 3 Aug 2019 09:19:32 +0200 Subject: [PATCH 01/63] blockchain v2: routines + Include an implementaiton of the routines specified in ADR-43 along with a demuxer and some dummy reactor code --- blockchain/v2/demuxer.go | 115 ++++++++++++++++++++++++ blockchain/v2/metrics.go | 124 +++++++++++++++++++++++++ blockchain/v2/reactor.go | 98 ++++++++++++++++++++ blockchain/v2/reactor_test.go | 17 ++++ blockchain/v2/routine.go | 165 ++++++++++++++++++++++++++++++++++ blockchain/v2/routine_test.go | 89 ++++++++++++++++++ blockchain/v2/types.go | 32 +++++++ 7 files changed, 640 insertions(+) create mode 100644 blockchain/v2/demuxer.go create mode 100644 blockchain/v2/metrics.go create mode 100644 blockchain/v2/reactor.go create mode 100644 blockchain/v2/reactor_test.go create mode 100644 blockchain/v2/routine.go create mode 100644 blockchain/v2/routine_test.go create mode 100644 blockchain/v2/types.go diff --git a/blockchain/v2/demuxer.go b/blockchain/v2/demuxer.go new file mode 100644 index 000000000..511bf7f8b --- /dev/null +++ b/blockchain/v2/demuxer.go @@ -0,0 +1,115 @@ +package v2 + +import "fmt" + +type demuxer struct { + eventbus chan Event + scheduler *Routine + processor *Routine + finished chan error + stopped chan struct{} +} + +func newDemuxer(scheduler *Routine, processor *Routine) *demuxer { + return &demuxer{ + eventbus: make(chan Event, 10), + scheduler: scheduler, + processor: processor, + stopped: make(chan struct{}, 1), + finished: make(chan error, 1), + } +} + +// What should the termination clause be? +// Is any of the subroutines finishe, the demuxer finishes +func (dm *demuxer) run() { + fmt.Printf("demuxer: run\n") + for { + select { + case event, ok := <-dm.eventbus: + if !ok { + fmt.Printf("demuxer: stopping\n") + dm.stopped <- struct{}{} + return + } + oEvents, err := dm.handle(event) + if err != nil { + // TODO Termination time + return + } + for _, event := range oEvents { + dm.eventbus <- event + } + case event, ok := <-dm.scheduler.output: + if !ok { + fmt.Printf("demuxer: scheduler output closed\n") + continue + } + oEvents, err := dm.handle(event) + if err != nil { + // TODO tTermination time + return + } + for _, event := range oEvents { + dm.eventbus <- event + } + case event, ok := <-dm.processor.output: + if !ok { + fmt.Printf("demuxer: processor output closed\n") + continue + } + oEvents, err := dm.handle(event) + if err != nil { + // TODO tTermination time + return + } + for _, event := range oEvents { + dm.eventbus <- event + } + case err := <-dm.scheduler.finished: + dm.finished <- err + case err := <-dm.processor.finished: + dm.finished <- err + } + } +} + +func (dm *demuxer) handle(event Event) (Events, error) { + received := dm.scheduler.send(event) + if !received { + return Events{scFull{}}, nil // backpressure + } + + received = dm.processor.send(event) + if !received { + return Events{pcFull{}}, nil // backpressure + } + + return Events{}, nil +} + +func (dm *demuxer) send(event Event) bool { + fmt.Printf("demuxer send\n") + select { + case dm.eventbus <- event: + return true + default: + fmt.Printf("demuxer channel was full\n") + return false + } +} + +func (dm *demuxer) stop() { + fmt.Printf("demuxer stop\n") + close(dm.eventbus) + <-dm.stopped + dm.terminate(fmt.Errorf("stopped")) +} + +func (dm *demuxer) terminate(reason error) { + dm.finished <- reason +} + +func (dm *demuxer) wait() error { + return <-dm.finished +} diff --git a/blockchain/v2/metrics.go b/blockchain/v2/metrics.go new file mode 100644 index 000000000..d865e7360 --- /dev/null +++ b/blockchain/v2/metrics.go @@ -0,0 +1,124 @@ +package v2 + +import ( + "github.com/go-kit/kit/metrics" + "github.com/go-kit/kit/metrics/discard" + "github.com/go-kit/kit/metrics/prometheus" + stdprometheus "github.com/prometheus/client_golang/prometheus" +) + +const ( + // MetricsSubsystem is a subsystem shared by all metrics exposed by this + // package. + MetricsSubsystem = "blockchain" +) + +// Metrics contains metrics exposed by this package. +type Metrics struct { + // events_in + EventsIn metrics.Counter + // events_in + EventsHandled metrics.Counter + // events_out + EventsOut metrics.Counter + // errors_in + ErrorsIn metrics.Counter + // errors_handled + ErrorsHandled metrics.Counter + // errors_out + ErrorsOut metrics.Counter + // events_shed + EventsShed metrics.Counter + // events_sent + EventsSent metrics.Counter + // errors_sent + ErrorsSent metrics.Counter + // errors_shed + ErrorsShed metrics.Counter +} + +// Can we burn in the routine name here? +func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics { + labels := []string{} + for i := 0; i < len(labelsAndValues); i += 2 { + labels = append(labels, labelsAndValues[i]) + } + return &Metrics{ + EventsIn: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "events_in", + Help: "Events read from the channel.", + }, labels).With(labelsAndValues...), + EventsHandled: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "events_handled", + Help: "Events handled", + }, labels).With(labelsAndValues...), + EventsOut: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "events_out", + Help: "Events output from routine.", + }, labels).With(labelsAndValues...), + ErrorsIn: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "errors_in", + Help: "Errors read from the channel.", + }, labels).With(labelsAndValues...), + ErrorsHandled: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "errors_handled", + Help: "Errors handled.", + }, labels).With(labelsAndValues...), + ErrorsOut: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "errors_out", + Help: "Errors output from routine.", + }, labels).With(labelsAndValues...), + ErrorsSent: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "errors_sent", + Help: "Errors sent to routine.", + }, labels).With(labelsAndValues...), + ErrorsShed: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "errors_shed", + Help: "Errors dropped from sending.", + }, labels).With(labelsAndValues...), + EventsSent: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "events_sent", + Help: "Events sent to routine.", + }, labels).With(labelsAndValues...), + EventsShed: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "events_shed", + Help: "Events dropped from sending.", + }, labels).With(labelsAndValues...), + } +} + +// NopMetrics returns no-op Metrics. +func NopMetrics() *Metrics { + return &Metrics{ + EventsIn: discard.NewCounter(), + EventsHandled: discard.NewCounter(), + EventsOut: discard.NewCounter(), + ErrorsIn: discard.NewCounter(), + ErrorsHandled: discard.NewCounter(), + ErrorsOut: discard.NewCounter(), + EventsShed: discard.NewCounter(), + EventsSent: discard.NewCounter(), + ErrorsSent: discard.NewCounter(), + ErrorsShed: discard.NewCounter(), + } +} diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go new file mode 100644 index 000000000..ffdf92911 --- /dev/null +++ b/blockchain/v2/reactor.go @@ -0,0 +1,98 @@ +package v2 + +import ( + "fmt" + "time" +) + +func schedulerHandle(event Event) (Events, error) { + switch event.(type) { + case timeCheck: + fmt.Println("scheduler handle timeCheck") + case testEvent: + fmt.Println("scheduler handle testEvent") + return Events{scTestEvent{}}, nil + } + return Events{}, nil +} + +func processorHandle(event Event) (Events, error) { + switch event.(type) { + case timeCheck: + fmt.Println("processor handle timeCheck") + case testEvent: + fmt.Println("processor handle testEvent") + case scTestEvent: + fmt.Println("processor handle scTestEvent") + return Events{}, fmt.Errorf("processor done") + } + return Events{}, nil +} + +// reactor +type Reactor struct { + events chan Event + demuxer *demuxer + scheduler *Routine + processor *Routine + ticker *time.Ticker + tickerStopped chan struct{} +} + +func (r *Reactor) Start() { + bufferSize := 10 + events := make(chan Event, bufferSize) + + r.scheduler = newRoutine("scheduler", events, schedulerHandle) + r.processor = newRoutine("processor", events, processorHandle) + r.demuxer = newDemuxer(r.scheduler, r.processor) + r.tickerStopped = make(chan struct{}) + + go r.scheduler.run() + go r.processor.run() + go r.demuxer.run() + + go func() { + ticker := time.NewTicker(1 * time.Second) + for { + select { + case <-ticker.C: + // xxx: what if !sent? + r.demuxer.send(timeCheck{}) + case <-r.tickerStopped: + fmt.Println("ticker stopped") + return + } + } + }() +} + +func (r *Reactor) Wait() { + fmt.Println("completed routines") + r.Stop() +} + +func (r *Reactor) Stop() { + fmt.Println("reactor stopping") + + r.tickerStopped <- struct{}{} + r.demuxer.stop() + r.scheduler.stop() + r.processor.stop() + // todo: accumulator + // todo: io + + fmt.Println("reactor stopped") +} + +func (r *Reactor) Receive(event Event) { + fmt.Println("receive event") + sent := r.demuxer.send(event) + if !sent { + panic("demuxer is full") + } +} + +func (r *Reactor) AddPeer() { + // TODO: add peer event and send to demuxer +} diff --git a/blockchain/v2/reactor_test.go b/blockchain/v2/reactor_test.go new file mode 100644 index 000000000..b3430074f --- /dev/null +++ b/blockchain/v2/reactor_test.go @@ -0,0 +1,17 @@ +package v2 + +import "testing" + +// XXX: This makes assumptions about the message routing +func TestReactor(t *testing.T) { + reactor := Reactor{} + reactor.Start() + script := Events{ + testEvent{}, + } + + for _, event := range script { + reactor.Receive(event) + } + reactor.Wait() +} diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go new file mode 100644 index 000000000..31b918925 --- /dev/null +++ b/blockchain/v2/routine.go @@ -0,0 +1,165 @@ +package v2 + +import ( + "fmt" + "sync/atomic" + + "github.com/tendermint/tendermint/libs/log" +) + +// TODO +// * revisit panic conditions +// * audit log levels +// * maybe routine should be an interface and the concret tpe should be handlerRoutine + +// Adding Metrics +// we need a metrics definition +type handleFunc = func(event Event) (Events, error) + +type Routine struct { + name string + input chan Event + errors chan error + output chan Event + stopped chan struct{} + finished chan error + running *uint32 + handle handleFunc + logger log.Logger + metrics *Metrics +} + +func newRoutine(name string, output chan Event, handleFunc handleFunc) *Routine { + return &Routine{ + name: name, + input: make(chan Event, 1), + handle: handleFunc, + errors: make(chan error, 1), + output: output, + stopped: make(chan struct{}, 1), + finished: make(chan error, 1), + running: new(uint32), + logger: log.NewNopLogger(), + metrics: NopMetrics(), + } +} + +func (rt *Routine) setLogger(logger log.Logger) { + rt.logger = logger +} + +func (rt *Routine) setMetrics(metrics *Metrics) { + rt.metrics = metrics +} + +func (rt *Routine) run() { + rt.logger.Info(fmt.Sprintf("%s: run\n", rt.name)) + starting := atomic.CompareAndSwapUint32(rt.running, uint32(0), uint32(1)) + if !starting { + panic("Routine has already started") + } + errorsDrained := false + for { + if !rt.isRunning() { + break + } + select { + case iEvent, ok := <-rt.input: + rt.metrics.EventsIn.With("routine", rt.name).Add(1) + if !ok { + if !errorsDrained { + continue // wait for errors to be drainned + } + rt.logger.Info(fmt.Sprintf("%s: stopping\n", rt.name)) + rt.stopped <- struct{}{} + return + } + oEvents, err := rt.handle(iEvent) + rt.metrics.EventsHandled.With("routine", rt.name).Add(1) + if err != nil { + rt.terminate(err) + return + } + rt.metrics.EventsOut.With("routine", rt.name).Add(float64(len(oEvents))) + rt.logger.Info(fmt.Sprintf("%s handled %d events\n", rt.name, len(oEvents))) + for _, event := range oEvents { + rt.logger.Info(fmt.Sprintln("writting back to output")) + rt.output <- event + } + case iEvent, ok := <-rt.errors: + rt.metrics.ErrorsIn.With("routine", rt.name).Add(1) + if !ok { + rt.logger.Info(fmt.Sprintf("%s: errors closed\n", rt.name)) + errorsDrained = true + continue + } + oEvents, err := rt.handle(iEvent) + rt.metrics.ErrorsHandled.With("routine", rt.name).Add(1) + if err != nil { + rt.terminate(err) + return + } + rt.metrics.ErrorsOut.With("routine", rt.name).Add(float64(len(oEvents))) + for _, event := range oEvents { + rt.output <- event + } + } + } +} +func (rt *Routine) feedback() { + for event := range rt.output { + rt.send(event) + } +} + +func (rt *Routine) send(event Event) bool { + if err, ok := event.(error); ok { + select { + case rt.errors <- err: + rt.metrics.ErrorsSent.With("routine", rt.name).Add(1) + return true + default: + rt.metrics.ErrorsShed.With("routine", rt.name).Add(1) + rt.logger.Info(fmt.Sprintf("%s: errors channel was full\n", rt.name)) + return false + } + } else { + select { + case rt.input <- event: + rt.metrics.EventsSent.With("routine", rt.name).Add(1) + return true + default: + rt.metrics.EventsShed.With("routine", rt.name).Add(1) + rt.logger.Info(fmt.Sprintf("%s: channel was full\n", rt.name)) + return false + } + } +} + +func (rt *Routine) isRunning() bool { + return atomic.LoadUint32(rt.running) == 1 +} + +// rename flush? +func (rt *Routine) stop() { + // XXX: what if already stopped? + rt.logger.Info(fmt.Sprintf("%s: stop\n", rt.name)) + close(rt.input) + close(rt.errors) + <-rt.stopped + rt.terminate(fmt.Errorf("routine stopped")) +} + +func (rt *Routine) terminate(reason error) { + stopped := atomic.CompareAndSwapUint32(rt.running, uint32(1), uint32(0)) + if !stopped { + panic("called stop but already stopped") + } + rt.finished <- reason +} + +// XXX: this should probably produced the finished +// channel and let the caller deicde how long to wait +func (rt *Routine) wait() error { + return <-rt.finished +} diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go new file mode 100644 index 000000000..98fe716f0 --- /dev/null +++ b/blockchain/v2/routine_test.go @@ -0,0 +1,89 @@ +package v2 + +import ( + "fmt" + "testing" + "time" +) + +type eventA struct{} +type eventB struct{} + +var done = fmt.Errorf("done") + +func simpleHandler(event Event) (Events, error) { + switch event.(type) { + case eventA: + return Events{eventB{}}, nil + case eventB: + return Events{routineFinished{}}, done + } + return Events{}, nil +} + +func TestRoutine(t *testing.T) { + events := make(chan Event, 10) + routine := newRoutine("simpleRoutine", events, simpleHandler) + + go routine.run() + go routine.feedback() + + routine.send(eventA{}) + + routine.wait() +} + +func genStatefulHandler(maxCount int) handleFunc { + counter := 0 + return func(event Event) (Events, error) { + switch event.(type) { + case eventA: + counter += 1 + if counter >= maxCount { + return Events{}, done + } + + return Events{eventA{}}, nil + } + return Events{}, nil + } +} + +func TestStatefulRoutine(t *testing.T) { + events := make(chan Event, 10) + handler := genStatefulHandler(10) + routine := newRoutine("statefulRoutine", events, handler) + + go routine.run() + go routine.feedback() + + go routine.send(eventA{}) + + routine.wait() +} + +func handleWithErrors(event Event) (Events, error) { + switch event.(type) { + case eventA: + return Events{}, nil + case errEvent: + return Events{}, done + } + return Events{}, nil +} + +func TestErrorSaturation(t *testing.T) { + events := make(chan Event, 10) + routine := newRoutine("errorRoutine", events, handleWithErrors) + + go routine.run() + go func() { + for { + routine.send(eventA{}) + time.Sleep(10 * time.Millisecond) + } + }() + routine.send(errEvent{}) + + routine.wait() +} diff --git a/blockchain/v2/types.go b/blockchain/v2/types.go new file mode 100644 index 000000000..c9e31b209 --- /dev/null +++ b/blockchain/v2/types.go @@ -0,0 +1,32 @@ +package v2 + +import "time" + +type testEvent struct { + msg string + time time.Time +} + +type testEventTwo struct { + msg string +} + +type stopEvent struct{} +type timeCheck struct { + time time.Time +} + +type errEvent struct{} + +type scTestEvent struct{} + +type pcFinished struct{} + +type routineFinished struct{} + +func (rf *routineFinished) Error() string { + return "routine finished" +} + +type scFull struct{} +type pcFull struct{} From 0cf9f8629200584a3747a8bcdff6ee9db7de6094 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Tue, 6 Aug 2019 13:27:15 +0200 Subject: [PATCH 02/63] Modification based on feedback + `routine.send` returns false when routine is not running + this will prevent panics sending to channels which have been closed + Make output channels routine specific removing the risk of someone writting to a channel which was closed by another touine. + consistency changes between the routines and the demuxer --- blockchain/v2/demuxer.go | 70 ++++++++++++++++++++++++----------- blockchain/v2/reactor.go | 26 +++++++++---- blockchain/v2/routine.go | 33 +++++++++++------ blockchain/v2/routine_test.go | 65 +++++++++++++++++++++++++++----- blockchain/v2/types.go | 3 ++ 5 files changed, 147 insertions(+), 50 deletions(-) diff --git a/blockchain/v2/demuxer.go b/blockchain/v2/demuxer.go index 511bf7f8b..32165735e 100644 --- a/blockchain/v2/demuxer.go +++ b/blockchain/v2/demuxer.go @@ -1,75 +1,88 @@ package v2 -import "fmt" +import ( + "fmt" + "sync/atomic" +) type demuxer struct { - eventbus chan Event + input chan Event scheduler *Routine processor *Routine finished chan error stopped chan struct{} + running *uint32 } +// TODO +// demuxer_test +// Termination process +// Logger +// Metrics +// Adhere to interface func newDemuxer(scheduler *Routine, processor *Routine) *demuxer { return &demuxer{ - eventbus: make(chan Event, 10), + input: make(chan Event, 10), scheduler: scheduler, processor: processor, stopped: make(chan struct{}, 1), finished: make(chan error, 1), + running: new(uint32), } } -// What should the termination clause be? -// Is any of the subroutines finishe, the demuxer finishes func (dm *demuxer) run() { + starting := atomic.CompareAndSwapUint32(dm.running, uint32(0), uint32(1)) + if !starting { + panic("Routine has already started") + } fmt.Printf("demuxer: run\n") for { + if !dm.isRunning() { + break + } select { - case event, ok := <-dm.eventbus: + case event, ok := <-dm.input: if !ok { fmt.Printf("demuxer: stopping\n") + dm.terminate(fmt.Errorf("stopped")) dm.stopped <- struct{}{} return } oEvents, err := dm.handle(event) if err != nil { - // TODO Termination time + dm.terminate(err) return } for _, event := range oEvents { - dm.eventbus <- event + dm.input <- event } - case event, ok := <-dm.scheduler.output: + case event, ok := <-dm.scheduler.output(): if !ok { fmt.Printf("demuxer: scheduler output closed\n") continue } oEvents, err := dm.handle(event) if err != nil { - // TODO tTermination time + dm.terminate(err) return } for _, event := range oEvents { - dm.eventbus <- event + dm.input <- event } - case event, ok := <-dm.processor.output: + case event, ok := <-dm.processor.output(): if !ok { fmt.Printf("demuxer: processor output closed\n") continue } oEvents, err := dm.handle(event) if err != nil { - // TODO tTermination time + dm.terminate(err) return } for _, event := range oEvents { - dm.eventbus <- event + dm.input <- event } - case err := <-dm.scheduler.finished: - dm.finished <- err - case err := <-dm.processor.finished: - dm.finished <- err } } } @@ -89,9 +102,12 @@ func (dm *demuxer) handle(event Event) (Events, error) { } func (dm *demuxer) send(event Event) bool { - fmt.Printf("demuxer send\n") + if !dm.isRunning() { + fmt.Println("dummuxer isn't running") + return false + } select { - case dm.eventbus <- event: + case dm.input <- event: return true default: fmt.Printf("demuxer channel was full\n") @@ -99,14 +115,24 @@ func (dm *demuxer) send(event Event) bool { } } +func (dm *demuxer) isRunning() bool { + return atomic.LoadUint32(dm.running) == 1 +} + func (dm *demuxer) stop() { + if !dm.isRunning() { + return + } fmt.Printf("demuxer stop\n") - close(dm.eventbus) + close(dm.input) <-dm.stopped - dm.terminate(fmt.Errorf("stopped")) } func (dm *demuxer) terminate(reason error) { + stopped := atomic.CompareAndSwapUint32(dm.running, uint32(1), uint32(0)) + if !stopped { + panic("called terminate but already terminated") + } dm.finished <- reason } diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index ffdf92911..4f07224ca 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -3,6 +3,8 @@ package v2 import ( "fmt" "time" + + "github.com/tendermint/tendermint/libs/log" ) func schedulerHandle(event Event) (Events, error) { @@ -31,7 +33,6 @@ func processorHandle(event Event) (Events, error) { // reactor type Reactor struct { - events chan Event demuxer *demuxer scheduler *Routine processor *Routine @@ -40,11 +41,14 @@ type Reactor struct { } func (r *Reactor) Start() { - bufferSize := 10 - events := make(chan Event, bufferSize) + logger := log.TestingLogger() - r.scheduler = newRoutine("scheduler", events, schedulerHandle) - r.processor = newRoutine("processor", events, processorHandle) + // what is the best way to get the events out of the routine + r.scheduler = newRoutine("scheduler", schedulerHandle) + r.scheduler.setLogger(logger) + r.processor = newRoutine("processor", processorHandle) + r.processor.setLogger(logger) + // so actually the demuxer only needs to read from events r.demuxer = newDemuxer(r.scheduler, r.processor) r.tickerStopped = make(chan struct{}) @@ -52,12 +56,20 @@ func (r *Reactor) Start() { go r.processor.run() go r.demuxer.run() + for { + if r.scheduler.isRunning() && r.processor.isRunning() && r.demuxer.isRunning() { + fmt.Println("routines running") + break + } + fmt.Println("waiting") + time.Sleep(1 * time.Second) + } + go func() { ticker := time.NewTicker(1 * time.Second) for { select { case <-ticker.C: - // xxx: what if !sent? r.demuxer.send(timeCheck{}) case <-r.tickerStopped: fmt.Println("ticker stopped") @@ -89,7 +101,7 @@ func (r *Reactor) Receive(event Event) { fmt.Println("receive event") sent := r.demuxer.send(event) if !sent { - panic("demuxer is full") + fmt.Println("demuxer is full") } } diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index 31b918925..fd923966e 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -10,17 +10,16 @@ import ( // TODO // * revisit panic conditions // * audit log levels -// * maybe routine should be an interface and the concret tpe should be handlerRoutine +// * Convert routine to an interface with concrete implmentation +// * determine the public interface -// Adding Metrics -// we need a metrics definition type handleFunc = func(event Event) (Events, error) type Routine struct { name string input chan Event errors chan error - output chan Event + out chan Event stopped chan struct{} finished chan error running *uint32 @@ -29,13 +28,13 @@ type Routine struct { metrics *Metrics } -func newRoutine(name string, output chan Event, handleFunc handleFunc) *Routine { +func newRoutine(name string, handleFunc handleFunc) *Routine { return &Routine{ name: name, input: make(chan Event, 1), handle: handleFunc, errors: make(chan error, 1), - output: output, + out: make(chan Event, 1), stopped: make(chan struct{}, 1), finished: make(chan error, 1), running: new(uint32), @@ -72,6 +71,7 @@ func (rt *Routine) run() { } rt.logger.Info(fmt.Sprintf("%s: stopping\n", rt.name)) rt.stopped <- struct{}{} + rt.terminate(fmt.Errorf("stopped")) return } oEvents, err := rt.handle(iEvent) @@ -84,7 +84,7 @@ func (rt *Routine) run() { rt.logger.Info(fmt.Sprintf("%s handled %d events\n", rt.name, len(oEvents))) for _, event := range oEvents { rt.logger.Info(fmt.Sprintln("writting back to output")) - rt.output <- event + rt.out <- event } case iEvent, ok := <-rt.errors: rt.metrics.ErrorsIn.With("routine", rt.name).Add(1) @@ -101,18 +101,23 @@ func (rt *Routine) run() { } rt.metrics.ErrorsOut.With("routine", rt.name).Add(float64(len(oEvents))) for _, event := range oEvents { - rt.output <- event + rt.out <- event } } } } func (rt *Routine) feedback() { - for event := range rt.output { + for event := range rt.out { rt.send(event) } } +// XXX: this should be called trySend for consistency func (rt *Routine) send(event Event) bool { + if !rt.isRunning() { + return false + } + rt.logger.Info(fmt.Sprintf("%s: sending %+v", rt.name, event)) if err, ok := event.(error); ok { select { case rt.errors <- err: @@ -140,14 +145,18 @@ func (rt *Routine) isRunning() bool { return atomic.LoadUint32(rt.running) == 1 } -// rename flush? +func (rt *Routine) output() chan Event { + return rt.out +} + func (rt *Routine) stop() { - // XXX: what if already stopped? + if !rt.isRunning() { + return + } rt.logger.Info(fmt.Sprintf("%s: stop\n", rt.name)) close(rt.input) close(rt.errors) <-rt.stopped - rt.terminate(fmt.Errorf("routine stopped")) } func (rt *Routine) terminate(reason error) { diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go index 98fe716f0..8a84dc4de 100644 --- a/blockchain/v2/routine_test.go +++ b/blockchain/v2/routine_test.go @@ -4,6 +4,8 @@ import ( "fmt" "testing" "time" + + "github.com/stretchr/testify/assert" ) type eventA struct{} @@ -22,15 +24,47 @@ func simpleHandler(event Event) (Events, error) { } func TestRoutine(t *testing.T) { - events := make(chan Event, 10) - routine := newRoutine("simpleRoutine", events, simpleHandler) + routine := newRoutine("simpleRoutine", simpleHandler) + assert.False(t, routine.isRunning(), + "expected an initialized routine to not be running") go routine.run() go routine.feedback() + for { + if routine.isRunning() { + break + } + time.Sleep(10 * time.Millisecond) + } routine.send(eventA{}) - routine.wait() + routine.stop() +} + +func TesRoutineSend(t *testing.T) { + routine := newRoutine("simpleRoutine", simpleHandler) + + assert.False(t, routine.send(eventA{}), + "expected sending to an unstarted routine to fail") + + go routine.run() + + go routine.feedback() + for { + if routine.isRunning() { + break + } + time.Sleep(10 * time.Millisecond) + } + + assert.True(t, routine.send(eventA{}), + "expected sending to a running routine to succeed") + + routine.stop() + + assert.False(t, routine.send(eventA{}), + "expected sending to a stopped routine to fail") } func genStatefulHandler(maxCount int) handleFunc { @@ -50,16 +84,22 @@ func genStatefulHandler(maxCount int) handleFunc { } func TestStatefulRoutine(t *testing.T) { - events := make(chan Event, 10) handler := genStatefulHandler(10) - routine := newRoutine("statefulRoutine", events, handler) + routine := newRoutine("statefulRoutine", handler) go routine.run() go routine.feedback() + for { + if routine.isRunning() { + break + } + time.Sleep(10 * time.Millisecond) + } + go routine.send(eventA{}) - routine.wait() + routine.stop() } func handleWithErrors(event Event) (Events, error) { @@ -73,8 +113,7 @@ func handleWithErrors(event Event) (Events, error) { } func TestErrorSaturation(t *testing.T) { - events := make(chan Event, 10) - routine := newRoutine("errorRoutine", events, handleWithErrors) + routine := newRoutine("errorRoutine", handleWithErrors) go routine.run() go func() { @@ -83,7 +122,15 @@ func TestErrorSaturation(t *testing.T) { time.Sleep(10 * time.Millisecond) } }() - routine.send(errEvent{}) + + for { + if routine.isRunning() { + break + } + time.Sleep(10 * time.Millisecond) + } + assert.True(t, routine.send(errEvent{}), + "expected send to succeed even when saturated") routine.wait() } diff --git a/blockchain/v2/types.go b/blockchain/v2/types.go index c9e31b209..e6f491460 100644 --- a/blockchain/v2/types.go +++ b/blockchain/v2/types.go @@ -2,6 +2,9 @@ package v2 import "time" +type Event interface{} + +type Events []Event type testEvent struct { msg string time time.Time From e4913f533a390117086879bbaa09f48115a0d925 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Tue, 6 Aug 2019 18:00:14 +0200 Subject: [PATCH 03/63] Fix race condition in shutdown: + ensure that we stop accepting messages once `stop` has been called to avoid the case in which we attempt to write to a channel which has already been closed --- blockchain/v2/reactor.go | 7 +------ blockchain/v2/routine.go | 24 ++++++++++++++++++++++-- blockchain/v2/routine_test.go | 5 +++-- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 4f07224ca..e8e10ae2d 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -3,8 +3,6 @@ package v2 import ( "fmt" "time" - - "github.com/tendermint/tendermint/libs/log" ) func schedulerHandle(event Event) (Events, error) { @@ -40,14 +38,11 @@ type Reactor struct { tickerStopped chan struct{} } +// TODO: setLogger should set loggers of the routines func (r *Reactor) Start() { - logger := log.TestingLogger() - // what is the best way to get the events out of the routine r.scheduler = newRoutine("scheduler", schedulerHandle) - r.scheduler.setLogger(logger) r.processor = newRoutine("processor", processorHandle) - r.processor.setLogger(logger) // so actually the demuxer only needs to read from events r.demuxer = newDemuxer(r.scheduler, r.processor) r.tickerStopped = make(chan struct{}) diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index fd923966e..e70c76679 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -26,6 +26,7 @@ type Routine struct { handle handleFunc logger log.Logger metrics *Metrics + stopping *uint32 } func newRoutine(name string, handleFunc handleFunc) *Routine { @@ -38,6 +39,7 @@ func newRoutine(name string, handleFunc handleFunc) *Routine { stopped: make(chan struct{}, 1), finished: make(chan error, 1), running: new(uint32), + stopping: new(uint32), logger: log.NewNopLogger(), metrics: NopMetrics(), } @@ -60,6 +62,7 @@ func (rt *Routine) run() { errorsDrained := false for { if !rt.isRunning() { + rt.logger.Info(fmt.Sprintf("%s: breaking because not running\n", rt.name)) break } select { @@ -67,6 +70,8 @@ func (rt *Routine) run() { rt.metrics.EventsIn.With("routine", rt.name).Add(1) if !ok { if !errorsDrained { + rt.logger.Info(fmt.Sprintf("%s: waiting for errors to drain\n", rt.name)) + continue // wait for errors to be drainned } rt.logger.Info(fmt.Sprintf("%s: stopping\n", rt.name)) @@ -112,11 +117,11 @@ func (rt *Routine) feedback() { } } -// XXX: this should be called trySend for consistency func (rt *Routine) send(event Event) bool { - if !rt.isRunning() { + if !rt.isRunning() || rt.isStopping() { return false } + rt.logger.Info(fmt.Sprintf("%s: sending %+v", rt.name, event)) if err, ok := event.(error); ok { select { @@ -145,6 +150,10 @@ func (rt *Routine) isRunning() bool { return atomic.LoadUint32(rt.running) == 1 } +func (rt *Routine) isStopping() bool { + return atomic.LoadUint32(rt.stopping) == 1 +} + func (rt *Routine) output() chan Event { return rt.out } @@ -153,7 +162,13 @@ func (rt *Routine) stop() { if !rt.isRunning() { return } + rt.logger.Info(fmt.Sprintf("%s: stop\n", rt.name)) + stopping := atomic.CompareAndSwapUint32(rt.stopping, uint32(0), uint32(1)) + if !stopping { + panic("Routine has already stopped") + } + close(rt.input) close(rt.errors) <-rt.stopped @@ -172,3 +187,8 @@ func (rt *Routine) terminate(reason error) { func (rt *Routine) wait() error { return <-rt.finished } + +/* + Problem: + We can't write to channels from one thread and close channels from another thread +*/ diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go index 8a84dc4de..7ef8da4d7 100644 --- a/blockchain/v2/routine_test.go +++ b/blockchain/v2/routine_test.go @@ -6,6 +6,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/tendermint/tendermint/libs/log" ) type eventA struct{} @@ -86,6 +87,7 @@ func genStatefulHandler(maxCount int) handleFunc { func TestStatefulRoutine(t *testing.T) { handler := genStatefulHandler(10) routine := newRoutine("statefulRoutine", handler) + routine.setLogger(log.TestingLogger()) go routine.run() go routine.feedback() @@ -97,7 +99,7 @@ func TestStatefulRoutine(t *testing.T) { time.Sleep(10 * time.Millisecond) } - go routine.send(eventA{}) + routine.send(eventA{}) routine.stop() } @@ -114,7 +116,6 @@ func handleWithErrors(event Event) (Events, error) { func TestErrorSaturation(t *testing.T) { routine := newRoutine("errorRoutine", handleWithErrors) - go routine.run() go func() { for { From c081b60ef6f07e1b3b6d9b4a41429481ed95ffdf Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Thu, 8 Aug 2019 15:12:11 +0200 Subject: [PATCH 04/63] Solidify API: + use `trySend` the replicate peer sending + expose `next()` as a chan of events as output + expose `final()` as a chan of error, for the final error + add `ready()` as chan struct when routine is ready --- blockchain/v2/demuxer.go | 22 +++++----- blockchain/v2/reactor.go | 12 ++--- blockchain/v2/routine.go | 37 ++++++++-------- blockchain/v2/routine_test.go | 82 +++++++++++++++++------------------ 4 files changed, 76 insertions(+), 77 deletions(-) diff --git a/blockchain/v2/demuxer.go b/blockchain/v2/demuxer.go index 32165735e..9ae4c3f38 100644 --- a/blockchain/v2/demuxer.go +++ b/blockchain/v2/demuxer.go @@ -9,7 +9,7 @@ type demuxer struct { input chan Event scheduler *Routine processor *Routine - finished chan error + fin chan error stopped chan struct{} running *uint32 } @@ -26,12 +26,12 @@ func newDemuxer(scheduler *Routine, processor *Routine) *demuxer { scheduler: scheduler, processor: processor, stopped: make(chan struct{}, 1), - finished: make(chan error, 1), + fin: make(chan error, 1), running: new(uint32), } } -func (dm *demuxer) run() { +func (dm *demuxer) start() { starting := atomic.CompareAndSwapUint32(dm.running, uint32(0), uint32(1)) if !starting { panic("Routine has already started") @@ -57,7 +57,7 @@ func (dm *demuxer) run() { for _, event := range oEvents { dm.input <- event } - case event, ok := <-dm.scheduler.output(): + case event, ok := <-dm.scheduler.next(): if !ok { fmt.Printf("demuxer: scheduler output closed\n") continue @@ -70,7 +70,7 @@ func (dm *demuxer) run() { for _, event := range oEvents { dm.input <- event } - case event, ok := <-dm.processor.output(): + case event, ok := <-dm.processor.next(): if !ok { fmt.Printf("demuxer: processor output closed\n") continue @@ -88,12 +88,12 @@ func (dm *demuxer) run() { } func (dm *demuxer) handle(event Event) (Events, error) { - received := dm.scheduler.send(event) + received := dm.scheduler.trySend(event) if !received { return Events{scFull{}}, nil // backpressure } - received = dm.processor.send(event) + received = dm.processor.trySend(event) if !received { return Events{pcFull{}}, nil // backpressure } @@ -101,7 +101,7 @@ func (dm *demuxer) handle(event Event) (Events, error) { return Events{}, nil } -func (dm *demuxer) send(event Event) bool { +func (dm *demuxer) trySend(event Event) bool { if !dm.isRunning() { fmt.Println("dummuxer isn't running") return false @@ -133,9 +133,9 @@ func (dm *demuxer) terminate(reason error) { if !stopped { panic("called terminate but already terminated") } - dm.finished <- reason + dm.fin <- reason } -func (dm *demuxer) wait() error { - return <-dm.finished +func (dm *demuxer) final() chan error { + return dm.fin } diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index e8e10ae2d..85f669739 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -47,9 +47,9 @@ func (r *Reactor) Start() { r.demuxer = newDemuxer(r.scheduler, r.processor) r.tickerStopped = make(chan struct{}) - go r.scheduler.run() - go r.processor.run() - go r.demuxer.run() + go r.scheduler.start() + go r.processor.start() + go r.demuxer.start() for { if r.scheduler.isRunning() && r.processor.isRunning() && r.demuxer.isRunning() { @@ -57,7 +57,7 @@ func (r *Reactor) Start() { break } fmt.Println("waiting") - time.Sleep(1 * time.Second) + time.Sleep(10 * time.Millisecond) } go func() { @@ -65,7 +65,7 @@ func (r *Reactor) Start() { for { select { case <-ticker.C: - r.demuxer.send(timeCheck{}) + r.demuxer.trySend(timeCheck{}) case <-r.tickerStopped: fmt.Println("ticker stopped") return @@ -94,7 +94,7 @@ func (r *Reactor) Stop() { func (r *Reactor) Receive(event Event) { fmt.Println("receive event") - sent := r.demuxer.send(event) + sent := r.demuxer.trySend(event) if !sent { fmt.Println("demuxer is full") } diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index e70c76679..1addff468 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -11,7 +11,6 @@ import ( // * revisit panic conditions // * audit log levels // * Convert routine to an interface with concrete implmentation -// * determine the public interface type handleFunc = func(event Event) (Events, error) @@ -21,7 +20,8 @@ type Routine struct { errors chan error out chan Event stopped chan struct{} - finished chan error + rdy chan struct{} + fin chan error running *uint32 handle handleFunc logger log.Logger @@ -37,7 +37,8 @@ func newRoutine(name string, handleFunc handleFunc) *Routine { errors: make(chan error, 1), out: make(chan Event, 1), stopped: make(chan struct{}, 1), - finished: make(chan error, 1), + rdy: make(chan struct{}, 1), + fin: make(chan error, 1), running: new(uint32), stopping: new(uint32), logger: log.NewNopLogger(), @@ -53,12 +54,13 @@ func (rt *Routine) setMetrics(metrics *Metrics) { rt.metrics = metrics } -func (rt *Routine) run() { +func (rt *Routine) start() { rt.logger.Info(fmt.Sprintf("%s: run\n", rt.name)) starting := atomic.CompareAndSwapUint32(rt.running, uint32(0), uint32(1)) if !starting { panic("Routine has already started") } + rt.rdy <- struct{}{} errorsDrained := false for { if !rt.isRunning() { @@ -113,11 +115,11 @@ func (rt *Routine) run() { } func (rt *Routine) feedback() { for event := range rt.out { - rt.send(event) + rt.trySend(event) } } -func (rt *Routine) send(event Event) bool { +func (rt *Routine) trySend(event Event) bool { if !rt.isRunning() || rt.isStopping() { return false } @@ -154,7 +156,11 @@ func (rt *Routine) isStopping() bool { return atomic.LoadUint32(rt.stopping) == 1 } -func (rt *Routine) output() chan Event { +func (rt *Routine) ready() chan struct{} { + return rt.rdy +} + +func (rt *Routine) next() chan Event { return rt.out } @@ -174,21 +180,14 @@ func (rt *Routine) stop() { <-rt.stopped } +func (rt *Routine) final() chan error { + return rt.fin +} + func (rt *Routine) terminate(reason error) { stopped := atomic.CompareAndSwapUint32(rt.running, uint32(1), uint32(0)) if !stopped { panic("called stop but already stopped") } - rt.finished <- reason + rt.fin <- reason } - -// XXX: this should probably produced the finished -// channel and let the caller deicde how long to wait -func (rt *Routine) wait() error { - return <-rt.finished -} - -/* - Problem: - We can't write to channels from one thread and close channels from another thread -*/ diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go index 7ef8da4d7..cbf4768a8 100644 --- a/blockchain/v2/routine_test.go +++ b/blockchain/v2/routine_test.go @@ -19,7 +19,7 @@ func simpleHandler(event Event) (Events, error) { case eventA: return Events{eventB{}}, nil case eventB: - return Events{routineFinished{}}, done + return Events{}, done } return Events{}, nil } @@ -29,53 +29,54 @@ func TestRoutine(t *testing.T) { assert.False(t, routine.isRunning(), "expected an initialized routine to not be running") - go routine.run() + go routine.start() go routine.feedback() - for { - if routine.isRunning() { - break - } - time.Sleep(10 * time.Millisecond) - } + <-routine.ready() - routine.send(eventA{}) + assert.True(t, routine.trySend(eventA{}), + "expected sending to a ready routine to succeed") - routine.stop() + assert.Equal(t, done, <-routine.final(), + "expected the final event to be done") } func TesRoutineSend(t *testing.T) { routine := newRoutine("simpleRoutine", simpleHandler) - assert.False(t, routine.send(eventA{}), + assert.False(t, routine.trySend(eventA{}), "expected sending to an unstarted routine to fail") - go routine.run() + go routine.start() go routine.feedback() - for { - if routine.isRunning() { - break - } - time.Sleep(10 * time.Millisecond) - } + <-routine.ready() - assert.True(t, routine.send(eventA{}), + assert.True(t, routine.trySend(eventA{}), "expected sending to a running routine to succeed") routine.stop() - assert.False(t, routine.send(eventA{}), + assert.False(t, routine.trySend(eventA{}), "expected sending to a stopped routine to fail") } +type finalCount struct { + count int +} + +func (f finalCount) Error() string { + return "end" +} + func genStatefulHandler(maxCount int) handleFunc { counter := 0 return func(event Event) (Events, error) { + // golint fixme switch event.(type) { case eventA: counter += 1 if counter >= maxCount { - return Events{}, done + return Events{}, finalCount{counter} } return Events{eventA{}}, nil @@ -85,23 +86,27 @@ func genStatefulHandler(maxCount int) handleFunc { } func TestStatefulRoutine(t *testing.T) { - handler := genStatefulHandler(10) + count := 10 + handler := genStatefulHandler(count) routine := newRoutine("statefulRoutine", handler) routine.setLogger(log.TestingLogger()) - go routine.run() + go routine.start() go routine.feedback() - for { - if routine.isRunning() { - break - } - time.Sleep(10 * time.Millisecond) - } + <-routine.ready() - routine.send(eventA{}) + assert.True(t, routine.trySend(eventA{}), + "expected sending to a started routine to succeed") - routine.stop() + final := <-routine.final() + fnl, ok := final.(finalCount) + if ok { + assert.Equal(t, count, fnl.count, + "expected the routine to count to 10") + } else { + t.Fail() + } } func handleWithErrors(event Event) (Events, error) { @@ -116,22 +121,17 @@ func handleWithErrors(event Event) (Events, error) { func TestErrorSaturation(t *testing.T) { routine := newRoutine("errorRoutine", handleWithErrors) - go routine.run() + go routine.start() + <-routine.ready() go func() { for { - routine.send(eventA{}) + routine.trySend(eventA{}) time.Sleep(10 * time.Millisecond) } }() - for { - if routine.isRunning() { - break - } - time.Sleep(10 * time.Millisecond) - } - assert.True(t, routine.send(errEvent{}), + assert.True(t, routine.trySend(errEvent{}), "expected send to succeed even when saturated") - routine.wait() + assert.Equal(t, done, <-routine.final()) } From 5b880fbcff0439099932a133e9566de19494134b Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Thu, 8 Aug 2019 15:53:02 +0200 Subject: [PATCH 05/63] cleanup events --- blockchain/v2/demuxer.go | 3 +++ blockchain/v2/reactor.go | 16 +++++++--------- blockchain/v2/reactor_test.go | 2 +- blockchain/v2/routine_test.go | 1 + blockchain/v2/types.go | 31 ------------------------------- 5 files changed, 12 insertions(+), 41 deletions(-) diff --git a/blockchain/v2/demuxer.go b/blockchain/v2/demuxer.go index 9ae4c3f38..6b9df0f50 100644 --- a/blockchain/v2/demuxer.go +++ b/blockchain/v2/demuxer.go @@ -5,6 +5,9 @@ import ( "sync/atomic" ) +type scFull struct{} +type pcFull struct{} + type demuxer struct { input chan Event scheduler *Routine diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 85f669739..0a12f385c 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -5,13 +5,16 @@ import ( "time" ) +type timeCheck struct { + time time.Time +} + func schedulerHandle(event Event) (Events, error) { switch event.(type) { case timeCheck: fmt.Println("scheduler handle timeCheck") - case testEvent: + case Event: fmt.Println("scheduler handle testEvent") - return Events{scTestEvent{}}, nil } return Events{}, nil } @@ -20,11 +23,8 @@ func processorHandle(event Event) (Events, error) { switch event.(type) { case timeCheck: fmt.Println("processor handle timeCheck") - case testEvent: - fmt.Println("processor handle testEvent") - case scTestEvent: - fmt.Println("processor handle scTestEvent") - return Events{}, fmt.Errorf("processor done") + case Event: + fmt.Println("processor handle event") } return Events{}, nil } @@ -40,10 +40,8 @@ type Reactor struct { // TODO: setLogger should set loggers of the routines func (r *Reactor) Start() { - // what is the best way to get the events out of the routine r.scheduler = newRoutine("scheduler", schedulerHandle) r.processor = newRoutine("processor", processorHandle) - // so actually the demuxer only needs to read from events r.demuxer = newDemuxer(r.scheduler, r.processor) r.tickerStopped = make(chan struct{}) diff --git a/blockchain/v2/reactor_test.go b/blockchain/v2/reactor_test.go index b3430074f..d075641f7 100644 --- a/blockchain/v2/reactor_test.go +++ b/blockchain/v2/reactor_test.go @@ -7,7 +7,7 @@ func TestReactor(t *testing.T) { reactor := Reactor{} reactor.Start() script := Events{ - testEvent{}, + struct{}{}, } for _, event := range script { diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go index cbf4768a8..cb7944ba3 100644 --- a/blockchain/v2/routine_test.go +++ b/blockchain/v2/routine_test.go @@ -11,6 +11,7 @@ import ( type eventA struct{} type eventB struct{} +type errEvent struct{} var done = fmt.Errorf("done") diff --git a/blockchain/v2/types.go b/blockchain/v2/types.go index e6f491460..dbde352a3 100644 --- a/blockchain/v2/types.go +++ b/blockchain/v2/types.go @@ -1,35 +1,4 @@ package v2 -import "time" - type Event interface{} - type Events []Event -type testEvent struct { - msg string - time time.Time -} - -type testEventTwo struct { - msg string -} - -type stopEvent struct{} -type timeCheck struct { - time time.Time -} - -type errEvent struct{} - -type scTestEvent struct{} - -type pcFinished struct{} - -type routineFinished struct{} - -func (rf *routineFinished) Error() string { - return "routine finished" -} - -type scFull struct{} -type pcFull struct{} From e826ca3c494904d63142766a5bf6165eab4a08cc Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Thu, 8 Aug 2019 16:48:07 +0200 Subject: [PATCH 06/63] demuxer cleanup --- blockchain/v2/demuxer.go | 46 ++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/blockchain/v2/demuxer.go b/blockchain/v2/demuxer.go index 6b9df0f50..70b670b2f 100644 --- a/blockchain/v2/demuxer.go +++ b/blockchain/v2/demuxer.go @@ -3,6 +3,8 @@ package v2 import ( "fmt" "sync/atomic" + + "github.com/tendermint/tendermint/libs/log" ) type scFull struct{} @@ -14,15 +16,12 @@ type demuxer struct { processor *Routine fin chan error stopped chan struct{} + rdy chan struct{} running *uint32 + stopping *uint32 + logger log.Logger } -// TODO -// demuxer_test -// Termination process -// Logger -// Metrics -// Adhere to interface func newDemuxer(scheduler *Routine, processor *Routine) *demuxer { return &demuxer{ input: make(chan Event, 10), @@ -30,16 +29,23 @@ func newDemuxer(scheduler *Routine, processor *Routine) *demuxer { processor: processor, stopped: make(chan struct{}, 1), fin: make(chan error, 1), + rdy: make(chan struct{}, 1), running: new(uint32), + stopping: new(uint32), + logger: log.NewNopLogger(), } } +func (dm *demuxer) setLogger(logger log.Logger) { + dm.logger = logger +} + func (dm *demuxer) start() { starting := atomic.CompareAndSwapUint32(dm.running, uint32(0), uint32(1)) if !starting { panic("Routine has already started") } - fmt.Printf("demuxer: run\n") + dm.logger.Info("demuxer: run") for { if !dm.isRunning() { break @@ -47,7 +53,7 @@ func (dm *demuxer) start() { select { case event, ok := <-dm.input: if !ok { - fmt.Printf("demuxer: stopping\n") + dm.logger.Info("demuxer: stopping") dm.terminate(fmt.Errorf("stopped")) dm.stopped <- struct{}{} return @@ -62,7 +68,7 @@ func (dm *demuxer) start() { } case event, ok := <-dm.scheduler.next(): if !ok { - fmt.Printf("demuxer: scheduler output closed\n") + dm.logger.Info("demuxer: scheduler output closed") continue } oEvents, err := dm.handle(event) @@ -75,7 +81,7 @@ func (dm *demuxer) start() { } case event, ok := <-dm.processor.next(): if !ok { - fmt.Printf("demuxer: processor output closed\n") + dm.logger.Info("demuxer: processor output closed") continue } oEvents, err := dm.handle(event) @@ -105,15 +111,15 @@ func (dm *demuxer) handle(event Event) (Events, error) { } func (dm *demuxer) trySend(event Event) bool { - if !dm.isRunning() { - fmt.Println("dummuxer isn't running") + if !dm.isRunning() || dm.isStopping() { + dm.logger.Info("dummuxer isn't running") return false } select { case dm.input <- event: return true default: - fmt.Printf("demuxer channel was full\n") + dm.logger.Info("demuxer channel was full") return false } } @@ -122,11 +128,23 @@ func (dm *demuxer) isRunning() bool { return atomic.LoadUint32(dm.running) == 1 } +func (dm *demuxer) isStopping() bool { + return atomic.LoadUint32(dm.stopping) == 1 +} + +func (dm *demuxer) ready() chan struct{} { + return dm.rdy +} + func (dm *demuxer) stop() { if !dm.isRunning() { return } - fmt.Printf("demuxer stop\n") + stopping := atomic.CompareAndSwapUint32(dm.stopping, uint32(0), uint32(1)) + if !stopping { + panic("Demuxer has already stopped") + } + dm.logger.Info("demuxer stop") close(dm.input) <-dm.stopped } From aeac4743ccf292b57f0d02587a33b3fc7300a180 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Thu, 8 Aug 2019 16:54:25 +0200 Subject: [PATCH 07/63] typo fix --- blockchain/v2/routine.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index 1addff468..715be6b4a 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -90,7 +90,7 @@ func (rt *Routine) start() { rt.metrics.EventsOut.With("routine", rt.name).Add(float64(len(oEvents))) rt.logger.Info(fmt.Sprintf("%s handled %d events\n", rt.name, len(oEvents))) for _, event := range oEvents { - rt.logger.Info(fmt.Sprintln("writting back to output")) + rt.logger.Info(fmt.Sprintln("writing back to output")) rt.out <- event } case iEvent, ok := <-rt.errors: From acbfe67fb84175444132b4017a0c0d6d8579841c Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Thu, 8 Aug 2019 16:56:39 +0200 Subject: [PATCH 08/63] set logger --- blockchain/v2/reactor.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 0a12f385c..e76cb4e7e 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -3,6 +3,8 @@ package v2 import ( "fmt" "time" + + "github.com/tendermint/tendermint/libs/log" ) type timeCheck struct { @@ -38,7 +40,12 @@ type Reactor struct { tickerStopped chan struct{} } -// TODO: setLogger should set loggers of the routines +func (r *Reactor) setLogger(logger log.Logger) { + r.scheduler.setLogger(logger) + r.processor.setLogger(logger) + r.demuxer.setLogger(logger) +} + func (r *Reactor) Start() { r.scheduler = newRoutine("scheduler", schedulerHandle) r.processor = newRoutine("processor", processorHandle) From 2c8cbfc26ad5790e03acb62770fd386e63a457c9 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Thu, 8 Aug 2019 17:42:46 +0200 Subject: [PATCH 09/63] linter fixes --- blockchain/v2/demuxer.go | 2 ++ blockchain/v2/reactor.go | 15 ++++----------- blockchain/v2/routine.go | 1 + blockchain/v2/routine_test.go | 4 +++- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/blockchain/v2/demuxer.go b/blockchain/v2/demuxer.go index 70b670b2f..7996ecfa0 100644 --- a/blockchain/v2/demuxer.go +++ b/blockchain/v2/demuxer.go @@ -1,3 +1,4 @@ +// nolint:unused package v2 import ( @@ -46,6 +47,7 @@ func (dm *demuxer) start() { panic("Routine has already started") } dm.logger.Info("demuxer: run") + dm.rdy <- struct{}{} for { if !dm.isRunning() { break diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index e76cb4e7e..97226a5d9 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -8,7 +8,6 @@ import ( ) type timeCheck struct { - time time.Time } func schedulerHandle(event Event) (Events, error) { @@ -31,15 +30,14 @@ func processorHandle(event Event) (Events, error) { return Events{}, nil } -// reactor type Reactor struct { demuxer *demuxer scheduler *Routine processor *Routine - ticker *time.Ticker tickerStopped chan struct{} } +// nolint:unused func (r *Reactor) setLogger(logger log.Logger) { r.scheduler.setLogger(logger) r.processor.setLogger(logger) @@ -56,14 +54,9 @@ func (r *Reactor) Start() { go r.processor.start() go r.demuxer.start() - for { - if r.scheduler.isRunning() && r.processor.isRunning() && r.demuxer.isRunning() { - fmt.Println("routines running") - break - } - fmt.Println("waiting") - time.Sleep(10 * time.Millisecond) - } + <-r.scheduler.ready() + <-r.processor.ready() + <-r.demuxer.ready() go func() { ticker := time.NewTicker(1 * time.Second) diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index 715be6b4a..977d2cd16 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -50,6 +50,7 @@ func (rt *Routine) setLogger(logger log.Logger) { rt.logger = logger } +// nolint:unused func (rt *Routine) setMetrics(metrics *Metrics) { rt.metrics = metrics } diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go index cb7944ba3..8de36e275 100644 --- a/blockchain/v2/routine_test.go +++ b/blockchain/v2/routine_test.go @@ -41,7 +41,7 @@ func TestRoutine(t *testing.T) { "expected the final event to be done") } -func TesRoutineSend(t *testing.T) { +func TestRoutineSend(t *testing.T) { routine := newRoutine("simpleRoutine", simpleHandler) assert.False(t, routine.trySend(eventA{}), @@ -81,6 +81,8 @@ func genStatefulHandler(maxCount int) handleFunc { } return Events{eventA{}}, nil + case eventB: + return Events{}, nil } return Events{}, nil } From 78d4c3b88a098249e00b347cabadae1523d2a42d Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Tue, 13 Aug 2019 17:57:17 +0200 Subject: [PATCH 10/63] fixes based on feedback --- blockchain/v2/demuxer.go | 4 +++- blockchain/v2/reactor.go | 24 +++++++++--------------- blockchain/v2/routine.go | 3 ++- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/blockchain/v2/demuxer.go b/blockchain/v2/demuxer.go index 7996ecfa0..e19816a2d 100644 --- a/blockchain/v2/demuxer.go +++ b/blockchain/v2/demuxer.go @@ -11,6 +11,8 @@ import ( type scFull struct{} type pcFull struct{} +const demuxerBufferSize = 10 + type demuxer struct { input chan Event scheduler *Routine @@ -25,7 +27,7 @@ type demuxer struct { func newDemuxer(scheduler *Routine, processor *Routine) *demuxer { return &demuxer{ - input: make(chan Event, 10), + input: make(chan Event, demuxerBufferSize), scheduler: scheduler, processor: processor, stopped: make(chan struct{}, 1), diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 97226a5d9..7c7bf4e27 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -8,6 +8,7 @@ import ( ) type timeCheck struct { + time time.Time } func schedulerHandle(event Event) (Events, error) { @@ -31,10 +32,10 @@ func processorHandle(event Event) (Events, error) { } type Reactor struct { - demuxer *demuxer - scheduler *Routine - processor *Routine - tickerStopped chan struct{} + demuxer *demuxer + scheduler *Routine + processor *Routine + ticker *time.Ticker } // nolint:unused @@ -48,7 +49,7 @@ func (r *Reactor) Start() { r.scheduler = newRoutine("scheduler", schedulerHandle) r.processor = newRoutine("processor", processorHandle) r.demuxer = newDemuxer(r.scheduler, r.processor) - r.tickerStopped = make(chan struct{}) + r.ticker = time.NewTicker(1 * time.Second) go r.scheduler.start() go r.processor.start() @@ -59,15 +60,8 @@ func (r *Reactor) Start() { <-r.demuxer.ready() go func() { - ticker := time.NewTicker(1 * time.Second) - for { - select { - case <-ticker.C: - r.demuxer.trySend(timeCheck{}) - case <-r.tickerStopped: - fmt.Println("ticker stopped") - return - } + for t := range r.ticker.C { + r.demuxer.trySend(timeCheck{t}) } }() } @@ -80,7 +74,7 @@ func (r *Reactor) Wait() { func (r *Reactor) Stop() { fmt.Println("reactor stopping") - r.tickerStopped <- struct{}{} + r.ticker.Stop() r.demuxer.stop() r.scheduler.stop() r.processor.stop() diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index 977d2cd16..ecd12c82c 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -56,6 +56,7 @@ func (rt *Routine) setMetrics(metrics *Metrics) { } func (rt *Routine) start() { + // what if we call baseService.start rt.logger.Info(fmt.Sprintf("%s: run\n", rt.name)) starting := atomic.CompareAndSwapUint32(rt.running, uint32(0), uint32(1)) if !starting { @@ -78,7 +79,7 @@ func (rt *Routine) start() { continue // wait for errors to be drainned } rt.logger.Info(fmt.Sprintf("%s: stopping\n", rt.name)) - rt.stopped <- struct{}{} + close(rt.stopped) rt.terminate(fmt.Errorf("stopped")) return } From f81c319ecef8b20c7f77b817177f8305b3232bb3 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Tue, 13 Aug 2019 19:29:28 +0200 Subject: [PATCH 11/63] Add some docs --- blockchain/v2/routine.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index ecd12c82c..089414708 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -14,6 +14,12 @@ import ( type handleFunc = func(event Event) (Events, error) +// Routines are a structure which model a finite state machine as serialized +// stream of events processed by a handle function. This Routine structure +// handles the concurrency and messaging guarantees. Events are sent via +// `trySend` are handled by the `handle` function to produce an iterator +// `next()`. Calling `close()` on a routine will conclude processing of all +// sent events and produce `last()` event representing the terminal state. type Routine struct { name string input chan Event @@ -56,7 +62,6 @@ func (rt *Routine) setMetrics(metrics *Metrics) { } func (rt *Routine) start() { - // what if we call baseService.start rt.logger.Info(fmt.Sprintf("%s: run\n", rt.name)) starting := atomic.CompareAndSwapUint32(rt.running, uint32(0), uint32(1)) if !starting { From 9d41770a99b7331abcfa258f564e5acfe03bcea1 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Wed, 21 Aug 2019 21:37:53 +0200 Subject: [PATCH 12/63] Close rdy channel + close `rdy` channel to ensure that calls to `<-ready()` will always return if the routine is ready --- blockchain/v2/routine.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index 089414708..b9b09e3df 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -67,7 +67,7 @@ func (rt *Routine) start() { if !starting { panic("Routine has already started") } - rt.rdy <- struct{}{} + close(rt.rdy) errorsDrained := false for { if !rt.isRunning() { From 72785a2e86256b2e514436f6d67a545bd1572454 Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 2 Sep 2019 20:23:02 +0200 Subject: [PATCH 13/63] docs: switch the data in `/unconfirmed_txs` and `num_unconfirmed_txs` (#3933) - switch the data that was represented in `/unconfirmed_txs` and `num_unconfirmed_txs` Signed-off-by: Marko Baricevic --- docs/spec/rpc/swagger.yaml | 6 ++---- rpc/core/mempool.go | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/spec/rpc/swagger.yaml b/docs/spec/rpc/swagger.yaml index a276304a1..ef16bc72b 100644 --- a/docs/spec/rpc/swagger.yaml +++ b/docs/spec/rpc/swagger.yaml @@ -2230,7 +2230,7 @@ definitions: type: "object" type: "object" type: "object" - UnconfirmedTransactionsResponse: + NumUnconfirmedTransactionsResponse: type: object required: - "jsonrpc" @@ -2248,7 +2248,6 @@ definitions: - "n_txs" - "total" - "total_bytes" - # - "txs" properties: n_txs: type: "string" @@ -2268,7 +2267,7 @@ definitions: # example: # - "gAPwYl3uCjCMTXENChSMnIkb5ZpYHBKIZqecFEV2tuZr7xIUA75/FmYq9WymsOBJ0XSJ8yV8zmQKMIxNcQ0KFIyciRvlmlgcEohmp5wURXa25mvvEhQbrvwbvlNiT+Yjr86G+YQNx7kRVgowjE1xDQoUjJyJG+WaWBwSiGannBRFdrbma+8SFK2m+1oxgILuQLO55n8mWfnbIzyPCjCMTXENChSMnIkb5ZpYHBKIZqecFEV2tuZr7xIUQNGfkmhTNMis4j+dyMDIWXdIPiYKMIxNcQ0KFIyciRvlmlgcEohmp5wURXa25mvvEhS8sL0D0wwgGCItQwVowak5YB38KRIUCg4KBXVhdG9tEgUxMDA1NBDoxRgaagom61rphyECn8x7emhhKdRCB2io7aS/6Cpuq5NbVqbODmqOT3jWw6kSQKUresk+d+Gw0BhjiggTsu8+1voW+VlDCQ1GRYnMaFOHXhyFv7BCLhFWxLxHSAYT8a5XqoMayosZf9mANKdXArA=" type: "object" - NumUnconfirmedTransactionsResponse: + UnconfirmedTransactionsResponse: type: object required: - "jsonrpc" @@ -2304,7 +2303,6 @@ definitions: type: string x-nullable: true example: - - null - "gAPwYl3uCjCMTXENChSMnIkb5ZpYHBKIZqecFEV2tuZr7xIUA75/FmYq9WymsOBJ0XSJ8yV8zmQKMIxNcQ0KFIyciRvlmlgcEohmp5wURXa25mvvEhQbrvwbvlNiT+Yjr86G+YQNx7kRVgowjE1xDQoUjJyJG+WaWBwSiGannBRFdrbma+8SFK2m+1oxgILuQLO55n8mWfnbIzyPCjCMTXENChSMnIkb5ZpYHBKIZqecFEV2tuZr7xIUQNGfkmhTNMis4j+dyMDIWXdIPiYKMIxNcQ0KFIyciRvlmlgcEohmp5wURXa25mvvEhS8sL0D0wwgGCItQwVowak5YB38KRIUCg4KBXVhdG9tEgUxMDA1NBDoxRgaagom61rphyECn8x7emhhKdRCB2io7aS/6Cpuq5NbVqbODmqOT3jWw6kSQKUresk+d+Gw0BhjiggTsu8+1voW+VlDCQ1GRYnMaFOHXhyFv7BCLhFWxLxHSAYT8a5XqoMayosZf9mANKdXArA=" type: "object" TxSearchResponse: diff --git a/rpc/core/mempool.go b/rpc/core/mempool.go index 1a0954438..ba1ed291d 100644 --- a/rpc/core/mempool.go +++ b/rpc/core/mempool.go @@ -346,7 +346,7 @@ func UnconfirmedTxs(ctx *rpctypes.Context, limit int) (*ctypes.ResultUnconfirmed // client := client.NewHTTP("tcp://0.0.0.0:26657", "/websocket") // err := client.Start() // if err != nil { -// // handle error +// // handle error // } // defer client.Stop() // result, err := client.UnconfirmedTxs() @@ -361,8 +361,8 @@ func UnconfirmedTxs(ctx *rpctypes.Context, limit int) (*ctypes.ResultUnconfirmed // "result" : { // "n_txs" : "0", // "total_bytes" : "0", -// "txs" : null, // "total" : "0" +// "txs" : null, // } // } // ``` From 1802b6083328a30a9ee253c43ce67b45c171f21d Mon Sep 17 00:00:00 2001 From: Michelle-L <39503657+Michelle-L@users.noreply.github.com> Date: Tue, 3 Sep 2019 09:38:32 +0200 Subject: [PATCH 14/63] docs: add dev sessions from YouTube (#3929) * Create development_sessions * Rename development_sessions to videos_development_sessions * Update videos_development_sessions * Rename videos_development_sessions to videos_development_sessions_md * Delete videos_development_sessions_md * Add files via upload --- Tendermint-Core-Development Sessions.md | 53 +++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Tendermint-Core-Development Sessions.md diff --git a/Tendermint-Core-Development Sessions.md b/Tendermint-Core-Development Sessions.md new file mode 100644 index 000000000..c1c7f90f2 --- /dev/null +++ b/Tendermint-Core-Development Sessions.md @@ -0,0 +1,53 @@ +# Tendermint-Core-Development Sessions + +The Tendermint Core developer call is comprised of both [Interchain Foundation](http://interchain.io/) and [All in Bits](https://tendermint.com/) team members discussing the development of [Tendermint BFT](https://github.com/tendermint/tendermint) and related research. The goal of the Tendermint Core developer calls is to provide transparency into the decision making process, technical information, update cycles etc. + + + + + + + + + +# Previous Tendermint Core Development Sessions + +August 2019 | Part Three: Tendermint Lite Client | [video](https://www.youtube.com/watch?v=whyL6UrKe7I&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=5) | + +August 2019 | Fork Accountability | [video](https://www.youtube.com/watch?v=Jph-4PGtdPo&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=4) | + +July 2019 | Part Two: Tendermint Lite Client | [video](https://www.youtube.com/watch?v=gTjG7jNNdKQ&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=6) | + +July 2019 | Part One: Tendermint Lite Client | [video](https://www.youtube.com/watch?v=C6fH_sgPJzA&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=7) | + +June 2019 | Testnet Deployments | [video](https://www.youtube.com/watch?v=gYA6no7tRlM&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=10) | + +June 2019 | Blockchain Reactor Refactor | [video](https://www.youtube.com/watch?v=JLBGH8yxABk&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=11) | + +June 2019 | Tendermint Rust Libraries | [video](https://www.youtube.com/watch?v=-WXKdyoGHwA&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=9) | + +May 2019 | Merkle Tree Deep Dive | [video](https://www.youtube.com/watch?v=L3bt2Uw8ICg&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=8) | + +May 2019 |Remote Signer Refactor | [video](https://www.youtube.com/watch?v=eUyXXEEuBzQ&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=12) | + +May 2019 | Introduction to Ansible | [video](https://www.youtube.com/watch?v=72clQLjzPg4&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=14&t=0s) | + +April 2019 | Tendermint State Sync Design Discussion | [video](https://www.youtube.com/watch?v=4k23j2QHwrM&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=11) | + +April 2019 | ADR-036 - Blockchain Reactor Refactor | [video](https://www.youtube.com/watch?v=TW2xC1LwEkE&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=10)| + +April 2019 | Verifying Distributed Algorithms | [video](https://www.youtube.com/watch?v=tMd4lgPVBxE&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=9) | + +April 2019 | Byzantine Model Checker Presentation | [video](https://www.youtube.com/watch?v=rdXl4VCQyow&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=8)| + +January 2019 | Proposer Selection in Idris | [video](https://www.youtube.com/watch?v=hWZdc9c1aH8&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=7)| + +January 2019 | Current Mempool Design | [video](https://www.youtube.com/watch?v=--iGIYYiLu4&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=6)| + +December 2018 | ABCI Proxy App | [video](https://www.youtube.com/watch?v=s6sQ2HOVHdo&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=5)| + +October 2018| DB Performance | [video](https://www.youtube.com/watch?v=jVSNHi4l0fQ&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=4)| + +October 8,2018| Alternative Mempool Algorithms| [video](https://www.youtube.com/watch?v=XxH5ZtM4vMM&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=2)| + +October 2018| Tendermint Termination | [video](https://www.youtube.com/watch?v=YBZjecfjeIk&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv) | \ No newline at end of file From acb874eaf668a57a98cae613cc0c77b8f9c3c1af Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 3 Sep 2019 11:59:13 +0400 Subject: [PATCH 15/63] docs: move dev sessions into docs (#3934) * docs: move dev sessions into docs and transform the list into a table * fix formatting --- README.md | 5 +-- Tendermint-Core-Development Sessions.md | 53 ------------------------- docs/DEV_SESSIONS.md | 33 +++++++++++++++ 3 files changed, 35 insertions(+), 56 deletions(-) delete mode 100644 Tendermint-Core-Development Sessions.md create mode 100644 docs/DEV_SESSIONS.md diff --git a/README.md b/README.md index 3ea9d5de4..d7928f668 100644 --- a/README.md +++ b/README.md @@ -74,9 +74,8 @@ and the [contributing guidelines](CONTRIBUTING.md) when submitting code. Join the larger community on the [forum](https://forum.cosmos.network/) and the [chat](https://riot.im/app/#/room/#tendermint:matrix.org). To learn more about the structure of the software, watch the [Developer -Sessions](https://www.youtube.com/playlist?list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv) -and read some [Architectural -Decision Records](https://github.com/tendermint/tendermint/tree/master/docs/architecture). +Sessions](/docs/DEV_SESSIONS.md) and read some [Architectural Decision +Records](https://github.com/tendermint/tendermint/tree/master/docs/architecture). Learn more by reading the code and comparing it to the [specification](https://github.com/tendermint/tendermint/tree/develop/docs/spec). diff --git a/Tendermint-Core-Development Sessions.md b/Tendermint-Core-Development Sessions.md deleted file mode 100644 index c1c7f90f2..000000000 --- a/Tendermint-Core-Development Sessions.md +++ /dev/null @@ -1,53 +0,0 @@ -# Tendermint-Core-Development Sessions - -The Tendermint Core developer call is comprised of both [Interchain Foundation](http://interchain.io/) and [All in Bits](https://tendermint.com/) team members discussing the development of [Tendermint BFT](https://github.com/tendermint/tendermint) and related research. The goal of the Tendermint Core developer calls is to provide transparency into the decision making process, technical information, update cycles etc. - - - - - - - - - -# Previous Tendermint Core Development Sessions - -August 2019 | Part Three: Tendermint Lite Client | [video](https://www.youtube.com/watch?v=whyL6UrKe7I&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=5) | - -August 2019 | Fork Accountability | [video](https://www.youtube.com/watch?v=Jph-4PGtdPo&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=4) | - -July 2019 | Part Two: Tendermint Lite Client | [video](https://www.youtube.com/watch?v=gTjG7jNNdKQ&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=6) | - -July 2019 | Part One: Tendermint Lite Client | [video](https://www.youtube.com/watch?v=C6fH_sgPJzA&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=7) | - -June 2019 | Testnet Deployments | [video](https://www.youtube.com/watch?v=gYA6no7tRlM&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=10) | - -June 2019 | Blockchain Reactor Refactor | [video](https://www.youtube.com/watch?v=JLBGH8yxABk&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=11) | - -June 2019 | Tendermint Rust Libraries | [video](https://www.youtube.com/watch?v=-WXKdyoGHwA&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=9) | - -May 2019 | Merkle Tree Deep Dive | [video](https://www.youtube.com/watch?v=L3bt2Uw8ICg&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=8) | - -May 2019 |Remote Signer Refactor | [video](https://www.youtube.com/watch?v=eUyXXEEuBzQ&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=12) | - -May 2019 | Introduction to Ansible | [video](https://www.youtube.com/watch?v=72clQLjzPg4&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=14&t=0s) | - -April 2019 | Tendermint State Sync Design Discussion | [video](https://www.youtube.com/watch?v=4k23j2QHwrM&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=11) | - -April 2019 | ADR-036 - Blockchain Reactor Refactor | [video](https://www.youtube.com/watch?v=TW2xC1LwEkE&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=10)| - -April 2019 | Verifying Distributed Algorithms | [video](https://www.youtube.com/watch?v=tMd4lgPVBxE&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=9) | - -April 2019 | Byzantine Model Checker Presentation | [video](https://www.youtube.com/watch?v=rdXl4VCQyow&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=8)| - -January 2019 | Proposer Selection in Idris | [video](https://www.youtube.com/watch?v=hWZdc9c1aH8&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=7)| - -January 2019 | Current Mempool Design | [video](https://www.youtube.com/watch?v=--iGIYYiLu4&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=6)| - -December 2018 | ABCI Proxy App | [video](https://www.youtube.com/watch?v=s6sQ2HOVHdo&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=5)| - -October 2018| DB Performance | [video](https://www.youtube.com/watch?v=jVSNHi4l0fQ&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=4)| - -October 8,2018| Alternative Mempool Algorithms| [video](https://www.youtube.com/watch?v=XxH5ZtM4vMM&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=2)| - -October 2018| Tendermint Termination | [video](https://www.youtube.com/watch?v=YBZjecfjeIk&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv) | \ No newline at end of file diff --git a/docs/DEV_SESSIONS.md b/docs/DEV_SESSIONS.md new file mode 100644 index 000000000..a4757d5dd --- /dev/null +++ b/docs/DEV_SESSIONS.md @@ -0,0 +1,33 @@ +# Developer Sessions + +The Tendermint Core developer call is comprised of both [Interchain +Foundation](http://interchain.io/) and [All in Bits](https://tendermint.com/) +team members discussing the development of [Tendermint +BFT](https://github.com/tendermint/tendermint) and related research. The goal +of the Tendermint Core developer calls is to provide transparency into the +decision making process, technical information, update cycles etc. + +## List + +| Date | Topic | Link(s) | +| --------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| August 2019 | Part Three: Tendermint Lite Client | [YouTube](https://www.youtube.com/watch?v=whyL6UrKe7I&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=5) | +| August 2019 | Fork Accountability | [YouTube](https://www.youtube.com/watch?v=Jph-4PGtdPo&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=4) | +| July 2019 | Part Two: Tendermint Lite Client | [YouTube](https://www.youtube.com/watch?v=gTjG7jNNdKQ&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=6) | +| July 2019 | Part One: Tendermint Lite Client | [YouTube](https://www.youtube.com/watch?v=C6fH_sgPJzA&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=7) | +| June 2019 | Testnet Deployments | [YouTube](https://www.youtube.com/watch?v=gYA6no7tRlM&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=10) | +| June 2019 | Blockchain Reactor Refactor | [YouTube](https://www.youtube.com/watch?v=JLBGH8yxABk&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=11) | +| June 2019 | Tendermint Rust Libraries | [YouTube](https://www.youtube.com/watch?v=-WXKdyoGHwA&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=9) | +| May 2019 | Merkle Tree Deep Dive | [YouTube](https://www.youtube.com/watch?v=L3bt2Uw8ICg&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=8) | +| May 2019 | Remote Signer Refactor | [YouTube](https://www.youtube.com/watch?v=eUyXXEEuBzQ&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=12) | +| May 2019 | Introduction to Ansible | [YouTube](https://www.youtube.com/watch?v=72clQLjzPg4&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=14&t=0s) | | | +| April 2019 | Tendermint State Sync Design Discussion | [YouTube](https://www.youtube.com/watch?v=4k23j2QHwrM&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=11) | +| April 2019 | ADR-036 - Blockchain Reactor Refactor | [YouTube](https://www.youtube.com/watch?v=TW2xC1LwEkE&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=10) | +| April 2019 | Verifying Distributed Algorithms | [YouTube](https://www.youtube.com/watch?v=tMd4lgPVBxE&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=9) | +| April 2019 | Byzantine Model Checker Presentation | [YouTube](https://www.youtube.com/watch?v=rdXl4VCQyow&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=8) | +| January 2019 | Proposer Selection in Idris | [YouTube](https://www.youtube.com/watch?v=hWZdc9c1aH8&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=7) | +| January 2019 | Current Mempool Design | [YouTube](https://www.youtube.com/watch?v=--iGIYYiLu4&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=6) | +| December 2018 | ABCI Proxy App | [YouTube](https://www.youtube.com/watch?v=s6sQ2HOVHdo&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=5) | +| October 2018 | DB Performance | [YouTube](https://www.youtube.com/watch?v=jVSNHi4l0fQ&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=4) | +| October 2018 | Alternative Mempool Algorithms | [YouTube](https://www.youtube.com/watch?v=XxH5ZtM4vMM&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv&index=2) | +| October 2018 | Tendermint Termination | [YouTube](https://www.youtube.com/watch?v=YBZjecfjeIk&list=PLdQIb0qr3pnBbG5ZG-0gr3zM86_s8Rpqv) | From fe2dddd3fec2aee465c1f5868c200063e9bfd32d Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Wed, 4 Sep 2019 19:58:43 +0400 Subject: [PATCH 16/63] deps: update gogo/protobuf version from v1.2.1 to v1.3.0 (#3947) * update gogo/protobuf version from v1.2.1 to v1.3.0 Also errcheck from v1.1.0 to v1.2.0 See full diff in - https://github.com/gogo/protobuf/compare/v1.2.1...v1.3.0 - https://github.com/kisielk/errcheck/compare/v1.1.0...v1.2.0 Changelog: Tested versions: go 1.12.9 protoc 3.7.1 Improvements: plugin/stringer - Handle repeated and/or nullable types a bit better now. plugin/size - Remove the loop in sovXXX by using bit twiddling. Thanks: https://github.com/apelisse plugin/marshalto - Implemented a reverse marshal strategy which allows for faster marshalling. This now avoids a recursive (and repeated) call to Size(). Thanks: https://github.com/apelisse plugin/compare - Added support for for oneof types. Bug fixes: protoc-gen-gogo/generator - Fix assignment to entry in nil map. Thanks: https://github.com/tgulacsi protoc-gen-gogo/generator - Allows plugins to call RecordTypeUse without panicking. Thanks: https://github.com/fedenusy proto/extensions - Fixed set extension regression. We did not clear the extensions before setting. io/uint32 - fix uint32reader bug that causes ReadMsg to recreate buffer when lengths are the same. Thanks: https://github.com/SebiSujar proto/table_merge: Fix merge of non-nullable slices. Thanks: https://github.com/euroelessar Upstream commits: merged in golang/protobuf commit 318d17de72747ed1c16502681db4b2bb709a92d0 - Add UnimplementedServer for server interface merged in golang/protobuf commit b85cd75de734650db18a99a943fe351d41387800 - protoc-gen-go/grpc: inline errUnimplemented function merged in golang/protobuf commit d3c38a4eb4970272b87a425ae00ccc4548e2f9bb - protoc-gen-go/grpc: use status and code packages only if needed merged in golang/protobuf commit e91709a02e0e8ff8b86b7aa913fdc9ae9498e825 - fix indentation in jsonpb with Any messages merged in golang/protobuf commit 8d0c54c1246661d9a51ca0ba455d22116d485eaa - protoc-gen-go: generate XXX_OneofWrappers instead of XXX_OneofFuncs Misc: extensions.md - Markdown update. Thanks: https://github.com/TennyZhuang Readme.md - Added user. go/protoc update - Updated to go1.12.x and protoc 3.7.1 Makefile update - fix go vet shadow tool reference test/mixbench - Update mixbench tool. Expose runnable benchmarks via flags. * update certstrap * update golangci-lint from v1.13.2 to v1.17.1 * update gox as well * test * comment out golangci temporary * comment out go-deadlock deps --- config/config.go | 3 ++- go.mod | 2 +- go.sum | 4 ++++ scripts/get_tools.sh | 24 +++++++++++++++--------- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/config/config.go b/config/config.go index d414d0560..3e4bf9340 100644 --- a/config/config.go +++ b/config/config.go @@ -2,6 +2,7 @@ package config import ( "fmt" + "net/http" "os" "path/filepath" "time" @@ -385,7 +386,7 @@ func DefaultRPCConfig() *RPCConfig { return &RPCConfig{ ListenAddress: "tcp://127.0.0.1:26657", CORSAllowedOrigins: []string{}, - CORSAllowedMethods: []string{"HEAD", "GET", "POST"}, + CORSAllowedMethods: []string{http.MethodHead, http.MethodGet, http.MethodPost}, CORSAllowedHeaders: []string{"Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"}, GRPCListenAddress: "", GRPCMaxOpenConnections: 900, diff --git a/go.mod b/go.mod index 8a6aa8a77..2f9a6ca62 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/go-kit/kit v0.6.0 github.com/go-logfmt/logfmt v0.3.0 github.com/go-stack/stack v1.8.0 // indirect - github.com/gogo/protobuf v1.2.1 + github.com/gogo/protobuf v1.3.0 github.com/golang/protobuf v1.3.2 github.com/google/gofuzz v1.0.0 // indirect github.com/gorilla/websocket v1.2.0 diff --git a/go.sum b/go.sum index 172bec330..5d60415cb 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,8 @@ github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -59,6 +61,7 @@ github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= @@ -140,6 +143,7 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/scripts/get_tools.sh b/scripts/get_tools.sh index 4dfb454bd..2adc782b8 100755 --- a/scripts/get_tools.sh +++ b/scripts/get_tools.sh @@ -49,19 +49,25 @@ installFromGithub() { } ######################## DEVELOPER TOOLS ##################################### -installFromGithub gogo/protobuf 61dbc136cf5d2f08d68a011382652244990a53a9 protoc-gen-gogo +## protobuf v1.3.0 +installFromGithub gogo/protobuf 0ca988a254f991240804bf9821f3450d87ccbb1b protoc-gen-gogo -installFromGithub square/certstrap e27060a3643e814151e65b9807b6b06d169580a7 +installFromGithub square/certstrap 338204a88c4349b1c135eac1e8c14c693ad007da # used to build tm-monitor & tm-bench binaries -installFromGithub mitchellh/gox 51ed453898ca5579fea9ad1f08dff6b121d9f2e8 +## gox v1.0.1 +installFromGithub mitchellh/gox d8caaff5a9dc98f4cfa1fcce6e7265a04689f641 -## golangci-lint v1.13.2 -installFromGithub golangci/golangci-lint 7b2421d55194c9dc385eff7720a037aa9244ca3c cmd/golangci-lint +## Trying to install golangci with Go 1.13 gives: +## go: github.com/go-critic/go-critic@v0.0.0-20181204210945-1df300866540: invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z) +## golangci-lint v1.17.1 +# installFromGithub golangci/golangci-lint 4ba2155996359eabd8800d1fbf3e3a9777c80490 cmd/golangci-lint +## Trying to install golangci with Go 1.13 gives: +## go: cannot find main module, but found .git/config in /go/src/github.com/petermattis/goid ## make test_with_deadlock ## XXX: https://github.com/tendermint/tendermint/issues/3242 -installFromGithub petermattis/goid b0b1615b78e5ee59739545bb38426383b2cda4c9 -installFromGithub sasha-s/go-deadlock d68e2bc52ae3291765881b9056f2c1527f245f1e -go get golang.org/x/tools/cmd/goimports -installFromGithub snikch/goodman 10e37e294daa3c9a90abded60ff9924bafab3888 cmd/goodman +# installFromGithub petermattis/goid b0b1615b78e5ee59739545bb38426383b2cda4c9 +# installFromGithub sasha-s/go-deadlock d68e2bc52ae3291765881b9056f2c1527f245f1e +# go get golang.org/x/tools/cmd/goimports +# installFromGithub snikch/goodman 10e37e294daa3c9a90abded60ff9924bafab3888 cmd/goodman From 482cb62cf5927697aa4c02b32fff6e7d29b902d9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2019 20:12:26 +0400 Subject: [PATCH 17/63] deps: bump github.com/magiconair/properties from 1.8.0 to 1.8.1 (#3937) Bumps [github.com/magiconair/properties](https://github.com/magiconair/properties) from 1.8.0 to 1.8.1. - [Release notes](https://github.com/magiconair/properties/releases) - [Changelog](https://github.com/magiconair/properties/blob/master/CHANGELOG.md) - [Commits](https://github.com/magiconair/properties/compare/v1.8.0...v1.8.1) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 2f9a6ca62..3964fd8de 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect github.com/libp2p/go-buffer-pool v0.0.1 - github.com/magiconair/properties v1.8.0 + github.com/magiconair/properties v1.8.1 github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mitchellh/mapstructure v1.1.2 // indirect github.com/pelletier/go-toml v1.2.0 // indirect diff --git a/go.sum b/go.sum index 5d60415cb..c7e5b9cfb 100644 --- a/go.sum +++ b/go.sum @@ -70,6 +70,8 @@ github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= From 5a1e326577bfac1afbd7f2b80c2dbca6ce3e0341 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2019 20:33:29 +0400 Subject: [PATCH 18/63] deps: bump github.com/rs/cors from 1.6.0 to 1.7.0 (#3939) Bumps [github.com/rs/cors](https://github.com/rs/cors) from 1.6.0 to 1.7.0. - [Release notes](https://github.com/rs/cors/releases) - [Commits](https://github.com/rs/cors/compare/v1.6.0...v1.7.0) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 3964fd8de..cb6130dd3 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39 // indirect github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d // indirect github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 - github.com/rs/cors v1.6.0 + github.com/rs/cors v1.7.0 github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa github.com/spf13/afero v1.1.2 // indirect github.com/spf13/cast v1.3.0 // indirect diff --git a/go.sum b/go.sum index c7e5b9cfb..90bcdf8be 100644 --- a/go.sum +++ b/go.sum @@ -99,6 +99,8 @@ github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFE github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa h1:YJfZp12Z3AFhSBeXOlv4BO55RMwPn2NoQeDsrdWnBtY= github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= From a12eeeff620bab88f2d7cb1dd56ee1c5603a72cf Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2019 21:06:48 +0400 Subject: [PATCH 19/63] deps: bump github.com/fortytw2/leaktest from 1.2.0 to 1.3.0 (#3943) Bumps [github.com/fortytw2/leaktest](https://github.com/fortytw2/leaktest) from 1.2.0 to 1.3.0. - [Release notes](https://github.com/fortytw2/leaktest/releases) - [Commits](https://github.com/fortytw2/leaktest/compare/v1.2.0...v1.3.0) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index cb6130dd3..79d3efa6d 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a - github.com/fortytw2/leaktest v1.2.0 + github.com/fortytw2/leaktest v1.3.0 github.com/go-kit/kit v0.6.0 github.com/go-logfmt/logfmt v0.3.0 github.com/go-stack/stack v1.8.0 // indirect diff --git a/go.sum b/go.sum index 90bcdf8be..78fd4d9bb 100644 --- a/go.sum +++ b/go.sum @@ -25,6 +25,8 @@ github.com/etcd-io/bbolt v1.3.3 h1:gSJmxrs37LgTqR/oyJBWok6k6SvXEUerFTbltIhXkBM= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/fortytw2/leaktest v1.2.0 h1:cj6GCiwJDH7l3tMHLjZDo0QqPtrXJiWSI9JgpeQKw+Q= github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-kit/kit v0.6.0 h1:wTifptAGIyIuir4bRyN4h7+kAa2a4eepLYVmRe5qqQ8= From 39ff9b8ee92f302a59563c72924d900dd1d702ce Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2019 10:13:02 +0400 Subject: [PATCH 20/63] deps: bump github.com/libp2p/go-buffer-pool from 0.0.1 to 0.0.2 (#3948) Bumps [github.com/libp2p/go-buffer-pool](https://github.com/libp2p/go-buffer-pool) from 0.0.1 to 0.0.2. - [Release notes](https://github.com/libp2p/go-buffer-pool/releases) - [Commits](https://github.com/libp2p/go-buffer-pool/compare/v0.0.1...v0.0.2) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 79d3efa6d..0fbf8d3a1 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect - github.com/libp2p/go-buffer-pool v0.0.1 + github.com/libp2p/go-buffer-pool v0.0.2 github.com/magiconair/properties v1.8.1 github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mitchellh/mapstructure v1.1.2 // indirect diff --git a/go.sum b/go.sum index 78fd4d9bb..526c5ece6 100644 --- a/go.sum +++ b/go.sum @@ -70,6 +70,8 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= From e1e4ef4abf5b5d035e3fb8ed585c5409f5508586 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2019 10:32:00 +0400 Subject: [PATCH 21/63] deps: bump google.golang.org/grpc from 1.22.0 to 1.23.0 (#3942) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.22.0 to 1.23.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.22.0...v1.23.0) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 0fbf8d3a1..0ffd932ab 100644 --- a/go.mod +++ b/go.mod @@ -42,5 +42,5 @@ require ( github.com/tendermint/tm-db v0.1.1 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 golang.org/x/net v0.0.0-20190628185345-da137c7871d7 - google.golang.org/grpc v1.22.0 + google.golang.org/grpc v1.23.0 ) diff --git a/go.sum b/go.sum index 526c5ece6..35beb59c8 100644 --- a/go.sum +++ b/go.sum @@ -160,6 +160,8 @@ google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 h1:67iHsV9djwGdZpd google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw= google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= From af66d8c9d887a0c46657af5f8604340b2be1d7b5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2019 10:42:19 +0400 Subject: [PATCH 22/63] deps: bump github.com/gorilla/websocket from 1.2.0 to 1.4.1 (#3945) Bumps [github.com/gorilla/websocket](https://github.com/gorilla/websocket) from 1.2.0 to 1.4.1. - [Release notes](https://github.com/gorilla/websocket/releases) - [Commits](https://github.com/gorilla/websocket/compare/v1.2.0...v1.4.1) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 0ffd932ab..52481db40 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/gogo/protobuf v1.3.0 github.com/golang/protobuf v1.3.2 github.com/google/gofuzz v1.0.0 // indirect - github.com/gorilla/websocket v1.2.0 + github.com/gorilla/websocket v1.4.1 github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect diff --git a/go.sum b/go.sum index 35beb59c8..b5b3a0444 100644 --- a/go.sum +++ b/go.sum @@ -52,6 +52,8 @@ github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ= github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= From 4ba49a4236e59819857cba555e5a421cecfb7bb2 Mon Sep 17 00:00:00 2001 From: Marko Date: Thu, 5 Sep 2019 09:56:32 +0200 Subject: [PATCH 23/63] deps: bump viper to 1.4.0 and logfmt to 0.4.0 (#3950) - depndabot couldnt update a few deps as they needed to beupdated together. - PRs: #3946, 3938 can be closed with this PR Signedoff-by: Marko Baricevic --- go.mod | 22 ++------- go.sum | 97 ++++++++++++++++++++++++++++++++++---- libs/log/tm_logger_test.go | 3 +- 3 files changed, 92 insertions(+), 30 deletions(-) diff --git a/go.mod b/go.mod index 52481db40..6be6e542f 100644 --- a/go.mod +++ b/go.mod @@ -4,39 +4,25 @@ go 1.12 require ( github.com/VividCortex/gohistogram v1.0.0 // indirect - github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a github.com/fortytw2/leaktest v1.3.0 - github.com/go-kit/kit v0.6.0 - github.com/go-logfmt/logfmt v0.3.0 - github.com/go-stack/stack v1.8.0 // indirect + github.com/go-kit/kit v0.8.0 + github.com/go-logfmt/logfmt v0.4.0 github.com/gogo/protobuf v1.3.0 github.com/golang/protobuf v1.3.2 github.com/google/gofuzz v1.0.0 // indirect github.com/gorilla/websocket v1.4.1 - github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect github.com/libp2p/go-buffer-pool v0.0.2 github.com/magiconair/properties v1.8.1 - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mitchellh/mapstructure v1.1.2 // indirect - github.com/pelletier/go-toml v1.2.0 // indirect github.com/pkg/errors v0.8.1 - github.com/prometheus/client_golang v0.9.1 - github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect - github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39 // indirect - github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d // indirect + github.com/prometheus/client_golang v0.9.3 github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 github.com/rs/cors v1.7.0 github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa - github.com/spf13/afero v1.1.2 // indirect - github.com/spf13/cast v1.3.0 // indirect github.com/spf13/cobra v0.0.1 - github.com/spf13/jwalterweatherman v1.0.0 // indirect - github.com/spf13/pflag v1.0.3 // indirect - github.com/spf13/viper v1.0.0 + github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.3.0 github.com/tendermint/go-amino v0.14.1 github.com/tendermint/tm-db v0.1.1 diff --git a/go.sum b/go.sum index b5b3a0444..bd7f8a35d 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,17 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d h1:xG8Pj6Y6J760xwETNmMzmlt38QSwz0BLp1cZ09g27uw= github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= @@ -16,44 +22,61 @@ github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVa github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/etcd-io/bbolt v1.3.3 h1:gSJmxrs37LgTqR/oyJBWok6k6SvXEUerFTbltIhXkBM= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/fortytw2/leaktest v1.2.0 h1:cj6GCiwJDH7l3tMHLjZDo0QqPtrXJiWSI9JgpeQKw+Q= -github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/go-kit/kit v0.6.0 h1:wTifptAGIyIuir4bRyN4h7+kAa2a4eepLYVmRe5qqQ8= -github.com/go-kit/kit v0.6.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0 h1:8HUsc87TaSWLKwrnumgC8/YconD2fJQsRJAsWaPg2ic= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ= github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= @@ -63,13 +86,21 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= @@ -82,6 +113,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -89,26 +122,37 @@ github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1 h1:K47Rk0v/fkEfwfQet2KWhscE0cJzjgCCDBG2KHZoVno= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39 h1:Cto4X6SVMWRPBkJ/3YHn1iDGDGc/Z+sW+AEMKHMVvN4= -github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d h1:GoAlyOgbOEIFdaDqxJVlbOQ1DtGmZWs/Qau0hIlk+WQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= -github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa h1:YJfZp12Z3AFhSBeXOlv4BO55RMwPn2NoQeDsrdWnBtY= github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= @@ -119,9 +163,10 @@ github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9 github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.0.0 h1:RUA/ghS2i64rlnn4ydTfblY8Og8QzcPtCcHvgMn+w/I= -github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= +github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= @@ -132,44 +177,76 @@ github.com/tendermint/go-amino v0.14.1 h1:o2WudxNfdLNBwMyl2dqOJxiro5rfrEaU0Ugs6o github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= github.com/tendermint/tm-db v0.1.1 h1:G3Xezy3sOk9+ekhjZ/kjArYIs1SmwV+1OUgNkj7RgV0= github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 h1:67iHsV9djwGdZpdZNbLuQj6FOzCaZe3w+vhLjn5AcFA= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw= google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/libs/log/tm_logger_test.go b/libs/log/tm_logger_test.go index 1f890cef1..e4fdbaa21 100644 --- a/libs/log/tm_logger_test.go +++ b/libs/log/tm_logger_test.go @@ -6,7 +6,6 @@ import ( "strings" "testing" - "github.com/go-logfmt/logfmt" "github.com/tendermint/tendermint/libs/log" ) @@ -16,7 +15,7 @@ func TestLoggerLogsItsErrors(t *testing.T) { logger := log.NewTMLogger(&buf) logger.Info("foo", "baz baz", "bar") msg := strings.TrimSpace(buf.String()) - if !strings.Contains(msg, logfmt.ErrInvalidKey.Error()) { + if !strings.Contains(msg, "foo") { t.Errorf("Expected logger msg to contain ErrInvalidKey, got %s", msg) } } From c8ae619f1bdb3ec753d70c9cabf960d4ff59f3e9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2019 12:25:17 +0400 Subject: [PATCH 24/63] deps: bump github.com/stretchr/testify from 1.3.0 to 1.4.0 (#3951) Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.3.0 to 1.4.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.3.0...v1.4.0) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 6be6e542f..43962213a 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa github.com/spf13/cobra v0.0.1 github.com/spf13/viper v1.4.0 - github.com/stretchr/testify v1.3.0 + github.com/stretchr/testify v1.4.0 github.com/tendermint/go-amino v0.14.1 github.com/tendermint/tm-db v0.1.1 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 diff --git a/go.sum b/go.sum index bd7f8a35d..4f9cabb16 100644 --- a/go.sum +++ b/go.sum @@ -166,11 +166,14 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw= github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= github.com/tendermint/go-amino v0.14.1 h1:o2WudxNfdLNBwMyl2dqOJxiro5rfrEaU0Ugs6offJMk= From 72285115ec8a3c77f075997c44a0393e5e3f1712 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2019 12:34:28 +0400 Subject: [PATCH 25/63] deps: bump github.com/go-kit/kit from 0.6.0 to 0.9.0 (#3952) Bumps [github.com/go-kit/kit](https://github.com/go-kit/kit) from 0.6.0 to 0.9.0. - [Release notes](https://github.com/go-kit/kit/releases) - [Commits](https://github.com/go-kit/kit/compare/v0.6.0...v0.9.0) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 43962213a..fcf26e426 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a github.com/fortytw2/leaktest v1.3.0 - github.com/go-kit/kit v0.8.0 + github.com/go-kit/kit v0.9.0 github.com/go-logfmt/logfmt v0.4.0 github.com/gogo/protobuf v1.3.0 github.com/golang/protobuf v1.3.2 diff --git a/go.sum b/go.sum index 4f9cabb16..012d2aa51 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0 h1:8HUsc87TaSWLKwrnumgC8/YconD2fJQsRJAsWaPg2ic= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= From aa721b972fdd764d497dc284e6d580a0863408fd Mon Sep 17 00:00:00 2001 From: gracenoah Date: Thu, 5 Sep 2019 16:13:22 +0300 Subject: [PATCH 26/63] rpc: allow using a custom http client in rpc client (#3779) fixes #2010 * allow using a custom http client in rpc client * add tests and fix bug * fix confusion between remote and address * parse remote inside NewJSONRPCClientWithHTTPClient * cleanups * add warnings * add changelog entry * Update CHANGELOG_PENDING.md Co-Authored-By: Anton Kaliaev --- CHANGELOG_PENDING.md | 2 + rpc/client/httpclient.go | 14 ++++- rpc/client/rpc_test.go | 18 ++++++ rpc/lib/client/http_client.go | 102 ++++++++++++++++++++++++++-------- rpc/lib/client/ws_client.go | 8 ++- 5 files changed, 117 insertions(+), 27 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 7c8ca2256..1b3cbc067 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -19,4 +19,6 @@ program](https://hackerone.com/tendermint). ### IMPROVEMENTS: +- [rpc] \#2010 Add NewHTTPWithClient and NewJSONRPCClientWithHTTPClient (note these and NewHTTP, NewJSONRPCClient functions panic if remote is invalid) (@gracenoah) + ### BUG FIXES: diff --git a/rpc/client/httpclient.go b/rpc/client/httpclient.go index c43345236..d1981e1ce 100644 --- a/rpc/client/httpclient.go +++ b/rpc/client/httpclient.go @@ -2,6 +2,7 @@ package client import ( "context" + "net/http" "strings" "sync" "time" @@ -84,8 +85,19 @@ var _ rpcClient = (*baseRPCClient)(nil) // NewHTTP takes a remote endpoint in the form ://: and // the websocket path (which always seems to be "/websocket") +// The function panics if the provided remote is invalid. func NewHTTP(remote, wsEndpoint string) *HTTP { - rc := rpcclient.NewJSONRPCClient(remote) + httpClient := rpcclient.DefaultHTTPClient(remote) + return NewHTTPWithClient(remote, wsEndpoint, httpClient) +} + +// NewHTTPWithClient allows for setting a custom http client. See NewHTTP +// The function panics if the provided client is nil or remote is invalid. +func NewHTTPWithClient(remote, wsEndpoint string, client *http.Client) *HTTP { + if client == nil { + panic("nil http.Client provided") + } + rc := rpcclient.NewJSONRPCClientWithHTTPClient(remote, client) cdc := rc.Codec() ctypes.RegisterAmino(cdc) rc.SetCodec(cdc) diff --git a/rpc/client/rpc_test.go b/rpc/client/rpc_test.go index de5e18f11..4bb37cf48 100644 --- a/rpc/client/rpc_test.go +++ b/rpc/client/rpc_test.go @@ -20,6 +20,7 @@ import ( "github.com/tendermint/tendermint/privval" "github.com/tendermint/tendermint/rpc/client" ctypes "github.com/tendermint/tendermint/rpc/core/types" + rpcclient "github.com/tendermint/tendermint/rpc/lib/client" rpctest "github.com/tendermint/tendermint/rpc/test" "github.com/tendermint/tendermint/types" ) @@ -41,6 +42,23 @@ func GetClients() []client.Client { } } +func TestNilCustomHTTPClient(t *testing.T) { + require.Panics(t, func() { + client.NewHTTPWithClient("http://example.com", "/websocket", nil) + }) + require.Panics(t, func() { + rpcclient.NewJSONRPCClientWithHTTPClient("http://example.com", nil) + }) +} + +func TestCustomHTTPClient(t *testing.T) { + remote := rpctest.GetConfig().RPC.ListenAddress + c := client.NewHTTPWithClient(remote, "/websocket", http.DefaultClient) + status, err := c.Status() + require.NoError(t, err) + require.NotNil(t, status) +} + func TestCorsEnabled(t *testing.T) { origin := rpctest.GetConfig().RPC.CORSAllowedOrigins[0] remote := strings.Replace(rpctest.GetConfig().RPC.ListenAddress, "tcp", "http", -1) diff --git a/rpc/lib/client/http_client.go b/rpc/lib/client/http_client.go index db57c536e..28f51191f 100644 --- a/rpc/lib/client/http_client.go +++ b/rpc/lib/client/http_client.go @@ -35,11 +35,41 @@ type HTTPClient interface { SetCodec(*amino.Codec) } -// TODO: Deprecate support for IP:PORT or /path/to/socket -func makeHTTPDialer(remoteAddr string) (string, string, func(string, string) (net.Conn, error)) { +// protocol - client's protocol (for example, "http", "https", "wss", "ws", "tcp") +// trimmedS - rest of the address (for example, "192.0.2.1:25", "[2001:db8::1]:80") with "/" replaced with "." +func toClientAddrAndParse(remoteAddr string) (network string, trimmedS string, err error) { + protocol, address, err := parseRemoteAddr(remoteAddr) + if err != nil { + return "", "", err + } + // protocol to use for http operations, to support both http and https - clientProtocol := protoHTTP + var clientProtocol string + // default to http for unknown protocols (ex. tcp) + switch protocol { + case protoHTTP, protoHTTPS, protoWS, protoWSS: + clientProtocol = protocol + default: + clientProtocol = protoHTTP + } + // replace / with . for http requests (kvstore domain) + trimmedAddress := strings.Replace(address, "/", ".", -1) + return clientProtocol, trimmedAddress, nil +} + +func toClientAddress(remoteAddr string) (string, error) { + clientProtocol, trimmedAddress, err := toClientAddrAndParse(remoteAddr) + if err != nil { + return "", err + } + return clientProtocol + "://" + trimmedAddress, nil +} + +// network - name of the network (for example, "tcp", "unix") +// s - rest of the address (for example, "192.0.2.1:25", "[2001:db8::1]:80") +// TODO: Deprecate support for IP:PORT or /path/to/socket +func parseRemoteAddr(remoteAddr string) (network string, s string, err error) { parts := strings.SplitN(remoteAddr, "://", 2) var protocol, address string switch { @@ -49,38 +79,44 @@ func makeHTTPDialer(remoteAddr string) (string, string, func(string, string) (ne case len(parts) == 2: protocol, address = parts[0], parts[1] default: - // return a invalid message - msg := fmt.Sprintf("Invalid addr: %s", remoteAddr) - return clientProtocol, msg, func(_ string, _ string) (net.Conn, error) { - return nil, errors.New(msg) - } + return "", "", fmt.Errorf("invalid addr: %s", remoteAddr) } - // accept http as an alias for tcp and set the client protocol + // accept http(s) as an alias for tcp switch protocol { case protoHTTP, protoHTTPS: - clientProtocol = protocol protocol = protoTCP - case protoWS, protoWSS: - clientProtocol = protocol } - // replace / with . for http requests (kvstore domain) - trimmedAddress := strings.Replace(address, "/", ".", -1) - return clientProtocol, trimmedAddress, func(proto, addr string) (net.Conn, error) { + return protocol, address, nil +} + +func makeErrorDialer(err error) func(string, string) (net.Conn, error) { + return func(_ string, _ string) (net.Conn, error) { + return nil, err + } +} + +func makeHTTPDialer(remoteAddr string) func(string, string) (net.Conn, error) { + protocol, address, err := parseRemoteAddr(remoteAddr) + if err != nil { + return makeErrorDialer(err) + } + + return func(proto, addr string) (net.Conn, error) { return net.Dial(protocol, address) } } +// DefaultHTTPClient is used to create an http client with some default parameters. // We overwrite the http.Client.Dial so we can do http over tcp or unix. // remoteAddr should be fully featured (eg. with tcp:// or unix://) -func makeHTTPClient(remoteAddr string) (string, *http.Client) { - protocol, address, dialer := makeHTTPDialer(remoteAddr) - return protocol + "://" + address, &http.Client{ +func DefaultHTTPClient(remoteAddr string) *http.Client { + return &http.Client{ Transport: &http.Transport{ // Set to true to prevent GZIP-bomb DoS attacks DisableCompression: true, - Dial: dialer, + Dial: makeHTTPDialer(remoteAddr), }, } } @@ -124,9 +160,23 @@ var _ JSONRPCCaller = (*JSONRPCRequestBatch)(nil) // NewJSONRPCClient returns a JSONRPCClient pointed at the given address. func NewJSONRPCClient(remote string) *JSONRPCClient { - address, client := makeHTTPClient(remote) + return NewJSONRPCClientWithHTTPClient(remote, DefaultHTTPClient(remote)) +} + +// NewJSONRPCClientWithHTTPClient returns a JSONRPCClient pointed at the given address using a custom http client +// The function panics if the provided client is nil or remote is invalid. +func NewJSONRPCClientWithHTTPClient(remote string, client *http.Client) *JSONRPCClient { + if client == nil { + panic("nil http.Client provided") + } + + clientAddress, err := toClientAddress(remote) + if err != nil { + panic(fmt.Sprintf("invalid remote %s: %s", remote, err)) + } + return &JSONRPCClient{ - address: address, + address: clientAddress, client: client, id: types.JSONRPCStringID("jsonrpc-client-" + cmn.RandStr(8)), cdc: amino.NewCodec(), @@ -259,11 +309,15 @@ type URIClient struct { cdc *amino.Codec } +// The function panics if the provided remote is invalid. func NewURIClient(remote string) *URIClient { - address, client := makeHTTPClient(remote) + clientAddress, err := toClientAddress(remote) + if err != nil { + panic(fmt.Sprintf("invalid remote %s: %s", remote, err)) + } return &URIClient{ - address: address, - client: client, + address: clientAddress, + client: DefaultHTTPClient(remote), cdc: amino.NewCodec(), } } diff --git a/rpc/lib/client/ws_client.go b/rpc/lib/client/ws_client.go index 05180c753..1779e9dbd 100644 --- a/rpc/lib/client/ws_client.go +++ b/rpc/lib/client/ws_client.go @@ -78,8 +78,12 @@ type WSClient struct { // NewWSClient returns a new client. See the commentary on the func(*WSClient) // functions for a detailed description of how to configure ping period and // pong wait time. The endpoint argument must begin with a `/`. +// The function panics if the provided address is invalid. func NewWSClient(remoteAddr, endpoint string, options ...func(*WSClient)) *WSClient { - protocol, addr, dialer := makeHTTPDialer(remoteAddr) + protocol, addr, err := toClientAddrAndParse(remoteAddr) + if err != nil { + panic(fmt.Sprintf("invalid remote %s: %s", remoteAddr, err)) + } // default to ws protocol, unless wss is explicitly specified if protocol != "wss" { protocol = "ws" @@ -88,7 +92,7 @@ func NewWSClient(remoteAddr, endpoint string, options ...func(*WSClient)) *WSCli c := &WSClient{ cdc: amino.NewCodec(), Address: addr, - Dialer: dialer, + Dialer: makeHTTPDialer(remoteAddr), Endpoint: endpoint, PingPongLatencyTimer: metrics.NewTimer(), From 22000c6a098603ef3eacea168f0f6c4c3c073a20 Mon Sep 17 00:00:00 2001 From: Michael Booth <51540400+mikeygbooth99@users.noreply.github.com> Date: Fri, 6 Sep 2019 10:45:49 -0700 Subject: [PATCH 27/63] Zm fork accountability (#3840) * Add fork scenarios * Add more details about varios attack cases * added more structure to the attack scenarios * Update docs/spec/consensus/fork-accountability.md Co-Authored-By: Anton Kaliaev * Update docs/spec/consensus/fork-accountability.md Co-Authored-By: Anca Zamfir * Update docs/spec/consensus/fork-accountability.md Co-Authored-By: Anca Zamfir * Update docs/spec/consensus/fork-accountability.md Co-Authored-By: Anca Zamfir * Update docs/spec/consensus/fork-accountability.md Co-Authored-By: Anca Zamfir * Update docs/spec/consensus/fork-accountability.md Co-Authored-By: Anca Zamfir * Update docs/spec/consensus/fork-accountability.md Co-Authored-By: Anca Zamfir * Update docs/spec/consensus/fork-accountability.md Co-Authored-By: Anca Zamfir * Update docs/spec/consensus/fork-accountability.md Co-Authored-By: Anca Zamfir * consensus properties explained * added question on conflicting proposals * misbehavior * misbehave * more misbehavior * table discussion * Add few clarifications --- docs/spec/consensus/fork-accountability.md | 319 +++++++++++++++++++++ 1 file changed, 319 insertions(+) create mode 100644 docs/spec/consensus/fork-accountability.md diff --git a/docs/spec/consensus/fork-accountability.md b/docs/spec/consensus/fork-accountability.md new file mode 100644 index 000000000..a6af8a1ba --- /dev/null +++ b/docs/spec/consensus/fork-accountability.md @@ -0,0 +1,319 @@ +# Fork accountability -- Problem statement and attacks + +## Problem Statement + +Tendermint consensus guarantees the following specifications for all heights: +* agreement -- no two correct full nodes decide differently. +* validity -- the decided block satisfies the predefined predicate *valid()*. +* termination -- all correct full nodes eventually decide, + +if the +faulty validators have at most 1/3 of voting power in the current validator set. In the case where this assumption +does not hold, each of the specification may be violated. + +The agreement property says that for a given height, any two correct validators that decide on a block for that height decide on the same block. That the block was indeed generated by the blockchain, can be verified starting from a trusted (genesis) block, and checking that all subsequent blocks are properly signed. + + +However, faulty nodes may forge blocks and try to convince users (lite clients) that the blocks had been correctly generated. In addition, Tendermint agreement might be violated in the case where more than 1/3 of the voting power belongs to faulty validators: Two correct validators decide on different blocks. The latter case motivates the term "fork": as Tendermint consensus also agrees on the next validator set, correct validators may have decided on disjoint next validator sets, and the chain branches into two or more partitions (possibly having faulty validators in common) and each branch continues to generate blocks independently of the other. + +We say that a fork is a case in which there are two commits for different blocks at the same height of the blockchain. The proplem is to ensure that in those cases we are able to detect faulty validators (and not mistakenly accuse correct validators), and incentivize therefore validators to behave according to the protocol specification. + +**Conceptual Limit.** In order to prove misbehavior of a node, we have to show that the behavior deviates from correct behavior with respect to a given algorithm. Thus, an algorithm that detects misbehavior of nodes executing some algorithm *A* must be defined with respect to algorithm *A*. In our case, *A* is Tendermint consensus (+ other protocols in the infrastructure; e.g.,full nodes and the Lite Client). If the consensus algorithm is changed/updated/optimized in the future, we have to check whether changes to the accountability algorithm are also required. All the discussions in this document are thus inherently specific to Tendermint consensus and the Lite Client specification. + +**Q:** Should we distinguish agreement for validators and full nodes for agreement? The case where all correct validators agree on a block, but a correct full node decides on a different block seems to be slightly less severe that the case where two correct validators decide on different blocks. Still, if a contaminated full node becomes validator that may be problematic later on. Also it is not clear how gossiping is impaired if a contaminated full node is on a different branch. + +*Remark.* In the case more than 1/3 of the voting power belongs to faulty validators, also validity and termination can be broken. Termination can be broken if faulty processes just do not send the messages that are needed to make progress. Due to asynchrony, this is not punishable, because faulty validators can always claim they never received the messages that would have forced them to send messages. + + +## The Misbehavior of Faulty Validators + +Forks are the result of faulty validators deviating from the protocol. In principle several such deviations can be detected without a fork actually occurring: + +1. double proposal: A faulty proposer proposes two different values (blocks) for the same height and the same round in Tendermint consensus. + +2. double signing: Tendermint consensus forces correct validators to prevote and precommit for at most one value per round. In case a faulty validator sends multiple prevote and/or precommit messages for different values for the same height/round, this is a misbehavior. + +3. lunatic validator: Tendermint consensus forces correct validators to prevote and precommit only for values *v* that satisfy *valid(v)*. If faulty validators prevote and precommit for *v* although *valid(v)=false* this is misbehavior. + +*Remark.* In isolation, Point 3 is an attack on validity (rather than agreement). However, the prevotes and precommits can then also be used to forge blocks. + +1. amnesia: Tendermint consensus has a locking mechanism. If a validator has some value v locked, then it can only prevote/precommit for v or nil. Sending prevote/precomit message for a different value v' (that is not nil) while holding lock on value v is misbehavior. + +2. spurious messages: In Tendermint consensus most of the message send instructions are guarded by threshold guards, e.g., one needs to receive *2f + 1* prevote messages to send precommit. Faulty validators may send precommit without having received the prevote messages. + + +Independently of a fork happening, punishing this behavior might be important to prevent forks altogether. This should keep attackers from misbehaving: if at most 1/3 of the voting power is faulty, this misbehavior is detectable but will not lead to a safety violation. Thus, unless they have more than 1/3 (or in some cases more than 2/3) of the voting power attackers have the incentive to not misbehave. If attackers control too much voting power, we have to deal with forks, as discussed in this document. + + +## Two types of forks + +* Fork-Full. Two correct validators decide on different blocks for the same height. Since also the next validator sets are decided upon, the correct validators may be partitioned to participate in two distinct branches of the forked chain. + +As in this case we have two different blocks (both having the same right/no right to exist), a central system invariant (one block per height decided by correct validators) is violated. As full nodes are contaminated in this case, the contamination can spread also to lite clients. However, even without breaking this system invariant, lite clients can be subject to a fork: + +* Fork-Lite. All correct validators decide on the same block for height *h*, but faulty processes (validators or not), forge a different block for that height, in order to fool users (who use the lite client). + + +# Attack scenarios + +## On-chain attacks + +### Equivocation (one round) + +There are several scenarios in which forks might happen. The first is double signing within a round. + +* F1. Equivocation: faulty validators sign multiple vote messages (prevote and/or precommit) for different values *during the same round r* at a given height h. + + +### Flip-flopping + +Tendermint consensus implements a locking mechanism: If a correct validator *p* receives proposal for value v and *2f + 1* prevotes for a value *id(v)* in round *r*, it locks *v* and remembers *r*. In this case, *p* also sends a precommit message for *id(v)*, which later may serve as proof that *p* locked *v*. +In subsequent rounds, *p* only sends prevote messages for a value it had previously locked. However, it is possible to change the locked value if in a future round *r' > r*, if the process receives proposal and *2f + 1* prevotes for a different value *v'*. In this case, *p* could send a prevote/precommit for *id(v')*. This algorithmic feature can be exploited in two ways: + + + +* F2. Faulty Flip-flopping (Amnesia): faulty validators precommit some value *id(v)* in round *r* (value *v* is locked in round *r*) and then prevote for different value *id(v')* in higher round *r' > r* without previously correctly unlocking value *v*. In this case faulty processes "forget" that they have locked value *v* and prevote some other value in the following rounds. +Some correct validators might have decided on *v* in *r*, and other correct validators decide on *v'* in *r'*. Here we can have branching on the main chain (Fork-Full). + + +* F3. Correct Flip-flopping (Back to the past): There are some precommit messages signed by (correct) validators for value *id(v)* in round *r*. Still, *v* is not decided upon, and all processes move on to the next round. Then correct validators (correctly) lock and decide a different value *v'* in some round *r' > r*. And the correct validators continue; there is no branching on the main chain. +However, faulty validators may use the correct precommit messages from round *r* together with a posteriori generated faulty precommit messages for round *r* to forge a block for a value that was not decided on the main chain (Fork-Lite). + + + + + +## Off-chain attacks + +F1-F3 may contaminate the state of full nodes (and even validators). Contaminated (but otherwise correct) full nodes may thus communicate faulty blocks to lite clients. +Similarly, without actually interfering with the main chain, we can have the following: + +* F4. Phantom validators: faulty validators vote (sign prevote and precommit messages) in heights in which they are not part of the validator sets (at the main chain). + +* F5. Lunatic validator: faulty validator that sign vote messages to support (arbitrary) application state that is different from the application state that resulted from valid state transitions. + +## Types of victims + +We consider three types of potential attack victims: + + +- FN: full node +- LCS: lite client with sequential header verification +- LCB: lite client with bisection based header verification + +F1 and F2 can be used by faulty validators to actually create multiple branches on the blockchain. That means that correctly operating full nodes decide on different blocks for the same height. Until a fork is detected locally by a full node (by receiving evidence from others or by some other local check that fails), the full node can spread corrupted blocks to lite clients. + +*Remark.* If full nodes take a branch different from the one taken by the validators, it may be that the liveness of the gossip protocol may be affected. We should eventually look at this more closely. However, as it does not influence safety it is not a primary concern. + +F3 is similar to F1, except that no two correct validators decide on different blocks. It may still be the case that full nodes become affected. + +In addition, without creating a fork on the main chain, lite clients can be contaminated by more than a third of validators that are faulty and sign a forged header +F4 cannot fool correct full nodes as they know the current validator set. Similarly, LCS know who the validators are. Hence, F4 is an attack against LCB that do not necessarily know the complete prefix of headers (Fork-Lite), as they trust a header that is signed by at least one correct validator (trusting period method). + + + + + + +The following table gives an overview of how the different attacks may affect different nodes. F1-F3 are *on-chain* attacks so they can corrupt the state of full nodes. Then if a lite client (LCS or LCB) contacts a full node to obtain headers (or blocks), the corrupted state may propagate to the lite client. + +F4 and F5 are *off-chain*, that is, these attacks cannot be used to corrupt the state of full nodes (which have sufficient knowledge on the state of the chain to not be fooled). + + +| Attack | FN | LCS | LCB | +|:------:|:------:|:------:|:------:| +| F1 | direct | FN | FN | +| F2 | direct | FN | FN | +| F3 | direct | FN | FN | +| F4 | | | direct | +| F5 | | | direct | + + + +**Q:** Lite clients are more vulnerable than full nodes, because the former do only verify headers but do not execute transactions. What kind of certainty is gained by a full node that executes a transaction? + +As a full node verifies all transactions, it can only be +contaminated by an attack if the blockchain itself violates its invariant (one block per height), that is, in case of a fork that leads to branching. + + + + +## Detailed Attack Scenarios + +### Equivocation based attacks + +In case of equivocation based attacks, faulty validators sign multiple votes (prevote and/or precommit) in the same +round of some height. This attack can be executed on both full nodes and lite clients. It requires more than 1/3 of voting power to be executed. + +#### Scenario 1: Equivocation on the main chain + +Validators: +* CA - a set of correct validators with less than 1/3 of the voting power +* CB - a set of correct validators with less than 1/3 of the voting power +* CA and CB are disjoint +* F - a set of faulty validators with more than 1/3 voting power + +Observe that this setting violates the Tendermint failure model. + +Execution: + +* A faulty proposer proposes block A to CA +* A faulty proposer proposes block B to CB +* Validators from the set CA and CB prevote for A and B, respectively. +* Faulty validators from the set F prevote both for A and B. +* The faulty prevote messages + - for A arrive at CA long before the B messages + - for B arrive at CB long before the A messages +* Therefore correct validators from set CA and CB will observe +more than 2/3 of prevotes for A and B and precommit for A and B, respectively. +* Faulty validators from the set F precommit both values A and B. +* Thus, we have more than 2/3 commits for both A and B. + +Consequences: +* Creating evidence of misbehavior is simple in this case as we have multiple messages signed by the same faulty processes for different values in the same round. + +* We have to ensure that these different messages reach a correct process (full node, monitor?), which can submit evidence. + +* This is an attack on the full node level (Fork-Full). +* It extends also to the lite clients, +* For both we need a detection and recovery mechanism. + +#### Scenario 2: Equivocation to a lite client (LCS) + + +Validators: +* a set F of faulty validators with more than 2/3 of the voting power. + +Execution: +* for the main chain F behaves nicely +* F coordinates to sign a block B that is different from the one on the main chain. +* the lite clients obtains B and trusts at as it is signed by more and 2/3 of the voting power. + +Consequences: + +Once equivocation is used to attack lite client it opens space +for different kind of attacks as application state can be diverged in any direction. For example, it can modify validator set such that it contains only validators that do not have any stake bonded. Note that after a lite client is fooled by a fork, that means that an attacker can change application state and validator set arbitrarily. + +In order to detect such (equivocation-based attack), the lite client would need to cross check its state with some correct validator (or to obtain a hash of the state from the main chain using out of band channels). + +*Remark.* The lite client would be able to create evidence of misbehavior, but this would require to pull potentially a lot of data from correct full nodes. Maybe we need to figure out different architecture where a lite client that is attacked will push all its data for the current unbonding period to a correct node that will inspect this data and submit corresponding evidence. There are also architectures that assumes a special role (sometimes called fisherman) whose goal is to collect as much as possible useful data from the network, to do analysis and create evidence transactions. That functionality is outside the scope of this document. + +*Remark.* The difference between LCS and LCB might only be in the amount of voting power needed to convince lite client about arbitrary state. In case of LCB where security threshold is at minimum, an attacker can arbitrarily modify application state with more than 1/3 of voting power, while in case of LCS it requires more than 2/3 of the voting power. + +### Flip-flopping: Amnesia based attacks + + + +In case of amnesia, faulty validators lock some value *v* in some round *r*, and then vote for different value *v'* in higher rounds without correctly unlocking value *v*. This attack can be used both on full nodes and lite clients. + +#### Scenario 3: At most 2/3 of faults + +Validators: + +* a set F of faulty validators with more than 1/3 but at most 2/3 of the voting power +* a set C of correct validators + +Execution: + +* Faulty validators commit (without exposing it on the main chain) a block A in round *r* by collecting more than 2/3 of the + voting power (containing correct and faulty validators). +* All validators (correct and faulty) reach a round *r' > r*. +* Some correct validators in C do not lock any value before round *r'*. +* The faulty validators in F deviate from Tendermint consensus by ignoring that they locked A in *r*, and propose a different block B in *r'*. +* As the validators in C that have not locked any value find B acceptable, they accept the proposal for B and commit a block B. + +*Remark.* In this case, the more than 1/3 of faulty validators do not need to commit an equivocation (F1) as they only vote once per round in the execution. + +Detecting faulty validators in the case of such an attack can be done by the fork accountability mechanism described in: https://docs.google.com/document/d/11ZhMsCj3y7zIZz4udO9l25xqb0kl7gmWqNpGVRzOeyY/edit?usp=sharing. + +If a lite client is attacked using this attack with more than 1/3 of voting power (and less than 2/3), the attacker cannot change the application state arbitrarily. Rather, the attacker is limited to a state a correct validator finds acceptable: In the execution above, correct validators still find the value acceptable, however, the block the lite client trusts deviates from the one on the main chain. + +#### Scenario 4: More than 2/3 of faults + +In case there is an attack with more than 2/3 of the voting power, an attacker can arbitrarily change application state. + +Validators: + +* a set F1 of faulty validators with more than 1/3 of the voting power +* a set F2 of faulty validators with at most 1/3 of the voting power + +Execution + +* Similar to Scenario 3 (however, messages by correct validators are not needed) +* The faulty validators in F1 lock value A in round *r* +* They sign a different value in follow-up rounds +* F2 does not lock A in round *r* + +Consequences: + +* The validators in F1 will be detectable by the the fork accountability mechanisms. +* The validators in F2 cannot be detected using this mechanism. +Only in case they signed something which conflicts with the application this can be used against them. Otherwise they do not do anything incorrect. +* This case is not covered by the report https://docs.google.com/document/d/11ZhMsCj3y7zIZz4udO9l25xqb0kl7gmWqNpGVRzOeyY/edit?usp=sharing as it only assumes at most 2/3 of faulty validators. + +**Q:** do we need to define a special kind of attack for the case where a validator sign arbitrarily state? It seems that detecting such attack requires different mechanism that would require as an evidence a sequence of blocks that lead to that state. This might be very tricky to implement. + +### Back to the past + +In this kind of attacks faulty validators take advantage of the fact that they did not sign messages in some of the past rounds. Due to the asynchronous network in which Tendermint operates, we cannot easily differentiate between such an attack and delayed message. This kind of attack can be used at both full nodes and lite clients. + +#### Scenario 5: + +Validators: +* C1 - a set of correct validators with 1/3 of the voting power +* C2 - a set of correct validators with 1/3 of the voting power +* C1 and C2 are disjoint +* F - a set of faulty validators with 1/3 voting power +* one additional faulty process *q* +* F and *q* violate the Tendermint failure model. + + +Execution: + +* in a round *r* of height *h* we have C1 precommitting a value A, +* C2 precommits nil, +* F does not send any message +* *q* precommits nil. +* In some round *r' > r*, F and *q* and C2 commit some other value B different from A. +* F and *fp* "go back to the past" and sign precommit message for value A in round *r*. +* Together with precomit messages of C1 this is sufficient for a commit for value A. + + +Consequences: + +* Only a single faulty validator that previously precommited nil did equivocation, while the other 1/3 of faulty validators actually executed an attack that has exactly the same sequence of messages as part of amnesia attack. Detecting this kind of attack boil down to mechanisms for equivocation and amnesia. + +**Q:** should we keep this as a separate kind of attack? It seems that equivocation, amnesia and phantom validators are the only kind of attack we need to support and this gives us security also in other cases. This would not be surprising as equivocation and amnesia are attacks that followed from the protocol and phantom attack is not really an attack to Tendermint but more to the Proof of stake module. + +### Phantom validators + +In case of phantom validators, processes that are not part of the current validator set but are still bonded (as attack happen during their unbonding period) can be part of the attack by signing vote messages. This attack can be executed against both full nodes and lite clients. + +#### Scenario 6: + +Validators: +* F -- a set of faulty validators that are not part of the validator set on the main chain at height *h + k* + +Execution: + +* There is a fork, and there exists two different headers for height *h + k*, with different validator sets: + - VS2 on the main chain + - forged header VS2', signed by F (and others) + +* a lite client has a trust in a header for height *h* (and the corresponding validator set VS1). +* As part of bisection header verification, it verifies header at height *h + k* with new validator set VS2'. + +Consequences: + +* To detect this, a node needs to see both, the forged header and the canonical header from the chain. +* If this is the case, detecting these kind of attacks is easy as it just requires verifying if processes are signing messages in heights in which they are not part of the validator set. + +**Remark.** We can have phantom-validator-based attacks as a follow up of equivocation or amnesia based attack where forked state contains validators that are not part of the validator set at the main chain. In this case, they keep signing messages contributed to a forked chain (the wrong branch) although they are not part of the validator set on the main chain. This attack can also be used to attack full node during a period of time he is eclipsed. + +### Lunatic validator + +Lunatic validator agrees to sign commit messages for arbitrary application state. It is used to attack lite clients. +Note that detecting this behavior require application knowledge. Detecting this behavior can probably be done by +referring to the block before the one in which height happen. + +**Q:** can we say that in this case a validator ignore to check if proposed value is valid before voting for it? From 7f0c55f24980939f6f5ce5b6341fe3b8ff708b7f Mon Sep 17 00:00:00 2001 From: Mircea Colonescu Date: Tue, 10 Sep 2019 02:56:16 -0400 Subject: [PATCH 28/63] ran go mod tidy (#3967) --- go.sum | 4 ---- 1 file changed, 4 deletions(-) diff --git a/go.sum b/go.sum index 012d2aa51..b0379c79c 100644 --- a/go.sum +++ b/go.sum @@ -71,8 +71,6 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ= -github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -103,8 +101,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-buffer-pool v0.0.1 h1:9Rrn/H46cXjaA2HQ5Y8lyhOS1NhTkZ4yuEs2r3Eechg= -github.com/libp2p/go-buffer-pool v0.0.1/go.mod h1:xtyIz9PMobb13WaxR6Zo1Pd1zXJKYg0a8KiIvDp3TzQ= github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= From 04d13d9945b904a11885a400506bcadc725eae0b Mon Sep 17 00:00:00 2001 From: Phil Salant Date: Tue, 10 Sep 2019 03:31:44 -0400 Subject: [PATCH 29/63] fix linter errors thrown by `unconvert`, `goconst`, and `nakedret` (#3960) * Remove unnecessary type conversions * Consolidate repeated strings into consts * Clothe return statements * Update blockchain/v1/reactor_fsm_test.go Co-Authored-By: Anton Kaliaev This PR repairs linter errors seen when running the following commands: golangci-lint run --no-config --disable-all=true --enable=unconvert golangci-lint run --no-config --disable-all=true --enable=goconst golangci-lint run --no-config --disable-all=true --enable=nakedret Contributes to #3262 --- abci/example/kvstore/kvstore_test.go | 19 ++++++++++++------- abci/example/kvstore/persistent_kvstore.go | 2 +- blockchain/v1/pool.go | 2 +- blockchain/v1/pool_test.go | 4 ++-- blockchain/v1/reactor_fsm_test.go | 10 +++++----- consensus/replay.go | 2 +- consensus/state.go | 4 ++-- consensus/state_test.go | 4 ++-- crypto/merkle/proof_simple_value.go | 4 ++-- .../bitarray/compact_bit_array_test.go | 2 +- lite/dynamic_verifier_test.go | 8 +++++--- lite/proxy/query.go | 2 +- lite/proxy/wrapper.go | 2 +- mempool/clist_mempool_test.go | 2 +- p2p/conn/connection.go | 2 +- p2p/conn/connection_test.go | 2 +- p2p/conn/secret_connection.go | 4 ++-- p2p/conn/secret_connection_test.go | 2 +- p2p/pex/addrbook.go | 4 ++-- p2p/upnp/probe.go | 2 +- p2p/upnp/upnp.go | 8 ++++---- proxy/app_conn_test.go | 2 +- rpc/client/rpc_test.go | 2 +- rpc/core/tx.go | 2 +- rpc/lib/rpc_test.go | 10 ++++++---- rpc/lib/server/handlers.go | 6 +++--- rpc/lib/types/types_test.go | 6 +++--- state/state_test.go | 2 +- tools/tm-monitor/monitor/network.go | 2 +- types/tx.go | 2 +- types/vote.go | 3 ++- 31 files changed, 69 insertions(+), 59 deletions(-) diff --git a/abci/example/kvstore/kvstore_test.go b/abci/example/kvstore/kvstore_test.go index 80b07ff5a..80e60fdec 100644 --- a/abci/example/kvstore/kvstore_test.go +++ b/abci/example/kvstore/kvstore_test.go @@ -18,6 +18,11 @@ import ( "github.com/tendermint/tendermint/abci/types" ) +const ( + testKey = "abc" + testValue = "def" +) + func testKVStore(t *testing.T, app types.Application, tx []byte, key, value string) { req := types.RequestDeliverTx{Tx: tx} ar := app.DeliverTx(req) @@ -46,12 +51,12 @@ func testKVStore(t *testing.T, app types.Application, tx []byte, key, value stri func TestKVStoreKV(t *testing.T) { kvstore := NewKVStoreApplication() - key := "abc" + key := testKey value := key tx := []byte(key) testKVStore(t, kvstore, tx, key, value) - value = "def" + value = testValue tx = []byte(key + "=" + value) testKVStore(t, kvstore, tx, key, value) } @@ -62,12 +67,12 @@ func TestPersistentKVStoreKV(t *testing.T) { t.Fatal(err) } kvstore := NewPersistentKVStoreApplication(dir) - key := "abc" + key := testKey value := key tx := []byte(key) testKVStore(t, kvstore, tx, key, value) - value = "def" + value = testValue tx = []byte(key + "=" + value) testKVStore(t, kvstore, tx, key, value) } @@ -90,7 +95,7 @@ func TestPersistentKVStoreInfo(t *testing.T) { height = int64(1) hash := []byte("foo") header := types.Header{ - Height: int64(height), + Height: height, } kvstore.BeginBlock(types.RequestBeginBlock{Hash: hash, Header: header}) kvstore.EndBlock(types.RequestEndBlock{Height: header.Height}) @@ -272,12 +277,12 @@ func TestClientServer(t *testing.T) { func runClientTests(t *testing.T, client abcicli.Client) { // run some tests.... - key := "abc" + key := testKey value := key tx := []byte(key) testClient(t, client, tx, key, value) - value = "def" + value = testValue tx = []byte(key + "=" + value) testClient(t, client, tx, key, value) } diff --git a/abci/example/kvstore/persistent_kvstore.go b/abci/example/kvstore/persistent_kvstore.go index eb2514a69..7f3550d4f 100644 --- a/abci/example/kvstore/persistent_kvstore.go +++ b/abci/example/kvstore/persistent_kvstore.go @@ -198,7 +198,7 @@ func (app *PersistentKVStoreApplication) execValidatorTx(tx []byte) types.Respon } // update - return app.updateValidator(types.Ed25519ValidatorUpdate(pubkey, int64(power))) + return app.updateValidator(types.Ed25519ValidatorUpdate(pubkey, power)) } // add, update, or remove a validator diff --git a/blockchain/v1/pool.go b/blockchain/v1/pool.go index 5de741305..be2edbc21 100644 --- a/blockchain/v1/pool.go +++ b/blockchain/v1/pool.go @@ -191,7 +191,7 @@ func (pool *BlockPool) makeRequestBatch(maxNumRequests int) []int { // - FSM timed out on waiting to advance the block execution due to missing blocks at h or h+1 // Determine the number of requests needed by subtracting the number of requests already made from the maximum // allowed - numNeeded := int(maxNumRequests) - len(pool.blocks) + numNeeded := maxNumRequests - len(pool.blocks) for len(pool.plannedRequests) < numNeeded { if pool.nextRequestHeight > pool.MaxPeerHeight { break diff --git a/blockchain/v1/pool_test.go b/blockchain/v1/pool_test.go index 72758d3b1..5af51148f 100644 --- a/blockchain/v1/pool_test.go +++ b/blockchain/v1/pool_test.go @@ -77,10 +77,10 @@ func makeBlockPool(bcr *testBcR, height int64, peers []BpPeer, blocks map[int64] bPool.MaxPeerHeight = maxH for h, p := range blocks { bPool.blocks[h] = p.id - bPool.peers[p.id].RequestSent(int64(h)) + bPool.peers[p.id].RequestSent(h) if p.create { // simulate that a block at height h has been received - _ = bPool.peers[p.id].AddBlock(types.MakeBlock(int64(h), txs, nil, nil), 100) + _ = bPool.peers[p.id].AddBlock(types.MakeBlock(h, txs, nil, nil), 100) } } return bPool diff --git a/blockchain/v1/reactor_fsm_test.go b/blockchain/v1/reactor_fsm_test.go index 54e177f25..548d3e7fe 100644 --- a/blockchain/v1/reactor_fsm_test.go +++ b/blockchain/v1/reactor_fsm_test.go @@ -140,7 +140,7 @@ func sBlockRespEv(current, expected string, peerID p2p.ID, height int64, prevBlo data: bReactorEventData{ peerID: peerID, height: height, - block: types.MakeBlock(int64(height), txs, nil, nil), + block: types.MakeBlock(height, txs, nil, nil), length: 100}, wantState: expected, wantNewBlocks: append(prevBlocks, height), @@ -157,7 +157,7 @@ func sBlockRespEvErrored(current, expected string, data: bReactorEventData{ peerID: peerID, height: height, - block: types.MakeBlock(int64(height), txs, nil, nil), + block: types.MakeBlock(height, txs, nil, nil), length: 100}, wantState: expected, wantErr: wantErr, @@ -769,7 +769,7 @@ forLoop: for i := 0; i < int(numBlocks); i++ { // Add the makeRequestEv step periodically. - if i%int(maxRequestsPerPeer) == 0 { + if i%maxRequestsPerPeer == 0 { testSteps = append( testSteps, sMakeRequestsEv("waitForBlock", "waitForBlock", maxNumRequests), @@ -786,7 +786,7 @@ forLoop: numBlocksReceived++ // Add the processedBlockEv step periodically. - if numBlocksReceived >= int(maxRequestsPerPeer) || height >= numBlocks { + if numBlocksReceived >= maxRequestsPerPeer || height >= numBlocks { for j := int(height) - numBlocksReceived; j < int(height); j++ { if j >= int(numBlocks) { // This is the last block that is processed, we should be in "finished" state. @@ -829,7 +829,7 @@ func makeCorrectTransitionSequenceWithRandomParameters() testFields { maxRequestsPerPeer := cmn.RandIntn(maxRequestsPerPeerTest) + 1 // Generate the maximum number of total pending requests, >= maxRequestsPerPeer. - maxPendingRequests := cmn.RandIntn(maxTotalPendingRequestsTest-int(maxRequestsPerPeer)) + maxRequestsPerPeer + maxPendingRequests := cmn.RandIntn(maxTotalPendingRequestsTest-maxRequestsPerPeer) + maxRequestsPerPeer // Generate the number of blocks to be synced. numBlocks := int64(cmn.RandIntn(maxNumBlocksInChainTest)) + startingHeight diff --git a/consensus/replay.go b/consensus/replay.go index 43ad557f7..83c6b3d40 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -246,7 +246,7 @@ func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error { return fmt.Errorf("Error calling Info: %v", err) } - blockHeight := int64(res.LastBlockHeight) + blockHeight := res.LastBlockHeight if blockHeight < 0 { return fmt.Errorf("Got a negative last block height (%d) from the app", blockHeight) } diff --git a/consensus/state.go b/consensus/state.go index 2cfb277e1..c2ad00c95 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -1458,7 +1458,7 @@ func (cs *ConsensusState) addProposalBlockPart(msg *BlockPartMessage, peerID p2p _, err = cdc.UnmarshalBinaryLengthPrefixedReader( cs.ProposalBlockParts.GetReader(), &cs.ProposalBlock, - int64(cs.state.ConsensusParams.Block.MaxBytes), + cs.state.ConsensusParams.Block.MaxBytes, ) if err != nil { return added, err @@ -1675,7 +1675,7 @@ func (cs *ConsensusState) addVote(vote *types.Vote, peerID p2p.ID) (added bool, panic(fmt.Sprintf("Unexpected vote type %X", vote.Type)) // go-amino should prevent this. } - return + return added, err } func (cs *ConsensusState) signVote(type_ types.SignedMsgType, hash []byte, header types.PartSetHeader) (*types.Vote, error) { diff --git a/consensus/state_test.go b/consensus/state_test.go index 8409f2235..96547e796 100644 --- a/consensus/state_test.go +++ b/consensus/state_test.go @@ -189,7 +189,7 @@ func TestStateBadProposal(t *testing.T) { if len(stateHash) == 0 { stateHash = make([]byte, 32) } - stateHash[0] = byte((stateHash[0] + 1) % 255) + stateHash[0] = (stateHash[0] + 1) % 255 propBlock.AppHash = stateHash propBlockParts := propBlock.MakePartSet(partSize) blockID := types.BlockID{Hash: propBlock.Hash(), PartsHeader: propBlockParts.Header()} @@ -364,7 +364,7 @@ func TestStateLockNoPOL(t *testing.T) { // lets add one for a different block hash := make([]byte, len(theBlockHash)) copy(hash, theBlockHash) - hash[0] = byte((hash[0] + 1) % 255) + hash[0] = (hash[0] + 1) % 255 signAddVotes(cs1, types.PrecommitType, hash, thePartSetHeader, vs2) ensurePrecommit(voteCh, height, round) // precommit diff --git a/crypto/merkle/proof_simple_value.go b/crypto/merkle/proof_simple_value.go index 2c89bb5fd..55337b7b8 100644 --- a/crypto/merkle/proof_simple_value.go +++ b/crypto/merkle/proof_simple_value.go @@ -74,8 +74,8 @@ func (op SimpleValueOp) Run(args [][]byte) ([][]byte, error) { bz := new(bytes.Buffer) // Wrap to hash the KVPair. - encodeByteSlice(bz, []byte(op.key)) // does not error - encodeByteSlice(bz, []byte(vhash)) // does not error + encodeByteSlice(bz, op.key) // does not error + encodeByteSlice(bz, vhash) // does not error kvhash := leafHash(bz.Bytes()) if !bytes.Equal(kvhash, op.Proof.LeafHash) { diff --git a/crypto/multisig/bitarray/compact_bit_array_test.go b/crypto/multisig/bitarray/compact_bit_array_test.go index 4612ae25a..70c0544d9 100644 --- a/crypto/multisig/bitarray/compact_bit_array_test.go +++ b/crypto/multisig/bitarray/compact_bit_array_test.go @@ -21,7 +21,7 @@ func randCompactBitArray(bits int) (*CompactBitArray, []byte) { } } // Set remaining bits - for i := uint8(0); i < 8-uint8(bA.ExtraBitsStored); i++ { + for i := uint8(0); i < 8-bA.ExtraBitsStored; i++ { bA.SetIndex(numBytes*8+int(i), src[numBytes-1]&(uint8(1)<<(8-i)) > 0) } return bA, src diff --git a/lite/dynamic_verifier_test.go b/lite/dynamic_verifier_test.go index c95fee9ec..9a5a62816 100644 --- a/lite/dynamic_verifier_test.go +++ b/lite/dynamic_verifier_test.go @@ -13,6 +13,8 @@ import ( dbm "github.com/tendermint/tm-db" ) +const testChainID = "inquiry-test" + func TestInquirerValidPath(t *testing.T) { assert, require := assert.New(t), require.New(t) trust := NewDBProvider("trust", dbm.NewMemDB()) @@ -24,7 +26,7 @@ func TestInquirerValidPath(t *testing.T) { nkeys := keys.Extend(1) // Construct a bunch of commits, each with one more height than the last. - chainID := "inquiry-test" + chainID := testChainID consHash := []byte("params") resHash := []byte("results") count := 50 @@ -146,7 +148,7 @@ func TestInquirerVerifyHistorical(t *testing.T) { nkeys := keys.Extend(1) // Construct a bunch of commits, each with one more height than the last. - chainID := "inquiry-test" + chainID := testChainID count := 10 consHash := []byte("special-params") fcz := make([]FullCommit, count) @@ -229,7 +231,7 @@ func TestConcurrencyInquirerVerify(t *testing.T) { nkeys := keys.Extend(1) // Construct a bunch of commits, each with one more height than the last. - chainID := "inquiry-test" + chainID := testChainID count := 10 consHash := []byte("special-params") fcz := make([]FullCommit, count) diff --git a/lite/proxy/query.go b/lite/proxy/query.go index 2e0b93229..518a6a235 100644 --- a/lite/proxy/query.go +++ b/lite/proxy/query.go @@ -29,7 +29,7 @@ func GetWithProof(prt *merkle.ProofRuntime, key []byte, reqHeight int64, node rp } res, err := GetWithProofOptions(prt, "/key", key, - rpcclient.ABCIQueryOptions{Height: int64(reqHeight), Prove: true}, + rpcclient.ABCIQueryOptions{Height: reqHeight, Prove: true}, node, cert) if err != nil { return diff --git a/lite/proxy/wrapper.go b/lite/proxy/wrapper.go index 2d333e9fb..82fee97cd 100644 --- a/lite/proxy/wrapper.go +++ b/lite/proxy/wrapper.go @@ -58,7 +58,7 @@ func (w Wrapper) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) { if !prove || err != nil { return res, err } - h := int64(res.Height) + h := res.Height sh, err := GetCertifiedCommit(h, w.Client, w.cert) if err != nil { return res, err diff --git a/mempool/clist_mempool_test.go b/mempool/clist_mempool_test.go index 666d5530a..e45228479 100644 --- a/mempool/clist_mempool_test.go +++ b/mempool/clist_mempool_test.go @@ -564,7 +564,7 @@ func TestMempoolRemoteAppConcurrency(t *testing.T) { for i := 0; i < N; i++ { peerID := mrand.Intn(maxPeers) txNum := mrand.Intn(nTxs) - tx := txs[int(txNum)] + tx := txs[txNum] // this will err with ErrTxInCache many times ... mempool.CheckTxWithInfo(tx, nil, TxInfo{SenderID: uint16(peerID)}) diff --git a/p2p/conn/connection.go b/p2p/conn/connection.go index 68066a7c7..231ec989f 100644 --- a/p2p/conn/connection.go +++ b/p2p/conn/connection.go @@ -803,7 +803,7 @@ func (ch *Channel) isSendPending() bool { // Not goroutine-safe func (ch *Channel) nextPacketMsg() PacketMsg { packet := PacketMsg{} - packet.ChannelID = byte(ch.desc.ID) + packet.ChannelID = ch.desc.ID maxSize := ch.maxPacketMsgPayloadSize packet.Bytes = ch.sending[:cmn.MinInt(maxSize, len(ch.sending))] if len(ch.sending) <= maxSize { diff --git a/p2p/conn/connection_test.go b/p2p/conn/connection_test.go index 91e3e2099..03a31ec63 100644 --- a/p2p/conn/connection_test.go +++ b/p2p/conn/connection_test.go @@ -133,7 +133,7 @@ func TestMConnectionReceive(t *testing.T) { select { case receivedBytes := <-receivedCh: - assert.Equal(t, []byte(msg), receivedBytes) + assert.Equal(t, msg, receivedBytes) case err := <-errorsCh: t.Fatalf("Expected %s, got %+v", msg, err) case <-time.After(500 * time.Millisecond): diff --git a/p2p/conn/secret_connection.go b/p2p/conn/secret_connection.go index a4489f475..c8e450f5b 100644 --- a/p2p/conn/secret_connection.go +++ b/p2p/conn/secret_connection.go @@ -188,7 +188,7 @@ func (sc *SecretConnection) Write(data []byte) (n int, err error) { return n, err } } - return + return n, err } // CONTRACT: data smaller than dataMaxSize is read atomically. @@ -234,7 +234,7 @@ func (sc *SecretConnection) Read(data []byte) (n int, err error) { sc.recvBuffer = make([]byte, len(chunk)-n) copy(sc.recvBuffer, chunk[n:]) } - return + return n, err } // Implements net.Conn diff --git a/p2p/conn/secret_connection_test.go b/p2p/conn/secret_connection_test.go index 9ab9695a3..4eefa799d 100644 --- a/p2p/conn/secret_connection_test.go +++ b/p2p/conn/secret_connection_test.go @@ -87,7 +87,7 @@ func makeSecretConnPair(tb testing.TB) (fooSecConn, barSecConn *SecretConnection require.Nil(tb, trs.FirstError()) require.True(tb, ok, "Unexpected task abortion") - return + return fooSecConn, barSecConn } func TestSecretConnectionHandshake(t *testing.T) { diff --git a/p2p/pex/addrbook.go b/p2p/pex/addrbook.go index 27bcef9e8..a64eb28a5 100644 --- a/p2p/pex/addrbook.go +++ b/p2p/pex/addrbook.go @@ -784,12 +784,12 @@ func (a *addrBook) groupKey(na *p2p.NetAddress) string { } if na.RFC6145() || na.RFC6052() { // last four bytes are the ip address - ip := net.IP(na.IP[12:16]) + ip := na.IP[12:16] return (&net.IPNet{IP: ip, Mask: net.CIDRMask(16, 32)}).String() } if na.RFC3964() { - ip := net.IP(na.IP[2:7]) + ip := na.IP[2:7] return (&net.IPNet{IP: ip, Mask: net.CIDRMask(16, 32)}).String() } diff --git a/p2p/upnp/probe.go b/p2p/upnp/probe.go index 16a537241..9adf72c6b 100644 --- a/p2p/upnp/probe.go +++ b/p2p/upnp/probe.go @@ -78,7 +78,7 @@ func testHairpin(listener net.Listener, extAddr string, logger log.Logger) (supp // Wait for data receipt time.Sleep(1 * time.Second) - return + return supportsHairpin } func Probe(logger log.Logger) (caps UPNPCapabilities, err error) { diff --git a/p2p/upnp/upnp.go b/p2p/upnp/upnp.go index 89f35c5df..0be23ea6d 100644 --- a/p2p/upnp/upnp.go +++ b/p2p/upnp/upnp.go @@ -105,7 +105,7 @@ func Discover() (nat NAT, err error) { } } err = errors.New("UPnP port discovery failed") - return + return nat, err } type Envelope struct { @@ -241,7 +241,7 @@ func getServiceURL(rootURL string) (url, urnDomain string, err error) { // Extract the domain name, which isn't always 'schemas-upnp-org' urnDomain = strings.Split(d.ServiceType, ":")[1] url = combineURL(rootURL, d.ControlURL) - return + return url, urnDomain, err } func combineURL(rootURL, subURL string) string { @@ -285,7 +285,7 @@ func soapRequest(url, function, message, domain string) (r *http.Response, err e r = nil return } - return + return r, err } type statusInfo struct { @@ -322,7 +322,7 @@ func (n *upnpNAT) getExternalIPAddress() (info statusInfo, err error) { return } - return + return info, err } // GetExternalAddress returns an external IP. If GetExternalIPAddress action diff --git a/proxy/app_conn_test.go b/proxy/app_conn_test.go index ca98f1be4..2004b0b89 100644 --- a/proxy/app_conn_test.go +++ b/proxy/app_conn_test.go @@ -147,7 +147,7 @@ func TestInfo(t *testing.T) { if err != nil { t.Errorf("Unexpected error: %v", err) } - if string(resInfo.Data) != "{\"size\":0}" { + if resInfo.Data != "{\"size\":0}" { t.Error("Expected ResponseInfo with one element '{\"size\":0}' but got something else") } } diff --git a/rpc/client/rpc_test.go b/rpc/client/rpc_test.go index 4bb37cf48..8bcbd313d 100644 --- a/rpc/client/rpc_test.go +++ b/rpc/client/rpc_test.go @@ -559,7 +559,7 @@ func makeEvidences(t *testing.T, val *privval.FilePV, chainID string) (ev types. // exactly same vote vote2 = deepcpVote(vote) fakes[41] = newEvidence(t, val, vote, vote2, chainID) - return + return ev, fakes } func TestBroadcastEvidenceDuplicateVote(t *testing.T) { diff --git a/rpc/core/tx.go b/rpc/core/tx.go index dba457c30..50a11fd45 100644 --- a/rpc/core/tx.go +++ b/rpc/core/tx.go @@ -106,7 +106,7 @@ func Tx(ctx *rpctypes.Context, hash []byte, prove bool) (*ctypes.ResultTx, error return &ctypes.ResultTx{ Hash: hash, Height: height, - Index: uint32(index), + Index: index, TxResult: r.Result, Tx: r.Tx, Proof: proof, diff --git a/rpc/lib/rpc_test.go b/rpc/lib/rpc_test.go index 3fa4de47f..9af5728a8 100644 --- a/rpc/lib/rpc_test.go +++ b/rpc/lib/rpc_test.go @@ -33,6 +33,8 @@ const ( unixAddr = "unix://" + unixSocket websocketEndpoint = "/websocket/endpoint" + + testVal = "acbd" ) type ResultEcho struct { @@ -189,7 +191,7 @@ func echoDataBytesViaHTTP(cl client.HTTPClient, bytes cmn.HexBytes) (cmn.HexByte } func testWithHTTPClient(t *testing.T, cl client.HTTPClient) { - val := "acbd" + val := testVal got, err := echoViaHTTP(cl, val) require.Nil(t, err) assert.Equal(t, got, val) @@ -255,7 +257,7 @@ func echoBytesViaWS(cl *client.WSClient, bytes []byte) ([]byte, error) { } func testWithWSClient(t *testing.T, cl *client.WSClient) { - val := "acbd" + val := testVal got, err := echoViaWS(cl, val) require.Nil(t, err) assert.Equal(t, got, val) @@ -314,7 +316,7 @@ func TestWSNewWSRPCFunc(t *testing.T) { require.Nil(t, err) defer cl.Stop() - val := "acbd" + val := testVal params := map[string]interface{}{ "arg": val, } @@ -339,7 +341,7 @@ func TestWSHandlesArrayParams(t *testing.T) { require.Nil(t, err) defer cl.Stop() - val := "acbd" + val := testVal params := []interface{}{val} err = cl.CallWithArrayParams(context.Background(), "echo_ws", params) require.Nil(t, err) diff --git a/rpc/lib/server/handlers.go b/rpc/lib/server/handlers.go index 5b5c9f8b9..70baa489f 100644 --- a/rpc/lib/server/handlers.go +++ b/rpc/lib/server/handlers.go @@ -376,9 +376,9 @@ func _nonJSONStringToArg(cdc *amino.Codec, rt reflect.Type, arg string) (reflect rv, err := jsonStringToArg(cdc, rt, qarg) if err != nil { return rv, err, false - } else { - return rv, nil, true } + + return rv, nil, true } if isHexString { @@ -396,7 +396,7 @@ func _nonJSONStringToArg(cdc *amino.Codec, rt reflect.Type, arg string) (reflect if rt.Kind() == reflect.String { return reflect.ValueOf(string(value)), nil, true } - return reflect.ValueOf([]byte(value)), nil, true + return reflect.ValueOf(value), nil, true } if isQuotedString && expectingByteSlice { diff --git a/rpc/lib/types/types_test.go b/rpc/lib/types/types_test.go index a5b2da9ce..b57211a96 100644 --- a/rpc/lib/types/types_test.go +++ b/rpc/lib/types/types_test.go @@ -39,17 +39,17 @@ func TestResponses(t *testing.T) { a := NewRPCSuccessResponse(cdc, jsonid, &SampleResult{"hello"}) b, _ := json.Marshal(a) s := fmt.Sprintf(`{"jsonrpc":"2.0","id":%v,"result":{"Value":"hello"}}`, tt.expected) - assert.Equal(string(s), string(b)) + assert.Equal(s, string(b)) d := RPCParseError(jsonid, errors.New("Hello world")) e, _ := json.Marshal(d) f := fmt.Sprintf(`{"jsonrpc":"2.0","id":%v,"error":{"code":-32700,"message":"Parse error. Invalid JSON","data":"Hello world"}}`, tt.expected) - assert.Equal(string(f), string(e)) + assert.Equal(f, string(e)) g := RPCMethodNotFoundError(jsonid) h, _ := json.Marshal(g) i := fmt.Sprintf(`{"jsonrpc":"2.0","id":%v,"error":{"code":-32601,"message":"Method not found"}}`, tt.expected) - assert.Equal(string(h), string(i)) + assert.Equal(string(h), i) } } diff --git a/state/state_test.go b/state/state_test.go index 062e62bb5..bd4935ea8 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -645,7 +645,7 @@ func TestLargeGenesisValidator(t *testing.T) { tearDown, _, state := setupTestCase(t) defer tearDown(t) - genesisVotingPower := int64(types.MaxTotalVotingPower / 1000) + genesisVotingPower := types.MaxTotalVotingPower / 1000 genesisPubKey := ed25519.GenPrivKey().PubKey() // fmt.Println("genesis addr: ", genesisPubKey.Address()) genesisVal := &types.Validator{Address: genesisPubKey.Address(), PubKey: genesisPubKey, VotingPower: genesisVotingPower} diff --git a/tools/tm-monitor/monitor/network.go b/tools/tm-monitor/monitor/network.go index 4d85d7ed6..45cf2ac3c 100644 --- a/tools/tm-monitor/monitor/network.go +++ b/tools/tm-monitor/monitor/network.go @@ -85,7 +85,7 @@ func (n *Network) NewBlock(b tmtypes.Header) { } else { n.AvgBlockTime = 0.0 } - n.txThroughputMeter.Mark(int64(b.NumTxs)) + n.txThroughputMeter.Mark(b.NumTxs) n.AvgTxThroughput = n.txThroughputMeter.Rate1() } diff --git a/types/tx.go b/types/tx.go index 0c6845a7d..b71c70029 100644 --- a/types/tx.go +++ b/types/tx.go @@ -133,6 +133,6 @@ type TxResult struct { // fieldNum is also 1 (see BinFieldNum in amino.MarshalBinaryBare). func ComputeAminoOverhead(tx Tx, fieldNum int) int64 { fnum := uint64(fieldNum) - typ3AndFieldNum := (uint64(fnum) << 3) | uint64(amino.Typ3_ByteLength) + typ3AndFieldNum := (fnum << 3) | uint64(amino.Typ3_ByteLength) return int64(amino.UvarintSize(typ3AndFieldNum)) + int64(amino.UvarintSize(uint64(len(tx)))) } diff --git a/types/vote.go b/types/vote.go index 6fcbd3ff6..69cc514bd 100644 --- a/types/vote.go +++ b/types/vote.go @@ -13,6 +13,7 @@ import ( const ( // MaxVoteBytes is a maximum vote size (including amino overhead). MaxVoteBytes int64 = 223 + nilVoteStr = "nil-Vote" ) var ( @@ -84,7 +85,7 @@ func (vote *Vote) Copy() *Vote { func (vote *Vote) String() string { if vote == nil { - return "nil-Vote" + return nilVoteStr } var typeString string switch vote.Type { From c4294bd4d724e2366866aec4431f16fbe486f26b Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 10 Sep 2019 16:38:37 +0400 Subject: [PATCH 30/63] cs: check for SkipTimeoutCommit or wait timeout in handleTxsAvailable (#3928) * cs: check for SkipTimeoutCommit or wait timeout in handleTxsAvailable Previously, if create_empty_blocks was set to false, TM sometimes could create 2 consecutive blocks without actually waiting for timeoutCommit (1 sec. by default). ``` I[2019-08-29|07:32:43.874] Executed block module=state height=47 validTxs=10 invalidTxs=0 I[2019-08-29|07:32:43.876] Committed state module=state height=47 txs=10 appHash=F88C010000000000 I[2019-08-29|07:32:44.885] Executed block module=state height=48 validTxs=2 invalidTxs=0 I[2019-08-29|07:32:44.887] Committed state module=state height=48 txs=2 appHash=FC8C010000000000 I[2019-08-29|07:32:44.908] Executed block module=state height=49 validTxs=8 invalidTxs=0 I[2019-08-29|07:32:44.909] Committed state module=state height=49 txs=8 appHash=8C8D010000000000 I[2019-08-29|07:32:45.886] Executed block module=state height=50 validTxs=2 invalidTxs=0 I[2019-08-29|07:32:45.895] Committed state module=state height=50 txs=2 appHash=908D010000000000 I[2019-08-29|07:32:45.908] Executed block module=state height=51 validTxs=8 invalidTxs=0 I[2019-08-29|07:32:45.909] Committed state module=state height=51 txs=8 appHash=A08D010000000000 ``` This commit fixes that by adding a check to handleTxsAvailable. Fixes #3908 * update changelog * schedule timeoutCommit if StartTime is in the future or SkipTimeoutCommit=true && we DON'T have all the votes * fix TestReactorCreatesBlockWhenEmptyBlocksFalse by checking if we have LastCommit or not * address Ethan's comments --- CHANGELOG_PENDING.md | 2 ++ consensus/state.go | 26 +++++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 1b3cbc067..d75e29ce7 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -22,3 +22,5 @@ program](https://hackerone.com/tendermint). - [rpc] \#2010 Add NewHTTPWithClient and NewJSONRPCClientWithHTTPClient (note these and NewHTTP, NewJSONRPCClient functions panic if remote is invalid) (@gracenoah) ### BUG FIXES: + +- [consensus] \#3908 Wait `timeout_commit` to pass even if `create_empty_blocks` is `false` diff --git a/consensus/state.go b/consensus/state.go index c2ad00c95..50b5981e6 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -537,7 +537,7 @@ func (cs *ConsensusState) updateToState(state sm.State) { // We add timeoutCommit to allow transactions // to be gathered for the first block. // And alternative solution that relies on clocks: - // cs.StartTime = state.LastBlockTime.Add(timeoutCommit) + // cs.StartTime = state.LastBlockTime.Add(timeoutCommit) cs.StartTime = cs.config.Commit(tmtime.Now()) } else { cs.StartTime = cs.config.Commit(cs.CommitTime) @@ -756,9 +756,25 @@ func (cs *ConsensusState) handleTimeout(ti timeoutInfo, rs cstypes.RoundState) { func (cs *ConsensusState) handleTxsAvailable() { cs.mtx.Lock() defer cs.mtx.Unlock() - // we only need to do this for round 0 - cs.enterNewRound(cs.Height, 0) - cs.enterPropose(cs.Height, 0) + + // We only need to do this for round 0. + if cs.Round != 0 { + return + } + + switch cs.Step { + case cstypes.RoundStepNewHeight: // timeoutCommit phase + if cs.needProofBlock(cs.Height) { + // enterPropose will be called by enterNewRound + return + } + + // +1ms to ensure RoundStepNewRound timeout always happens after RoundStepNewHeight + timeoutCommit := cs.StartTime.Sub(tmtime.Now()) + 1*time.Millisecond + cs.scheduleTimeout(timeoutCommit, cs.Height, 0, cstypes.RoundStepNewRound) + case cstypes.RoundStepNewRound: // after timeoutCommit + cs.enterPropose(cs.Height, 0) + } } //----------------------------------------------------------------------------- @@ -766,7 +782,7 @@ func (cs *ConsensusState) handleTxsAvailable() { // Used internally by handleTimeout and handleMsg to make state transitions // Enter: `timeoutNewHeight` by startTime (commitTime+timeoutCommit), -// or, if SkipTimeout==true, after receiving all precommits from (height,round-1) +// or, if SkipTimeoutCommit==true, after receiving all precommits from (height,round-1) // Enter: `timeoutPrecommits` after any +2/3 precommits from (height,round-1) // Enter: +2/3 precommits for nil at (height,round-1) // Enter: +2/3 prevotes any or +2/3 precommits for block or any from (height, round) From 2edd89b4507d50c7340c91dacf427789ba8341ce Mon Sep 17 00:00:00 2001 From: Jon <50962907+jon-certik@users.noreply.github.com> Date: Tue, 10 Sep 2019 08:51:19 -0400 Subject: [PATCH 31/63] mempool: fix memory loading error on 32-bit machines (#3969) * Correct memory alignment for 32-bit machine. Switching the `txsBytes` and `rechecking` fields of `CListMempool` to ensure the correct memory alignment for `atomic.LoadInt64` on 32-bit machine. * Update CHANGELOG_PENDING.md for #3968 Fixed #3968 `mempool` Memory Loading Error on 32-bit Ubuntu 16.04 Machine. * Update CHANGELOG_PENDING.md Co-Authored-By: Anton Kaliaev --- CHANGELOG_PENDING.md | 1 + mempool/clist_mempool.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index d75e29ce7..c8bb7bcca 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -24,3 +24,4 @@ program](https://hackerone.com/tendermint). ### BUG FIXES: - [consensus] \#3908 Wait `timeout_commit` to pass even if `create_empty_blocks` is `false` +- [mempool] \#3968 Fix memory loading error on 32-bit machines (@jon-certik) diff --git a/mempool/clist_mempool.go b/mempool/clist_mempool.go index 8df4e6708..ee47e52d8 100644 --- a/mempool/clist_mempool.go +++ b/mempool/clist_mempool.go @@ -53,8 +53,8 @@ type CListMempool struct { // Atomic integers height int64 // the last block Update()'d to - rechecking int32 // for re-checking filtered txs on Update() txsBytes int64 // total size of mempool, in bytes + rechecking int32 // for re-checking filtered txs on Update() // Keep a cache of already-seen txs. // This reduces the pressure on the proxyApp. From 777ff271cba868b3abe4188ebab4c8bb711e7640 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 10 Sep 2019 21:58:17 +0400 Subject: [PATCH 32/63] enable unconvert, goconst and nakedret linters (#3973) This should've been a part of https://github.com/tendermint/tendermint/pull/3960, but I forgot about it while reviewing. A good programmer is someone who always looks both ways before crossing a one-way street. - Doug Linder --- .golangci.yml | 6 ------ types/vote_set.go | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 17d575316..690cc3f69 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,10 +9,7 @@ linters: - maligned - errcheck - interfacer - - unconvert - - goconst - unparam - - nakedret - lll - gochecknoglobals - gochecknoinits @@ -29,9 +26,6 @@ linters: # suggest-new: true # dupl: # threshold: 100 -# goconst: -# min-len: 2 -# min-occurrences: 2 # depguard: # list-type: blacklist # packages: diff --git a/types/vote_set.go b/types/vote_set.go index a4a42bb4c..56dd9a13c 100644 --- a/types/vote_set.go +++ b/types/vote_set.go @@ -434,7 +434,7 @@ func (voteSet *VoteSet) StringIndented(indent string) string { voteStrings := make([]string, len(voteSet.votes)) for i, vote := range voteSet.votes { if vote == nil { - voteStrings[i] = "nil-Vote" + voteStrings[i] = nilVoteStr } else { voteStrings[i] = vote.String() } @@ -499,7 +499,7 @@ func (voteSet *VoteSet) voteStrings() []string { voteStrings := make([]string, len(voteSet.votes)) for i, vote := range voteSet.votes { if vote == nil { - voteStrings[i] = "nil-Vote" + voteStrings[i] = nilVoteStr } else { voteStrings[i] = vote.String() } From 961e1d360fe8ef4efb573f15fa7da0e907809fc0 Mon Sep 17 00:00:00 2001 From: Shivani Joshi <46731446+Shivani912@users.noreply.github.com> Date: Tue, 10 Sep 2019 15:19:33 -0400 Subject: [PATCH 33/63] docs/guides: specify a fix for badger err on Windows (#3974) * Added badger error for Windows * Update go-built-in.md * Update docs/guides/go-built-in.md Co-Authored-By: Anton Kaliaev * Update docs/guides/go.md Co-Authored-By: Anton Kaliaev When restarting the app, it throws an error saying that it requires truncation of badger value log because it is corrupted. This seems to be an issue with badger DB and it is reported here. It solves the problem when you set the truncate value to true, but this obviously results in loss of data. I am not sure if this is a concern or not. However, it'd great if this could be documented for Windows users! Fixes #3954 --- docs/guides/go-built-in.md | 6 ++++++ docs/guides/go.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/docs/guides/go-built-in.md b/docs/guides/go-built-in.md index 705022c90..96adaf885 100644 --- a/docs/guides/go-built-in.md +++ b/docs/guides/go-built-in.md @@ -448,6 +448,12 @@ defer db.Close() app := NewKVStoreApplication(db) ``` +For **Windows** users, restarting this app will make badger throw an error as it requires value log to be truncated. For more information on this, visit [here](https://github.com/dgraph-io/badger/issues/744). +This can be avoided by setting the truncate option to true, like this: +```go +db, err := badger.Open(badger.DefaultOptions("/tmp/badger").WithTruncate(true)) +``` + Then we use it to create a Tendermint Core `Node` instance: ```go diff --git a/docs/guides/go.md b/docs/guides/go.md index ada84adfc..3798c9f5e 100644 --- a/docs/guides/go.md +++ b/docs/guides/go.md @@ -388,6 +388,12 @@ defer db.Close() app := NewKVStoreApplication(db) ``` +For **Windows** users, restarting this app will make badger throw an error as it requires value log to be truncated. For more information on this, visit [here](https://github.com/dgraph-io/badger/issues/744). +This can be avoided by setting the truncate option to true, like this: +```go +db, err := badger.Open(badger.DefaultOptions("/tmp/badger").WithTruncate(true)) +``` + Then we start the ABCI server and add some signal handling to gracefully stop it upon receiving SIGTERM or Ctrl-C. Tendermint Core will act as a client, which connects to our server and send us transactions and other messages. From d1d517a9b74b7136933342370cddfb8a1d5ca48e Mon Sep 17 00:00:00 2001 From: Phil Salant Date: Wed, 11 Sep 2019 01:15:18 -0400 Subject: [PATCH 34/63] linters: enable scopelint (#3963) * Pin range scope vars * Don't disable scopelint This PR repairs linter errors seen when running the following commands: golangci-lint run --no-config --disable-all=true --enable=scopelint Contributes to #3262 --- .golangci.yml | 1 - blockchain/v0/reactor_test.go | 4 ++++ blockchain/v1/peer_test.go | 2 ++ blockchain/v1/pool_test.go | 9 +++++++++ blockchain/v1/reactor_fsm_test.go | 4 ++++ blockchain/v1/reactor_test.go | 4 ++++ consensus/reactor_test.go | 7 +++++++ consensus/replay_test.go | 1 + consensus/wal_test.go | 2 ++ crypto/merkle/rfc6962_test.go | 1 + crypto/multisig/bitarray/compact_bit_array_test.go | 5 +++++ crypto/secp256k1/secp256k1_internal_test.go | 1 + crypto/secp256k1/secp256k1_test.go | 1 + evidence/reactor_test.go | 1 + libs/common/bit_array_test.go | 1 + libs/common/bytes_test.go | 1 + libs/flowrate/io_test.go | 2 ++ libs/log/filter_test.go | 1 + p2p/conn/secret_connection_test.go | 2 ++ p2p/netaddress_test.go | 1 + rpc/lib/client/http_client.go | 1 + rpc/lib/server/handlers.go | 1 + scripts/privValUpgrade_test.go | 1 + state/execution_test.go | 2 ++ state/store_test.go | 1 + state/txindex/kv/kv_test.go | 2 ++ store/store_test.go | 2 ++ types/block_test.go | 7 +++++++ types/event_bus_test.go | 1 + types/evidence_test.go | 1 + types/part_set_test.go | 2 ++ types/proposal_test.go | 1 + types/vote_test.go | 1 + 33 files changed, 73 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 690cc3f69..8b7fbd7ec 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,7 +13,6 @@ linters: - lll - gochecknoglobals - gochecknoinits - - scopelint - stylecheck # linters-settings: # govet: diff --git a/blockchain/v0/reactor_test.go b/blockchain/v0/reactor_test.go index 1ba43400e..0a88dbd74 100644 --- a/blockchain/v0/reactor_test.go +++ b/blockchain/v0/reactor_test.go @@ -258,6 +258,7 @@ func TestBcBlockRequestMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { request := bcBlockRequestMessage{Height: tc.requestHeight} assert.Equal(t, tc.expectErr, request.ValidateBasic() != nil, "Validate Basic had an unexpected result") @@ -277,6 +278,7 @@ func TestBcNoBlockResponseMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { nonResponse := bcNoBlockResponseMessage{Height: tc.nonResponseHeight} assert.Equal(t, tc.expectErr, nonResponse.ValidateBasic() != nil, "Validate Basic had an unexpected result") @@ -296,6 +298,7 @@ func TestBcStatusRequestMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { request := bcStatusRequestMessage{Height: tc.requestHeight} assert.Equal(t, tc.expectErr, request.ValidateBasic() != nil, "Validate Basic had an unexpected result") @@ -315,6 +318,7 @@ func TestBcStatusResponseMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { response := bcStatusResponseMessage{Height: tc.responseHeight} assert.Equal(t, tc.expectErr, response.ValidateBasic() != nil, "Validate Basic had an unexpected result") diff --git a/blockchain/v1/peer_test.go b/blockchain/v1/peer_test.go index 3c19e4efd..c35419790 100644 --- a/blockchain/v1/peer_test.go +++ b/blockchain/v1/peer_test.go @@ -125,6 +125,7 @@ func TestPeerGetAndRemoveBlock(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { // try to get the block b, err := peer.BlockAtHeight(tt.height) @@ -167,6 +168,7 @@ func TestPeerAddBlock(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { // try to get the block err := peer.AddBlock(makeSmallBlock(int(tt.height)), 10) diff --git a/blockchain/v1/pool_test.go b/blockchain/v1/pool_test.go index 5af51148f..5530ecd41 100644 --- a/blockchain/v1/pool_test.go +++ b/blockchain/v1/pool_test.go @@ -159,6 +159,7 @@ func TestBlockPoolUpdatePeer(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { pool := tt.pool err := pool.UpdatePeer(tt.args.id, tt.args.height) @@ -232,6 +233,7 @@ func TestBlockPoolRemovePeer(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { tt.pool.RemovePeer(tt.args.peerID, tt.args.err) assertBlockPoolEquivalent(t, tt.poolWanted, tt.pool) @@ -272,6 +274,7 @@ func TestBlockPoolRemoveShortPeers(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { pool := tt.pool pool.removeShortPeers() @@ -317,6 +320,7 @@ func TestBlockPoolSendRequestBatch(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { resetPoolTestResults() @@ -421,6 +425,7 @@ func TestBlockPoolAddBlock(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { err := tt.pool.AddBlock(tt.args.peerID, tt.args.block, tt.args.blockSize) assert.Equal(t, tt.errWanted, err) @@ -473,6 +478,7 @@ func TestBlockPoolFirstTwoBlocksAndPeers(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { pool := tt.pool gotFirst, gotSecond, err := pool.FirstTwoBlocksAndPeers() @@ -544,6 +550,7 @@ func TestBlockPoolInvalidateFirstTwoBlocks(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { tt.pool.InvalidateFirstTwoBlocks(errNoPeerResponse) assertBlockPoolEquivalent(t, tt.poolWanted, tt.pool) @@ -584,6 +591,7 @@ func TestProcessedCurrentHeightBlock(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { tt.pool.ProcessedCurrentHeightBlock() assertBlockPoolEquivalent(t, tt.poolWanted, tt.pool) @@ -642,6 +650,7 @@ func TestRemovePeerAtCurrentHeight(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { tt.pool.RemovePeerAtCurrentHeights(errNoPeerResponse) assertBlockPoolEquivalent(t, tt.poolWanted, tt.pool) diff --git a/blockchain/v1/reactor_fsm_test.go b/blockchain/v1/reactor_fsm_test.go index 548d3e7fe..7dff5bbaf 100644 --- a/blockchain/v1/reactor_fsm_test.go +++ b/blockchain/v1/reactor_fsm_test.go @@ -211,6 +211,7 @@ type testFields struct { func executeFSMTests(t *testing.T, tests []testFields, matchRespToReq bool) { for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { // Create test reactor testBcR := newTestReactor(tt.startingHeight) @@ -220,6 +221,7 @@ func executeFSMTests(t *testing.T, tests []testFields, matchRespToReq bool) { } for _, step := range tt.steps { + step := step assert.Equal(t, step.currentState, testBcR.fsm.state.name) var heightBefore int64 @@ -862,6 +864,7 @@ func TestFSMCorrectTransitionSequences(t *testing.T) { } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { // Create test reactor testBcR := newTestReactor(tt.startingHeight) @@ -871,6 +874,7 @@ func TestFSMCorrectTransitionSequences(t *testing.T) { } for _, step := range tt.steps { + step := step assert.Equal(t, step.currentState, testBcR.fsm.state.name) oldNumStatusRequests := testBcR.numStatusRequests diff --git a/blockchain/v1/reactor_test.go b/blockchain/v1/reactor_test.go index 9599b7a8a..00f7b0968 100644 --- a/blockchain/v1/reactor_test.go +++ b/blockchain/v1/reactor_test.go @@ -329,6 +329,7 @@ func TestBcBlockRequestMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { request := bcBlockRequestMessage{Height: tc.requestHeight} assert.Equal(t, tc.expectErr, request.ValidateBasic() != nil, "Validate Basic had an unexpected result") @@ -348,6 +349,7 @@ func TestBcNoBlockResponseMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { nonResponse := bcNoBlockResponseMessage{Height: tc.nonResponseHeight} assert.Equal(t, tc.expectErr, nonResponse.ValidateBasic() != nil, "Validate Basic had an unexpected result") @@ -367,6 +369,7 @@ func TestBcStatusRequestMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { request := bcStatusRequestMessage{Height: tc.requestHeight} assert.Equal(t, tc.expectErr, request.ValidateBasic() != nil, "Validate Basic had an unexpected result") @@ -386,6 +389,7 @@ func TestBcStatusResponseMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { response := bcStatusResponseMessage{Height: tc.responseHeight} assert.Equal(t, tc.expectErr, response.ValidateBasic() != nil, "Validate Basic had an unexpected result") diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index 0c76f7b4d..168f07924 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -656,6 +656,7 @@ func TestNewRoundStepMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { message := NewRoundStepMessage{ Height: tc.messageHeight, @@ -685,6 +686,7 @@ func TestNewValidBlockMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { message := NewValidBlockMessage{ Height: tc.messageHeight, @@ -715,6 +717,7 @@ func TestProposalPOLMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { message := ProposalPOLMessage{ Height: tc.messageHeight, @@ -742,6 +745,7 @@ func TestBlockPartMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { message := BlockPartMessage{ Height: tc.messageHeight, @@ -781,6 +785,7 @@ func TestHasVoteMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { message := HasVoteMessage{ Height: tc.messageHeight, @@ -825,6 +830,7 @@ func TestVoteSetMaj23MessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { message := VoteSetMaj23Message{ Height: tc.messageHeight, @@ -871,6 +877,7 @@ func TestVoteSetBitsMessageValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { message := VoteSetBitsMessage{ Height: tc.messageHeight, diff --git a/consensus/replay_test.go b/consensus/replay_test.go index 5b454248d..b308e4946 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -123,6 +123,7 @@ func TestWALCrash(t *testing.T) { } for i, tc := range testCases { + tc := tc consensusReplayConfig := ResetConfig(fmt.Sprintf("%s_%d", t.Name(), i)) t.Run(tc.name, func(t *testing.T) { crashWALandCheckLiveness(t, consensusReplayConfig, tc.initFn, tc.heightToStop) diff --git a/consensus/wal_test.go b/consensus/wal_test.go index 5cb73fb7f..82d912f3a 100644 --- a/consensus/wal_test.go +++ b/consensus/wal_test.go @@ -86,6 +86,8 @@ func TestWALEncoderDecoder(t *testing.T) { b := new(bytes.Buffer) for _, msg := range msgs { + msg := msg + b.Reset() enc := NewWALEncoder(b) diff --git a/crypto/merkle/rfc6962_test.go b/crypto/merkle/rfc6962_test.go index 52eab4228..e2fe7f617 100644 --- a/crypto/merkle/rfc6962_test.go +++ b/crypto/merkle/rfc6962_test.go @@ -56,6 +56,7 @@ func TestRFC6962Hasher(t *testing.T) { got: innerHash([]byte("N123"), []byte("N456")), }, } { + tc := tc t.Run(tc.desc, func(t *testing.T) { wantBytes, err := hex.DecodeString(tc.want) if err != nil { diff --git a/crypto/multisig/bitarray/compact_bit_array_test.go b/crypto/multisig/bitarray/compact_bit_array_test.go index 70c0544d9..369945ff3 100644 --- a/crypto/multisig/bitarray/compact_bit_array_test.go +++ b/crypto/multisig/bitarray/compact_bit_array_test.go @@ -72,6 +72,7 @@ func TestJSONMarshalUnmarshal(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.bA.String(), func(t *testing.T) { bz, err := json.Marshal(tc.bA) require.NoError(t, err) @@ -131,6 +132,7 @@ func TestCompactMarshalUnmarshal(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.bA.String(), func(t *testing.T) { bz := tc.bA.CompactMarshal() @@ -165,12 +167,15 @@ func TestCompactBitArrayNumOfTrueBitsBefore(t *testing.T) { {`"______________xx"`, []int{14, 15}, []int{0, 1}}, } for tcIndex, tc := range testCases { + tc := tc + tcIndex := tcIndex t.Run(tc.marshalledBA, func(t *testing.T) { var bA *CompactBitArray err := json.Unmarshal([]byte(tc.marshalledBA), &bA) require.NoError(t, err) for i := 0; i < len(tc.bAIndex); i++ { + require.Equal(t, tc.trueValueIndex[i], bA.NumTrueBitsBefore(tc.bAIndex[i]), "tc %d, i %d", tcIndex, i) } }) diff --git a/crypto/secp256k1/secp256k1_internal_test.go b/crypto/secp256k1/secp256k1_internal_test.go index 305f12020..3103413f8 100644 --- a/crypto/secp256k1/secp256k1_internal_test.go +++ b/crypto/secp256k1/secp256k1_internal_test.go @@ -29,6 +29,7 @@ func Test_genPrivKey(t *testing.T) { {"valid because 0 < 1 < N", validOne, false}, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { if tt.shouldPanic { require.Panics(t, func() { diff --git a/crypto/secp256k1/secp256k1_test.go b/crypto/secp256k1/secp256k1_test.go index 2488b5399..aaf8f8112 100644 --- a/crypto/secp256k1/secp256k1_test.go +++ b/crypto/secp256k1/secp256k1_test.go @@ -100,6 +100,7 @@ func TestGenPrivKeySecp256k1(t *testing.T) { {"another seed used in cosmos tests #3", []byte("")}, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { gotPrivKey := secp256k1.GenPrivKeySecp256k1(tt.secret) require.NotNil(t, gotPrivKey) diff --git a/evidence/reactor_test.go b/evidence/reactor_test.go index 9603e6680..006978b3b 100644 --- a/evidence/reactor_test.go +++ b/evidence/reactor_test.go @@ -203,6 +203,7 @@ func TestEvidenceListMessageValidationBasic(t *testing.T) { }, true}, } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { evListMsg := &EvidenceListMessage{} n := 3 diff --git a/libs/common/bit_array_test.go b/libs/common/bit_array_test.go index 09ec8af25..acf745cc8 100644 --- a/libs/common/bit_array_test.go +++ b/libs/common/bit_array_test.go @@ -232,6 +232,7 @@ func TestJSONMarshalUnmarshal(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.bA.String(), func(t *testing.T) { bz, err := json.Marshal(tc.bA) require.NoError(t, err) diff --git a/libs/common/bytes_test.go b/libs/common/bytes_test.go index 9e11988f2..49c8cacb9 100644 --- a/libs/common/bytes_test.go +++ b/libs/common/bytes_test.go @@ -40,6 +40,7 @@ func TestJSONMarshal(t *testing.T) { } for i, tc := range cases { + tc := tc t.Run(fmt.Sprintf("Case %d", i), func(t *testing.T) { ts := TestStruct{B1: tc.input, B2: tc.input} diff --git a/libs/flowrate/io_test.go b/libs/flowrate/io_test.go index ab2c7121f..d482a7b72 100644 --- a/libs/flowrate/io_test.go +++ b/libs/flowrate/io_test.go @@ -89,6 +89,7 @@ func TestReader(t *testing.T) { {false, start, _300ms, 0, 20, 3, 0, 0, 67, 100, 0, 0, 0}, } for i, s := range status { + s := s if !statusesAreEqual(&s, &want[i]) { t.Errorf("r.Status(%v)\nexpected: %v\ngot : %v", i, want[i], s) } @@ -143,6 +144,7 @@ func TestWriter(t *testing.T) { {true, start, _500ms, _100ms, 100, 5, 200, 200, 200, 200, 0, 0, 100000}, } for i, s := range status { + s := s if !statusesAreEqual(&s, &want[i]) { t.Errorf("w.Status(%v)\nexpected: %v\ngot : %v\n", i, want[i], s) } diff --git a/libs/log/filter_test.go b/libs/log/filter_test.go index f9957f043..cf4dc7495 100644 --- a/libs/log/filter_test.go +++ b/libs/log/filter_test.go @@ -55,6 +55,7 @@ func TestVariousLevels(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.name, func(t *testing.T) { var buf bytes.Buffer logger := log.NewFilter(log.NewTMJSONLogger(&buf), tc.allowed) diff --git a/p2p/conn/secret_connection_test.go b/p2p/conn/secret_connection_test.go index 4eefa799d..0b7cc00c3 100644 --- a/p2p/conn/secret_connection_test.go +++ b/p2p/conn/secret_connection_test.go @@ -110,6 +110,7 @@ func TestShareLowOrderPubkey(t *testing.T) { // all blacklisted low order points: for _, remLowOrderPubKey := range blacklist { + remLowOrderPubKey := remLowOrderPubKey _, _ = cmn.Parallel( func(_ int) (val interface{}, err error, abort bool) { _, err = shareEphPubKey(fooConn, locEphPub) @@ -135,6 +136,7 @@ func TestShareLowOrderPubkey(t *testing.T) { func TestComputeDHFailsOnLowOrder(t *testing.T) { _, locPrivKey := genEphKeys() for _, remLowOrderPubKey := range blacklist { + remLowOrderPubKey := remLowOrderPubKey shared, err := computeDHSecret(&remLowOrderPubKey, locPrivKey) assert.Error(t, err) diff --git a/p2p/netaddress_test.go b/p2p/netaddress_test.go index e7d82cd77..a3dd40f30 100644 --- a/p2p/netaddress_test.go +++ b/p2p/netaddress_test.go @@ -67,6 +67,7 @@ func TestNewNetAddressString(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.name, func(t *testing.T) { addr, err := NewNetAddressString(tc.addr) if tc.correct { diff --git a/rpc/lib/client/http_client.go b/rpc/lib/client/http_client.go index 28f51191f..963da30b8 100644 --- a/rpc/lib/client/http_client.go +++ b/rpc/lib/client/http_client.go @@ -394,6 +394,7 @@ func unmarshalResponseBytesArray(cdc *amino.Codec, responseBytes []byte, expecte } for i, response := range responses { + response := response // From the JSON-RPC 2.0 spec: // id: It MUST be the same as the value of the id member in the Request Object. if err := validateResponseID(&response, expectedID); err != nil { diff --git a/rpc/lib/server/handlers.go b/rpc/lib/server/handlers.go index 70baa489f..cb7346769 100644 --- a/rpc/lib/server/handlers.go +++ b/rpc/lib/server/handlers.go @@ -129,6 +129,7 @@ func makeJSONRPCHandler(funcMap map[string]*RPCFunc, cdc *amino.Codec, logger lo } for _, request := range requests { + request := request // A Notification is a Request object without an "id" member. // The Server MUST NOT reply to a Notification, including those that are within a batch request. if request.ID == types.JSONRPCStringID("") { diff --git a/scripts/privValUpgrade_test.go b/scripts/privValUpgrade_test.go index bac4d315f..7caf38798 100644 --- a/scripts/privValUpgrade_test.go +++ b/scripts/privValUpgrade_test.go @@ -75,6 +75,7 @@ func TestLoadAndUpgrade(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { // need to re-write the file everytime because upgrading renames it err := ioutil.WriteFile(oldFilePath, []byte(oldPrivvalContent), 0600) diff --git a/state/execution_test.go b/state/execution_test.go index 38301df73..02d13b353 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -210,6 +210,7 @@ func TestValidateValidatorUpdates(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.name, func(t *testing.T) { err := sm.ValidateValidatorUpdates(tc.abciUpdates, tc.validatorParams) if tc.shouldErr { @@ -275,6 +276,7 @@ func TestUpdateValidators(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.name, func(t *testing.T) { updates, err := types.PB2TM.ValidatorUpdates(tc.abciUpdates) assert.NoError(t, err) diff --git a/state/store_test.go b/state/store_test.go index 4549e8f89..0a190446e 100644 --- a/state/store_test.go +++ b/state/store_test.go @@ -70,6 +70,7 @@ func BenchmarkLoadValidators(b *testing.B) { sm.SaveState(stateDB, state) for i := 10; i < 10000000000; i *= 10 { // 10, 100, 1000, ... + i := i sm.SaveValidatorsInfo(stateDB, int64(i), state.LastHeightValidatorsChanged, state.NextValidators) b.Run(fmt.Sprintf("height=%d", i), func(b *testing.B) { diff --git a/state/txindex/kv/kv_test.go b/state/txindex/kv/kv_test.go index a0c833e49..189a9da61 100644 --- a/state/txindex/kv/kv_test.go +++ b/state/txindex/kv/kv_test.go @@ -118,6 +118,7 @@ func TestTxSearch(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.q, func(t *testing.T) { results, err := indexer.Search(query.MustParse(tc.q)) assert.NoError(t, err) @@ -191,6 +192,7 @@ func TestTxSearchDeprecatedIndexing(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.q, func(t *testing.T) { results, err := indexer.Search(query.MustParse(tc.q)) require.NoError(t, err) diff --git a/store/store_test.go b/store/store_test.go index 0122a44ac..fd148f7b9 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -84,6 +84,7 @@ func TestNewBlockStore(t *testing.T) { } for i, tt := range panicCausers { + tt := tt // Expecting a panic here on trying to parse an invalid blockStore _, _, panicErr := doFn(func() (interface{}, error) { db.Set(blockStoreKey, tt.data) @@ -253,6 +254,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) { } for i, tuple := range tuples { + tuple := tuple bs, db := freshBlockStore() // SaveBlock res, err, panicErr := doFn(func() (interface{}, error) { diff --git a/types/block_test.go b/types/block_test.go index 716229bbc..71c6e9ea0 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -83,6 +83,8 @@ func TestBlockValidateBasic(t *testing.T) { }, true}, } for i, tc := range testCases { + tc := tc + i := i t.Run(tc.testName, func(t *testing.T) { block := MakeBlock(h, txs, commit, evList) block.ProposerAddress = valSet.GetProposer().Address @@ -228,6 +230,7 @@ func TestCommitValidateBasic(t *testing.T) { {"Incorrect round", func(com *Commit) { com.Precommits[0].Round = 100 }, true}, } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { com := randCommit() tc.malleateCommit(com) @@ -302,6 +305,7 @@ func TestBlockMaxDataBytes(t *testing.T) { } for i, tc := range testCases { + tc := tc if tc.panics { assert.Panics(t, func() { MaxDataBytes(tc.maxBytes, tc.valsCount, tc.evidenceCount) @@ -330,6 +334,7 @@ func TestBlockMaxDataBytesUnknownEvidence(t *testing.T) { } for i, tc := range testCases { + tc := tc if tc.panics { assert.Panics(t, func() { MaxDataBytesUnknownEvidence(tc.maxBytes, tc.valsCount) @@ -406,6 +411,7 @@ func TestSignedHeaderValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { sh := SignedHeader{ Header: tc.shHeader, @@ -445,6 +451,7 @@ func TestBlockIDValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { blockID := BlockID{ Hash: tc.blockIDHash, diff --git a/types/event_bus_test.go b/types/event_bus_test.go index 45590217f..f7631b6d5 100644 --- a/types/event_bus_test.go +++ b/types/event_bus_test.go @@ -338,6 +338,7 @@ func BenchmarkEventBus(b *testing.B) { } for _, bm := range benchmarks { + bm := bm b.Run(bm.name, func(b *testing.B) { benchmarkEventBus(bm.numClients, bm.randQueries, bm.randEvents, b) }) diff --git a/types/evidence_test.go b/types/evidence_test.go index fc97ae409..3c943e38f 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -146,6 +146,7 @@ func TestDuplicateVoteEvidenceValidation(t *testing.T) { }, true}, } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { ev := &DuplicateVoteEvidence{ PubKey: secp256k1.GenPrivKey().PubKey(), diff --git a/types/part_set_test.go b/types/part_set_test.go index daa2fa5c5..37aacea75 100644 --- a/types/part_set_test.go +++ b/types/part_set_test.go @@ -95,6 +95,7 @@ func TestPartSetHeaderValidateBasic(t *testing.T) { {"Invalid Hash", func(psHeader *PartSetHeader) { psHeader.Hash = make([]byte, 1) }, true}, } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { data := cmn.RandBytes(testPartSize * 100) ps := NewPartSetFromData(data, testPartSize) @@ -117,6 +118,7 @@ func TestPartValidateBasic(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { data := cmn.RandBytes(testPartSize * 100) ps := NewPartSetFromData(data, testPartSize) diff --git a/types/proposal_test.go b/types/proposal_test.go index f1c048e1d..3a1368072 100644 --- a/types/proposal_test.go +++ b/types/proposal_test.go @@ -127,6 +127,7 @@ func TestProposalValidateBasic(t *testing.T) { blockID := makeBlockID(tmhash.Sum([]byte("blockhash")), math.MaxInt64, tmhash.Sum([]byte("partshash"))) for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { prop := NewProposal( 4, 2, 2, diff --git a/types/vote_test.go b/types/vote_test.go index b6eb1f586..42a6bbd9f 100644 --- a/types/vote_test.go +++ b/types/vote_test.go @@ -285,6 +285,7 @@ func TestVoteValidateBasic(t *testing.T) { {"Too big Signature", func(v *Vote) { v.Signature = make([]byte, MaxSignatureSize+1) }, true}, } for _, tc := range testCases { + tc := tc t.Run(tc.testName, func(t *testing.T) { vote := examplePrecommit() err := privVal.SignVote("test_chain_id", vote) From 9c827807425bd7d62de4bc813cb9549a91b1bc36 Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Wed, 11 Sep 2019 05:29:28 -0400 Subject: [PATCH 35/63] Add cleveldb build for Amazon Linux (#3976) * Add cleveldb build for Amazon Linux In attempting to build Tendermint binaries with cleveldb support that we can use for load testing (see https://github.com/interchainio/got), it became apparent that we need a bit of a simpler build process for this kind of executable. Since we're basing our load testing infrastructure on Amazon Linux, it makes sense to support such a build process for Amazon Linux in a platform-independent way. This PR allows one to simply build the Amazon Linux-compatible binary using Docker on one's local machine. It first builds an Amazon Linux-based build image with Go v1.12.9, and then it uses that image to build the cleveldb version of Tendermint. This should, in theory, be compatible with CentOS too, but that's yet to be tested. * Add comment describing the new Makefile target * Add missing PHONY entry for new Makefile target * Expand on Makefile comment --- DOCKER/Dockerfile.build_c-amazonlinux | 28 +++++++++++++++++++++++++++ DOCKER/Makefile | 3 +++ Makefile | 9 ++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 DOCKER/Dockerfile.build_c-amazonlinux diff --git a/DOCKER/Dockerfile.build_c-amazonlinux b/DOCKER/Dockerfile.build_c-amazonlinux new file mode 100644 index 000000000..64babe3ae --- /dev/null +++ b/DOCKER/Dockerfile.build_c-amazonlinux @@ -0,0 +1,28 @@ +FROM amazonlinux:2 + +RUN yum -y update && \ + yum -y install wget + +RUN wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \ + rpm -ivh epel-release-latest-7.noarch.rpm + +RUN yum -y groupinstall "Development Tools" +RUN yum -y install leveldb-devel which + +ENV GOVERSION=1.12.9 + +RUN cd /tmp && \ + wget https://dl.google.com/go/go${GOVERSION}.linux-amd64.tar.gz && \ + tar -C /usr/local -xf go${GOVERSION}.linux-amd64.tar.gz && \ + mkdir -p /go/src && \ + mkdir -p /go/bin + +ENV PATH=$PATH:/usr/local/go/bin:/go/bin +ENV GOBIN=/go/bin +ENV GOPATH=/go/src + +RUN mkdir -p /tendermint +WORKDIR /tendermint + +CMD ["/usr/bin/make", "build_c"] + diff --git a/DOCKER/Makefile b/DOCKER/Makefile index 32510ebbb..41fb60ac8 100644 --- a/DOCKER/Makefile +++ b/DOCKER/Makefile @@ -13,4 +13,7 @@ build_testing: push_develop: docker push "tendermint/tendermint:develop" +build_amazonlinux_buildimage: + docker build -t "tendermint/tendermint:build_c-amazonlinux" -f Dockerfile.build_c-amazonlinux . + .PHONY: build build_develop push push_develop diff --git a/Makefile b/Makefile index fe76f0862..03a88a853 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,13 @@ build: build_c: CGO_ENABLED=1 go build $(BUILD_FLAGS) -tags "$(BUILD_TAGS) cleveldb" -o $(OUTPUT) ./cmd/tendermint/ +# Runs `make build_c` from within an Amazon Linux (v2)-based Docker build +# container in order to build an Amazon Linux-compatible binary. Produces a +# compatible binary at ./build/tendermint +build_c-amazonlinux: + $(MAKE) -C ./DOCKER build_amazonlinux_buildimage + docker run --rm -it -v `pwd`:/tendermint tendermint/tendermint:build_c-amazonlinux + build_race: CGO_ENABLED=1 go build -race $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint @@ -327,4 +334,4 @@ contract-tests: # To avoid unintended conflicts with file names, always add to .PHONY # unless there is a reason not to. # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html -.PHONY: check build build_race build_abci dist install install_abci check_tools get_tools update_tools draw_deps get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver test_cover test_apps test_persistence test_p2p test test_race test_integrations test_release test100 vagrant_test fmt rpc-docs build-linux localnet-start localnet-stop build-docker build-docker-localnode sentry-start sentry-config sentry-stop build-slate protoc_grpc protoc_all build_c install_c test_with_deadlock cleanup_after_test_with_deadlock lint build-contract-tests-hooks contract-tests +.PHONY: check build build_race build_abci dist install install_abci check_tools get_tools update_tools draw_deps get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver test_cover test_apps test_persistence test_p2p test test_race test_integrations test_release test100 vagrant_test fmt rpc-docs build-linux localnet-start localnet-stop build-docker build-docker-localnode sentry-start sentry-config sentry-stop build-slate protoc_grpc protoc_all build_c install_c test_with_deadlock cleanup_after_test_with_deadlock lint build-contract-tests-hooks contract-tests build_c-amazonlinux From fc1c37c4ac9a93ac94029adabf27e37c34211e4f Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Wed, 11 Sep 2019 10:10:07 -0400 Subject: [PATCH 36/63] Update ADR-025 and mark it as Accepted (#3958) * update adr-025, mark accepted * minor update * Update docs/architecture/adr-025-commit.md Co-Authored-By: Anton Kaliaev --- docs/architecture/adr-025-commit.md | 91 +++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 18 deletions(-) diff --git a/docs/architecture/adr-025-commit.md b/docs/architecture/adr-025-commit.md index 6db039d43..8f68662a8 100644 --- a/docs/architecture/adr-025-commit.md +++ b/docs/architecture/adr-025-commit.md @@ -5,7 +5,8 @@ Currently the `Commit` structure contains a lot of potentially redundant or unnecessary data. It contains a list of precommits from every validator, where the precommit includes the whole `Vote` structure. Thus each of the commit height, round, -type, and blockID are repeated for every validator, and could be deduplicated. +type, and blockID are repeated for every validator, and could be deduplicated, +leading to very significant savings in block size. ``` type Commit struct { @@ -24,21 +25,40 @@ type Vote struct { Signature []byte `json:"signature"` } ``` -References: -[#1648](https://github.com/tendermint/tendermint/issues/1648) -[#2179](https://github.com/tendermint/tendermint/issues/2179) -[#2226](https://github.com/tendermint/tendermint/issues/2226) -## Proposed Solution +The original tracking issue for this is [#1648](https://github.com/tendermint/tendermint/issues/1648). +We have discussed replacing the `Vote` type in `Commit` with a new `CommitSig` +type, which includes at minimum the vote signature. The `Vote` type will +continue to be used in the consensus reactor and elsewhere. -We can improve efficiency by replacing the usage of the `Vote` struct with a subset of each vote, and by storing the constant values (`Height`, `Round`, `BlockID`) in the Commit itself. +A primary question is what should be included in the `CommitSig` beyond the +signature. One current constraint is that we must include a timestamp, since +this is how we calculuate BFT time, though we may be able to change this [in the +future](https://github.com/tendermint/tendermint/issues/2840). + +Other concerns here include: + +- Validator Address [#3596](https://github.com/tendermint/tendermint/issues/3596) - + Should the CommitSig include the validator address? It is very convenient to + do so, but likely not necessary. This was also discussed in [#2226](https://github.com/tendermint/tendermint/issues/2226). +- Absent Votes [#3591](https://github.com/tendermint/tendermint/issues/3591) - + How to represent absent votes? Currently they are just present as `nil` in the + Precommits list, which is actually problematic for serialization +- Other BlockIDs [#3485](https://github.com/tendermint/tendermint/issues/3485) - + How to represent votes for nil and for other block IDs? We currently allow + votes for nil and votes for alternative block ids, but just ignore them + + +## Decision + +Deduplicate the fields and introduce `CommitSig`: ``` type Commit struct { Height int64 Round int BlockID BlockID `json:"block_id"` - Precommits []*CommitSig `json:"precommits"` + Precommits []CommitSig `json:"precommits"` } type CommitSig struct { @@ -60,19 +80,54 @@ const ( ``` -Note the need for an extra byte to indicate whether the signature is for the BlockID or for nil. -This byte can also be used to indicate an absent vote, rather than using a nil object like we currently do, -which has been [problematic for compatibility between Amino and proto3](https://github.com/tendermint/go-amino/issues/260). - -Note we also continue to store the `ValidatorAddress` in the `CommitSig`. -While this still takes 20-bytes per signature, it ensures that the Commit has all -information necessary to reconstruct Vote, which simplifies mapping between Commit and Vote objects -and with debugging. It also may be necessary for the light-client to know which address a signature corresponds to if -it is trying to verify a current commit with an older validtor set. +Re the concerns outlined in the context: + +**Timestamp**: Leave the timestamp for now. Removing it and switching to +proposer based time will take more analysis and work, and will be left for a +future breaking change. In the meantime, the concerns with the current approach to +BFT time [can be +mitigated](https://github.com/tendermint/tendermint/issues/2840#issuecomment-529122431). + +**ValidatorAddress**: we include it in the `CommitSig` for now. While this +does increase the block size unecessarily (20-bytes per validator), it has some ergonomic and debugging advantages: + +- `Commit` contains everything necessary to reconstruct `[]Vote`, and doesn't depend on additional access to a `ValidatorSet` +- Lite clients can check if they know the validators in a commit without + re-downloading the validator set +- Easy to see directly in a commit which validators signed what without having + to fetch the validator set + +If and when we change the `CommitSig` again, for instance to remove the timestamp, +we can reconsider whether the ValidatorAddress should be removed. + +**Absent Votes**: we include absent votes explicitly with no Signature or +Timestamp but with the ValidatorAddress. This should resolve the serialization +issues and make it easy to see which validator's votes failed to be included. + +**Other BlockIDs**: We use a single byte to indicate which blockID a `CommitSig` +is for. The only options are: + - `Absent` - no vote received from the this validator, so no signature + - `Nil` - validator voted Nil - meaning they did not see a polka in time + - `Commit` - validator voted for this block + +Note this means we don't allow votes for any other blockIDs. If a signature is +included in a commit, it is either for nil or the correct blockID. According to +the Tendermint protocol and assumptions, there is no way for a correct validator to +precommit for a conflicting blockID in the same round an actual commit was +created. This was the consensus from +[#3485](https://github.com/tendermint/tendermint/issues/3485) + +We may want to consider supporting other blockIDs later, as a way to capture +evidence that might be helpful. We should clarify if/when/how doing so would +actually help first. To implement it, we could change the `Commit.BlockID` +field to a slice, where the first entry is the correct block ID and the other +entries are other BlockIDs that validators precommited before. The BlockIDFlag +enum can be extended to represent these additional block IDs on a per block +basis. ## Status -Proposed +Accepted ## Consequences From 5474528db14bfb4b0b245788d16e125a1ddbeee1 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Thu, 12 Sep 2019 12:06:26 -0400 Subject: [PATCH 37/63] Switch to a priority queue: * Routines will now use a priority queue instead of channels to iterate over events --- blockchain/v2/demuxer.go | 34 +++---- blockchain/v2/reactor.go | 11 ++- blockchain/v2/reactor_test.go | 4 +- blockchain/v2/routine.go | 181 +++++++++++----------------------- blockchain/v2/routine_test.go | 84 +++++++++------- blockchain/v2/types.go | 64 +++++++++++- go.mod | 1 + go.sum | 2 + 8 files changed, 196 insertions(+), 185 deletions(-) diff --git a/blockchain/v2/demuxer.go b/blockchain/v2/demuxer.go index e19816a2d..5ebb54633 100644 --- a/blockchain/v2/demuxer.go +++ b/blockchain/v2/demuxer.go @@ -8,8 +8,12 @@ import ( "github.com/tendermint/tendermint/libs/log" ) -type scFull struct{} -type pcFull struct{} +type scFull struct { + priorityHigh +} +type pcFull struct { + priorityHigh +} const demuxerBufferSize = 10 @@ -62,56 +66,50 @@ func (dm *demuxer) start() { dm.stopped <- struct{}{} return } - oEvents, err := dm.handle(event) + oEvent, err := dm.handle(event) if err != nil { dm.terminate(err) return } - for _, event := range oEvents { - dm.input <- event - } + dm.input <- oEvent case event, ok := <-dm.scheduler.next(): if !ok { dm.logger.Info("demuxer: scheduler output closed") continue } - oEvents, err := dm.handle(event) + oEvent, err := dm.handle(event) if err != nil { dm.terminate(err) return } - for _, event := range oEvents { - dm.input <- event - } + dm.input <- oEvent case event, ok := <-dm.processor.next(): if !ok { dm.logger.Info("demuxer: processor output closed") continue } - oEvents, err := dm.handle(event) + oEvent, err := dm.handle(event) if err != nil { dm.terminate(err) return } - for _, event := range oEvents { - dm.input <- event - } + dm.input <- oEvent } } } -func (dm *demuxer) handle(event Event) (Events, error) { +func (dm *demuxer) handle(event Event) (Event, error) { received := dm.scheduler.trySend(event) if !received { - return Events{scFull{}}, nil // backpressure + return scFull{}, nil // backpressure } received = dm.processor.trySend(event) if !received { - return Events{pcFull{}}, nil // backpressure + return pcFull{}, nil // backpressure } - return Events{}, nil + return noOp, nil } func (dm *demuxer) trySend(event Event) bool { diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 7c7bf4e27..64deb5ce8 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -8,27 +8,28 @@ import ( ) type timeCheck struct { + priorityHigh time time.Time } -func schedulerHandle(event Event) (Events, error) { +func schedulerHandle(event Event) (Event, error) { switch event.(type) { case timeCheck: fmt.Println("scheduler handle timeCheck") case Event: fmt.Println("scheduler handle testEvent") } - return Events{}, nil + return noOp, nil } -func processorHandle(event Event) (Events, error) { +func processorHandle(event Event) (Event, error) { switch event.(type) { case timeCheck: fmt.Println("processor handle timeCheck") case Event: fmt.Println("processor handle event") } - return Events{}, nil + return noOp, nil } type Reactor struct { @@ -61,7 +62,7 @@ func (r *Reactor) Start() { go func() { for t := range r.ticker.C { - r.demuxer.trySend(timeCheck{t}) + r.demuxer.trySend(timeCheck{time: t}) } }() } diff --git a/blockchain/v2/reactor_test.go b/blockchain/v2/reactor_test.go index d075641f7..2b3e2be1e 100644 --- a/blockchain/v2/reactor_test.go +++ b/blockchain/v2/reactor_test.go @@ -6,8 +6,8 @@ import "testing" func TestReactor(t *testing.T) { reactor := Reactor{} reactor.Start() - script := Events{ - struct{}{}, + script := []Event{ + // TODO } for _, event := range script { diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index b9b09e3df..eaaa68cf0 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -4,6 +4,7 @@ import ( "fmt" "sync/atomic" + "github.com/Workiva/go-datastructures/queue" "github.com/tendermint/tendermint/libs/log" ) @@ -12,7 +13,7 @@ import ( // * audit log levels // * Convert routine to an interface with concrete implmentation -type handleFunc = func(event Event) (Events, error) +type handleFunc = func(event Event) (Event, error) // Routines are a structure which model a finite state machine as serialized // stream of events processed by a handle function. This Routine structure @@ -21,34 +22,30 @@ type handleFunc = func(event Event) (Events, error) // `next()`. Calling `close()` on a routine will conclude processing of all // sent events and produce `last()` event representing the terminal state. type Routine struct { - name string - input chan Event - errors chan error - out chan Event - stopped chan struct{} - rdy chan struct{} - fin chan error - running *uint32 - handle handleFunc - logger log.Logger - metrics *Metrics - stopping *uint32 + name string + queue *queue.PriorityQueue + out chan Event // XXX: actually item + fin chan error + rdy chan struct{} + running *uint32 + handle handleFunc + logger log.Logger + metrics *Metrics } +var queueSize int = 10 + func newRoutine(name string, handleFunc handleFunc) *Routine { return &Routine{ - name: name, - input: make(chan Event, 1), - handle: handleFunc, - errors: make(chan error, 1), - out: make(chan Event, 1), - stopped: make(chan struct{}, 1), - rdy: make(chan struct{}, 1), - fin: make(chan error, 1), - running: new(uint32), - stopping: new(uint32), - logger: log.NewNopLogger(), - metrics: NopMetrics(), + name: name, + queue: queue.NewPriorityQueue(queueSize, true), + handle: handleFunc, + out: make(chan Event, queueSize), + rdy: make(chan struct{}, 1), + fin: make(chan error, 1), + running: new(uint32), + logger: log.NewNopLogger(), + metrics: NopMetrics(), } } @@ -63,138 +60,80 @@ func (rt *Routine) setMetrics(metrics *Metrics) { func (rt *Routine) start() { rt.logger.Info(fmt.Sprintf("%s: run\n", rt.name)) - starting := atomic.CompareAndSwapUint32(rt.running, uint32(0), uint32(1)) - if !starting { - panic("Routine has already started") + running := atomic.CompareAndSwapUint32(rt.running, uint32(0), uint32(1)) + if !running { + panic(fmt.Sprintf("%s is already running", rt.name)) } close(rt.rdy) - errorsDrained := false + defer func() { + stopped := atomic.CompareAndSwapUint32(rt.running, uint32(1), uint32(0)) + if !stopped { + panic(fmt.Sprintf("%s is failed to stop", rt.name)) + } + }() + for { - if !rt.isRunning() { - rt.logger.Info(fmt.Sprintf("%s: breaking because not running\n", rt.name)) - break + events, err := rt.queue.Get(1) + if err != nil { + rt.logger.Info(fmt.Sprintf("%s: stopping\n", rt.name)) + rt.terminate(fmt.Errorf("stopped")) + return } - select { - case iEvent, ok := <-rt.input: - rt.metrics.EventsIn.With("routine", rt.name).Add(1) - if !ok { - if !errorsDrained { - rt.logger.Info(fmt.Sprintf("%s: waiting for errors to drain\n", rt.name)) - - continue // wait for errors to be drainned - } - rt.logger.Info(fmt.Sprintf("%s: stopping\n", rt.name)) - close(rt.stopped) - rt.terminate(fmt.Errorf("stopped")) - return - } - oEvents, err := rt.handle(iEvent) - rt.metrics.EventsHandled.With("routine", rt.name).Add(1) - if err != nil { - rt.terminate(err) - return - } - rt.metrics.EventsOut.With("routine", rt.name).Add(float64(len(oEvents))) - rt.logger.Info(fmt.Sprintf("%s handled %d events\n", rt.name, len(oEvents))) - for _, event := range oEvents { - rt.logger.Info(fmt.Sprintln("writing back to output")) - rt.out <- event - } - case iEvent, ok := <-rt.errors: - rt.metrics.ErrorsIn.With("routine", rt.name).Add(1) - if !ok { - rt.logger.Info(fmt.Sprintf("%s: errors closed\n", rt.name)) - errorsDrained = true - continue - } - oEvents, err := rt.handle(iEvent) - rt.metrics.ErrorsHandled.With("routine", rt.name).Add(1) - if err != nil { - rt.terminate(err) - return - } - rt.metrics.ErrorsOut.With("routine", rt.name).Add(float64(len(oEvents))) - for _, event := range oEvents { - rt.out <- event - } + oEvent, err := rt.handle(events[0]) + rt.metrics.EventsHandled.With("routine", rt.name).Add(1) + if err != nil { + rt.terminate(err) + return } - } -} -func (rt *Routine) feedback() { - for event := range rt.out { - rt.trySend(event) + rt.metrics.EventsOut.With("routine", rt.name).Add(1) + rt.logger.Debug(fmt.Sprintf("%s produced %+v event\n", rt.name, oEvent)) + + rt.out <- oEvent } } func (rt *Routine) trySend(event Event) bool { - if !rt.isRunning() || rt.isStopping() { + rt.logger.Info(fmt.Sprintf("%s: sending %+v", rt.name, event)) + if !rt.isRunning() { return false } - - rt.logger.Info(fmt.Sprintf("%s: sending %+v", rt.name, event)) - if err, ok := event.(error); ok { - select { - case rt.errors <- err: - rt.metrics.ErrorsSent.With("routine", rt.name).Add(1) - return true - default: - rt.metrics.ErrorsShed.With("routine", rt.name).Add(1) - rt.logger.Info(fmt.Sprintf("%s: errors channel was full\n", rt.name)) - return false - } - } else { - select { - case rt.input <- event: - rt.metrics.EventsSent.With("routine", rt.name).Add(1) - return true - default: - rt.metrics.EventsShed.With("routine", rt.name).Add(1) - rt.logger.Info(fmt.Sprintf("%s: channel was full\n", rt.name)) - return false - } + err := rt.queue.Put(event) + if err != nil { + rt.metrics.EventsShed.With("routine", rt.name).Add(1) + rt.logger.Info(fmt.Sprintf("%s: trySend fail, queue was full/stopped \n", rt.name)) + return false } + rt.metrics.EventsSent.With("routine", rt.name).Add(1) + return true } func (rt *Routine) isRunning() bool { return atomic.LoadUint32(rt.running) == 1 } -func (rt *Routine) isStopping() bool { - return atomic.LoadUint32(rt.stopping) == 1 +func (rt *Routine) next() chan Event { + return rt.out } func (rt *Routine) ready() chan struct{} { return rt.rdy } -func (rt *Routine) next() chan Event { - return rt.out -} - func (rt *Routine) stop() { if !rt.isRunning() { return } rt.logger.Info(fmt.Sprintf("%s: stop\n", rt.name)) - stopping := atomic.CompareAndSwapUint32(rt.stopping, uint32(0), uint32(1)) - if !stopping { - panic("Routine has already stopped") - } - - close(rt.input) - close(rt.errors) - <-rt.stopped + rt.queue.Dispose() // this should block until all queue items are free? } func (rt *Routine) final() chan error { return rt.fin } +// XXX: Maybe get rid of this func (rt *Routine) terminate(reason error) { - stopped := atomic.CompareAndSwapUint32(rt.running, uint32(1), uint32(0)) - if !stopped { - panic("called stop but already stopped") - } + close(rt.out) rt.fin <- reason } diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go index 8de36e275..38bff1fcf 100644 --- a/blockchain/v2/routine_test.go +++ b/blockchain/v2/routine_test.go @@ -9,47 +9,47 @@ import ( "github.com/tendermint/tendermint/libs/log" ) -type eventA struct{} -type eventB struct{} -type errEvent struct{} +type eventA struct { + priorityNormal +} var done = fmt.Errorf("done") -func simpleHandler(event Event) (Events, error) { +func simpleHandler(event Event) (Event, error) { switch event.(type) { case eventA: - return Events{eventB{}}, nil - case eventB: - return Events{}, done + return noOp, done } - return Events{}, nil + return noOp, nil } -func TestRoutine(t *testing.T) { +func TestRoutineFinal(t *testing.T) { routine := newRoutine("simpleRoutine", simpleHandler) assert.False(t, routine.isRunning(), "expected an initialized routine to not be running") go routine.start() - go routine.feedback() <-routine.ready() + assert.True(t, routine.isRunning(), + "expected an started routine") assert.True(t, routine.trySend(eventA{}), "expected sending to a ready routine to succeed") assert.Equal(t, done, <-routine.final(), "expected the final event to be done") + + assert.False(t, routine.isRunning(), + "expected an completed routine to no longer be running") } -func TestRoutineSend(t *testing.T) { +func TestRoutineStop(t *testing.T) { routine := newRoutine("simpleRoutine", simpleHandler) assert.False(t, routine.trySend(eventA{}), "expected sending to an unstarted routine to fail") go routine.start() - - go routine.feedback() <-routine.ready() assert.True(t, routine.trySend(eventA{}), @@ -71,20 +71,22 @@ func (f finalCount) Error() string { func genStatefulHandler(maxCount int) handleFunc { counter := 0 - return func(event Event) (Events, error) { - // golint fixme - switch event.(type) { - case eventA: + return func(event Event) (Event, error) { + if _, ok := event.(eventA); ok { counter += 1 if counter >= maxCount { - return Events{}, finalCount{counter} + return noOp, finalCount{counter} } - return Events{eventA{}}, nil - case eventB: - return Events{}, nil + return eventA{}, nil } - return Events{}, nil + return noOp, nil + } +} + +func feedback(r *Routine) { + for event := range r.next() { + r.trySend(event) } } @@ -95,16 +97,14 @@ func TestStatefulRoutine(t *testing.T) { routine.setLogger(log.TestingLogger()) go routine.start() - go routine.feedback() - + go feedback(routine) <-routine.ready() assert.True(t, routine.trySend(eventA{}), "expected sending to a started routine to succeed") final := <-routine.final() - fnl, ok := final.(finalCount) - if ok { + if fnl, ok := final.(finalCount); ok { assert.Equal(t, count, fnl.count, "expected the routine to count to 10") } else { @@ -112,28 +112,38 @@ func TestStatefulRoutine(t *testing.T) { } } -func handleWithErrors(event Event) (Events, error) { +type lowPriorityEvent struct { + priorityLow +} + +type highPriorityEvent struct { + priorityHigh +} + +func handleWithPriority(event Event) (Event, error) { switch event.(type) { - case eventA: - return Events{}, nil - case errEvent: - return Events{}, done + case lowPriorityEvent: + return noOp, nil + case highPriorityEvent: + return noOp, done } - return Events{}, nil + return noOp, nil } -func TestErrorSaturation(t *testing.T) { - routine := newRoutine("errorRoutine", handleWithErrors) +func TestPriority(t *testing.T) { + // XXX: align with buffer size + routine := newRoutine("priorityRoutine", handleWithPriority) go routine.start() <-routine.ready() go func() { for { - routine.trySend(eventA{}) - time.Sleep(10 * time.Millisecond) + routine.trySend(lowPriorityEvent{}) + time.Sleep(1 * time.Millisecond) } }() + time.Sleep(10 * time.Millisecond) - assert.True(t, routine.trySend(errEvent{}), + assert.True(t, routine.trySend(highPriorityEvent{}), "expected send to succeed even when saturated") assert.Equal(t, done, <-routine.final()) diff --git a/blockchain/v2/types.go b/blockchain/v2/types.go index dbde352a3..836e87fd8 100644 --- a/blockchain/v2/types.go +++ b/blockchain/v2/types.go @@ -1,4 +1,64 @@ package v2 -type Event interface{} -type Events []Event +import ( + "github.com/Workiva/go-datastructures/queue" +) + +type Event queue.Item + +type priority interface { + Compare(other queue.Item) int + Priority() int +} + +type priorityLow struct{} +type priorityNormal struct{} +type priorityHigh struct{} + +func (p priorityLow) Priority() int { + return 1 +} + +func (p priorityNormal) Priority() int { + return 2 +} + +func (p priorityHigh) Priority() int { + return 3 +} + +func (p priorityLow) Compare(other queue.Item) int { + op := other.(priority) + if p.Priority() > op.Priority() { + return 1 + } else if p.Priority() == op.Priority() { + return 0 + } + return -1 +} + +func (p priorityNormal) Compare(other queue.Item) int { + op := other.(priority) + if p.Priority() > op.Priority() { + return 1 + } else if p.Priority() == op.Priority() { + return 0 + } + return -1 +} + +func (p priorityHigh) Compare(other queue.Item) int { + op := other.(priority) + if p.Priority() > op.Priority() { + return 1 + } else if p.Priority() == op.Priority() { + return 0 + } + return -1 +} + +type noOpEvent struct { + priorityLow +} + +var noOp = noOpEvent{} diff --git a/go.mod b/go.mod index ffa305e38..1bf4f0277 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.12 require ( github.com/VividCortex/gohistogram v1.0.0 // indirect + github.com/Workiva/go-datastructures v1.0.50 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a diff --git a/go.sum b/go.sum index c6d506f0b..a8a72a82d 100644 --- a/go.sum +++ b/go.sum @@ -3,6 +3,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.50 h1:slDmfW6KCHcC7U+LP3DDBbm4fqTwZGn1beOFPfGaLvo= +github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= From 9f80c8e1c52fb614247842d586d4c0742b6bcbbc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2019 20:08:50 +0400 Subject: [PATCH 38/63] deps: bump google.golang.org/grpc from 1.23.0 to 1.23.1 (#3982) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.23.0 to 1.23.1. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.23.0...v1.23.1) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index fcf26e426..12393ae5d 100644 --- a/go.mod +++ b/go.mod @@ -28,5 +28,5 @@ require ( github.com/tendermint/tm-db v0.1.1 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 golang.org/x/net v0.0.0-20190628185345-da137c7871d7 - google.golang.org/grpc v1.23.0 + google.golang.org/grpc v1.23.1 ) diff --git a/go.sum b/go.sum index b0379c79c..766d1a64e 100644 --- a/go.sum +++ b/go.sum @@ -234,6 +234,8 @@ google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw= google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1 h1:q4XQuHFC6I28BKZpo6IYyb3mNO+l7lSOxRuYTCiDfXk= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From c62b7fbd7e97cdafd343e6949903e8b4eecae4a1 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Thu, 12 Sep 2019 12:50:25 -0400 Subject: [PATCH 39/63] feedback tweaks --- blockchain/v2/routine.go | 6 +++--- blockchain/v2/routine_test.go | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index eaaa68cf0..9c5b97b18 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -23,12 +23,12 @@ type handleFunc = func(event Event) (Event, error) // sent events and produce `last()` event representing the terminal state. type Routine struct { name string + handle handleFunc queue *queue.PriorityQueue - out chan Event // XXX: actually item + out chan Event fin chan error rdy chan struct{} running *uint32 - handle handleFunc logger log.Logger metrics *Metrics } @@ -38,8 +38,8 @@ var queueSize int = 10 func newRoutine(name string, handleFunc handleFunc) *Routine { return &Routine{ name: name, - queue: queue.NewPriorityQueue(queueSize, true), handle: handleFunc, + queue: queue.NewPriorityQueue(queueSize, true), out: make(chan Event, queueSize), rdy: make(chan struct{}, 1), fin: make(chan error, 1), diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go index 38bff1fcf..6fa8bde32 100644 --- a/blockchain/v2/routine_test.go +++ b/blockchain/v2/routine_test.go @@ -143,8 +143,12 @@ func TestPriority(t *testing.T) { }() time.Sleep(10 * time.Millisecond) + assert.True(t, routine.isRunning(), + "expected an started routine") assert.True(t, routine.trySend(highPriorityEvent{}), "expected send to succeed even when saturated") assert.Equal(t, done, <-routine.final()) + assert.False(t, routine.isRunning(), + "expected an started routine") } From 7e0b64e8b0842d2f13c2b24feed13ec187be10f5 Mon Sep 17 00:00:00 2001 From: Tess Rinearson Date: Thu, 12 Sep 2019 14:59:41 -0700 Subject: [PATCH 40/63] types: add test for block commits with votes for the wrong blockID (#3936) * types: add test for block commits with votes for the wrong blockID * remove * respond to feedback * verify the commits as well * testing table * Update types/block_test.go Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com> * Update types/block_test.go Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com> * gofmt * test panic case --- types/block_test.go | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/types/block_test.go b/types/block_test.go index 71c6e9ea0..1bf2a15ff 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -15,6 +15,7 @@ import ( "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/tmhash" cmn "github.com/tendermint/tendermint/libs/common" + tmtime "github.com/tendermint/tendermint/types/time" "github.com/tendermint/tendermint/version" ) @@ -372,6 +373,63 @@ func TestCommitToVoteSet(t *testing.T) { } } +func TestCommitToVoteSetWithVotesForAnotherBlockOrNilBlock(t *testing.T) { + blockID := makeBlockID([]byte("blockhash"), 1000, []byte("partshash")) + blockID2 := makeBlockID([]byte("blockhash2"), 1000, []byte("partshash")) + blockID3 := makeBlockID([]byte("blockhash3"), 10000, []byte("partshash")) + + height := int64(3) + round := 1 + + type commitVoteTest struct { + blockIDs []BlockID + numVotes []int // must sum to numValidators + numValidators int + valid bool + } + + testCases := []commitVoteTest{ + {[]BlockID{blockID, blockID2, blockID3}, []int{8, 1, 1}, 10, true}, + {[]BlockID{blockID, blockID2, blockID3}, []int{67, 20, 13}, 100, true}, + {[]BlockID{blockID, blockID2, blockID3}, []int{1, 1, 1}, 3, false}, + {[]BlockID{blockID, blockID2, blockID3}, []int{3, 1, 1}, 5, false}, + {[]BlockID{blockID, {}}, []int{67, 33}, 100, true}, + {[]BlockID{blockID, blockID2, {}}, []int{10, 5, 5}, 20, false}, + } + + for _, tc := range testCases { + voteSet, valSet, vals := randVoteSet(height-1, 1, PrecommitType, tc.numValidators, 1) + + vi := 0 + for n := range tc.blockIDs { + for i := 0; i < tc.numVotes[n]; i++ { + addr := vals[vi].GetPubKey().Address() + vote := &Vote{ + ValidatorAddress: addr, + ValidatorIndex: vi, + Height: height - 1, + Round: round, + Type: PrecommitType, + BlockID: tc.blockIDs[n], + Timestamp: tmtime.Now(), + } + + _, err := signAddVote(vals[vi], vote, voteSet) + assert.NoError(t, err) + vi++ + } + } + if tc.valid { + commit := voteSet.MakeCommit() // panics without > 2/3 valid votes + assert.NotNil(t, commit) + err := valSet.VerifyCommit(voteSet.ChainID(), blockID, height-1, commit) + assert.Nil(t, err) + } else { + assert.Panics(t, func() { voteSet.MakeCommit() }) + } + } +} + func TestSignedHeaderValidateBasic(t *testing.T) { commit := randCommit() chainID := "𠜎" From e7ee314c99830f0cc0cebe6d2415d05fe32ceb2e Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Fri, 13 Sep 2019 11:33:38 -0400 Subject: [PATCH 41/63] Subsume the demuxer into the reactor + Simplify the design by demuxing events directly in the reactor --- blockchain/v2/demuxer.go | 164 ---------------------------------- blockchain/v2/reactor.go | 75 ++++++++++------ blockchain/v2/reactor_test.go | 12 ++- blockchain/v2/routine.go | 2 +- 4 files changed, 57 insertions(+), 196 deletions(-) delete mode 100644 blockchain/v2/demuxer.go diff --git a/blockchain/v2/demuxer.go b/blockchain/v2/demuxer.go deleted file mode 100644 index 5ebb54633..000000000 --- a/blockchain/v2/demuxer.go +++ /dev/null @@ -1,164 +0,0 @@ -// nolint:unused -package v2 - -import ( - "fmt" - "sync/atomic" - - "github.com/tendermint/tendermint/libs/log" -) - -type scFull struct { - priorityHigh -} -type pcFull struct { - priorityHigh -} - -const demuxerBufferSize = 10 - -type demuxer struct { - input chan Event - scheduler *Routine - processor *Routine - fin chan error - stopped chan struct{} - rdy chan struct{} - running *uint32 - stopping *uint32 - logger log.Logger -} - -func newDemuxer(scheduler *Routine, processor *Routine) *demuxer { - return &demuxer{ - input: make(chan Event, demuxerBufferSize), - scheduler: scheduler, - processor: processor, - stopped: make(chan struct{}, 1), - fin: make(chan error, 1), - rdy: make(chan struct{}, 1), - running: new(uint32), - stopping: new(uint32), - logger: log.NewNopLogger(), - } -} - -func (dm *demuxer) setLogger(logger log.Logger) { - dm.logger = logger -} - -func (dm *demuxer) start() { - starting := atomic.CompareAndSwapUint32(dm.running, uint32(0), uint32(1)) - if !starting { - panic("Routine has already started") - } - dm.logger.Info("demuxer: run") - dm.rdy <- struct{}{} - for { - if !dm.isRunning() { - break - } - select { - case event, ok := <-dm.input: - if !ok { - dm.logger.Info("demuxer: stopping") - dm.terminate(fmt.Errorf("stopped")) - dm.stopped <- struct{}{} - return - } - oEvent, err := dm.handle(event) - if err != nil { - dm.terminate(err) - return - } - dm.input <- oEvent - case event, ok := <-dm.scheduler.next(): - if !ok { - dm.logger.Info("demuxer: scheduler output closed") - continue - } - oEvent, err := dm.handle(event) - if err != nil { - dm.terminate(err) - return - } - dm.input <- oEvent - case event, ok := <-dm.processor.next(): - if !ok { - dm.logger.Info("demuxer: processor output closed") - continue - } - oEvent, err := dm.handle(event) - if err != nil { - dm.terminate(err) - return - } - dm.input <- oEvent - } - } -} - -func (dm *demuxer) handle(event Event) (Event, error) { - received := dm.scheduler.trySend(event) - if !received { - return scFull{}, nil // backpressure - } - - received = dm.processor.trySend(event) - if !received { - return pcFull{}, nil // backpressure - } - - return noOp, nil -} - -func (dm *demuxer) trySend(event Event) bool { - if !dm.isRunning() || dm.isStopping() { - dm.logger.Info("dummuxer isn't running") - return false - } - select { - case dm.input <- event: - return true - default: - dm.logger.Info("demuxer channel was full") - return false - } -} - -func (dm *demuxer) isRunning() bool { - return atomic.LoadUint32(dm.running) == 1 -} - -func (dm *demuxer) isStopping() bool { - return atomic.LoadUint32(dm.stopping) == 1 -} - -func (dm *demuxer) ready() chan struct{} { - return dm.rdy -} - -func (dm *demuxer) stop() { - if !dm.isRunning() { - return - } - stopping := atomic.CompareAndSwapUint32(dm.stopping, uint32(0), uint32(1)) - if !stopping { - panic("Demuxer has already stopped") - } - dm.logger.Info("demuxer stop") - close(dm.input) - <-dm.stopped -} - -func (dm *demuxer) terminate(reason error) { - stopped := atomic.CompareAndSwapUint32(dm.running, uint32(1), uint32(0)) - if !stopped { - panic("called terminate but already terminated") - } - dm.fin <- reason -} - -func (dm *demuxer) final() chan error { - return dm.fin -} diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 64deb5ce8..cba3f5857 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -16,8 +16,6 @@ func schedulerHandle(event Event) (Event, error) { switch event.(type) { case timeCheck: fmt.Println("scheduler handle timeCheck") - case Event: - fmt.Println("scheduler handle testEvent") } return noOp, nil } @@ -26,71 +24,94 @@ func processorHandle(event Event) (Event, error) { switch event.(type) { case timeCheck: fmt.Println("processor handle timeCheck") - case Event: - fmt.Println("processor handle event") } return noOp, nil + } type Reactor struct { - demuxer *demuxer + events chan Event + stopDemux chan struct{} scheduler *Routine processor *Routine ticker *time.Ticker + logger log.Logger +} + +var bufferSize int = 10 + +func NewReactor() *Reactor { + return &Reactor{ + events: make(chan Event, bufferSize), + stopDemux: make(chan struct{}), + scheduler: newRoutine("scheduler", schedulerHandle), + processor: newRoutine("processor", processorHandle), + ticker: time.NewTicker(1 * time.Second), + logger: log.NewNopLogger(), + } } // nolint:unused func (r *Reactor) setLogger(logger log.Logger) { + r.logger = logger r.scheduler.setLogger(logger) r.processor.setLogger(logger) - r.demuxer.setLogger(logger) } func (r *Reactor) Start() { - r.scheduler = newRoutine("scheduler", schedulerHandle) - r.processor = newRoutine("processor", processorHandle) - r.demuxer = newDemuxer(r.scheduler, r.processor) - r.ticker = time.NewTicker(1 * time.Second) - go r.scheduler.start() go r.processor.start() - go r.demuxer.start() + go r.demux() <-r.scheduler.ready() <-r.processor.ready() - <-r.demuxer.ready() go func() { for t := range r.ticker.C { - r.demuxer.trySend(timeCheck{time: t}) + r.events <- timeCheck{time: t} } }() } -func (r *Reactor) Wait() { - fmt.Println("completed routines") - r.Stop() +func (r *Reactor) demux() { + for { + select { + case event := <-r.events: + + // XXX: check for backpressure + r.scheduler.trySend(event) + r.processor.trySend(event) + case _ = <-r.stopDemux: + r.logger.Info("demuxing stopped") + return + case event := <-r.scheduler.next(): + r.events <- event + case event := <-r.processor.next(): + r.events <- event + case err := <-r.scheduler.final(): + r.logger.Info(fmt.Sprintf("scheduler final %s", err)) + case err := <-r.processor.final(): + r.logger.Info(fmt.Sprintf("processor final %s", err)) + // XXX: switch to consensus + } + } } func (r *Reactor) Stop() { - fmt.Println("reactor stopping") + r.logger.Info("reactor stopping") r.ticker.Stop() - r.demuxer.stop() r.scheduler.stop() r.processor.stop() - // todo: accumulator - // todo: io + close(r.stopDemux) + close(r.events) - fmt.Println("reactor stopped") + r.logger.Info("reactor stopped") } func (r *Reactor) Receive(event Event) { - fmt.Println("receive event") - sent := r.demuxer.trySend(event) - if !sent { - fmt.Println("demuxer is full") - } + // XXX: decode and serialize write events + r.events <- event } func (r *Reactor) AddPeer() { diff --git a/blockchain/v2/reactor_test.go b/blockchain/v2/reactor_test.go index 2b3e2be1e..e14e618de 100644 --- a/blockchain/v2/reactor_test.go +++ b/blockchain/v2/reactor_test.go @@ -1,11 +1,15 @@ package v2 -import "testing" +import ( + "testing" + + "github.com/tendermint/tendermint/libs/log" +) -// XXX: This makes assumptions about the message routing func TestReactor(t *testing.T) { - reactor := Reactor{} + reactor := NewReactor() reactor.Start() + reactor.setLogger(log.TestingLogger()) script := []Event{ // TODO } @@ -13,5 +17,5 @@ func TestReactor(t *testing.T) { for _, event := range script { reactor.Receive(event) } - reactor.Wait() + reactor.Stop() } diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index 9c5b97b18..04cd43c63 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -20,7 +20,7 @@ type handleFunc = func(event Event) (Event, error) // handles the concurrency and messaging guarantees. Events are sent via // `trySend` are handled by the `handle` function to produce an iterator // `next()`. Calling `close()` on a routine will conclude processing of all -// sent events and produce `last()` event representing the terminal state. +// sent events and produce `final()` event representing the terminal state. type Routine struct { name string handle handleFunc From 21d46dea93167ec6d4d3c88da985c8ce9dfeef95 Mon Sep 17 00:00:00 2001 From: Marko Date: Fri, 13 Sep 2019 18:52:35 +0200 Subject: [PATCH 42/63] Update Makefile (#3949) * Update makefile - these two files were taken from the sdk with adjustments for usage in TM Signed-off-by: Marko Baricevic * .phony * remove slate * more tools * circleci update 1/2 * fixed typo * fixed bash error * '<<' must be escaped in 2.1 * fixed invalid config * removed golangci-lint from tools. runs as github app now * one more issue in Circle config * some more work on the Circle config * minor changes * fiddling with restore cache config * fiddling with restore cache config * added commands in circle config. makefile changes * bash shenannigans * bash shenannigans * fighting the config demons * fighting the config demons, v2 * fighting the config demons, v3 * updating p2p dockerfile * updating p2p dockerfile * updating p2p test * updating p2p test * testing circle config * testing circle config * remove dontcover command * its the weekend, custom docker image --- .circleci/config.yml | 255 ++++++++++++++++--------------- Makefile | 152 ++++-------------- abci/tests/test_app/test.sh | 3 +- abci/tests/test_cli/test.sh | 1 + scripts/devtools/Makefile | 92 +++++++++++ scripts/get_tools.sh | 73 --------- scripts/install-golangci-lint.sh | 27 ++++ test/docker/Dockerfile | 4 +- tests.mk | 106 +++++++++++++ 9 files changed, 385 insertions(+), 328 deletions(-) create mode 100644 scripts/devtools/Makefile delete mode 100755 scripts/get_tools.sh create mode 100644 scripts/install-golangci-lint.sh create mode 100644 tests.mk diff --git a/.circleci/config.yml b/.circleci/config.yml index be2d9690b..babba409d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,136 +1,126 @@ -version: 2 +version: 2.1 -defaults: &defaults - working_directory: /go/src/github.com/tendermint/tendermint - docker: - - image: circleci/golang - environment: - GOBIN: /tmp/workspace/bin - -docs_update_config: &docs_update_config - working_directory: ~/repo - docker: - - image: tendermintdev/jq_curl - environment: - AWS_REGION: us-east-1 +executors: + golang: + docker: + - image: tendermintdev/docker-tendermint-build + working_directory: /go/src/github.com/tendermint/tendermint + environment: + GOBIN: /tmp/bin + release: + machine: true + docs: + docker: + - image: tendermintdev/jq_curl + environment: + AWS_REGION: us-east-1 -release_management_docker: &release_management_docker - machine: true +commands: + run_test: + parameters: + script_path: + type: string + steps: + - attach_workspace: + at: /tmp/bin + - restore_cache: + name: "Restore source code cache" + keys: + - go-src-v1-{{ .Revision }} + - checkout + - restore_cache: + name: "Restore go modules cache" + keys: + - go-mod-v1-{{ checksum "go.sum" }} + - run: + name: "Running test" + command: | + bash << parameters.script_path >> jobs: setup_dependencies: - <<: *defaults + executor: golang steps: - - run: mkdir -p /tmp/workspace/bin - - run: mkdir -p /tmp/workspace/profiles - checkout - restore_cache: + name: "Restore go modules cache" keys: - - v4-pkg-cache + - go-mod-v1-{{ checksum "go.sum" }} - run: - name: tools command: | - export PATH="$GOBIN:$PATH" - make get_tools + mkdir -p /tmp/bin - run: - name: binaries - command: | - export PATH="$GOBIN:$PATH" - make install install_abci - - persist_to_workspace: - root: /tmp/workspace - paths: - - bin - - profiles + name: Cache go modules + command: make go-mod-cache + - run: + name: tools + command: make tools + - run: + name: "Build binaries" + command: make install install_abci - save_cache: - key: v4-pkg-cache + name: "Save go modules cache" + key: go-mod-v1-{{ checksum "go.sum" }} paths: - - /go/pkg + - "/go/pkg/mod" - save_cache: - key: v3-tree-{{ .Environment.CIRCLE_SHA1 }} + name: "Save source code cache" + key: go-src-v1-{{ .Revision }} paths: - - /go/src/github.com/tendermint/tendermint - - build_slate: - <<: *defaults - steps: - - attach_workspace: - at: /tmp/workspace - - restore_cache: - key: v4-pkg-cache - - restore_cache: - key: v3-tree-{{ .Environment.CIRCLE_SHA1 }} - - run: - name: slate docs - command: | - set -ex - export PATH="$GOBIN:$PATH" - make build-slate + - ".git" + - persist_to_workspace: + root: "/tmp/bin" + paths: + - "." test_abci_apps: - <<: *defaults + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - restore_cache: - key: v4-pkg-cache - - restore_cache: - key: v3-tree-{{ .Environment.CIRCLE_SHA1 }} - - run: - name: Run abci apps tests - command: | - export PATH="$GOBIN:$PATH" - bash abci/tests/test_app/test.sh + - run_test: + script_path: abci/tests/test_app/test.sh # if this test fails, fix it and update the docs at: # https://github.com/tendermint/tendermint/blob/develop/docs/abci-cli.md test_abci_cli: - <<: *defaults + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - restore_cache: - key: v4-pkg-cache - - restore_cache: - key: v3-tree-{{ .Environment.CIRCLE_SHA1 }} - - run: - name: Run abci-cli tests - command: | - export PATH="$GOBIN:$PATH" - bash abci/tests/test_cli/test.sh + - run_test: + script_path: abci/tests/test_cli/test.sh test_apps: - <<: *defaults + executor: golang steps: - - attach_workspace: - at: /tmp/workspace - - restore_cache: - key: v4-pkg-cache - - restore_cache: - key: v3-tree-{{ .Environment.CIRCLE_SHA1 }} - - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends bsdmainutils - - run: - name: Run tests - command: bash test/app/test.sh + - run_test: + script_path: test/app/test.sh + + test_persistence: + executor: golang + steps: + - run_test: + script_path: test/persist/test_failure_indices.sh test_cover: - <<: *defaults + executor: golang parallelism: 4 steps: - - attach_workspace: - at: /tmp/workspace - restore_cache: - key: v4-pkg-cache + name: "Restore source code cache" + keys: + - go-src-v1-{{ .Revision }} + - checkout - restore_cache: - key: v3-tree-{{ .Environment.CIRCLE_SHA1 }} - - run: mkdir -p /tmp/logs + name: "Restore go module cache" + keys: + - go-mod-v2-{{ checksum "go.sum" }} - run: - name: Run tests + name: "Run tests" command: | + export VERSION="$(git describe --tags --long | sed 's/v\(.*\)/\1/')" + export GO111MODULE=on + mkdir -p /tmp/logs /tmp/workspace/profiles for pkg in $(go list github.com/tendermint/tendermint/... | circleci tests split --split-by=timings); do id=$(basename "$pkg") - - GO111MODULE=on go test -v -timeout 5m -mod=readonly -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg" | tee "/tmp/logs/$id-$RANDOM.log" + go test -v -timeout 5m -mod=readonly -race -coverprofile=/tmp/workspace/profiles/$id.out -covermode=atomic "$pkg" | tee "/tmp/logs/$id-$RANDOM.log" done - persist_to_workspace: root: /tmp/workspace @@ -139,19 +129,6 @@ jobs: - store_artifacts: path: /tmp/logs - test_persistence: - <<: *defaults - steps: - - attach_workspace: - at: /tmp/workspace - - restore_cache: - key: v4-pkg-cache - - restore_cache: - key: v3-tree-{{ .Environment.CIRCLE_SHA1 }} - - run: - name: Run tests - command: bash test/persist/test_failure_indices.sh - localnet: working_directory: /home/circleci/.go_workspace/src/github.com/tendermint/tendermint machine: @@ -187,19 +164,22 @@ jobs: path: /home/circleci/project/test/p2p/logs upload_coverage: - <<: *defaults + executor: golang steps: - attach_workspace: at: /tmp/workspace - restore_cache: - key: v4-pkg-cache + name: "Restore source code cache" + keys: + - go-src-v1-{{ .Revision }} + - checkout - restore_cache: - key: v3-tree-{{ .Environment.CIRCLE_SHA1 }} + name: "Restore go module cache" + keys: + - go-mod-v2-{{ checksum "go.sum" }} - run: name: gather command: | - set -ex - echo "mode: atomic" > coverage.txt for prof in $(ls /tmp/workspace/profiles/); do tail -n +2 /tmp/workspace/profiles/"$prof" >> coverage.txt @@ -209,8 +189,12 @@ jobs: command: bash .circleci/codecov.sh -f coverage.txt deploy_docs: - <<: *docs_update_config + executor: docs steps: + - restore_cache: + name: "Restore source code cache" + keys: + - go-src-v1-{{ .Revision }} - checkout - run: name: Trigger website build @@ -233,8 +217,12 @@ jobs: fi prepare_build: - <<: *defaults + executor: golang steps: + - restore_cache: + name: "Restore source code cache" + keys: + - go-src-v1-{{ .Revision }} - checkout - run: name: Get next release number @@ -250,8 +238,7 @@ jobs: echo "export CIRCLE_TAG=\"${NEXT_TAG}\"" > release-version.source - run: name: Build dependencies - command: | - make get_tools + command: make tools - persist_to_workspace: root: . paths: @@ -262,11 +249,16 @@ jobs: - "/go/pkg/mod" build_artifacts: - <<: *defaults + executor: golang parallelism: 4 steps: + - restore_cache: + name: "Restore source code cache" + keys: + - go-src-v1-{{ .Revision }} - checkout - restore_cache: + name: "Restore release dependencies cache" keys: - v2-release-deps-{{ checksum "go.sum" }} - attach_workspace: @@ -287,13 +279,17 @@ jobs: - "tendermint_linux_amd64" release_artifacts: - <<: *defaults + executor: golang steps: + - restore_cache: + name: "Restore source code cache" + keys: + - go-src-v1-{{ .Revision }} - checkout - attach_workspace: at: /tmp/workspace - run: - name: Deploy to GitHub + name: "Deploy to GitHub" command: | # Setting CIRCLE_TAG because we do not tag the release ourselves. source /tmp/workspace/release-version.source @@ -315,27 +311,36 @@ jobs: python -u scripts/release_management/github-publish.py --id "${RELEASE_ID}" release_docker: - <<: *release_management_docker + machine: + image: ubuntu-1604:201903-01 steps: + - restore_cache: + name: "Restore source code cache" + keys: + - go-src-v1-{{ .Revision }} - checkout - attach_workspace: at: /tmp/workspace - run: - name: Deploy to Docker Hub + name: "Deploy to Docker Hub" command: | # Setting CIRCLE_TAG because we do not tag the release ourselves. source /tmp/workspace/release-version.source cp /tmp/workspace/tendermint_linux_amd64 DOCKER/tendermint docker build --label="tendermint" --tag="tendermint/tendermint:${CIRCLE_TAG}" --tag="tendermint/tendermint:latest" "DOCKER" - docker login -u "${DOCKERHUB_USER}" --password-stdin <<< "${DOCKERHUB_PASS}" + docker login -u "${DOCKERHUB_USER}" --password-stdin \<<< "${DOCKERHUB_PASS}" docker push "tendermint/tendermint" docker logout reproducible_builds: - <<: *defaults + executor: golang steps: - attach_workspace: at: /tmp/workspace + - restore_cache: + name: "Restore source code cache" + keys: + - go-src-v1-{{ .Revision }} - checkout - setup_remote_docker: docker_layer_caching: true diff --git a/Makefile b/Makefile index 03a88a853..6870258f6 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,6 @@ GOBIN?=${GOPATH}/bin PACKAGES=$(shell go list ./...) OUTPUT?=build/tendermint -export GO111MODULE = on - INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf BUILD_TAGS?='tendermint' LD_FLAGS = -X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short=8 HEAD` -s -w @@ -16,7 +14,9 @@ BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)" all: check build test install -check: check_tools +# The below include contains the tools. +include scripts/devtools/Makefile +include tests.mk ######################################## ### Build Tendermint @@ -27,13 +27,6 @@ build: build_c: CGO_ENABLED=1 go build $(BUILD_FLAGS) -tags "$(BUILD_TAGS) cleveldb" -o $(OUTPUT) ./cmd/tendermint/ -# Runs `make build_c` from within an Amazon Linux (v2)-based Docker build -# container in order to build an Amazon Linux-compatible binary. Produces a -# compatible binary at ./build/tendermint -build_c-amazonlinux: - $(MAKE) -C ./DOCKER build_amazonlinux_buildimage - docker run --rm -it -v `pwd`:/tendermint tendermint/tendermint:build_c-amazonlinux - build_race: CGO_ENABLED=1 go build -race $(BUILD_FLAGS) -tags $(BUILD_TAGS) -o $(OUTPUT) ./cmd/tendermint @@ -78,22 +71,6 @@ install_abci: dist: @BUILD_TAGS=$(BUILD_TAGS) sh -c "'$(CURDIR)/scripts/dist.sh'" -######################################## -### Tools & dependencies - -check_tools: - @# https://stackoverflow.com/a/25668869 - @echo "Found tools: $(foreach tool,$(notdir $(GOTOOLS)),\ - $(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))" - -get_tools: - @echo "--> Installing tools" - ./scripts/get_tools.sh - -update_tools: - @echo "--> Updating tools" - ./scripts/get_tools.sh - #For ABCI and libs get_protoc: @# https://github.com/google/protobuf/releases @@ -107,6 +84,16 @@ get_protoc: cd .. && \ rm -rf protobuf-3.6.1 +go-mod-cache: go.sum + @echo "--> Download go modules to local cache" + @go mod download +.PHONY: go-mod-cache + +go.sum: go.mod + @echo "--> Ensure dependencies have not been modified" + @go mod verify + @go mod tidy + draw_deps: @# requires brew install graphviz or apt-get install graphviz go get github.com/RobotsAndPencils/goviz @@ -153,100 +140,6 @@ protoc_grpc: rpc/grpc/types.pb.go protoc_merkle: crypto/merkle/merkle.pb.go -######################################## -### Testing - -## required to be run first by most tests -build_docker_test_image: - docker build -t tester -f ./test/docker/Dockerfile . - -### coverage, app, persistence, and libs tests -test_cover: - # run the go unit tests with coverage - bash test/test_cover.sh - -test_apps: - # run the app tests using bash - # requires `abci-cli` and `tendermint` binaries installed - bash test/app/test.sh - -test_abci_apps: - bash abci/tests/test_app/test.sh - -test_abci_cli: - # test the cli against the examples in the tutorial at: - # ./docs/abci-cli.md - # if test fails, update the docs ^ - @ bash abci/tests/test_cli/test.sh - -test_persistence: - # run the persistence tests using bash - # requires `abci-cli` installed - docker run --name run_persistence -t tester bash test/persist/test_failure_indices.sh - - # TODO undockerize - # bash test/persist/test_failure_indices.sh - -test_p2p: - docker rm -f rsyslog || true - rm -rf test/logs || true - mkdir test/logs - cd test/ - docker run -d -v "logs:/var/log/" -p 127.0.0.1:5514:514/udp --name rsyslog voxxit/rsyslog - cd .. - # requires 'tester' the image from above - bash test/p2p/test.sh tester - # the `docker cp` takes a really long time; uncomment for debugging - # - # mkdir -p test/p2p/logs && docker cp rsyslog:/var/log test/p2p/logs - -test_integrations: - make build_docker_test_image - make get_tools - make install - make test_cover - make test_apps - make test_abci_apps - make test_abci_cli - make test_libs - make test_persistence - make test_p2p - -test_release: - @go test -tags release $(PACKAGES) - -test100: - @for i in {1..100}; do make test; done - -vagrant_test: - vagrant up - vagrant ssh -c 'make test_integrations' - -### go tests -test: - @echo "--> Running go test" - @go test -p 1 $(PACKAGES) - -test_race: - @echo "--> Running go test --race" - @go test -p 1 -v -race $(PACKAGES) - -# uses https://github.com/sasha-s/go-deadlock/ to detect potential deadlocks -test_with_deadlock: - make set_with_deadlock - make test - make cleanup_after_test_with_deadlock - -set_with_deadlock: - find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/sync.RWMutex/deadlock.RWMutex/' - find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/sync.Mutex/deadlock.Mutex/' - find . -name "*.go" | grep -v "vendor/" | xargs -n 1 goimports -w - -# cleanes up after you ran test_with_deadlock -cleanup_after_test_with_deadlock: - find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/deadlock.RWMutex/sync.RWMutex/' - find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/deadlock.Mutex/sync.Mutex/' - find . -name "*.go" | grep -v "vendor/" | xargs -n 1 goimports -w ######################################## ### Formatting, linting, and vetting @@ -276,12 +169,19 @@ build-docker: ### Local testnet using docker # Build linux binary on other platforms -build-linux: get_tools +build-linux: tools GOOS=linux GOARCH=amd64 $(MAKE) build build-docker-localnode: @cd networks/local && make +# Runs `make build_c` from within an Amazon Linux (v2)-based Docker build +# container in order to build an Amazon Linux-compatible binary. Produces a +# compatible binary at ./build/tendermint +build_c-amazonlinux: + $(MAKE) -C ./DOCKER build_amazonlinux_buildimage + docker run --rm -it -v `pwd`:/tendermint tendermint/tendermint:build_c-amazonlinux + # Run a 4-node testnet locally localnet-start: localnet-stop build-docker-localnode @if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/tendermint:Z tendermint/localnode testnet --config /etc/tendermint/config-template.toml --v 4 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2; fi @@ -311,10 +211,6 @@ sentry-stop: @if [ -z "$(DO_API_TOKEN)" ]; then echo "DO_API_TOKEN environment variable not set." ; false ; fi cd networks/remote/terraform && terraform destroy -var DO_API_TOKEN="$(DO_API_TOKEN)" -var SSH_KEY_FILE="$(HOME)/.ssh/id_rsa.pub" -# meant for the CI, inspect script & adapt accordingly -build-slate: - bash scripts/slate.sh - # Build hooks for dredd, to skip or add information on some steps build-contract-tests-hooks: ifeq ($(OS),Windows_NT) @@ -334,4 +230,8 @@ contract-tests: # To avoid unintended conflicts with file names, always add to .PHONY # unless there is a reason not to. # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html -.PHONY: check build build_race build_abci dist install install_abci check_tools get_tools update_tools draw_deps get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver test_cover test_apps test_persistence test_p2p test test_race test_integrations test_release test100 vagrant_test fmt rpc-docs build-linux localnet-start localnet-stop build-docker build-docker-localnode sentry-start sentry-config sentry-stop build-slate protoc_grpc protoc_all build_c install_c test_with_deadlock cleanup_after_test_with_deadlock lint build-contract-tests-hooks contract-tests build_c-amazonlinux +.PHONY: check build build_race build_abci dist install install_abci check_tools tools update_tools draw_deps \ + get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver fmt rpc-docs build-linux localnet-start \ + localnet-stop build-docker build-docker-localnode sentry-start sentry-config sentry-stop protoc_grpc protoc_all \ + build_c install_c test_with_deadlock cleanup_after_test_with_deadlock lint build-contract-tests-hooks contract-tests \ + build_c-amazonlinux diff --git a/abci/tests/test_app/test.sh b/abci/tests/test_app/test.sh index c0bdace27..0d8301831 100755 --- a/abci/tests/test_app/test.sh +++ b/abci/tests/test_app/test.sh @@ -3,9 +3,8 @@ set -e # These tests spawn the counter app and server by execing the ABCI_APP command and run some simple client tests against it -export GO111MODULE=on - # Get the directory of where this script is. +export PATH="$GOBIN:$PATH" SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" diff --git a/abci/tests/test_cli/test.sh b/abci/tests/test_cli/test.sh index ce074f513..cc880603d 100755 --- a/abci/tests/test_cli/test.sh +++ b/abci/tests/test_cli/test.sh @@ -2,6 +2,7 @@ set -e # Get the root directory. +export PATH="$GOBIN:$PATH" SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done DIR="$( cd -P "$( dirname "$SOURCE" )/../.." && pwd )" diff --git a/scripts/devtools/Makefile b/scripts/devtools/Makefile new file mode 100644 index 000000000..1ca24bf9d --- /dev/null +++ b/scripts/devtools/Makefile @@ -0,0 +1,92 @@ +### +# Find OS and Go environment +# GO contains the Go binary +# FS contains the OS file separator +### +ifeq ($(OS),Windows_NT) + GO := $(shell where go.exe 2> NUL) + FS := "\\" +else + GO := $(shell command -v go 2> /dev/null) + FS := "/" +endif + +ifeq ($(GO),) + $(error could not find go. Is it in PATH? $(GO)) +endif + +GOPATH ?= $(shell $(GO) env GOPATH) +GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com + +### +# Functions +### + +go_get = $(if $(findstring Windows_NT,$(OS)),\ +IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS) ( mkdir $(GITHUBDIR)$(FS)$(1) ) else (cd .) &\ +IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS)$(2)$(FS) ( cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2) ) else (cd .) &\ +,\ +mkdir -p $(GITHUBDIR)$(FS)$(1) &&\ +(test ! -d $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2)) || true &&\ +)\ +cd $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && git fetch origin && git checkout -q $(3) + +mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) +mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd) + +### +# tools +### + +TOOLS_DESTDIR ?= $(GOPATH)/bin + +GOIMPORTS = $(TOOLS_DESTDIR)/goimports +CERTSTRAP = $(TOOLS_DESTDIR)/certstrap +PROTOBUF = $(TOOLS_DESTDIR)/protoc +GOX = $(TOOLS_DESTDIR)/gox +GOODMAN = $(TOOLS_DESTDIR)/goodman + +all: tools + +tools: goimports certstrap protobuf gox goodman + +check: check_tools + +check_tools: + @# https://stackoverflow.com/a/25668869 + @echo "Found tools: $(foreach tool,$(notdir $(GOTOOLS)),\ + $(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))" + +goimports: $(GOIMPORTS) +$(GOIMPORTS): + @echo "Get goimports@v0.0.0-20190628034336-212fb13d595e" + @go get golang.org/x/tools/cmd/goimports@v0.0.0-20190628034336-212fb13d595e + +certstrap: $(CERTSTRAP) +$(CERTSTRAP): + @echo "Get Certstrap" + @go get github.com/square/certstrap@338204a88c4349b1c135eac1e8c14c693ad007da + +protobuf: $(PROTOBUF) +$(PROTOBUF): + @echo "Get Protobuf" + ## protobuf v1.3.0 + @go get github.com/gogo/protobuf/protoc-gen-gogo@0ca988a254f991240804bf9821f3450d87ccbb1b + +gox: $(GOX) +$(GOX): + @echo "Get Gox" +# used to build tm-monitor & tm-bench binaries + ## gox v1.0.1 + @go get github.com/mitchellh/gox@d8caaff5a9dc98f4cfa1fcce6e7265a04689f641 + +goodman: $(GOODMAN) +$(GOODMAN): + @echo "Get Goodman" + @go get github.com/snikch/goodman/cmd/goodman@10e37e294daa3c9a90abded60ff9924bafab3888 + +tools-clean: + rm -f $(CERTSTRAP) $(GOIMPORTS) $(PROTOBUF) $(GOX) $(GOODMAN) + rm -f tools-stamp + +.PHONY: all tools tools-clean diff --git a/scripts/get_tools.sh b/scripts/get_tools.sh deleted file mode 100755 index 2adc782b8..000000000 --- a/scripts/get_tools.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash -set -e - -# This file downloads all of the binary dependencies we have, and checks out a -# specific git hash. -# -# repos it installs: -# github.com/golang/dep/cmd/dep -# github.com/gogo/protobuf/protoc-gen-gogo -# github.com/square/certstrap -# github.com/mitchellh/gox -# github.com/golangci/golangci-lint -# github.com/petermattis/goid -# github.com/sasha-s/go-deadlock -# goimports - -## check if GOPATH is set -if [ -z ${GOPATH+x} ]; then - echo "please set GOPATH (https://github.com/golang/go/wiki/SettingGOPATH)" - exit 1 -fi - -mkdir -p "$GOPATH/src/github.com" -cd "$GOPATH/src/github.com" || exit 1 - -installFromGithub() { - repo=$1 - commit=$2 - # optional - subdir=$3 - echo "--> Installing $repo ($commit)..." - if [ ! -d "$repo" ]; then - mkdir -p "$repo" - git clone "https://github.com/$repo.git" "$repo" - fi - if [ ! -z ${subdir+x} ] && [ ! -d "$repo/$subdir" ]; then - echo "ERROR: no such directory $repo/$subdir" - exit 1 - fi - pushd "$repo" && \ - git fetch origin && \ - git checkout -q "$commit" && \ - if [ ! -z ${subdir+x} ]; then cd "$subdir" || exit 1; fi && \ - go install && \ - if [ ! -z ${subdir+x} ]; then cd - || exit 1; fi && \ - popd || exit 1 - echo "--> Done" - echo "" -} - -######################## DEVELOPER TOOLS ##################################### -## protobuf v1.3.0 -installFromGithub gogo/protobuf 0ca988a254f991240804bf9821f3450d87ccbb1b protoc-gen-gogo - -installFromGithub square/certstrap 338204a88c4349b1c135eac1e8c14c693ad007da - -# used to build tm-monitor & tm-bench binaries -## gox v1.0.1 -installFromGithub mitchellh/gox d8caaff5a9dc98f4cfa1fcce6e7265a04689f641 - -## Trying to install golangci with Go 1.13 gives: -## go: github.com/go-critic/go-critic@v0.0.0-20181204210945-1df300866540: invalid pseudo-version: does not match version-control timestamp (2019-05-26T07:48:19Z) -## golangci-lint v1.17.1 -# installFromGithub golangci/golangci-lint 4ba2155996359eabd8800d1fbf3e3a9777c80490 cmd/golangci-lint - -## Trying to install golangci with Go 1.13 gives: -## go: cannot find main module, but found .git/config in /go/src/github.com/petermattis/goid -## make test_with_deadlock -## XXX: https://github.com/tendermint/tendermint/issues/3242 -# installFromGithub petermattis/goid b0b1615b78e5ee59739545bb38426383b2cda4c9 -# installFromGithub sasha-s/go-deadlock d68e2bc52ae3291765881b9056f2c1527f245f1e -# go get golang.org/x/tools/cmd/goimports -# installFromGithub snikch/goodman 10e37e294daa3c9a90abded60ff9924bafab3888 cmd/goodman diff --git a/scripts/install-golangci-lint.sh b/scripts/install-golangci-lint.sh new file mode 100644 index 000000000..b95713828 --- /dev/null +++ b/scripts/install-golangci-lint.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -euo pipefail + +f_sha256() { + local l_file + l_file=$1 + python -sBc "import hashlib;print(hashlib.sha256(open('$l_file','rb').read()).hexdigest())" +} + +installer="$(mktemp)" +trap "rm -f ${installer}" EXIT + +GOBIN="${1}" +VERSION="${2}" +HASHSUM="${3}" +CURL="$(which curl)" + +echo "Downloading golangci-lint ${VERSION} installer ..." >&2 +"${CURL}" -sfL "https://raw.githubusercontent.com/golangci/golangci-lint/${VERSION}/install.sh" > "${installer}" + +echo "Checking hashsum ..." >&2 +[ "${HASHSUM}" = "$(f_sha256 ${installer})" ] +chmod +x "${installer}" + +echo "Launching installer ..." >&2 +exec "${installer}" -d -b "${GOBIN}" "${VERSION}" diff --git a/test/docker/Dockerfile b/test/docker/Dockerfile index b39277bd9..fb5458e82 100644 --- a/test/docker/Dockerfile +++ b/test/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.12 +FROM golang:1.13 # Add testing deps for curl RUN echo 'deb http://httpredir.debian.org/debian testing main non-free contrib' >> /etc/apt/sources.list @@ -19,7 +19,7 @@ COPY . $REPO # Install the vendored dependencies # docker caching prevents reinstall on code change! -RUN make get_tools +RUN make tools # install ABCI CLI RUN make install_abci diff --git a/tests.mk b/tests.mk new file mode 100644 index 000000000..18caef496 --- /dev/null +++ b/tests.mk @@ -0,0 +1,106 @@ +#!/usr/bin/make -f + +######################################## +### Testing + +BINDIR ?= $(GOPATH)/bin + +## required to be run first by most tests +build_docker_test_image: + docker build -t tester -f ./test/docker/Dockerfile . + +### coverage, app, persistence, and libs tests +test_cover: + # run the go unit tests with coverage + bash test/test_cover.sh + +test_apps: + # run the app tests using bash + # requires `abci-cli` and `tendermint` binaries installed + bash test/app/test.sh + +test_abci_apps: + bash abci/tests/test_app/test.sh + +test_abci_cli: + # test the cli against the examples in the tutorial at: + # ./docs/abci-cli.md + # if test fails, update the docs ^ + @ bash abci/tests/test_cli/test.sh + +test_persistence: + # run the persistence tests using bash + # requires `abci-cli` installed + docker run --name run_persistence -t tester bash test/persist/test_failure_indices.sh + + # TODO undockerize + # bash test/persist/test_failure_indices.sh + +test_p2p: + docker rm -f rsyslog || true + rm -rf test/logs || true + mkdir test/logs + cd test/ + docker run -d -v "logs:/var/log/" -p 127.0.0.1:5514:514/udp --name rsyslog voxxit/rsyslog + cd .. + # requires 'tester' the image from above + bash test/p2p/test.sh tester + # the `docker cp` takes a really long time; uncomment for debugging + # + # mkdir -p test/p2p/logs && docker cp rsyslog:/var/log test/p2p/logs + +test_integrations: + make build_docker_test_image + make tools + make install + make test_cover + make test_apps + make test_abci_apps + make test_abci_cli + make test_libs + make test_persistence + make test_p2p + +test_release: + @go test -tags release $(PACKAGES) + +test100: + @for i in {1..100}; do make test; done + +vagrant_test: + vagrant up + vagrant ssh -c 'make test_integrations' + +### go tests +test: + @echo "--> Running go test" + @go test -p 1 $(PACKAGES) + +test_race: + @echo "--> Running go test --race" + @go test -p 1 -v -race $(PACKAGES) + +# uses https://github.com/sasha-s/go-deadlock/ to detect potential deadlocks +test_with_deadlock: + make set_with_deadlock + make test + make cleanup_after_test_with_deadlock + +set_with_deadlock: + @echo "Get Goid" + @go get github.com/petermattis/goid@b0b1615b78e5ee59739545bb38426383b2cda4c9 + @echo "Get Go-Deadlock" + @go get github.com/sasha-s/go-deadlock@d68e2bc52ae3291765881b9056f2c1527f245f1e + find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/sync.RWMutex/deadlock.RWMutex/' + find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/sync.Mutex/deadlock.Mutex/' + find . -name "*.go" | grep -v "vendor/" | xargs -n 1 goimports -w + +# cleanes up after you ran test_with_deadlock +cleanup_after_test_with_deadlock: + find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/deadlock.RWMutex/sync.RWMutex/' + find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/deadlock.Mutex/sync.Mutex/' + find . -name "*.go" | grep -v "vendor/" | xargs -n 1 goimports -w + # cleans up the deps to not include the need libs + go mod tidy + +.PHONY: test_cover test_apps test_persistence test_p2p test test_race test_integrations test_release test100 vagrant_test From fbede85e20c424a00f0c6bac3660a9b1e8f6b5c2 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Fri, 13 Sep 2019 18:36:02 -0400 Subject: [PATCH 43/63] changes based on feedback --- blockchain/v2/reactor.go | 7 ++++--- blockchain/v2/routine.go | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index cba3f5857..16f473276 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -73,11 +73,12 @@ func (r *Reactor) Start() { }() } +// Would it be possible here to provide some kind of type safety for the types +// of events that each routine can produce and consume? func (r *Reactor) demux() { for { select { case event := <-r.events: - // XXX: check for backpressure r.scheduler.trySend(event) r.processor.trySend(event) @@ -85,9 +86,9 @@ func (r *Reactor) demux() { r.logger.Info("demuxing stopped") return case event := <-r.scheduler.next(): - r.events <- event + r.processor.trySend(event) case event := <-r.processor.next(): - r.events <- event + r.scheduler.trySend(event) case err := <-r.scheduler.final(): r.logger.Info(fmt.Sprintf("scheduler final %s", err)) case err := <-r.processor.final(): diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index 04cd43c63..82015c618 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -92,6 +92,8 @@ func (rt *Routine) start() { } } +// XXX: rename send +// XXX: look into returning OpError in the net package func (rt *Routine) trySend(event Event) bool { rt.logger.Info(fmt.Sprintf("%s: sending %+v", rt.name, event)) if !rt.isRunning() { From 9bd2c0389f5182d4a30ac06523d229639ff51f62 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Fri, 13 Sep 2019 18:54:25 -0400 Subject: [PATCH 44/63] rename trySend to end --- blockchain/v2/reactor.go | 8 ++++---- blockchain/v2/routine.go | 7 +++---- blockchain/v2/routine_test.go | 16 ++++++++-------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 16f473276..26b2cb979 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -80,15 +80,15 @@ func (r *Reactor) demux() { select { case event := <-r.events: // XXX: check for backpressure - r.scheduler.trySend(event) - r.processor.trySend(event) + r.scheduler.send(event) + r.processor.send(event) case _ = <-r.stopDemux: r.logger.Info("demuxing stopped") return case event := <-r.scheduler.next(): - r.processor.trySend(event) + r.processor.send(event) case event := <-r.processor.next(): - r.scheduler.trySend(event) + r.scheduler.send(event) case err := <-r.scheduler.final(): r.logger.Info(fmt.Sprintf("scheduler final %s", err)) case err := <-r.processor.final(): diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index 82015c618..231da703a 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -18,7 +18,7 @@ type handleFunc = func(event Event) (Event, error) // Routines are a structure which model a finite state machine as serialized // stream of events processed by a handle function. This Routine structure // handles the concurrency and messaging guarantees. Events are sent via -// `trySend` are handled by the `handle` function to produce an iterator +// `send` are handled by the `handle` function to produce an iterator // `next()`. Calling `close()` on a routine will conclude processing of all // sent events and produce `final()` event representing the terminal state. type Routine struct { @@ -92,9 +92,8 @@ func (rt *Routine) start() { } } -// XXX: rename send // XXX: look into returning OpError in the net package -func (rt *Routine) trySend(event Event) bool { +func (rt *Routine) send(event Event) bool { rt.logger.Info(fmt.Sprintf("%s: sending %+v", rt.name, event)) if !rt.isRunning() { return false @@ -102,7 +101,7 @@ func (rt *Routine) trySend(event Event) bool { err := rt.queue.Put(event) if err != nil { rt.metrics.EventsShed.With("routine", rt.name).Add(1) - rt.logger.Info(fmt.Sprintf("%s: trySend fail, queue was full/stopped \n", rt.name)) + rt.logger.Info(fmt.Sprintf("%s: send failed, queue was full/stopped \n", rt.name)) return false } rt.metrics.EventsSent.With("routine", rt.name).Add(1) diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go index 6fa8bde32..e32394ee4 100644 --- a/blockchain/v2/routine_test.go +++ b/blockchain/v2/routine_test.go @@ -33,7 +33,7 @@ func TestRoutineFinal(t *testing.T) { assert.True(t, routine.isRunning(), "expected an started routine") - assert.True(t, routine.trySend(eventA{}), + assert.True(t, routine.send(eventA{}), "expected sending to a ready routine to succeed") assert.Equal(t, done, <-routine.final(), @@ -46,18 +46,18 @@ func TestRoutineFinal(t *testing.T) { func TestRoutineStop(t *testing.T) { routine := newRoutine("simpleRoutine", simpleHandler) - assert.False(t, routine.trySend(eventA{}), + assert.False(t, routine.send(eventA{}), "expected sending to an unstarted routine to fail") go routine.start() <-routine.ready() - assert.True(t, routine.trySend(eventA{}), + assert.True(t, routine.send(eventA{}), "expected sending to a running routine to succeed") routine.stop() - assert.False(t, routine.trySend(eventA{}), + assert.False(t, routine.send(eventA{}), "expected sending to a stopped routine to fail") } @@ -86,7 +86,7 @@ func genStatefulHandler(maxCount int) handleFunc { func feedback(r *Routine) { for event := range r.next() { - r.trySend(event) + r.send(event) } } @@ -100,7 +100,7 @@ func TestStatefulRoutine(t *testing.T) { go feedback(routine) <-routine.ready() - assert.True(t, routine.trySend(eventA{}), + assert.True(t, routine.send(eventA{}), "expected sending to a started routine to succeed") final := <-routine.final() @@ -137,7 +137,7 @@ func TestPriority(t *testing.T) { <-routine.ready() go func() { for { - routine.trySend(lowPriorityEvent{}) + routine.send(lowPriorityEvent{}) time.Sleep(1 * time.Millisecond) } }() @@ -145,7 +145,7 @@ func TestPriority(t *testing.T) { assert.True(t, routine.isRunning(), "expected an started routine") - assert.True(t, routine.trySend(highPriorityEvent{}), + assert.True(t, routine.send(highPriorityEvent{}), "expected send to succeed even when saturated") assert.Equal(t, done, <-routine.final()) From 822942a2e4ef5868a97b25ca12d0c60f6f45f3e5 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Sat, 14 Sep 2019 12:49:10 -0400 Subject: [PATCH 45/63] better debugging logging --- blockchain/v2/routine.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index 231da703a..823485bf2 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -8,11 +8,6 @@ import ( "github.com/tendermint/tendermint/libs/log" ) -// TODO -// * revisit panic conditions -// * audit log levels -// * Convert routine to an interface with concrete implmentation - type handleFunc = func(event Event) (Event, error) // Routines are a structure which model a finite state machine as serialized @@ -79,14 +74,14 @@ func (rt *Routine) start() { rt.terminate(fmt.Errorf("stopped")) return } - oEvent, err := rt.handle(events[0]) + oEvent, err := rt.handle(events[0].(Event)) rt.metrics.EventsHandled.With("routine", rt.name).Add(1) if err != nil { rt.terminate(err) return } rt.metrics.EventsOut.With("routine", rt.name).Add(1) - rt.logger.Debug(fmt.Sprintf("%s produced %+v event\n", rt.name, oEvent)) + rt.logger.Debug(fmt.Sprintf("%s produced %T %+v\n", rt.name, oEvent, oEvent)) rt.out <- oEvent } @@ -94,7 +89,7 @@ func (rt *Routine) start() { // XXX: look into returning OpError in the net package func (rt *Routine) send(event Event) bool { - rt.logger.Info(fmt.Sprintf("%s: sending %+v", rt.name, event)) + rt.logger.Debug(fmt.Sprintf("%s: received %T %+v", rt.name, event, event)) if !rt.isRunning() { return false } From 99b7a33f90f23ba1ae2b3375a205af555fc7410e Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Sat, 14 Sep 2019 13:01:19 -0400 Subject: [PATCH 46/63] align buffer sizes --- blockchain/v2/reactor.go | 6 +++--- blockchain/v2/reactor_test.go | 3 --- blockchain/v2/routine.go | 8 +++----- blockchain/v2/routine_test.go | 28 +++++++++++++++++++--------- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 26b2cb979..8cc8ac218 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -42,10 +42,10 @@ var bufferSize int = 10 func NewReactor() *Reactor { return &Reactor{ - events: make(chan Event, bufferSize), + events: make(chan Event, bufferSize*2), stopDemux: make(chan struct{}), - scheduler: newRoutine("scheduler", schedulerHandle), - processor: newRoutine("processor", processorHandle), + scheduler: newRoutine("scheduler", schedulerHandle, bufferSize), + processor: newRoutine("processor", processorHandle, bufferSize), ticker: time.NewTicker(1 * time.Second), logger: log.NewNopLogger(), } diff --git a/blockchain/v2/reactor_test.go b/blockchain/v2/reactor_test.go index e14e618de..86ac728a9 100644 --- a/blockchain/v2/reactor_test.go +++ b/blockchain/v2/reactor_test.go @@ -2,14 +2,11 @@ package v2 import ( "testing" - - "github.com/tendermint/tendermint/libs/log" ) func TestReactor(t *testing.T) { reactor := NewReactor() reactor.Start() - reactor.setLogger(log.TestingLogger()) script := []Event{ // TODO } diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index 823485bf2..cc7e7ea0f 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -28,14 +28,12 @@ type Routine struct { metrics *Metrics } -var queueSize int = 10 - -func newRoutine(name string, handleFunc handleFunc) *Routine { +func newRoutine(name string, handleFunc handleFunc, bufferSize int) *Routine { return &Routine{ name: name, handle: handleFunc, - queue: queue.NewPriorityQueue(queueSize, true), - out: make(chan Event, queueSize), + queue: queue.NewPriorityQueue(bufferSize, true), + out: make(chan Event, bufferSize), rdy: make(chan struct{}, 1), fin: make(chan error, 1), running: new(uint32), diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go index e32394ee4..2bd5a1a30 100644 --- a/blockchain/v2/routine_test.go +++ b/blockchain/v2/routine_test.go @@ -6,7 +6,6 @@ import ( "time" "github.com/stretchr/testify/assert" - "github.com/tendermint/tendermint/libs/log" ) type eventA struct { @@ -24,7 +23,10 @@ func simpleHandler(event Event) (Event, error) { } func TestRoutineFinal(t *testing.T) { - routine := newRoutine("simpleRoutine", simpleHandler) + var ( + bufferSize = 10 + routine = newRoutine("simpleRoutine", simpleHandler, bufferSize) + ) assert.False(t, routine.isRunning(), "expected an initialized routine to not be running") @@ -44,7 +46,10 @@ func TestRoutineFinal(t *testing.T) { } func TestRoutineStop(t *testing.T) { - routine := newRoutine("simpleRoutine", simpleHandler) + var ( + bufferSize = 10 + routine = newRoutine("simpleRoutine", simpleHandler, bufferSize) + ) assert.False(t, routine.send(eventA{}), "expected sending to an unstarted routine to fail") @@ -91,10 +96,12 @@ func feedback(r *Routine) { } func TestStatefulRoutine(t *testing.T) { - count := 10 - handler := genStatefulHandler(count) - routine := newRoutine("statefulRoutine", handler) - routine.setLogger(log.TestingLogger()) + var ( + count = 10 + handler = genStatefulHandler(count) + bufferSize = 20 + routine = newRoutine("statefulRoutine", handler, bufferSize) + ) go routine.start() go feedback(routine) @@ -131,8 +138,11 @@ func handleWithPriority(event Event) (Event, error) { } func TestPriority(t *testing.T) { - // XXX: align with buffer size - routine := newRoutine("priorityRoutine", handleWithPriority) + var ( + bufferSize = 20 + routine = newRoutine("priorityRoutine", handleWithPriority, bufferSize) + ) + go routine.start() <-routine.ready() go func() { From 522a849ba905f3cc602a26d63256045c83779b8b Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 16 Sep 2019 10:46:10 +0200 Subject: [PATCH 47/63] get_tools = tools (#3988) - in the makefile update `get_tools` was changed to just `tools` Signed-off-by: Marko Baricevic --- DOCKER/Dockerfile.abci | 2 +- Vagrantfile | 2 +- docs/app-dev/abci-cli.md | 2 +- docs/app-dev/getting-started.md | 2 +- docs/introduction/install.md | 2 +- docs/tools/monitoring.md | 2 +- networks/remote/integration.sh | 2 +- scripts/dist.sh | 2 +- scripts/install/install_tendermint_arm.sh | 2 +- scripts/install/install_tendermint_bsd.sh | 2 +- scripts/install/install_tendermint_osx.sh | 2 +- scripts/install/install_tendermint_ubuntu.sh | 2 +- tools/build/Makefile | 4 ++-- tools/tm-bench/Dockerfile.dev | 2 +- tools/tm-monitor/Dockerfile.dev | 2 +- tools/tm-monitor/README.md | 2 +- 16 files changed, 17 insertions(+), 17 deletions(-) diff --git a/DOCKER/Dockerfile.abci b/DOCKER/Dockerfile.abci index c6ec05f69..52a3d9e0b 100644 --- a/DOCKER/Dockerfile.abci +++ b/DOCKER/Dockerfile.abci @@ -15,7 +15,7 @@ RUN apt-get update && apt-get install -y \ COPY Gopkg.toml /go/src/github.com/tendermint/abci/ COPY Gopkg.lock /go/src/github.com/tendermint/abci/ -RUN make get_tools +RUN make tools # see https://github.com/golang/dep/issues/1312 RUN dep ensure -vendor-only diff --git a/Vagrantfile b/Vagrantfile index 67de74297..3367a908d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -57,6 +57,6 @@ Vagrant.configure("2") do |config| # get all deps and tools, ready to install/test su - vagrant -c 'source /home/vagrant/.bash_profile' - su - vagrant -c 'cd /home/vagrant/go/src/github.com/tendermint/tendermint && make get_tools' + su - vagrant -c 'cd /home/vagrant/go/src/github.com/tendermint/tendermint && make tools' SHELL end diff --git a/docs/app-dev/abci-cli.md b/docs/app-dev/abci-cli.md index 4b21a4b2d..c426b8cf9 100644 --- a/docs/app-dev/abci-cli.md +++ b/docs/app-dev/abci-cli.md @@ -15,7 +15,7 @@ mkdir -p $GOPATH/src/github.com/tendermint cd $GOPATH/src/github.com/tendermint git clone https://github.com/tendermint/tendermint.git cd tendermint -make get_tools +make tools make install_abci ``` diff --git a/docs/app-dev/getting-started.md b/docs/app-dev/getting-started.md index eff70db68..8b97338d9 100644 --- a/docs/app-dev/getting-started.md +++ b/docs/app-dev/getting-started.md @@ -27,7 +27,7 @@ Then run ``` go get github.com/tendermint/tendermint cd $GOPATH/src/github.com/tendermint/tendermint -make get_tools +make tools make install_abci ``` diff --git a/docs/introduction/install.md b/docs/introduction/install.md index 0a013bed1..39825dae3 100644 --- a/docs/introduction/install.md +++ b/docs/introduction/install.md @@ -28,7 +28,7 @@ cd tendermint ### Get Tools & Dependencies ``` -make get_tools +make tools ``` ### Compile diff --git a/docs/tools/monitoring.md b/docs/tools/monitoring.md index 26b90ed70..0653a5639 100644 --- a/docs/tools/monitoring.md +++ b/docs/tools/monitoring.md @@ -87,6 +87,6 @@ websocket. ## Development ``` -make get_tools +make tools make test ``` diff --git a/networks/remote/integration.sh b/networks/remote/integration.sh index c2d7c3a36..6ff02cb6f 100644 --- a/networks/remote/integration.sh +++ b/networks/remote/integration.sh @@ -30,7 +30,7 @@ go get $REPO cd $GOPATH/src/$REPO ## build -make get_tools +make tools make build # generate an ssh key diff --git a/scripts/dist.sh b/scripts/dist.sh index ac62f1099..81fdf9813 100755 --- a/scripts/dist.sh +++ b/scripts/dist.sh @@ -29,7 +29,7 @@ XC_OS=${XC_OS:-"solaris darwin freebsd linux windows"} XC_EXCLUDE=${XC_EXCLUDE:-" darwin/arm solaris/amd64 solaris/386 solaris/arm freebsd/amd64 windows/arm "} # Make sure build tools are available. -make get_tools +make tools # Build! # ldflags: -s Omit the symbol table and debug information. diff --git a/scripts/install/install_tendermint_arm.sh b/scripts/install/install_tendermint_arm.sh index 085ba82f4..cd2e18c9f 100644 --- a/scripts/install/install_tendermint_arm.sh +++ b/scripts/install/install_tendermint_arm.sh @@ -31,7 +31,7 @@ cd "$GOPATH/src/$REPO" git checkout $BRANCH # XXX: uncomment if branch isn't master # git fetch origin $BRANCH -make get_tools +make tools make install # the binary is located in $GOPATH/bin diff --git a/scripts/install/install_tendermint_bsd.sh b/scripts/install/install_tendermint_bsd.sh index 294155d0e..c69e6269c 100644 --- a/scripts/install/install_tendermint_bsd.sh +++ b/scripts/install/install_tendermint_bsd.sh @@ -46,7 +46,7 @@ cd "$GOPATH/src/$REPO" # build & install master git checkout $BRANCH -gmake get_tools +gmake tools gmake install # the binary is located in $GOPATH/bin diff --git a/scripts/install/install_tendermint_osx.sh b/scripts/install/install_tendermint_osx.sh index ee799f66a..be2c4d0ec 100644 --- a/scripts/install/install_tendermint_osx.sh +++ b/scripts/install/install_tendermint_osx.sh @@ -36,5 +36,5 @@ cd $GOPATH/src/$REPO git checkout $BRANCH # XXX: uncomment if branch isn't master # git fetch origin $BRANCH -make get_tools +make tools make install diff --git a/scripts/install/install_tendermint_ubuntu.sh b/scripts/install/install_tendermint_ubuntu.sh index 2e5558ff6..b562498f6 100644 --- a/scripts/install/install_tendermint_ubuntu.sh +++ b/scripts/install/install_tendermint_ubuntu.sh @@ -40,7 +40,7 @@ cd "$GOPATH/src/$REPO" git checkout $BRANCH # XXX: uncomment if branch isn't master # git fetch origin $BRANCH -make get_tools +make tools make install # the binary is located in $GOPATH/bin diff --git a/tools/build/Makefile b/tools/build/Makefile index 8c33ffd5d..df1387068 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -64,7 +64,7 @@ build-tendermint: git-branch gopath-setup @echo "*** Building tendermint" go get -d -u github.com/tendermint/tendermint/cmd/tendermint cd $(GOPATH)/src/github.com/tendermint/tendermint && git checkout "$(GIT_BRANCH)" && git pull - export PATH=$(GOPATH)/bin:$(PATH) && $(MAKE) -C $(GOPATH)/src/github.com/tendermint/tendermint get_tools build + export PATH=$(GOPATH)/bin:$(PATH) && $(MAKE) -C $(GOPATH)/src/github.com/tendermint/tendermint tools build cp $(GOPATH)/src/github.com/tendermint/tendermint/build/tendermint $(GOPATH)/bin @echo "*** Built tendermint" @@ -87,7 +87,7 @@ build-basecoind: git-branch gopath-setup @echo "*** Building basecoind from cosmos-sdk" go get -d -u github.com/cosmos/cosmos-sdk/examples/basecoin/cmd/basecoind cd $(GOPATH)/src/github.com/cosmos/cosmos-sdk && git checkout "$(GIT_BRANCH)" && git pull - export PATH=$(GOPATH)/bin:$(PATH) && $(MAKE) -C $(GOPATH)/src/github.com/cosmos/cosmos-sdk get_tools build + export PATH=$(GOPATH)/bin:$(PATH) && $(MAKE) -C $(GOPATH)/src/github.com/cosmos/cosmos-sdk tools build cp $(GOPATH)/src/github.com/cosmos/cosmos-sdk/build/basecoind $(GOPATH)/bin/basecoind @echo "*** Built basecoind from cosmos-sdk" diff --git a/tools/tm-bench/Dockerfile.dev b/tools/tm-bench/Dockerfile.dev index 1151965a2..73c263336 100644 --- a/tools/tm-bench/Dockerfile.dev +++ b/tools/tm-bench/Dockerfile.dev @@ -5,7 +5,7 @@ WORKDIR /go/src/github.com/tendermint/tendermint/tools/tm-bench COPY Makefile /go/src/github.com/tendermint/tendermint/tools/tm-bench/ -RUN make get_tools +RUN make tools COPY . /go/src/github.com/tendermint/tendermint/tools/tm-bench diff --git a/tools/tm-monitor/Dockerfile.dev b/tools/tm-monitor/Dockerfile.dev index e593bf89c..347c7f0fb 100644 --- a/tools/tm-monitor/Dockerfile.dev +++ b/tools/tm-monitor/Dockerfile.dev @@ -5,7 +5,7 @@ WORKDIR /go/src/github.com/tendermint/tools/tm-monitor COPY Makefile /go/src/github.com/tendermint/tools/tm-monitor/ -RUN make get_tools +RUN make tools COPY . /go/src/github.com/tendermint/tools/tm-monitor diff --git a/tools/tm-monitor/README.md b/tools/tm-monitor/README.md index 2bd367b99..1a8dfffc7 100644 --- a/tools/tm-monitor/README.md +++ b/tools/tm-monitor/README.md @@ -86,6 +86,6 @@ websocket. ## Development ``` -make get_tools +make tools make test ``` From 45ddd67bd6a3b6a9f5789a9b8a150b950e50d127 Mon Sep 17 00:00:00 2001 From: Marko Date: Mon, 16 Sep 2019 11:26:13 +0200 Subject: [PATCH 48/63] Add MempoolClient to Client Interface (#3987) * Add MempoolClient to Client Interface closes #3984 - add mempoolclient interface to client interface Signed-off-by: Marko Baricevic * Update CHANGELOG_PENDING.md * add golang-ci version --- CHANGELOG_PENDING.md | 1 + rpc/client/interface.go | 1 + rpc/client/mock/client.go | 1 + types/vote.go | 4 ++-- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index c8bb7bcca..3ab1632e3 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -20,6 +20,7 @@ program](https://hackerone.com/tendermint). ### IMPROVEMENTS: - [rpc] \#2010 Add NewHTTPWithClient and NewJSONRPCClientWithHTTPClient (note these and NewHTTP, NewJSONRPCClient functions panic if remote is invalid) (@gracenoah) +- [rpc] \#3984 Add `MempoolClient` interface to `Client` interface ### BUG FIXES: diff --git a/rpc/client/interface.go b/rpc/client/interface.go index 383e0b480..c4a7b023d 100644 --- a/rpc/client/interface.go +++ b/rpc/client/interface.go @@ -39,6 +39,7 @@ type Client interface { SignClient StatusClient EvidenceClient + MempoolClient } // ABCIClient groups together the functionality that principally affects the diff --git a/rpc/client/mock/client.go b/rpc/client/mock/client.go index 3ec40d6cc..b7fdd602d 100644 --- a/rpc/client/mock/client.go +++ b/rpc/client/mock/client.go @@ -37,6 +37,7 @@ type Client struct { client.StatusClient client.EventsClient client.EvidenceClient + client.MempoolClient cmn.Service } diff --git a/types/vote.go b/types/vote.go index 69cc514bd..8f5eee7fb 100644 --- a/types/vote.go +++ b/types/vote.go @@ -12,8 +12,8 @@ import ( const ( // MaxVoteBytes is a maximum vote size (including amino overhead). - MaxVoteBytes int64 = 223 - nilVoteStr = "nil-Vote" + MaxVoteBytes int64 = 223 + nilVoteStr string = "nil-Vote" ) var ( From d3d034e57226aa9afb7df70041d81722b43eda34 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Tue, 17 Sep 2019 15:18:15 -0400 Subject: [PATCH 49/63] tidying --- blockchain/v2/reactor.go | 11 +++++------ blockchain/v2/reactor_test.go | 6 +++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 8cc8ac218..f96b325b0 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -38,11 +38,9 @@ type Reactor struct { logger log.Logger } -var bufferSize int = 10 - -func NewReactor() *Reactor { +func NewReactor(bufferSize int) *Reactor { return &Reactor{ - events: make(chan Event, bufferSize*2), + events: make(chan Event, bufferSize), stopDemux: make(chan struct{}), scheduler: newRoutine("scheduler", schedulerHandle, bufferSize), processor: newRoutine("processor", processorHandle, bufferSize), @@ -73,7 +71,7 @@ func (r *Reactor) Start() { }() } -// Would it be possible here to provide some kind of type safety for the types +// XXX: Would it be possible here to provide some kind of type safety for the types // of events that each routine can produce and consume? func (r *Reactor) demux() { for { @@ -82,7 +80,7 @@ func (r *Reactor) demux() { // XXX: check for backpressure r.scheduler.send(event) r.processor.send(event) - case _ = <-r.stopDemux: + case <-r.stopDemux: r.logger.Info("demuxing stopped") return case event := <-r.scheduler.next(): @@ -112,6 +110,7 @@ func (r *Reactor) Stop() { func (r *Reactor) Receive(event Event) { // XXX: decode and serialize write events + // TODO: backpressure r.events <- event } diff --git a/blockchain/v2/reactor_test.go b/blockchain/v2/reactor_test.go index 86ac728a9..46a2e60c6 100644 --- a/blockchain/v2/reactor_test.go +++ b/blockchain/v2/reactor_test.go @@ -5,7 +5,11 @@ import ( ) func TestReactor(t *testing.T) { - reactor := NewReactor() + var ( + bufferSize = 10 + reactor = NewReactor(bufferSize) + ) + reactor.Start() script := []Event{ // TODO From 9d4a480f54b319f4e2704a8685c6755f9aa77cf8 Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 18 Sep 2019 10:45:03 +0200 Subject: [PATCH 50/63] makefile: minor cleanup (#3994) - goimports is not used as a tool anymore - correct me if wrong - rename devtools folder to merely tools.mk - remove slate_header.txt Signed-off-by: Marko Baricevic --- Makefile | 6 +----- rpc/core/README.md | 10 ---------- rpc/core/slate_header.txt | 13 ------------- scripts/devtools/Makefile => tools.mk | 10 ++-------- 4 files changed, 3 insertions(+), 36 deletions(-) delete mode 100644 rpc/core/slate_header.txt rename scripts/devtools/Makefile => tools.mk (86%) diff --git a/Makefile b/Makefile index 6870258f6..e7937cfc6 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)" all: check build test install # The below include contains the tools. -include scripts/devtools/Makefile +include tools.mk include tests.mk ######################################## @@ -153,10 +153,6 @@ lint: DESTINATION = ./index.html.md -rpc-docs: - cat rpc/core/slate_header.txt > $(DESTINATION) - godoc2md -template rpc/core/doc_template.txt github.com/tendermint/tendermint/rpc/core | grep -v -e "pipe.go" -e "routes.go" -e "dev.go" | sed 's,/src/target,https://github.com/tendermint/tendermint/tree/master/rpc/core,' >> $(DESTINATION) - ########################################################### ### Docker image diff --git a/rpc/core/README.md b/rpc/core/README.md index 32c3051e3..d767c5f71 100644 --- a/rpc/core/README.md +++ b/rpc/core/README.md @@ -1,15 +1,5 @@ # Tendermint RPC -We are using [Slate](https://github.com/lord/slate) to power our RPC -documentation. For generating markdown use: - -```shell -go get github.com/davecheney/godoc2md - -# from root of this repo -make rpc-docs -``` - ## Pagination Requests that return multiple items will be paginated to 30 items by default. diff --git a/rpc/core/slate_header.txt b/rpc/core/slate_header.txt deleted file mode 100644 index bb4ca6e03..000000000 --- a/rpc/core/slate_header.txt +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: RPC Reference - -language_tabs: # must be one of https://git.io/vQNgJ - - shell - - go - -toc_footers: - - Tendermint - - Documentation Powered by Slate - -search: true ---- diff --git a/scripts/devtools/Makefile b/tools.mk similarity index 86% rename from scripts/devtools/Makefile rename to tools.mk index 1ca24bf9d..f0a8338a6 100644 --- a/scripts/devtools/Makefile +++ b/tools.mk @@ -40,7 +40,6 @@ mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd) TOOLS_DESTDIR ?= $(GOPATH)/bin -GOIMPORTS = $(TOOLS_DESTDIR)/goimports CERTSTRAP = $(TOOLS_DESTDIR)/certstrap PROTOBUF = $(TOOLS_DESTDIR)/protoc GOX = $(TOOLS_DESTDIR)/gox @@ -48,7 +47,7 @@ GOODMAN = $(TOOLS_DESTDIR)/goodman all: tools -tools: goimports certstrap protobuf gox goodman +tools: certstrap protobuf gox goodman check: check_tools @@ -57,11 +56,6 @@ check_tools: @echo "Found tools: $(foreach tool,$(notdir $(GOTOOLS)),\ $(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))" -goimports: $(GOIMPORTS) -$(GOIMPORTS): - @echo "Get goimports@v0.0.0-20190628034336-212fb13d595e" - @go get golang.org/x/tools/cmd/goimports@v0.0.0-20190628034336-212fb13d595e - certstrap: $(CERTSTRAP) $(CERTSTRAP): @echo "Get Certstrap" @@ -86,7 +80,7 @@ $(GOODMAN): @go get github.com/snikch/goodman/cmd/goodman@10e37e294daa3c9a90abded60ff9924bafab3888 tools-clean: - rm -f $(CERTSTRAP) $(GOIMPORTS) $(PROTOBUF) $(GOX) $(GOODMAN) + rm -f $(CERTSTRAP) $(PROTOBUF) $(GOX) $(GOODMAN) rm -f tools-stamp .PHONY: all tools tools-clean From 98b91ce2a2f8a0da4c81cd938ef50fe54181e6fe Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 18 Sep 2019 11:04:40 +0200 Subject: [PATCH 51/63] tm-bench: add deprecation warning (#3992) - Added a deprecation warining in for deprecation of tm-bench in favor of tm-load-test - With the merging of this pr we can close tm-bench related issues. Signed-off-by: Marko Baricevic --- tools/tm-bench/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/tm-bench/README.md b/tools/tm-bench/README.md index d5ed1231f..b69f693f7 100644 --- a/tools/tm-bench/README.md +++ b/tools/tm-bench/README.md @@ -1,4 +1,8 @@ -# tm-bench +# tm-bench (Deprecated) + +> ## **Deprecation Warning** + +### This tool will be depreacted in favor of [tm-load-test](https://github.com/interchainio/tm-load-test). Tendermint blockchain benchmarking tool: From 1b54369f414d31b729165211d78b35bbc41ce007 Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 18 Sep 2019 11:32:50 +0200 Subject: [PATCH 52/63] custom marshallers for proto types, which EmitDefaults (#3889) * Remove omitempty from *pb.go - remove omitempty from *pb.go files - added command to makefile for everytime `make protoc_all` is run - open question: - Do we want to further remove omitempty from other places - https://github.com/tendermint/tendermint/blob/master/rpc/lib/types/types.go#L151 - and other places ref #3882 Signed-off-by: Marko Baricevic * bring back omitempty to *pb.go * Update types/tx.go * custom marshlers * undo benchmark `omitepmty` * golangci lint fix * cleanup comments * changelog_pending entry --- CHANGELOG_PENDING.md | 1 + abci/types/messages_test.go | 5 +-- abci/types/result.go | 6 +-- crypto/merkle/result.go | 53 ++++++++++++++++++++++++++ libs/common/result.go | 54 +++++++++++++++++++++++++++ types/proto3/result.go | 74 +++++++++++++++++++++++++++++++++++++ types/tx.go | 6 +-- 7 files changed, 189 insertions(+), 10 deletions(-) create mode 100644 crypto/merkle/result.go create mode 100644 libs/common/result.go create mode 100644 types/proto3/result.go diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 3ab1632e3..405e95696 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -21,6 +21,7 @@ program](https://hackerone.com/tendermint). - [rpc] \#2010 Add NewHTTPWithClient and NewJSONRPCClientWithHTTPClient (note these and NewHTTP, NewJSONRPCClient functions panic if remote is invalid) (@gracenoah) - [rpc] \#3984 Add `MempoolClient` interface to `Client` interface +- [rpc] \#3882 Add custom marshalers to proto messages to disable `omitempty` ### BUG FIXES: diff --git a/abci/types/messages_test.go b/abci/types/messages_test.go index 904b16410..b9ba72dcf 100644 --- a/abci/types/messages_test.go +++ b/abci/types/messages_test.go @@ -15,9 +15,8 @@ import ( func TestMarshalJSON(t *testing.T) { b, err := json.Marshal(&ResponseDeliverTx{}) assert.Nil(t, err) - // Do not include empty fields. - assert.False(t, strings.Contains(string(b), "code")) - + // include empty fields. + assert.True(t, strings.Contains(string(b), "code")) r1 := ResponseCheckTx{ Code: 1, Data: []byte("hello"), diff --git a/abci/types/result.go b/abci/types/result.go index dbf409f4c..321e71f08 100644 --- a/abci/types/result.go +++ b/abci/types/result.go @@ -42,14 +42,12 @@ func (r ResponseQuery) IsErr() bool { } //--------------------------------------------------------------------------- -// override JSON marshalling so we dont emit defaults (ie. disable omitempty) -// note we need Unmarshal functions too because protobuf had the bright idea -// to marshal int64->string. cool. cool, cool, cool: https://developers.google.com/protocol-buffers/docs/proto3#json +// override JSON marshalling so we emit defaults (ie. disable omitempty) var ( jsonpbMarshaller = jsonpb.Marshaler{ EnumsAsInts: true, - EmitDefaults: false, + EmitDefaults: true, } jsonpbUnmarshaller = jsonpb.Unmarshaler{} ) diff --git a/crypto/merkle/result.go b/crypto/merkle/result.go new file mode 100644 index 000000000..c7bbb575f --- /dev/null +++ b/crypto/merkle/result.go @@ -0,0 +1,53 @@ +// nolint: dupl +package merkle + +import ( + "bytes" + "encoding/json" + + "github.com/gogo/protobuf/jsonpb" +) + +//--------------------------------------------------------------------------- +// override JSON marshalling so we emit defaults (ie. disable omitempty) + +var ( + jsonpbMarshaller = jsonpb.Marshaler{ + EnumsAsInts: true, + EmitDefaults: true, + } + jsonpbUnmarshaller = jsonpb.Unmarshaler{} +) + +func (r *ProofOp) MarshalJSON() ([]byte, error) { + s, err := jsonpbMarshaller.MarshalToString(r) + return []byte(s), err +} + +func (r *ProofOp) UnmarshalJSON(b []byte) error { + reader := bytes.NewBuffer(b) + return jsonpbUnmarshaller.Unmarshal(reader, r) +} + +func (r *Proof) MarshalJSON() ([]byte, error) { + s, err := jsonpbMarshaller.MarshalToString(r) + return []byte(s), err +} + +func (r *Proof) UnmarshalJSON(b []byte) error { + reader := bytes.NewBuffer(b) + return jsonpbUnmarshaller.Unmarshal(reader, r) +} + +// Some compile time assertions to ensure we don't +// have accidental runtime surprises later on. +// jsonEncodingRoundTripper ensures that asserted +// interfaces implement both MarshalJSON and UnmarshalJSON + +type jsonRoundTripper interface { + json.Marshaler + json.Unmarshaler +} + +var _ jsonRoundTripper = (*ProofOp)(nil) +var _ jsonRoundTripper = (*Proof)(nil) diff --git a/libs/common/result.go b/libs/common/result.go new file mode 100644 index 000000000..90d149f4b --- /dev/null +++ b/libs/common/result.go @@ -0,0 +1,54 @@ +// nolint: dupl +// dupl is reading this as the same file as crypto/merkle/result.go +package common + +import ( + "bytes" + "encoding/json" + + "github.com/gogo/protobuf/jsonpb" +) + +//--------------------------------------------------------------------------- +// override JSON marshalling so we emit defaults (ie. disable omitempty) + +var ( + jsonpbMarshaller = jsonpb.Marshaler{ + EnumsAsInts: true, + EmitDefaults: true, + } + jsonpbUnmarshaller = jsonpb.Unmarshaler{} +) + +func (r *KVPair) MarshalJSON() ([]byte, error) { + s, err := jsonpbMarshaller.MarshalToString(r) + return []byte(s), err +} + +func (r *KVPair) UnmarshalJSON(b []byte) error { + reader := bytes.NewBuffer(b) + return jsonpbUnmarshaller.Unmarshal(reader, r) +} + +func (r *KI64Pair) MarshalJSON() ([]byte, error) { + s, err := jsonpbMarshaller.MarshalToString(r) + return []byte(s), err +} + +func (r *KI64Pair) UnmarshalJSON(b []byte) error { + reader := bytes.NewBuffer(b) + return jsonpbUnmarshaller.Unmarshal(reader, r) +} + +// Some compile time assertions to ensure we don't +// have accidental runtime surprises later on. +// jsonEncodingRoundTripper ensures that asserted +// interfaces implement both MarshalJSON and UnmarshalJSON + +type jsonRoundTripper interface { + json.Marshaler + json.Unmarshaler +} + +var _ jsonRoundTripper = (*KVPair)(nil) +var _ jsonRoundTripper = (*KI64Pair)(nil) diff --git a/types/proto3/result.go b/types/proto3/result.go new file mode 100644 index 000000000..ee5269bd3 --- /dev/null +++ b/types/proto3/result.go @@ -0,0 +1,74 @@ +package proto3 + +import ( + "bytes" + "encoding/json" + + "github.com/gogo/protobuf/jsonpb" +) + +//--------------------------------------------------------------------------- +// override JSON marshalling so we emit defaults (ie. disable omitempty) + +var ( + jsonpbMarshaller = jsonpb.Marshaler{ + EnumsAsInts: true, + EmitDefaults: true, + } + jsonpbUnmarshaller = jsonpb.Unmarshaler{} +) + +func (r *PartSetHeader) MarshalJSON() ([]byte, error) { + s, err := jsonpbMarshaller.MarshalToString(r) + return []byte(s), err +} + +func (r *PartSetHeader) UnmarshalJSON(b []byte) error { + reader := bytes.NewBuffer(b) + return jsonpbUnmarshaller.Unmarshal(reader, r) +} + +func (r *Header) MarshalJSON() ([]byte, error) { + s, err := jsonpbMarshaller.MarshalToString(r) + return []byte(s), err +} + +func (r *Header) UnmarshalJSON(b []byte) error { + reader := bytes.NewBuffer(b) + return jsonpbUnmarshaller.Unmarshal(reader, r) +} + +func (r *Version) MarshalJSON() ([]byte, error) { + s, err := jsonpbMarshaller.MarshalToString(r) + return []byte(s), err +} + +func (r *Version) UnmarshalJSON(b []byte) error { + reader := bytes.NewBuffer(b) + return jsonpbUnmarshaller.Unmarshal(reader, r) +} + +func (r *Timestamp) MarshalJSON() ([]byte, error) { + s, err := jsonpbMarshaller.MarshalToString(r) + return []byte(s), err +} + +func (r *Timestamp) UnmarshalJSON(b []byte) error { + reader := bytes.NewBuffer(b) + return jsonpbUnmarshaller.Unmarshal(reader, r) +} + +// Some compile time assertions to ensure we don't +// have accidental runtime surprises later on. +// jsonEncodingRoundTripper ensures that asserted +// interfaces implement both MarshalJSON and UnmarshalJSON + +type jsonRoundTripper interface { + json.Marshaler + json.Unmarshaler +} + +var _ jsonRoundTripper = (*PartSetHeader)(nil) +var _ jsonRoundTripper = (*Header)(nil) +var _ jsonRoundTripper = (*Version)(nil) +var _ jsonRoundTripper = (*Timestamp)(nil) diff --git a/types/tx.go b/types/tx.go index b71c70029..54ba6bde8 100644 --- a/types/tx.go +++ b/types/tx.go @@ -83,9 +83,9 @@ func (txs Txs) Proof(i int) TxProof { // TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. type TxProof struct { - RootHash cmn.HexBytes - Data Tx - Proof merkle.SimpleProof + RootHash cmn.HexBytes `json:"root_hash"` + Data Tx `json:"data"` + Proof merkle.SimpleProof `json:"proof"` } // Leaf returns the hash(tx), which is the leaf in the merkle tree which this proof refers to. From 2c7f42fafabef88e3c43dfd6a04cf6e23efe6797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Cha=C3=ADn?= Date: Wed, 18 Sep 2019 14:10:00 +0200 Subject: [PATCH 53/63] fix Header misalignment in StringIndent (#3996) --- types/block.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/block.go b/types/block.go index 537aed2e7..2dbab1393 100644 --- a/types/block.go +++ b/types/block.go @@ -432,7 +432,7 @@ func (h *Header) StringIndented(indent string) string { %s Validators: %v %s NextValidators: %v %s App: %v -%s Consensus: %v +%s Consensus: %v %s Results: %v %s Evidence: %v %s Proposer: %v From 0cbf32de975f725aa97cca384a5c8a577cf9cace Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Wed, 18 Sep 2019 15:22:24 -0400 Subject: [PATCH 54/63] merge fix --- blockchain/v2/schedule.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/blockchain/v2/schedule.go b/blockchain/v2/schedule.go index 329557492..db3819b81 100644 --- a/blockchain/v2/schedule.go +++ b/blockchain/v2/schedule.go @@ -10,8 +10,6 @@ import ( "github.com/tendermint/tendermint/p2p" ) -type Event interface{} - type blockState int const ( From 2ae7a300b76e173ed530d534bc4936cac00fb9be Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Wed, 18 Sep 2019 15:59:51 -0400 Subject: [PATCH 55/63] merge artifact go build file --- go.mod | 1 - 1 file changed, 1 deletion(-) diff --git a/go.mod b/go.mod index ddb067c29..01a122fe7 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.12 require ( github.com/VividCortex/gohistogram v1.0.0 // indirect github.com/Workiva/go-datastructures v1.0.50 - github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a github.com/fortytw2/leaktest v1.3.0 From 4dfbaeb0c412aa1ce06b2dd6adf7b5daec5d6d9d Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 19 Sep 2019 11:41:57 +0300 Subject: [PATCH 56/63] regenerate protobuf files with newer gogo version (#3998) protoc 3.7.0 gogo v1.3.0 --- abci/types/types.pb.go | 4594 +++++++++++++++++++---------------- abci/types/typespb_test.go | 28 +- crypto/merkle/merkle.pb.go | 212 +- libs/common/types.pb.go | 189 +- libs/common/typespb_test.go | 22 +- rpc/grpc/types.pb.go | 295 ++- rpc/grpc/typespb_test.go | 24 +- types/proto3/block.pb.go | 52 +- 8 files changed, 3009 insertions(+), 2407 deletions(-) diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index 926d528ad..48d15c2a6 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -3,28 +3,26 @@ package types -import proto "github.com/gogo/protobuf/proto" -import golang_proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import merkle "github.com/tendermint/tendermint/crypto/merkle" -import common "github.com/tendermint/tendermint/libs/common" - -import time "time" - -import bytes "bytes" - import ( - context "golang.org/x/net/context" + bytes "bytes" + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + golang_proto "github.com/golang/protobuf/proto" + _ "github.com/golang/protobuf/ptypes/timestamp" + merkle "github.com/tendermint/tendermint/crypto/merkle" + common "github.com/tendermint/tendermint/libs/common" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" + time "time" ) -import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - -import io "io" - // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = golang_proto.Marshal @@ -36,7 +34,7 @@ var _ = time.Kitchen // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type CheckTxType int32 @@ -49,6 +47,7 @@ var CheckTxType_name = map[int32]string{ 0: "New", 1: "Recheck", } + var CheckTxType_value = map[string]int32{ "New": 0, "Recheck": 1, @@ -57,8 +56,9 @@ var CheckTxType_value = map[string]int32{ func (x CheckTxType) String() string { return proto.EnumName(CheckTxType_name, int32(x)) } + func (CheckTxType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{0} + return fileDescriptor_9f1eaa49c51fa1ac, []int{0} } type Request struct { @@ -84,7 +84,7 @@ func (m *Request) Reset() { *m = Request{} } func (m *Request) String() string { return proto.CompactTextString(m) } func (*Request) ProtoMessage() {} func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{0} + return fileDescriptor_9f1eaa49c51fa1ac, []int{0} } func (m *Request) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -94,15 +94,15 @@ func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Request.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_Request.Merge(dst, src) +func (m *Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request.Merge(m, src) } func (m *Request) XXX_Size() int { return m.Size() @@ -121,37 +121,37 @@ type isRequest_Value interface { } type Request_Echo struct { - Echo *RequestEcho `protobuf:"bytes,2,opt,name=echo,oneof"` + Echo *RequestEcho `protobuf:"bytes,2,opt,name=echo,proto3,oneof"` } type Request_Flush struct { - Flush *RequestFlush `protobuf:"bytes,3,opt,name=flush,oneof"` + Flush *RequestFlush `protobuf:"bytes,3,opt,name=flush,proto3,oneof"` } type Request_Info struct { - Info *RequestInfo `protobuf:"bytes,4,opt,name=info,oneof"` + Info *RequestInfo `protobuf:"bytes,4,opt,name=info,proto3,oneof"` } type Request_SetOption struct { - SetOption *RequestSetOption `protobuf:"bytes,5,opt,name=set_option,json=setOption,oneof"` + SetOption *RequestSetOption `protobuf:"bytes,5,opt,name=set_option,json=setOption,proto3,oneof"` } type Request_InitChain struct { - InitChain *RequestInitChain `protobuf:"bytes,6,opt,name=init_chain,json=initChain,oneof"` + InitChain *RequestInitChain `protobuf:"bytes,6,opt,name=init_chain,json=initChain,proto3,oneof"` } type Request_Query struct { - Query *RequestQuery `protobuf:"bytes,7,opt,name=query,oneof"` + Query *RequestQuery `protobuf:"bytes,7,opt,name=query,proto3,oneof"` } type Request_BeginBlock struct { - BeginBlock *RequestBeginBlock `protobuf:"bytes,8,opt,name=begin_block,json=beginBlock,oneof"` + BeginBlock *RequestBeginBlock `protobuf:"bytes,8,opt,name=begin_block,json=beginBlock,proto3,oneof"` } type Request_CheckTx struct { - CheckTx *RequestCheckTx `protobuf:"bytes,9,opt,name=check_tx,json=checkTx,oneof"` + CheckTx *RequestCheckTx `protobuf:"bytes,9,opt,name=check_tx,json=checkTx,proto3,oneof"` } type Request_DeliverTx struct { - DeliverTx *RequestDeliverTx `protobuf:"bytes,19,opt,name=deliver_tx,json=deliverTx,oneof"` + DeliverTx *RequestDeliverTx `protobuf:"bytes,19,opt,name=deliver_tx,json=deliverTx,proto3,oneof"` } type Request_EndBlock struct { - EndBlock *RequestEndBlock `protobuf:"bytes,11,opt,name=end_block,json=endBlock,oneof"` + EndBlock *RequestEndBlock `protobuf:"bytes,11,opt,name=end_block,json=endBlock,proto3,oneof"` } type Request_Commit struct { - Commit *RequestCommit `protobuf:"bytes,12,opt,name=commit,oneof"` + Commit *RequestCommit `protobuf:"bytes,12,opt,name=commit,proto3,oneof"` } func (*Request_Echo) isRequest_Value() {} @@ -250,9 +250,9 @@ func (m *Request) GetCommit() *RequestCommit { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Request) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Request_OneofMarshaler, _Request_OneofUnmarshaler, _Request_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Request) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Request_Echo)(nil), (*Request_Flush)(nil), (*Request_Info)(nil), @@ -267,234 +267,6 @@ func (*Request) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error } } -func _Request_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Request) - // value - switch x := m.Value.(type) { - case *Request_Echo: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Echo); err != nil { - return err - } - case *Request_Flush: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Flush); err != nil { - return err - } - case *Request_Info: - _ = b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Info); err != nil { - return err - } - case *Request_SetOption: - _ = b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SetOption); err != nil { - return err - } - case *Request_InitChain: - _ = b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitChain); err != nil { - return err - } - case *Request_Query: - _ = b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Query); err != nil { - return err - } - case *Request_BeginBlock: - _ = b.EncodeVarint(8<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BeginBlock); err != nil { - return err - } - case *Request_CheckTx: - _ = b.EncodeVarint(9<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.CheckTx); err != nil { - return err - } - case *Request_DeliverTx: - _ = b.EncodeVarint(19<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.DeliverTx); err != nil { - return err - } - case *Request_EndBlock: - _ = b.EncodeVarint(11<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.EndBlock); err != nil { - return err - } - case *Request_Commit: - _ = b.EncodeVarint(12<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Commit); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Request.Value has unexpected type %T", x) - } - return nil -} - -func _Request_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Request) - switch tag { - case 2: // value.echo - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestEcho) - err := b.DecodeMessage(msg) - m.Value = &Request_Echo{msg} - return true, err - case 3: // value.flush - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestFlush) - err := b.DecodeMessage(msg) - m.Value = &Request_Flush{msg} - return true, err - case 4: // value.info - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestInfo) - err := b.DecodeMessage(msg) - m.Value = &Request_Info{msg} - return true, err - case 5: // value.set_option - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestSetOption) - err := b.DecodeMessage(msg) - m.Value = &Request_SetOption{msg} - return true, err - case 6: // value.init_chain - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestInitChain) - err := b.DecodeMessage(msg) - m.Value = &Request_InitChain{msg} - return true, err - case 7: // value.query - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestQuery) - err := b.DecodeMessage(msg) - m.Value = &Request_Query{msg} - return true, err - case 8: // value.begin_block - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestBeginBlock) - err := b.DecodeMessage(msg) - m.Value = &Request_BeginBlock{msg} - return true, err - case 9: // value.check_tx - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestCheckTx) - err := b.DecodeMessage(msg) - m.Value = &Request_CheckTx{msg} - return true, err - case 19: // value.deliver_tx - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestDeliverTx) - err := b.DecodeMessage(msg) - m.Value = &Request_DeliverTx{msg} - return true, err - case 11: // value.end_block - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestEndBlock) - err := b.DecodeMessage(msg) - m.Value = &Request_EndBlock{msg} - return true, err - case 12: // value.commit - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestCommit) - err := b.DecodeMessage(msg) - m.Value = &Request_Commit{msg} - return true, err - default: - return false, nil - } -} - -func _Request_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Request) - // value - switch x := m.Value.(type) { - case *Request_Echo: - s := proto.Size(x.Echo) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_Flush: - s := proto.Size(x.Flush) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_Info: - s := proto.Size(x.Info) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_SetOption: - s := proto.Size(x.SetOption) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_InitChain: - s := proto.Size(x.InitChain) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_Query: - s := proto.Size(x.Query) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_BeginBlock: - s := proto.Size(x.BeginBlock) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_CheckTx: - s := proto.Size(x.CheckTx) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_DeliverTx: - s := proto.Size(x.DeliverTx) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_EndBlock: - s := proto.Size(x.EndBlock) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_Commit: - s := proto.Size(x.Commit) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type RequestEcho struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -506,7 +278,7 @@ func (m *RequestEcho) Reset() { *m = RequestEcho{} } func (m *RequestEcho) String() string { return proto.CompactTextString(m) } func (*RequestEcho) ProtoMessage() {} func (*RequestEcho) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{1} + return fileDescriptor_9f1eaa49c51fa1ac, []int{1} } func (m *RequestEcho) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -516,15 +288,15 @@ func (m *RequestEcho) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_RequestEcho.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestEcho) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestEcho.Merge(dst, src) +func (m *RequestEcho) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestEcho.Merge(m, src) } func (m *RequestEcho) XXX_Size() int { return m.Size() @@ -552,7 +324,7 @@ func (m *RequestFlush) Reset() { *m = RequestFlush{} } func (m *RequestFlush) String() string { return proto.CompactTextString(m) } func (*RequestFlush) ProtoMessage() {} func (*RequestFlush) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{2} + return fileDescriptor_9f1eaa49c51fa1ac, []int{2} } func (m *RequestFlush) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -562,15 +334,15 @@ func (m *RequestFlush) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_RequestFlush.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestFlush) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestFlush.Merge(dst, src) +func (m *RequestFlush) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestFlush.Merge(m, src) } func (m *RequestFlush) XXX_Size() int { return m.Size() @@ -594,7 +366,7 @@ func (m *RequestInfo) Reset() { *m = RequestInfo{} } func (m *RequestInfo) String() string { return proto.CompactTextString(m) } func (*RequestInfo) ProtoMessage() {} func (*RequestInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{3} + return fileDescriptor_9f1eaa49c51fa1ac, []int{3} } func (m *RequestInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -604,15 +376,15 @@ func (m *RequestInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_RequestInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestInfo.Merge(dst, src) +func (m *RequestInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestInfo.Merge(m, src) } func (m *RequestInfo) XXX_Size() int { return m.Size() @@ -657,7 +429,7 @@ func (m *RequestSetOption) Reset() { *m = RequestSetOption{} } func (m *RequestSetOption) String() string { return proto.CompactTextString(m) } func (*RequestSetOption) ProtoMessage() {} func (*RequestSetOption) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{4} + return fileDescriptor_9f1eaa49c51fa1ac, []int{4} } func (m *RequestSetOption) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -667,15 +439,15 @@ func (m *RequestSetOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return xxx_messageInfo_RequestSetOption.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestSetOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestSetOption.Merge(dst, src) +func (m *RequestSetOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestSetOption.Merge(m, src) } func (m *RequestSetOption) XXX_Size() int { return m.Size() @@ -701,10 +473,10 @@ func (m *RequestSetOption) GetValue() string { } type RequestInitChain struct { - Time time.Time `protobuf:"bytes,1,opt,name=time,stdtime" json:"time"` + Time time.Time `protobuf:"bytes,1,opt,name=time,proto3,stdtime" json:"time"` ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - ConsensusParams *ConsensusParams `protobuf:"bytes,3,opt,name=consensus_params,json=consensusParams" json:"consensus_params,omitempty"` - Validators []ValidatorUpdate `protobuf:"bytes,4,rep,name=validators" json:"validators"` + ConsensusParams *ConsensusParams `protobuf:"bytes,3,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params,omitempty"` + Validators []ValidatorUpdate `protobuf:"bytes,4,rep,name=validators,proto3" json:"validators"` AppStateBytes []byte `protobuf:"bytes,5,opt,name=app_state_bytes,json=appStateBytes,proto3" json:"app_state_bytes,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -715,7 +487,7 @@ func (m *RequestInitChain) Reset() { *m = RequestInitChain{} } func (m *RequestInitChain) String() string { return proto.CompactTextString(m) } func (*RequestInitChain) ProtoMessage() {} func (*RequestInitChain) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{5} + return fileDescriptor_9f1eaa49c51fa1ac, []int{5} } func (m *RequestInitChain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -725,15 +497,15 @@ func (m *RequestInitChain) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return xxx_messageInfo_RequestInitChain.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestInitChain) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestInitChain.Merge(dst, src) +func (m *RequestInitChain) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestInitChain.Merge(m, src) } func (m *RequestInitChain) XXX_Size() int { return m.Size() @@ -793,7 +565,7 @@ func (m *RequestQuery) Reset() { *m = RequestQuery{} } func (m *RequestQuery) String() string { return proto.CompactTextString(m) } func (*RequestQuery) ProtoMessage() {} func (*RequestQuery) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{6} + return fileDescriptor_9f1eaa49c51fa1ac, []int{6} } func (m *RequestQuery) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -803,15 +575,15 @@ func (m *RequestQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_RequestQuery.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestQuery) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestQuery.Merge(dst, src) +func (m *RequestQuery) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestQuery.Merge(m, src) } func (m *RequestQuery) XXX_Size() int { return m.Size() @@ -852,9 +624,9 @@ func (m *RequestQuery) GetProve() bool { type RequestBeginBlock struct { Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - Header Header `protobuf:"bytes,2,opt,name=header" json:"header"` - LastCommitInfo LastCommitInfo `protobuf:"bytes,3,opt,name=last_commit_info,json=lastCommitInfo" json:"last_commit_info"` - ByzantineValidators []Evidence `protobuf:"bytes,4,rep,name=byzantine_validators,json=byzantineValidators" json:"byzantine_validators"` + Header Header `protobuf:"bytes,2,opt,name=header,proto3" json:"header"` + LastCommitInfo LastCommitInfo `protobuf:"bytes,3,opt,name=last_commit_info,json=lastCommitInfo,proto3" json:"last_commit_info"` + ByzantineValidators []Evidence `protobuf:"bytes,4,rep,name=byzantine_validators,json=byzantineValidators,proto3" json:"byzantine_validators"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -864,7 +636,7 @@ func (m *RequestBeginBlock) Reset() { *m = RequestBeginBlock{} } func (m *RequestBeginBlock) String() string { return proto.CompactTextString(m) } func (*RequestBeginBlock) ProtoMessage() {} func (*RequestBeginBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{7} + return fileDescriptor_9f1eaa49c51fa1ac, []int{7} } func (m *RequestBeginBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -874,15 +646,15 @@ func (m *RequestBeginBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_RequestBeginBlock.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestBeginBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestBeginBlock.Merge(dst, src) +func (m *RequestBeginBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestBeginBlock.Merge(m, src) } func (m *RequestBeginBlock) XXX_Size() int { return m.Size() @@ -933,7 +705,7 @@ func (m *RequestCheckTx) Reset() { *m = RequestCheckTx{} } func (m *RequestCheckTx) String() string { return proto.CompactTextString(m) } func (*RequestCheckTx) ProtoMessage() {} func (*RequestCheckTx) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{8} + return fileDescriptor_9f1eaa49c51fa1ac, []int{8} } func (m *RequestCheckTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -943,15 +715,15 @@ func (m *RequestCheckTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_RequestCheckTx.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestCheckTx) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestCheckTx.Merge(dst, src) +func (m *RequestCheckTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestCheckTx.Merge(m, src) } func (m *RequestCheckTx) XXX_Size() int { return m.Size() @@ -987,7 +759,7 @@ func (m *RequestDeliverTx) Reset() { *m = RequestDeliverTx{} } func (m *RequestDeliverTx) String() string { return proto.CompactTextString(m) } func (*RequestDeliverTx) ProtoMessage() {} func (*RequestDeliverTx) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{9} + return fileDescriptor_9f1eaa49c51fa1ac, []int{9} } func (m *RequestDeliverTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -997,15 +769,15 @@ func (m *RequestDeliverTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return xxx_messageInfo_RequestDeliverTx.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestDeliverTx) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestDeliverTx.Merge(dst, src) +func (m *RequestDeliverTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestDeliverTx.Merge(m, src) } func (m *RequestDeliverTx) XXX_Size() int { return m.Size() @@ -1034,7 +806,7 @@ func (m *RequestEndBlock) Reset() { *m = RequestEndBlock{} } func (m *RequestEndBlock) String() string { return proto.CompactTextString(m) } func (*RequestEndBlock) ProtoMessage() {} func (*RequestEndBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{10} + return fileDescriptor_9f1eaa49c51fa1ac, []int{10} } func (m *RequestEndBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1044,15 +816,15 @@ func (m *RequestEndBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_RequestEndBlock.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestEndBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestEndBlock.Merge(dst, src) +func (m *RequestEndBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestEndBlock.Merge(m, src) } func (m *RequestEndBlock) XXX_Size() int { return m.Size() @@ -1080,7 +852,7 @@ func (m *RequestCommit) Reset() { *m = RequestCommit{} } func (m *RequestCommit) String() string { return proto.CompactTextString(m) } func (*RequestCommit) ProtoMessage() {} func (*RequestCommit) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{11} + return fileDescriptor_9f1eaa49c51fa1ac, []int{11} } func (m *RequestCommit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1090,15 +862,15 @@ func (m *RequestCommit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_RequestCommit.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestCommit) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestCommit.Merge(dst, src) +func (m *RequestCommit) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestCommit.Merge(m, src) } func (m *RequestCommit) XXX_Size() int { return m.Size() @@ -1133,7 +905,7 @@ func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{12} + return fileDescriptor_9f1eaa49c51fa1ac, []int{12} } func (m *Response) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1143,15 +915,15 @@ func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Response.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Response) XXX_Merge(src proto.Message) { - xxx_messageInfo_Response.Merge(dst, src) +func (m *Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_Response.Merge(m, src) } func (m *Response) XXX_Size() int { return m.Size() @@ -1170,40 +942,40 @@ type isResponse_Value interface { } type Response_Exception struct { - Exception *ResponseException `protobuf:"bytes,1,opt,name=exception,oneof"` + Exception *ResponseException `protobuf:"bytes,1,opt,name=exception,proto3,oneof"` } type Response_Echo struct { - Echo *ResponseEcho `protobuf:"bytes,2,opt,name=echo,oneof"` + Echo *ResponseEcho `protobuf:"bytes,2,opt,name=echo,proto3,oneof"` } type Response_Flush struct { - Flush *ResponseFlush `protobuf:"bytes,3,opt,name=flush,oneof"` + Flush *ResponseFlush `protobuf:"bytes,3,opt,name=flush,proto3,oneof"` } type Response_Info struct { - Info *ResponseInfo `protobuf:"bytes,4,opt,name=info,oneof"` + Info *ResponseInfo `protobuf:"bytes,4,opt,name=info,proto3,oneof"` } type Response_SetOption struct { - SetOption *ResponseSetOption `protobuf:"bytes,5,opt,name=set_option,json=setOption,oneof"` + SetOption *ResponseSetOption `protobuf:"bytes,5,opt,name=set_option,json=setOption,proto3,oneof"` } type Response_InitChain struct { - InitChain *ResponseInitChain `protobuf:"bytes,6,opt,name=init_chain,json=initChain,oneof"` + InitChain *ResponseInitChain `protobuf:"bytes,6,opt,name=init_chain,json=initChain,proto3,oneof"` } type Response_Query struct { - Query *ResponseQuery `protobuf:"bytes,7,opt,name=query,oneof"` + Query *ResponseQuery `protobuf:"bytes,7,opt,name=query,proto3,oneof"` } type Response_BeginBlock struct { - BeginBlock *ResponseBeginBlock `protobuf:"bytes,8,opt,name=begin_block,json=beginBlock,oneof"` + BeginBlock *ResponseBeginBlock `protobuf:"bytes,8,opt,name=begin_block,json=beginBlock,proto3,oneof"` } type Response_CheckTx struct { - CheckTx *ResponseCheckTx `protobuf:"bytes,9,opt,name=check_tx,json=checkTx,oneof"` + CheckTx *ResponseCheckTx `protobuf:"bytes,9,opt,name=check_tx,json=checkTx,proto3,oneof"` } type Response_DeliverTx struct { - DeliverTx *ResponseDeliverTx `protobuf:"bytes,10,opt,name=deliver_tx,json=deliverTx,oneof"` + DeliverTx *ResponseDeliverTx `protobuf:"bytes,10,opt,name=deliver_tx,json=deliverTx,proto3,oneof"` } type Response_EndBlock struct { - EndBlock *ResponseEndBlock `protobuf:"bytes,11,opt,name=end_block,json=endBlock,oneof"` + EndBlock *ResponseEndBlock `protobuf:"bytes,11,opt,name=end_block,json=endBlock,proto3,oneof"` } type Response_Commit struct { - Commit *ResponseCommit `protobuf:"bytes,12,opt,name=commit,oneof"` + Commit *ResponseCommit `protobuf:"bytes,12,opt,name=commit,proto3,oneof"` } func (*Response_Exception) isResponse_Value() {} @@ -1310,9 +1082,9 @@ func (m *Response) GetCommit() *ResponseCommit { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Response) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Response_OneofMarshaler, _Response_OneofUnmarshaler, _Response_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Response) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Response_Exception)(nil), (*Response_Echo)(nil), (*Response_Flush)(nil), @@ -1328,252 +1100,6 @@ func (*Response) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) erro } } -func _Response_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Response) - // value - switch x := m.Value.(type) { - case *Response_Exception: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Exception); err != nil { - return err - } - case *Response_Echo: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Echo); err != nil { - return err - } - case *Response_Flush: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Flush); err != nil { - return err - } - case *Response_Info: - _ = b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Info); err != nil { - return err - } - case *Response_SetOption: - _ = b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SetOption); err != nil { - return err - } - case *Response_InitChain: - _ = b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitChain); err != nil { - return err - } - case *Response_Query: - _ = b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Query); err != nil { - return err - } - case *Response_BeginBlock: - _ = b.EncodeVarint(8<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BeginBlock); err != nil { - return err - } - case *Response_CheckTx: - _ = b.EncodeVarint(9<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.CheckTx); err != nil { - return err - } - case *Response_DeliverTx: - _ = b.EncodeVarint(10<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.DeliverTx); err != nil { - return err - } - case *Response_EndBlock: - _ = b.EncodeVarint(11<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.EndBlock); err != nil { - return err - } - case *Response_Commit: - _ = b.EncodeVarint(12<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Commit); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Response.Value has unexpected type %T", x) - } - return nil -} - -func _Response_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Response) - switch tag { - case 1: // value.exception - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseException) - err := b.DecodeMessage(msg) - m.Value = &Response_Exception{msg} - return true, err - case 2: // value.echo - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseEcho) - err := b.DecodeMessage(msg) - m.Value = &Response_Echo{msg} - return true, err - case 3: // value.flush - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseFlush) - err := b.DecodeMessage(msg) - m.Value = &Response_Flush{msg} - return true, err - case 4: // value.info - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseInfo) - err := b.DecodeMessage(msg) - m.Value = &Response_Info{msg} - return true, err - case 5: // value.set_option - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseSetOption) - err := b.DecodeMessage(msg) - m.Value = &Response_SetOption{msg} - return true, err - case 6: // value.init_chain - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseInitChain) - err := b.DecodeMessage(msg) - m.Value = &Response_InitChain{msg} - return true, err - case 7: // value.query - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseQuery) - err := b.DecodeMessage(msg) - m.Value = &Response_Query{msg} - return true, err - case 8: // value.begin_block - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseBeginBlock) - err := b.DecodeMessage(msg) - m.Value = &Response_BeginBlock{msg} - return true, err - case 9: // value.check_tx - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseCheckTx) - err := b.DecodeMessage(msg) - m.Value = &Response_CheckTx{msg} - return true, err - case 10: // value.deliver_tx - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseDeliverTx) - err := b.DecodeMessage(msg) - m.Value = &Response_DeliverTx{msg} - return true, err - case 11: // value.end_block - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseEndBlock) - err := b.DecodeMessage(msg) - m.Value = &Response_EndBlock{msg} - return true, err - case 12: // value.commit - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseCommit) - err := b.DecodeMessage(msg) - m.Value = &Response_Commit{msg} - return true, err - default: - return false, nil - } -} - -func _Response_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Response) - // value - switch x := m.Value.(type) { - case *Response_Exception: - s := proto.Size(x.Exception) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_Echo: - s := proto.Size(x.Echo) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_Flush: - s := proto.Size(x.Flush) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_Info: - s := proto.Size(x.Info) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_SetOption: - s := proto.Size(x.SetOption) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_InitChain: - s := proto.Size(x.InitChain) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_Query: - s := proto.Size(x.Query) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_BeginBlock: - s := proto.Size(x.BeginBlock) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_CheckTx: - s := proto.Size(x.CheckTx) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_DeliverTx: - s := proto.Size(x.DeliverTx) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_EndBlock: - s := proto.Size(x.EndBlock) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_Commit: - s := proto.Size(x.Commit) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // nondeterministic type ResponseException struct { Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` @@ -1586,7 +1112,7 @@ func (m *ResponseException) Reset() { *m = ResponseException{} } func (m *ResponseException) String() string { return proto.CompactTextString(m) } func (*ResponseException) ProtoMessage() {} func (*ResponseException) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{13} + return fileDescriptor_9f1eaa49c51fa1ac, []int{13} } func (m *ResponseException) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1596,15 +1122,15 @@ func (m *ResponseException) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_ResponseException.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseException) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseException.Merge(dst, src) +func (m *ResponseException) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseException.Merge(m, src) } func (m *ResponseException) XXX_Size() int { return m.Size() @@ -1633,7 +1159,7 @@ func (m *ResponseEcho) Reset() { *m = ResponseEcho{} } func (m *ResponseEcho) String() string { return proto.CompactTextString(m) } func (*ResponseEcho) ProtoMessage() {} func (*ResponseEcho) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{14} + return fileDescriptor_9f1eaa49c51fa1ac, []int{14} } func (m *ResponseEcho) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1643,15 +1169,15 @@ func (m *ResponseEcho) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_ResponseEcho.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseEcho) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseEcho.Merge(dst, src) +func (m *ResponseEcho) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseEcho.Merge(m, src) } func (m *ResponseEcho) XXX_Size() int { return m.Size() @@ -1679,7 +1205,7 @@ func (m *ResponseFlush) Reset() { *m = ResponseFlush{} } func (m *ResponseFlush) String() string { return proto.CompactTextString(m) } func (*ResponseFlush) ProtoMessage() {} func (*ResponseFlush) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{15} + return fileDescriptor_9f1eaa49c51fa1ac, []int{15} } func (m *ResponseFlush) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1689,15 +1215,15 @@ func (m *ResponseFlush) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_ResponseFlush.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseFlush) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseFlush.Merge(dst, src) +func (m *ResponseFlush) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseFlush.Merge(m, src) } func (m *ResponseFlush) XXX_Size() int { return m.Size() @@ -1723,7 +1249,7 @@ func (m *ResponseInfo) Reset() { *m = ResponseInfo{} } func (m *ResponseInfo) String() string { return proto.CompactTextString(m) } func (*ResponseInfo) ProtoMessage() {} func (*ResponseInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{16} + return fileDescriptor_9f1eaa49c51fa1ac, []int{16} } func (m *ResponseInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1733,15 +1259,15 @@ func (m *ResponseInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_ResponseInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseInfo.Merge(dst, src) +func (m *ResponseInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseInfo.Merge(m, src) } func (m *ResponseInfo) XXX_Size() int { return m.Size() @@ -1802,7 +1328,7 @@ func (m *ResponseSetOption) Reset() { *m = ResponseSetOption{} } func (m *ResponseSetOption) String() string { return proto.CompactTextString(m) } func (*ResponseSetOption) ProtoMessage() {} func (*ResponseSetOption) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{17} + return fileDescriptor_9f1eaa49c51fa1ac, []int{17} } func (m *ResponseSetOption) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1812,15 +1338,15 @@ func (m *ResponseSetOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_ResponseSetOption.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseSetOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseSetOption.Merge(dst, src) +func (m *ResponseSetOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseSetOption.Merge(m, src) } func (m *ResponseSetOption) XXX_Size() int { return m.Size() @@ -1853,8 +1379,8 @@ func (m *ResponseSetOption) GetInfo() string { } type ResponseInitChain struct { - ConsensusParams *ConsensusParams `protobuf:"bytes,1,opt,name=consensus_params,json=consensusParams" json:"consensus_params,omitempty"` - Validators []ValidatorUpdate `protobuf:"bytes,2,rep,name=validators" json:"validators"` + ConsensusParams *ConsensusParams `protobuf:"bytes,1,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params,omitempty"` + Validators []ValidatorUpdate `protobuf:"bytes,2,rep,name=validators,proto3" json:"validators"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1864,7 +1390,7 @@ func (m *ResponseInitChain) Reset() { *m = ResponseInitChain{} } func (m *ResponseInitChain) String() string { return proto.CompactTextString(m) } func (*ResponseInitChain) ProtoMessage() {} func (*ResponseInitChain) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{18} + return fileDescriptor_9f1eaa49c51fa1ac, []int{18} } func (m *ResponseInitChain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1874,15 +1400,15 @@ func (m *ResponseInitChain) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_ResponseInitChain.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseInitChain) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseInitChain.Merge(dst, src) +func (m *ResponseInitChain) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseInitChain.Merge(m, src) } func (m *ResponseInitChain) XXX_Size() int { return m.Size() @@ -1915,7 +1441,7 @@ type ResponseQuery struct { Index int64 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"` Key []byte `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"` Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"` - Proof *merkle.Proof `protobuf:"bytes,8,opt,name=proof" json:"proof,omitempty"` + Proof *merkle.Proof `protobuf:"bytes,8,opt,name=proof,proto3" json:"proof,omitempty"` Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"` Codespace string `protobuf:"bytes,10,opt,name=codespace,proto3" json:"codespace,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1927,7 +1453,7 @@ func (m *ResponseQuery) Reset() { *m = ResponseQuery{} } func (m *ResponseQuery) String() string { return proto.CompactTextString(m) } func (*ResponseQuery) ProtoMessage() {} func (*ResponseQuery) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{19} + return fileDescriptor_9f1eaa49c51fa1ac, []int{19} } func (m *ResponseQuery) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1937,15 +1463,15 @@ func (m *ResponseQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_ResponseQuery.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseQuery) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseQuery.Merge(dst, src) +func (m *ResponseQuery) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseQuery.Merge(m, src) } func (m *ResponseQuery) XXX_Size() int { return m.Size() @@ -2020,7 +1546,7 @@ func (m *ResponseQuery) GetCodespace() string { } type ResponseBeginBlock struct { - Events []Event `protobuf:"bytes,1,rep,name=events" json:"events,omitempty"` + Events []Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2030,7 +1556,7 @@ func (m *ResponseBeginBlock) Reset() { *m = ResponseBeginBlock{} } func (m *ResponseBeginBlock) String() string { return proto.CompactTextString(m) } func (*ResponseBeginBlock) ProtoMessage() {} func (*ResponseBeginBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{20} + return fileDescriptor_9f1eaa49c51fa1ac, []int{20} } func (m *ResponseBeginBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2040,15 +1566,15 @@ func (m *ResponseBeginBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_ResponseBeginBlock.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseBeginBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseBeginBlock.Merge(dst, src) +func (m *ResponseBeginBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseBeginBlock.Merge(m, src) } func (m *ResponseBeginBlock) XXX_Size() int { return m.Size() @@ -2073,7 +1599,7 @@ type ResponseCheckTx struct { Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"` GasWanted int64 `protobuf:"varint,5,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"` GasUsed int64 `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` - Events []Event `protobuf:"bytes,7,rep,name=events" json:"events,omitempty"` + Events []Event `protobuf:"bytes,7,rep,name=events,proto3" json:"events,omitempty"` Codespace string `protobuf:"bytes,8,opt,name=codespace,proto3" json:"codespace,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -2084,7 +1610,7 @@ func (m *ResponseCheckTx) Reset() { *m = ResponseCheckTx{} } func (m *ResponseCheckTx) String() string { return proto.CompactTextString(m) } func (*ResponseCheckTx) ProtoMessage() {} func (*ResponseCheckTx) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{21} + return fileDescriptor_9f1eaa49c51fa1ac, []int{21} } func (m *ResponseCheckTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2094,15 +1620,15 @@ func (m *ResponseCheckTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_ResponseCheckTx.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseCheckTx) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseCheckTx.Merge(dst, src) +func (m *ResponseCheckTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseCheckTx.Merge(m, src) } func (m *ResponseCheckTx) XXX_Size() int { return m.Size() @@ -2176,7 +1702,7 @@ type ResponseDeliverTx struct { Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"` GasWanted int64 `protobuf:"varint,5,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"` GasUsed int64 `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` - Events []Event `protobuf:"bytes,7,rep,name=events" json:"events,omitempty"` + Events []Event `protobuf:"bytes,7,rep,name=events,proto3" json:"events,omitempty"` Codespace string `protobuf:"bytes,8,opt,name=codespace,proto3" json:"codespace,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -2187,7 +1713,7 @@ func (m *ResponseDeliverTx) Reset() { *m = ResponseDeliverTx{} } func (m *ResponseDeliverTx) String() string { return proto.CompactTextString(m) } func (*ResponseDeliverTx) ProtoMessage() {} func (*ResponseDeliverTx) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{22} + return fileDescriptor_9f1eaa49c51fa1ac, []int{22} } func (m *ResponseDeliverTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2197,15 +1723,15 @@ func (m *ResponseDeliverTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_ResponseDeliverTx.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseDeliverTx) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseDeliverTx.Merge(dst, src) +func (m *ResponseDeliverTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseDeliverTx.Merge(m, src) } func (m *ResponseDeliverTx) XXX_Size() int { return m.Size() @@ -2273,9 +1799,9 @@ func (m *ResponseDeliverTx) GetCodespace() string { } type ResponseEndBlock struct { - ValidatorUpdates []ValidatorUpdate `protobuf:"bytes,1,rep,name=validator_updates,json=validatorUpdates" json:"validator_updates"` - ConsensusParamUpdates *ConsensusParams `protobuf:"bytes,2,opt,name=consensus_param_updates,json=consensusParamUpdates" json:"consensus_param_updates,omitempty"` - Events []Event `protobuf:"bytes,3,rep,name=events" json:"events,omitempty"` + ValidatorUpdates []ValidatorUpdate `protobuf:"bytes,1,rep,name=validator_updates,json=validatorUpdates,proto3" json:"validator_updates"` + ConsensusParamUpdates *ConsensusParams `protobuf:"bytes,2,opt,name=consensus_param_updates,json=consensusParamUpdates,proto3" json:"consensus_param_updates,omitempty"` + Events []Event `protobuf:"bytes,3,rep,name=events,proto3" json:"events,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2285,7 +1811,7 @@ func (m *ResponseEndBlock) Reset() { *m = ResponseEndBlock{} } func (m *ResponseEndBlock) String() string { return proto.CompactTextString(m) } func (*ResponseEndBlock) ProtoMessage() {} func (*ResponseEndBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{23} + return fileDescriptor_9f1eaa49c51fa1ac, []int{23} } func (m *ResponseEndBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2295,15 +1821,15 @@ func (m *ResponseEndBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return xxx_messageInfo_ResponseEndBlock.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseEndBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseEndBlock.Merge(dst, src) +func (m *ResponseEndBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseEndBlock.Merge(m, src) } func (m *ResponseEndBlock) XXX_Size() int { return m.Size() @@ -2347,7 +1873,7 @@ func (m *ResponseCommit) Reset() { *m = ResponseCommit{} } func (m *ResponseCommit) String() string { return proto.CompactTextString(m) } func (*ResponseCommit) ProtoMessage() {} func (*ResponseCommit) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{24} + return fileDescriptor_9f1eaa49c51fa1ac, []int{24} } func (m *ResponseCommit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2357,15 +1883,15 @@ func (m *ResponseCommit) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_ResponseCommit.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseCommit) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseCommit.Merge(dst, src) +func (m *ResponseCommit) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseCommit.Merge(m, src) } func (m *ResponseCommit) XXX_Size() int { return m.Size() @@ -2386,9 +1912,9 @@ func (m *ResponseCommit) GetData() []byte { // ConsensusParams contains all consensus-relevant parameters // that can be adjusted by the abci app type ConsensusParams struct { - Block *BlockParams `protobuf:"bytes,1,opt,name=block" json:"block,omitempty"` - Evidence *EvidenceParams `protobuf:"bytes,2,opt,name=evidence" json:"evidence,omitempty"` - Validator *ValidatorParams `protobuf:"bytes,3,opt,name=validator" json:"validator,omitempty"` + Block *BlockParams `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"` + Evidence *EvidenceParams `protobuf:"bytes,2,opt,name=evidence,proto3" json:"evidence,omitempty"` + Validator *ValidatorParams `protobuf:"bytes,3,opt,name=validator,proto3" json:"validator,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2398,7 +1924,7 @@ func (m *ConsensusParams) Reset() { *m = ConsensusParams{} } func (m *ConsensusParams) String() string { return proto.CompactTextString(m) } func (*ConsensusParams) ProtoMessage() {} func (*ConsensusParams) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{25} + return fileDescriptor_9f1eaa49c51fa1ac, []int{25} } func (m *ConsensusParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2408,15 +1934,15 @@ func (m *ConsensusParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_ConsensusParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ConsensusParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConsensusParams.Merge(dst, src) +func (m *ConsensusParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsensusParams.Merge(m, src) } func (m *ConsensusParams) XXX_Size() int { return m.Size() @@ -2463,7 +1989,7 @@ func (m *BlockParams) Reset() { *m = BlockParams{} } func (m *BlockParams) String() string { return proto.CompactTextString(m) } func (*BlockParams) ProtoMessage() {} func (*BlockParams) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{26} + return fileDescriptor_9f1eaa49c51fa1ac, []int{26} } func (m *BlockParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2473,15 +1999,15 @@ func (m *BlockParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_BlockParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *BlockParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockParams.Merge(dst, src) +func (m *BlockParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockParams.Merge(m, src) } func (m *BlockParams) XXX_Size() int { return m.Size() @@ -2519,7 +2045,7 @@ func (m *EvidenceParams) Reset() { *m = EvidenceParams{} } func (m *EvidenceParams) String() string { return proto.CompactTextString(m) } func (*EvidenceParams) ProtoMessage() {} func (*EvidenceParams) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{27} + return fileDescriptor_9f1eaa49c51fa1ac, []int{27} } func (m *EvidenceParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2529,15 +2055,15 @@ func (m *EvidenceParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_EvidenceParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *EvidenceParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_EvidenceParams.Merge(dst, src) +func (m *EvidenceParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_EvidenceParams.Merge(m, src) } func (m *EvidenceParams) XXX_Size() int { return m.Size() @@ -2557,7 +2083,7 @@ func (m *EvidenceParams) GetMaxAge() int64 { // ValidatorParams contains limits on validators. type ValidatorParams struct { - PubKeyTypes []string `protobuf:"bytes,1,rep,name=pub_key_types,json=pubKeyTypes" json:"pub_key_types,omitempty"` + PubKeyTypes []string `protobuf:"bytes,1,rep,name=pub_key_types,json=pubKeyTypes,proto3" json:"pub_key_types,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2567,7 +2093,7 @@ func (m *ValidatorParams) Reset() { *m = ValidatorParams{} } func (m *ValidatorParams) String() string { return proto.CompactTextString(m) } func (*ValidatorParams) ProtoMessage() {} func (*ValidatorParams) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{28} + return fileDescriptor_9f1eaa49c51fa1ac, []int{28} } func (m *ValidatorParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2577,15 +2103,15 @@ func (m *ValidatorParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_ValidatorParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ValidatorParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorParams.Merge(dst, src) +func (m *ValidatorParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorParams.Merge(m, src) } func (m *ValidatorParams) XXX_Size() int { return m.Size() @@ -2605,7 +2131,7 @@ func (m *ValidatorParams) GetPubKeyTypes() []string { type LastCommitInfo struct { Round int32 `protobuf:"varint,1,opt,name=round,proto3" json:"round,omitempty"` - Votes []VoteInfo `protobuf:"bytes,2,rep,name=votes" json:"votes"` + Votes []VoteInfo `protobuf:"bytes,2,rep,name=votes,proto3" json:"votes"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2615,7 +2141,7 @@ func (m *LastCommitInfo) Reset() { *m = LastCommitInfo{} } func (m *LastCommitInfo) String() string { return proto.CompactTextString(m) } func (*LastCommitInfo) ProtoMessage() {} func (*LastCommitInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{29} + return fileDescriptor_9f1eaa49c51fa1ac, []int{29} } func (m *LastCommitInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2625,15 +2151,15 @@ func (m *LastCommitInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_LastCommitInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *LastCommitInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_LastCommitInfo.Merge(dst, src) +func (m *LastCommitInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_LastCommitInfo.Merge(m, src) } func (m *LastCommitInfo) XXX_Size() int { return m.Size() @@ -2660,7 +2186,7 @@ func (m *LastCommitInfo) GetVotes() []VoteInfo { type Event struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Attributes []common.KVPair `protobuf:"bytes,2,rep,name=attributes" json:"attributes,omitempty"` + Attributes []common.KVPair `protobuf:"bytes,2,rep,name=attributes,proto3" json:"attributes,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2670,7 +2196,7 @@ func (m *Event) Reset() { *m = Event{} } func (m *Event) String() string { return proto.CompactTextString(m) } func (*Event) ProtoMessage() {} func (*Event) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{30} + return fileDescriptor_9f1eaa49c51fa1ac, []int{30} } func (m *Event) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2680,15 +2206,15 @@ func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Event.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Event) XXX_Merge(src proto.Message) { - xxx_messageInfo_Event.Merge(dst, src) +func (m *Event) XXX_Merge(src proto.Message) { + xxx_messageInfo_Event.Merge(m, src) } func (m *Event) XXX_Size() int { return m.Size() @@ -2715,14 +2241,14 @@ func (m *Event) GetAttributes() []common.KVPair { type Header struct { // basic block info - Version Version `protobuf:"bytes,1,opt,name=version" json:"version"` + Version Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version"` ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` - Time time.Time `protobuf:"bytes,4,opt,name=time,stdtime" json:"time"` + Time time.Time `protobuf:"bytes,4,opt,name=time,proto3,stdtime" json:"time"` NumTxs int64 `protobuf:"varint,5,opt,name=num_txs,json=numTxs,proto3" json:"num_txs,omitempty"` TotalTxs int64 `protobuf:"varint,6,opt,name=total_txs,json=totalTxs,proto3" json:"total_txs,omitempty"` // prev block info - LastBlockId BlockID `protobuf:"bytes,7,opt,name=last_block_id,json=lastBlockId" json:"last_block_id"` + LastBlockId BlockID `protobuf:"bytes,7,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` // hashes of block data LastCommitHash []byte `protobuf:"bytes,8,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` DataHash []byte `protobuf:"bytes,9,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` @@ -2744,7 +2270,7 @@ func (m *Header) Reset() { *m = Header{} } func (m *Header) String() string { return proto.CompactTextString(m) } func (*Header) ProtoMessage() {} func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{31} + return fileDescriptor_9f1eaa49c51fa1ac, []int{31} } func (m *Header) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2754,15 +2280,15 @@ func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Header.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Header) XXX_Merge(src proto.Message) { - xxx_messageInfo_Header.Merge(dst, src) +func (m *Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header.Merge(m, src) } func (m *Header) XXX_Size() int { return m.Size() @@ -2897,7 +2423,7 @@ func (m *Version) Reset() { *m = Version{} } func (m *Version) String() string { return proto.CompactTextString(m) } func (*Version) ProtoMessage() {} func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{32} + return fileDescriptor_9f1eaa49c51fa1ac, []int{32} } func (m *Version) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2907,15 +2433,15 @@ func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Version.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Version) XXX_Merge(src proto.Message) { - xxx_messageInfo_Version.Merge(dst, src) +func (m *Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_Version.Merge(m, src) } func (m *Version) XXX_Size() int { return m.Size() @@ -2942,7 +2468,7 @@ func (m *Version) GetApp() uint64 { type BlockID struct { Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - PartsHeader PartSetHeader `protobuf:"bytes,2,opt,name=parts_header,json=partsHeader" json:"parts_header"` + PartsHeader PartSetHeader `protobuf:"bytes,2,opt,name=parts_header,json=partsHeader,proto3" json:"parts_header"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2952,7 +2478,7 @@ func (m *BlockID) Reset() { *m = BlockID{} } func (m *BlockID) String() string { return proto.CompactTextString(m) } func (*BlockID) ProtoMessage() {} func (*BlockID) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{33} + return fileDescriptor_9f1eaa49c51fa1ac, []int{33} } func (m *BlockID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2962,15 +2488,15 @@ func (m *BlockID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_BlockID.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *BlockID) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockID.Merge(dst, src) +func (m *BlockID) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockID.Merge(m, src) } func (m *BlockID) XXX_Size() int { return m.Size() @@ -3007,7 +2533,7 @@ func (m *PartSetHeader) Reset() { *m = PartSetHeader{} } func (m *PartSetHeader) String() string { return proto.CompactTextString(m) } func (*PartSetHeader) ProtoMessage() {} func (*PartSetHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{34} + return fileDescriptor_9f1eaa49c51fa1ac, []int{34} } func (m *PartSetHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3017,15 +2543,15 @@ func (m *PartSetHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_PartSetHeader.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *PartSetHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_PartSetHeader.Merge(dst, src) +func (m *PartSetHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_PartSetHeader.Merge(m, src) } func (m *PartSetHeader) XXX_Size() int { return m.Size() @@ -3053,7 +2579,7 @@ func (m *PartSetHeader) GetHash() []byte { // Validator type Validator struct { Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // PubKey pub_key = 2 [(gogoproto.nullable)=false]; + //PubKey pub_key = 2 [(gogoproto.nullable)=false]; Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -3064,7 +2590,7 @@ func (m *Validator) Reset() { *m = Validator{} } func (m *Validator) String() string { return proto.CompactTextString(m) } func (*Validator) ProtoMessage() {} func (*Validator) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{35} + return fileDescriptor_9f1eaa49c51fa1ac, []int{35} } func (m *Validator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3074,15 +2600,15 @@ func (m *Validator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Validator.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Validator) XXX_Merge(src proto.Message) { - xxx_messageInfo_Validator.Merge(dst, src) +func (m *Validator) XXX_Merge(src proto.Message) { + xxx_messageInfo_Validator.Merge(m, src) } func (m *Validator) XXX_Size() int { return m.Size() @@ -3109,7 +2635,7 @@ func (m *Validator) GetPower() int64 { // ValidatorUpdate type ValidatorUpdate struct { - PubKey PubKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey" json:"pub_key"` + PubKey PubKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"` Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -3120,7 +2646,7 @@ func (m *ValidatorUpdate) Reset() { *m = ValidatorUpdate{} } func (m *ValidatorUpdate) String() string { return proto.CompactTextString(m) } func (*ValidatorUpdate) ProtoMessage() {} func (*ValidatorUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{36} + return fileDescriptor_9f1eaa49c51fa1ac, []int{36} } func (m *ValidatorUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3130,15 +2656,15 @@ func (m *ValidatorUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_ValidatorUpdate.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ValidatorUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorUpdate.Merge(dst, src) +func (m *ValidatorUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorUpdate.Merge(m, src) } func (m *ValidatorUpdate) XXX_Size() int { return m.Size() @@ -3165,7 +2691,7 @@ func (m *ValidatorUpdate) GetPower() int64 { // VoteInfo type VoteInfo struct { - Validator Validator `protobuf:"bytes,1,opt,name=validator" json:"validator"` + Validator Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator"` SignedLastBlock bool `protobuf:"varint,2,opt,name=signed_last_block,json=signedLastBlock,proto3" json:"signed_last_block,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -3176,7 +2702,7 @@ func (m *VoteInfo) Reset() { *m = VoteInfo{} } func (m *VoteInfo) String() string { return proto.CompactTextString(m) } func (*VoteInfo) ProtoMessage() {} func (*VoteInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{37} + return fileDescriptor_9f1eaa49c51fa1ac, []int{37} } func (m *VoteInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3186,15 +2712,15 @@ func (m *VoteInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_VoteInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *VoteInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_VoteInfo.Merge(dst, src) +func (m *VoteInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_VoteInfo.Merge(m, src) } func (m *VoteInfo) XXX_Size() int { return m.Size() @@ -3231,7 +2757,7 @@ func (m *PubKey) Reset() { *m = PubKey{} } func (m *PubKey) String() string { return proto.CompactTextString(m) } func (*PubKey) ProtoMessage() {} func (*PubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{38} + return fileDescriptor_9f1eaa49c51fa1ac, []int{38} } func (m *PubKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3241,15 +2767,15 @@ func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_PubKey.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *PubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PubKey.Merge(dst, src) +func (m *PubKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_PubKey.Merge(m, src) } func (m *PubKey) XXX_Size() int { return m.Size() @@ -3276,9 +2802,9 @@ func (m *PubKey) GetData() []byte { type Evidence struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Validator Validator `protobuf:"bytes,2,opt,name=validator" json:"validator"` + Validator Validator `protobuf:"bytes,2,opt,name=validator,proto3" json:"validator"` Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` - Time time.Time `protobuf:"bytes,4,opt,name=time,stdtime" json:"time"` + Time time.Time `protobuf:"bytes,4,opt,name=time,proto3,stdtime" json:"time"` TotalVotingPower int64 `protobuf:"varint,5,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -3289,7 +2815,7 @@ func (m *Evidence) Reset() { *m = Evidence{} } func (m *Evidence) String() string { return proto.CompactTextString(m) } func (*Evidence) ProtoMessage() {} func (*Evidence) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{39} + return fileDescriptor_9f1eaa49c51fa1ac, []int{39} } func (m *Evidence) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3299,15 +2825,15 @@ func (m *Evidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Evidence.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Evidence) XXX_Merge(src proto.Message) { - xxx_messageInfo_Evidence.Merge(dst, src) +func (m *Evidence) XXX_Merge(src proto.Message) { + xxx_messageInfo_Evidence.Merge(m, src) } func (m *Evidence) XXX_Size() int { return m.Size() @@ -3354,6 +2880,8 @@ func (m *Evidence) GetTotalVotingPower() int64 { } func init() { + proto.RegisterEnum("types.CheckTxType", CheckTxType_name, CheckTxType_value) + golang_proto.RegisterEnum("types.CheckTxType", CheckTxType_name, CheckTxType_value) proto.RegisterType((*Request)(nil), "types.Request") golang_proto.RegisterType((*Request)(nil), "types.Request") proto.RegisterType((*RequestEcho)(nil), "types.RequestEcho") @@ -3434,9 +2962,158 @@ func init() { golang_proto.RegisterType((*PubKey)(nil), "types.PubKey") proto.RegisterType((*Evidence)(nil), "types.Evidence") golang_proto.RegisterType((*Evidence)(nil), "types.Evidence") - proto.RegisterEnum("types.CheckTxType", CheckTxType_name, CheckTxType_value) - golang_proto.RegisterEnum("types.CheckTxType", CheckTxType_name, CheckTxType_value) } + +func init() { proto.RegisterFile("abci/types/types.proto", fileDescriptor_9f1eaa49c51fa1ac) } +func init() { golang_proto.RegisterFile("abci/types/types.proto", fileDescriptor_9f1eaa49c51fa1ac) } + +var fileDescriptor_9f1eaa49c51fa1ac = []byte{ + // 2279 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xcd, 0x73, 0x1c, 0x47, + 0x15, 0xd7, 0xec, 0xf7, 0xbc, 0xd5, 0x7e, 0xb8, 0x2d, 0xdb, 0xeb, 0xc5, 0x48, 0xae, 0x31, 0x38, + 0x52, 0xe2, 0xac, 0x12, 0x05, 0x53, 0x32, 0x0e, 0xa9, 0xd2, 0xda, 0x06, 0xa9, 0x62, 0x82, 0x18, + 0xdb, 0xe2, 0x42, 0xd5, 0x54, 0xef, 0x4e, 0x7b, 0x77, 0xca, 0xbb, 0x33, 0x93, 0x99, 0x5e, 0x79, + 0xc5, 0x91, 0x73, 0x0e, 0x39, 0xf0, 0x27, 0x70, 0xe0, 0x4f, 0xc8, 0x91, 0x13, 0x95, 0x23, 0x07, + 0xce, 0x06, 0x44, 0x71, 0xa1, 0x8a, 0x33, 0x70, 0xa3, 0xfa, 0x75, 0xcf, 0xa7, 0x66, 0x4d, 0x62, + 0xb8, 0xe5, 0x22, 0x4d, 0xf7, 0xfb, 0xbd, 0xde, 0x7e, 0xdd, 0xef, 0xbd, 0xdf, 0x7b, 0x0d, 0x57, + 0xe9, 0x68, 0xec, 0xec, 0xf2, 0x33, 0x9f, 0x85, 0xf2, 0xef, 0xc0, 0x0f, 0x3c, 0xee, 0x91, 0x2a, + 0x0e, 0xfa, 0xef, 0x4e, 0x1c, 0x3e, 0x5d, 0x8c, 0x06, 0x63, 0x6f, 0xbe, 0x3b, 0xf1, 0x26, 0xde, + 0x2e, 0x4a, 0x47, 0x8b, 0xe7, 0x38, 0xc2, 0x01, 0x7e, 0x49, 0xad, 0xfe, 0xfd, 0x14, 0x9c, 0x33, + 0xd7, 0x66, 0xc1, 0xdc, 0x71, 0x79, 0xfa, 0x73, 0x1c, 0x9c, 0xf9, 0xdc, 0xdb, 0x9d, 0xb3, 0xe0, + 0xc5, 0x8c, 0xa9, 0x7f, 0x4a, 0x79, 0xff, 0xbf, 0x2a, 0xcf, 0x9c, 0x51, 0xb8, 0x3b, 0xf6, 0xe6, + 0x73, 0xcf, 0x4d, 0x6f, 0xb6, 0xbf, 0x35, 0xf1, 0xbc, 0xc9, 0x8c, 0x25, 0x9b, 0xe3, 0xce, 0x9c, + 0x85, 0x9c, 0xce, 0x7d, 0x09, 0x30, 0x7e, 0x5f, 0x81, 0xba, 0xc9, 0x3e, 0x5d, 0xb0, 0x90, 0x93, + 0x6d, 0xa8, 0xb0, 0xf1, 0xd4, 0xeb, 0x95, 0x6e, 0x6a, 0xdb, 0xcd, 0x3d, 0x32, 0x90, 0x0b, 0x29, + 0xe9, 0xa3, 0xf1, 0xd4, 0x3b, 0x5c, 0x33, 0x11, 0x41, 0xde, 0x81, 0xea, 0xf3, 0xd9, 0x22, 0x9c, + 0xf6, 0xca, 0x08, 0xbd, 0x9c, 0x85, 0xfe, 0x48, 0x88, 0x0e, 0xd7, 0x4c, 0x89, 0x11, 0xcb, 0x3a, + 0xee, 0x73, 0xaf, 0x57, 0x29, 0x5a, 0xf6, 0xc8, 0x7d, 0x8e, 0xcb, 0x0a, 0x04, 0xd9, 0x07, 0x08, + 0x19, 0xb7, 0x3c, 0x9f, 0x3b, 0x9e, 0xdb, 0xab, 0x22, 0xfe, 0x5a, 0x16, 0xff, 0x84, 0xf1, 0x9f, + 0xa2, 0xf8, 0x70, 0xcd, 0xd4, 0xc3, 0x68, 0x20, 0x34, 0x1d, 0xd7, 0xe1, 0xd6, 0x78, 0x4a, 0x1d, + 0xb7, 0x57, 0x2b, 0xd2, 0x3c, 0x72, 0x1d, 0xfe, 0x40, 0x88, 0x85, 0xa6, 0x13, 0x0d, 0x84, 0x29, + 0x9f, 0x2e, 0x58, 0x70, 0xd6, 0xab, 0x17, 0x99, 0xf2, 0x33, 0x21, 0x12, 0xa6, 0x20, 0x86, 0xdc, + 0x87, 0xe6, 0x88, 0x4d, 0x1c, 0xd7, 0x1a, 0xcd, 0xbc, 0xf1, 0x8b, 0x5e, 0x03, 0x55, 0x7a, 0x59, + 0x95, 0xa1, 0x00, 0x0c, 0x85, 0xfc, 0x70, 0xcd, 0x84, 0x51, 0x3c, 0x22, 0x7b, 0xd0, 0x18, 0x4f, + 0xd9, 0xf8, 0x85, 0xc5, 0x97, 0x3d, 0x1d, 0x35, 0xaf, 0x64, 0x35, 0x1f, 0x08, 0xe9, 0xd3, 0xe5, + 0xe1, 0x9a, 0x59, 0x1f, 0xcb, 0x4f, 0x61, 0x97, 0xcd, 0x66, 0xce, 0x29, 0x0b, 0x84, 0xd6, 0xe5, + 0x22, 0xbb, 0x1e, 0x4a, 0x39, 0xea, 0xe9, 0x76, 0x34, 0x20, 0x77, 0x41, 0x67, 0xae, 0xad, 0x36, + 0xda, 0x44, 0xc5, 0xab, 0xb9, 0x1b, 0x75, 0xed, 0x68, 0x9b, 0x0d, 0xa6, 0xbe, 0xc9, 0x00, 0x6a, + 0xc2, 0x8d, 0x1c, 0xde, 0x5b, 0x47, 0x9d, 0x8d, 0xdc, 0x16, 0x51, 0x76, 0xb8, 0x66, 0x2a, 0xd4, + 0xb0, 0x0e, 0xd5, 0x53, 0x3a, 0x5b, 0x30, 0xe3, 0x2d, 0x68, 0xa6, 0x3c, 0x85, 0xf4, 0xa0, 0x3e, + 0x67, 0x61, 0x48, 0x27, 0xac, 0xa7, 0xdd, 0xd4, 0xb6, 0x75, 0x33, 0x1a, 0x1a, 0x6d, 0x58, 0x4f, + 0xfb, 0x89, 0x31, 0x8f, 0x15, 0x85, 0x2f, 0x08, 0xc5, 0x53, 0x16, 0x84, 0xc2, 0x01, 0x94, 0xa2, + 0x1a, 0x92, 0x5b, 0xd0, 0x42, 0x6b, 0xac, 0x48, 0x2e, 0xfc, 0xb4, 0x62, 0xae, 0xe3, 0xe4, 0x89, + 0x02, 0x6d, 0x41, 0xd3, 0xdf, 0xf3, 0x63, 0x48, 0x19, 0x21, 0xe0, 0xef, 0xf9, 0x0a, 0x60, 0xfc, + 0x00, 0xba, 0x79, 0x57, 0x22, 0x5d, 0x28, 0xbf, 0x60, 0x67, 0xea, 0xf7, 0xc4, 0x27, 0xd9, 0x50, + 0x66, 0xe1, 0x6f, 0xe8, 0xa6, 0xb2, 0xf1, 0xf3, 0x52, 0xac, 0x1c, 0x7b, 0x13, 0xd9, 0x87, 0x8a, + 0x08, 0x2a, 0xd4, 0x6e, 0xee, 0xf5, 0x07, 0x32, 0xe2, 0x06, 0x51, 0xc4, 0x0d, 0x9e, 0x46, 0x11, + 0x37, 0x6c, 0x7c, 0xf9, 0x6a, 0x6b, 0xed, 0xf3, 0x3f, 0x6d, 0x69, 0x26, 0x6a, 0x90, 0xeb, 0xc2, + 0x21, 0xa8, 0xe3, 0x5a, 0x8e, 0xad, 0x7e, 0xa7, 0x8e, 0xe3, 0x23, 0x9b, 0x1c, 0x40, 0x77, 0xec, + 0xb9, 0x21, 0x73, 0xc3, 0x45, 0x68, 0xf9, 0x34, 0xa0, 0xf3, 0x50, 0xc5, 0x5a, 0x74, 0x89, 0x0f, + 0x22, 0xf1, 0x31, 0x4a, 0xcd, 0xce, 0x38, 0x3b, 0x41, 0x3e, 0x04, 0x38, 0xa5, 0x33, 0xc7, 0xa6, + 0xdc, 0x0b, 0xc2, 0x5e, 0xe5, 0x66, 0x39, 0xa5, 0x7c, 0x12, 0x09, 0x9e, 0xf9, 0x36, 0xe5, 0x6c, + 0x58, 0x11, 0x3b, 0x33, 0x53, 0x78, 0x72, 0x1b, 0x3a, 0xd4, 0xf7, 0xad, 0x90, 0x53, 0xce, 0xac, + 0xd1, 0x19, 0x67, 0x21, 0xc6, 0xe3, 0xba, 0xd9, 0xa2, 0xbe, 0xff, 0x44, 0xcc, 0x0e, 0xc5, 0xa4, + 0x61, 0xc7, 0xb7, 0x89, 0xa1, 0x42, 0x08, 0x54, 0x6c, 0xca, 0x29, 0x9e, 0xc6, 0xba, 0x89, 0xdf, + 0x62, 0xce, 0xa7, 0x7c, 0xaa, 0x6c, 0xc4, 0x6f, 0x72, 0x15, 0x6a, 0x53, 0xe6, 0x4c, 0xa6, 0x1c, + 0xcd, 0x2a, 0x9b, 0x6a, 0x24, 0x0e, 0xde, 0x0f, 0xbc, 0x53, 0x86, 0xd9, 0xa2, 0x61, 0xca, 0x81, + 0xf1, 0x37, 0x0d, 0x2e, 0x5d, 0x08, 0x2f, 0xb1, 0xee, 0x94, 0x86, 0xd3, 0xe8, 0xb7, 0xc4, 0x37, + 0x79, 0x47, 0xac, 0x4b, 0x6d, 0x16, 0xa8, 0x2c, 0xd6, 0x52, 0x16, 0x1f, 0xe2, 0xa4, 0x32, 0x54, + 0x41, 0xc8, 0x23, 0xe8, 0xce, 0x68, 0xc8, 0x2d, 0xe9, 0xcb, 0x16, 0x66, 0xa9, 0x72, 0x26, 0x32, + 0x1f, 0xd3, 0xc8, 0xe7, 0x85, 0x73, 0x2a, 0xf5, 0xf6, 0x2c, 0x33, 0x4b, 0x0e, 0x61, 0x63, 0x74, + 0xf6, 0x4b, 0xea, 0x72, 0xc7, 0x65, 0xd6, 0x85, 0x33, 0xef, 0xa8, 0xa5, 0x1e, 0x9d, 0x3a, 0x36, + 0x73, 0xc7, 0xd1, 0x61, 0x5f, 0x8e, 0x55, 0xe2, 0xcb, 0x08, 0x8d, 0x43, 0x68, 0x67, 0x73, 0x01, + 0x69, 0x43, 0x89, 0x2f, 0x95, 0x85, 0x25, 0xbe, 0x24, 0xb7, 0xa1, 0x22, 0x96, 0x43, 0xeb, 0xda, + 0x71, 0x32, 0x55, 0xe8, 0xa7, 0x67, 0x3e, 0x33, 0x51, 0x6e, 0x18, 0xb1, 0xa7, 0xc6, 0xf9, 0x21, + 0xbf, 0x96, 0xb1, 0x03, 0x9d, 0x5c, 0x2a, 0x48, 0x5d, 0x8b, 0x96, 0xbe, 0x16, 0xa3, 0x03, 0xad, + 0x4c, 0x06, 0x30, 0x3e, 0xab, 0x42, 0xc3, 0x64, 0xa1, 0x2f, 0x9c, 0x8e, 0xec, 0x83, 0xce, 0x96, + 0x63, 0x26, 0xd3, 0xb6, 0x96, 0x4b, 0x8a, 0x12, 0xf3, 0x28, 0x92, 0x8b, 0x2c, 0x15, 0x83, 0xc9, + 0x4e, 0x86, 0x72, 0x2e, 0xe7, 0x95, 0xd2, 0x9c, 0x73, 0x27, 0xcb, 0x39, 0x1b, 0x39, 0x6c, 0x8e, + 0x74, 0x76, 0x32, 0xa4, 0x93, 0x5f, 0x38, 0xc3, 0x3a, 0xf7, 0x0a, 0x58, 0x27, 0xbf, 0xfd, 0x15, + 0xb4, 0x73, 0xaf, 0x80, 0x76, 0x7a, 0x17, 0x7e, 0xab, 0x90, 0x77, 0xee, 0x64, 0x79, 0x27, 0x6f, + 0x4e, 0x8e, 0x78, 0x3e, 0x2c, 0x22, 0x9e, 0xeb, 0x39, 0x9d, 0x95, 0xcc, 0xf3, 0xc1, 0x05, 0xe6, + 0xb9, 0x9a, 0x53, 0x2d, 0xa0, 0x9e, 0x7b, 0x19, 0xea, 0x81, 0x42, 0xdb, 0x56, 0x70, 0xcf, 0xf7, + 0x2f, 0x72, 0xcf, 0xb5, 0xfc, 0xd5, 0x16, 0x91, 0xcf, 0x6e, 0x8e, 0x7c, 0xae, 0xe4, 0x77, 0xb9, + 0x92, 0x7d, 0x76, 0x44, 0x7e, 0xc8, 0x79, 0x9a, 0xc8, 0x25, 0x2c, 0x08, 0xbc, 0x40, 0x25, 0x76, + 0x39, 0x30, 0xb6, 0x45, 0xc6, 0x4a, 0xfc, 0xeb, 0x35, 0x4c, 0x85, 0x4e, 0x9f, 0xf2, 0x2e, 0xe3, + 0x0b, 0x2d, 0xd1, 0xc5, 0xc8, 0x4f, 0x67, 0x3b, 0x5d, 0x65, 0xbb, 0x14, 0x81, 0x95, 0xb2, 0x04, + 0xb6, 0x05, 0x4d, 0x91, 0x53, 0x73, 0xdc, 0x44, 0xfd, 0x88, 0x9b, 0xc8, 0xdb, 0x70, 0x09, 0xf3, + 0x91, 0xa4, 0x39, 0x15, 0x88, 0x15, 0x0c, 0xc4, 0x8e, 0x10, 0xc8, 0x13, 0x93, 0x89, 0xf2, 0x5d, + 0xb8, 0x9c, 0xc2, 0x8a, 0x75, 0x31, 0x17, 0xca, 0x24, 0xdd, 0x8d, 0xd1, 0x07, 0xbe, 0x7f, 0x48, + 0xc3, 0xa9, 0xf1, 0x93, 0xe4, 0x80, 0x12, 0xde, 0x23, 0x50, 0x19, 0x7b, 0xb6, 0xb4, 0xbb, 0x65, + 0xe2, 0xb7, 0xe0, 0xc2, 0x99, 0x37, 0xc1, 0xcd, 0xe9, 0xa6, 0xf8, 0x14, 0xa8, 0x38, 0x94, 0x74, + 0x19, 0x33, 0xc6, 0xaf, 0xb5, 0x64, 0xbd, 0x84, 0x0a, 0x8b, 0x58, 0x4b, 0xfb, 0x5f, 0x58, 0xab, + 0xf4, 0xf5, 0x58, 0xcb, 0x38, 0xd7, 0x92, 0x2b, 0x8b, 0xf9, 0xe8, 0xcd, 0x4c, 0x14, 0xde, 0xe3, + 0xb8, 0x36, 0x5b, 0xe2, 0x91, 0x96, 0x4d, 0x39, 0x88, 0x4a, 0x85, 0x1a, 0x1e, 0x73, 0xb6, 0x54, + 0xa8, 0xe3, 0x9c, 0x1c, 0x90, 0x5b, 0xc8, 0x63, 0xde, 0x73, 0x15, 0xaa, 0xad, 0x81, 0x2a, 0xe8, + 0x8f, 0xc5, 0xa4, 0x29, 0x65, 0xa9, 0x6c, 0xab, 0x67, 0x48, 0xf0, 0x06, 0xe8, 0x62, 0xa3, 0xa1, + 0x4f, 0xc7, 0x0c, 0x23, 0x4f, 0x37, 0x93, 0x09, 0xe3, 0x29, 0x90, 0x8b, 0x11, 0x4f, 0x3e, 0x82, + 0x1a, 0x3b, 0x65, 0x2e, 0x17, 0x27, 0x2e, 0x0e, 0x6d, 0x3d, 0xa6, 0x1d, 0xe6, 0xf2, 0x61, 0x4f, + 0x1c, 0xd5, 0xdf, 0x5f, 0x6d, 0x75, 0x25, 0xe6, 0x8e, 0x37, 0x77, 0x38, 0x9b, 0xfb, 0xfc, 0xcc, + 0x54, 0x5a, 0xc6, 0x3f, 0x35, 0xc1, 0x06, 0x99, 0x6c, 0x50, 0x78, 0x78, 0x91, 0xcb, 0x97, 0x52, + 0x04, 0xff, 0xd5, 0x0e, 0xf4, 0xdb, 0x00, 0x13, 0x1a, 0x5a, 0x2f, 0xa9, 0xcb, 0x99, 0xad, 0x4e, + 0x55, 0x9f, 0xd0, 0xf0, 0xe7, 0x38, 0x21, 0xaa, 0x21, 0x21, 0x5e, 0x84, 0xcc, 0xc6, 0xe3, 0x2d, + 0x9b, 0xf5, 0x09, 0x0d, 0x9f, 0x85, 0xcc, 0x4e, 0xd9, 0x56, 0x7f, 0x13, 0xdb, 0xb2, 0xe7, 0xd9, + 0xc8, 0x9f, 0xe7, 0xbf, 0x53, 0xbe, 0x9c, 0x90, 0xe5, 0x37, 0xc3, 0xf6, 0x7f, 0x68, 0xa2, 0x4e, + 0xc8, 0xa6, 0x64, 0x72, 0x04, 0x97, 0xe2, 0x98, 0xb2, 0x16, 0x18, 0x6b, 0x91, 0x57, 0xbd, 0x3e, + 0x14, 0xbb, 0xa7, 0xd9, 0xe9, 0x90, 0x7c, 0x02, 0xd7, 0x72, 0x19, 0x21, 0x5e, 0xb0, 0xf4, 0xda, + 0xc4, 0x70, 0x25, 0x9b, 0x18, 0xa2, 0xf5, 0x92, 0xd3, 0x28, 0xbf, 0x91, 0x97, 0x7f, 0x47, 0x14, + 0x58, 0x69, 0x32, 0x29, 0xba, 0x53, 0xe3, 0x37, 0x1a, 0x74, 0x72, 0x1b, 0x22, 0xdb, 0x50, 0x95, + 0x7c, 0xa6, 0x65, 0xda, 0x58, 0x3c, 0x31, 0xb5, 0x67, 0x09, 0x20, 0xef, 0x43, 0x83, 0xa9, 0x5a, + 0x4f, 0x19, 0x79, 0x25, 0x57, 0x02, 0x2a, 0x7c, 0x0c, 0x23, 0xdf, 0x03, 0x3d, 0x3e, 0xba, 0x5c, + 0x9d, 0x1f, 0x9f, 0xb4, 0x52, 0x4a, 0x80, 0xc6, 0x03, 0x68, 0xa6, 0x7e, 0x9e, 0x7c, 0x0b, 0xf4, + 0x39, 0x5d, 0xaa, 0x62, 0x5d, 0x96, 0x6f, 0x8d, 0x39, 0x5d, 0x62, 0x9d, 0x4e, 0xae, 0x41, 0x5d, + 0x08, 0x27, 0x54, 0x1e, 0x7c, 0xd9, 0xac, 0xcd, 0xe9, 0xf2, 0xc7, 0x34, 0x34, 0x76, 0xa0, 0x9d, + 0xdd, 0x56, 0x04, 0x8d, 0x08, 0x51, 0x42, 0x0f, 0x26, 0xcc, 0xb8, 0x0b, 0x9d, 0xdc, 0x6e, 0x88, + 0x01, 0x2d, 0x7f, 0x31, 0xb2, 0x5e, 0xb0, 0x33, 0x0b, 0xb7, 0x8b, 0x6e, 0xa2, 0x9b, 0x4d, 0x7f, + 0x31, 0xfa, 0x98, 0x9d, 0x89, 0x7a, 0x34, 0x34, 0x9e, 0x40, 0x3b, 0x5b, 0x46, 0x8b, 0x94, 0x19, + 0x78, 0x0b, 0xd7, 0xc6, 0xf5, 0xab, 0xa6, 0x1c, 0x88, 0x4e, 0xfc, 0xd4, 0x93, 0x9e, 0x91, 0xae, + 0x9b, 0x4f, 0x3c, 0xce, 0x52, 0xc5, 0xb7, 0xc4, 0x18, 0x0e, 0x54, 0xf1, 0xce, 0xc5, 0xfd, 0x61, + 0x41, 0xac, 0x28, 0x58, 0x7c, 0x93, 0xc7, 0x00, 0x94, 0xf3, 0xc0, 0x19, 0x2d, 0x92, 0xe5, 0xda, + 0x03, 0xf9, 0x3c, 0x32, 0xf8, 0xf8, 0xe4, 0x98, 0x3a, 0xc1, 0xf0, 0x86, 0xf2, 0x95, 0x8d, 0x04, + 0x99, 0xf2, 0x97, 0x94, 0xbe, 0xf1, 0xab, 0x2a, 0xd4, 0x64, 0xfb, 0x40, 0x06, 0xd9, 0xe6, 0x54, + 0xac, 0xaa, 0x36, 0x29, 0x67, 0xd5, 0x1e, 0x63, 0xc6, 0xbf, 0x9d, 0xef, 0xf0, 0x86, 0xcd, 0xf3, + 0x57, 0x5b, 0x75, 0x64, 0xcb, 0xa3, 0x87, 0x49, 0xbb, 0xb7, 0xaa, 0x1b, 0x8a, 0x7a, 0xcb, 0xca, + 0xd7, 0xee, 0x2d, 0xaf, 0x41, 0xdd, 0x5d, 0xcc, 0x2d, 0xbe, 0x0c, 0x55, 0xb6, 0xa9, 0xb9, 0x8b, + 0xf9, 0xd3, 0x25, 0x7a, 0x09, 0xf7, 0x38, 0x9d, 0xa1, 0x48, 0xe6, 0x9a, 0x06, 0x4e, 0x08, 0xe1, + 0x3e, 0xb4, 0x52, 0x45, 0x85, 0x63, 0xab, 0xe2, 0xb4, 0x9d, 0x76, 0xf6, 0xa3, 0x87, 0xca, 0xca, + 0x66, 0x5c, 0x64, 0x1c, 0xd9, 0x64, 0x3b, 0xdb, 0x4a, 0x61, 0x2d, 0xd2, 0xc0, 0x90, 0x4a, 0x75, + 0x4b, 0xa2, 0x12, 0x11, 0x1b, 0x10, 0x41, 0x26, 0x21, 0x3a, 0x42, 0x1a, 0x62, 0x02, 0x85, 0x6f, + 0x41, 0x27, 0xa1, 0x73, 0x09, 0x01, 0xb9, 0x4a, 0x32, 0x8d, 0xc0, 0xf7, 0x60, 0xc3, 0x65, 0x4b, + 0x6e, 0xe5, 0xd1, 0x4d, 0x44, 0x13, 0x21, 0x3b, 0xc9, 0x6a, 0x7c, 0x17, 0xda, 0x49, 0x2a, 0x42, + 0xec, 0xba, 0x6c, 0x68, 0xe3, 0x59, 0x84, 0x5d, 0x87, 0x46, 0x5c, 0x4c, 0xb5, 0x10, 0x50, 0xa7, + 0xb2, 0x86, 0x8a, 0xcb, 0xb3, 0x80, 0x85, 0x8b, 0x19, 0x57, 0x8b, 0xb4, 0x11, 0x83, 0xe5, 0x99, + 0x29, 0xe7, 0x11, 0x7b, 0x0b, 0x5a, 0x51, 0x74, 0x4b, 0x5c, 0x07, 0x71, 0xeb, 0xd1, 0x24, 0x82, + 0x76, 0xa0, 0xeb, 0x07, 0x9e, 0xef, 0x85, 0x2c, 0xb0, 0xa8, 0x6d, 0x07, 0x2c, 0x0c, 0x7b, 0x5d, + 0xb9, 0x5e, 0x34, 0x7f, 0x20, 0xa7, 0x8d, 0xf7, 0xa1, 0x1e, 0x55, 0x89, 0x1b, 0x50, 0x1d, 0xc6, + 0x99, 0xa8, 0x62, 0xca, 0x81, 0xe0, 0xa1, 0x03, 0xdf, 0x57, 0x6f, 0x22, 0xe2, 0xd3, 0xf8, 0x05, + 0xd4, 0xd5, 0x85, 0x15, 0x76, 0xca, 0x3f, 0x84, 0x75, 0x9f, 0x06, 0xc2, 0x8c, 0x74, 0xbf, 0x1c, + 0xf5, 0x21, 0xc7, 0x34, 0xe0, 0x4f, 0x18, 0xcf, 0xb4, 0xcd, 0x4d, 0xc4, 0xcb, 0x29, 0xe3, 0x1e, + 0xb4, 0x32, 0x18, 0xb1, 0x2d, 0xf4, 0xa3, 0x28, 0xa8, 0x71, 0x10, 0xff, 0x72, 0x29, 0xf9, 0x65, + 0xe3, 0x3e, 0xe8, 0xf1, 0xdd, 0x88, 0x72, 0x39, 0x32, 0x5d, 0x53, 0xc7, 0x2d, 0x87, 0xf8, 0x14, + 0xe0, 0xbd, 0x64, 0x81, 0x8a, 0x09, 0x39, 0x30, 0x9e, 0xa5, 0x92, 0x90, 0x64, 0x05, 0x72, 0x07, + 0xea, 0x2a, 0x09, 0xa9, 0xa8, 0x8c, 0x9a, 0xfe, 0x63, 0xcc, 0x42, 0x51, 0xd3, 0x2f, 0x73, 0x52, + 0xb2, 0x6c, 0x29, 0xbd, 0xec, 0x0c, 0x1a, 0x51, 0xa2, 0xc9, 0x66, 0x63, 0xb9, 0x62, 0x37, 0x9f, + 0x8d, 0xd5, 0xa2, 0x09, 0x50, 0x78, 0x47, 0xe8, 0x4c, 0x5c, 0x66, 0x5b, 0x49, 0x08, 0xe1, 0x6f, + 0x34, 0xcc, 0x8e, 0x14, 0x3c, 0x8e, 0xe2, 0xc5, 0x78, 0x0f, 0x6a, 0x72, 0x6f, 0x85, 0xe9, 0xab, + 0x88, 0x92, 0xfe, 0xa8, 0x41, 0x23, 0xca, 0xd3, 0x85, 0x4a, 0x99, 0x4d, 0x97, 0xbe, 0xea, 0xa6, + 0xff, 0xff, 0x89, 0xe7, 0x0e, 0x10, 0x99, 0x5f, 0x4e, 0x3d, 0xee, 0xb8, 0x13, 0x4b, 0x9e, 0xb5, + 0xcc, 0x41, 0x5d, 0x94, 0x9c, 0xa0, 0xe0, 0x58, 0xcc, 0xbf, 0x7d, 0x0b, 0x9a, 0xa9, 0xb7, 0x0b, + 0x52, 0x87, 0xf2, 0x27, 0xec, 0x65, 0x77, 0x8d, 0x34, 0xa1, 0x6e, 0x32, 0xec, 0x44, 0xbb, 0xda, + 0xde, 0x67, 0x55, 0xe8, 0x1c, 0x0c, 0x1f, 0x1c, 0x1d, 0xf8, 0xfe, 0xcc, 0x19, 0x53, 0x6c, 0x5d, + 0x76, 0xa1, 0x82, 0xdd, 0x5b, 0xc1, 0x2b, 0x75, 0xbf, 0xe8, 0x19, 0x81, 0xec, 0x41, 0x15, 0x9b, + 0x38, 0x52, 0xf4, 0x58, 0xdd, 0x2f, 0x7c, 0x4d, 0x10, 0x3f, 0x22, 0xdb, 0xbc, 0x8b, 0x6f, 0xd6, + 0xfd, 0xa2, 0x27, 0x05, 0xf2, 0x11, 0xe8, 0x49, 0x77, 0xb5, 0xea, 0xe5, 0xba, 0xbf, 0xf2, 0x71, + 0x41, 0xe8, 0x27, 0x15, 0xe8, 0xaa, 0x77, 0xde, 0xfe, 0xca, 0x2e, 0x9c, 0xec, 0x43, 0x3d, 0xaa, + 0xdd, 0x8b, 0xdf, 0x96, 0xfb, 0x2b, 0x1a, 0x7f, 0x71, 0x3c, 0xb2, 0x61, 0x2a, 0x7a, 0x00, 0xef, + 0x17, 0xbe, 0x4e, 0x90, 0xbb, 0x50, 0x53, 0x45, 0x54, 0xe1, 0x2b, 0x71, 0xbf, 0xb8, 0x7d, 0x17, + 0x46, 0x26, 0x2d, 0xe3, 0xaa, 0x47, 0xfa, 0xfe, 0xca, 0x67, 0x14, 0x72, 0x00, 0x90, 0xea, 0x7b, + 0x56, 0xbe, 0xbe, 0xf7, 0x57, 0x3f, 0x8f, 0x90, 0xfb, 0xd0, 0x48, 0x9e, 0xbc, 0x8a, 0x5f, 0xc5, + 0xfb, 0xab, 0x5e, 0x2c, 0x86, 0x37, 0xfe, 0xf5, 0x97, 0x4d, 0xed, 0xb7, 0xe7, 0x9b, 0xda, 0x17, + 0xe7, 0x9b, 0xda, 0x97, 0xe7, 0x9b, 0xda, 0x1f, 0xce, 0x37, 0xb5, 0x3f, 0x9f, 0x6f, 0x6a, 0xbf, + 0xfb, 0xeb, 0xa6, 0x36, 0xaa, 0x61, 0x8c, 0x7c, 0xf0, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x46, + 0x07, 0xcf, 0xb8, 0x3f, 0x1a, 0x00, 0x00, +} + func (this *Request) Equal(that interface{}) bool { if that == nil { return this == nil @@ -5503,6 +5180,44 @@ type ABCIApplicationServer interface { EndBlock(context.Context, *RequestEndBlock) (*ResponseEndBlock, error) } +// UnimplementedABCIApplicationServer can be embedded to have forward compatible implementations. +type UnimplementedABCIApplicationServer struct { +} + +func (*UnimplementedABCIApplicationServer) Echo(ctx context.Context, req *RequestEcho) (*ResponseEcho, error) { + return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") +} +func (*UnimplementedABCIApplicationServer) Flush(ctx context.Context, req *RequestFlush) (*ResponseFlush, error) { + return nil, status.Errorf(codes.Unimplemented, "method Flush not implemented") +} +func (*UnimplementedABCIApplicationServer) Info(ctx context.Context, req *RequestInfo) (*ResponseInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method Info not implemented") +} +func (*UnimplementedABCIApplicationServer) SetOption(ctx context.Context, req *RequestSetOption) (*ResponseSetOption, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetOption not implemented") +} +func (*UnimplementedABCIApplicationServer) DeliverTx(ctx context.Context, req *RequestDeliverTx) (*ResponseDeliverTx, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeliverTx not implemented") +} +func (*UnimplementedABCIApplicationServer) CheckTx(ctx context.Context, req *RequestCheckTx) (*ResponseCheckTx, error) { + return nil, status.Errorf(codes.Unimplemented, "method CheckTx not implemented") +} +func (*UnimplementedABCIApplicationServer) Query(ctx context.Context, req *RequestQuery) (*ResponseQuery, error) { + return nil, status.Errorf(codes.Unimplemented, "method Query not implemented") +} +func (*UnimplementedABCIApplicationServer) Commit(ctx context.Context, req *RequestCommit) (*ResponseCommit, error) { + return nil, status.Errorf(codes.Unimplemented, "method Commit not implemented") +} +func (*UnimplementedABCIApplicationServer) InitChain(ctx context.Context, req *RequestInitChain) (*ResponseInitChain, error) { + return nil, status.Errorf(codes.Unimplemented, "method InitChain not implemented") +} +func (*UnimplementedABCIApplicationServer) BeginBlock(ctx context.Context, req *RequestBeginBlock) (*ResponseBeginBlock, error) { + return nil, status.Errorf(codes.Unimplemented, "method BeginBlock not implemented") +} +func (*UnimplementedABCIApplicationServer) EndBlock(ctx context.Context, req *RequestEndBlock) (*ResponseEndBlock, error) { + return nil, status.Errorf(codes.Unimplemented, "method EndBlock not implemented") +} + func RegisterABCIApplicationServer(s *grpc.Server, srv ABCIApplicationServer) { s.RegisterService(&_ABCIApplication_serviceDesc, srv) } @@ -5761,7 +5476,7 @@ var _ABCIApplication_serviceDesc = grpc.ServiceDesc{ func (m *Request) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5769,183 +5484,257 @@ func (m *Request) Marshal() (dAtA []byte, err error) { } func (m *Request) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Value != nil { - nn1, err := m.Value.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } } - i += nn1 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + return len(dAtA) - i, nil } func (m *Request_Echo) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_Echo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Echo != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Echo.Size())) - n2, err := m.Echo.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Echo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0x12 } - return i, nil + return len(dAtA) - i, nil } func (m *Request_Flush) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_Flush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Flush != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Flush.Size())) - n3, err := m.Flush.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Flush.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n3 + i-- + dAtA[i] = 0x1a } - return i, nil + return len(dAtA) - i, nil } func (m *Request_Info) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Info != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Info.Size())) - n4, err := m.Info.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n4 + i-- + dAtA[i] = 0x22 } - return i, nil + return len(dAtA) - i, nil } func (m *Request_SetOption) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_SetOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.SetOption != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.SetOption.Size())) - n5, err := m.SetOption.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.SetOption.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n5 + i-- + dAtA[i] = 0x2a } - return i, nil + return len(dAtA) - i, nil } func (m *Request_InitChain) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_InitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.InitChain != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.InitChain.Size())) - n6, err := m.InitChain.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.InitChain.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n6 + i-- + dAtA[i] = 0x32 } - return i, nil + return len(dAtA) - i, nil } func (m *Request_Query) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_Query) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Query != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Query.Size())) - n7, err := m.Query.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Query.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n7 + i-- + dAtA[i] = 0x3a } - return i, nil + return len(dAtA) - i, nil } func (m *Request_BeginBlock) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_BeginBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.BeginBlock != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.BeginBlock.Size())) - n8, err := m.BeginBlock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.BeginBlock.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n8 + i-- + dAtA[i] = 0x42 } - return i, nil + return len(dAtA) - i, nil } func (m *Request_CheckTx) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_CheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.CheckTx != nil { - dAtA[i] = 0x4a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.CheckTx.Size())) - n9, err := m.CheckTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.CheckTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n9 + i-- + dAtA[i] = 0x4a } - return i, nil + return len(dAtA) - i, nil } func (m *Request_EndBlock) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_EndBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.EndBlock != nil { - dAtA[i] = 0x5a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.EndBlock.Size())) - n10, err := m.EndBlock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.EndBlock.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n10 + i-- + dAtA[i] = 0x5a } - return i, nil + return len(dAtA) - i, nil } func (m *Request_Commit) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Commit != nil { - dAtA[i] = 0x62 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Commit.Size())) - n11, err := m.Commit.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Commit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n11 + i-- + dAtA[i] = 0x62 } - return i, nil + return len(dAtA) - i, nil } func (m *Request_DeliverTx) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_DeliverTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.DeliverTx != nil { - dAtA[i] = 0x9a - i++ - dAtA[i] = 0x1 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.DeliverTx.Size())) - n12, err := m.DeliverTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.DeliverTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n12 + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a } - return i, nil + return len(dAtA) - i, nil } func (m *RequestEcho) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5953,26 +5742,33 @@ func (m *RequestEcho) Marshal() (dAtA []byte, err error) { } func (m *RequestEcho) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestEcho) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Message) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Message) + copy(dAtA[i:], m.Message) i = encodeVarintTypes(dAtA, i, uint64(len(m.Message))) - i += copy(dAtA[i:], m.Message) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RequestFlush) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5980,20 +5776,26 @@ func (m *RequestFlush) Marshal() (dAtA []byte, err error) { } func (m *RequestFlush) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestFlush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + return len(dAtA) - i, nil } func (m *RequestInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6001,36 +5803,43 @@ func (m *RequestInfo) Marshal() (dAtA []byte, err error) { } func (m *RequestInfo) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Version) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Version))) - i += copy(dAtA[i:], m.Version) - } - if m.BlockVersion != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.BlockVersion)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.P2PVersion != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.P2PVersion)) + i-- + dAtA[i] = 0x18 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.BlockVersion != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.BlockVersion)) + i-- + dAtA[i] = 0x10 + } + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RequestSetOption) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6038,32 +5847,40 @@ func (m *RequestSetOption) Marshal() (dAtA []byte, err error) { } func (m *RequestSetOption) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestSetOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Value) + copy(dAtA[i:], m.Value) i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RequestInitChain) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6071,62 +5888,74 @@ func (m *RequestInitChain) Marshal() (dAtA []byte, err error) { } func (m *RequestInitChain) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestInitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Time))) - n13, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i:]) - if err != nil { - return 0, err - } - i += n13 - if len(m.ChainId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainId))) - i += copy(dAtA[i:], m.ChainId) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.ConsensusParams != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.ConsensusParams.Size())) - n14, err := m.ConsensusParams.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n14 + if len(m.AppStateBytes) > 0 { + i -= len(m.AppStateBytes) + copy(dAtA[i:], m.AppStateBytes) + i = encodeVarintTypes(dAtA, i, uint64(len(m.AppStateBytes))) + i-- + dAtA[i] = 0x2a } if len(m.Validators) > 0 { - for _, msg := range m.Validators { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x22 } } - if len(m.AppStateBytes) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.AppStateBytes))) - i += copy(dAtA[i:], m.AppStateBytes) + if m.ConsensusParams != nil { + { + size, err := m.ConsensusParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0x12 } - return i, nil + n13, err13 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + if err13 != nil { + return 0, err13 + } + i -= n13 + i = encodeVarintTypes(dAtA, i, uint64(n13)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *RequestQuery) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6134,47 +5963,55 @@ func (m *RequestQuery) Marshal() (dAtA []byte, err error) { } func (m *RequestQuery) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestQuery) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Data) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if len(m.Path) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Path))) - i += copy(dAtA[i:], m.Path) - } - if m.Height != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Prove { - dAtA[i] = 0x20 - i++ + i-- if m.Prove { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x20 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + if len(m.Path) > 0 { + i -= len(m.Path) + copy(dAtA[i:], m.Path) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Path))) + i-- + dAtA[i] = 0x12 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RequestBeginBlock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6182,54 +6019,67 @@ func (m *RequestBeginBlock) Marshal() (dAtA []byte, err error) { } func (m *RequestBeginBlock) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestBeginBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Hash) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) - i += copy(dAtA[i:], m.Hash) - } - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Header.Size())) - n15, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n15 - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.LastCommitInfo.Size())) - n16, err := m.LastCommitInfo.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - i += n16 if len(m.ByzantineValidators) > 0 { - for _, msg := range m.ByzantineValidators { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.ByzantineValidators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ByzantineValidators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x22 } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size, err := m.LastCommitInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RequestCheckTx) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6237,31 +6087,38 @@ func (m *RequestCheckTx) Marshal() (dAtA []byte, err error) { } func (m *RequestCheckTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestCheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Tx) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Tx))) - i += copy(dAtA[i:], m.Tx) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Type != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Tx) > 0 { + i -= len(m.Tx) + copy(dAtA[i:], m.Tx) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Tx))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RequestDeliverTx) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6269,26 +6126,33 @@ func (m *RequestDeliverTx) Marshal() (dAtA []byte, err error) { } func (m *RequestDeliverTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestDeliverTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Tx) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Tx) + copy(dAtA[i:], m.Tx) i = encodeVarintTypes(dAtA, i, uint64(len(m.Tx))) - i += copy(dAtA[i:], m.Tx) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RequestEndBlock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6296,25 +6160,31 @@ func (m *RequestEndBlock) Marshal() (dAtA []byte, err error) { } func (m *RequestEndBlock) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestEndBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Height != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func (m *RequestCommit) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6322,20 +6192,26 @@ func (m *RequestCommit) Marshal() (dAtA []byte, err error) { } func (m *RequestCommit) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestCommit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + return len(dAtA) - i, nil } func (m *Response) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6343,195 +6219,275 @@ func (m *Response) Marshal() (dAtA []byte, err error) { } func (m *Response) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.Value != nil { - nn17, err := m.Value.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } } - i += nn17 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + return len(dAtA) - i, nil } func (m *Response_Exception) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Exception) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Exception != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Exception.Size())) - n18, err := m.Exception.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Exception.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n18 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Response_Echo) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Echo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Echo != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Echo.Size())) - n19, err := m.Echo.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Echo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n19 + i-- + dAtA[i] = 0x12 } - return i, nil + return len(dAtA) - i, nil } func (m *Response_Flush) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Flush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Flush != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Flush.Size())) - n20, err := m.Flush.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Flush.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n20 + i-- + dAtA[i] = 0x1a } - return i, nil + return len(dAtA) - i, nil } func (m *Response_Info) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Info != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Info.Size())) - n21, err := m.Info.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n21 + i-- + dAtA[i] = 0x22 } - return i, nil + return len(dAtA) - i, nil } func (m *Response_SetOption) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_SetOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.SetOption != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.SetOption.Size())) - n22, err := m.SetOption.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.SetOption.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n22 + i-- + dAtA[i] = 0x2a } - return i, nil + return len(dAtA) - i, nil } func (m *Response_InitChain) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_InitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.InitChain != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.InitChain.Size())) - n23, err := m.InitChain.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.InitChain.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n23 + i-- + dAtA[i] = 0x32 } - return i, nil + return len(dAtA) - i, nil } func (m *Response_Query) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Query) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Query != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Query.Size())) - n24, err := m.Query.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Query.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n24 + i-- + dAtA[i] = 0x3a } - return i, nil + return len(dAtA) - i, nil } func (m *Response_BeginBlock) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_BeginBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.BeginBlock != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.BeginBlock.Size())) - n25, err := m.BeginBlock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.BeginBlock.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n25 + i-- + dAtA[i] = 0x42 } - return i, nil + return len(dAtA) - i, nil } func (m *Response_CheckTx) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_CheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.CheckTx != nil { - dAtA[i] = 0x4a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.CheckTx.Size())) - n26, err := m.CheckTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.CheckTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n26 + i-- + dAtA[i] = 0x4a } - return i, nil + return len(dAtA) - i, nil } func (m *Response_DeliverTx) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_DeliverTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.DeliverTx != nil { - dAtA[i] = 0x52 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.DeliverTx.Size())) - n27, err := m.DeliverTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.DeliverTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n27 + i-- + dAtA[i] = 0x52 } - return i, nil + return len(dAtA) - i, nil } func (m *Response_EndBlock) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_EndBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.EndBlock != nil { - dAtA[i] = 0x5a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.EndBlock.Size())) - n28, err := m.EndBlock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.EndBlock.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n28 + i-- + dAtA[i] = 0x5a } - return i, nil + return len(dAtA) - i, nil } func (m *Response_Commit) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Commit != nil { - dAtA[i] = 0x62 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Commit.Size())) - n29, err := m.Commit.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Commit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n29 + i-- + dAtA[i] = 0x62 } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseException) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6539,26 +6495,33 @@ func (m *ResponseException) Marshal() (dAtA []byte, err error) { } func (m *ResponseException) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseException) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Error) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Error) + copy(dAtA[i:], m.Error) i = encodeVarintTypes(dAtA, i, uint64(len(m.Error))) - i += copy(dAtA[i:], m.Error) + i-- + dAtA[i] = 0xa } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseEcho) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6566,26 +6529,33 @@ func (m *ResponseEcho) Marshal() (dAtA []byte, err error) { } func (m *ResponseEcho) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseEcho) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Message) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Message) + copy(dAtA[i:], m.Message) i = encodeVarintTypes(dAtA, i, uint64(len(m.Message))) - i += copy(dAtA[i:], m.Message) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseFlush) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6593,20 +6563,26 @@ func (m *ResponseFlush) Marshal() (dAtA []byte, err error) { } func (m *ResponseFlush) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseFlush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6614,48 +6590,57 @@ func (m *ResponseInfo) Marshal() (dAtA []byte, err error) { } func (m *ResponseInfo) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Data) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if len(m.Version) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Version))) - i += copy(dAtA[i:], m.Version) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.AppVersion != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.AppVersion)) + if len(m.LastBlockAppHash) > 0 { + i -= len(m.LastBlockAppHash) + copy(dAtA[i:], m.LastBlockAppHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.LastBlockAppHash))) + i-- + dAtA[i] = 0x2a } if m.LastBlockHeight != 0 { - dAtA[i] = 0x20 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.LastBlockHeight)) + i-- + dAtA[i] = 0x20 } - if len(m.LastBlockAppHash) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.LastBlockAppHash))) - i += copy(dAtA[i:], m.LastBlockAppHash) + if m.AppVersion != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.AppVersion)) + i-- + dAtA[i] = 0x18 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x12 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseSetOption) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6663,37 +6648,45 @@ func (m *ResponseSetOption) Marshal() (dAtA []byte, err error) { } func (m *ResponseSetOption) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseSetOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Code)) - } - if len(m.Log) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) - i += copy(dAtA[i:], m.Log) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Info) > 0 { - dAtA[i] = 0x22 - i++ + i -= len(m.Info) + copy(dAtA[i:], m.Info) i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) - i += copy(dAtA[i:], m.Info) + i-- + dAtA[i] = 0x22 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Log) > 0 { + i -= len(m.Log) + copy(dAtA[i:], m.Log) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) + i-- + dAtA[i] = 0x1a + } + if m.Code != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseInitChain) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6701,42 +6694,52 @@ func (m *ResponseInitChain) Marshal() (dAtA []byte, err error) { } func (m *ResponseInitChain) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseInitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.ConsensusParams != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.ConsensusParams.Size())) - n30, err := m.ConsensusParams.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n30 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Validators) > 0 { - for _, msg := range m.Validators { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.ConsensusParams != nil { + { + size, err := m.ConsensusParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseQuery) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6744,75 +6747,88 @@ func (m *ResponseQuery) Marshal() (dAtA []byte, err error) { } func (m *ResponseQuery) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseQuery) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Code)) - } - if len(m.Log) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) - i += copy(dAtA[i:], m.Log) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Info) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) - i += copy(dAtA[i:], m.Info) + if len(m.Codespace) > 0 { + i -= len(m.Codespace) + copy(dAtA[i:], m.Codespace) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Codespace))) + i-- + dAtA[i] = 0x52 } - if m.Index != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Index)) + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x48 } - if len(m.Key) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.Proof != nil { + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 } if len(m.Value) > 0 { - dAtA[i] = 0x3a - i++ + i -= len(m.Value) + copy(dAtA[i:], m.Value) i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + i-- + dAtA[i] = 0x3a } - if m.Proof != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Proof.Size())) - n31, err := m.Proof.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n31 + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x32 } - if m.Height != 0 { - dAtA[i] = 0x48 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + if m.Index != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x28 } - if len(m.Codespace) > 0 { - dAtA[i] = 0x52 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Codespace))) - i += copy(dAtA[i:], m.Codespace) + if len(m.Info) > 0 { + i -= len(m.Info) + copy(dAtA[i:], m.Info) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) + i-- + dAtA[i] = 0x22 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Log) > 0 { + i -= len(m.Log) + copy(dAtA[i:], m.Log) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) + i-- + dAtA[i] = 0x1a + } + if m.Code != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseBeginBlock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6820,32 +6836,40 @@ func (m *ResponseBeginBlock) Marshal() (dAtA []byte, err error) { } func (m *ResponseBeginBlock) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseBeginBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseCheckTx) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6853,71 +6877,83 @@ func (m *ResponseCheckTx) Marshal() (dAtA []byte, err error) { } func (m *ResponseCheckTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseCheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Code)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Data) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) + if len(m.Codespace) > 0 { + i -= len(m.Codespace) + copy(dAtA[i:], m.Codespace) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Codespace))) + i-- + dAtA[i] = 0x42 } - if len(m.Log) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) - i += copy(dAtA[i:], m.Log) + if len(m.Events) > 0 { + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } } - if len(m.Info) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) - i += copy(dAtA[i:], m.Info) + if m.GasUsed != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x30 } if m.GasWanted != 0 { - dAtA[i] = 0x28 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.GasWanted)) + i-- + dAtA[i] = 0x28 } - if m.GasUsed != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.GasUsed)) + if len(m.Info) > 0 { + i -= len(m.Info) + copy(dAtA[i:], m.Info) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) + i-- + dAtA[i] = 0x22 } - if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0x3a - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if len(m.Log) > 0 { + i -= len(m.Log) + copy(dAtA[i:], m.Log) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) + i-- + dAtA[i] = 0x1a } - if len(m.Codespace) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Codespace))) - i += copy(dAtA[i:], m.Codespace) + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Code != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseDeliverTx) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6925,71 +6961,83 @@ func (m *ResponseDeliverTx) Marshal() (dAtA []byte, err error) { } func (m *ResponseDeliverTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseDeliverTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Code)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Data) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) + if len(m.Codespace) > 0 { + i -= len(m.Codespace) + copy(dAtA[i:], m.Codespace) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Codespace))) + i-- + dAtA[i] = 0x42 } - if len(m.Log) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) - i += copy(dAtA[i:], m.Log) + if len(m.Events) > 0 { + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } } - if len(m.Info) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) - i += copy(dAtA[i:], m.Info) + if m.GasUsed != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x30 } if m.GasWanted != 0 { - dAtA[i] = 0x28 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.GasWanted)) + i-- + dAtA[i] = 0x28 } - if m.GasUsed != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.GasUsed)) + if len(m.Info) > 0 { + i -= len(m.Info) + copy(dAtA[i:], m.Info) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) + i-- + dAtA[i] = 0x22 } - if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0x3a - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if len(m.Log) > 0 { + i -= len(m.Log) + copy(dAtA[i:], m.Log) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) + i-- + dAtA[i] = 0x1a } - if len(m.Codespace) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Codespace))) - i += copy(dAtA[i:], m.Codespace) + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Code != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseEndBlock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6997,54 +7045,66 @@ func (m *ResponseEndBlock) Marshal() (dAtA []byte, err error) { } func (m *ResponseEndBlock) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseEndBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.ValidatorUpdates) > 0 { - for _, msg := range m.ValidatorUpdates { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Events) > 0 { + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x1a } } if m.ConsensusParamUpdates != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.ConsensusParamUpdates.Size())) - n32, err := m.ConsensusParamUpdates.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n32 - } - if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + { + size, err := m.ConsensusParamUpdates.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.ValidatorUpdates) > 0 { + for iNdEx := len(m.ValidatorUpdates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ValidatorUpdates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseCommit) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7052,26 +7112,33 @@ func (m *ResponseCommit) Marshal() (dAtA []byte, err error) { } func (m *ResponseCommit) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseCommit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Data) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Data) + copy(dAtA[i:], m.Data) i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x12 } - return i, nil + return len(dAtA) - i, nil } func (m *ConsensusParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7079,50 +7146,62 @@ func (m *ConsensusParams) Marshal() (dAtA []byte, err error) { } func (m *ConsensusParams) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsensusParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Block != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Block.Size())) - n33, err := m.Block.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Validator != nil { + { + size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n33 + i-- + dAtA[i] = 0x1a } if m.Evidence != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Evidence.Size())) - n34, err := m.Evidence.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Evidence.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n34 + i-- + dAtA[i] = 0x12 } - if m.Validator != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Validator.Size())) - n35, err := m.Validator.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Block != nil { + { + size, err := m.Block.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n35 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *BlockParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7130,30 +7209,36 @@ func (m *BlockParams) Marshal() (dAtA []byte, err error) { } func (m *BlockParams) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.MaxBytes != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.MaxBytes)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.MaxGas != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.MaxGas)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.MaxBytes != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.MaxBytes)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *EvidenceParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7161,25 +7246,31 @@ func (m *EvidenceParams) Marshal() (dAtA []byte, err error) { } func (m *EvidenceParams) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EvidenceParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if m.MaxAge != 0 { - dAtA[i] = 0x8 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.MaxAge)) + i-- + dAtA[i] = 0x8 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func (m *ValidatorParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7187,35 +7278,35 @@ func (m *ValidatorParams) Marshal() (dAtA []byte, err error) { } func (m *ValidatorParams) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.PubKeyTypes) > 0 { - for _, s := range m.PubKeyTypes { + for iNdEx := len(m.PubKeyTypes) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PubKeyTypes[iNdEx]) + copy(dAtA[i:], m.PubKeyTypes[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PubKeyTypes[iNdEx]))) + i-- dAtA[i] = 0xa - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func (m *LastCommitInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7223,37 +7314,45 @@ func (m *LastCommitInfo) Marshal() (dAtA []byte, err error) { } func (m *LastCommitInfo) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LastCommitInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Round != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Round)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Votes) > 0 { - for _, msg := range m.Votes { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Round != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Round)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Event) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7261,38 +7360,47 @@ func (m *Event) Marshal() (dAtA []byte, err error) { } func (m *Event) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Type) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) - i += copy(dAtA[i:], m.Type) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Attributes) > 0 { - for _, msg := range m.Attributes { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Header) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7300,121 +7408,141 @@ func (m *Header) Marshal() (dAtA []byte, err error) { } func (m *Header) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Version.Size())) - n36, err := m.Version.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - i += n36 - if len(m.ChainID) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainID))) - i += copy(dAtA[i:], m.ChainID) + if len(m.ProposerAddress) > 0 { + i -= len(m.ProposerAddress) + copy(dAtA[i:], m.ProposerAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ProposerAddress))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 } - if m.Height != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + if len(m.EvidenceHash) > 0 { + i -= len(m.EvidenceHash) + copy(dAtA[i:], m.EvidenceHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.EvidenceHash))) + i-- + dAtA[i] = 0x7a } - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Time))) - n37, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i:]) - if err != nil { - return 0, err + if len(m.LastResultsHash) > 0 { + i -= len(m.LastResultsHash) + copy(dAtA[i:], m.LastResultsHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.LastResultsHash))) + i-- + dAtA[i] = 0x72 } - i += n37 - if m.NumTxs != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.NumTxs)) + if len(m.AppHash) > 0 { + i -= len(m.AppHash) + copy(dAtA[i:], m.AppHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.AppHash))) + i-- + dAtA[i] = 0x6a } - if m.TotalTxs != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.TotalTxs)) + if len(m.ConsensusHash) > 0 { + i -= len(m.ConsensusHash) + copy(dAtA[i:], m.ConsensusHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ConsensusHash))) + i-- + dAtA[i] = 0x62 } - dAtA[i] = 0x3a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.LastBlockId.Size())) - n38, err := m.LastBlockId.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.NextValidatorsHash) > 0 { + i -= len(m.NextValidatorsHash) + copy(dAtA[i:], m.NextValidatorsHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.NextValidatorsHash))) + i-- + dAtA[i] = 0x5a } - i += n38 - if len(m.LastCommitHash) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.LastCommitHash))) - i += copy(dAtA[i:], m.LastCommitHash) + if len(m.ValidatorsHash) > 0 { + i -= len(m.ValidatorsHash) + copy(dAtA[i:], m.ValidatorsHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorsHash))) + i-- + dAtA[i] = 0x52 } if len(m.DataHash) > 0 { - dAtA[i] = 0x4a - i++ + i -= len(m.DataHash) + copy(dAtA[i:], m.DataHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.DataHash))) - i += copy(dAtA[i:], m.DataHash) + i-- + dAtA[i] = 0x4a } - if len(m.ValidatorsHash) > 0 { - dAtA[i] = 0x52 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorsHash))) - i += copy(dAtA[i:], m.ValidatorsHash) + if len(m.LastCommitHash) > 0 { + i -= len(m.LastCommitHash) + copy(dAtA[i:], m.LastCommitHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.LastCommitHash))) + i-- + dAtA[i] = 0x42 } - if len(m.NextValidatorsHash) > 0 { - dAtA[i] = 0x5a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.NextValidatorsHash))) - i += copy(dAtA[i:], m.NextValidatorsHash) + { + size, err := m.LastBlockId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - if len(m.ConsensusHash) > 0 { - dAtA[i] = 0x62 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.ConsensusHash))) - i += copy(dAtA[i:], m.ConsensusHash) + i-- + dAtA[i] = 0x3a + if m.TotalTxs != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.TotalTxs)) + i-- + dAtA[i] = 0x30 } - if len(m.AppHash) > 0 { - dAtA[i] = 0x6a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.AppHash))) - i += copy(dAtA[i:], m.AppHash) + if m.NumTxs != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.NumTxs)) + i-- + dAtA[i] = 0x28 } - if len(m.LastResultsHash) > 0 { - dAtA[i] = 0x72 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.LastResultsHash))) - i += copy(dAtA[i:], m.LastResultsHash) + n35, err35 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + if err35 != nil { + return 0, err35 } - if len(m.EvidenceHash) > 0 { - dAtA[i] = 0x7a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.EvidenceHash))) - i += copy(dAtA[i:], m.EvidenceHash) + i -= n35 + i = encodeVarintTypes(dAtA, i, uint64(n35)) + i-- + dAtA[i] = 0x22 + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 } - if len(m.ProposerAddress) > 0 { - dAtA[i] = 0x82 - i++ - dAtA[i] = 0x1 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.ProposerAddress))) - i += copy(dAtA[i:], m.ProposerAddress) + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *Version) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7422,30 +7550,36 @@ func (m *Version) Marshal() (dAtA []byte, err error) { } func (m *Version) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Version) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Block != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Block)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.App != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.App)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Block != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Block)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *BlockID) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7453,34 +7587,43 @@ func (m *BlockID) Marshal() (dAtA []byte, err error) { } func (m *BlockID) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Hash) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) - i += copy(dAtA[i:], m.Hash) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.PartsHeader.Size())) - n39, err := m.PartsHeader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.PartsHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n39 - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x12 + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *PartSetHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7488,31 +7631,38 @@ func (m *PartSetHeader) Marshal() (dAtA []byte, err error) { } func (m *PartSetHeader) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PartSetHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Total != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Total)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Hash) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) - i += copy(dAtA[i:], m.Hash) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Total != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Total)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Validator) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7520,31 +7670,38 @@ func (m *Validator) Marshal() (dAtA []byte, err error) { } func (m *Validator) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Address) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) - i += copy(dAtA[i:], m.Address) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Power != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.Power)) + i-- + dAtA[i] = 0x18 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ValidatorUpdate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7552,33 +7709,41 @@ func (m *ValidatorUpdate) Marshal() (dAtA []byte, err error) { } func (m *ValidatorUpdate) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.PubKey.Size())) - n40, err := m.PubKey.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - i += n40 if m.Power != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.Power)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *VoteInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7586,38 +7751,46 @@ func (m *VoteInfo) Marshal() (dAtA []byte, err error) { } func (m *VoteInfo) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VoteInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Validator.Size())) - n41, err := m.Validator.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - i += n41 if m.SignedLastBlock { - dAtA[i] = 0x10 - i++ + i-- if m.SignedLastBlock { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *PubKey) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7625,32 +7798,40 @@ func (m *PubKey) Marshal() (dAtA []byte, err error) { } func (m *PubKey) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Type) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) - i += copy(dAtA[i:], m.Type) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Data) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Data) + copy(dAtA[i:], m.Data) i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Evidence) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7658,56 +7839,67 @@ func (m *Evidence) Marshal() (dAtA []byte, err error) { } func (m *Evidence) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Evidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Type) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) - i += copy(dAtA[i:], m.Type) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Validator.Size())) - n42, err := m.Validator.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.TotalVotingPower != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.TotalVotingPower)) + i-- + dAtA[i] = 0x28 } - i += n42 - if m.Height != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + n40, err40 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + if err40 != nil { + return 0, err40 } + i -= n40 + i = encodeVarintTypes(dAtA, i, uint64(n40)) + i-- dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Time))) - n43, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i:]) - if err != nil { - return 0, err + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 } - i += n43 - if m.TotalVotingPower != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.TotalVotingPower)) + { + size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0x12 + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func NewPopulatedRequest(r randyTypes, easy bool) *Request { this := &Request{} @@ -7840,10 +8032,10 @@ func NewPopulatedRequestInitChain(r randyTypes, easy bool) *RequestInitChain { v1 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) this.Time = *v1 this.ChainId = string(randStringTypes(r)) - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.ConsensusParams = NewPopulatedConsensusParams(r, easy) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v2 := r.Intn(5) this.Validators = make([]ValidatorUpdate, v2) for i := 0; i < v2; i++ { @@ -7892,7 +8084,7 @@ func NewPopulatedRequestBeginBlock(r randyTypes, easy bool) *RequestBeginBlock { this.Header = *v7 v8 := NewPopulatedLastCommitInfo(r, easy) this.LastCommitInfo = *v8 - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v9 := r.Intn(5) this.ByzantineValidators = make([]Evidence, v9) for i := 0; i < v9; i++ { @@ -8107,10 +8299,10 @@ func NewPopulatedResponseSetOption(r randyTypes, easy bool) *ResponseSetOption { func NewPopulatedResponseInitChain(r randyTypes, easy bool) *ResponseInitChain { this := &ResponseInitChain{} - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.ConsensusParams = NewPopulatedConsensusParams(r, easy) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v14 := r.Intn(5) this.Validators = make([]ValidatorUpdate, v14) for i := 0; i < v14; i++ { @@ -8143,7 +8335,7 @@ func NewPopulatedResponseQuery(r randyTypes, easy bool) *ResponseQuery { for i := 0; i < v17; i++ { this.Value[i] = byte(r.Intn(256)) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.Proof = merkle.NewPopulatedProof(r, easy) } this.Height = int64(r.Int63()) @@ -8159,7 +8351,7 @@ func NewPopulatedResponseQuery(r randyTypes, easy bool) *ResponseQuery { func NewPopulatedResponseBeginBlock(r randyTypes, easy bool) *ResponseBeginBlock { this := &ResponseBeginBlock{} - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v18 := r.Intn(5) this.Events = make([]Event, v18) for i := 0; i < v18; i++ { @@ -8191,7 +8383,7 @@ func NewPopulatedResponseCheckTx(r randyTypes, easy bool) *ResponseCheckTx { if r.Intn(2) == 0 { this.GasUsed *= -1 } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v21 := r.Intn(5) this.Events = make([]Event, v21) for i := 0; i < v21; i++ { @@ -8224,7 +8416,7 @@ func NewPopulatedResponseDeliverTx(r randyTypes, easy bool) *ResponseDeliverTx { if r.Intn(2) == 0 { this.GasUsed *= -1 } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v24 := r.Intn(5) this.Events = make([]Event, v24) for i := 0; i < v24; i++ { @@ -8241,7 +8433,7 @@ func NewPopulatedResponseDeliverTx(r randyTypes, easy bool) *ResponseDeliverTx { func NewPopulatedResponseEndBlock(r randyTypes, easy bool) *ResponseEndBlock { this := &ResponseEndBlock{} - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v26 := r.Intn(5) this.ValidatorUpdates = make([]ValidatorUpdate, v26) for i := 0; i < v26; i++ { @@ -8249,10 +8441,10 @@ func NewPopulatedResponseEndBlock(r randyTypes, easy bool) *ResponseEndBlock { this.ValidatorUpdates[i] = *v27 } } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.ConsensusParamUpdates = NewPopulatedConsensusParams(r, easy) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v28 := r.Intn(5) this.Events = make([]Event, v28) for i := 0; i < v28; i++ { @@ -8281,13 +8473,13 @@ func NewPopulatedResponseCommit(r randyTypes, easy bool) *ResponseCommit { func NewPopulatedConsensusParams(r randyTypes, easy bool) *ConsensusParams { this := &ConsensusParams{} - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.Block = NewPopulatedBlockParams(r, easy) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.Evidence = NewPopulatedEvidenceParams(r, easy) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.Validator = NewPopulatedValidatorParams(r, easy) } if !easy && r.Intn(10) != 0 { @@ -8343,7 +8535,7 @@ func NewPopulatedLastCommitInfo(r randyTypes, easy bool) *LastCommitInfo { if r.Intn(2) == 0 { this.Round *= -1 } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v32 := r.Intn(5) this.Votes = make([]VoteInfo, v32) for i := 0; i < v32; i++ { @@ -8360,7 +8552,7 @@ func NewPopulatedLastCommitInfo(r randyTypes, easy bool) *LastCommitInfo { func NewPopulatedEvent(r randyTypes, easy bool) *Event { this := &Event{} this.Type = string(randStringTypes(r)) - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v34 := r.Intn(5) this.Attributes = make([]common.KVPair, v34) for i := 0; i < v34; i++ { @@ -9811,14 +10003,7 @@ func (m *Evidence) Size() (n int) { } func sovTypes(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -9838,7 +10023,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -9866,7 +10051,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9875,6 +10060,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9898,7 +10086,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9907,6 +10095,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9930,7 +10121,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9939,6 +10130,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9962,7 +10156,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9971,6 +10165,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9994,7 +10191,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10003,6 +10200,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10026,7 +10226,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10035,6 +10235,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10058,7 +10261,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10067,6 +10270,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10090,7 +10296,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10099,6 +10305,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10122,7 +10331,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10131,6 +10340,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10154,7 +10366,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10163,6 +10375,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10186,7 +10401,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10195,6 +10410,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10213,6 +10431,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10241,7 +10462,7 @@ func (m *RequestEcho) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10269,7 +10490,7 @@ func (m *RequestEcho) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10279,6 +10500,9 @@ func (m *RequestEcho) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10293,6 +10517,9 @@ func (m *RequestEcho) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10321,7 +10548,7 @@ func (m *RequestFlush) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10344,6 +10571,9 @@ func (m *RequestFlush) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10372,7 +10602,7 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10400,7 +10630,7 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10410,6 +10640,9 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10429,7 +10662,7 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlockVersion |= (uint64(b) & 0x7F) << shift + m.BlockVersion |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10448,7 +10681,7 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.P2PVersion |= (uint64(b) & 0x7F) << shift + m.P2PVersion |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10462,6 +10695,9 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10490,7 +10726,7 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10518,7 +10754,7 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10528,6 +10764,9 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10547,7 +10786,7 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10557,6 +10796,9 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10571,6 +10813,9 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10599,7 +10844,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10627,7 +10872,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10636,6 +10881,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10657,7 +10905,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10667,6 +10915,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10686,7 +10937,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10695,6 +10946,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10719,7 +10973,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10728,6 +10982,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10750,7 +11007,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10759,6 +11016,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10776,6 +11036,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10804,7 +11067,7 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10832,7 +11095,7 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10841,6 +11104,9 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10863,7 +11129,7 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10873,6 +11139,9 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10892,7 +11161,7 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (int64(b) & 0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -10911,7 +11180,7 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10926,6 +11195,9 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10954,7 +11226,7 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10982,7 +11254,7 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10991,6 +11263,9 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11013,7 +11288,7 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11022,6 +11297,9 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11043,7 +11321,7 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11052,6 +11330,9 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11073,7 +11354,7 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11082,6 +11363,9 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11099,6 +11383,9 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11127,7 +11414,7 @@ func (m *RequestCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11155,7 +11442,7 @@ func (m *RequestCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11164,6 +11451,9 @@ func (m *RequestCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11186,7 +11476,7 @@ func (m *RequestCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= (CheckTxType(b) & 0x7F) << shift + m.Type |= CheckTxType(b&0x7F) << shift if b < 0x80 { break } @@ -11200,6 +11490,9 @@ func (m *RequestCheckTx) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11228,7 +11521,7 @@ func (m *RequestDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11256,7 +11549,7 @@ func (m *RequestDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11265,6 +11558,9 @@ func (m *RequestDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11282,6 +11578,9 @@ func (m *RequestDeliverTx) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11310,7 +11609,7 @@ func (m *RequestEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11338,7 +11637,7 @@ func (m *RequestEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (int64(b) & 0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -11352,6 +11651,9 @@ func (m *RequestEndBlock) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11380,7 +11682,7 @@ func (m *RequestCommit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11403,6 +11705,9 @@ func (m *RequestCommit) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11431,7 +11736,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11459,7 +11764,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11468,6 +11773,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11491,7 +11799,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11500,6 +11808,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11523,7 +11834,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11532,6 +11843,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11555,7 +11869,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11564,6 +11878,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11587,7 +11904,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11596,6 +11913,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11619,7 +11939,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11628,6 +11948,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11651,7 +11974,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11660,6 +11983,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11683,7 +12009,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11692,6 +12018,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11715,7 +12044,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11724,6 +12053,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11747,7 +12079,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11756,6 +12088,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11779,7 +12114,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11788,6 +12123,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11811,7 +12149,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11820,6 +12158,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11838,6 +12179,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11866,7 +12210,7 @@ func (m *ResponseException) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11894,7 +12238,7 @@ func (m *ResponseException) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11904,6 +12248,9 @@ func (m *ResponseException) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11918,6 +12265,9 @@ func (m *ResponseException) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11946,7 +12296,7 @@ func (m *ResponseEcho) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11974,7 +12324,7 @@ func (m *ResponseEcho) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11984,6 +12334,9 @@ func (m *ResponseEcho) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11998,6 +12351,9 @@ func (m *ResponseEcho) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12026,7 +12382,7 @@ func (m *ResponseFlush) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12049,6 +12405,9 @@ func (m *ResponseFlush) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12077,7 +12436,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12105,7 +12464,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12115,6 +12474,9 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12134,7 +12496,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12144,6 +12506,9 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12163,7 +12528,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.AppVersion |= (uint64(b) & 0x7F) << shift + m.AppVersion |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12182,7 +12547,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LastBlockHeight |= (int64(b) & 0x7F) << shift + m.LastBlockHeight |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12201,7 +12566,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12210,6 +12575,9 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12227,6 +12595,9 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12255,7 +12626,7 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12283,7 +12654,7 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= (uint32(b) & 0x7F) << shift + m.Code |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -12302,7 +12673,7 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12312,6 +12683,9 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12331,7 +12705,7 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12341,6 +12715,9 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12355,6 +12732,9 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12383,7 +12763,7 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12411,7 +12791,7 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12420,6 +12800,9 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12444,7 +12827,7 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12453,6 +12836,9 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12470,6 +12856,9 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12498,7 +12887,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12526,7 +12915,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= (uint32(b) & 0x7F) << shift + m.Code |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -12545,7 +12934,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12555,6 +12944,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12574,7 +12966,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12584,6 +12976,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12603,7 +12998,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Index |= (int64(b) & 0x7F) << shift + m.Index |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12622,7 +13017,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12631,6 +13026,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12653,7 +13051,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12662,6 +13060,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12684,7 +13085,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12693,6 +13094,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12717,7 +13121,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (int64(b) & 0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12736,7 +13140,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12746,6 +13150,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12760,6 +13167,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12788,7 +13198,7 @@ func (m *ResponseBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12816,7 +13226,7 @@ func (m *ResponseBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12825,6 +13235,9 @@ func (m *ResponseBeginBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12842,6 +13255,9 @@ func (m *ResponseBeginBlock) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12870,7 +13286,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12898,7 +13314,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= (uint32(b) & 0x7F) << shift + m.Code |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -12917,7 +13333,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12926,6 +13342,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12948,7 +13367,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12958,6 +13377,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12977,7 +13399,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12987,6 +13409,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13006,7 +13431,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GasWanted |= (int64(b) & 0x7F) << shift + m.GasWanted |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13025,7 +13450,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GasUsed |= (int64(b) & 0x7F) << shift + m.GasUsed |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13044,7 +13469,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13053,6 +13478,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13075,7 +13503,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13085,6 +13513,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13099,6 +13530,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13127,7 +13561,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13155,7 +13589,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= (uint32(b) & 0x7F) << shift + m.Code |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -13174,7 +13608,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13183,6 +13617,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13205,7 +13642,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13215,6 +13652,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13234,7 +13674,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13244,6 +13684,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13263,7 +13706,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GasWanted |= (int64(b) & 0x7F) << shift + m.GasWanted |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13282,7 +13725,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GasUsed |= (int64(b) & 0x7F) << shift + m.GasUsed |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13301,7 +13744,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13310,6 +13753,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13332,7 +13778,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13342,6 +13788,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13356,6 +13805,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13384,7 +13836,7 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13412,7 +13864,7 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13421,6 +13873,9 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13443,7 +13898,7 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13452,6 +13907,9 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13476,7 +13934,7 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13485,6 +13943,9 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13502,6 +13963,9 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13530,7 +13994,7 @@ func (m *ResponseCommit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13558,7 +14022,7 @@ func (m *ResponseCommit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13567,6 +14031,9 @@ func (m *ResponseCommit) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13584,6 +14051,9 @@ func (m *ResponseCommit) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13612,7 +14082,7 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13640,7 +14110,7 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13649,6 +14119,9 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13673,7 +14146,7 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13682,6 +14155,9 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13706,7 +14182,7 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13715,6 +14191,9 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13734,6 +14213,9 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13762,7 +14244,7 @@ func (m *BlockParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13790,7 +14272,7 @@ func (m *BlockParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxBytes |= (int64(b) & 0x7F) << shift + m.MaxBytes |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13809,7 +14291,7 @@ func (m *BlockParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxGas |= (int64(b) & 0x7F) << shift + m.MaxGas |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13823,6 +14305,9 @@ func (m *BlockParams) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13851,7 +14336,7 @@ func (m *EvidenceParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13879,7 +14364,7 @@ func (m *EvidenceParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxAge |= (int64(b) & 0x7F) << shift + m.MaxAge |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13893,6 +14378,9 @@ func (m *EvidenceParams) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13921,7 +14409,7 @@ func (m *ValidatorParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13949,7 +14437,7 @@ func (m *ValidatorParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13959,6 +14447,9 @@ func (m *ValidatorParams) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13973,6 +14464,9 @@ func (m *ValidatorParams) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14001,7 +14495,7 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14029,7 +14523,7 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Round |= (int32(b) & 0x7F) << shift + m.Round |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -14048,7 +14542,7 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14057,6 +14551,9 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14074,6 +14571,9 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14102,7 +14602,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14130,7 +14630,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14140,6 +14640,9 @@ func (m *Event) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14159,7 +14662,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14168,6 +14671,9 @@ func (m *Event) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14185,6 +14691,9 @@ func (m *Event) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14213,7 +14722,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14241,7 +14750,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14250,6 +14759,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14271,7 +14783,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14281,6 +14793,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14300,7 +14815,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (int64(b) & 0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -14319,7 +14834,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14328,6 +14843,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14349,7 +14867,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NumTxs |= (int64(b) & 0x7F) << shift + m.NumTxs |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -14368,7 +14886,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TotalTxs |= (int64(b) & 0x7F) << shift + m.TotalTxs |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -14387,7 +14905,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14396,6 +14914,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14417,7 +14938,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14426,6 +14947,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14448,7 +14972,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14457,6 +14981,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14479,7 +15006,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14488,6 +15015,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14510,7 +15040,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14519,6 +15049,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14541,7 +15074,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14550,6 +15083,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14572,7 +15108,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14581,6 +15117,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14603,7 +15142,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14612,6 +15151,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14634,7 +15176,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14643,6 +15185,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14665,7 +15210,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14674,6 +15219,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14691,6 +15239,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14719,7 +15270,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14747,7 +15298,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Block |= (uint64(b) & 0x7F) << shift + m.Block |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14766,7 +15317,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.App |= (uint64(b) & 0x7F) << shift + m.App |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14780,6 +15331,9 @@ func (m *Version) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14808,7 +15362,7 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14836,7 +15390,7 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14845,6 +15399,9 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14867,7 +15424,7 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14876,6 +15433,9 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14892,6 +15452,9 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14920,7 +15483,7 @@ func (m *PartSetHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14948,7 +15511,7 @@ func (m *PartSetHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Total |= (int32(b) & 0x7F) << shift + m.Total |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -14967,7 +15530,7 @@ func (m *PartSetHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14976,6 +15539,9 @@ func (m *PartSetHeader) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14993,6 +15559,9 @@ func (m *PartSetHeader) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15021,7 +15590,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15049,7 +15618,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15058,6 +15627,9 @@ func (m *Validator) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15080,7 +15652,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Power |= (int64(b) & 0x7F) << shift + m.Power |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -15094,6 +15666,9 @@ func (m *Validator) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15122,7 +15697,7 @@ func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15150,7 +15725,7 @@ func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15159,6 +15734,9 @@ func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15180,7 +15758,7 @@ func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Power |= (int64(b) & 0x7F) << shift + m.Power |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -15194,6 +15772,9 @@ func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15222,7 +15803,7 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15250,7 +15831,7 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15259,6 +15840,9 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15280,7 +15864,7 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15295,6 +15879,9 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15323,7 +15910,7 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15351,7 +15938,7 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15361,6 +15948,9 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15380,7 +15970,7 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15389,6 +15979,9 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15406,6 +15999,9 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15434,7 +16030,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15462,7 +16058,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15472,6 +16068,9 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15491,7 +16090,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15500,6 +16099,9 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15521,7 +16123,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (int64(b) & 0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -15540,7 +16142,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15549,6 +16151,9 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15570,7 +16175,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TotalVotingPower |= (int64(b) & 0x7F) << shift + m.TotalVotingPower |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -15584,6 +16189,9 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15651,10 +16259,13 @@ func skipTypes(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthTypes } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } return iNdEx, nil case 3: for { @@ -15683,6 +16294,9 @@ func skipTypes(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } } return iNdEx, nil case 4: @@ -15701,155 +16315,3 @@ var ( ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("abci/types/types.proto", fileDescriptor_types_30d8160a6576aafe) } -func init() { - golang_proto.RegisterFile("abci/types/types.proto", fileDescriptor_types_30d8160a6576aafe) -} - -var fileDescriptor_types_30d8160a6576aafe = []byte{ - // 2282 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xcd, 0x73, 0x1c, 0x47, - 0x15, 0xd7, 0xec, 0xf7, 0xbc, 0xd5, 0x7e, 0xb8, 0x2d, 0xdb, 0xeb, 0xc5, 0x48, 0xae, 0x31, 0x38, - 0x52, 0xe2, 0xac, 0x12, 0x05, 0x53, 0x32, 0x0e, 0xa9, 0xd2, 0xda, 0x06, 0xa9, 0x62, 0x82, 0x18, - 0xdb, 0xe2, 0x42, 0xd5, 0x54, 0xef, 0x4e, 0x7b, 0x77, 0xca, 0xbb, 0x33, 0x93, 0x99, 0x5e, 0x79, - 0xc5, 0x91, 0x73, 0x0e, 0x39, 0xf0, 0x27, 0x70, 0xe0, 0x4f, 0xc8, 0x91, 0x13, 0x95, 0x23, 0x07, - 0xce, 0x06, 0x44, 0x71, 0xa1, 0x8a, 0x33, 0x70, 0xa3, 0xfa, 0x75, 0xcf, 0xa7, 0x66, 0x4d, 0x62, - 0xb8, 0xe5, 0xb2, 0x3b, 0xdd, 0xef, 0xf7, 0x7a, 0xba, 0xdf, 0xbc, 0xf7, 0x7e, 0xef, 0x35, 0x5c, - 0xa5, 0xa3, 0xb1, 0xb3, 0xcb, 0xcf, 0x7c, 0x16, 0xca, 0xdf, 0x81, 0x1f, 0x78, 0xdc, 0x23, 0x55, - 0x1c, 0xf4, 0xdf, 0x9d, 0x38, 0x7c, 0xba, 0x18, 0x0d, 0xc6, 0xde, 0x7c, 0x77, 0xe2, 0x4d, 0xbc, - 0x5d, 0x94, 0x8e, 0x16, 0xcf, 0x71, 0x84, 0x03, 0x7c, 0x92, 0x5a, 0xfd, 0xfb, 0x29, 0x38, 0x67, - 0xae, 0xcd, 0x82, 0xb9, 0xe3, 0xf2, 0xf4, 0xe3, 0x38, 0x38, 0xf3, 0xb9, 0xb7, 0x3b, 0x67, 0xc1, - 0x8b, 0x19, 0x53, 0x7f, 0x4a, 0x79, 0xff, 0xbf, 0x2a, 0xcf, 0x9c, 0x51, 0xb8, 0x3b, 0xf6, 0xe6, - 0x73, 0xcf, 0x4d, 0x6f, 0xb6, 0xbf, 0x35, 0xf1, 0xbc, 0xc9, 0x8c, 0x25, 0x9b, 0xe3, 0xce, 0x9c, - 0x85, 0x9c, 0xce, 0x7d, 0x09, 0x30, 0x7e, 0x5f, 0x81, 0xba, 0xc9, 0x3e, 0x5d, 0xb0, 0x90, 0x93, - 0x6d, 0xa8, 0xb0, 0xf1, 0xd4, 0xeb, 0x95, 0x6e, 0x6a, 0xdb, 0xcd, 0x3d, 0x32, 0x90, 0x0b, 0x29, - 0xe9, 0xa3, 0xf1, 0xd4, 0x3b, 0x5c, 0x33, 0x11, 0x41, 0xde, 0x81, 0xea, 0xf3, 0xd9, 0x22, 0x9c, - 0xf6, 0xca, 0x08, 0xbd, 0x9c, 0x85, 0xfe, 0x48, 0x88, 0x0e, 0xd7, 0x4c, 0x89, 0x11, 0xcb, 0x3a, - 0xee, 0x73, 0xaf, 0x57, 0x29, 0x5a, 0xf6, 0xc8, 0x7d, 0x8e, 0xcb, 0x0a, 0x04, 0xd9, 0x07, 0x08, - 0x19, 0xb7, 0x3c, 0x9f, 0x3b, 0x9e, 0xdb, 0xab, 0x22, 0xfe, 0x5a, 0x16, 0xff, 0x84, 0xf1, 0x9f, - 0xa2, 0xf8, 0x70, 0xcd, 0xd4, 0xc3, 0x68, 0x20, 0x34, 0x1d, 0xd7, 0xe1, 0xd6, 0x78, 0x4a, 0x1d, - 0xb7, 0x57, 0x2b, 0xd2, 0x3c, 0x72, 0x1d, 0xfe, 0x40, 0x88, 0x85, 0xa6, 0x13, 0x0d, 0xc4, 0x51, - 0x3e, 0x5d, 0xb0, 0xe0, 0xac, 0x57, 0x2f, 0x3a, 0xca, 0xcf, 0x84, 0x48, 0x1c, 0x05, 0x31, 0xe4, - 0x3e, 0x34, 0x47, 0x6c, 0xe2, 0xb8, 0xd6, 0x68, 0xe6, 0x8d, 0x5f, 0xf4, 0x1a, 0xa8, 0xd2, 0xcb, - 0xaa, 0x0c, 0x05, 0x60, 0x28, 0xe4, 0x87, 0x6b, 0x26, 0x8c, 0xe2, 0x11, 0xd9, 0x83, 0xc6, 0x78, - 0xca, 0xc6, 0x2f, 0x2c, 0xbe, 0xec, 0xe9, 0xa8, 0x79, 0x25, 0xab, 0xf9, 0x40, 0x48, 0x9f, 0x2e, - 0x0f, 0xd7, 0xcc, 0xfa, 0x58, 0x3e, 0x92, 0xbb, 0xa0, 0x33, 0xd7, 0x56, 0xaf, 0x6b, 0xa2, 0xd2, - 0xd5, 0xdc, 0x77, 0x71, 0xed, 0xe8, 0x65, 0x0d, 0xa6, 0x9e, 0xc9, 0x00, 0x6a, 0xc2, 0x19, 0x1c, - 0xde, 0x5b, 0x47, 0x9d, 0x8d, 0xdc, 0x8b, 0x50, 0x76, 0xb8, 0x66, 0x2a, 0x94, 0x30, 0x9f, 0xcd, - 0x66, 0xce, 0x29, 0x0b, 0xc4, 0xe6, 0x2e, 0x17, 0x99, 0xef, 0xa1, 0x94, 0xe3, 0xf6, 0x74, 0x3b, - 0x1a, 0x0c, 0xeb, 0x50, 0x3d, 0xa5, 0xb3, 0x05, 0x33, 0xde, 0x82, 0x66, 0xca, 0x53, 0x48, 0x0f, - 0xea, 0x73, 0x16, 0x86, 0x74, 0xc2, 0x7a, 0xda, 0x4d, 0x6d, 0x5b, 0x37, 0xa3, 0xa1, 0xd1, 0x86, - 0xf5, 0xb4, 0x9f, 0x18, 0xf3, 0x58, 0x51, 0xf8, 0x82, 0x50, 0x3c, 0x65, 0x41, 0x28, 0x1c, 0x40, - 0x29, 0xaa, 0x21, 0xb9, 0x05, 0x2d, 0xb4, 0x83, 0x15, 0xc9, 0x85, 0x9f, 0x56, 0xcc, 0x75, 0x9c, - 0x3c, 0x51, 0xa0, 0x2d, 0x68, 0xfa, 0x7b, 0x7e, 0x0c, 0x29, 0x23, 0x04, 0xfc, 0x3d, 0x5f, 0x01, - 0x8c, 0x1f, 0x40, 0x37, 0xef, 0x4a, 0xa4, 0x0b, 0xe5, 0x17, 0xec, 0x4c, 0xbd, 0x4f, 0x3c, 0x92, - 0x0d, 0x75, 0x2c, 0x7c, 0x87, 0x6e, 0xaa, 0x33, 0x7e, 0x5e, 0x8a, 0x95, 0x63, 0x6f, 0x22, 0xfb, - 0x50, 0x11, 0x41, 0x85, 0xda, 0xcd, 0xbd, 0xfe, 0x40, 0x46, 0xdc, 0x20, 0x8a, 0xb8, 0xc1, 0xd3, - 0x28, 0xe2, 0x86, 0x8d, 0x2f, 0x5f, 0x6d, 0xad, 0x7d, 0xfe, 0xa7, 0x2d, 0xcd, 0x44, 0x0d, 0x72, - 0x5d, 0x38, 0x04, 0x75, 0x5c, 0xcb, 0xb1, 0xd5, 0x7b, 0xea, 0x38, 0x3e, 0xb2, 0xc9, 0x01, 0x74, - 0xc7, 0x9e, 0x1b, 0x32, 0x37, 0x5c, 0x84, 0x96, 0x4f, 0x03, 0x3a, 0x0f, 0x55, 0xac, 0x45, 0x9f, - 0xff, 0x41, 0x24, 0x3e, 0x46, 0xa9, 0xd9, 0x19, 0x67, 0x27, 0xc8, 0x87, 0x00, 0xa7, 0x74, 0xe6, - 0xd8, 0x94, 0x7b, 0x41, 0xd8, 0xab, 0xdc, 0x2c, 0xa7, 0x94, 0x4f, 0x22, 0xc1, 0x33, 0xdf, 0xa6, - 0x9c, 0x0d, 0x2b, 0x62, 0x67, 0x66, 0x0a, 0x4f, 0x6e, 0x43, 0x87, 0xfa, 0xbe, 0x15, 0x72, 0xca, - 0x99, 0x35, 0x3a, 0xe3, 0x2c, 0xc4, 0x78, 0x5c, 0x37, 0x5b, 0xd4, 0xf7, 0x9f, 0x88, 0xd9, 0xa1, - 0x98, 0x34, 0xec, 0xf8, 0x6b, 0x62, 0xa8, 0x10, 0x02, 0x15, 0x9b, 0x72, 0x8a, 0xd6, 0x58, 0x37, - 0xf1, 0x59, 0xcc, 0xf9, 0x94, 0x4f, 0xd5, 0x19, 0xf1, 0x99, 0x5c, 0x85, 0xda, 0x94, 0x39, 0x93, - 0x29, 0xc7, 0x63, 0x95, 0x4d, 0x35, 0x12, 0x86, 0xf7, 0x03, 0xef, 0x94, 0x61, 0xb6, 0x68, 0x98, - 0x72, 0x60, 0xfc, 0x4d, 0x83, 0x4b, 0x17, 0xc2, 0x4b, 0xac, 0x3b, 0xa5, 0xe1, 0x34, 0x7a, 0x97, - 0x78, 0x26, 0xef, 0x88, 0x75, 0xa9, 0xcd, 0x02, 0x95, 0xc5, 0x5a, 0xea, 0xc4, 0x87, 0x38, 0xa9, - 0x0e, 0xaa, 0x20, 0xe4, 0x11, 0x74, 0x67, 0x34, 0xe4, 0x96, 0x8c, 0x02, 0x0b, 0xb3, 0x54, 0x39, - 0x13, 0x99, 0x8f, 0x69, 0x14, 0x2d, 0xc2, 0x39, 0x95, 0x7a, 0x7b, 0x96, 0x99, 0x25, 0x87, 0xb0, - 0x31, 0x3a, 0xfb, 0x25, 0x75, 0xb9, 0xe3, 0x32, 0xeb, 0x82, 0xcd, 0x3b, 0x6a, 0xa9, 0x47, 0xa7, - 0x8e, 0xcd, 0xdc, 0x71, 0x64, 0xec, 0xcb, 0xb1, 0x4a, 0xfc, 0x31, 0x42, 0xe3, 0x10, 0xda, 0xd9, - 0x5c, 0x40, 0xda, 0x50, 0xe2, 0x4b, 0x75, 0xc2, 0x12, 0x5f, 0x92, 0xdb, 0x50, 0x11, 0xcb, 0xe1, - 0xe9, 0xda, 0x71, 0x32, 0x55, 0xe8, 0xa7, 0x67, 0x3e, 0x33, 0x51, 0x6e, 0x18, 0xb1, 0xa7, 0xc6, - 0x81, 0x9b, 0x5f, 0xcb, 0xd8, 0x81, 0x4e, 0x2e, 0x89, 0xa4, 0x3e, 0x8b, 0x96, 0xfe, 0x2c, 0x46, - 0x07, 0x5a, 0x99, 0xdc, 0x61, 0x7c, 0x56, 0x85, 0x86, 0xc9, 0x42, 0x5f, 0x38, 0x1d, 0xd9, 0x07, - 0x9d, 0x2d, 0xc7, 0x4c, 0xa6, 0x6d, 0x2d, 0x97, 0x14, 0x25, 0xe6, 0x51, 0x24, 0x17, 0xe9, 0x23, - 0x06, 0x93, 0x9d, 0x0c, 0xe5, 0x5c, 0xce, 0x2b, 0xa5, 0x39, 0xe7, 0x4e, 0x96, 0x73, 0x36, 0x72, - 0xd8, 0x1c, 0xe9, 0xec, 0x64, 0x48, 0x27, 0xbf, 0x70, 0x86, 0x75, 0xee, 0x15, 0xb0, 0x4e, 0x7e, - 0xfb, 0x2b, 0x68, 0xe7, 0x5e, 0x01, 0xed, 0xf4, 0x2e, 0xbc, 0xab, 0x90, 0x77, 0xee, 0x64, 0x79, - 0x27, 0x7f, 0x9c, 0x1c, 0xf1, 0x7c, 0x58, 0x44, 0x3c, 0xd7, 0x73, 0x3a, 0x2b, 0x99, 0xe7, 0x83, - 0x0b, 0xcc, 0x73, 0x35, 0xa7, 0x5a, 0x40, 0x3d, 0xf7, 0x32, 0x9c, 0x00, 0x85, 0x67, 0x2b, 0x26, - 0x05, 0xf2, 0xfd, 0x8b, 0xac, 0x75, 0x2d, 0xff, 0x69, 0x8b, 0x68, 0x6b, 0x37, 0x47, 0x5b, 0x57, - 0xf2, 0xbb, 0xcc, 0xf1, 0x56, 0xc2, 0x3e, 0x3b, 0x22, 0x3f, 0xe4, 0x3c, 0x4d, 0xe4, 0x12, 0x16, - 0x04, 0x5e, 0xa0, 0x12, 0xbb, 0x1c, 0x18, 0xdb, 0x22, 0x63, 0x25, 0xfe, 0xf5, 0x1a, 0xa6, 0x42, - 0xa7, 0x4f, 0x79, 0x97, 0xf1, 0x85, 0x96, 0xe8, 0x62, 0xe4, 0xa7, 0xb3, 0x9d, 0xae, 0xb2, 0x5d, - 0x8a, 0xc0, 0x4a, 0x59, 0x02, 0xdb, 0x82, 0xa6, 0xc8, 0xa9, 0x39, 0x6e, 0xa2, 0x7e, 0xc4, 0x4d, - 0xe4, 0x6d, 0xb8, 0x84, 0xf9, 0x48, 0xd2, 0x9c, 0x0a, 0xc4, 0x0a, 0x06, 0x62, 0x47, 0x08, 0xa4, - 0xc5, 0x64, 0xa2, 0x7c, 0x17, 0x2e, 0xa7, 0xb0, 0x62, 0x5d, 0xcc, 0x85, 0x32, 0x49, 0x77, 0x63, - 0xf4, 0x81, 0xef, 0x1f, 0xd2, 0x70, 0x6a, 0xfc, 0x24, 0x31, 0x50, 0xc2, 0x7b, 0x04, 0x2a, 0x63, - 0xcf, 0x96, 0xe7, 0x6e, 0x99, 0xf8, 0x2c, 0xb8, 0x70, 0xe6, 0x4d, 0x70, 0x73, 0xba, 0x29, 0x1e, - 0x05, 0x2a, 0x0e, 0x25, 0x5d, 0xc6, 0x8c, 0xf1, 0x6b, 0x2d, 0x59, 0x2f, 0xa1, 0xc2, 0x22, 0xd6, - 0xd2, 0xfe, 0x17, 0xd6, 0x2a, 0x7d, 0x3d, 0xd6, 0x32, 0xce, 0xb5, 0xe4, 0x93, 0xc5, 0x7c, 0xf4, - 0x66, 0x47, 0x14, 0xde, 0xe3, 0xb8, 0x36, 0x5b, 0xa2, 0x49, 0xcb, 0xa6, 0x1c, 0x44, 0xa5, 0x42, - 0x0d, 0xcd, 0x9c, 0x2d, 0x15, 0xea, 0x38, 0x27, 0x07, 0xe4, 0x16, 0xf2, 0x98, 0xf7, 0x5c, 0x85, - 0x6a, 0x6b, 0xa0, 0x0a, 0xfa, 0x63, 0x31, 0x69, 0x4a, 0x59, 0x2a, 0xdb, 0xea, 0x19, 0x12, 0xbc, - 0x01, 0xba, 0xd8, 0x68, 0xe8, 0xd3, 0x31, 0xc3, 0xc8, 0xd3, 0xcd, 0x64, 0xc2, 0x78, 0x0a, 0xe4, - 0x62, 0xc4, 0x93, 0x8f, 0xa0, 0xc6, 0x4e, 0x99, 0xcb, 0x85, 0xc5, 0x85, 0xd1, 0xd6, 0x63, 0xda, - 0x61, 0x2e, 0x1f, 0xf6, 0x84, 0xa9, 0xfe, 0xfe, 0x6a, 0xab, 0x2b, 0x31, 0x77, 0xbc, 0xb9, 0xc3, - 0xd9, 0xdc, 0xe7, 0x67, 0xa6, 0xd2, 0x32, 0xfe, 0xa9, 0x09, 0x36, 0xc8, 0x64, 0x83, 0x42, 0xe3, - 0x45, 0x2e, 0x5f, 0x4a, 0x11, 0xfc, 0x57, 0x33, 0xe8, 0xb7, 0x01, 0x26, 0x34, 0xb4, 0x5e, 0x52, - 0x97, 0x33, 0x5b, 0x59, 0x55, 0x9f, 0xd0, 0xf0, 0xe7, 0x38, 0x21, 0xaa, 0x21, 0x21, 0x5e, 0x84, - 0xcc, 0x46, 0xf3, 0x96, 0xcd, 0xfa, 0x84, 0x86, 0xcf, 0x42, 0x66, 0xa7, 0xce, 0x56, 0x7f, 0x93, - 0xb3, 0x65, 0xed, 0xd9, 0xc8, 0xdb, 0xf3, 0xdf, 0x29, 0x5f, 0x4e, 0xc8, 0xf2, 0x9b, 0x71, 0xf6, - 0x7f, 0x68, 0xa2, 0x4e, 0xc8, 0xa6, 0x64, 0x72, 0x04, 0x97, 0xe2, 0x98, 0xb2, 0x16, 0x18, 0x6b, - 0x91, 0x57, 0xbd, 0x3e, 0x14, 0xbb, 0xa7, 0xd9, 0xe9, 0x90, 0x7c, 0x02, 0xd7, 0x72, 0x19, 0x21, - 0x5e, 0xb0, 0xf4, 0xda, 0xc4, 0x70, 0x25, 0x9b, 0x18, 0xa2, 0xf5, 0x12, 0x6b, 0x94, 0xdf, 0xc8, - 0xcb, 0xbf, 0x23, 0x0a, 0xac, 0x34, 0x99, 0x14, 0x7d, 0x53, 0xe3, 0x37, 0x1a, 0x74, 0x72, 0x1b, - 0x22, 0xdb, 0x50, 0x95, 0x7c, 0xa6, 0x65, 0xda, 0x58, 0xb4, 0x98, 0xda, 0xb3, 0x04, 0x90, 0xf7, - 0xa1, 0xc1, 0x54, 0xad, 0xa7, 0x0e, 0x79, 0x25, 0x57, 0x02, 0x2a, 0x7c, 0x0c, 0x23, 0xdf, 0x03, - 0x3d, 0x36, 0x5d, 0xae, 0xce, 0x8f, 0x2d, 0xad, 0x94, 0x12, 0xa0, 0xf1, 0x00, 0x9a, 0xa9, 0xd7, - 0x93, 0x6f, 0x81, 0x3e, 0xa7, 0x4b, 0x55, 0xac, 0xcb, 0xf2, 0xad, 0x31, 0xa7, 0x4b, 0xac, 0xd3, - 0xc9, 0x35, 0xa8, 0x0b, 0xe1, 0x84, 0x4a, 0xc3, 0x97, 0xcd, 0xda, 0x9c, 0x2e, 0x7f, 0x4c, 0x43, - 0x63, 0x07, 0xda, 0xd9, 0x6d, 0x45, 0xd0, 0x88, 0x10, 0x25, 0xf4, 0x60, 0xc2, 0x8c, 0xbb, 0xd0, - 0xc9, 0xed, 0x86, 0x18, 0xd0, 0xf2, 0x17, 0x23, 0xeb, 0x05, 0x3b, 0xb3, 0x70, 0xbb, 0xe8, 0x26, - 0xba, 0xd9, 0xf4, 0x17, 0xa3, 0x8f, 0xd9, 0x99, 0xa8, 0x47, 0x43, 0xe3, 0x09, 0xb4, 0xb3, 0x65, - 0xb4, 0x48, 0x99, 0x81, 0xb7, 0x70, 0x6d, 0x5c, 0xbf, 0x6a, 0xca, 0x81, 0xe8, 0xc4, 0x4f, 0x3d, - 0xe9, 0x19, 0xe9, 0xba, 0xf9, 0xc4, 0xe3, 0x2c, 0x55, 0x7c, 0x4b, 0x8c, 0xe1, 0x40, 0x15, 0xbf, - 0xb9, 0xf8, 0x7e, 0x58, 0x10, 0x2b, 0x0a, 0x16, 0xcf, 0xe4, 0x31, 0x00, 0xe5, 0x3c, 0x70, 0x46, - 0x8b, 0x64, 0xb9, 0xf6, 0x40, 0x5e, 0x8f, 0x0c, 0x3e, 0x3e, 0x39, 0xa6, 0x4e, 0x30, 0xbc, 0xa1, - 0x7c, 0x65, 0x23, 0x41, 0xa6, 0xfc, 0x25, 0xa5, 0x6f, 0xfc, 0xaa, 0x0a, 0x35, 0xd9, 0x3e, 0x90, - 0x41, 0xb6, 0x39, 0x15, 0xab, 0xaa, 0x4d, 0xca, 0x59, 0xb5, 0xc7, 0x98, 0xf1, 0x6f, 0xe7, 0x3b, - 0xbc, 0x61, 0xf3, 0xfc, 0xd5, 0x56, 0x1d, 0xd9, 0xf2, 0xe8, 0x61, 0xd2, 0xee, 0xad, 0xea, 0x86, - 0xa2, 0xde, 0xb2, 0xf2, 0xb5, 0x7b, 0xcb, 0x6b, 0x50, 0x77, 0x17, 0x73, 0x8b, 0x2f, 0x43, 0x95, - 0x6d, 0x6a, 0xee, 0x62, 0xfe, 0x74, 0x89, 0x5e, 0xc2, 0x3d, 0x4e, 0x67, 0x28, 0x92, 0xb9, 0xa6, - 0x81, 0x13, 0x42, 0xb8, 0x0f, 0xad, 0x54, 0x51, 0xe1, 0xd8, 0xaa, 0x38, 0x6d, 0xa7, 0x9d, 0xfd, - 0xe8, 0xa1, 0x3a, 0x65, 0x33, 0x2e, 0x32, 0x8e, 0x6c, 0xb2, 0x9d, 0x6d, 0xa5, 0xb0, 0x16, 0x69, - 0x60, 0x48, 0xa5, 0xba, 0x25, 0x51, 0x89, 0x88, 0x0d, 0x88, 0x20, 0x93, 0x10, 0x1d, 0x21, 0x0d, - 0x31, 0x81, 0xc2, 0xb7, 0xa0, 0x93, 0xd0, 0xb9, 0x84, 0x80, 0x5c, 0x25, 0x99, 0x46, 0xe0, 0x7b, - 0xb0, 0xe1, 0xb2, 0x25, 0xb7, 0xf2, 0xe8, 0x26, 0xa2, 0x89, 0x90, 0x9d, 0x64, 0x35, 0xbe, 0x0b, - 0xed, 0x24, 0x15, 0x21, 0x76, 0x5d, 0x36, 0xb4, 0xf1, 0x2c, 0xc2, 0xae, 0x43, 0x23, 0x2e, 0xa6, - 0x5a, 0x08, 0xa8, 0x53, 0x59, 0x43, 0xc5, 0xe5, 0x59, 0xc0, 0xc2, 0xc5, 0x8c, 0xab, 0x45, 0xda, - 0x88, 0xc1, 0xf2, 0xcc, 0x94, 0xf3, 0x88, 0xbd, 0x05, 0xad, 0x28, 0xba, 0x25, 0xae, 0x83, 0xb8, - 0xf5, 0x68, 0x12, 0x41, 0x3b, 0xd0, 0xf5, 0x03, 0xcf, 0xf7, 0x42, 0x16, 0x58, 0xd4, 0xb6, 0x03, - 0x16, 0x86, 0xbd, 0xae, 0x5c, 0x2f, 0x9a, 0x3f, 0x90, 0xd3, 0xc6, 0xfb, 0x50, 0x8f, 0xaa, 0xc4, - 0x0d, 0xa8, 0x0e, 0xe3, 0x4c, 0x54, 0x31, 0xe5, 0x40, 0xf0, 0xd0, 0x81, 0xef, 0xab, 0x3b, 0x11, - 0xf1, 0x68, 0xfc, 0x02, 0xea, 0xea, 0x83, 0x15, 0x76, 0xca, 0x3f, 0x84, 0x75, 0x9f, 0x06, 0xe2, - 0x18, 0xe9, 0x7e, 0x39, 0xea, 0x43, 0x8e, 0x69, 0xc0, 0x9f, 0x30, 0x9e, 0x69, 0x9b, 0x9b, 0x88, - 0x97, 0x53, 0xc6, 0x3d, 0x68, 0x65, 0x30, 0x62, 0x5b, 0xe8, 0x47, 0x51, 0x50, 0xe3, 0x20, 0x7e, - 0x73, 0x29, 0x79, 0xb3, 0x71, 0x1f, 0xf4, 0xf8, 0xdb, 0x88, 0x72, 0x39, 0x3a, 0xba, 0xa6, 0xcc, - 0x2d, 0x87, 0x78, 0x15, 0xe0, 0xbd, 0x64, 0x81, 0x8a, 0x09, 0x39, 0x30, 0x9e, 0xa5, 0x92, 0x90, - 0x64, 0x05, 0x72, 0x07, 0xea, 0x2a, 0x09, 0xa9, 0xa8, 0x8c, 0x9a, 0xfe, 0x63, 0xcc, 0x42, 0x51, - 0xd3, 0x2f, 0x73, 0x52, 0xb2, 0x6c, 0x29, 0xbd, 0xec, 0x0c, 0x1a, 0x51, 0xa2, 0xc9, 0x66, 0x63, - 0xb9, 0x62, 0x37, 0x9f, 0x8d, 0xd5, 0xa2, 0x09, 0x50, 0x78, 0x47, 0xe8, 0x4c, 0x5c, 0x66, 0x5b, - 0x49, 0x08, 0xe1, 0x3b, 0x1a, 0x66, 0x47, 0x0a, 0x1e, 0x47, 0xf1, 0x62, 0xbc, 0x07, 0x35, 0xb9, - 0xb7, 0xc2, 0xf4, 0x55, 0x44, 0x49, 0x7f, 0xd4, 0xa0, 0x11, 0xe5, 0xe9, 0x42, 0xa5, 0xcc, 0xa6, - 0x4b, 0x5f, 0x75, 0xd3, 0xff, 0xff, 0xc4, 0x73, 0x07, 0x88, 0xcc, 0x2f, 0xa7, 0x1e, 0x77, 0xdc, - 0x89, 0x25, 0x6d, 0x2d, 0x73, 0x50, 0x17, 0x25, 0x27, 0x28, 0x38, 0x16, 0xf3, 0x6f, 0xdf, 0x82, - 0x66, 0xea, 0xee, 0x82, 0xd4, 0xa1, 0xfc, 0x09, 0x7b, 0xd9, 0x5d, 0x23, 0x4d, 0xa8, 0x9b, 0x0c, - 0x3b, 0xd1, 0xae, 0xb6, 0xf7, 0x59, 0x15, 0x3a, 0x07, 0xc3, 0x07, 0x47, 0x07, 0xbe, 0x3f, 0x73, - 0xc6, 0x14, 0x5b, 0x97, 0x5d, 0xa8, 0x60, 0xf7, 0x56, 0x70, 0x4b, 0xdd, 0x2f, 0xba, 0x46, 0x20, - 0x7b, 0x50, 0xc5, 0x26, 0x8e, 0x14, 0x5d, 0x56, 0xf7, 0x0b, 0x6f, 0x13, 0xc4, 0x4b, 0x64, 0x9b, - 0x77, 0xf1, 0xce, 0xba, 0x5f, 0x74, 0xa5, 0x40, 0x3e, 0x02, 0x3d, 0xe9, 0xae, 0x56, 0xdd, 0x5c, - 0xf7, 0x57, 0x5e, 0x2e, 0x08, 0xfd, 0xa4, 0x02, 0x5d, 0x75, 0x01, 0xdb, 0x5f, 0xd9, 0x85, 0x93, - 0x7d, 0xa8, 0x47, 0xb5, 0x7b, 0xf1, 0xdd, 0x72, 0x7f, 0x45, 0xe3, 0x2f, 0xcc, 0x23, 0x1b, 0xa6, - 0xa2, 0x0b, 0xf0, 0x7e, 0xe1, 0xed, 0x04, 0xb9, 0x0b, 0x35, 0x55, 0x44, 0x15, 0xde, 0x2f, 0xf7, - 0x8b, 0xdb, 0x77, 0x71, 0xc8, 0xa4, 0x65, 0x5c, 0x75, 0x49, 0xdf, 0x5f, 0x79, 0x8d, 0x42, 0x0e, - 0x00, 0x52, 0x7d, 0xcf, 0xca, 0xdb, 0xf7, 0xfe, 0xea, 0xeb, 0x11, 0x72, 0x1f, 0x1a, 0xc9, 0x95, - 0x57, 0xf1, 0x7d, 0x7a, 0x7f, 0xd5, 0x8d, 0xc5, 0xf0, 0xc6, 0xbf, 0xfe, 0xb2, 0xa9, 0xfd, 0xf6, - 0x7c, 0x53, 0xfb, 0xe2, 0x7c, 0x53, 0xfb, 0xf2, 0x7c, 0x53, 0xfb, 0xc3, 0xf9, 0xa6, 0xf6, 0xe7, - 0xf3, 0x4d, 0xed, 0x77, 0x7f, 0xdd, 0xd4, 0x46, 0x35, 0x8c, 0x91, 0x0f, 0xfe, 0x13, 0x00, 0x00, - 0xff, 0xff, 0x92, 0xed, 0x9f, 0xca, 0x3f, 0x1a, 0x00, 0x00, -} diff --git a/abci/types/typespb_test.go b/abci/types/typespb_test.go index 523561532..e900d3841 100644 --- a/abci/types/typespb_test.go +++ b/abci/types/typespb_test.go @@ -3,19 +3,21 @@ package types -import testing "testing" -import math_rand "math/rand" -import time "time" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" -import proto "github.com/gogo/protobuf/proto" -import golang_proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "github.com/tendermint/tendermint/crypto/merkle" -import _ "github.com/tendermint/tendermint/libs/common" +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" + github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" + proto "github.com/gogo/protobuf/proto" + golang_proto "github.com/golang/protobuf/proto" + _ "github.com/golang/protobuf/ptypes/timestamp" + _ "github.com/tendermint/tendermint/crypto/merkle" + _ "github.com/tendermint/tendermint/libs/common" + math "math" + math_rand "math/rand" + testing "testing" + time "time" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/crypto/merkle/merkle.pb.go b/crypto/merkle/merkle.pb.go index 5b7e15c5a..2ebbee155 100644 --- a/crypto/merkle/merkle.pb.go +++ b/crypto/merkle/merkle.pb.go @@ -3,14 +3,15 @@ package merkle -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import bytes "bytes" - -import io "io" +import ( + bytes "bytes" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // ProofOp defines an operation used for calculating Merkle root // The data could be arbitrary format, providing nessecary data @@ -39,7 +40,7 @@ func (m *ProofOp) Reset() { *m = ProofOp{} } func (m *ProofOp) String() string { return proto.CompactTextString(m) } func (*ProofOp) ProtoMessage() {} func (*ProofOp) Descriptor() ([]byte, []int) { - return fileDescriptor_merkle_24be8bc4e405ac66, []int{0} + return fileDescriptor_9c1c2162d560d38e, []int{0} } func (m *ProofOp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -49,15 +50,15 @@ func (m *ProofOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ProofOp.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ProofOp) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProofOp.Merge(dst, src) +func (m *ProofOp) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProofOp.Merge(m, src) } func (m *ProofOp) XXX_Size() int { return m.Size() @@ -91,7 +92,7 @@ func (m *ProofOp) GetData() []byte { // Proof is Merkle proof defined by the list of ProofOps type Proof struct { - Ops []ProofOp `protobuf:"bytes,1,rep,name=ops" json:"ops"` + Ops []ProofOp `protobuf:"bytes,1,rep,name=ops,proto3" json:"ops"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -101,7 +102,7 @@ func (m *Proof) Reset() { *m = Proof{} } func (m *Proof) String() string { return proto.CompactTextString(m) } func (*Proof) ProtoMessage() {} func (*Proof) Descriptor() ([]byte, []int) { - return fileDescriptor_merkle_24be8bc4e405ac66, []int{1} + return fileDescriptor_9c1c2162d560d38e, []int{1} } func (m *Proof) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -111,15 +112,15 @@ func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Proof.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Proof) XXX_Merge(src proto.Message) { - xxx_messageInfo_Proof.Merge(dst, src) +func (m *Proof) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proof.Merge(m, src) } func (m *Proof) XXX_Size() int { return m.Size() @@ -141,6 +142,26 @@ func init() { proto.RegisterType((*ProofOp)(nil), "merkle.ProofOp") proto.RegisterType((*Proof)(nil), "merkle.Proof") } + +func init() { proto.RegisterFile("crypto/merkle/merkle.proto", fileDescriptor_9c1c2162d560d38e) } + +var fileDescriptor_9c1c2162d560d38e = []byte{ + // 200 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0x2e, 0xaa, 0x2c, + 0x28, 0xc9, 0xd7, 0xcf, 0x4d, 0x2d, 0xca, 0xce, 0x49, 0x85, 0x52, 0x7a, 0x05, 0x45, 0xf9, 0x25, + 0xf9, 0x42, 0x6c, 0x10, 0x9e, 0x94, 0x6e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, + 0xae, 0x7e, 0x7a, 0x7e, 0x7a, 0xbe, 0x3e, 0x58, 0x3a, 0xa9, 0x34, 0x0d, 0xcc, 0x03, 0x73, 0xc0, + 0x2c, 0x88, 0x36, 0x25, 0x67, 0x2e, 0xf6, 0x80, 0xa2, 0xfc, 0xfc, 0x34, 0xff, 0x02, 0x21, 0x21, + 0x2e, 0x96, 0x92, 0xca, 0x82, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x30, 0x5b, 0x48, + 0x80, 0x8b, 0x39, 0x3b, 0xb5, 0x52, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xc4, 0x04, 0xa9, + 0x4a, 0x49, 0x2c, 0x49, 0x94, 0x60, 0x06, 0x0b, 0x81, 0xd9, 0x4a, 0x06, 0x5c, 0xac, 0x60, 0x43, + 0x84, 0xd4, 0xb9, 0x98, 0xf3, 0x0b, 0x8a, 0x25, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0xf8, 0xf5, + 0xa0, 0x0e, 0x84, 0x5a, 0xe0, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x48, 0x85, 0x93, 0xc8, + 0x8f, 0x87, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, + 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x49, 0x6c, 0x60, 0x37, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, + 0xb9, 0x2b, 0x0f, 0xd1, 0xe8, 0x00, 0x00, 0x00, +} + func (this *ProofOp) Equal(that interface{}) bool { if that == nil { return this == nil @@ -209,7 +230,7 @@ func (this *Proof) Equal(that interface{}) bool { func (m *ProofOp) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -217,38 +238,47 @@ func (m *ProofOp) Marshal() (dAtA []byte, err error) { } func (m *ProofOp) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProofOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Type) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintMerkle(dAtA, i, uint64(len(m.Type))) - i += copy(dAtA[i:], m.Type) - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintMerkle(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Data) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.Data) + copy(dAtA[i:], m.Data) i = encodeVarintMerkle(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) + i-- + dAtA[i] = 0x1a } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintMerkle(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintMerkle(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Proof) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -256,36 +286,46 @@ func (m *Proof) Marshal() (dAtA []byte, err error) { } func (m *Proof) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Ops) > 0 { - for _, msg := range m.Ops { - dAtA[i] = 0xa - i++ - i = encodeVarintMerkle(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Ops) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Ops[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMerkle(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func encodeVarintMerkle(dAtA []byte, offset int, v uint64) int { + offset -= sovMerkle(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func NewPopulatedProofOp(r randyMerkle, easy bool) *ProofOp { this := &ProofOp{} @@ -308,7 +348,7 @@ func NewPopulatedProofOp(r randyMerkle, easy bool) *ProofOp { func NewPopulatedProof(r randyMerkle, easy bool) *Proof { this := &Proof{} - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v3 := r.Intn(5) this.Ops = make([]ProofOp, v3) for i := 0; i < v3; i++ { @@ -437,14 +477,7 @@ func (m *Proof) Size() (n int) { } func sovMerkle(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozMerkle(x uint64) (n int) { return sovMerkle(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -464,7 +497,7 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -492,7 +525,7 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -502,6 +535,9 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMerkle } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMerkle + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -521,7 +557,7 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -530,6 +566,9 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMerkle } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMerkle + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -552,7 +591,7 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -561,6 +600,9 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMerkle } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMerkle + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -578,6 +620,9 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMerkle } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMerkle + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -606,7 +651,7 @@ func (m *Proof) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -634,7 +679,7 @@ func (m *Proof) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -643,6 +688,9 @@ func (m *Proof) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMerkle } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMerkle + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -660,6 +708,9 @@ func (m *Proof) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMerkle } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMerkle + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -727,10 +778,13 @@ func skipMerkle(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthMerkle } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthMerkle + } return iNdEx, nil case 3: for { @@ -759,6 +813,9 @@ func skipMerkle(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthMerkle + } } return iNdEx, nil case 4: @@ -777,22 +834,3 @@ var ( ErrInvalidLengthMerkle = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowMerkle = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("crypto/merkle/merkle.proto", fileDescriptor_merkle_24be8bc4e405ac66) } - -var fileDescriptor_merkle_24be8bc4e405ac66 = []byte{ - // 200 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0x2e, 0xaa, 0x2c, - 0x28, 0xc9, 0xd7, 0xcf, 0x4d, 0x2d, 0xca, 0xce, 0x49, 0x85, 0x52, 0x7a, 0x05, 0x45, 0xf9, 0x25, - 0xf9, 0x42, 0x6c, 0x10, 0x9e, 0x94, 0x6e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, - 0xae, 0x7e, 0x7a, 0x7e, 0x7a, 0xbe, 0x3e, 0x58, 0x3a, 0xa9, 0x34, 0x0d, 0xcc, 0x03, 0x73, 0xc0, - 0x2c, 0x88, 0x36, 0x25, 0x67, 0x2e, 0xf6, 0x80, 0xa2, 0xfc, 0xfc, 0x34, 0xff, 0x02, 0x21, 0x21, - 0x2e, 0x96, 0x92, 0xca, 0x82, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x30, 0x5b, 0x48, - 0x80, 0x8b, 0x39, 0x3b, 0xb5, 0x52, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xc4, 0x04, 0xa9, - 0x4a, 0x49, 0x2c, 0x49, 0x94, 0x60, 0x06, 0x0b, 0x81, 0xd9, 0x4a, 0x06, 0x5c, 0xac, 0x60, 0x43, - 0x84, 0xd4, 0xb9, 0x98, 0xf3, 0x0b, 0x8a, 0x25, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0xf8, 0xf5, - 0xa0, 0x0e, 0x84, 0x5a, 0xe0, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x48, 0x85, 0x93, 0xc8, - 0x8f, 0x87, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, - 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x49, 0x6c, 0x60, 0x37, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, - 0xb9, 0x2b, 0x0f, 0xd1, 0xe8, 0x00, 0x00, 0x00, -} diff --git a/libs/common/types.pb.go b/libs/common/types.pb.go index 46a714d23..1f6cd3a41 100644 --- a/libs/common/types.pb.go +++ b/libs/common/types.pb.go @@ -3,15 +3,16 @@ package common -import proto "github.com/gogo/protobuf/proto" -import golang_proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import bytes "bytes" - -import io "io" +import ( + bytes "bytes" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + golang_proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -23,7 +24,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Define these here for compatibility but use tmlibs/common.KVPair. type KVPair struct { @@ -38,7 +39,7 @@ func (m *KVPair) Reset() { *m = KVPair{} } func (m *KVPair) String() string { return proto.CompactTextString(m) } func (*KVPair) ProtoMessage() {} func (*KVPair) Descriptor() ([]byte, []int) { - return fileDescriptor_types_a863d437ea36eb85, []int{0} + return fileDescriptor_28b36ea5054b507d, []int{0} } func (m *KVPair) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -48,15 +49,15 @@ func (m *KVPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_KVPair.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *KVPair) XXX_Merge(src proto.Message) { - xxx_messageInfo_KVPair.Merge(dst, src) +func (m *KVPair) XXX_Merge(src proto.Message) { + xxx_messageInfo_KVPair.Merge(m, src) } func (m *KVPair) XXX_Size() int { return m.Size() @@ -94,7 +95,7 @@ func (m *KI64Pair) Reset() { *m = KI64Pair{} } func (m *KI64Pair) String() string { return proto.CompactTextString(m) } func (*KI64Pair) ProtoMessage() {} func (*KI64Pair) Descriptor() ([]byte, []int) { - return fileDescriptor_types_a863d437ea36eb85, []int{1} + return fileDescriptor_28b36ea5054b507d, []int{1} } func (m *KI64Pair) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -104,15 +105,15 @@ func (m *KI64Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_KI64Pair.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *KI64Pair) XXX_Merge(src proto.Message) { - xxx_messageInfo_KI64Pair.Merge(dst, src) +func (m *KI64Pair) XXX_Merge(src proto.Message) { + xxx_messageInfo_KI64Pair.Merge(m, src) } func (m *KI64Pair) XXX_Size() int { return m.Size() @@ -143,6 +144,25 @@ func init() { proto.RegisterType((*KI64Pair)(nil), "common.KI64Pair") golang_proto.RegisterType((*KI64Pair)(nil), "common.KI64Pair") } + +func init() { proto.RegisterFile("libs/common/types.proto", fileDescriptor_28b36ea5054b507d) } +func init() { golang_proto.RegisterFile("libs/common/types.proto", fileDescriptor_28b36ea5054b507d) } + +var fileDescriptor_28b36ea5054b507d = []byte{ + // 174 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0xc9, 0x4c, 0x2a, + 0xd6, 0x4f, 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0xd3, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0x88, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, + 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xa5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, + 0x30, 0x07, 0xcc, 0x82, 0x68, 0x53, 0x32, 0xe0, 0x62, 0xf3, 0x0e, 0x0b, 0x48, 0xcc, 0x2c, 0x12, + 0x12, 0xe0, 0x62, 0xce, 0x4e, 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09, 0x02, 0x31, 0x85, + 0x44, 0xb8, 0x58, 0xcb, 0x12, 0x73, 0x4a, 0x53, 0x25, 0x98, 0xc0, 0x62, 0x10, 0x8e, 0x92, 0x11, + 0x17, 0x87, 0xb7, 0xa7, 0x99, 0x09, 0x31, 0x7a, 0x98, 0xa1, 0x7a, 0x9c, 0x64, 0x7e, 0x3c, 0x94, + 0x63, 0x5c, 0xf1, 0x48, 0x8e, 0x71, 0xc7, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, + 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0xf1, 0xc0, 0x63, 0x39, 0xc6, 0x24, 0x36, 0xb0, 0x53, 0x8c, + 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x39, 0xe1, 0xef, 0xdc, 0x00, 0x00, 0x00, +} + func (this *KVPair) Equal(that interface{}) bool { if that == nil { return this == nil @@ -206,7 +226,7 @@ func (this *KI64Pair) Equal(that interface{}) bool { func (m *KVPair) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -214,32 +234,40 @@ func (m *KVPair) Marshal() (dAtA []byte, err error) { } func (m *KVPair) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KVPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Value) + copy(dAtA[i:], m.Value) i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *KI64Pair) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -247,35 +275,44 @@ func (m *KI64Pair) Marshal() (dAtA []byte, err error) { } func (m *KI64Pair) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KI64Pair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Value != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func NewPopulatedKVPair(r randyTypes, easy bool) *KVPair { this := &KVPair{} @@ -424,14 +461,7 @@ func (m *KI64Pair) Size() (n int) { } func sovTypes(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -451,7 +481,7 @@ func (m *KVPair) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -479,7 +509,7 @@ func (m *KVPair) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -488,6 +518,9 @@ func (m *KVPair) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -510,7 +543,7 @@ func (m *KVPair) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -519,6 +552,9 @@ func (m *KVPair) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -536,6 +572,9 @@ func (m *KVPair) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -564,7 +603,7 @@ func (m *KI64Pair) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -592,7 +631,7 @@ func (m *KI64Pair) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -601,6 +640,9 @@ func (m *KI64Pair) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -623,7 +665,7 @@ func (m *KI64Pair) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Value |= (int64(b) & 0x7F) << shift + m.Value |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -637,6 +679,9 @@ func (m *KI64Pair) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -704,10 +749,13 @@ func skipTypes(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthTypes } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } return iNdEx, nil case 3: for { @@ -736,6 +784,9 @@ func skipTypes(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } } return iNdEx, nil case 4: @@ -754,23 +805,3 @@ var ( ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("libs/common/types.proto", fileDescriptor_types_a863d437ea36eb85) } -func init() { - golang_proto.RegisterFile("libs/common/types.proto", fileDescriptor_types_a863d437ea36eb85) -} - -var fileDescriptor_types_a863d437ea36eb85 = []byte{ - // 174 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0xc9, 0x4c, 0x2a, - 0xd6, 0x4f, 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0xd3, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x83, 0x88, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, - 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xa5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, - 0x30, 0x07, 0xcc, 0x82, 0x68, 0x53, 0x32, 0xe0, 0x62, 0xf3, 0x0e, 0x0b, 0x48, 0xcc, 0x2c, 0x12, - 0x12, 0xe0, 0x62, 0xce, 0x4e, 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09, 0x02, 0x31, 0x85, - 0x44, 0xb8, 0x58, 0xcb, 0x12, 0x73, 0x4a, 0x53, 0x25, 0x98, 0xc0, 0x62, 0x10, 0x8e, 0x92, 0x11, - 0x17, 0x87, 0xb7, 0xa7, 0x99, 0x09, 0x31, 0x7a, 0x98, 0xa1, 0x7a, 0x9c, 0x64, 0x7e, 0x3c, 0x94, - 0x63, 0x5c, 0xf1, 0x48, 0x8e, 0x71, 0xc7, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, - 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0xf1, 0xc0, 0x63, 0x39, 0xc6, 0x24, 0x36, 0xb0, 0x53, 0x8c, - 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x39, 0xe1, 0xef, 0xdc, 0x00, 0x00, 0x00, -} diff --git a/libs/common/typespb_test.go b/libs/common/typespb_test.go index 439cc1273..a4b96a389 100644 --- a/libs/common/typespb_test.go +++ b/libs/common/typespb_test.go @@ -3,16 +3,18 @@ package common -import testing "testing" -import math_rand "math/rand" -import time "time" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" -import proto "github.com/gogo/protobuf/proto" -import golang_proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" + github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" + proto "github.com/gogo/protobuf/proto" + golang_proto "github.com/golang/protobuf/proto" + math "math" + math_rand "math/rand" + testing "testing" + time "time" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/rpc/grpc/types.pb.go b/rpc/grpc/types.pb.go index 2fd469159..86552a4b5 100644 --- a/rpc/grpc/types.pb.go +++ b/rpc/grpc/types.pb.go @@ -3,22 +3,22 @@ package core_grpc -import proto "github.com/gogo/protobuf/proto" -import golang_proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import types "github.com/tendermint/tendermint/abci/types" - -import bytes "bytes" - import ( - context "golang.org/x/net/context" + bytes "bytes" + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + golang_proto "github.com/golang/protobuf/proto" + types "github.com/tendermint/tendermint/abci/types" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) -import io "io" - // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = golang_proto.Marshal @@ -29,7 +29,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type RequestPing struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -41,7 +41,7 @@ func (m *RequestPing) Reset() { *m = RequestPing{} } func (m *RequestPing) String() string { return proto.CompactTextString(m) } func (*RequestPing) ProtoMessage() {} func (*RequestPing) Descriptor() ([]byte, []int) { - return fileDescriptor_types_8721e2f2d306fca2, []int{0} + return fileDescriptor_15f63baabf91876a, []int{0} } func (m *RequestPing) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -51,15 +51,15 @@ func (m *RequestPing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_RequestPing.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestPing) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestPing.Merge(dst, src) +func (m *RequestPing) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestPing.Merge(m, src) } func (m *RequestPing) XXX_Size() int { return m.Size() @@ -81,7 +81,7 @@ func (m *RequestBroadcastTx) Reset() { *m = RequestBroadcastTx{} } func (m *RequestBroadcastTx) String() string { return proto.CompactTextString(m) } func (*RequestBroadcastTx) ProtoMessage() {} func (*RequestBroadcastTx) Descriptor() ([]byte, []int) { - return fileDescriptor_types_8721e2f2d306fca2, []int{1} + return fileDescriptor_15f63baabf91876a, []int{1} } func (m *RequestBroadcastTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -91,15 +91,15 @@ func (m *RequestBroadcastTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_RequestBroadcastTx.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestBroadcastTx) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestBroadcastTx.Merge(dst, src) +func (m *RequestBroadcastTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestBroadcastTx.Merge(m, src) } func (m *RequestBroadcastTx) XXX_Size() int { return m.Size() @@ -127,7 +127,7 @@ func (m *ResponsePing) Reset() { *m = ResponsePing{} } func (m *ResponsePing) String() string { return proto.CompactTextString(m) } func (*ResponsePing) ProtoMessage() {} func (*ResponsePing) Descriptor() ([]byte, []int) { - return fileDescriptor_types_8721e2f2d306fca2, []int{2} + return fileDescriptor_15f63baabf91876a, []int{2} } func (m *ResponsePing) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -137,15 +137,15 @@ func (m *ResponsePing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_ResponsePing.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponsePing) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponsePing.Merge(dst, src) +func (m *ResponsePing) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponsePing.Merge(m, src) } func (m *ResponsePing) XXX_Size() int { return m.Size() @@ -157,8 +157,8 @@ func (m *ResponsePing) XXX_DiscardUnknown() { var xxx_messageInfo_ResponsePing proto.InternalMessageInfo type ResponseBroadcastTx struct { - CheckTx *types.ResponseCheckTx `protobuf:"bytes,1,opt,name=check_tx,json=checkTx" json:"check_tx,omitempty"` - DeliverTx *types.ResponseDeliverTx `protobuf:"bytes,2,opt,name=deliver_tx,json=deliverTx" json:"deliver_tx,omitempty"` + CheckTx *types.ResponseCheckTx `protobuf:"bytes,1,opt,name=check_tx,json=checkTx,proto3" json:"check_tx,omitempty"` + DeliverTx *types.ResponseDeliverTx `protobuf:"bytes,2,opt,name=deliver_tx,json=deliverTx,proto3" json:"deliver_tx,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -168,7 +168,7 @@ func (m *ResponseBroadcastTx) Reset() { *m = ResponseBroadcastTx{} } func (m *ResponseBroadcastTx) String() string { return proto.CompactTextString(m) } func (*ResponseBroadcastTx) ProtoMessage() {} func (*ResponseBroadcastTx) Descriptor() ([]byte, []int) { - return fileDescriptor_types_8721e2f2d306fca2, []int{3} + return fileDescriptor_15f63baabf91876a, []int{3} } func (m *ResponseBroadcastTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -178,15 +178,15 @@ func (m *ResponseBroadcastTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_ResponseBroadcastTx.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseBroadcastTx) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseBroadcastTx.Merge(dst, src) +func (m *ResponseBroadcastTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseBroadcastTx.Merge(m, src) } func (m *ResponseBroadcastTx) XXX_Size() int { return m.Size() @@ -221,6 +221,35 @@ func init() { proto.RegisterType((*ResponseBroadcastTx)(nil), "core_grpc.ResponseBroadcastTx") golang_proto.RegisterType((*ResponseBroadcastTx)(nil), "core_grpc.ResponseBroadcastTx") } + +func init() { proto.RegisterFile("rpc/grpc/types.proto", fileDescriptor_15f63baabf91876a) } +func init() { golang_proto.RegisterFile("rpc/grpc/types.proto", fileDescriptor_15f63baabf91876a) } + +var fileDescriptor_15f63baabf91876a = []byte{ + // 321 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x2a, 0x48, 0xd6, + 0x4f, 0x07, 0x11, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c, + 0xc9, 0xf9, 0x45, 0xa9, 0xf1, 0x20, 0x61, 0x29, 0xdd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, + 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xfc, 0xf4, 0x7c, 0x7d, 0xb0, 0x8a, 0xa4, 0xd2, 0x34, 0x30, 0x0f, + 0xcc, 0x01, 0xb3, 0x20, 0x3a, 0xa5, 0xcc, 0x91, 0x94, 0x97, 0xa4, 0xe6, 0xa5, 0xa4, 0x16, 0xe5, + 0x66, 0xe6, 0x95, 0x20, 0x33, 0x13, 0x93, 0x92, 0x33, 0x21, 0x96, 0x21, 0x5b, 0xa9, 0xc4, 0xcb, + 0xc5, 0x1d, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0x12, 0x90, 0x99, 0x97, 0xae, 0xa4, 0xc2, 0x25, + 0x04, 0xe5, 0x3a, 0x15, 0xe5, 0x27, 0xa6, 0x24, 0x27, 0x16, 0x97, 0x84, 0x54, 0x08, 0xf1, 0x71, + 0x31, 0x95, 0x54, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x31, 0x95, 0x54, 0x28, 0xf1, 0x71, + 0xf1, 0x04, 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x82, 0x75, 0x35, 0x32, 0x72, 0x09, 0xc3, + 0x04, 0x90, 0xf5, 0x19, 0x72, 0x71, 0x24, 0x67, 0xa4, 0x26, 0x67, 0xc7, 0x43, 0x75, 0x73, 0x1b, + 0x89, 0xe9, 0x41, 0x2c, 0x87, 0xa9, 0x76, 0x06, 0x49, 0x87, 0x54, 0x04, 0xb1, 0x27, 0x43, 0x18, + 0x42, 0xe6, 0x5c, 0x5c, 0x29, 0xa9, 0x39, 0x99, 0x65, 0xa9, 0x45, 0x20, 0x4d, 0x4c, 0x60, 0x4d, + 0x12, 0x68, 0x9a, 0x5c, 0x20, 0x0a, 0x42, 0x2a, 0x82, 0x38, 0x53, 0x60, 0x4c, 0xa3, 0xa9, 0x8c, + 0x5c, 0x3c, 0x70, 0xbb, 0x1d, 0x03, 0x3c, 0x85, 0xcc, 0xb9, 0x58, 0x40, 0x8e, 0x13, 0x12, 0xd3, + 0x83, 0x87, 0xaa, 0x1e, 0x92, 0x57, 0xa5, 0xc4, 0x51, 0xc4, 0x11, 0xbe, 0x11, 0xf2, 0xe1, 0xe2, + 0x46, 0xf6, 0x84, 0x2c, 0xa6, 0x7e, 0x24, 0x69, 0x29, 0x39, 0x2c, 0xc6, 0x20, 0xc9, 0x3b, 0xc9, + 0xfc, 0x78, 0x28, 0xc7, 0xb8, 0xe2, 0x91, 0x1c, 0xe3, 0x8e, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, + 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x81, 0xc7, 0x72, 0x8c, 0x49, 0x6c, + 0xe0, 0x58, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd5, 0xa8, 0xe4, 0xd9, 0x10, 0x02, 0x00, + 0x00, +} + func (this *RequestPing) Equal(that interface{}) bool { if that == nil { return this == nil @@ -375,6 +404,17 @@ type BroadcastAPIServer interface { BroadcastTx(context.Context, *RequestBroadcastTx) (*ResponseBroadcastTx, error) } +// UnimplementedBroadcastAPIServer can be embedded to have forward compatible implementations. +type UnimplementedBroadcastAPIServer struct { +} + +func (*UnimplementedBroadcastAPIServer) Ping(ctx context.Context, req *RequestPing) (*ResponsePing, error) { + return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") +} +func (*UnimplementedBroadcastAPIServer) BroadcastTx(ctx context.Context, req *RequestBroadcastTx) (*ResponseBroadcastTx, error) { + return nil, status.Errorf(codes.Unimplemented, "method BroadcastTx not implemented") +} + func RegisterBroadcastAPIServer(s *grpc.Server, srv BroadcastAPIServer) { s.RegisterService(&_BroadcastAPI_serviceDesc, srv) } @@ -435,7 +475,7 @@ var _BroadcastAPI_serviceDesc = grpc.ServiceDesc{ func (m *RequestPing) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -443,20 +483,26 @@ func (m *RequestPing) Marshal() (dAtA []byte, err error) { } func (m *RequestPing) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestPing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + return len(dAtA) - i, nil } func (m *RequestBroadcastTx) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -464,26 +510,33 @@ func (m *RequestBroadcastTx) Marshal() (dAtA []byte, err error) { } func (m *RequestBroadcastTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestBroadcastTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Tx) > 0 { - dAtA[i] = 0xa - i++ + i -= len(m.Tx) + copy(dAtA[i:], m.Tx) i = encodeVarintTypes(dAtA, i, uint64(len(m.Tx))) - i += copy(dAtA[i:], m.Tx) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ResponsePing) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -491,20 +544,26 @@ func (m *ResponsePing) Marshal() (dAtA []byte, err error) { } func (m *ResponsePing) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponsePing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseBroadcastTx) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -512,44 +571,56 @@ func (m *ResponseBroadcastTx) Marshal() (dAtA []byte, err error) { } func (m *ResponseBroadcastTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseBroadcastTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.CheckTx != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.CheckTx.Size())) - n1, err := m.CheckTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.DeliverTx != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.DeliverTx.Size())) - n2, err := m.DeliverTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.DeliverTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.CheckTx != nil { + { + size, err := m.CheckTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func NewPopulatedRequestPing(r randyTypes, easy bool) *RequestPing { this := &RequestPing{} @@ -582,10 +653,10 @@ func NewPopulatedResponsePing(r randyTypes, easy bool) *ResponsePing { func NewPopulatedResponseBroadcastTx(r randyTypes, easy bool) *ResponseBroadcastTx { this := &ResponseBroadcastTx{} - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.CheckTx = types.NewPopulatedResponseCheckTx(r, easy) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.DeliverTx = types.NewPopulatedResponseDeliverTx(r, easy) } if !easy && r.Intn(10) != 0 { @@ -727,14 +798,7 @@ func (m *ResponseBroadcastTx) Size() (n int) { } func sovTypes(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -754,7 +818,7 @@ func (m *RequestPing) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -777,6 +841,9 @@ func (m *RequestPing) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -805,7 +872,7 @@ func (m *RequestBroadcastTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -833,7 +900,7 @@ func (m *RequestBroadcastTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -842,6 +909,9 @@ func (m *RequestBroadcastTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -859,6 +929,9 @@ func (m *RequestBroadcastTx) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -887,7 +960,7 @@ func (m *ResponsePing) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -910,6 +983,9 @@ func (m *ResponsePing) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -938,7 +1014,7 @@ func (m *ResponseBroadcastTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -966,7 +1042,7 @@ func (m *ResponseBroadcastTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -975,6 +1051,9 @@ func (m *ResponseBroadcastTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -999,7 +1078,7 @@ func (m *ResponseBroadcastTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1008,6 +1087,9 @@ func (m *ResponseBroadcastTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1027,6 +1109,9 @@ func (m *ResponseBroadcastTx) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -1094,10 +1179,13 @@ func skipTypes(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthTypes } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } return iNdEx, nil case 3: for { @@ -1126,6 +1214,9 @@ func skipTypes(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } } return iNdEx, nil case 4: @@ -1144,31 +1235,3 @@ var ( ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("rpc/grpc/types.proto", fileDescriptor_types_8721e2f2d306fca2) } -func init() { golang_proto.RegisterFile("rpc/grpc/types.proto", fileDescriptor_types_8721e2f2d306fca2) } - -var fileDescriptor_types_8721e2f2d306fca2 = []byte{ - // 321 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x2a, 0x48, 0xd6, - 0x4f, 0x07, 0x11, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c, - 0xc9, 0xf9, 0x45, 0xa9, 0xf1, 0x20, 0x61, 0x29, 0xdd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, - 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xfc, 0xf4, 0x7c, 0x7d, 0xb0, 0x8a, 0xa4, 0xd2, 0x34, 0x30, 0x0f, - 0xcc, 0x01, 0xb3, 0x20, 0x3a, 0xa5, 0xcc, 0x91, 0x94, 0x97, 0xa4, 0xe6, 0xa5, 0xa4, 0x16, 0xe5, - 0x66, 0xe6, 0x95, 0x20, 0x33, 0x13, 0x93, 0x92, 0x33, 0x21, 0x96, 0x21, 0x5b, 0xa9, 0xc4, 0xcb, - 0xc5, 0x1d, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0x12, 0x90, 0x99, 0x97, 0xae, 0xa4, 0xc2, 0x25, - 0x04, 0xe5, 0x3a, 0x15, 0xe5, 0x27, 0xa6, 0x24, 0x27, 0x16, 0x97, 0x84, 0x54, 0x08, 0xf1, 0x71, - 0x31, 0x95, 0x54, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x31, 0x95, 0x54, 0x28, 0xf1, 0x71, - 0xf1, 0x04, 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x82, 0x75, 0x35, 0x32, 0x72, 0x09, 0xc3, - 0x04, 0x90, 0xf5, 0x19, 0x72, 0x71, 0x24, 0x67, 0xa4, 0x26, 0x67, 0xc7, 0x43, 0x75, 0x73, 0x1b, - 0x89, 0xe9, 0x41, 0x2c, 0x87, 0xa9, 0x76, 0x06, 0x49, 0x87, 0x54, 0x04, 0xb1, 0x27, 0x43, 0x18, - 0x42, 0xe6, 0x5c, 0x5c, 0x29, 0xa9, 0x39, 0x99, 0x65, 0xa9, 0x45, 0x20, 0x4d, 0x4c, 0x60, 0x4d, - 0x12, 0x68, 0x9a, 0x5c, 0x20, 0x0a, 0x42, 0x2a, 0x82, 0x38, 0x53, 0x60, 0x4c, 0xa3, 0xa9, 0x8c, - 0x5c, 0x3c, 0x70, 0xbb, 0x1d, 0x03, 0x3c, 0x85, 0xcc, 0xb9, 0x58, 0x40, 0x8e, 0x13, 0x12, 0xd3, - 0x83, 0x87, 0xaa, 0x1e, 0x92, 0x57, 0xa5, 0xc4, 0x51, 0xc4, 0x11, 0xbe, 0x11, 0xf2, 0xe1, 0xe2, - 0x46, 0xf6, 0x84, 0x2c, 0xa6, 0x7e, 0x24, 0x69, 0x29, 0x39, 0x2c, 0xc6, 0x20, 0xc9, 0x3b, 0xc9, - 0xfc, 0x78, 0x28, 0xc7, 0xb8, 0xe2, 0x91, 0x1c, 0xe3, 0x8e, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, - 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x81, 0xc7, 0x72, 0x8c, 0x49, 0x6c, - 0xe0, 0x58, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd5, 0xa8, 0xe4, 0xd9, 0x10, 0x02, 0x00, - 0x00, -} diff --git a/rpc/grpc/typespb_test.go b/rpc/grpc/typespb_test.go index da076bf64..09b2d666b 100644 --- a/rpc/grpc/typespb_test.go +++ b/rpc/grpc/typespb_test.go @@ -3,17 +3,19 @@ package core_grpc -import testing "testing" -import math_rand "math/rand" -import time "time" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" -import proto "github.com/gogo/protobuf/proto" -import golang_proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/tendermint/tendermint/abci/types" +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" + github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" + proto "github.com/gogo/protobuf/proto" + golang_proto "github.com/golang/protobuf/proto" + _ "github.com/tendermint/tendermint/abci/types" + math "math" + math_rand "math/rand" + testing "testing" + time "time" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/types/proto3/block.pb.go b/types/proto3/block.pb.go index 0fee66c29..0478505ee 100644 --- a/types/proto3/block.pb.go +++ b/types/proto3/block.pb.go @@ -3,9 +3,11 @@ package proto3 -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type PartSetHeader struct { Total int32 `protobuf:"varint,1,opt,name=Total,proto3" json:"Total,omitempty"` @@ -30,7 +32,7 @@ func (m *PartSetHeader) Reset() { *m = PartSetHeader{} } func (m *PartSetHeader) String() string { return proto.CompactTextString(m) } func (*PartSetHeader) ProtoMessage() {} func (*PartSetHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_block_1ca6cebf74619a45, []int{0} + return fileDescriptor_760f4d5ceb2a11f0, []int{0} } func (m *PartSetHeader) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PartSetHeader.Unmarshal(m, b) @@ -38,8 +40,8 @@ func (m *PartSetHeader) XXX_Unmarshal(b []byte) error { func (m *PartSetHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_PartSetHeader.Marshal(b, m, deterministic) } -func (dst *PartSetHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_PartSetHeader.Merge(dst, src) +func (m *PartSetHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_PartSetHeader.Merge(m, src) } func (m *PartSetHeader) XXX_Size() int { return xxx_messageInfo_PartSetHeader.Size(m) @@ -66,7 +68,7 @@ func (m *PartSetHeader) GetHash() []byte { type BlockID struct { Hash []byte `protobuf:"bytes,1,opt,name=Hash,proto3" json:"Hash,omitempty"` - PartsHeader *PartSetHeader `protobuf:"bytes,2,opt,name=PartsHeader" json:"PartsHeader,omitempty"` + PartsHeader *PartSetHeader `protobuf:"bytes,2,opt,name=PartsHeader,proto3" json:"PartsHeader,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -76,7 +78,7 @@ func (m *BlockID) Reset() { *m = BlockID{} } func (m *BlockID) String() string { return proto.CompactTextString(m) } func (*BlockID) ProtoMessage() {} func (*BlockID) Descriptor() ([]byte, []int) { - return fileDescriptor_block_1ca6cebf74619a45, []int{1} + return fileDescriptor_760f4d5ceb2a11f0, []int{1} } func (m *BlockID) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockID.Unmarshal(m, b) @@ -84,8 +86,8 @@ func (m *BlockID) XXX_Unmarshal(b []byte) error { func (m *BlockID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_BlockID.Marshal(b, m, deterministic) } -func (dst *BlockID) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockID.Merge(dst, src) +func (m *BlockID) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockID.Merge(m, src) } func (m *BlockID) XXX_Size() int { return xxx_messageInfo_BlockID.Size(m) @@ -112,14 +114,14 @@ func (m *BlockID) GetPartsHeader() *PartSetHeader { type Header struct { // basic block info - Version *Version `protobuf:"bytes,1,opt,name=Version" json:"Version,omitempty"` + Version *Version `protobuf:"bytes,1,opt,name=Version,proto3" json:"Version,omitempty"` ChainID string `protobuf:"bytes,2,opt,name=ChainID,proto3" json:"ChainID,omitempty"` Height int64 `protobuf:"varint,3,opt,name=Height,proto3" json:"Height,omitempty"` - Time *Timestamp `protobuf:"bytes,4,opt,name=Time" json:"Time,omitempty"` + Time *Timestamp `protobuf:"bytes,4,opt,name=Time,proto3" json:"Time,omitempty"` NumTxs int64 `protobuf:"varint,5,opt,name=NumTxs,proto3" json:"NumTxs,omitempty"` TotalTxs int64 `protobuf:"varint,6,opt,name=TotalTxs,proto3" json:"TotalTxs,omitempty"` // prev block info - LastBlockID *BlockID `protobuf:"bytes,7,opt,name=LastBlockID" json:"LastBlockID,omitempty"` + LastBlockID *BlockID `protobuf:"bytes,7,opt,name=LastBlockID,proto3" json:"LastBlockID,omitempty"` // hashes of block data LastCommitHash []byte `protobuf:"bytes,8,opt,name=LastCommitHash,proto3" json:"LastCommitHash,omitempty"` DataHash []byte `protobuf:"bytes,9,opt,name=DataHash,proto3" json:"DataHash,omitempty"` @@ -141,7 +143,7 @@ func (m *Header) Reset() { *m = Header{} } func (m *Header) String() string { return proto.CompactTextString(m) } func (*Header) ProtoMessage() {} func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_block_1ca6cebf74619a45, []int{2} + return fileDescriptor_760f4d5ceb2a11f0, []int{2} } func (m *Header) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Header.Unmarshal(m, b) @@ -149,8 +151,8 @@ func (m *Header) XXX_Unmarshal(b []byte) error { func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Header.Marshal(b, m, deterministic) } -func (dst *Header) XXX_Merge(src proto.Message) { - xxx_messageInfo_Header.Merge(dst, src) +func (m *Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header.Merge(m, src) } func (m *Header) XXX_Size() int { return xxx_messageInfo_Header.Size(m) @@ -285,7 +287,7 @@ func (m *Version) Reset() { *m = Version{} } func (m *Version) String() string { return proto.CompactTextString(m) } func (*Version) ProtoMessage() {} func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_block_1ca6cebf74619a45, []int{3} + return fileDescriptor_760f4d5ceb2a11f0, []int{3} } func (m *Version) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Version.Unmarshal(m, b) @@ -293,8 +295,8 @@ func (m *Version) XXX_Unmarshal(b []byte) error { func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Version.Marshal(b, m, deterministic) } -func (dst *Version) XXX_Merge(src proto.Message) { - xxx_messageInfo_Version.Merge(dst, src) +func (m *Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_Version.Merge(m, src) } func (m *Version) XXX_Size() int { return xxx_messageInfo_Version.Size(m) @@ -336,7 +338,7 @@ func (m *Timestamp) Reset() { *m = Timestamp{} } func (m *Timestamp) String() string { return proto.CompactTextString(m) } func (*Timestamp) ProtoMessage() {} func (*Timestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_block_1ca6cebf74619a45, []int{4} + return fileDescriptor_760f4d5ceb2a11f0, []int{4} } func (m *Timestamp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Timestamp.Unmarshal(m, b) @@ -344,8 +346,8 @@ func (m *Timestamp) XXX_Unmarshal(b []byte) error { func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic) } -func (dst *Timestamp) XXX_Merge(src proto.Message) { - xxx_messageInfo_Timestamp.Merge(dst, src) +func (m *Timestamp) XXX_Merge(src proto.Message) { + xxx_messageInfo_Timestamp.Merge(m, src) } func (m *Timestamp) XXX_Size() int { return xxx_messageInfo_Timestamp.Size(m) @@ -378,9 +380,9 @@ func init() { proto.RegisterType((*Timestamp)(nil), "proto3.Timestamp") } -func init() { proto.RegisterFile("types/proto3/block.proto", fileDescriptor_block_1ca6cebf74619a45) } +func init() { proto.RegisterFile("types/proto3/block.proto", fileDescriptor_760f4d5ceb2a11f0) } -var fileDescriptor_block_1ca6cebf74619a45 = []byte{ +var fileDescriptor_760f4d5ceb2a11f0 = []byte{ // 451 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x53, 0x5f, 0x6f, 0xd3, 0x30, 0x10, 0x57, 0x68, 0xda, 0xae, 0x97, 0x76, 0x1d, 0x27, 0x40, 0x16, 0x4f, 0x55, 0x04, 0xa8, 0xbc, From 0116c8113ba1c4b39bdb6280d036a43e280a7c87 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 19 Sep 2019 10:53:15 +0200 Subject: [PATCH 57/63] RC1 - 0.32.4 - Release candidate for v0.32.4 Signed-off-by: Marko Baricevic --- CHANGELOG.md | 20 ++++++++++++++++++++ CHANGELOG_PENDING.md | 9 +-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f835811d3..a16d9a7ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## v0.32.4 + +*September 19, 2019* + +Special thanks to external contributors on this release: @jon-certik + +Friendly reminder, we have a [bug bounty +program](https://hackerone.com/tendermint). + +### IMPROVEMENTS: + +- [rpc] [\#2010](https://github.com/tendermint/tendermint/issues/2010) Add NewHTTPWithClient and NewJSONRPCClientWithHTTPClient (note these and NewHTTP, NewJSONRPCClient functions panic if remote is invalid) (@gracenoah) +- [rpc] [\#3984](https://github.com/tendermint/tendermint/issues/3984) Add `MempoolClient` interface to `Client` interface +- [rpc] [\#3882](https://github.com/tendermint/tendermint/issues/3882) Add custom marshalers to proto messages to disable `omitempty` + +### BUG FIXES: + +- [consensus] [\#3908](https://github.com/tendermint/tendermint/issues/3908) Wait `timeout_commit` to pass even if `create_empty_blocks` is `false` +- [mempool] [\#3968](https://github.com/tendermint/tendermint/issues/3968) Fix memory loading error on 32-bit machines (@jon-certik) + ## v0.32.3 *August 28, 2019* diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 405e95696..043c66c7e 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -1,4 +1,4 @@ -## v0.32.4 +## v0.32.5 \*\* @@ -19,11 +19,4 @@ program](https://hackerone.com/tendermint). ### IMPROVEMENTS: -- [rpc] \#2010 Add NewHTTPWithClient and NewJSONRPCClientWithHTTPClient (note these and NewHTTP, NewJSONRPCClient functions panic if remote is invalid) (@gracenoah) -- [rpc] \#3984 Add `MempoolClient` interface to `Client` interface -- [rpc] \#3882 Add custom marshalers to proto messages to disable `omitempty` - ### BUG FIXES: - -- [consensus] \#3908 Wait `timeout_commit` to pass even if `create_empty_blocks` is `false` -- [mempool] \#3968 Fix memory loading error on 32-bit machines (@jon-certik) From fce61cc51c88a11bd6a5be5e2109f12607c6392c Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 19 Sep 2019 11:03:39 +0200 Subject: [PATCH 58/63] pr suggestions --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a16d9a7ae..54dec0049 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,15 +4,19 @@ *September 19, 2019* -Special thanks to external contributors on this release: @jon-certik +Special thanks to external contributors on this release: @jon-certik, @gracenoah Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermint). +### BREAKING CHANGES: + +- CLI/RPC/Config + - [rpc] [\#3984](https://github.com/tendermint/tendermint/issues/3984) Add `MempoolClient` interface to `Client` interface + ### IMPROVEMENTS: - [rpc] [\#2010](https://github.com/tendermint/tendermint/issues/2010) Add NewHTTPWithClient and NewJSONRPCClientWithHTTPClient (note these and NewHTTP, NewJSONRPCClient functions panic if remote is invalid) (@gracenoah) -- [rpc] [\#3984](https://github.com/tendermint/tendermint/issues/3984) Add `MempoolClient` interface to `Client` interface - [rpc] [\#3882](https://github.com/tendermint/tendermint/issues/3882) Add custom marshalers to proto messages to disable `omitempty` ### BUG FIXES: From a5a19add7772c238eda56420b6ca44e13fc8a24a Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 19 Sep 2019 11:51:28 +0200 Subject: [PATCH 59/63] bump versions --- version/version.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version/version.go b/version/version.go index e1c01c4c2..816d67f0b 100644 --- a/version/version.go +++ b/version/version.go @@ -20,10 +20,10 @@ const ( // Must be a string because scripts like dist.sh read this file. // XXX: Don't change the name of this variable or you will break // automation :) - TMCoreSemVer = "0.32.3" + TMCoreSemVer = "0.32.4" // ABCISemVer is the semantic version of the ABCI library - ABCISemVer = "0.16.1" + ABCISemVer = "0.16.2" ABCIVersion = ABCISemVer ) From 049f158465119d57b5a68e7f0ebe19e9480b267b Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 19 Sep 2019 14:08:49 +0200 Subject: [PATCH 60/63] revert abci change --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index 816d67f0b..b342d6b21 100644 --- a/version/version.go +++ b/version/version.go @@ -23,7 +23,7 @@ const ( TMCoreSemVer = "0.32.4" // ABCISemVer is the semantic version of the ABCI library - ABCISemVer = "0.16.2" + ABCISemVer = "0.16.1" ABCIVersion = ABCISemVer ) From 8fbc62563ed43b5d69e7ca73a4ff4247c841630e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2019 14:09:42 +0200 Subject: [PATCH 61/63] build(deps): bump github.com/tendermint/tm-db from 0.1.1 to 0.2.0 (#4001) Bumps [github.com/tendermint/tm-db](https://github.com/tendermint/tm-db) from 0.1.1 to 0.2.0. - [Release notes](https://github.com/tendermint/tm-db/releases) - [Changelog](https://github.com/tendermint/tm-db/blob/master/CHANGELOG.md) - [Commits](https://github.com/tendermint/tm-db/compare/v0.1.1...v0.2.0) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 01a122fe7..013cfba79 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.4.0 github.com/tendermint/go-amino v0.14.1 - github.com/tendermint/tm-db v0.1.1 + github.com/tendermint/tm-db v0.2.0 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 golang.org/x/net v0.0.0-20190628185345-da137c7871d7 google.golang.org/grpc v1.23.1 diff --git a/go.sum b/go.sum index 79370588d..15e931679 100644 --- a/go.sum +++ b/go.sum @@ -180,6 +180,8 @@ github.com/tendermint/go-amino v0.14.1 h1:o2WudxNfdLNBwMyl2dqOJxiro5rfrEaU0Ugs6o github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= github.com/tendermint/tm-db v0.1.1 h1:G3Xezy3sOk9+ekhjZ/kjArYIs1SmwV+1OUgNkj7RgV0= github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= +github.com/tendermint/tm-db v0.2.0 h1:rJxgdqn6fIiVJZy4zLpY1qVlyD0TU6vhkT4kEf71TQQ= +github.com/tendermint/tm-db v0.2.0/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= From bf989eb2724a9e3acaaea0f6e1f02544ff082d41 Mon Sep 17 00:00:00 2001 From: Marko Date: Thu, 19 Sep 2019 15:31:28 +0200 Subject: [PATCH 62/63] fix linting (#4000) --- .golangci.yml | 1 + blockchain/v2/reactor.go | 6 ++---- blockchain/v2/routine.go | 1 + blockchain/v2/routine_test.go | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 8b7fbd7ec..0991cdf1e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -45,3 +45,4 @@ linters: # disabled-checks: # - wrapperFunc # - commentFormatting # https://github.com/go-critic/go-critic/issues/755 + diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index f96b325b0..25ec41224 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -13,16 +13,14 @@ type timeCheck struct { } func schedulerHandle(event Event) (Event, error) { - switch event.(type) { - case timeCheck: + if _, ok := event.(timeCheck); ok { fmt.Println("scheduler handle timeCheck") } return noOp, nil } func processorHandle(event Event) (Event, error) { - switch event.(type) { - case timeCheck: + if _, ok := event.(timeCheck); ok { fmt.Println("processor handle timeCheck") } return noOp, nil diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index cc7e7ea0f..a24a16f09 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -42,6 +42,7 @@ func newRoutine(name string, handleFunc handleFunc, bufferSize int) *Routine { } } +// nolint: unused func (rt *Routine) setLogger(logger log.Logger) { rt.logger = logger } diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go index 2bd5a1a30..66a8cc704 100644 --- a/blockchain/v2/routine_test.go +++ b/blockchain/v2/routine_test.go @@ -15,8 +15,7 @@ type eventA struct { var done = fmt.Errorf("done") func simpleHandler(event Event) (Event, error) { - switch event.(type) { - case eventA: + if _, ok := event.(eventA); ok { return noOp, done } return noOp, nil From 0d13736acefd9ac916aec07f40c4ce5e40d74b5c Mon Sep 17 00:00:00 2001 From: Marko Date: Thu, 19 Sep 2019 18:24:17 +0200 Subject: [PATCH 63/63] address pr comments in #4002 (#4004) --- CHANGELOG.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54dec0049..7aa703bbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ *September 19, 2019* -Special thanks to external contributors on this release: @jon-certik, @gracenoah +Special thanks to external contributors on this release: @jon-certik, @gracenoah, @PSalant726, @gchaincl Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermint). @@ -18,6 +18,15 @@ program](https://hackerone.com/tendermint). - [rpc] [\#2010](https://github.com/tendermint/tendermint/issues/2010) Add NewHTTPWithClient and NewJSONRPCClientWithHTTPClient (note these and NewHTTP, NewJSONRPCClient functions panic if remote is invalid) (@gracenoah) - [rpc] [\#3882](https://github.com/tendermint/tendermint/issues/3882) Add custom marshalers to proto messages to disable `omitempty` +- [deps] [\#3952](https://github.com/tendermint/tendermint/pull/3952) bump github.com/go-kit/kit from 0.6.0 to 0.9.0 +- [deps] [\#3951](https://github.com/tendermint/tendermint/pull/3951) bump github.com/stretchr/testify from 1.3.0 to 1.4.0 +- [deps] [\#3945](https://github.com/tendermint/tendermint/pull/3945) bump github.com/gorilla/websocket from 1.2.0 to 1.4.1 +- [deps] [\#3948](https://github.com/tendermint/tendermint/pull/3948) bump github.com/libp2p/go-buffer-pool from 0.0.1 to 0.0.2 +- [deps] [\#3943](https://github.com/tendermint/tendermint/pull/3943) bump github.com/fortytw2/leaktest from 1.2.0 to 1.3.0 +- [deps] [\#3939](https://github.com/tendermint/tendermint/pull/3939) bump github.com/rs/cors from 1.6.0 to 1.7.0 +- [deps] [\#3937](https://github.com/tendermint/tendermint/pull/3937) bump github.com/magiconair/properties from 1.8.0 to 1.8.1 +- [deps] [\#3947](https://github.com/tendermint/tendermint/pull/3947) update gogo/protobuf version from v1.2.1 to v1.3.0 +- [deps] [\#4001](https://github.com/tendermint/tendermint/pull/4001) bump github.com/tendermint/tm-db from 0.1.1 to 0.2.0 ### BUG FIXES: