diff --git a/Cargo.lock b/Cargo.lock index 91b27ed..3aaf388 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,23 +4,13 @@ version = 3 [[package]] name = "ahash" -version = "0.8.11" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "cfg-if", + "getrandom 0.2.15", "once_cell", "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", ] [[package]] @@ -56,17 +46,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.4.0" @@ -148,7 +127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115e54d64eb62cdebad391c19efc9dce4981c690c85a33a12199d99bb9546fee" dependencies = [ "borsh-derive 0.10.4", - "hashbrown 0.13.2", + "hashbrown 0.12.3", ] [[package]] @@ -184,7 +163,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", "syn_derive", ] @@ -249,7 +228,7 @@ checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -289,7 +268,7 @@ dependencies = [ "iana-time-zone", "num-traits", "serde", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -399,7 +378,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -423,7 +402,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -434,7 +413,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -473,19 +452,6 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" -[[package]] -name = "env_logger" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -565,12 +531,6 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ "ahash", ] @@ -587,27 +547,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "iana-time-zone" version = "0.1.61" @@ -842,7 +787,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -895,7 +840,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -956,9 +901,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -1081,35 +1026,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "regex" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - [[package]] name = "rustc_version" version = "0.4.1" @@ -1145,9 +1061,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] @@ -1163,13 +1079,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1211,7 +1127,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1272,8 +1188,8 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "solana-account-info" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "bincode", "serde", @@ -1284,59 +1200,105 @@ dependencies = [ [[package]] name = "solana-atomic-u64" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "parking_lot", ] [[package]] name = "solana-bincode" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "bincode", "serde", "solana-instruction", ] +[[package]] +name = "solana-borsh" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" +dependencies = [ + "borsh 0.10.4", + "borsh 1.5.1", +] + [[package]] name = "solana-clock" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "serde", "serde_derive", "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-cpi" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" +dependencies = [ + "solana-account-info", + "solana-define-syscall", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-stable-layout", ] [[package]] name = "solana-decode-error" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "num-traits", ] [[package]] name = "solana-define-syscall" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" + +[[package]] +name = "solana-epoch-rewards" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" +dependencies = [ + "serde", + "serde_derive", + "solana-hash", + "solana-sdk-macro", + "solana-sysvar-id", +] [[package]] name = "solana-epoch-schedule" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "serde", "serde_derive", "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-fee-calculator" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" +dependencies = [ + "log", + "serde", + "serde_derive", ] [[package]] name = "solana-frozen-abi" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "bs58", "bv", @@ -1354,18 +1316,18 @@ dependencies = [ [[package]] name = "solana-frozen-abi-macro" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] name = "solana-hash" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "borsh 1.5.1", "bs58", @@ -1381,8 +1343,8 @@ dependencies = [ [[package]] name = "solana-instruction" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "bincode", "borsh 1.5.1", @@ -1397,32 +1359,46 @@ dependencies = [ ] [[package]] -name = "solana-logger" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +name = "solana-last-restart-slot" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ - "env_logger", - "lazy_static", - "log", + "serde", + "serde_derive", + "solana-sdk-macro", + "solana-sysvar-id", ] [[package]] name = "solana-msg" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "solana-define-syscall", ] [[package]] name = "solana-native-token" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" + +[[package]] +name = "solana-nonce" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" +dependencies = [ + "serde", + "serde_derive", + "solana-fee-calculator", + "solana-hash", + "solana-pubkey", + "solana-sha256-hasher", +] [[package]] name = "solana-program" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "base64 0.22.1", "bincode", @@ -1456,14 +1432,20 @@ dependencies = [ "solana-account-info", "solana-atomic-u64", "solana-bincode", + "solana-borsh", "solana-clock", + "solana-cpi", "solana-decode-error", "solana-define-syscall", + "solana-epoch-rewards", "solana-epoch-schedule", + "solana-fee-calculator", "solana-hash", "solana-instruction", + "solana-last-restart-slot", "solana-msg", "solana-native-token", + "solana-nonce", "solana-program-entrypoint", "solana-program-error", "solana-program-memory", @@ -1479,14 +1461,18 @@ dependencies = [ "solana-sha256-hasher", "solana-short-vec", "solana-slot-hashes", + "solana-slot-history", + "solana-stable-layout", + "solana-sysvar-id", + "solana-transaction-error", "thiserror", "wasm-bindgen", ] [[package]] name = "solana-program-entrypoint" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "solana-account-info", "solana-msg", @@ -1496,8 +1482,8 @@ dependencies = [ [[package]] name = "solana-program-error" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "borsh 1.5.1", "num-traits", @@ -1511,8 +1497,8 @@ dependencies = [ [[package]] name = "solana-program-memory" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "num-traits", "solana-define-syscall", @@ -1520,21 +1506,21 @@ dependencies = [ [[package]] name = "solana-program-option" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" [[package]] name = "solana-program-pack" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "solana-program-error", ] [[package]] name = "solana-pubkey" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "borsh 0.10.4", "borsh 1.5.1", @@ -1558,34 +1544,35 @@ dependencies = [ [[package]] name = "solana-rent" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "serde", "serde_derive", "solana-sdk-macro", + "solana-sysvar-id", ] [[package]] name = "solana-sanitize" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" [[package]] name = "solana-sdk-macro" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "bs58", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] name = "solana-secp256k1-recover" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "libsecp256k1", "solana-define-syscall", @@ -1594,16 +1581,16 @@ dependencies = [ [[package]] name = "solana-serde-varint" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "serde", ] [[package]] name = "solana-serialize-utils" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "solana-instruction", "solana-pubkey", @@ -1612,8 +1599,8 @@ dependencies = [ [[package]] name = "solana-sha256-hasher" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "sha2 0.10.8", "solana-define-syscall", @@ -1622,20 +1609,41 @@ dependencies = [ [[package]] name = "solana-short-vec" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "serde", ] [[package]] name = "solana-slot-hashes" -version = "2.1.0" -source = "git+https://github.com/anza-xyz/agave.git#7b05e29f4eb275bf884b18351b2d5ad13dc48bf0" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" dependencies = [ "serde", "serde_derive", "solana-hash", + "solana-sysvar-id", +] + +[[package]] +name = "solana-slot-history" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" +dependencies = [ + "bv", + "serde", + "serde_derive", + "solana-sysvar-id", +] + +[[package]] +name = "solana-stable-layout" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" +dependencies = [ + "solana-instruction", + "solana-pubkey", ] [[package]] @@ -1659,7 +1667,6 @@ dependencies = [ "anyhow", "borsh 1.5.1", "js-sys", - "num-derive 0.4.2", "num-traits", "serde", "serde_derive", @@ -1667,16 +1674,33 @@ dependencies = [ "solana-frozen-abi", "solana-frozen-abi-macro", "solana-instruction", - "solana-logger", + "solana-nonce", "solana-program", - "solana-program-error", "solana-pubkey", + "solana-rent", "static_assertions", "strum", "strum_macros", "wasm-bindgen", ] +[[package]] +name = "solana-sysvar-id" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" +dependencies = [ + "solana-pubkey", +] + +[[package]] +name = "solana-transaction-error" +version = "2.2.0" +source = "git+https://github.com/anza-xyz/agave.git#15b56c2af5c8cac992ce2d6d4c950eebb8ac99ed" +dependencies = [ + "solana-instruction", + "solana-sanitize", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -1727,9 +1751,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -1745,36 +1769,27 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.79", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", + "syn 2.0.87", ] [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] @@ -1901,7 +1916,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", "wasm-bindgen-shared", ] @@ -1923,7 +1938,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1944,68 +1959,13 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-core" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-targets", ] [[package]] @@ -2014,46 +1974,28 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2066,48 +2008,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2141,7 +2059,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.87", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 73bea80..63922d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,6 @@ members = ["clients/rust", "interface"] [workspace.metadata.cli] solana = "edge" -# Specify Rust toolchains for rustfmt, clippy, and build. -# Any unprovided toolchains default to stable. [workspace.metadata.toolchains] -format = "1.79.0" -lint = "1.79.0" +format = "nightly-2024-08-08-aarch64-apple-darwin" +lint = "nightly-2024-08-08-aarch64-apple-darwin" diff --git a/interface/Cargo.toml b/interface/Cargo.toml index 9fdab5c..91a7578 100644 --- a/interface/Cargo.toml +++ b/interface/Cargo.toml @@ -13,16 +13,14 @@ all-features = true rustdoc-args = ["--cfg=docsrs"] [dependencies] -num-derive = "0.4" num-traits = "0.2" -serde = { version = "1.0.210" } -serde_derive = { version = "1.0.210" } -solana-decode-error = { version = "2.1.0", git = "https://github.com/anza-xyz/agave.git" } -solana-frozen-abi = { version = "2.1.0", optional = true, git = "https://github.com/anza-xyz/agave.git" } -solana-frozen-abi-macro = { version = "2.1.0", optional = true, git = "https://github.com/anza-xyz/agave.git" } -solana-instruction = { version = "2.1.0", features = ["bincode", "std"], git = "https://github.com/anza-xyz/agave.git" } -solana-logger = { version = "2.1.0", optional = true, git = "https://github.com/anza-xyz/agave.git" } -solana-pubkey = { version = "2.1.0", default-features = false, features = ["serde"], git = "https://github.com/anza-xyz/agave.git" } +serde = { version = "1.0.210", optional = true } +serde_derive = { version = "1.0.210", optional = true } +solana-decode-error = { version = "2.2", git = "https://github.com/anza-xyz/agave.git" } +solana-frozen-abi = { version = "2.2", optional = true, git = "https://github.com/anza-xyz/agave.git" } +solana-frozen-abi-macro = { version = "2.2", optional = true, git = "https://github.com/anza-xyz/agave.git" } +solana-instruction = { version = "2.2", features = ["bincode", "std"], git = "https://github.com/anza-xyz/agave.git" } +solana-pubkey = { version = "2.2", default-features = false, git = "https://github.com/anza-xyz/agave.git" } [target.'cfg(target_arch = "wasm32")'.dependencies] js-sys = "0.3.72" @@ -31,16 +29,17 @@ wasm-bindgen = "0.2" [dev-dependencies] anyhow = "1.0.89" borsh = { version = "1.5.1", features = ["derive", "unstable__schema"] } -solana-instruction = { version = "2.1.0", git = "https://github.com/anza-xyz/agave.git" } -solana-program = { version = "2.1.0", default-features = false, git = "https://github.com/anza-xyz/agave.git" } -solana-program-error = { version = "2.1.0", features = ["borsh"], git = "https://github.com/anza-xyz/agave.git" } +solana-nonce = { version = "2.2", git = "https://github.com/anza-xyz/agave.git" } +solana-program = { version = "2.2", default-features = false, git = "https://github.com/anza-xyz/agave.git" } +solana-rent = { version = "2.2", features = ["sysvar"], git = "https://github.com/anza-xyz/agave.git" } static_assertions = "1.1.0" strum = "0.24" strum_macros = "0.24" [features] +default = ["serde"] frozen-abi = [ "dep:solana-frozen-abi", - "dep:solana-frozen-abi-macro", - "dep:solana-logger" -] \ No newline at end of file + "dep:solana-frozen-abi-macro" +] +serde = ["dep:serde", "dep:serde_derive", "solana-pubkey/serde"] diff --git a/interface/src/error.rs b/interface/src/error.rs index 83a8d59..8d93d5a 100644 --- a/interface/src/error.rs +++ b/interface/src/error.rs @@ -1,11 +1,11 @@ use num_traits::{FromPrimitive, ToPrimitive}; -use serde::Serialize; use solana_decode_error::DecodeError; // Use strum when testing to ensure our FromPrimitive // impl is exhaustive +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(test, derive(strum_macros::FromRepr, strum_macros::EnumIter))] -#[derive(Serialize, Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum SystemError { /// An account with the same address already exists. AccountAlreadyInUse, @@ -120,3 +120,37 @@ impl DecodeError for SystemError { "SystemError" } } + +impl From for SystemError { + fn from(error: u64) -> Self { + match error { + 0 => SystemError::AccountAlreadyInUse, + 1 => SystemError::ResultWithNegativeLamports, + 2 => SystemError::InvalidProgramId, + 3 => SystemError::InvalidAccountDataLength, + 4 => SystemError::MaxSeedLengthExceeded, + 5 => SystemError::AddressWithSeedMismatch, + 6 => SystemError::NonceNoRecentBlockhashes, + 7 => SystemError::NonceBlockhashNotExpired, + 8 => SystemError::NonceUnexpectedBlockhashValue, + _ => panic!("Unsupported SsytemError"), + } + } +} + +#[cfg(test)] +mod tests { + use {super::SystemError, num_traits::FromPrimitive, strum::IntoEnumIterator}; + + #[test] + fn test_system_error_from_primitive_exhaustive() { + for variant in SystemError::iter() { + let variant_i64 = variant.clone() as i64; + assert_eq!( + SystemError::from_repr(variant_i64 as usize), + SystemError::from_i64(variant_i64) + ); + assert_eq!(SystemError::from(variant_i64 as u64), variant); + } + } +} diff --git a/interface/src/instruction.rs b/interface/src/instruction.rs index 1724991..7bf8b6a 100644 --- a/interface/src/instruction.rs +++ b/interface/src/instruction.rs @@ -1,4 +1,3 @@ -use serde_derive::{Deserialize, Serialize}; use solana_instruction::{AccountMeta, Instruction}; use solana_pubkey::Pubkey; @@ -13,7 +12,8 @@ use crate::{program::ID, NONCE_STATE_SIZE, RECENT_BLOCKHASHES_ID, RENT_ID}; solana_frozen_abi_macro::AbiEnumVisitor ) )] -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum SystemInstruction { /// Create a new account /// @@ -53,8 +53,8 @@ pub enum SystemInstruction { /// 0. `[WRITE, SIGNER]` Funding account /// 1. `[WRITE]` Created account /// 2. `[SIGNER]` (optional) Base account; the account matching the base Pubkey below must be - /// provided as a signer, but may be the same as the funding account - /// and provided as account 0 + /// provided as a signer, but may be the same as the funding account + /// and provided as account 0 CreateAccountWithSeed { /// Base public key base: Pubkey, @@ -126,7 +126,7 @@ pub enum SystemInstruction { }, /// Allocate space for and assign an account at an address - /// derived from a base public key and a seed + /// derived from a base public key and a seed /// /// # Account references /// 0. `[WRITE]` Allocated account @@ -193,7 +193,7 @@ pub enum SystemInstruction { /// [`SystemInstruction::CreateAccount`]. /// /// [`Transaction`]: https://docs.rs/solana-sdk/latest/solana_sdk/transaction/struct.Transaction.html -/// [invoked]: crate::program::invoke +/// [invoked]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke.html /// /// Account creation typically involves three steps: [`allocate`] space, /// [`transfer`] lamports for rent, [`assign`] to its owning program. The @@ -219,12 +219,10 @@ pub enum SystemInstruction { /// # use solana_program::example_mocks::{solana_sdk, solana_rpc_client}; /// use solana_rpc_client::rpc_client::RpcClient; /// use solana_sdk::{ -/// pubkey::Pubkey, /// signature::{Keypair, Signer}, -/// system_instruction, -/// system_program, /// transaction::Transaction, /// }; +/// use solana_system_interface::{instruction, program}; /// use anyhow::Result; /// /// fn create_account( @@ -234,12 +232,12 @@ pub enum SystemInstruction { /// space: u64, /// ) -> Result<()> { /// let rent = client.get_minimum_balance_for_rent_exemption(space.try_into()?)?; -/// let instr = system_instruction::create_account( +/// let instr = instruction::create_account( /// &payer.pubkey(), /// &new_account.pubkey(), /// rent, /// space, -/// &system_program::ID, +/// &program::ID, /// ); /// /// let blockhash = client.get_latest_blockhash()?; @@ -271,25 +269,19 @@ pub enum SystemInstruction { /// for by the client that submitted the transaction. /// /// [pda]: Pubkey::find_program_address -/// [`invoke_signed`]: crate::program::invoke_signed +/// [`invoke_signed`]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke_signed.html /// /// ``` -/// # use borsh::{BorshDeserialize, BorshSerialize}; -/// use solana_program::{ -/// account_info::{next_account_info, AccountInfo}, -/// entrypoint, -/// entrypoint::ProgramResult, -/// msg, -/// program::invoke_signed, -/// pubkey::Pubkey, -/// system_instruction, -/// system_program, -/// sysvar::rent::Rent, -/// sysvar::Sysvar, -/// }; +/// use borsh::{BorshDeserialize, BorshSerialize}; +/// use solana_account_info::{next_account_info, AccountInfo}; +/// use solana_cpi::invoke_signed; +/// use solana_program::sysvar::Sysvar; +/// use solana_program_entrypoint::entrypoint; +/// use solana_program_error::ProgramResult; +/// use solana_pubkey::Pubkey; +/// use solana_system_interface::{instruction, program}; /// /// #[derive(BorshSerialize, BorshDeserialize, Debug)] -/// # #[borsh(crate = "borsh")] /// pub struct CreateAccountInstruction { /// /// The PDA seed used to distinguish the new account from other PDAs /// pub new_account_seed: [u8; 16], @@ -329,21 +321,23 @@ pub enum SystemInstruction { /// .minimum_balance(instr.space.try_into().expect("overflow")); /// /// invoke_signed( -/// &system_instruction::create_account( +/// &instruction::create_account( /// payer.key, /// new_account_pda.key, /// rent, /// instr.space, -/// &system_program::ID +/// &program::ID /// ), /// &[payer.clone(), new_account_pda.clone()], -/// &[&[payer.key.as_ref(), new_account_seed, &[new_account_bump_seed]]], +/// &[&[ +/// payer.key.as_ref(), +/// new_account_seed, +/// &[new_account_bump_seed], +/// ]], /// )?; /// /// Ok(()) /// } -/// -/// # Ok::<(), anyhow::Error>(()) /// ``` pub fn create_account( from_pubkey: &Pubkey, @@ -404,7 +398,7 @@ pub fn create_account_with_seed( /// [`SystemInstruction::Assign`]. /// /// [`Transaction`]: https://docs.rs/solana-sdk/latest/solana_sdk/transaction/struct.Transaction.html -/// [invoked]: crate::program::invoke +/// [invoked]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke.html /// /// # Required signers /// @@ -424,12 +418,12 @@ pub fn create_account_with_seed( /// ``` /// # use solana_program::example_mocks::{solana_sdk, solana_rpc_client}; /// use solana_rpc_client::rpc_client::RpcClient; +/// use solana_pubkey::Pubkey /// use solana_sdk::{ -/// pubkey::Pubkey, /// signature::{Keypair, Signer}, -/// system_instruction, /// transaction::Transaction, /// }; +/// use solana_system_interface::instruction; /// use anyhow::Result; /// /// fn create_account( @@ -441,18 +435,18 @@ pub fn create_account_with_seed( /// ) -> Result<()> { /// let rent = client.get_minimum_balance_for_rent_exemption(space.try_into()?)?; /// -/// let transfer_instr = system_instruction::transfer( +/// let transfer_instr = instruction::transfer( /// &payer.pubkey(), /// &new_account.pubkey(), /// rent, /// ); /// -/// let allocate_instr = system_instruction::allocate( +/// let allocate_instr = instruction::allocate( /// &new_account.pubkey(), /// space, /// ); /// -/// let assign_instr = system_instruction::assign( +/// let assign_instr = instruction::assign( /// &new_account.pubkey(), /// owning_program, /// ); @@ -488,25 +482,19 @@ pub fn create_account_with_seed( /// submitted the transaction. /// /// [pda]: Pubkey::find_program_address -/// [`invoke_signed`]: crate::program::invoke_signed +/// [`invoke_signed`]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke_signed.html /// /// ``` -/// # use borsh::{BorshDeserialize, BorshSerialize}; -/// use solana_program::{ -/// account_info::{next_account_info, AccountInfo}, -/// entrypoint, -/// entrypoint::ProgramResult, -/// msg, -/// program::invoke_signed, -/// pubkey::Pubkey, -/// system_instruction, -/// system_program, -/// sysvar::rent::Rent, -/// sysvar::Sysvar, -/// }; +/// use borsh::{BorshDeserialize, BorshSerialize}; +/// use solana_account_info::{next_account_info, AccountInfo}; +/// use solana_cpi::invoke_signed; +/// use solana_program::sysvar::Sysvar; +/// use solana_program_entrypoint::entrypoint; +/// use solana_program_error::ProgramResult; +/// use solana_pubkey::Pubkey; +/// use solana_system_interface::{instruction, program}; /// /// #[derive(BorshSerialize, BorshDeserialize, Debug)] -/// # #[borsh(crate = "borsh")] /// pub struct CreateAccountInstruction { /// /// The PDA seed used to distinguish the new account from other PDAs /// pub new_account_seed: [u8; 16], @@ -546,37 +534,23 @@ pub fn create_account_with_seed( /// .minimum_balance(instr.space.try_into().expect("overflow")); /// /// invoke_signed( -/// &system_instruction::transfer( +/// &instruction::create_account( /// payer.key, /// new_account_pda.key, /// rent, -/// ), -/// &[payer.clone(), new_account_pda.clone()], -/// &[&[payer.key.as_ref(), new_account_seed, &[new_account_bump_seed]]], -/// )?; -/// -/// invoke_signed( -/// &system_instruction::allocate( -/// new_account_pda.key, /// instr.space, +/// &program::ID /// ), -/// &[new_account_pda.clone()], -/// &[&[payer.key.as_ref(), new_account_seed, &[new_account_bump_seed]]], -/// )?; -/// -/// invoke_signed( -/// &system_instruction::assign( -/// new_account_pda.key, -/// &program_id, -/// ), -/// &[new_account_pda.clone()], -/// &[&[payer.key.as_ref(), new_account_seed, &[new_account_bump_seed]]], +/// &[payer.clone(), new_account_pda.clone()], +/// &[&[ +/// payer.key.as_ref(), +/// new_account_seed, +/// &[new_account_bump_seed], +/// ]], /// )?; /// /// Ok(()) /// } -/// -/// # Ok::<(), anyhow::Error>(()) /// ``` pub fn assign(pubkey: &Pubkey, owner: &Pubkey) -> Instruction { let account_metas = vec![AccountMeta::new(*pubkey, true)]; @@ -615,7 +589,7 @@ pub fn assign_with_seed( /// [`SystemInstruction::Transfer`]. /// /// [`Transaction`]: https://docs.rs/solana-sdk/latest/solana_sdk/transaction/struct.Transaction.html -/// [invoked]: crate::program::invoke +/// [invoked]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke.html /// /// # Required signers /// @@ -635,12 +609,12 @@ pub fn assign_with_seed( /// ``` /// # use solana_program::example_mocks::{solana_sdk, solana_rpc_client}; /// use solana_rpc_client::rpc_client::RpcClient; +/// use solana_pubkey::Pubkey /// use solana_sdk::{ -/// pubkey::Pubkey, /// signature::{Keypair, Signer}, -/// system_instruction, /// transaction::Transaction, /// }; +/// use solana_system_interface::instruction; /// use anyhow::Result; /// /// fn create_account( @@ -652,18 +626,18 @@ pub fn assign_with_seed( /// ) -> Result<()> { /// let rent = client.get_minimum_balance_for_rent_exemption(space.try_into()?)?; /// -/// let transfer_instr = system_instruction::transfer( +/// let transfer_instr = instruction::transfer( /// &payer.pubkey(), /// &new_account.pubkey(), /// rent, /// ); /// -/// let allocate_instr = system_instruction::allocate( +/// let allocate_instr = instruction::allocate( /// &new_account.pubkey(), /// space, /// ); /// -/// let assign_instr = system_instruction::assign( +/// let assign_instr = instruction::assign( /// &new_account.pubkey(), /// owning_program, /// ); @@ -699,25 +673,19 @@ pub fn assign_with_seed( /// submitted the transaction. /// /// [pda]: Pubkey::find_program_address -/// [`invoke_signed`]: crate::program::invoke_signed +/// [`invoke_signed`]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke_signed.html /// /// ``` -/// # use borsh::{BorshDeserialize, BorshSerialize}; -/// use solana_program::{ -/// account_info::{next_account_info, AccountInfo}, -/// entrypoint, -/// entrypoint::ProgramResult, -/// msg, -/// program::invoke_signed, -/// pubkey::Pubkey, -/// system_instruction, -/// system_program, -/// sysvar::rent::Rent, -/// sysvar::Sysvar, -/// }; +/// use borsh::{BorshDeserialize, BorshSerialize}; +/// use solana_account_info::{next_account_info, AccountInfo}; +/// use solana_cpi::invoke_signed; +/// use solana_program::sysvar::Sysvar; +/// use solana_program_entrypoint::entrypoint; +/// use solana_program_error::ProgramResult; +/// use solana_pubkey::Pubkey; +/// use solana_system_interface::{instruction, program}; /// /// #[derive(BorshSerialize, BorshDeserialize, Debug)] -/// # #[borsh(crate = "borsh")] /// pub struct CreateAccountInstruction { /// /// The PDA seed used to distinguish the new account from other PDAs /// pub new_account_seed: [u8; 16], @@ -757,37 +725,23 @@ pub fn assign_with_seed( /// .minimum_balance(instr.space.try_into().expect("overflow")); /// /// invoke_signed( -/// &system_instruction::transfer( +/// &instruction::create_account( /// payer.key, /// new_account_pda.key, /// rent, -/// ), -/// &[payer.clone(), new_account_pda.clone()], -/// &[&[payer.key.as_ref(), new_account_seed, &[new_account_bump_seed]]], -/// )?; -/// -/// invoke_signed( -/// &system_instruction::allocate( -/// new_account_pda.key, /// instr.space, +/// &program::ID /// ), -/// &[new_account_pda.clone()], -/// &[&[payer.key.as_ref(), new_account_seed, &[new_account_bump_seed]]], -/// )?; -/// -/// invoke_signed( -/// &system_instruction::assign( -/// new_account_pda.key, -/// &program_id, -/// ), -/// &[new_account_pda.clone()], -/// &[&[payer.key.as_ref(), new_account_seed, &[new_account_bump_seed]]], +/// &[payer.clone(), new_account_pda.clone()], +/// &[&[ +/// payer.key.as_ref(), +/// new_account_seed, +/// &[new_account_bump_seed], +/// ]], /// )?; /// /// Ok(()) /// } -/// -/// # Ok::<(), anyhow::Error>(()) /// ``` pub fn transfer(from_pubkey: &Pubkey, to_pubkey: &Pubkey, lamports: u64) -> Instruction { let account_metas = vec![ @@ -828,7 +782,7 @@ pub fn transfer_with_seed( /// [`SystemInstruction::Allocate`]. /// /// [`Transaction`]: https://docs.rs/solana-sdk/latest/solana_sdk/transaction/struct.Transaction.html -/// [invoked]: crate::program::invoke +/// [invoked]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke.html /// /// The transaction will fail if the account already has size greater than 0, /// or if the requested size is greater than [`MAX_PERMITTED_DATA_LENGTH`]. @@ -851,12 +805,12 @@ pub fn transfer_with_seed( /// ``` /// # use solana_program::example_mocks::{solana_sdk, solana_rpc_client}; /// use solana_rpc_client::rpc_client::RpcClient; +/// use solana_pubkey::Pubkey /// use solana_sdk::{ -/// pubkey::Pubkey, /// signature::{Keypair, Signer}, -/// system_instruction, /// transaction::Transaction, /// }; +/// use solana_system_interface::instruction; /// use anyhow::Result; /// /// fn create_account( @@ -868,18 +822,18 @@ pub fn transfer_with_seed( /// ) -> Result<()> { /// let rent = client.get_minimum_balance_for_rent_exemption(space.try_into()?)?; /// -/// let transfer_instr = system_instruction::transfer( +/// let transfer_instr = instruction::transfer( /// &payer.pubkey(), /// &new_account.pubkey(), /// rent, /// ); /// -/// let allocate_instr = system_instruction::allocate( +/// let allocate_instr = instruction::allocate( /// &new_account.pubkey(), /// space, /// ); /// -/// let assign_instr = system_instruction::assign( +/// let assign_instr = instruction::assign( /// &new_account.pubkey(), /// owning_program, /// ); @@ -915,25 +869,19 @@ pub fn transfer_with_seed( /// submitted the transaction. /// /// [pda]: Pubkey::find_program_address -/// [`invoke_signed`]: crate::program::invoke_signed +/// [`invoke_signed`]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke_signed.html /// /// ``` -/// # use borsh::{BorshDeserialize, BorshSerialize}; -/// use solana_program::{ -/// account_info::{next_account_info, AccountInfo}, -/// entrypoint, -/// entrypoint::ProgramResult, -/// msg, -/// program::invoke_signed, -/// pubkey::Pubkey, -/// system_instruction, -/// system_program, -/// sysvar::rent::Rent, -/// sysvar::Sysvar, -/// }; +/// use borsh::{BorshDeserialize, BorshSerialize}; +/// use solana_account_info::{next_account_info, AccountInfo}; +/// use solana_cpi::invoke_signed; +/// use solana_program::sysvar::Sysvar; +/// use solana_program_entrypoint::entrypoint; +/// use solana_program_error::ProgramResult; +/// use solana_pubkey::Pubkey; +/// use solana_system_interface::{instruction, program}; /// /// #[derive(BorshSerialize, BorshDeserialize, Debug)] -/// # #[borsh(crate = "borsh")] /// pub struct CreateAccountInstruction { /// /// The PDA seed used to distinguish the new account from other PDAs /// pub new_account_seed: [u8; 16], @@ -973,37 +921,23 @@ pub fn transfer_with_seed( /// .minimum_balance(instr.space.try_into().expect("overflow")); /// /// invoke_signed( -/// &system_instruction::transfer( +/// &instruction::create_account( /// payer.key, /// new_account_pda.key, /// rent, -/// ), -/// &[payer.clone(), new_account_pda.clone()], -/// &[&[payer.key.as_ref(), new_account_seed, &[new_account_bump_seed]]], -/// )?; -/// -/// invoke_signed( -/// &system_instruction::allocate( -/// new_account_pda.key, /// instr.space, +/// &program::ID /// ), -/// &[new_account_pda.clone()], -/// &[&[payer.key.as_ref(), new_account_seed, &[new_account_bump_seed]]], -/// )?; -/// -/// invoke_signed( -/// &system_instruction::assign( -/// new_account_pda.key, -/// &program_id, -/// ), -/// &[new_account_pda.clone()], -/// &[&[payer.key.as_ref(), new_account_seed, &[new_account_bump_seed]]], +/// &[payer.clone(), new_account_pda.clone()], +/// &[&[ +/// payer.key.as_ref(), +/// new_account_seed, +/// &[new_account_bump_seed], +/// ]], /// )?; /// /// Ok(()) /// } -/// -/// # Ok::<(), anyhow::Error>(()) /// ``` pub fn allocate(pubkey: &Pubkey, space: u64) -> Instruction { let account_metas = vec![AccountMeta::new(*pubkey, true)]; @@ -1040,7 +974,7 @@ pub fn allocate_with_seed( /// [`SystemInstruction::Transfer`]s. /// /// [`Transaction`]: https://docs.rs/solana-sdk/latest/solana_sdk/transaction/struct.Transaction.html -/// [invoked]: crate::program::invoke +/// [invoked]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke.html /// /// # Required signers /// @@ -1055,12 +989,11 @@ pub fn allocate_with_seed( /// ``` /// # use solana_program::example_mocks::{solana_sdk, solana_rpc_client}; /// use solana_rpc_client::rpc_client::RpcClient; -/// use solana_sdk::{ -/// pubkey::Pubkey, +/// use solana_pubkey::Pubkey; /// signature::{Keypair, Signer}, -/// system_instruction, /// transaction::Transaction, /// }; +/// use solana_system_interface::instruction; /// use anyhow::Result; /// /// fn transfer_lamports_to_many( @@ -1068,7 +1001,7 @@ pub fn allocate_with_seed( /// from: &Keypair, /// to_and_amount: &[(Pubkey, u64)], /// ) -> Result<()> { -/// let instrs = system_instruction::transfer_many(&from.pubkey(), to_and_amount); +/// let instrs = instruction::transfer_many(&from.pubkey(), to_and_amount); /// /// let blockhash = client.get_latest_blockhash()?; /// let tx = Transaction::new_signed_with_payer( @@ -1106,20 +1039,16 @@ pub fn allocate_with_seed( /// transaction. /// /// [pda]: Pubkey::find_program_address -/// [`invoke_signed`]: crate::program::invoke_signed +/// [`invoke_signed`]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke_signed.html /// /// ``` -/// # use borsh::{BorshDeserialize, BorshSerialize}; -/// use solana_program::{ -/// account_info::{next_account_info, next_account_infos, AccountInfo}, -/// entrypoint, -/// entrypoint::ProgramResult, -/// msg, -/// program::invoke_signed, -/// pubkey::Pubkey, -/// system_instruction, -/// system_program, -/// }; +/// use borsh::{BorshDeserialize, BorshSerialize}; +/// use solana_account_info::{next_account_info, next_account_infos, AccountInfo}; +/// use solana_cpi::invoke_signed; +/// use solana_program_entrypoint::entrypoint; +/// use solana_program_error::ProgramResult; +/// use solana_pubkey::Pubkey; +/// use solana_system_interface::{instruction, program}; /// /// /// # Accounts /// /// @@ -1127,7 +1056,6 @@ pub fn allocate_with_seed( /// /// - 1: system_program - executable /// /// - *: to - writable /// #[derive(BorshSerialize, BorshDeserialize, Debug)] -/// # #[borsh(crate = "borsh")] /// pub struct TransferLamportsToManyInstruction { /// pub bank_pda_bump_seed: u8, /// pub amount_list: Vec, @@ -1148,7 +1076,7 @@ pub fn allocate_with_seed( /// let bank_pda_bump_seed = instr.bank_pda_bump_seed; /// let system_account = next_account_info(account_info_iter)?; /// -/// assert!(system_program::check_id(system_account.key)); +/// assert!(program::check_id(system_account.key)); /// /// let to_accounts = next_account_infos(account_info_iter, account_info_iter.len())?; /// @@ -1163,7 +1091,7 @@ pub fn allocate_with_seed( /// .map(|(to, amount)| (*to.key, *amount)) /// .collect::>(); /// -/// let instrs = system_instruction::transfer_many(bank_pda.key, to_and_amount.as_ref()); +/// let instrs = instruction::transfer_many(bank_pda.key, to_and_amount.as_ref()); /// /// for instr in instrs { /// invoke_signed(&instr, accounts, &[&[b"bank", &[bank_pda_bump_seed]]])?; @@ -1171,8 +1099,6 @@ pub fn allocate_with_seed( /// /// Ok(()) /// } -/// -/// # Ok::<(), anyhow::Error>(()) /// ``` pub fn transfer_many(from_pubkey: &Pubkey, to_lamports: &[(Pubkey, u64)]) -> Vec { to_lamports @@ -1220,7 +1146,7 @@ pub fn create_nonce_account_with_seed( /// [`SystemInstruction::InitializeNonceAccount`]. /// /// [`Transaction`]: https://docs.rs/solana-sdk/latest/solana_sdk/transaction/struct.Transaction.html -/// [invoked]: crate::program::invoke +/// [invoked]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke.html /// /// A [durable transaction nonce][dtn] is a special account that enables /// execution of transactions that have been signed in the past. @@ -1284,12 +1210,11 @@ pub fn create_nonce_account_with_seed( /// # use solana_program::example_mocks::solana_rpc_client; /// use solana_rpc_client::rpc_client::RpcClient; /// use solana_sdk::{ -/// # pubkey::Pubkey, /// signature::{Keypair, Signer}, -/// system_instruction, /// transaction::Transaction, /// nonce::State, /// }; +/// use solana_system_interface::instruction; /// use anyhow::Result; /// /// fn submit_create_nonce_account_tx( @@ -1300,7 +1225,7 @@ pub fn create_nonce_account_with_seed( /// let nonce_account = Keypair::new(); /// /// let nonce_rent = client.get_minimum_balance_for_rent_exemption(State::size())?; -/// let instr = system_instruction::create_nonce_account( +/// let instr = instruction::create_nonce_account( /// &payer.pubkey(), /// &nonce_account.pubkey(), /// &payer.pubkey(), // Make the fee payer the nonce account authority @@ -1357,7 +1282,7 @@ pub fn create_nonce_account( /// [`SystemInstruction::AdvanceNonceAccount`]. /// /// [`Transaction`]: https://docs.rs/solana-sdk/latest/solana_sdk/transaction/struct.Transaction.html -/// [invoked]: crate::program::invoke +/// [invoked]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke.html /// /// Every transaction that relies on a durable transaction nonce must contain a /// [`SystemInstruction::AdvanceNonceAccount`] instruction as the first @@ -1395,17 +1320,15 @@ pub fn create_nonce_account( /// # use solana_program::example_mocks::solana_rpc_client; /// # use solana_program::example_mocks::solana_rpc_client_nonce_utils; /// use solana_rpc_client::rpc_client::RpcClient; +/// use solana_pubkey::Pubkey; /// use solana_sdk::{ /// message::Message, -/// pubkey::Pubkey, /// signature::{Keypair, Signer}, -/// system_instruction, /// transaction::Transaction, /// }; -/// # use solana_sdk::account::Account; +/// use solana_system_interface::instruction; /// use std::path::Path; /// use anyhow::Result; -/// # use anyhow::anyhow; /// /// fn create_transfer_tx_with_nonce( /// client: &RpcClient, @@ -1416,14 +1339,14 @@ pub fn create_nonce_account( /// tx_path: &Path, /// ) -> Result<()> { /// -/// let instr_transfer = system_instruction::transfer( +/// let instr_transfer = instruction::transfer( /// &payer.pubkey(), /// receiver, /// amount, /// ); /// /// // In this example, `payer` is `nonce_account_pubkey`'s authority -/// let instr_advance_nonce_account = system_instruction::advance_nonce_account( +/// let instr_advance_nonce_account = instruction::advance_nonce_account( /// nonce_account_pubkey, /// &payer.pubkey(), /// ); @@ -1490,7 +1413,7 @@ pub fn advance_nonce_account(nonce_pubkey: &Pubkey, authorized_pubkey: &Pubkey) /// [`SystemInstruction::WithdrawNonceAccount`]. /// /// [`Transaction`]: https://docs.rs/solana-sdk/latest/solana_sdk/transaction/struct.Transaction.html -/// [invoked]: crate::program::invoke +/// [invoked]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke.html /// /// Withdrawing the entire balance of a nonce account will cause the runtime to /// destroy it upon successful completion of the transaction. @@ -1515,12 +1438,12 @@ pub fn advance_nonce_account(nonce_pubkey: &Pubkey, authorized_pubkey: &Pubkey) /// # use solana_program::example_mocks::solana_sdk; /// # use solana_program::example_mocks::solana_rpc_client; /// use solana_rpc_client::rpc_client::RpcClient; +/// use solana_pubkey::Pubkey; /// use solana_sdk::{ -/// pubkey::Pubkey, /// signature::{Keypair, Signer}, -/// system_instruction, /// transaction::Transaction, /// }; +/// use solana_system_interface::instruction; /// use anyhow::Result; /// /// fn submit_withdraw_nonce_account_tx( @@ -1531,8 +1454,8 @@ pub fn advance_nonce_account(nonce_pubkey: &Pubkey, authorized_pubkey: &Pubkey) /// /// let nonce_balance = client.get_balance(nonce_account_pubkey)?; /// -/// let instr = system_instruction::withdraw_nonce_account( -/// &nonce_account_pubkey, +/// let instr = instruction::withdraw_nonce_account( +/// nonce_account_pubkey, /// &authorized_account.pubkey(), /// &authorized_account.pubkey(), /// nonce_balance, @@ -1583,7 +1506,7 @@ pub fn withdraw_nonce_account( /// [`SystemInstruction::AuthorizeNonceAccount`]. /// /// [`Transaction`]: https://docs.rs/solana-sdk/latest/solana_sdk/transaction/struct.Transaction.html -/// [invoked]: crate::program::invoke +/// [invoked]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.invoke.html /// /// This constructor creates a [`SystemInstruction::AuthorizeNonceAccount`] /// instruction. @@ -1598,12 +1521,12 @@ pub fn withdraw_nonce_account( /// # use solana_program::example_mocks::solana_sdk; /// # use solana_program::example_mocks::solana_rpc_client; /// use solana_rpc_client::rpc_client::RpcClient; +/// use solana_pubkey::Pubkey; /// use solana_sdk::{ -/// pubkey::Pubkey, /// signature::{Keypair, Signer}, -/// system_instruction, /// transaction::Transaction, /// }; +/// use solana_system_interface::instruction; /// use anyhow::Result; /// /// fn authorize_nonce_account_tx( @@ -1614,9 +1537,9 @@ pub fn withdraw_nonce_account( /// ) -> Result<()> { /// /// let instr = system_instruction::authorize_nonce_account( -/// &nonce_account_pubkey, +/// nonce_account_pubkey, /// &authorized_account.pubkey(), -/// &new_authority_pubkey, +/// new_authority_pubkey, /// ); /// /// let mut tx = Transaction::new_with_payer(&[instr], Some(&authorized_account.pubkey())); diff --git a/interface/src/lib.rs b/interface/src/lib.rs index f3024d9..7a694a7 100644 --- a/interface/src/lib.rs +++ b/interface/src/lib.rs @@ -1,4 +1,4 @@ -//! The [system native program][np]. +//! The [system native program interface][np]. //! //! [rent exempt]: https://solana.com/docs/core/accounts#rent-exemption //! @@ -7,7 +7,7 @@ //! or they can be [program derived addresses][pda], //! where write access to accounts is granted by an owning program. //! -//! [pda]: solana_pubkey::Pubkey::find_program_address +//! [pda]: https://docs.rs/solana-pubkey/latest/solana_pubkey/struct.Pubkey.html#method.find_program_address //! //! Most of the functions in this module construct an [`Instruction`], that must //! be submitted to the runtime for execution, either via RPC, typically with @@ -20,10 +20,11 @@ //! and these variants are linked from the documentation for their constructors. //! //! [`RpcClient`]: https://docs.rs/solana-client/latest/solana_client/rpc_client/struct.RpcClient.html -//! [cpi]: solana_program::program -//! [`invoke`]: solana_program::program::invoke -//! [`invoke_signed`]: solana_program::program::invoke_signed -//! [`AccountInfo`]: solana_account_info::AccountInfo +//! [cpi]: https://docs.rs/solana-program/latest/solana_program/program/index.html +//! [`invoke`]: https://docs.rs/solana-program/latest/solana_program/program/fn.invoke.html +//! [`invoke_signed`]: https://docs.rs/solana-program/latest/solana_program/program/fn.invoke_signed.html +//! [`AccountInfo`]: https://docs.rs/solana-account-info/2.1.0/solana_account_info/struct.AccountInfo.html + #![cfg_attr(feature = "frozen-abi", feature(min_specialization))] #![cfg_attr(docsrs, feature(doc_auto_cfg))] @@ -34,18 +35,29 @@ mod wasm; use solana_pubkey::Pubkey; -// inline some constants to avoid dependencies +// Inline some constants to avoid dependencies. + const RECENT_BLOCKHASHES_ID: Pubkey = Pubkey::from_str_const("SysvarRecentB1ockHashes11111111111111111111"); + const RENT_ID: Pubkey = Pubkey::from_str_const("SysvarRent111111111111111111111111111111111"); + +#[cfg(test)] +static_assertions::const_assert_eq!(solana_nonce::state::State::size(), NONCE_STATE_SIZE); +/// The serialized size of the nonce state. const NONCE_STATE_SIZE: usize = 80; -//TODO: enable this assertion when the nonce crate is ready -//#[cfg(test)] -//static_assertions::const_assert_eq!(solana_program::nonce::State::size(), NONCE_STATE_SIZE); +#[cfg(test)] +static_assertions::const_assert!(MAX_PERMITTED_DATA_LENGTH <= u32::MAX as u64); /// Maximum permitted size of account data (10 MiB). +/// +// SBF program entrypoint assumes that the max account data length +// will fit inside a u32. If this constant no longer fits in a u32, +// the entrypoint deserialization code in the SDK must be updated. pub const MAX_PERMITTED_DATA_LENGTH: u64 = 10 * 1024 * 1024; +#[cfg(test)] +static_assertions::const_assert_eq!(MAX_PERMITTED_DATA_LENGTH, 10_485_760); /// Maximum permitted size of new allocations per transaction, in bytes. /// /// The value was chosen such that at least one max sized account could be created, @@ -53,17 +65,26 @@ pub const MAX_PERMITTED_DATA_LENGTH: u64 = 10 * 1024 * 1024; pub const MAX_PERMITTED_ACCOUNTS_DATA_ALLOCATIONS_PER_TRANSACTION: i64 = MAX_PERMITTED_DATA_LENGTH as i64 * 2; -// SBF program entrypoint assumes that the max account data length -// will fit inside a u32. If this constant no longer fits in a u32, -// the entrypoint deserialization code in the SDK must be updated. -#[cfg(test)] -static_assertions::const_assert!(MAX_PERMITTED_DATA_LENGTH <= u32::MAX as u64); - -#[cfg(test)] -static_assertions::const_assert_eq!(MAX_PERMITTED_DATA_LENGTH, 10_485_760); - pub mod program { use solana_pubkey::declare_id; declare_id!("11111111111111111111111111111111"); } + +#[cfg(test)] +mod tests { + use super::*; + + #[allow(deprecated)] + #[test] + fn test_constants() { + // Ensure that the constants are in sync with the solana program. + assert_eq!( + RECENT_BLOCKHASHES_ID, + solana_program::sysvar::recent_blockhashes::id(), + ); + + // Ensure that the constants are in sync with the solana rent. + assert_eq!(RENT_ID, solana_rent::sysvar::id(),); + } +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..5ee99a5 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "nightly-2024-08-08-aarch64-apple-darwin" \ No newline at end of file