Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

Minimizing custom-plugin code requirements #14

Closed
rigelrozanski opened this issue May 2, 2017 · 7 comments
Closed

Minimizing custom-plugin code requirements #14

rigelrozanski opened this issue May 2, 2017 · 7 comments

Comments

@rigelrozanski
Copy link
Contributor

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

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

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

@rigelrozanski
Copy link
Contributor Author

With regards to the flag system... I think we should create a similar mechanism to as done for query in #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 #22

@ethanfrey
Copy link
Contributor

What do you mean by heavy client?

@ethanfrey
Copy link
Contributor

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

@rigelrozanski
Copy link
Contributor Author

sorry heavy client = full node

@ethanfrey
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants