Skip to content

Re-implement short format for block roots/hashes #6689

Open
@michaelsproul

Description

@michaelsproul

Description

With the switch to alloy-primitives in v6.0.0, we inadvertently changed the formatting of Hash256 values in the logs! Previously:

Dec 12 12:05:05.000 INFO Synced slot: 10598423, block: 0x7dd2…ee75, epoch: 331200, finalized_epoch: 331198, finalized_root: 0xf48f…06f1, exec_hash: 0xdd55…bdc8 (verified), peers: 103, service: slot_notifier

Now, the full block roots are displayed:

Dec 12 13:25:29.000 INFO Synced slot: 10598825, block: 0xf633e35ac946c51255f9f995505b19fbdd9ea066e2f4344b4796b3c437b2a33e, epoch: 331213, finalized_epoch: 331211, finalized_root: 0xba7c68d160dd9f611cb0604ef140586345eec5807032c2c97951262f1f1591dd, exec_hash: 0x4e99af907ff1c7066026af53f2d80ecd6ae7b717bde720af70e2987b1a1aa1c6 (verified), peers: 105, service: slot_notifier

We used to use ?block_root to get the full block root via its Debug impl, and %block_root or just block_root to use the Display impl which was abbreviated. I think alloy must not be using the abbreviated format for Display, which is a reasonable design decision.

Version

Lighthouse v6.0.0, since:

Steps to resolve

Alloy doesn't seem to provide a short format at all (looking at https://docs.rs/alloy-primitives/0.8.15/alloy_primitives/struct.FixedBytes.html). We would need to write one ourselves, possibly something zero-copy that integrates with our logging library.

Seeing as we're imminently switching to tracing, this issue should probably wait until the tracing PR is merged:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions