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

bug: Alloy SolType::abi_encode differs for Bytes type? #1

Open
erhant opened this issue Aug 7, 2024 · 2 comments
Open

bug: Alloy SolType::abi_encode differs for Bytes type? #1

erhant opened this issue Aug 7, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@erhant
Copy link
Member

erhant commented Aug 7, 2024

to be investigated, this bug does not happen for abi_encode_packed

This is not an Alloy bug, but our own bug

@erhant
Copy link
Member Author

erhant commented Aug 7, 2024

it does not affect the oracle as we work with packed encoding anyways

@erhant erhant self-assigned this Aug 7, 2024
@erhant
Copy link
Member Author

erhant commented Sep 24, 2024

the problem is in this line: https://github.com/firstbatchxyz/dkn-l2-oracle/blob/master/tests/abi_encode_test.rs#L118

the bytes array is encoded as if its independent, therefore the offset it results in respects only itself; it should respect other structs as well.

for that, we need to create a large complex type ephemerally (see https://docs.rs/alloy-sol-types/latest/alloy_sol_types/trait.SolType.html) and then call .abi_encode on top of it.

@erhant erhant added the bug Something isn't working label Sep 24, 2024
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

1 participant