-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
The FixedBytes
should be encoded by adding trailing zeros (so right padding).
The following test is currently failing:
test "keeps compatibility with FixedBytes":
let bytes16 = FixedBytes[16](randomBytes[16]())
check encode(bytes16) == @(bytes16.data) & 16.zeroes
let bytes32 = FixedBytes[32](randomBytes[32]())
check encode(bytes32) == @(bytes32.data)
let bytes33 = FixedBytes[33](randomBytes[33]())
check encode(bytes33) == @(bytes33.data) & 31.zeroes
The error is:
Check failed: encode(bytes16) == @(bytes16.data) & 16.zeroes
encode(bytes16) was @[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 123, 248, 85, 22, 17, 155, 159, 163, 175, 32, 209, 119, 44, 3, 33]
@(bytes16.data) & 16.zeroes was @[22, 123, 248, 85, 22, 17, 155, 159, 163, 175, 32, 209, 119, 44, 3, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
So the current encoding for FixedBytes
is using left padding, but it should be using right padding.
Metadata
Metadata
Assignees
Labels
No labels