Clean up comments
This commit is contained in:
parent
483ed6d87a
commit
0133723aca
|
@ -27,13 +27,12 @@ import (
|
||||||
// BaseCli - main basecoin client command
|
// BaseCli - main basecoin client command
|
||||||
var BaseCli = &cobra.Command{
|
var BaseCli = &cobra.Command{
|
||||||
Use: "basecli",
|
Use: "basecli",
|
||||||
Short: "Light client for tendermint",
|
Short: "Light client for Tendermint",
|
||||||
Long: `Basecli is an version of tmcli including custom logic to
|
Long: `Basecli is a certifying light client for the basecoin abci app.
|
||||||
present a nice (not raw hex) interface to the basecoin blockchain structure.
|
|
||||||
|
|
||||||
This is a useful tool, but also serves to demonstrate how one can configure
|
It leverages the power of the tendermint consensus algorithm get full
|
||||||
tmcli to work for any custom abci app.
|
cryptographic proof of all queries while only syncing a fraction of the
|
||||||
`,
|
block headers.`,
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -35,7 +35,6 @@ func main() {
|
||||||
// out own init command to not require argument
|
// out own init command to not require argument
|
||||||
InitCmd,
|
InitCmd,
|
||||||
commands.StartCmd,
|
commands.StartCmd,
|
||||||
//commands.RelayCmd,
|
|
||||||
commands.UnsafeResetAllCmd,
|
commands.UnsafeResetAllCmd,
|
||||||
commands.VersionCmd,
|
commands.VersionCmd,
|
||||||
)
|
)
|
||||||
|
|
|
@ -21,7 +21,7 @@ import (
|
||||||
// EyesCli - main basecoin client command
|
// EyesCli - main basecoin client command
|
||||||
var EyesCli = &cobra.Command{
|
var EyesCli = &cobra.Command{
|
||||||
Use: "eyescli",
|
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)`,
|
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)
|
// These are default parsers, but optional in your app (you can remove key)
|
||||||
query.TxQueryCmd,
|
query.TxQueryCmd,
|
||||||
query.KeyQueryCmd,
|
query.KeyQueryCmd,
|
||||||
// this is out custom parser
|
// this is our custom parser
|
||||||
etccmd.EtcQueryCmd,
|
etccmd.EtcQueryCmd,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,10 @@ var RemoveTxCmd = &cobra.Command{
|
||||||
RunE: commands.RequireInit(removeTxCmd),
|
RunE: commands.RequireInit(removeTxCmd),
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint
|
|
||||||
const (
|
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"
|
FlagValue = "value"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,8 @@ func (h Handler) DeliverTx(ctx basecoin.Context, store state.SimpleDB, tx baseco
|
||||||
return
|
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) {
|
func (h Handler) doSetTx(ctx basecoin.Context, store state.SimpleDB, tx SetTx) (res basecoin.DeliverResult, err error) {
|
||||||
data := NewData(tx.Value, ctx.BlockHeight())
|
data := NewData(tx.Value, ctx.BlockHeight())
|
||||||
store.Set(tx.Key, wire.BinaryBytes(data))
|
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
|
// 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) {
|
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
|
// we set res.Data so it gets returned to the client over the abci interface
|
||||||
res.Data = store.Get(tx.Key)
|
res.Data = store.Get(tx.Key)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import "github.com/tendermint/go-wire/data"
|
||||||
// Data is the struct we use to store in the merkle tree
|
// Data is the struct we use to store in the merkle tree
|
||||||
type Data struct {
|
type Data struct {
|
||||||
// SetAt is the block height this was set at
|
// 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.
|
// Value is the data that was stored.
|
||||||
// data.Bytes is like []byte but json encodes as hex not base64
|
// data.Bytes is like []byte but json encodes as hex not base64
|
||||||
Value data.Bytes `json:"value"`
|
Value data.Bytes `json:"value"`
|
||||||
|
|
|
@ -20,14 +20,14 @@ oneTimeSetUp() {
|
||||||
export EYE_HOME=${SERVE_DIR}
|
export EYE_HOME=${SERVE_DIR}
|
||||||
${SERVER_EXE} init --chain-id=$CHAIN_ID >>$SERVER_LOG
|
${SERVER_EXE} init --chain-id=$CHAIN_ID >>$SERVER_LOG
|
||||||
startServer $SERVE_DIR $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
|
# Set up client - make sure you use the proper prefix if you set
|
||||||
# a custom CLIENT_EXE
|
# a custom CLIENT_EXE
|
||||||
export EYE_HOME=${BASE_DIR}/client
|
export EYE_HOME=${BASE_DIR}/client
|
||||||
|
|
||||||
initClient $CHAIN_ID
|
initClient $CHAIN_ID
|
||||||
if [ $? != 0 ]; then return 1; fi
|
[ $? = 0 ] || return 1
|
||||||
|
|
||||||
printf "...Testing may begin!\n\n\n"
|
printf "...Testing may begin!\n\n\n"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue