-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
explicit 8-byte alignment #185
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change make it possible to finally compile marginfi programs on M-series macs? That would be a huge plus and remove the need for having a x86 VM to compile for me.
I'm a big fan of this change but would like @jkbpvsc to make the final approval. This code is very sensitive and if we change it in a way that's not backwards compatible it will be a pain.
yes it makes it compatible with mac. i am confident it doesn't affect on-chain representation, as it just makes the alignment and size of types equal between bpf and arm without changing bpf, but someone should definitely write a test that fetches all types from mainnet to be doubly sure. |
@cavemanloverboy can you fix linting, it seems its failing |
this failure was on main haha. i'll fix |
the linter failed because the bank and oracles are no longer in the vector holding the lut keys.
Just wanna confirm this is intentional |
I added a couple of fixture-based tests on You can rebase on |
…mrgnlabs/marginfi-v2 into cavey/explicit-8-byte-alignment
…mrgnlabs/marginfi-v2 into cavey/explicit-8-byte-alignment
#[macro_export] | ||
macro_rules! assert_struct_align { | ||
($struct: ty, $align: expr) => { | ||
static_assertions::const_assert_eq!(std::mem::align_of::<$struct>(), $align); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed previously static_assertions
hasn't been updated in 4 years, I wonder if we can make the same checks using const generics or some other mechanism in latest rust. Just a thought, not for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you want to check exactly?
Closes #181 |
…mrgnlabs/marginfi-v2 into cavey/explicit-8-byte-alignment
^ last commit, just wanted to commit latest lock |
* explicit 8-byte alignment * fix linter * update lock files * update locks * upgrade fuzzer's rustc * add toolchain for fuzzer * lower bumpalo version * fix ahash * fix ahash * upgrade rust toolchain for fuzz * Update nightly toolchain for fuzzer * Update test.yaml * latest lock
all padding fields are now 8 byte aligned (on bpf, arm, x86), and all program types are now explciitly 8 byte aligned.
improves devex on mac. bpf in-memory (on-chain) representation is unchanged.