tendermint / light-client

DEPRECATED: A light client for tendermint, supporting signatures, proofs, and validation (see github.com/tendermint/tendermint/lite)
Other
17 stars 9 forks source link

Minimizing custom-plugin code requirements #14

Closed rigelrozanski closed 7 years ago

rigelrozanski commented 7 years ago

Discussion space for code organization for custom implementations of light-client. The current method of how we register 'proof presenters' may be able to get entirely implemented on the light-client side (and not in places like basecli/adapter.go on the custom plugin side). Ideally keys used to access the store should be predefined functions, as so I could imagine that as a part of custom implementations we could simply feed the associated keys and parse type and let light client generate the objects such as AccountPresenter or BaseTxPresenter Additionally there may be a way to automate how functions like ReadTxJSON are created, and have the json options encoded in the background?

ethanfrey commented 7 years ago

Added the prefixing for MakeKey into a helper class: ccdfb96

I don't think there any simpler way to handle this stuff, without using a bunch of reflection, which I am not sure is worth it.

func (_ AccountPresenter) ParseData(raw []byte) (interface{}, error) {
    var acc *btypes.Account
    err := wire.ReadBinaryBytes(raw, &acc)
    return acc, err
}

The idea would be to have a function like this: pres := MakePresenter([]byte("base/a"), &btypes.Account{}) ?

And then it would return a presenter that prefixes the keys and uses go-wire to read binary into a new object of that type?

ethanfrey commented 7 years ago

The flag reading seems much more boiler-plate. Do you have an idea how to simplify that? I'd love to hear it.

rigelrozanski commented 7 years ago

With regards to the flag system... I think we should create a similar mechanism to as done for query in https://github.com/tendermint/light-client/pull/21 - basically push the responsibility of the cmd function to each plugin - This makes the most sense as each plugin should really have the same tx command for both the heavy client and the light client. more discussion on https://github.com/tendermint/light-client/issues/22

ethanfrey commented 7 years ago

What do you mean by heavy client?

ethanfrey commented 7 years ago

We have a light client that gets proofs. And a naive client that trusts anything it gets.

rigelrozanski commented 7 years ago

sorry heavy client = full node

ethanfrey commented 7 years ago

Okay, this has been done now... trackomatron seems happier...