Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Bytes32.wrap(Bytes value, int offset) doesn't honor offset for specific Bytes param #168

Closed
Nashatyrev opened this issue Nov 17, 2020 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@Nashatyrev
Copy link

Issue in the implementation of the Bytes32.wrap(Bytes value, int offset) method:

    Bytes bytes = Bytes.fromHexString(
        "0x00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff");
    MutableBytes mutableBytes = MutableBytes.create(48);
    bytes.copyTo(mutableBytes);
    System.out.println(Bytes32.wrap(mutableBytes, 1));

Expected output:

0x112233445566778899aabbccddeeff00

Actual output:

0x00112233445566778899aabbccddeeff
@atoulme atoulme added the bug Something isn't working label Nov 26, 2020
@atoulme atoulme added this to the 1.4.0 milestone Nov 26, 2020
@atoulme
Copy link
Member

atoulme commented Dec 3, 2020

Which version are you using?
I have reproduced the issue. I recommend you use this notation as workaround:
mutableBytes.slice(1, 32);

@Nashatyrev
Copy link
Author

We are using 1.0.0 at the moment.
Yep, thanks for the workaround, I believe this is exactly what I've used

@Nashatyrev
Copy link
Author

I believe this was fixed with #179

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants