Skip to content

Complete platform tools cache by making temp crate a SBPF program#220

Open
billythedummy wants to merge 2 commits into
solana-foundation:masterfrom
igneous-labs:complete-platform-tools-cache
Open

Complete platform tools cache by making temp crate a SBPF program#220
billythedummy wants to merge 2 commits into
solana-foundation:masterfrom
igneous-labs:complete-platform-tools-cache

Conversation

@billythedummy

@billythedummy billythedummy commented Nov 18, 2025

Copy link
Copy Markdown

Description

Building off #202

#202 downloads the platform tools, but cargo build-sbf appears to run further setup steps when it tries to compile a SBPF program for the first time. These further setup steps involve downloading criterion and switching out the toolchain. Dump of stdout is pasted in appendix section below for visibility.

This PR makes sure that those setup steps are ran as well by marking the temp/ repo as a SBPF program by setting

[lib]
crate-type = ["cdylib", "lib"]

in Cargo.toml.

Other

  • cleans up temp/ folder by cd ../ before removing it
  • change cargo build-sbf to cargo test-sbf in case the test step performs any additional setup (doesn't look like it does)

P.S. the bash command is getting a little unwieldy, idk if you guys want to factor it out into a bash script or something like that.

P.P.S the right thing to do would probably be to further figure out why the initial setup involves downloading a criterion release. Seems wholly unnecessary.

Appendix: setup stdout dump

+ wget https://github.com/Snaipe/Criterion/releases/download/v2.3.3/criterion-v2.3.3-linux-x86_64.tar.bz2 -O criterion-v2.3.3-linux-x86_64.tar.bz2 --progress=dot:giga --retry-connrefused --read-timeout=30
--2025-11-18 08:34:59--  https://github.com/Snaipe/Criterion/releases/download/v2.3.3/criterion-v2.3.3-linux-x86_64.tar.bz2
Resolving github.com (github.com)... 20.205.243.166
Connecting to github.com (github.com)|20.205.243.166|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://release-assets.githubusercontent.com/github-production-release-asset/30111969/98b27400-e1f1-11e8-8f10-e43f4ef84b92?sp=r&sv=2018-11-09&sr=b&spr=https&se=2025-11-18T09%3A20%3A47Z&rscd=attachment%3B+filename%3Dcriterion-v2.3.3-linux-x86_64.tar.bz2&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2025-11-18T08%3A20%3A42Z&ske=2025-11-18T09%3A20%3A47Z&sks=b&skv=2018-11-09&sig=JR9I5t4cCOsqtCWs2f7kwky%2BP0Xeru0IX1ZzSicmQms%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc2MzQ1NTE5OSwibmJmIjoxNzYzNDU0ODk5LCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.95LsZcQ8RbLyMZ7pTrICIDBZ6oiLSX7dd254GTzTXpw&response-content-disposition=attachment%3B%20filename%3Dcriterion-v2.3.3-linux-x86_64.tar.bz2&response-content-type=application%2Foctet-stream [following]
--2025-11-18 08:35:00--  https://release-assets.githubusercontent.com/github-production-release-asset/30111969/98b27400-e1f1-11e8-8f10-e43f4ef84b92?sp=r&sv=2018-11-09&sr=b&spr=https&se=2025-11-18T09%3A20%3A47Z&rscd=attachment%3B+filename%3Dcriterion-v2.3.3-linux-x86_64.tar.bz2&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2025-11-18T08%3A20%3A42Z&ske=2025-11-18T09%3A20%3A47Z&sks=b&skv=2018-11-09&sig=JR9I5t4cCOsqtCWs2f7kwky%2BP0Xeru0IX1ZzSicmQms%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc2MzQ1NTE5OSwibmJmIjoxNzYzNDU0ODk5LCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.95LsZcQ8RbLyMZ7pTrICIDBZ6oiLSX7dd254GTzTXpw&response-content-disposition=attachment%3B%20filename%3Dcriterion-v2.3.3-linux-x86_64.tar.bz2&response-content-type=application%2Foctet-stream
Resolving release-assets.githubusercontent.com (release-assets.githubusercontent.com)... 185.199.109.133, 185.199.108.133, 185.199.111.133, ...
Connecting to release-assets.githubusercontent.com (release-assets.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 677858 (662K) [application/octet-stream]
Saving to: 'criterion-v2.3.3-linux-x86_64.tar.bz2'

     0K                                    100% 10.7M=0.06s

2025-11-18 08:35:00 (10.7 MB/s) - 'criterion-v2.3.3-linux-x86_64.tar.bz2' saved [677858/677858]

+ tar --strip-components 1 -jxf criterion-v2.3.3-linux-x86_64.tar.bz2
+ ./platform-tools/rust/bin/rustc --version
+ ./platform-tools/rust/bin/rustc --print sysroot
+ [[ 5 -lt 4 ]]
+ mapfile -t toolchains
++ rustup toolchain list
+ set +e
+ for item in "${toolchains[@]}"
+ [[ 1.89.0-sbpf-solana-v1.52 == *\s\o\l\a\n\a* ]]
+ rustup toolchain uninstall 1.89.0-sbpf-solana-v1.52
info: uninstalling toolchain '1.89.0-sbpf-solana-v1.52'
info: toolchain '1.89.0-sbpf-solana-v1.52' uninstalled
+ for item in "${toolchains[@]}"
+ [[ 1.89.0-x86_64-unknown-linux-gnu (active, default) == *\s\o\l\a\n\a* ]]
+ set -e
+ rustup toolchain link 1.89.0-sbpf-solana-v1.52 platform-tools/rust
+ exit 0

@montana64

Copy link
Copy Markdown

@meumar-osec meumar-osec requested review from meumar-osec and removed request for meumar-osec March 11, 2026 08:44
@meumar-osec

Copy link
Copy Markdown
Collaborator

lgtm, but Dockerfiles are generated by generate_dockerfiles.py (from the base_dockerfile_agave template). Can you update that template to use this same pattern so future generated Dockerfiles get the platform-tools cache too?

@billythedummy

Copy link
Copy Markdown
Author

oh lol i didn't even notice that file. Done.

I guess

P.S. the bash command is getting a little unwieldy, idk if you guys want to factor it out into a bash script or something like that.

doesn't really apply since its this script that does the heavy lifting

meumar-osec added a commit to otter-sec/solana-verifiable-build that referenced this pull request Apr 8, 2026
meumar-osec added a commit to otter-sec/solana-verifiable-build that referenced this pull request Apr 8, 2026
meumar-osec added a commit to otter-sec/solana-verifiable-build that referenced this pull request Apr 10, 2026
meumar-osec added a commit to otter-sec/solana-verifiable-build that referenced this pull request Apr 10, 2026
… (temp SBPF program)"

This reverts commit aac45d3, reversing
changes made to 3ed285a.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants