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: byte array encoding #344

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

Conversation

frenzox
Copy link

@frenzox frenzox commented Jan 27, 2025

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

When encoding a ByteArray or Bytes with size multiple of 32, we try to add an unnecessary 32 byte padding and end up with the following panic:

Panicked with 0x496e646578206f7574206f6620626f756e6473 ('Index out of bounds').

Issue Number: N/A

What is the new behavior?

If the size is multiple of 32, skip padding. This avoids the panic.

Does this introduce a breaking change?

  • Yes
  • No

Other information

We should not add padding when the size of the array is a multiple of
32 bytes.

Signed-off-by: Guilherme Felipe da Silva <[email protected]>
@gaetbout gaetbout requested a review from 0xLucqs January 28, 2025 08:15
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.

1 participant