From 0133723acaaefbbe6e8a5213e1a6770b9c93f7e4 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 7 Aug 2017 18:47:22 +0200 Subject: [PATCH] Clean up comments --- cmd/basecli/main.go | 11 +++++------ cmd/eyes/main.go | 1 - cmd/eyescli/main.go | 4 ++-- modules/etc/commands/tx.go | 5 +++-- modules/etc/handler.go | 4 +++- modules/etc/store.go | 2 +- tests/cli/eyes.sh | 4 ++-- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/cmd/basecli/main.go b/cmd/basecli/main.go index 0239c5ada..54df8eac5 100644 --- a/cmd/basecli/main.go +++ b/cmd/basecli/main.go @@ -27,13 +27,12 @@ import ( // BaseCli - main basecoin client command var BaseCli = &cobra.Command{ Use: "basecli", - Short: "Light client for tendermint", - Long: `Basecli is an version of tmcli including custom logic to -present a nice (not raw hex) interface to the basecoin blockchain structure. + Short: "Light client for Tendermint", + Long: `Basecli is a certifying light client for the basecoin abci app. -This is a useful tool, but also serves to demonstrate how one can configure -tmcli to work for any custom abci app. -`, +It leverages the power of the tendermint consensus algorithm get full +cryptographic proof of all queries while only syncing a fraction of the +block headers.`, } func main() { diff --git a/cmd/eyes/main.go b/cmd/eyes/main.go index 2c92dd487..59d750695 100644 --- a/cmd/eyes/main.go +++ b/cmd/eyes/main.go @@ -35,7 +35,6 @@ func main() { // out own init command to not require argument InitCmd, commands.StartCmd, - //commands.RelayCmd, commands.UnsafeResetAllCmd, commands.VersionCmd, ) diff --git a/cmd/eyescli/main.go b/cmd/eyescli/main.go index 1efa6bfc4..e65a7083a 100644 --- a/cmd/eyescli/main.go +++ b/cmd/eyescli/main.go @@ -21,7 +21,7 @@ import ( // EyesCli - main basecoin client command var EyesCli = &cobra.Command{ Use: "eyescli", - Short: "Light client for tendermint", + Short: "Light client for Tendermint", Long: `EyesCli is the light client for a merkle key-value store (eyes)`, } @@ -33,7 +33,7 @@ func main() { // These are default parsers, but optional in your app (you can remove key) query.TxQueryCmd, query.KeyQueryCmd, - // this is out custom parser + // this is our custom parser etccmd.EtcQueryCmd, ) diff --git a/modules/etc/commands/tx.go b/modules/etc/commands/tx.go index 492067b24..d60b790d8 100644 --- a/modules/etc/commands/tx.go +++ b/modules/etc/commands/tx.go @@ -22,9 +22,10 @@ var RemoveTxCmd = &cobra.Command{ RunE: commands.RequireInit(removeTxCmd), } -//nolint const ( - FlagKey = "key" + // FlagKey is the cli flag to set the key + FlagKey = "key" + // FlagValue is the cli flag to set the value FlagValue = "value" ) diff --git a/modules/etc/handler.go b/modules/etc/handler.go index ba338d5fb..c979813e7 100644 --- a/modules/etc/handler.go +++ b/modules/etc/handler.go @@ -73,7 +73,8 @@ func (h Handler) DeliverTx(ctx basecoin.Context, store state.SimpleDB, tx baseco return } -// doSetTx write to the store, overwriting any previous value +// doSetTx writes to the store, overwriting any previous value +// note that an empty response in DeliverTx is OK with no log or data returned func (h Handler) doSetTx(ctx basecoin.Context, store state.SimpleDB, tx SetTx) (res basecoin.DeliverResult, err error) { data := NewData(tx.Value, ctx.BlockHeight()) store.Set(tx.Key, wire.BinaryBytes(data)) @@ -81,6 +82,7 @@ func (h Handler) doSetTx(ctx basecoin.Context, store state.SimpleDB, tx SetTx) ( } // doRemoveTx deletes the value from the store and returns the last value +// here we let res.Data to return the value over abci func (h Handler) doRemoveTx(ctx basecoin.Context, store state.SimpleDB, tx RemoveTx) (res basecoin.DeliverResult, err error) { // we set res.Data so it gets returned to the client over the abci interface res.Data = store.Get(tx.Key) diff --git a/modules/etc/store.go b/modules/etc/store.go index 4ec45d251..458b1d3ab 100644 --- a/modules/etc/store.go +++ b/modules/etc/store.go @@ -5,7 +5,7 @@ import "github.com/tendermint/go-wire/data" // Data is the struct we use to store in the merkle tree type Data struct { // SetAt is the block height this was set at - SetAt uint64 `json:"created_at"` + SetAt uint64 `json:"set_at"` // Value is the data that was stored. // data.Bytes is like []byte but json encodes as hex not base64 Value data.Bytes `json:"value"` diff --git a/tests/cli/eyes.sh b/tests/cli/eyes.sh index 800335970..5ca993507 100755 --- a/tests/cli/eyes.sh +++ b/tests/cli/eyes.sh @@ -20,14 +20,14 @@ oneTimeSetUp() { export EYE_HOME=${SERVE_DIR} ${SERVER_EXE} init --chain-id=$CHAIN_ID >>$SERVER_LOG startServer $SERVE_DIR $SERVER_LOG - if [ $? != 0 ]; then return 1; fi + [ $? = 0 ] || return 1 # Set up client - make sure you use the proper prefix if you set # a custom CLIENT_EXE export EYE_HOME=${BASE_DIR}/client initClient $CHAIN_ID - if [ $? != 0 ]; then return 1; fi + [ $? = 0 ] || return 1 printf "...Testing may begin!\n\n\n" }