I think that the output shows a bug because the first 32 bytes with 0x20 should not be there. Notice that the offset for the byte array 0x60 is 96 but with the given encoding, the vec length starts 128 bytes from the beginning. The correct encoding should be this:
all 0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000
Component
sol-types
What version of Alloy are you on?
├── alloy-sol-types v0.8.0 │ ├── alloy-primitives v0.8.0 │ ├── alloy-sol-macro v0.8.0 (proc-macro) │ │ ├── alloy-sol-macro-expander v0.8.0 │ │ │ ├── alloy-sol-macro-input v0.8.0 │ │ ├── alloy-sol-macro-input v0.8.0 (*)
Operating System
macOS (Apple Silicon)
Describe the bug
Example 1 It looks like there's a leading
0x20
in the abi encoding of dynamic tuples:The output of the above is:
I think that the output shows a bug because the first 32 bytes with 0x20 should not be there. Notice that the offset for the byte array 0x60 is 96 but with the given encoding, the vec length starts 128 bytes from the beginning. The correct encoding should be this:
This is the output you get using the ethers.js encoder as well:
Example 2 I copied this example from these docs:
The output has a leading
0x20
for some reason. Otherwise, the output matches the specSpec: