Skip to content
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

Closed
carlhua opened this issue Nov 5, 2020 · 3 comments · Fixed by #4703
Closed

Consider automatically generate enum definitions during compilation #3657

carlhua opened this issue Nov 5, 2020 · 3 comments · Fixed by #4703
Labels
Feature Request Used to indicate requests to add new features Reviewed RIPD Export Exported from legacy JIRA issue tracking

Comments

@carlhua
Copy link
Contributor

carlhua commented Nov 5, 2020

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

@carlhua carlhua added Feature Request Used to indicate requests to add new features RIPD Export Exported from legacy JIRA issue tracking Reviewed Medium Priority labels Nov 5, 2020
@intelliot
Copy link
Collaborator

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.

@intelliot
Copy link
Collaborator

I believe this will be resolved by #4402 and related work

@github-project-automation github-project-automation bot moved this to 🆕 New in Core Ledger Feb 14, 2023
@intelliot intelliot moved this from 🆕 New to 🏗 In progress in Core Ledger Feb 14, 2023
intelliot pushed a commit that referenced this issue Oct 18, 2023
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>
@intelliot intelliot moved this from 🏗 In progress to Ready to release in Core Ledger Dec 1, 2023
@intelliot
Copy link
Collaborator

Fixed by #4703.

sophiax851 pushed a commit to sophiax851/rippled that referenced this issue Jun 12, 2024
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Used to indicate requests to add new features Reviewed RIPD Export Exported from legacy JIRA issue tracking
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants