diff --git a/tm-monitor/eventmeter/eventmeter.go b/tm-monitor/eventmeter/eventmeter.go index 9e49cee75..3979d07b3 100644 --- a/tm-monitor/eventmeter/eventmeter.go +++ b/tm-monitor/eventmeter/eventmeter.go @@ -22,7 +22,7 @@ import ( // Meter for a particular event // Closure to enable side effects from receiving an event -type EventCallbackFunc func(em *EventMetric, data events.EventData) +type EventCallbackFunc func(em *EventMetric, data interface{}) // Metrics for a given event type EventMetric struct { diff --git a/tm-monitor/glide.lock b/tm-monitor/glide.lock index 2acd9cd19..33b827d25 100644 --- a/tm-monitor/glide.lock +++ b/tm-monitor/glide.lock @@ -1,5 +1,5 @@ -hash: 80c204190057df1e74d32ecd7095e8a1a865c3a06671f1a31d5240e1e3ff2c64 -updated: 2017-05-20T17:49:23.646798165-04:00 +hash: 30b649bc544a4ebd2b2a6188ce314cb72e6c28be8f3e57ec22e7cb83fd974814 +updated: 2017-07-29T18:47:33.199177142Z imports: - name: github.com/btcsuite/btcd version: 583684b21bfbde9b5fc4403916fd7c807feb0289 @@ -24,7 +24,7 @@ imports: - name: github.com/kr/logfmt version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0 - name: github.com/pkg/errors - version: bfd5150e4e41705ded2129ec33379de1cb90b513 + version: 645ef00459ed84a119197bfb8d8205042c6df63d - name: github.com/rcrowley/go-metrics version: 1f30fe9094a513ce4c700b9a54458bbb0c96996c - name: github.com/tendermint/abci @@ -39,13 +39,13 @@ imports: - edwards25519 - extra25519 - name: github.com/tendermint/go-crypto - version: 7dff40942a64cdeefefa9446b2d104750b349f8a + version: 95b7c9e09c49b91bfbb71bb63dd514eb55450f16 - name: github.com/tendermint/go-wire version: 5f88da3dbc1a72844e6dfaf274ce87f851d488eb subpackages: - data - name: github.com/tendermint/tendermint - version: 267f134d44e76efb2adef5f0c993da8a5d5bd1b8 + version: e9b7221292afe25ce956ea85ab83bb5708eb2992 subpackages: - config - p2p @@ -56,7 +56,7 @@ imports: - rpc/lib/types - types - name: github.com/tendermint/tmlibs - version: 306795ae1d8e4f4a10dcc8bdb32a00455843c9d5 + version: 2f6f3e6aa70bb19b70a6e73210273fa127041070 subpackages: - common - events diff --git a/tm-monitor/glide.yaml b/tm-monitor/glide.yaml index 53637fb44..e68ff6970 100644 --- a/tm-monitor/glide.yaml +++ b/tm-monitor/glide.yaml @@ -1,8 +1,5 @@ package: github.com/tendermint/tools/tm-monitor import: -- package: github.com/go-kit/kit - subpackages: - - log - package: github.com/gorilla/websocket - package: github.com/pkg/errors - package: github.com/rcrowley/go-metrics @@ -15,7 +12,9 @@ import: - rpc/lib/server - types - package: github.com/tendermint/tmlibs + version: develop subpackages: + - common - events - log testImport: diff --git a/tm-monitor/mock/mock.go b/tm-monitor/mock/mock.go index b614e5953..949afe992 100644 --- a/tm-monitor/mock/mock.go +++ b/tm-monitor/mock/mock.go @@ -1,11 +1,10 @@ package mock import ( - "log" + stdlog "log" "reflect" - gokitlog "github.com/go-kit/kit/log" - ctypes "github.com/tendermint/tendermint/rpc/core/types" + "github.com/tendermint/tmlibs/log" em "github.com/tendermint/tools/tm-monitor/eventmeter" ) @@ -17,7 +16,7 @@ type EventMeter struct { func (e *EventMeter) Start() error { return nil } func (e *EventMeter) Stop() {} -func (e *EventMeter) SetLogger(l gokitlog.Logger) {} +func (e *EventMeter) SetLogger(l log.Logger) {} func (e *EventMeter) RegisterLatencyCallback(cb em.LatencyCallbackFunc) { e.latencyCallback = cb } func (e *EventMeter) RegisterDisconnectCallback(cb em.DisconnectCallbackFunc) { e.disconnectCallback = cb @@ -43,13 +42,13 @@ func (e *EventMeter) Call(callback string, args ...interface{}) { } type RpcClient struct { - Stubs map[string]ctypes.TMResult + Stubs map[string]interface{} } func (c *RpcClient) Call(method string, params map[string]interface{}, result interface{}) (interface{}, error) { s, ok := c.Stubs[method] if !ok { - log.Fatalf("Call to %s, but no stub is defined for it", method) + stdlog.Fatalf("Call to %s, but no stub is defined for it", method) } rv, rt := reflect.ValueOf(result), reflect.TypeOf(result) diff --git a/tm-monitor/monitor/monitor_test.go b/tm-monitor/monitor/monitor_test.go index 1a4dd7114..d12d81e3f 100644 --- a/tm-monitor/monitor/monitor_test.go +++ b/tm-monitor/monitor/monitor_test.go @@ -61,10 +61,10 @@ func startMonitor(t *testing.T) *monitor.Monitor { func createValidatorNode(t *testing.T) (n *monitor.Node, emMock *mock.EventMeter) { emMock = &mock.EventMeter{} - stubs := make(map[string]ctypes.TMResult) + stubs := make(map[string]interface{}) pubKey := crypto.GenPrivKeyEd25519().PubKey() - stubs["validators"] = &ctypes.ResultValidators{BlockHeight: blockHeight, Validators: []*tmtypes.Validator{tmtypes.NewValidator(pubKey, 0)}} - stubs["status"] = &ctypes.ResultStatus{PubKey: pubKey} + stubs["validators"] = ctypes.ResultValidators{BlockHeight: blockHeight, Validators: []*tmtypes.Validator{tmtypes.NewValidator(pubKey, 0)}} + stubs["status"] = ctypes.ResultStatus{PubKey: pubKey} rpcClientMock := &mock.RpcClient{stubs} n = monitor.NewNodeWithEventMeterAndRpcClient("tcp://127.0.0.1:46657", emMock, rpcClientMock) diff --git a/tm-monitor/monitor/node.go b/tm-monitor/monitor/node.go index 32af6aadd..2c2352a77 100644 --- a/tm-monitor/monitor/node.go +++ b/tm-monitor/monitor/node.go @@ -125,7 +125,7 @@ func (n *Node) Stop() { // implements eventmeter.EventCallbackFunc func newBlockCallback(n *Node) em.EventCallbackFunc { - return func(metric *em.EventMetric, data events.EventData) { + return func(metric *em.EventMetric, data interface{}) { block := data.(tmtypes.TMEventData).Unwrap().(tmtypes.EventDataNewBlockHeader).Header n.Height = uint64(block.Height) diff --git a/tm-monitor/monitor/node_test.go b/tm-monitor/monitor/node_test.go index a379701c0..b8691a785 100644 --- a/tm-monitor/monitor/node_test.go +++ b/tm-monitor/monitor/node_test.go @@ -37,7 +37,7 @@ func TestNodeNewBlockReceived(t *testing.T) { n.SendBlocksTo(blockCh) blockHeader := &tmtypes.Header{Height: 5} - emMock.Call("eventCallback", &em.EventMetric{}, tmtypes.EventDataNewBlockHeader{blockHeader}) + emMock.Call("eventCallback", &em.EventMetric{}, tmtypes.TMEventData{tmtypes.EventDataNewBlockHeader{blockHeader}}) assert.Equal(uint64(5), n.Height) assert.Equal(*blockHeader, <-blockCh) @@ -89,10 +89,10 @@ func TestNumValidators(t *testing.T) { func startValidatorNode(t *testing.T) (n *monitor.Node, emMock *mock.EventMeter) { emMock = &mock.EventMeter{} - stubs := make(map[string]ctypes.TMResult) + stubs := make(map[string]interface{}) pubKey := crypto.GenPrivKeyEd25519().PubKey() - stubs["validators"] = &ctypes.ResultValidators{BlockHeight: blockHeight, Validators: []*tmtypes.Validator{tmtypes.NewValidator(pubKey, 0)}} - stubs["status"] = &ctypes.ResultStatus{PubKey: pubKey} + stubs["validators"] = ctypes.ResultValidators{BlockHeight: blockHeight, Validators: []*tmtypes.Validator{tmtypes.NewValidator(pubKey, 0)}} + stubs["status"] = ctypes.ResultStatus{PubKey: pubKey} rpcClientMock := &mock.RpcClient{stubs} n = monitor.NewNodeWithEventMeterAndRpcClient("tcp://127.0.0.1:46657", emMock, rpcClientMock)