burrow icon indicating copy to clipboard operation
burrow copied to clipboard

[Web3] Configurability

Open gregdhill opened this issue 6 years ago • 7 comments

In order to preserve the outer dynamics of the web3 interface we have to change the representation of token values, state hashes and keys. It would be nice if these adjustments where configurable, with sensitive defaults.

gregdhill avatar Sep 30 '19 14:09 gregdhill

I'm a first-time open source contributor (though I've got a small amount of gRPC/protobuf experience, for what it's worth) - I'd be interested in picking up this issue, if it's a good starter one, although to be honest wrapping my head around the repo seems like a bit of a tall order so it might take me some time to get there.

(I also completely understand if this would be better-suited for someone with more experience w/ Burrow to pick up!)

rohitkumarWUSTL avatar Sep 30 '19 19:09 rohitkumarWUSTL

Hey @rohitkumarWUSTL! Thanks for the interest, I can post a few links which I think may be of help. So when we establish the web3 service here, we should pass in a new config (which can be added here. The service can then check this config before doing things such as the balance conversion here.

gregdhill avatar Oct 01 '19 11:10 gregdhill

Thanks! The links are helpful. Sorry, I just need a little clarification - does the BurrowConfig contain sufficient information already (i.e. the only change that needs to be made is for the config field in the EthService struct to change types from a tmConfig to a BurrowConfig), or do additional fields need to be added to the BurrowConfig struct to reflect configurations of token values, state hashes and keys (with corresponding additions in the DefaultBurrowConfig() function as well)?

(Or are neither of those the case, and I completely misread what you're going for?)

rohitkumarWUSTL avatar Oct 02 '19 05:10 rohitkumarWUSTL

So currently we only pass tmConfig as you've discovered, but we can pass the full BurrowConfig instead since it contains the Tendermint configuration. For this task we'll want to add another set of options to BurrowConfig in a sub-struct - one field of which may be the conversion rate for instance.

gregdhill avatar Oct 02 '19 08:10 gregdhill

I see, that makes sense. So the changes that need to be made are:

  • Change the tmConfig field in the EthService struct to a BurrowConfig
  • Add a sub-struct to the BurrowConfig struct for additional configs (what should it be called?)
  • Implement defaults for this sub-struct (I'll need some guidance on this as I don't have any domain knowledge yet, sorry)
  • (Possibly) refactor anywhere where an EthService is constructed with a custom config object?

Am I missing anything? Thank you for being so helpful!

rohitkumarWUSTL avatar Oct 04 '19 05:10 rohitkumarWUSTL

Those changes sound good to me! We can name the sub-struct Web3, and start off with a conversion rate field that is either a customizable *big.Int or we can create an enum for ethereum denominations. Once that's done we can discuss other settings.

gregdhill avatar Oct 04 '19 16:10 gregdhill

@rohitkumarWUSTL are you still working on this?

deepakchethan avatar Feb 29 '20 02:02 deepakchethan