From ab2d3c1a790635ec239fc88d7e9c43ad9e018f43 Mon Sep 17 00:00:00 2001 From: Matthew Slipper Date: Mon, 17 Sep 2018 22:34:28 -0700 Subject: [PATCH] Add additional metrics to p2p and consensus. Partially addresses https://github.com/cosmos/cosmos-sdk/issues/2169. --- .gitignore | 3 +- config/config.go | 6 ++-- config/metrics.go | 3 ++ consensus/byzantine_test.go | 2 +- consensus/metrics.go | 65 ++++++++++++++++++++++++++++--------- consensus/reactor.go | 19 +++++++++-- consensus/reactor_test.go | 6 ++-- consensus/state.go | 2 ++ mempool/metrics.go | 4 ++- node/node.go | 7 ++-- p2p/metrics.go | 35 ++++++++++++++++++-- p2p/peer.go | 60 +++++++++++++++++++++++++++++----- p2p/peer_test.go | 2 +- p2p/switch.go | 2 +- types/params.go | 8 ++--- types/protobuf.go | 8 ++--- 16 files changed, 182 insertions(+), 50 deletions(-) create mode 100644 config/metrics.go diff --git a/.gitignore b/.gitignore index 193a42894a11..c83ffb3aba32 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ scripts/cutWALUntil/cutWALUntil *.iml libs/pubsub/query/fuzz_test/output +libs/db/test* shunit2 .tendermint-lite @@ -38,4 +39,4 @@ terraform.tfstate terraform.tfstate.backup terraform.tfstate.d -.vscode \ No newline at end of file +.vscode diff --git a/config/config.go b/config/config.go index c0882546f1a0..f080be01ec66 100644 --- a/config/config.go +++ b/config/config.go @@ -587,15 +587,15 @@ type TxIndexConfig struct { // Comma-separated list of tags to index (by default the only tag is "tx.hash") // // You can also index transactions by height by adding "tx.height" tag here. - // + // // It's recommended to index only a subset of tags due to possible memory // bloat. This is, of course, depends on the indexer's DB and the volume of // transactions. IndexTags string `mapstructure:"index_tags"` // When set to true, tells indexer to index all tags (predefined tags: - // "tx.hash", "tx.height" and all tags from DeliverTx responses). - // + // "tx.hash", "tx.height" and all tags from DeliverTx responses). + // // Note this may be not desirable (see the comment above). IndexTags has a // precedence over IndexAllTags (i.e. when given both, IndexTags will be // indexed). diff --git a/config/metrics.go b/config/metrics.go new file mode 100644 index 000000000000..35839cb1a43e --- /dev/null +++ b/config/metrics.go @@ -0,0 +1,3 @@ +package config + +const MetricsNamespace = "tendermint" diff --git a/consensus/byzantine_test.go b/consensus/byzantine_test.go index 0aba77432e77..98bd031299eb 100644 --- a/consensus/byzantine_test.go +++ b/consensus/byzantine_test.go @@ -66,7 +66,7 @@ func TestByzantine(t *testing.T) { err := eventBus.Subscribe(context.Background(), testSubscriber, types.EventQueryNewBlock, eventChans[i]) require.NoError(t, err) - conR := NewConsensusReactor(css[i], true) // so we dont start the consensus states + conR := NewConsensusReactor(css[i], true, NopMetrics()) // so we dont start the consensus states conR.SetLogger(logger.With("validator", i)) conR.SetEventBus(eventBus) diff --git a/consensus/metrics.go b/consensus/metrics.go index 253880e84e4f..b5519e3dd1c6 100644 --- a/consensus/metrics.go +++ b/consensus/metrics.go @@ -4,10 +4,13 @@ import ( "github.com/go-kit/kit/metrics" "github.com/go-kit/kit/metrics/discard" - prometheus "github.com/go-kit/kit/metrics/prometheus" + "github.com/go-kit/kit/metrics/prometheus" stdprometheus "github.com/prometheus/client_golang/prometheus" + tmcfg "github.com/tendermint/tendermint/config" ) +const MetricsSubsystem = "consensus" + // Metrics contains metrics exposed by this package. type Metrics struct { // Height of the chain. @@ -38,75 +41,103 @@ type Metrics struct { BlockSizeBytes metrics.Gauge // Total number of transactions. TotalTxs metrics.Gauge + // The latest block height. + LatestBlockHeight metrics.Gauge + // Whether or not a node is synced. 0 if no, 1 if yes. + CatchingUp metrics.Gauge } // PrometheusMetrics returns Metrics build using Prometheus client library. func PrometheusMetrics() *Metrics { return &Metrics{ Height: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "height", Help: "Height of the chain.", }, []string{}), Rounds: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "rounds", Help: "Number of rounds.", }, []string{}), Validators: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "validators", Help: "Number of validators.", }, []string{}), ValidatorsPower: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "validators_power", Help: "Total power of all validators.", }, []string{}), MissingValidators: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "missing_validators", Help: "Number of validators who did not sign.", }, []string{}), MissingValidatorsPower: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "missing_validators_power", Help: "Total power of the missing validators.", }, []string{}), ByzantineValidators: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "byzantine_validators", Help: "Number of validators who tried to double sign.", }, []string{}), ByzantineValidatorsPower: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "byzantine_validators_power", Help: "Total power of the byzantine validators.", }, []string{}), BlockIntervalSeconds: prometheus.NewHistogramFrom(stdprometheus.HistogramOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "block_interval_seconds", Help: "Time between this and the last block.", Buckets: []float64{1, 2.5, 5, 10, 60}, }, []string{}), NumTxs: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "num_txs", Help: "Number of transactions.", }, []string{}), BlockSizeBytes: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "block_size_bytes", Help: "Size of the block.", }, []string{}), TotalTxs: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "consensus", + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "total_txs", Help: "Total number of transactions.", }, []string{}), + LatestBlockHeight: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, + Name: "latest_block_height", + Help: "The latest block height.", + }, []string{}), + CatchingUp: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ + Namespace: tmcfg.MetricsNamespace, + Subsystem: MetricsSubsystem, + Name: "catching_up", + Help: "Whether or not a node is synced. 0 if syncing, 1 if synced.", + }, []string{}), } } @@ -126,8 +157,10 @@ func NopMetrics() *Metrics { BlockIntervalSeconds: discard.NewHistogram(), - NumTxs: discard.NewGauge(), - BlockSizeBytes: discard.NewGauge(), - TotalTxs: discard.NewGauge(), + NumTxs: discard.NewGauge(), + BlockSizeBytes: discard.NewGauge(), + TotalTxs: discard.NewGauge(), + LatestBlockHeight: discard.NewGauge(), + CatchingUp: discard.NewGauge(), } } diff --git a/consensus/reactor.go b/consensus/reactor.go index 6ba8172641c3..60a1ccd3c19a 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -8,7 +8,7 @@ import ( "github.com/pkg/errors" - amino "github.com/tendermint/go-amino" + "github.com/tendermint/go-amino" cstypes "github.com/tendermint/tendermint/consensus/types" cmn "github.com/tendermint/tendermint/libs/common" @@ -42,15 +42,19 @@ type ConsensusReactor struct { mtx sync.RWMutex fastSync bool eventBus *types.EventBus + + metrics *Metrics } // NewConsensusReactor returns a new ConsensusReactor with the given // consensusState. -func NewConsensusReactor(consensusState *ConsensusState, fastSync bool) *ConsensusReactor { +func NewConsensusReactor(consensusState *ConsensusState, fastSync bool, csMetrics *Metrics) *ConsensusReactor { conR := &ConsensusReactor{ conS: consensusState, fastSync: fastSync, + metrics: csMetrics, } + conR.setCatchingUp() conR.BaseReactor = *p2p.NewBaseReactor("ConsensusReactor", conR) return conR } @@ -94,6 +98,7 @@ func (conR *ConsensusReactor) SwitchToConsensus(state sm.State, blocksSynced int conR.mtx.Lock() conR.fastSync = false conR.mtx.Unlock() + conR.metrics.CatchingUp.Set(0) if blocksSynced > 0 { // dont bother with the WAL if we fast synced @@ -814,6 +819,16 @@ func (conR *ConsensusReactor) StringIndented(indent string) string { return s } +func (conR *ConsensusReactor) setCatchingUp() { + var catchingUp float64 + if conR.fastSync { + catchingUp = 1 + } else { + catchingUp = 0 + } + conR.metrics.CatchingUp.Set(catchingUp) +} + //----------------------------------------------------------------------------- var ( diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index 98b058b8d61a..16350076c9c0 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -45,7 +45,7 @@ func startConsensusNet(t *testing.T, css []*ConsensusState, N int) ([]*Consensus for i := 0; i < N; i++ { /*logger, err := tmflags.ParseLogLevel("consensus:info,*:error", logger, "info") if err != nil { t.Fatal(err)}*/ - reactors[i] = NewConsensusReactor(css[i], true) // so we dont start the consensus states + reactors[i] = NewConsensusReactor(css[i], true, NopMetrics()) // so we dont start the consensus states reactors[i].SetLogger(css[i].Logger) // eventBus is already started with the cs @@ -255,7 +255,7 @@ func TestReactorRecordsBlockParts(t *testing.T) { // create reactor css := randConsensusNet(1, "consensus_reactor_records_block_parts_test", newMockTickerFunc(true), newPersistentKVStore) - reactor := NewConsensusReactor(css[0], false) // so we dont start the consensus states + reactor := NewConsensusReactor(css[0], false, NopMetrics()) // so we dont start the consensus states reactor.SetEventBus(css[0].eventBus) reactor.SetLogger(log.TestingLogger()) sw := p2p.MakeSwitch(cfg.DefaultP2PConfig(), 1, "testing", "123.123.123", func(i int, sw *p2p.Switch) *p2p.Switch { return sw }) @@ -306,7 +306,7 @@ func TestReactorRecordsVotes(t *testing.T) { // Create reactor. css := randConsensusNet(1, "consensus_reactor_records_votes_test", newMockTickerFunc(true), newPersistentKVStore) - reactor := NewConsensusReactor(css[0], false) // so we dont start the consensus states + reactor := NewConsensusReactor(css[0], false, NopMetrics()) // so we dont start the consensus states reactor.SetEventBus(css[0].eventBus) reactor.SetLogger(log.TestingLogger()) sw := p2p.MakeSwitch(cfg.DefaultP2PConfig(), 1, "testing", "123.123.123", func(i int, sw *p2p.Switch) *p2p.Switch { return sw }) diff --git a/consensus/state.go b/consensus/state.go index d77afafe983f..76dbc69f4f5e 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -1387,6 +1387,8 @@ func (cs *ConsensusState) recordMetrics(height int64, block *types.Block) { cs.metrics.NumTxs.Set(float64(block.NumTxs)) cs.metrics.BlockSizeBytes.Set(float64(block.Size())) cs.metrics.TotalTxs.Set(float64(block.TotalTxs)) + cs.metrics.LatestBlockHeight.Set(float64(block.Height)) + } //----------------------------------------------------------------------------- diff --git a/mempool/metrics.go b/mempool/metrics.go index f381678cb314..473b7cb5b1d3 100644 --- a/mempool/metrics.go +++ b/mempool/metrics.go @@ -4,8 +4,9 @@ import ( "github.com/go-kit/kit/metrics" "github.com/go-kit/kit/metrics/discard" - prometheus "github.com/go-kit/kit/metrics/prometheus" + "github.com/go-kit/kit/metrics/prometheus" stdprometheus "github.com/prometheus/client_golang/prometheus" + "github.com/tendermint/tendermint/config" ) // Metrics contains metrics exposed by this package. @@ -19,6 +20,7 @@ type Metrics struct { func PrometheusMetrics() *Metrics { return &Metrics{ Size: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ + Namespace: config.MetricsNamespace, Subsystem: "mempool", Name: "size", Help: "Size of the mempool (number of uncommitted transactions).", diff --git a/node/node.go b/node/node.go index 76f23dfdd456..bda88eecd1de 100644 --- a/node/node.go +++ b/node/node.go @@ -279,6 +279,8 @@ func NewNode(config *cfg.Config, bcReactor := bc.NewBlockchainReactor(state.Copy(), blockExec, blockStore, fastSync) bcReactor.SetLogger(logger.With("module", "blockchain")) + csm := cs.WithMetrics(csMetrics) + // Make ConsensusReactor consensusState := cs.NewConsensusState( config.Consensus, @@ -287,13 +289,13 @@ func NewNode(config *cfg.Config, blockStore, mempool, evidencePool, - cs.WithMetrics(csMetrics), + csm, ) consensusState.SetLogger(consensusLogger) if privValidator != nil { consensusState.SetPrivValidator(privValidator) } - consensusReactor := cs.NewConsensusReactor(consensusState, fastSync) + consensusReactor := cs.NewConsensusReactor(consensusState, fastSync, csMetrics) consensusReactor.SetLogger(consensusLogger) p2pLogger := logger.With("module", "p2p") @@ -751,7 +753,6 @@ func saveGenesisDoc(db dbm.DB, genDoc *types.GenesisDoc) { db.SetSync(genesisDocKey, bytes) } - // splitAndTrimEmpty slices s into all subslices separated by sep and returns a // slice of the string s with all leading and trailing Unicode code points // contained in cutset removed. If sep is empty, SplitAndTrim splits after each diff --git a/p2p/metrics.go b/p2p/metrics.go index ab876ee7c62d..ca3082ccf1d0 100644 --- a/p2p/metrics.go +++ b/p2p/metrics.go @@ -4,24 +4,52 @@ import ( "github.com/go-kit/kit/metrics" "github.com/go-kit/kit/metrics/discard" - prometheus "github.com/go-kit/kit/metrics/prometheus" + "github.com/go-kit/kit/metrics/prometheus" stdprometheus "github.com/prometheus/client_golang/prometheus" + "github.com/tendermint/tendermint/config" ) +const MetricsSubsystem = "p2p" + // Metrics contains metrics exposed by this package. type Metrics struct { // Number of peers. Peers metrics.Gauge + // Number of bytes received from a given peer. + PeerReceiveBytesTotal metrics.Counter + // Number of bytes sent to a given peer. + PeerSendBytesTotal metrics.Counter + // Pending bytes to be sent to a given peer. + PeerPendingSendBytes metrics.Gauge } // PrometheusMetrics returns Metrics build using Prometheus client library. func PrometheusMetrics() *Metrics { return &Metrics{ Peers: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Subsystem: "p2p", + Namespace: config.MetricsNamespace, + Subsystem: MetricsSubsystem, Name: "peers", Help: "Number of peers.", }, []string{}), + PeerReceiveBytesTotal: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: config.MetricsNamespace, + Subsystem: MetricsSubsystem, + Name: "peer_receive_bytes_total", + Help: "Number of bytes received from a given peer.", + }, []string{"peer_id"}), + PeerSendBytesTotal: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: config.MetricsNamespace, + Subsystem: MetricsSubsystem, + Name: "peer_send_bytes_total", + Help: "Number of bytes sent to a given peer.", + }, []string{"peer_id"}), + PeerPendingSendBytes: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ + Namespace: config.MetricsNamespace, + Subsystem: MetricsSubsystem, + Name: "peer_pending_send_bytes", + Help: "Number of pending bytes to be sent to a given peer.", + }, []string{"peer_id"}), } } @@ -29,5 +57,8 @@ func PrometheusMetrics() *Metrics { func NopMetrics() *Metrics { return &Metrics{ Peers: discard.NewGauge(), + PeerReceiveBytesTotal: discard.NewCounter(), + PeerSendBytesTotal: discard.NewCounter(), + PeerPendingSendBytes: discard.NewGauge(), } } diff --git a/p2p/peer.go b/p2p/peer.go index a5f0bbbd816b..61a9d3266dc1 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -6,7 +6,7 @@ import ( "sync/atomic" "time" - crypto "github.com/tendermint/tendermint/crypto" + "github.com/tendermint/tendermint/crypto" cmn "github.com/tendermint/tendermint/libs/common" "github.com/tendermint/tendermint/libs/log" @@ -14,6 +14,8 @@ import ( tmconn "github.com/tendermint/tendermint/p2p/conn" ) +const MetricsTickerDuration = 10 * time.Second + var testIPSuffix uint32 // Peer is an interface representing a peer connected on a reactor. @@ -100,6 +102,11 @@ type peer struct { // User data Data *cmn.CMap + + metrics *Metrics + + metricsTicker *time.Ticker + quitChan chan bool } func newPeer( @@ -109,12 +116,16 @@ func newPeer( reactorsByCh map[byte]Reactor, chDescs []*tmconn.ChannelDescriptor, onPeerError func(Peer, interface{}), + metrics *Metrics, ) *peer { p := &peer{ - peerConn: pc, - nodeInfo: nodeInfo, - channels: nodeInfo.Channels, - Data: cmn.NewCMap(), + peerConn: pc, + nodeInfo: nodeInfo, + channels: nodeInfo.Channels, + Data: cmn.NewCMap(), + metrics: metrics, + metricsTicker: time.NewTicker(MetricsTickerDuration), + quitChan: make(chan bool), } p.mconn = createMConnection( @@ -225,12 +236,36 @@ func (p *peer) OnStart() error { if err := p.BaseService.OnStart(); err != nil { return err } + err := p.mconn.Start() - return err + if err != nil { + return err + } + + go func() { + for { + select { + case <-p.metricsTicker.C: + status := p.mconn.Status() + var sendQueueSize float64 + for _, chStatus := range status.Channels { + sendQueueSize += float64(chStatus.SendQueueSize) + } + + p.metrics.PeerPendingSendBytes.With("peer-id", string(p.ID())).Set(sendQueueSize) + case <-p.quitChan: + return + } + } + }() + + return nil } // OnStop implements BaseService. func (p *peer) OnStop() { + p.metricsTicker.Stop() + p.quitChan <- true p.BaseService.OnStop() p.mconn.Stop() // stop everything and close the conn } @@ -282,7 +317,11 @@ func (p *peer) Send(chID byte, msgBytes []byte) bool { } else if !p.hasChannel(chID) { return false } - return p.mconn.Send(chID, msgBytes) + res := p.mconn.Send(chID, msgBytes) + if res { + p.metrics.PeerSendBytesTotal.With("peer-id", string(p.ID())).Add(float64(len(msgBytes))) + } + return res } // TrySend msg bytes to the channel identified by chID byte. Immediately returns @@ -293,7 +332,11 @@ func (p *peer) TrySend(chID byte, msgBytes []byte) bool { } else if !p.hasChannel(chID) { return false } - return p.mconn.TrySend(chID, msgBytes) + res := p.mconn.TrySend(chID, msgBytes) + if res { + p.metrics.PeerSendBytesTotal.With("peer-id", string(p.ID())).Add(float64(len(msgBytes))) + } + return res } // Get the data for a given key. @@ -427,6 +470,7 @@ func createMConnection( // which does onPeerError. panic(fmt.Sprintf("Unknown channel %X", chID)) } + p.metrics.PeerReceiveBytesTotal.With("peer_id", string(p.ID())).Add(float64(len(msgBytes))) reactor.Receive(chID, p, msgBytes) } diff --git a/p2p/peer_test.go b/p2p/peer_test.go index f0e9153288ee..c67e716c4aea 100644 --- a/p2p/peer_test.go +++ b/p2p/peer_test.go @@ -91,7 +91,7 @@ func createOutboundPeerAndPerformHandshake( return nil, err } - p := newPeer(pc, mConfig, nodeInfo, reactorsByCh, chDescs, func(p Peer, r interface{}) {}) + p := newPeer(pc, mConfig, nodeInfo, reactorsByCh, chDescs, func(p Peer, r interface{}) {}, NopMetrics()) p.SetLogger(log.TestingLogger().With("peer", addr)) return p, nil } diff --git a/p2p/switch.go b/p2p/switch.go index b5413dabf1b6..bbb6fbe151c8 100644 --- a/p2p/switch.go +++ b/p2p/switch.go @@ -642,7 +642,7 @@ func (sw *Switch) addPeer(pc peerConn) error { return err } - peer := newPeer(pc, sw.mConfig, peerNodeInfo, sw.reactorsByCh, sw.chDescs, sw.StopPeerForError) + peer := newPeer(pc, sw.mConfig, peerNodeInfo, sw.reactorsByCh, sw.chDescs, sw.StopPeerForError, sw.metrics) peer.SetLogger(sw.Logger.With("peer", addr)) peer.Logger.Info("Successful handshake with peer", "peerNodeInfo", peerNodeInfo) diff --git a/types/params.go b/types/params.go index 77f68eb7b3ee..1af63961888a 100644 --- a/types/params.go +++ b/types/params.go @@ -22,8 +22,8 @@ type ConsensusParams struct { // BlockSize contain limits on the block size. type BlockSize struct { - MaxBytes int `json:"max_txs_bytes"` // NOTE: must not be 0 nor greater than 100MB - MaxGas int64 `json:"max_gas"` + MaxBytes int `json:"max_txs_bytes"` // NOTE: must not be 0 nor greater than 100MB + MaxGas int64 `json:"max_gas"` } // TxSize contain limits on the tx size. @@ -55,8 +55,8 @@ func DefaultConsensusParams() *ConsensusParams { // DefaultBlockSize returns a default BlockSize. func DefaultBlockSize() BlockSize { return BlockSize{ - MaxBytes: 22020096, // 21MB - MaxGas: -1, + MaxBytes: 22020096, // 21MB + MaxGas: -1, } } diff --git a/types/protobuf.go b/types/protobuf.go index 9c448cd848dc..6629a885dc4a 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -115,8 +115,8 @@ func (tm2pb) ValidatorUpdates(vals *ValidatorSet) []abci.ValidatorUpdate { func (tm2pb) ConsensusParams(params *ConsensusParams) *abci.ConsensusParams { return &abci.ConsensusParams{ BlockSize: &abci.BlockSize{ - MaxBytes: int32(params.BlockSize.MaxBytes), - MaxGas: params.BlockSize.MaxGas, + MaxBytes: int32(params.BlockSize.MaxBytes), + MaxGas: params.BlockSize.MaxGas, }, TxSize: &abci.TxSize{ MaxBytes: int32(params.TxSize.MaxBytes), @@ -215,8 +215,8 @@ func (pb2tm) ValidatorUpdates(vals []abci.ValidatorUpdate) ([]*Validator, error) func (pb2tm) ConsensusParams(csp *abci.ConsensusParams) ConsensusParams { return ConsensusParams{ BlockSize: BlockSize{ - MaxBytes: int(csp.BlockSize.MaxBytes), // XXX - MaxGas: csp.BlockSize.MaxGas, + MaxBytes: int(csp.BlockSize.MaxBytes), // XXX + MaxGas: csp.BlockSize.MaxGas, }, TxSize: TxSize{ MaxBytes: int(csp.TxSize.MaxBytes), // XXX