Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement merkleeyes #211

Merged
merged 8 commits into from
Aug 7, 2017
Merged

Conversation

ethanfrey
Copy link
Contributor

To provide a semi-useful demo app for tutorials,
to document the process to do so with the git comments and commits,
and to allow us to deprecate merkleeyes app in the repo....

I implemented a simple k-v store interface as a basecoin/basecli app.

Please take a look.

@ethanfrey ethanfrey force-pushed the feature/reimplement-merkleeyes branch from 0f7f495 to 09b1bb3 Compare August 6, 2017 22:01
@ethanfrey ethanfrey changed the title WIP: Reimplement merkleeyes Reimplement merkleeyes Aug 6, 2017
return stack.New(
base.Logger{},
stack.Recovery{},
).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clear my understanding - eyes will run concurrently to a basecoin instance and therefor needs it's own stack and logger

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this set of commands for if you wanted to run an eyes client out of process from basecoin? Can we run it in process? if yes, when do we even want out of process functionality?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, to run it as a separate process. Mainly for testing.

Currently merkleeyes is used for two things. A storage layer for base coin (no more in unstable) and a backend abci app for testing tendermint.

This would replace the second usage and consolidate all abci apps in the new framework.

cmd/eyes/main.go Outdated
// out own init command to not require argument
InitCmd,
commands.StartCmd,
//commands.RelayCmd,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's happening with Relay? Did you mention that we don't need any more? Should delete all instances of this line if so

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally right, not needed here
In the main app, still need to figure out how

// EyesCli - main basecoin client command
var EyesCli = &cobra.Command{
Use: "eyescli",
Short: "Light client for tendermint",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize Tendermint (as per coding standards) - should only be lowercase ever when it's a part of the cli-command name (Use) or file/folder name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Use: "etc [key]",
Short: "Get data stored under key in etc",
RunE: commands.RequireInit(etcQueryCmd),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's etc again? Maybe we should add more documentation - etc not very descriptive. If this command is supposed to just be querying raw data from the eyes (in general, as this commands code-comment suggests) then etc is maybe a bad descriptor of the functionality - however Short: desc seems to suggest otherwise

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need naming help.

It is like etcd that bucky refers to a lot.
It is also like the merkleeyes app, thus eyes.
Maybe a different name?

I need help naming for sure

@rigelrozanski
Copy link
Contributor

Overall looks good - main concern is just understanding etc let's add even a readme to the module folder explaining that maybe. - Actually generally maybe each module should actually have a module describing what's happening?! I'm a fan of having the markdown descriptions popup when I'm browsing a codebase in github

RegisterImplementation(SetTx{}, TypeSet, ByteSet)
}

// SetTx sets a key-value pair
Copy link
Contributor

@cloudhead cloudhead Aug 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get in the habit of ending our godoc sentences with a period.

return
}

// doSetTx write to the store, overwriting any previous value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/write/writes

store.Set(tx.Key, wire.BinaryBytes(data))
return
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No result?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty result is okay with no extra info. It is standard in abci but should be commented

RunE: commands.RequireInit(removeTxCmd),
}

//nolint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the nolint for here? just curious.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cuz i was too lazy to comment both exported const.
otherwise the automatic linter complains :(

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be written [ $? = 0 ] || return 1 -- but this way is ok too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for shorter

// These are default parsers, but optional in your app (you can remove key)
query.TxQueryCmd,
query.KeyQueryCmd,
// this is out custom parser
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"our"

// 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"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make the go and json keys match?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Notice that everything has json tags and that we check price in CheckTx,
while we run real code in DeliverTx.  Return values are meant for the client.
Note how the all framework commands can be reused with a bit of configurations.
And one can add the custom query and tx commands.
@ethanfrey ethanfrey force-pushed the feature/reimplement-merkleeyes branch from 36a2ba7 to ade9d45 Compare August 7, 2017 16:50
@ethanfrey ethanfrey merged commit 13d739a into unstable Aug 7, 2017
@ethanfrey ethanfrey deleted the feature/reimplement-merkleeyes branch August 21, 2017 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants