Closed rigelrozanski closed 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?
The flag reading seems much more boiler-plate. Do you have an idea how to simplify that? I'd love to hear it.
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
What do you mean by heavy client?
We have a light client that gets proofs. And a naive client that trusts anything it gets.
sorry heavy client = full node
Okay, this has been done now... trackomatron seems happier...
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
orBaseTxPresenter
Additionally there may be a way to automate how functions like ReadTxJSON are created, and have the json options encoded in the background?