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

Element:Tuple at depth 0 being encoded as nested tuple #156

Open
Aioxas opened this issue Nov 26, 2019 · 2 comments
Open

Element:Tuple at depth 0 being encoded as nested tuple #156

Aioxas opened this issue Nov 26, 2019 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@Aioxas
Copy link

Aioxas commented Nov 26, 2019

Continuing conversation from #150

Expected behavior:



Element::Tuple(Tuple(vec![
                Element::Bytes(vec![0]),
                Element::Empty,
                Element::Tuple(Tuple(vec![Element::Bytes(vec![0]), Element::Empty])),
            ])),
            &[1, 0, 255, 0, 0, 255, 5, 1, 0, 255, 0, 0, 255, 0],
        )


Actual behavior:



Element::Tuple(Tuple(vec![
                Element::Bytes(vec![0]),
                Element::Empty,
                Element::Tuple(Tuple(vec![Element::Bytes(vec![0]), Element::Empty])),
            ])),
            &[5,1, 0, 255, 0, 0, 255, 5, 1, 0, 255, 0, 0, 255, 0, 0],
        )

@Aioxas Aioxas changed the title Tuples at depth 0 being encoded as nested tuples Element:Tuple at depth 0 being encoded as nested tuple Nov 26, 2019
@Speedy37 Speedy37 added the bug Something isn't working label Nov 26, 2019
@Speedy37 Speedy37 added this to the 0.3.1 milestone Nov 26, 2019
@Speedy37
Copy link
Contributor

Element::Tuple, Vec and Tuple encoding/decoding is broken:

  • Element::Tuple and Vec always insert the NESTED and NIL bytes
  • Tuple never insert the NESTED and NIL bytes (this type is useless)
  • Static rust tuples (T0, ..., TN) are correct and only insert NESTED/NIL if tuple_depth > 0

@Aioxas
Copy link
Author

Aioxas commented Nov 29, 2019

something I noticed is that when decoding the bytes, it assumes its an Element, and due to that it never goes anywhere else than the first one. Since unlike a Tuple, there's no iteration and because it's returning an offset of just the first decoded element it implodes with Err::InvalidData

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

No branches or pull requests

2 participants