From 0fbc25ae16201b874ebfb22c60bd9690ad78f1ba Mon Sep 17 00:00:00 2001 From: febo Date: Sat, 31 May 2025 03:21:45 +0100 Subject: [PATCH 1/8] Update pinocchio dependency --- benchmark/benches/pinocchio.rs | 5 ++++- programs/pinocchio/Cargo.toml | 8 ++++---- programs/pinocchio/src/processor.rs | 16 ++++++++++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/benchmark/benches/pinocchio.rs b/benchmark/benches/pinocchio.rs index 47572dc..f095b35 100644 --- a/benchmark/benches/pinocchio.rs +++ b/benchmark/benches/pinocchio.rs @@ -14,10 +14,13 @@ use setup::*; mod pinocchio { use super::*; + use solana_pubkey::Pubkey; use test::Bencher; + pub const ID: Pubkey = Pubkey::from_str_const("Pinocchio1111111111111111111111111111111111"); + #[bench] fn run(_bencher: &mut Bencher) { - runner::run(&eisodos_pinocchio::ID.into(), "eisodos_pinocchio"); + runner::run(&ID, "eisodos_pinocchio"); } } diff --git a/programs/pinocchio/Cargo.toml b/programs/pinocchio/Cargo.toml index 0fd20ab..c9a01c8 100644 --- a/programs/pinocchio/Cargo.toml +++ b/programs/pinocchio/Cargo.toml @@ -14,9 +14,9 @@ check-cfg = [ ] [lib] -crate-type = ["cdylib", "lib"] +crate-type = ["cdylib"] [dependencies] -pinocchio = "0.8" -pinocchio-pubkey = "0.2.4" -pinocchio-system = "0.2.3" +pinocchio = { version = "0.8", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/system-inline" } +pinocchio-pubkey = { version = "0.2", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/system-inline" } +pinocchio-system = { version = "0.2", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/system-inline" } diff --git a/programs/pinocchio/src/processor.rs b/programs/pinocchio/src/processor.rs index 10c94ae..2ee10a5 100644 --- a/programs/pinocchio/src/processor.rs +++ b/programs/pinocchio/src/processor.rs @@ -23,9 +23,13 @@ pub fn process_account(accounts: &[AccountInfo], expected: u64) -> ProgramResult #[inline(always)] pub fn process_create_account(accounts: &[AccountInfo]) -> ProgramResult { + let [from, to, _remaining @ ..] = accounts else { + return Err(ProgramError::InvalidArgument); + }; + CreateAccount { - from: &accounts[0], - to: &accounts[1], + from, + to, lamports: 500_000_000, space: 10, owner: &crate::ID, @@ -35,9 +39,13 @@ pub fn process_create_account(accounts: &[AccountInfo]) -> ProgramResult { #[inline(always)] pub fn process_transfer(accounts: &[AccountInfo]) -> ProgramResult { + let [from, to, _remaining @ ..] = accounts else { + return Err(ProgramError::InvalidArgument); + }; + Transfer { - from: &accounts[0], - to: &accounts[1], + from, + to, lamports: 1_000_000_000, } .invoke() From d3e4a5b167a6a96ffdfdc904d442ff23b90aebe6 Mon Sep 17 00:00:00 2001 From: febo Date: Sat, 31 May 2025 03:22:48 +0100 Subject: [PATCH 2/8] Remove archived entrypoint --- Cargo.lock | 582 +----------------- Cargo.toml | 3 +- benchmark/Cargo.toml | 2 +- benchmark/benches/solana_nostd_entrypoint.rs | 28 - programs/solana-nostd-entrypoint/Cargo.toml | 18 - .../src/cpi/create_account.rs | 39 -- .../solana-nostd-entrypoint/src/cpi/mod.rs | 72 --- .../src/cpi/transfer.rs | 29 - .../solana-nostd-entrypoint/src/entrypoint.rs | 33 - .../src/instruction.rs | 35 -- programs/solana-nostd-entrypoint/src/lib.rs | 6 - .../solana-nostd-entrypoint/src/processor.rs | 35 -- 12 files changed, 17 insertions(+), 865 deletions(-) delete mode 100644 benchmark/benches/solana_nostd_entrypoint.rs delete mode 100644 programs/solana-nostd-entrypoint/Cargo.toml delete mode 100644 programs/solana-nostd-entrypoint/src/cpi/create_account.rs delete mode 100644 programs/solana-nostd-entrypoint/src/cpi/mod.rs delete mode 100644 programs/solana-nostd-entrypoint/src/cpi/transfer.rs delete mode 100644 programs/solana-nostd-entrypoint/src/entrypoint.rs delete mode 100644 programs/solana-nostd-entrypoint/src/instruction.rs delete mode 100644 programs/solana-nostd-entrypoint/src/lib.rs delete mode 100644 programs/solana-nostd-entrypoint/src/processor.rs diff --git a/Cargo.lock b/Cargo.lock index 43722f5..2c21a28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,17 +17,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" -[[package]] -name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom 0.2.15", - "once_cell", - "version_check", -] - [[package]] name = "ahash" version = "0.8.11" @@ -80,12 +69,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anyhow" -version = "1.0.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" - [[package]] name = "ark-bn254" version = "0.4.0" @@ -305,18 +288,6 @@ name = "bitflags" version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" -dependencies = [ - "serde", -] - -[[package]] -name = "bitmaps" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" -dependencies = [ - "typenum", -] [[package]] name = "blake3" @@ -329,7 +300,6 @@ dependencies = [ "cc", "cfg-if", "constant_time_eq", - "digest 0.10.7", ] [[package]] @@ -350,120 +320,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "borsh" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" -dependencies = [ - "borsh-derive 0.9.3", - "hashbrown 0.11.2", -] - -[[package]] -name = "borsh" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" -dependencies = [ - "borsh-derive 0.10.3", - "hashbrown 0.13.2", -] - -[[package]] -name = "borsh" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" -dependencies = [ - "borsh-derive 1.5.1", - "cfg_aliases", -] - -[[package]] -name = "borsh-derive" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" -dependencies = [ - "borsh-derive-internal 0.9.3", - "borsh-schema-derive-internal 0.9.3", - "proc-macro-crate 0.1.5", - "proc-macro2", - "syn 1.0.109", -] - -[[package]] -name = "borsh-derive" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" -dependencies = [ - "borsh-derive-internal 0.10.3", - "borsh-schema-derive-internal 0.10.3", - "proc-macro-crate 0.1.5", - "proc-macro2", - "syn 1.0.109", -] - -[[package]] -name = "borsh-derive" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" -dependencies = [ - "once_cell", - "proc-macro-crate 3.2.0", - "proc-macro2", - "quote", - "syn 2.0.87", - "syn_derive", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "brotli" version = "6.0.0" @@ -485,12 +341,6 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - [[package]] name = "bs58" version = "0.5.1" @@ -554,8 +404,6 @@ version = "1.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d74707dde2ba56f86ae90effb3b43ddd369504387e718014de010cec7959800" dependencies = [ - "jobserver", - "libc", "shlex", ] @@ -565,12 +413,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chrono" version = "0.4.38" @@ -598,26 +440,6 @@ dependencies = [ "unreachable", ] -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89f72f65e8501878b8a004d5a1afb780987e2ce2b4532c562e367a72c57499f" -dependencies = [ - "log", - "web-sys", -] - [[package]] name = "const-crypto" version = "0.3.0" @@ -677,25 +499,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.20" @@ -737,7 +540,6 @@ dependencies = [ "byteorder", "digest 0.9.0", "rand_core 0.5.1", - "serde", "subtle", "zeroize", ] @@ -799,7 +601,6 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", "crypto-common", - "subtle", ] [[package]] @@ -837,7 +638,6 @@ version = "0.0.0" dependencies = [ "eisodos-jiminy", "eisodos-pinocchio", - "eisodos-solana-nostd-entrypoint", "eisodos-solana-program", "mollusk-svm", "mollusk-svm-bencher", @@ -869,14 +669,6 @@ dependencies = [ "pinocchio-system", ] -[[package]] -name = "eisodos-solana-nostd-entrypoint" -version = "0.0.0" -dependencies = [ - "solana-nostd-entrypoint", - "solana-program", -] - [[package]] name = "eisodos-solana-program" version = "0.0.0" @@ -1065,7 +857,6 @@ version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "serde", "typenum", "version_check", ] @@ -1098,10 +889,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -1151,22 +940,13 @@ dependencies = [ "byteorder", ] -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash 0.7.8", -] - [[package]] name = "hashbrown" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.11", + "ahash", ] [[package]] @@ -1328,22 +1108,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "im" -version = "15.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" -dependencies = [ - "bitmaps", - "rand_core 0.6.4", - "rand_xoshiro", - "rayon", - "serde", - "sized-chunks", - "typenum", - "version_check", -] - [[package]] name = "indexmap" version = "2.5.0" @@ -1447,15 +1211,6 @@ dependencies = [ "jiminy-cpi", ] -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.77" @@ -1575,24 +1330,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "memmap2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - [[package]] name = "mime" version = "0.3.17" @@ -1740,17 +1477,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "num-format" version = "0.4.4" @@ -1890,15 +1616,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" -[[package]] -name = "pbkdf2" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" -dependencies = [ - "crypto-mac", -] - [[package]] name = "percent-encoding" version = "2.3.1" @@ -1928,15 +1645,13 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pinocchio" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "530596fa307103e53257f2cf064815919ee7fbc4c7ab999f6f13cc7067c3aff1" +version = "0.8.4" +source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fsystem-inline#023ac9708ae125f0ab189303617e39070f5d97ff" [[package]] name = "pinocchio-pubkey" version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b20fcebc172c3cd3f54114b0241b48fa8e30893ced2eb4927aaba5e3a0ba5" +source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fsystem-inline#023ac9708ae125f0ab189303617e39070f5d97ff" dependencies = [ "five8_const", "pinocchio", @@ -1945,8 +1660,7 @@ dependencies = [ [[package]] name = "pinocchio-system" version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f75423420ae70aa748cf611cab14cfd00af08d0d2d3d258cb0cf5e2880ec19c" +source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fsystem-inline#023ac9708ae125f0ab189303617e39070f5d97ff" dependencies = [ "pinocchio", "pinocchio-pubkey", @@ -1967,47 +1681,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - -[[package]] -name = "proc-macro-crate" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" -dependencies = [ - "toml_edit", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.94" @@ -2108,35 +1781,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_xoshiro" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" -dependencies = [ - "rand_core 0.6.4", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - [[package]] name = "redox_syscall" version = "0.5.4" @@ -2239,12 +1883,6 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc_version" version = "0.4.1" @@ -2443,16 +2081,6 @@ version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" -[[package]] -name = "sized-chunks" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" -dependencies = [ - "bitmaps", - "typenum", -] - [[package]] name = "slab" version = "0.4.9" @@ -2623,7 +2251,7 @@ dependencies = [ "serde", "serde_derive", "solana-sdk-ids", - "solana-sdk-macro 2.2.1", + "solana-sdk-macro", "solana-sysvar-id", ] @@ -2714,7 +2342,7 @@ dependencies = [ "serde_derive", "solana-hash", "solana-sdk-ids", - "solana-sdk-macro 2.2.1", + "solana-sdk-macro", "solana-sysvar-id", ] @@ -2727,7 +2355,7 @@ dependencies = [ "serde", "serde_derive", "solana-sdk-ids", - "solana-sdk-macro 2.2.1", + "solana-sdk-macro", "solana-sysvar-id", ] @@ -2737,7 +2365,7 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89e1d3b52b4a014efeaaab67f14e40af3972a4be61c523d612860db8e3145529" dependencies = [ - "ahash 0.8.11", + "ahash", "lazy_static", "solana-epoch-schedule", "solana-hash", @@ -2766,50 +2394,13 @@ dependencies = [ "solana-native-token", ] -[[package]] -name = "solana-frozen-abi" -version = "1.18.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bfcde2fc6946c99c7e3400fadd04d1628d675bfd66cb34d461c0f3224bd27d1" -dependencies = [ - "block-buffer 0.10.4", - "bs58 0.4.0", - "bv", - "either", - "generic-array", - "im", - "lazy_static", - "log", - "memmap2", - "rustc_version", - "serde", - "serde_bytes", - "serde_derive", - "sha2 0.10.8", - "solana-frozen-abi-macro", - "subtle", - "thiserror 1.0.69", -] - -[[package]] -name = "solana-frozen-abi-macro" -version = "1.18.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5024d241425f4e99f112ee03bfa89e526c86c7ca9bd7e13448a7f2dffb7e060" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn 2.0.87", -] - [[package]] name = "solana-hash" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf7bcb14392900fe02e4e34e90234fbf0c673d4e327888410ba99fa2ba0f4e99" dependencies = [ - "bs58 0.5.1", + "bs58", "bytemuck", "bytemuck_derive", "js-sys", @@ -2875,7 +2466,7 @@ dependencies = [ "serde", "serde_derive", "solana-sdk-ids", - "solana-sdk-macro 2.2.1", + "solana-sdk-macro", "solana-sysvar-id", ] @@ -3011,15 +2602,6 @@ dependencies = [ "solana-sdk-ids", ] -[[package]] -name = "solana-nostd-entrypoint" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76f4dd2903511a15f50af226b0bd55443ac72315e127d933227ec32bb31f381" -dependencies = [ - "solana-program", -] - [[package]] name = "solana-packet" version = "2.2.1" @@ -3068,61 +2650,6 @@ dependencies = [ "solana-secp256r1-program", ] -[[package]] -name = "solana-program" -version = "1.18.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76056fecde0fe0ece8b457b719729c17173333471c72ad41969982975a10d6e0" -dependencies = [ - "ark-bn254", - "ark-ec", - "ark-ff", - "ark-serialize", - "base64 0.21.7", - "bincode", - "bitflags 2.9.0", - "blake3", - "borsh 0.10.3", - "borsh 0.9.3", - "borsh 1.5.1", - "bs58 0.4.0", - "bv", - "bytemuck", - "cc", - "console_error_panic_hook", - "console_log", - "curve25519-dalek 3.2.1", - "getrandom 0.2.15", - "itertools 0.10.5", - "js-sys", - "lazy_static", - "libc", - "libsecp256k1", - "light-poseidon", - "log", - "memoffset", - "num-bigint 0.4.6", - "num-derive", - "num-traits", - "parking_lot", - "rand 0.8.5", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "serde_json", - "sha2 0.10.8", - "sha3", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-sdk-macro 1.18.23", - "thiserror 1.0.69", - "tiny-bip39", - "wasm-bindgen", - "zeroize", -] - [[package]] name = "solana-program-entrypoint" version = "2.2.1" @@ -3205,7 +2732,7 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40db1ff5a0f8aea2c158d78ab5f2cf897848964251d1df42fef78efd3c85b863" dependencies = [ - "bs58 0.5.1", + "bs58", "curve25519-dalek 4.1.3", "five8_const", "getrandom 0.2.15", @@ -3230,7 +2757,7 @@ dependencies = [ "serde", "serde_derive", "solana-sdk-ids", - "solana-sdk-macro 2.2.1", + "solana-sdk-macro", "solana-sysvar-id", ] @@ -3266,26 +2793,13 @@ dependencies = [ "solana-pubkey", ] -[[package]] -name = "solana-sdk-macro" -version = "1.18.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a8613ca80150f7e277e773620ba65d2c5fcc3a08eb8026627d601421ab43aef" -dependencies = [ - "bs58 0.4.0", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.87", -] - [[package]] name = "solana-sdk-macro" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86280da8b99d03560f6ab5aca9de2e38805681df34e0bb8f238e69b29433b9df" dependencies = [ - "bs58 0.5.1", + "bs58", "proc-macro2", "quote", "syn 2.0.87", @@ -3481,7 +2995,7 @@ dependencies = [ "solana-rent", "solana-sanitize", "solana-sdk-ids", - "solana-sdk-macro 2.2.1", + "solana-sdk-macro", "solana-slot-hashes", "solana-slot-history", "solana-stake-interface", @@ -3584,18 +3098,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "syn_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "sync_wrapper" version = "0.1.2" @@ -3672,25 +3174,6 @@ dependencies = [ "syn 2.0.87", ] -[[package]] -name = "tiny-bip39" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" -dependencies = [ - "anyhow", - "hmac", - "once_cell", - "pbkdf2", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror 1.0.69", - "unicode-normalization", - "wasm-bindgen", - "zeroize", -] - [[package]] name = "tinyvec" version = "1.8.0" @@ -3744,32 +3227,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" - -[[package]] -name = "toml_edit" -version = "0.22.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow", -] - [[package]] name = "tower-service" version = "0.3.3" @@ -4167,15 +3624,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" -dependencies = [ - "memchr", -] - [[package]] name = "winreg" version = "0.50.0" diff --git a/Cargo.toml b/Cargo.toml index 4150e86..699ca40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,12 +4,11 @@ members = [ "benchmark", "programs/jiminy", "programs/pinocchio", - "programs/solana-nostd-entrypoint", "programs/solana-program" ] [workspace.metadata.cli] -solana = "2.2.6" +solana = "2.2.15" [workspace.metadata.toolchains] format = "1.84.1" diff --git a/benchmark/Cargo.toml b/benchmark/Cargo.toml index 5966426..e79b99a 100644 --- a/benchmark/Cargo.toml +++ b/benchmark/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "eisodos" publish = false +edition = "2021" [[bin]] name = "coyote" @@ -9,7 +10,6 @@ path = "src/main.rs" [dev-dependencies] eisodos-jiminy = { path="../programs/jiminy" } eisodos-pinocchio = { path="../programs/pinocchio" } -eisodos-solana-nostd-entrypoint = { path="../programs/solana-nostd-entrypoint" } eisodos-solana-program = { path="../programs/solana-program" } mollusk-svm = "0.1.4" mollusk-svm-bencher = "0.1.4" diff --git a/benchmark/benches/solana_nostd_entrypoint.rs b/benchmark/benches/solana_nostd_entrypoint.rs deleted file mode 100644 index 3d87fe5..0000000 --- a/benchmark/benches/solana_nostd_entrypoint.rs +++ /dev/null @@ -1,28 +0,0 @@ -#![feature(test)] - -extern crate mollusk_svm; -extern crate mollusk_svm_bencher; -extern crate solana_account; -extern crate solana_instruction; -extern crate solana_pubkey; -extern crate test; - -mod setup; -use setup::*; - -#[cfg(test)] -mod solana_nostd_entrypoint { - - use super::*; - use solana_pubkey::Pubkey; - use test::Bencher; - - #[bench] - fn run(_bencher: &mut Bencher) { - let id = eisodos_solana_nostd_entrypoint::ID; - runner::run( - &Pubkey::new_from_array(id.to_bytes()), - "eisodos_solana_nostd_entrypoint", - ); - } -} diff --git a/programs/solana-nostd-entrypoint/Cargo.toml b/programs/solana-nostd-entrypoint/Cargo.toml deleted file mode 100644 index c06896f..0000000 --- a/programs/solana-nostd-entrypoint/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "eisodos-solana-nostd-entrypoint" -version = "0.0.0" -edition = "2021" -publish = false - -[package.metadata.solana] -program-id = "SoLanaNoStdEntrypoint1111111111111111111111" - -[lib] -crate-type = ["cdylib", "lib"] - -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] } - -[dependencies] -solana-nostd-entrypoint = "0.6" -solana-program = "1.18" diff --git a/programs/solana-nostd-entrypoint/src/cpi/create_account.rs b/programs/solana-nostd-entrypoint/src/cpi/create_account.rs deleted file mode 100644 index a5a9649..0000000 --- a/programs/solana-nostd-entrypoint/src/cpi/create_account.rs +++ /dev/null @@ -1,39 +0,0 @@ -use super::invoke; -use solana_nostd_entrypoint::{InstructionC, NoStdAccountInfo}; -use solana_program::{entrypoint::ProgramResult, pubkey::Pubkey, system_program}; - -/// Create a new account. -/// -/// This function is a wrapper around the system program's `create_account` -/// instruction. -pub fn create_account( - from: &NoStdAccountInfo, - to: &NoStdAccountInfo, - lamports: u64, - space: u64, - owner: &Pubkey, -) -> ProgramResult { - // instruction data - // - [0..4 ]: instruction discriminator - // - [4..12 ]: lamports - // - [12..20]: account space - // - [20..52]: owner pubkey - let mut instruction_data = [0; 52]; - // create account instruction has a '0' discriminator - instruction_data[4..12].copy_from_slice(&lamports.to_le_bytes()); - instruction_data[12..20].copy_from_slice(&space.to_le_bytes()); - instruction_data[20..52].copy_from_slice(owner.as_ref()); - - let instruction_accounts = [from.to_meta_c_signer(), to.to_meta_c_signer()]; - - invoke( - &InstructionC { - program_id: &system_program::ID, - accounts: instruction_accounts.as_ptr(), - accounts_len: instruction_accounts.len() as u64, - data: instruction_data.as_ptr(), - data_len: instruction_data.len() as u64, - }, - &[from, to], - ) -} diff --git a/programs/solana-nostd-entrypoint/src/cpi/mod.rs b/programs/solana-nostd-entrypoint/src/cpi/mod.rs deleted file mode 100644 index 4b30e15..0000000 --- a/programs/solana-nostd-entrypoint/src/cpi/mod.rs +++ /dev/null @@ -1,72 +0,0 @@ -use solana_nostd_entrypoint::{AccountInfoC, InstructionC, NoStdAccountInfo}; -use solana_program::{entrypoint::ProgramResult, program_error::ProgramError}; -use std::mem::MaybeUninit; - -pub mod create_account; -pub mod transfer; - -pub use create_account::*; -pub use transfer::*; - -/// Helper function to invoke a program. -/// -/// The helpers performs the following checks: -/// * The number of accounts passed to the instruction is equal to the number of -/// accounts expected by the instruction. -/// * The accounts passed to the instruction are the same as the accounts info -/// (`pubkey` comparison). -/// * The accounts are borrowed as mutable if the instruction is writable. -/// -/// These checks are similar to the checks performed by the default invoke in -/// `solana_program`. -fn invoke( - instruction: &InstructionC, - accounts: &[&NoStdAccountInfo; ACCOUNTS], -) -> ProgramResult { - if (instruction.accounts_len as usize) < ACCOUNTS { - return Err(ProgramError::NotEnoughAccountKeys); - } - - const UNINIT: MaybeUninit = MaybeUninit::::uninit(); - let mut infos = [UNINIT; ACCOUNTS]; - - let metas = unsafe { core::slice::from_raw_parts(instruction.accounts, ACCOUNTS) }; - - for index in 0..ACCOUNTS { - let info = &accounts[index]; - let meta = &metas[index]; - - if *info.key() != unsafe { *meta.pubkey } { - return Err(ProgramError::InvalidArgument); - } - - if meta.is_writable { - let _ = info.try_borrow_mut_data(); - let _ = info.try_borrow_mut_lamports(); - } else { - let _ = info.try_borrow_data(); - let _ = info.try_borrow_lamports(); - } - - infos[index].write(info.to_info_c()); - } - - let seeds: &[&[&[u8]]] = &[]; - - #[cfg(target_os = "solana")] - unsafe { - solana_program::syscalls::sol_invoke_signed_c( - instruction as *const InstructionC as *const u8, - infos.as_ptr() as *const u8, - infos.len() as u64, - seeds.as_ptr() as *const u8, - seeds.len() as u64, - ); - } - - // For clippy - #[cfg(not(target_os = "solana"))] - core::hint::black_box(&(&instruction, &accounts, &seeds)); - - Ok(()) -} diff --git a/programs/solana-nostd-entrypoint/src/cpi/transfer.rs b/programs/solana-nostd-entrypoint/src/cpi/transfer.rs deleted file mode 100644 index 06aa92c..0000000 --- a/programs/solana-nostd-entrypoint/src/cpi/transfer.rs +++ /dev/null @@ -1,29 +0,0 @@ -use super::invoke; -use solana_nostd_entrypoint::{InstructionC, NoStdAccountInfo}; -use solana_program::{entrypoint::ProgramResult, system_program}; - -/// Transfer lamports between accounts. -/// -/// This function is a wrapper around the system program's `transfer` -/// instruction. -pub fn transfer(from: &NoStdAccountInfo, to: &NoStdAccountInfo, lamports: u64) -> ProgramResult { - // instruction data - // - [0..4 ]: instruction discriminator - // - [4..12 ]: lamports - let mut instruction_data = [0; 12]; - instruction_data[0] = 2; - instruction_data[4..12].copy_from_slice(&lamports.to_le_bytes()); - - let instruction_accounts = [from.to_meta_c_signer(), to.to_meta_c_signer()]; - - invoke( - &InstructionC { - program_id: &system_program::ID, - accounts: instruction_accounts.as_ptr(), - accounts_len: instruction_accounts.len() as u64, - data: instruction_data.as_ptr(), - data_len: instruction_data.len() as u64, - }, - &[from, to], - ) -} diff --git a/programs/solana-nostd-entrypoint/src/entrypoint.rs b/programs/solana-nostd-entrypoint/src/entrypoint.rs deleted file mode 100644 index 0308983..0000000 --- a/programs/solana-nostd-entrypoint/src/entrypoint.rs +++ /dev/null @@ -1,33 +0,0 @@ -use crate::processor::{process_create_account, process_transfer}; -#[allow(unused_imports)] -use { - crate::{ - instruction::Instruction, - processor::{process_account, process_log, process_ping}, - }, - solana_nostd_entrypoint::{ - basic_panic_impl, entrypoint_nostd, noalloc_allocator, NoStdAccountInfo, - }, - solana_program::{entrypoint::ProgramResult, log, pubkey::Pubkey}, -}; - -entrypoint_nostd!(process_instruction, 64); -noalloc_allocator!(); -basic_panic_impl!(); - -#[inline(always)] -pub fn process_instruction( - _program_id: &Pubkey, - accounts: &[NoStdAccountInfo], - instruction_data: &[u8], -) -> ProgramResult { - let instruction = Instruction::unpack(instruction_data)?; - - match instruction { - Instruction::Ping => process_ping(), - Instruction::Log => process_log(), - Instruction::Account { expected } => process_account(accounts, expected), - Instruction::CreateAccount => process_create_account(accounts), - Instruction::Transfer => process_transfer(accounts), - } -} diff --git a/programs/solana-nostd-entrypoint/src/instruction.rs b/programs/solana-nostd-entrypoint/src/instruction.rs deleted file mode 100644 index ff83489..0000000 --- a/programs/solana-nostd-entrypoint/src/instruction.rs +++ /dev/null @@ -1,35 +0,0 @@ -use solana_program::program_error::ProgramError; - -#[derive(Clone, Debug)] -#[rustfmt::skip] -pub enum Instruction { - Ping, - Log, - Account { - expected: u64, - }, - CreateAccount, - Transfer, -} - -impl Instruction { - /// Unpacks a byte buffer into a [Instruction](enum.Instruction.html). - #[inline(always)] - pub fn unpack(input: &[u8]) -> Result { - match input.split_first() { - // 0 - Ping - Some((&0, [])) => Ok(Instruction::Ping), - // 1 - Log - Some((&1, [])) => Ok(Instruction::Log), - // 2 - Account - Some((&2, remaining)) if remaining.len() == 8 => Ok(Instruction::Account { - expected: u64::from_le_bytes(remaining[0..8].try_into().unwrap()), - }), - // 3 - CreateAccount - Some((&3, [])) => Ok(Instruction::CreateAccount), - // 4 - Transfer - Some((&4, [])) => Ok(Instruction::Transfer), - _ => Err(ProgramError::InvalidInstructionData), - } - } -} diff --git a/programs/solana-nostd-entrypoint/src/lib.rs b/programs/solana-nostd-entrypoint/src/lib.rs deleted file mode 100644 index 6fc4bf6..0000000 --- a/programs/solana-nostd-entrypoint/src/lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod cpi; -pub mod entrypoint; -pub mod instruction; -pub mod processor; - -solana_program::declare_id!("SoLanaNoStdEntrypoint1111111111111111111111"); diff --git a/programs/solana-nostd-entrypoint/src/processor.rs b/programs/solana-nostd-entrypoint/src/processor.rs deleted file mode 100644 index da10b96..0000000 --- a/programs/solana-nostd-entrypoint/src/processor.rs +++ /dev/null @@ -1,35 +0,0 @@ -use { - crate::cpi::{create_account, transfer}, - solana_nostd_entrypoint::NoStdAccountInfo, - solana_program::{entrypoint::ProgramResult, msg, program_error::ProgramError}, -}; - -#[inline(always)] -pub fn process_ping() -> ProgramResult { - Ok(()) -} - -#[inline(always)] -pub fn process_log() -> ProgramResult { - msg!("Instruction: Log"); - Ok(()) -} - -#[inline(always)] -pub fn process_account(accounts: &[NoStdAccountInfo], expected: u64) -> ProgramResult { - if accounts.len() == expected as usize { - Ok(()) - } else { - Err(ProgramError::InvalidArgument) - } -} - -#[inline(always)] -pub fn process_create_account(accounts: &[NoStdAccountInfo]) -> ProgramResult { - create_account(&accounts[0], &accounts[1], 500_000_000, 10, &crate::ID) -} - -#[inline(always)] -pub fn process_transfer(accounts: &[NoStdAccountInfo]) -> ProgramResult { - transfer(&accounts[0], &accounts[1], 1_000_000_000) -} From 4014562dedf52360c5b0b978477d5936d16750c9 Mon Sep 17 00:00:00 2001 From: febo Date: Sat, 31 May 2025 03:23:00 +0100 Subject: [PATCH 3/8] Update README --- README.md | 64 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 24e463f..9045874 100644 --- a/README.md +++ b/README.md @@ -12,48 +12,62 @@ The purpose of `eisodos` is to offer a simple benchmark of different program entrypoint implementations. An entrypoint is used to parse the [SBF input](https://solana.com/docs/programs/faq#input-parameter-serialization) for a program, providing the information of an instruction input in a "friendly" way. The SBF loader passes the input parameters as a byte array and the entrypoint then transforms the input into separate typed entities — `program id`, `accounts` array and `instruction data`. -## Entrypoints +## Entrypoint Entrypoint implementation currently included in the benchmark: - [`pinocchio`](https://github.com/anza-xyz/pinocchio) -- [`solana-nostd-entrypoint`](https://github.com/cavemanloverboy/solana-nostd-entrypoint) - [`solana-program`](https://github.com/anza-xyz/agave/tree/master/sdk/program) - [`jiminy`](https://github.com/igneous-labs/jiminy) -| Benchmark | `pinocchio` | `solana-nostd-entrypoint` | `solana-program` | `jiminy` | -| ------------- | --------------- | ------------------------- | ----------------- | ------------ | -| _Entrypoint_ | -| Ping | 🟩 **14** | 🟩 **14** | 🟧 41 (+27) | 🟩 **14** | -| Log | 🟩 **119** | 🟩 **119** | 🟧 146 (+27) | 🟩 **119** | -| Account (1) | 🟩 38 (+2) | 🟩 39 (+3) | 🟥 235 (+199) | 🟩 **36** | -| Account (3) | 🟩 **66** | 🟩 69 (+3) | 🟥 541 (+475) | 🟩 **66** | -| Account (5) | 🟩 **94** | 🟩 99 (+5) | 🟥 847 (+751) | 🟩 96 (+2) | -| Account (10) | 🟩 **164** | 🟩 174 (+10) | 🟥 1,612 (+1,441) | 🟩 171 (+7) | -| Account (20) | 🟩 **304** | 🟨 324 (+20) | 🟥 3,142 (+2,821) | 🟨 321 (+17) | -| Account (32) | 🟩 **472** | 🟨 504 (+32) | 🟥 4,978 (+4,477) | 🟨 501 (+29) | -| Account (64) | 🟩 **920** | 🟨 985 (+65) | 🟥 9,874 (+8,893) | 🟨 981 (+61) | -| _CPI_ | -| CreateAccount | 🟨 1,449 (+142) | 🟨 1,494 (+187) | 🟥 2,786 (+1,479) | 🟩 **1,307** | -| Transfer | 🟨 1,439 (+140) | 🟨 1,487 (+180) | 🟥 2,379 (+1,080) | 🟩 **1,299** | +> [!NOTE] +> Previous benchmark included the [`solana-nostd-entrypoint`](https://github.com/cavemanloverboy/solana-nostd-entrypoint) – the project has not been archieved and therefore ommitted. + +| Benchmark | `pinocchio` | `solana-program` | `jiminy` | +| ------------- | --------------- | ----------------- | ------------ | +| Ping | 🟩 **13** | 🟥 117 (+104) | 🟩 15 (+2) | +| Log | 🟩 **118** | 🟥 222 (+104) | 🟩 120 (+2) | +| Account (1) | 🟩 **37** | 🟥 317 (+280) | 🟩 38 (+1) | +| Account (3) | 🟩 **65** | 🟥 641 (+576) | 🟩 68 (+3) | +| Account (5) | 🟩 **93** | 🟥 965 (+872) | 🟩 98 (+5) | +| Account (10) | 🟩 **163** | 🟥 1,775 (+1,612) | 🟩 173 (+10) | +| Account (20) | 🟩 **303** | 🟥 3,395 (+3,092) | 🟨 323 (+20) | +| Account (32) | 🟩 **471** | 🟥 5,339 (+4,868) | 🟨 503 (+32) | +| Account (64) | 🟩 **919** | 🟥 10,523 (+9,604) | 🟨 983 (+64) | > [!IMPORTANT] > Values correspond to compute units (CUs) consumed by the entrypoint. The delta in relation to the lowest consumption is shown in brackets. > -> Solana CLI `v2.2.6` was used in the bench tests. +> Solana CLI `v2.2.15` was used in the bench tests. -## Binary Sizes +## CPI and Binary Size -The size of the compiled benchmark program for each entrypoint is shown below. The delta in relation to the smallest binary size is shown in brackets. +There are also benchmarks for CPI and binary size produced by the different entrypoints libraries. Note that these actually measure how efficient the helpers of the library are +instead of the entrypoint efficiency, since it is generally possible to improve/re-write +the helpers. -| Binary size (bytes) | `pinocchio` | `solana-nostd-entrypoint` | `solana-program` | `jiminy` | -| ------------------- | ------------------ | ------------------------- | ------------------- | -------- | -| | 🟥 10,736 (+7,240) | 🟥 17,720 (+14,224) | 🟥 64,688 (+61,192) | 🟩 3,496 | + +### CPI + +| Benchmark (CPI) | `pinocchio` | `solana-program` | `jiminy` | +| ---------------------- | --------------- | ----------------- | ------------ | +| system::create_account | 🟩 1,314 (+5) | 🟥 2,866 (+1,557) | 🟩 **1,309** | +| system::transfer | 🟩 1,310 (+9) | 🟥 2,459 (+1,158) | 🟩 **1,301** | + + +### Binary Size + +| | `pinocchio` | `solana-program` | `jiminy` | +| ------------------- | --------------- | ------------------- | -------- | +| Binary size (bytes) | 🟨 4,216 (+696) | 🟥 68,832 (+65,312) | 🟩 3,520 | ## Benchmark The benchmark uses a simple program with multiple instructions to measure the compute units (CUs) consumed by the entrypoint. Note that the intention is not to write the most efficient program, instead to reflect an "average" program implementation. The aim is to use the exactly same program implementation, replacing the entrypoint to determine the impact on the CUs consumed. +> [!NOTE] +> Note that this not apply to the instructions that use the CPI since these involve using library specific helpers. + The program used has the following instructions: ```rust @@ -62,7 +76,9 @@ pub enum Instruction { Log, Account { expected: u64, - } + }, + CreateAccount, + Transfer } ``` From 4a0a87e5feb4492af1bdc02250f05a686d5a4e57 Mon Sep 17 00:00:00 2001 From: febo Date: Sat, 31 May 2025 03:37:14 +0100 Subject: [PATCH 4/8] Tweaks --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9045874..c2f5e37 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Entrypoint implementation currently included in the benchmark: - [`jiminy`](https://github.com/igneous-labs/jiminy) > [!NOTE] -> Previous benchmark included the [`solana-nostd-entrypoint`](https://github.com/cavemanloverboy/solana-nostd-entrypoint) – the project has not been archieved and therefore ommitted. +> Previous benchmark included the [`solana-nostd-entrypoint`](https://github.com/cavemanloverboy/solana-nostd-entrypoint) – the project has not been archived and therefore ommitted. | Benchmark | `pinocchio` | `solana-program` | `jiminy` | | ------------- | --------------- | ----------------- | ------------ | @@ -65,8 +65,8 @@ the helpers. The benchmark uses a simple program with multiple instructions to measure the compute units (CUs) consumed by the entrypoint. Note that the intention is not to write the most efficient program, instead to reflect an "average" program implementation. The aim is to use the exactly same program implementation, replacing the entrypoint to determine the impact on the CUs consumed. -> [!NOTE] -> Note that this not apply to the instructions that use the CPI since these involve using library specific helpers. +> [!WARNING] +> This not apply to instructions that use CPIs since these involve using library specific helpers. The program used has the following instructions: From b575da0bec56406f0d068726f35097648cd5da0f Mon Sep 17 00:00:00 2001 From: febo Date: Mon, 2 Jun 2025 12:12:45 +0100 Subject: [PATCH 5/8] Update branch reference --- Cargo.lock | 6 +++--- README.md | 24 ++++++++++++------------ programs/pinocchio/Cargo.toml | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2c21a28..ce1c268 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1646,12 +1646,12 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pinocchio" version = "0.8.4" -source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fsystem-inline#023ac9708ae125f0ab189303617e39070f5d97ff" +source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fentrypoint-cleanup#936160198fe05e95920db5a8bb0576cbd7fda8f1" [[package]] name = "pinocchio-pubkey" version = "0.2.4" -source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fsystem-inline#023ac9708ae125f0ab189303617e39070f5d97ff" +source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fentrypoint-cleanup#936160198fe05e95920db5a8bb0576cbd7fda8f1" dependencies = [ "five8_const", "pinocchio", @@ -1660,7 +1660,7 @@ dependencies = [ [[package]] name = "pinocchio-system" version = "0.2.3" -source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fsystem-inline#023ac9708ae125f0ab189303617e39070f5d97ff" +source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fentrypoint-cleanup#936160198fe05e95920db5a8bb0576cbd7fda8f1" dependencies = [ "pinocchio", "pinocchio-pubkey", diff --git a/README.md b/README.md index c2f5e37..6b64939 100644 --- a/README.md +++ b/README.md @@ -25,15 +25,15 @@ Entrypoint implementation currently included in the benchmark: | Benchmark | `pinocchio` | `solana-program` | `jiminy` | | ------------- | --------------- | ----------------- | ------------ | -| Ping | 🟩 **13** | 🟥 117 (+104) | 🟩 15 (+2) | -| Log | 🟩 **118** | 🟥 222 (+104) | 🟩 120 (+2) | -| Account (1) | 🟩 **37** | 🟥 317 (+280) | 🟩 38 (+1) | -| Account (3) | 🟩 **65** | 🟥 641 (+576) | 🟩 68 (+3) | -| Account (5) | 🟩 **93** | 🟥 965 (+872) | 🟩 98 (+5) | -| Account (10) | 🟩 **163** | 🟥 1,775 (+1,612) | 🟩 173 (+10) | -| Account (20) | 🟩 **303** | 🟥 3,395 (+3,092) | 🟨 323 (+20) | -| Account (32) | 🟩 **471** | 🟥 5,339 (+4,868) | 🟨 503 (+32) | -| Account (64) | 🟩 **919** | 🟥 10,523 (+9,604) | 🟨 983 (+64) | +| Ping | 🟩 **12** | 🟥 117 (+105) | 🟩 15 (+3) | +| Log | 🟩 **117** | 🟥 222 (+105) | 🟩 120 (+3) | +| Account (1) | 🟩 **32** | 🟥 317 (+285) | 🟩 38 (+6) | +| Account (3) | 🟩 **60** | 🟥 641 (+581) | 🟩 68 (+8) | +| Account (5) | 🟩 **88** | 🟥 965 (+877) | 🟩 98 (+10) | +| Account (10) | 🟩 **158** | 🟥 1,775 (+1,617) | 🟨 173 (+15) | +| Account (20) | 🟩 **298** | 🟥 3,395 (+3,097) | 🟨 323 (+25) | +| Account (32) | 🟩 **466** | 🟥 5,339 (+4,873) | 🟨 503 (+37) | +| Account (64) | 🟩 **914** | 🟥 10,523 (+9,609) | 🟨 983 (+69) | > [!IMPORTANT] > Values correspond to compute units (CUs) consumed by the entrypoint. The delta in relation to the lowest consumption is shown in brackets. @@ -51,15 +51,15 @@ the helpers. | Benchmark (CPI) | `pinocchio` | `solana-program` | `jiminy` | | ---------------------- | --------------- | ----------------- | ------------ | -| system::create_account | 🟩 1,314 (+5) | 🟥 2,866 (+1,557) | 🟩 **1,309** | -| system::transfer | 🟩 1,310 (+9) | 🟥 2,459 (+1,158) | 🟩 **1,301** | +| system::create_account | 🟩 **1,309** | 🟥 2,866 (+1,557) | 🟩 **1,309** | +| system::transfer | 🟩 1,305 (+4) | 🟥 2,459 (+1,158) | 🟩 **1,301** | ### Binary Size | | `pinocchio` | `solana-program` | `jiminy` | | ------------------- | --------------- | ------------------- | -------- | -| Binary size (bytes) | 🟨 4,216 (+696) | 🟥 68,832 (+65,312) | 🟩 3,520 | +| Binary size (bytes) | 🟨 4,040 (+520) | 🟥 68,832 (+65,312) | 🟩 3,520 | ## Benchmark diff --git a/programs/pinocchio/Cargo.toml b/programs/pinocchio/Cargo.toml index c9a01c8..1c6f425 100644 --- a/programs/pinocchio/Cargo.toml +++ b/programs/pinocchio/Cargo.toml @@ -17,6 +17,6 @@ check-cfg = [ crate-type = ["cdylib"] [dependencies] -pinocchio = { version = "0.8", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/system-inline" } -pinocchio-pubkey = { version = "0.2", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/system-inline" } -pinocchio-system = { version = "0.2", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/system-inline" } +pinocchio = { version = "0.8", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/entrypoint-cleanup" } +pinocchio-pubkey = { version = "0.2", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/entrypoint-cleanup" } +pinocchio-system = { version = "0.2", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/entrypoint-cleanup" } From aa0745417865093a656dfa39a5c4789768a296af Mon Sep 17 00:00:00 2001 From: febo Date: Sat, 9 Aug 2025 08:25:36 +0300 Subject: [PATCH 6/8] Use published crates --- Cargo.lock | 16 +++++++---- README.md | 43 +++++++++++++++-------------- benchmark/benches/solana_program.rs | 5 +++- programs/jiminy/Cargo.toml | 2 +- programs/pinocchio/Cargo.toml | 6 ++-- programs/solana-program/Cargo.toml | 2 +- 6 files changed, 41 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ce1c268..1ea5c23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1645,22 +1645,26 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pinocchio" -version = "0.8.4" -source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fentrypoint-cleanup#936160198fe05e95920db5a8bb0576cbd7fda8f1" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5123fe61ac87a327d434d530eaddaaf65069a37e33e5c9f798feaed29e4974c8" [[package]] name = "pinocchio-pubkey" -version = "0.2.4" -source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fentrypoint-cleanup#936160198fe05e95920db5a8bb0576cbd7fda8f1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0225638cadcbebae8932cb7f49cb5da7c15c21beb19f048f05a5ca7d93f065" dependencies = [ "five8_const", "pinocchio", + "sha2-const-stable", ] [[package]] name = "pinocchio-system" -version = "0.2.3" -source = "git+https://github.com/anza-xyz/pinocchio.git?branch=febo%2Fentrypoint-cleanup#936160198fe05e95920db5a8bb0576cbd7fda8f1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "141ed5eafb4ab04568bb0e224e3dc9a9de13c933de4c004e0d1a553498be3a7c" dependencies = [ "pinocchio", "pinocchio-pubkey", diff --git a/README.md b/README.md index 6b64939..0c23e80 100644 --- a/README.md +++ b/README.md @@ -23,43 +23,44 @@ Entrypoint implementation currently included in the benchmark: > [!NOTE] > Previous benchmark included the [`solana-nostd-entrypoint`](https://github.com/cavemanloverboy/solana-nostd-entrypoint) – the project has not been archived and therefore ommitted. -| Benchmark | `pinocchio` | `solana-program` | `jiminy` | -| ------------- | --------------- | ----------------- | ------------ | -| Ping | 🟩 **12** | 🟥 117 (+105) | 🟩 15 (+3) | -| Log | 🟩 **117** | 🟥 222 (+105) | 🟩 120 (+3) | -| Account (1) | 🟩 **32** | 🟥 317 (+285) | 🟩 38 (+6) | -| Account (3) | 🟩 **60** | 🟥 641 (+581) | 🟩 68 (+8) | -| Account (5) | 🟩 **88** | 🟥 965 (+877) | 🟩 98 (+10) | -| Account (10) | 🟩 **158** | 🟥 1,775 (+1,617) | 🟨 173 (+15) | -| Account (20) | 🟩 **298** | 🟥 3,395 (+3,097) | 🟨 323 (+25) | -| Account (32) | 🟩 **466** | 🟥 5,339 (+4,873) | 🟨 503 (+37) | -| Account (64) | 🟩 **914** | 🟥 10,523 (+9,609) | 🟨 983 (+69) | +| Benchmark | `pinocchio` | `solana-program` | `jiminy` | +| ------------- | --------------- | ---------------- | ------------- | +| Ping | 🟩 **14** | 🟨 98 (+84) | 🟩 16 (+2) | +| Log | 🟩 **118** | 🟨 202 (+84) | 🟩 120 (+3) | +| Account (1) | 🟩 **22** | 🟥 268 (+246) | 🟨 37 (+15) | +| Account (3) | 🟩 **44** | 🟥 546 (+502) | 🟨 67 (+23) | +| Account (5) | 🟩 **59** | 🟥 824 (+765) | 🟨 97 (+38) | +| Account (10) | 🟩 **101** | 🟥 1,519 (+1,418) | 🟨 172 (+71) | +| Account (20) | 🟩 **177** | 🟥 2,909 (+2,732) | 🟥 322 (+145) | +| Account (32) | 🟩 **269** | 🟥 4,577 (+4,308) | 🟥 502 (+233) | +| Account (64) | 🟩 **512** | 🟥 9,025 (+8,513) | 🟥 982 (+470) | > [!IMPORTANT] > Values correspond to compute units (CUs) consumed by the entrypoint. The delta in relation to the lowest consumption is shown in brackets. +> - 🟩 (green): value within 10 CUs of the best value (`value < (best value + 10)`) +> - 🟨 (yellow): value within 100 CUs of the best value (`value < (best value + 100)`) +> - 🟥 (red): value over 100 CUs of the best value (`value > (best value + 100)`) > -> Solana CLI `v2.2.15` was used in the bench tests. +> Solana platform tools `v1.51` with `LTO` enabled was used in the bench tests. ## CPI and Binary Size -There are also benchmarks for CPI and binary size produced by the different entrypoints libraries. Note that these actually measure how efficient the helpers of the library are -instead of the entrypoint efficiency, since it is generally possible to improve/re-write -the helpers. +There are also benchmarks for CPI and binary size produced by the different entrypoints libraries. Note that these actually measure how efficient the helpers of the library are instead of the entrypoint efficiency, since it is generally possible to improve/re-write the helpers. ### CPI | Benchmark (CPI) | `pinocchio` | `solana-program` | `jiminy` | | ---------------------- | --------------- | ----------------- | ------------ | -| system::create_account | 🟩 **1,309** | 🟥 2,866 (+1,557) | 🟩 **1,309** | -| system::transfer | 🟩 1,305 (+4) | 🟥 2,459 (+1,158) | 🟩 **1,301** | +| system::create_account | 🟩 **1,291** | 🟥 2,592 (+1,301) | 🟨 1,307 (+13) | +| system::transfer | 🟩 **1,287** | 🟥 2,189 (+902) | 🟨 1,301 (+14) | ### Binary Size -| | `pinocchio` | `solana-program` | `jiminy` | -| ------------------- | --------------- | ------------------- | -------- | -| Binary size (bytes) | 🟨 4,040 (+520) | 🟥 68,832 (+65,312) | 🟩 3,520 | +| | `pinocchio` | `solana-program` | `jiminy` | +| ------------------- | --------------- | -----------------| --------- | +| Binary size (bytes) | 5,824 (+2,144) | 64,784 (+61,104) | **3,680** | ## Benchmark @@ -131,7 +132,7 @@ pnpm install This will install the required packages. Then all programs can be buiit using: ```bash -pnpm programs:build +RUSTFLAGS="-C embed-bitcode=yes -C lto=fat" pnpm programs:build --tools-version v1.51 ``` After this, you are ready to run individual benchmarks by using: diff --git a/benchmark/benches/solana_program.rs b/benchmark/benches/solana_program.rs index 6e977e8..ab1f215 100644 --- a/benchmark/benches/solana_program.rs +++ b/benchmark/benches/solana_program.rs @@ -14,10 +14,13 @@ use setup::*; mod solana_program { use super::*; + use solana_pubkey::Pubkey; use test::Bencher; + pub const ID: Pubkey = Pubkey::from_str_const("SoLanaProgram111111111111111111111111111111"); + #[bench] fn run(_bencher: &mut Bencher) { - runner::run(&eisodos_solana_program::ID, "eisodos_solana_program"); + runner::run(&ID, "eisodos_solana_program"); } } diff --git a/programs/jiminy/Cargo.toml b/programs/jiminy/Cargo.toml index 6dff70c..4f09e72 100644 --- a/programs/jiminy/Cargo.toml +++ b/programs/jiminy/Cargo.toml @@ -14,7 +14,7 @@ check-cfg = [ ] [lib] -crate-type = ["cdylib", "lib"] +crate-type = ["cdylib"] [dependencies] const-crypto = { version = "^0.3", default-features = false } diff --git a/programs/pinocchio/Cargo.toml b/programs/pinocchio/Cargo.toml index 1c6f425..42ca6f2 100644 --- a/programs/pinocchio/Cargo.toml +++ b/programs/pinocchio/Cargo.toml @@ -17,6 +17,6 @@ check-cfg = [ crate-type = ["cdylib"] [dependencies] -pinocchio = { version = "0.8", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/entrypoint-cleanup" } -pinocchio-pubkey = { version = "0.2", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/entrypoint-cleanup" } -pinocchio-system = { version = "0.2", git = "https://github.com/anza-xyz/pinocchio.git", branch = "febo/entrypoint-cleanup" } +pinocchio = "0.9" +pinocchio-pubkey = "0.3" +pinocchio-system = "0.3" diff --git a/programs/solana-program/Cargo.toml b/programs/solana-program/Cargo.toml index 2c35ba6..0d858ed 100644 --- a/programs/solana-program/Cargo.toml +++ b/programs/solana-program/Cargo.toml @@ -15,7 +15,7 @@ check-cfg = [ ] [lib] -crate-type = ["cdylib", "lib"] +crate-type = ["cdylib"] [dependencies] solana-account-info = "2.2" From 847c444b55a5791fb79d601f6db69eba16790e00 Mon Sep 17 00:00:00 2001 From: febo Date: Sat, 9 Aug 2025 08:29:53 +0300 Subject: [PATCH 7/8] Tweaks --- README.md | 8 ++++---- benchmark/benches/jiminy.rs | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0c23e80..3e5ba09 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,9 @@ Entrypoint implementation currently included in the benchmark: > [!IMPORTANT] > Values correspond to compute units (CUs) consumed by the entrypoint. The delta in relation to the lowest consumption is shown in brackets. -> - 🟩 (green): value within 10 CUs of the best value (`value < (best value + 10)`) -> - 🟨 (yellow): value within 100 CUs of the best value (`value < (best value + 100)`) -> - 🟥 (red): value over 100 CUs of the best value (`value > (best value + 100)`) +> - 🟩 (green): value within 10 CUs of the best value (`value < best value + 10`) +> - 🟨 (yellow): value within 100 CUs of the best value (`value < best value + 100`) +> - 🟥 (red): value over 100 CUs of the best value (`value >= best value + 100`) > > Solana platform tools `v1.51` with `LTO` enabled was used in the bench tests. @@ -67,7 +67,7 @@ There are also benchmarks for CPI and binary size produced by the different entr The benchmark uses a simple program with multiple instructions to measure the compute units (CUs) consumed by the entrypoint. Note that the intention is not to write the most efficient program, instead to reflect an "average" program implementation. The aim is to use the exactly same program implementation, replacing the entrypoint to determine the impact on the CUs consumed. > [!WARNING] -> This not apply to instructions that use CPIs since these involve using library specific helpers. +> This does not apply to instructions that use CPIs since these involve using library specific helpers. The program used has the following instructions: diff --git a/benchmark/benches/jiminy.rs b/benchmark/benches/jiminy.rs index b93eb0e..96e09b7 100644 --- a/benchmark/benches/jiminy.rs +++ b/benchmark/benches/jiminy.rs @@ -14,10 +14,13 @@ use setup::*; mod jiminy { use super::*; + use solana_pubkey::Pubkey; use test::Bencher; + pub const ID: Pubkey = Pubkey::from_str_const("Jim1ny1111111111111111111111111111111111111"); + #[bench] fn run(_bencher: &mut Bencher) { - runner::run(&eisodos_jiminy::ID.into(), "eisodos_jiminy"); + runner::run(&ID, "eisodos_jiminy"); } } From fb0108dbf6b60c70e95ab53f1f8618929a904984 Mon Sep 17 00:00:00 2001 From: febo Date: Sat, 9 Aug 2025 08:33:03 +0300 Subject: [PATCH 8/8] Fix heading --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e5ba09..12f5aa5 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Entrypoint implementation currently included in the benchmark: > > Solana platform tools `v1.51` with `LTO` enabled was used in the bench tests. -## CPI and Binary Size +## CPI and Binary Size There are also benchmarks for CPI and binary size produced by the different entrypoints libraries. Note that these actually measure how efficient the helpers of the library are instead of the entrypoint efficiency, since it is generally possible to improve/re-write the helpers.