Skip to content

Commit

Permalink
Minimal implementation of ConsensusParams method (cosmos#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzdybal authored Feb 24, 2022
1 parent a85b6da commit 488b707
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Month, DD, YYYY
- [rpc] [Remove extra variable #280](https://github.com/celestiaorg/optimint/pull/280) [@raneet10](https://github.com/Raneet10/)
- [rpc] [Implement BlockChainInfo RPC method #282](https://github.com/celestiaorg/optimint/pull/282) [@raneet10](https://github.com/Raneet10/)
- [state,block,store,rpc] [Minimalistic validator set handling](https://github.com/celestiaorg/optimint/pull/286) [@tzdybal](https://github.com/tzdybal/)
- [rpc] [Implement ConsensusParams #292](https://github.com/celestiaorg/optimint/pull/292) [@tzdybal](https://github.com/tzdybal/)

### BUG FIXES

Expand Down
31 changes: 27 additions & 4 deletions rpc/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
tmmath "github.com/tendermint/tendermint/libs/math"
tmpubsub "github.com/tendermint/tendermint/libs/pubsub"
tmquery "github.com/tendermint/tendermint/libs/pubsub/query"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/tendermint/tendermint/proxy"
rpcclient "github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
Expand Down Expand Up @@ -335,8 +336,29 @@ func (c *Client) ConsensusState(ctx context.Context) (*ctypes.ResultConsensusSta
}

func (c *Client) ConsensusParams(ctx context.Context, height *int64) (*ctypes.ResultConsensusParams, error) {
// needs state storage
panic("ConsensusParams - not implemented!")
// TODO(tzdybal): implement consensus params handling: https://github.com/celestiaorg/optimint/issues/291
params := c.node.GetGenesis().ConsensusParams
return &ctypes.ResultConsensusParams{
BlockHeight: int64(c.normalizeHeight(height)),
ConsensusParams: tmproto.ConsensusParams{
Block: tmproto.BlockParams{
MaxBytes: params.Block.MaxBytes,
MaxGas: params.Block.MaxGas,
TimeIotaMs: params.Block.TimeIotaMs,
},
Evidence: tmproto.EvidenceParams{
MaxAgeNumBlocks: params.Evidence.MaxAgeNumBlocks,
MaxAgeDuration: params.Evidence.MaxAgeDuration,
MaxBytes: params.Evidence.MaxBytes,
},
Validator: tmproto.ValidatorParams{
PubKeyTypes: params.Validator.PubKeyTypes,
},
Version: tmproto.VersionParams{
AppVersion: params.Version.AppVersion,
},
},
}, nil
}

func (c *Client) Health(ctx context.Context) (*ctypes.ResultHealth, error) {
Expand Down Expand Up @@ -650,8 +672,9 @@ func (c *Client) Status(ctx context.Context) (*ctypes.ResultStatus, error) {
}

func (c *Client) BroadcastEvidence(ctx context.Context, evidence types.Evidence) (*ctypes.ResultBroadcastEvidence, error) {
// needs evidence pool?
panic("BroadcastEvidence - not implemented!")
return &ctypes.ResultBroadcastEvidence{
Hash: evidence.Hash(),
}, nil
}

func (c *Client) NumUnconfirmedTxs(ctx context.Context) (*ctypes.ResultUnconfirmedTxs, error) {
Expand Down

0 comments on commit 488b707

Please sign in to comment.