Conversation
|
Hey @mr-zwets and @A60AB5450353F40E – I know you both have done some some experimenting with the v1 JSON schema so far, I'd love to get your thoughts on these updates! |
|
Hi, thanks for pinging me! I just went over the changes and I think the simplified view of time in a registry is a great change! I'm not sure I fully get the rational for changing from arrays to objects (maps?) but one thing I worry about is that getting the latest identity snapshot becomes less easy as you can't get the last index of the array but instead have to compare all the timestamp keys on an object?
Currently One thing I do hope is that wallets will not have to support both bcmr versions with different parsing rules. I assume because it wasn't used on mainnet that the old standard can just be dropped? |
|
Awesome, thanks for the review @mr-zwets! Ah, I failed to mention another implementation concern on timestamps – the v1 schema had two potentially-conflicting ways to represent snapshot ordering information. Since Re mandatory And thanks also for the recommendation to assign proper names to some of the complex types, I hadn't fought with that yet, but definitely important that we export early and often. Fixed in e89183b 🚀 |
|
Ok, Still working on additional examples. |
|
Ah, I didn't respond to @mr-zwets question on supporting the v1 schema – yeah, I think v1 should definitely be dropped completely. In a sense, it only ever supported chipnet since the format can't even indicate what chain it's talking about. We can worry a bit more about backwards compatibility after this major version. I'm hopeful we've found a lot of the issues for now though, and future changes will generally just add new, optional fields. (And/or use |
|
I think this is pretty solid, so merging now. I'll work on a few additional examples in other PRs. |
Fixes #6
This PR includes an assortment of corrections I've run into while experimenting since the v1 release. They're generally small changes, but they still require a version increase as they're not all backward compatible.
One key insight reflected in several locations is that objects are generally safer than arrays in data formats that might be revised by multiple parties. With an array, a git commit that inserts an item cannot be safely merged with another git commit that references array items by number. Because maps explicitly assign an index to each item, they also tend to be more resilient and easier for humans to work with in simple editing tools. This PR doesn't completely remove array use from the BCMR schema, but arrays are reserved only for fields requiring a simple list of strings.
Extensionshave stricter limits: strings, or objects of strings (up to two dimensions), rather than the previousunknownvalue. This makes implementation in a variety of programming languages far safer and more consistent without compromising expressiveness. (Extensions that might have unwittingly used arrays will also now be implemented using objects, gaining the benefits of objects mentioned above.)chainsand adefaultChain, allowing registries to differentiate identities/tokens usingmainnetvs.chipnet,testnet4, or any potential future splits. Registries focused on BCH mainnet can basically ignore this stuff entirely, but now it's at least possible for registries to differentiate between networks.identitiesfield is now an object rather than an array, keyed by ISO string times. This both simplifies usage and makes the format easier to grok.IdentitySnapshot.time.{begin/complete}is now replaced with an optionalmigratedtimestamp, removing a lot of visual noise from the format.token.nfts.fieldsis now optional, also reducing noisetoken.nfts.parsenow uses a standard transaction context, eliminating some undefined behavior and simplifying implementation. (Some discussion here.)