-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Adds stable layout types to pass to the runtime #30192
Adds stable layout types to pass to the runtime #30192
Conversation
8a65b60
to
edd379b
Compare
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.
Solid PR so far! Just a couple of minor comments but otherwise looks great
Here's all the unique types that are used with $ rg translate_type | sed -n 's/.*translate_type.*::<\(.*\)>.*/\1/p' | sort | uniq
&[u8]
AccountInfo
ProcessedSiblingInstruction
Pubkey
SolInstruction
StableInstruction
T
edwards::PodEdwardsPoint
i32
ristretto::PodRistrettoPoint
scalar::PodScalar
u64
u8 And removing the built-ins:
Their details:
Are there other types that I've missed? |
bbec6db
to
98cbe12
Compare
force-push to rebase onto the tip of master. |
😱 Looks like that scary T is |
Looking through the sysvars, I found:
I think we're OK, since bpf_loader only cares about Clock, EpochSchedule, Fees, and Rent. Those are the only sysvars that I saw that had Syscalls associated with them. which I think means those are the only ones that use |
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.
This looks good to me now, thanks for much for doing this work!
Up to you if you want to try to hack downstream-projects in CI to run with nightly, but if a validator running this makes roots, I think we're probably good to land!
Yep the other sysvars use bincode (eew), so we're good |
The lack of this in 1.14 is causing issues for people who build their on-chain program with the compiler from 1.16 and the 1.14 crates. You can see my writeup at #31960 (comment) Although we don't typically recommend that people do that, the other difficulties with upgrading to the 1.16 crates has meant that people first upgrade their toolchain, only to find that their current program doesn't work because of the Would it be possible to backport this PR to 1.14? I know it's very late, but the changes don't seem too invasive, and it'll unblock a lot of developers. |
Problem
Please refer to #29852.
Summary of Changes
Add shadow structs with stable memory layouts to pass to the runtime.
Fixes #29852
Testing
In addition to CI, I built
solana-validator
with Rust nightly (cargo 1.69.0-nightly (e84a7928d 2023-01-31)
) and ran it against mainnet-beta. It has caught up and has been running & making roots for 21+ hours.Additionally, I've run
cargo +nightly test
against the following dirs: