-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider automatically generate enum definitions during compilation #3657
Comments
From RIPD-1305 on Jira: That is how it was originally generated, but it's not working well to manually update it every time, especially after a rippled release (when the definitions can change). Consider having enums/definitions consolidated into one place (whether from the same repo or in an independent repo) so that other software with dependency on these definitions can automatically parse. |
I believe this will be resolved by #4402 and related work |
Add a new RPC / WS call for `server_definitions`, which returns an SDK-compatible `definitions.json` (binary enum definitions) generated by the server. This enables clients/libraries to dynamically work with new fields and features, such as ones that may become available on side chains. Clients query `server_definitions` on a node from the network they want to work with, and immediately know how to speak that node's binary "language", even if new features are added to it in the future (as long as there are no new serialized types that the software doesn't know how to serialize/deserialize). Example: ```js > {"command": "server_definitions"} < { "result": { "FIELDS": [ [ "Generic", { "isSerialized": false, "isSigningField": false, "isVLEncoded": false, "nth": 0, "type": "Unknown" } ], [ "Invalid", { "isSerialized": false, "isSigningField": false, "isVLEncoded": false, "nth": -1, "type": "Unknown" } ], [ "ObjectEndMarker", { "isSerialized": false, "isSigningField": true, "isVLEncoded": false, "nth": 1, "type": "STObject" } ], ... ``` Close #3657 --------- Co-authored-by: Richard Holland <richard.holland@starstone.co.nz>
Fixed by #4703. |
Add a new RPC / WS call for `server_definitions`, which returns an SDK-compatible `definitions.json` (binary enum definitions) generated by the server. This enables clients/libraries to dynamically work with new fields and features, such as ones that may become available on side chains. Clients query `server_definitions` on a node from the network they want to work with, and immediately know how to speak that node's binary "language", even if new features are added to it in the future (as long as there are no new serialized types that the software doesn't know how to serialize/deserialize). Example: ```js > {"command": "server_definitions"} < { "result": { "FIELDS": [ [ "Generic", { "isSerialized": false, "isSigningField": false, "isVLEncoded": false, "nth": 0, "type": "Unknown" } ], [ "Invalid", { "isSerialized": false, "isSigningField": false, "isVLEncoded": false, "nth": -1, "type": "Unknown" } ], [ "ObjectEndMarker", { "isSerialized": false, "isSigningField": true, "isVLEncoded": false, "nth": 1, "type": "STObject" } ], ... ``` Close XRPLF#3657 --------- Co-authored-by: Richard Holland <richard.holland@starstone.co.nz>
The binary enum definitions should be generated from the rippled code automatically whenever there is a new rippled release.
We should consider how this (interpreted broadly) can be handled so that other packages that rely on the binary representation can be automatically updated.
Options include having a descriptor file in some DSL and a script that parses it to generate the necessary definitions. The script could be packaged and be used as part of the build, and we could have some kind of “hook” on GitHub that runs, generates the files, and updates repos we have push access to (e.g. the JS binary codec).
Exported from RIPD-1305
The text was updated successfully, but these errors were encountered: