ibc-go
ibc-go copied to clipboard
Add wrapper type around genesis to handle generic json object
Summary
A common issue that occurs in our E2E tests is dealing with genesis modifications.
The majority of the logic happens here
Our approach so far, has been to attempt to marshal the bytes into concrete types, modify the types, and serialize back to bytes. Over time, we have run into several categories of problems.
- codec issues
- types being removed and needing to fall back to a raw map
- conditional modifications based on version
- Conditional marshalling functions based on version
Things get quite complex quite quickly when needing to consider all previous versions and how to handle the genesis bytes.
I think we could consider forgetting about trying to work with concrete types, and creating a wrapper around a simple map[string]interface{}
type GenesisFile map[string]interface{}
And adding a bunch of functions which perform the operations that we need.
I think this is definitely not a perfect solution, but due to the nature of our tests needing to work with all versions, we are effectively working with an unversioned json object, and it might be the lesser of two evils to simply treat it as such.
I think we will still have some of the problems outlined above, such as conditional modifications, but I think this idea is at least worth exploring with a PoC.
For Admin Use
- [ ] Not duplicate issue
- [ ] Appropriate labels applied
- [ ] Appropriate contributors tagged/assigned