Skip to content

Comments

fix: receipts root encoding#16

Open
dudong2 wants to merge 1 commit intobasechain/developfrom
fix/receiptsroot-encoding
Open

fix: receipts root encoding#16
dudong2 wants to merge 1 commit intobasechain/developfrom
fix/receiptsroot-encoding

Conversation

@dudong2
Copy link
Member

@dudong2 dudong2 commented May 16, 2025

Description

tl;dr

Currently, EmitReceiptsRootEvent emits receiptsRoot as string(receiptsRoot.Bytes()), which may contain non-UTF-8 characters and result in unreadable or invalid output.
This PR changes the emission to use receiptsRoot.Hex() instead, which is UTF-8 safe and human-readable.

Problem

  • string(receiptsRoot.Bytes()) can include invalid UTF-8 bytes (e.g. 0x00, 0x80–0xFF)
  • This leads to:
    • Escaped or malformed data in RPC responses
    • Inconsistent hash reconstruction in clients

FIx

sdk.NewAttribute(types.AttributeKeyEthereumReceiptsRoot, receiptsRoot.Hex())

Impact

  • Safer and cleaner receiptsRoot in events
  • No behavioral change — only improves compatibility with RPC consumers

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

Reviewers Checklist

All items are required.
Please add a note if the item is not applicable
and please add your handle next to the items reviewed
if you only reviewed selected items.

I have...

  • added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • confirmed all author checklist items have been addressed
  • confirmed that this PR does not change production code
  • reviewed content
  • tested instructions (if applicable)
  • confirmed all CI checks have passed

@dudong2 dudong2 self-assigned this May 16, 2025
zsystm pushed a commit that referenced this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants