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

feat: Add option to include raw block cbor #127

Merged
merged 6 commits into from
Feb 6, 2022
Merged

Conversation

scarmuega
Copy link
Member

This PR implements an optional flag that will include the raw cbor payload for each block as a extra field of the Block event. To enable the feature, the include_block_cbor flag of the mapper config needs to be enabled. The following is an example of a daemon mode config that includes the payload and outputs to the stdout sink:

[source]
type = "N2N"
address = ["Tcp", "relays-new.cardano-mainnet.iohk.io:3001"]
magic = "mainnet"
since = [19284008, "c91204d1ea48281023147416851008c192dbf7e4dba9c89597c715fa0af68939"]

[source.mapper]
include_block_cbor = true

[[filters]]
type = "Selection"

[filters.check]
predicate = "variant_in"
argument = ["Block"]

[sink]
type = "Stdout"
format = "JSONL"

This is an example of the output:

{
    "block": {
        "body_size": 1094,
        "cbor_hex": "820384828f1a004fa3be1a012640625820c04e0a42caf9947b8edcb208e41f6ee130b7446... [REDACTED]",
        "hash": "586f3c5dff0a9a026b04b183b1923da6d5181270d1362d073725f044aa5460d7",
        "issuer_vkey": "61261a95b7613ee6bf2067dad77b70349729b0c50d57bc1cf30de0db4a1e73a8",
        "number": 5219262,
        "previous_hash": "c04e0a42caf9947b8edcb208e41f6ee130b7446c76872fe9af5ed33067092590",
        "slot": 19284066,
        "tx_count": 3
    },
    "context": {
        "block_hash": "586f3c5dff0a9a026b04b183b1923da6d5181270d1362d073725f044aa5460d7",
        "block_number": 5219262,
        "certificate_idx": null,
        "input_idx": null,
        "output_address": null,
        "output_idx": null,
        "slot": 19284066,
        "timestamp": 1610850357,
        "tx_hash": null,
        "tx_idx": null
    },
    "fingerprint": "19284066.blck.310275953652163912797886047039773707901"
}

@mark-stopka mark-stopka added the enhancement New feature or request label Feb 6, 2022
@mark-stopka mark-stopka added this to the v1.2 milestone Feb 6, 2022
@scarmuega scarmuega marked this pull request as ready for review February 6, 2022 12:40
rvcas
rvcas previously approved these changes Feb 6, 2022
@mark-stopka
Copy link
Collaborator

I don't seem to be able to trigger tests...

@scarmuega
Copy link
Member Author

PR was created during yesterday's Github Actions outage, it got stuck in a pending status. I've pushed a trivial change just to trigger the workflow.

@mark-stopka
Copy link
Collaborator

PR was created during yesterday's Github Actions outage, it got stuck in a pending status. I've pushed a trivial change just to trigger the workflow.

Trivial changes can be dangerous when we have .editorconfig compliance check, lol. =) All fixed now. @rvcas can you go for an approval once again please?

@mark-stopka
Copy link
Collaborator

@scarmuega should I create a backlog issue to document the new include_block_cbor property, I don't see documentation update as part of the PR.

@scarmuega scarmuega merged commit 42b6bd1 into main Feb 6, 2022
@scarmuega scarmuega deleted the feat/raw-blocks branch February 6, 2022 22:51
@scarmuega
Copy link
Member Author

@mark-stopka yes, please, lets keep track of the missing documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants