Open PushjoeYY opened 7 months ago
That seems correct to me? The alignment of u128 is 0x10, so putting it at 0x128 would mean its unaligned, whereas 0x130 is the next aligned offset. only repr(packed)
allows putting fields at unaligned offsets.
Alignment of u128 was 8 in Rust 1.76 but is now 16 in 1.77 if I understand correctly, so I guess we're doing it right now. (Do we get that dynamically from rustc somehow or is it hardcoded?)
Ah right. We link statically against a mirror of the abi crate which we update when we sync with rustc, so vscode r-a will usually depend on the latest nightly version of that (where as using rustup r-a will always match correctly)
Oh, the reason must be that the data I received was generated by an older version of rustc. It's quite challenging to detect such compatibility issues.
rust-analyzer version: v0.3.1924-standalone
rustc version: (eg. output of
1.77.1
)editor or extension: VSCode
related file: https://github.com/raydium-io/raydium-contract-instructions/blob/master/lib/src/amm_stats.rs
(basic view of struct repr(C)) (Correct offset,but the next field's offset should be 0x128) (Wrong)