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

Contract Reader Handle Empty Bytes #15688

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

Conversation

EasterTheBunny
Copy link
Contributor

In some cases, a contract call will return an empty result 0x, which decodes to an empty set of bytes. The codec can't decode this empty set except in specific cases where a slice of bytes is the expected result.

This commit adds a short-circuit to decoding an empty result where the return value is unaltered.

In some cases, a contract call will return an empty result `0x`, which decodes to an empty set of bytes. The codec
can't decode this empty set except in specific cases where a slice of bytes is the expected result.

This commit adds a short-circuit to decoding an empty result where the return value is unaltered.
Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

🎖️ No JIRA issue number found in: PR title, commit message, or branch name. Please include the issue ID in one of these.

Copy link
Contributor

@ilija42 ilija42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test in TestChainComponents?

@EasterTheBunny
Copy link
Contributor Author

TestChainComponents

I was thinking about this, but the edge case is simply in implementation and the chain components tests are unaware of the exact bytes returned by the RPC. To top it off, we didn't catch this issue because it wasn't an issue using the simulated chain.

I think I can add a special test harness for this case (both GetLatest and Batch), but I will need to simulate an empty data return at the lowest level. I'll look at what kind of lift that will take. Maybe there is a shortcut.

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.

3 participants