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

Fix typo in block.rewards.rewardType literals - Capitalize #152

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

paul-leydier
Copy link

Problem

The documentation page for GetBlock endpoint shows potential rewardType to be one of:

"fee", "rent", "voting", "staking"

These are not capitalized.

However, querying the endpoint on block 257199412 with the following HTTP body:

{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "getBlock",
    "params": [
        257199412,
        {
            "encoding": "json",
            "maxSupportedTransactionVersion": 0,
            "transactionDetails": "none",
            "rewards": true
        }
    ]
}

Returns:

{
    "jsonrpc": "2.0",
    "result": {
        "blockHeight": 237611155,
        "blockTime": 1711735787,
        "blockhash": "B1Y7EQCzGxR9SdWEDYBNEZ3rGNDzm474bCmNCKCHUXfq",
        "parentSlot": 257199411,
        "previousBlockhash": "8rQyMomtZUgeEtmgfXXd6HAmf6Yfw7dCyfdqdmPHeSKb",
        "rewards": [
            {
                "commission": null,
                "lamports": 31619653,
                "postBalance": 3194164089961,
                "pubkey": "q9XWcZ7T1wP4bW9SB4XgNNwjnFEJ982nE8aVbbNuwot",
                "rewardType": "Fee"
            }
        ]
    },
    "id": 1
}

Note the capitalization of "Fee" in the response. This can cause confusion for developper parsing the response with non-loose parsers.

Summary of Changes

I simply capitalized the described rewardType literals in the docs.

@nickfrosty
Copy link
Collaborator

Nice catch! The current response does in fact give a response with the first letter capitalized.

After a bit of digging in the rpc code base, I think this is actually not intended. Based on the Reward struct within a ConfirmedBlock

It should be using this formatter giving a lower case value

Copy link

github-actions bot commented Dec 6, 2024

This pull request has been automatically marked as stale because it has not had recent activity. Remove stale label or comment or this will be closed in 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants