diff --git a/Cargo.lock b/Cargo.lock index 836c48d..95e9a56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -71,12 +71,12 @@ dependencies = [ [[package]] name = "agave-geyser-plugin-interface" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45926f74ba8e7430177e865fdc27a4a274c33c80ce1ced460e78fd721ca8500a" +checksum = "34779bd664411533de577a88cf18a6c3344a2eb7c24b4697352e2f97be45683c" dependencies = [ "log", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-transaction-status", "thiserror", ] @@ -1641,7 +1641,7 @@ dependencies = [ "rand 0.8.5", "solana-entry", "solana-ledger", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-svm", "svm-executor", "tokio", @@ -2286,16 +2286,16 @@ name = "igloo-executor" version = "0.1.0" dependencies = [ "anyhow", + "async-trait", "crossbeam-channel", - "igloo-interface", "igloo-storage", - "igloo-validator", + "igloo-verifier", "log", "solana-accounts-db", "solana-core", "solana-ledger", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-svm", "tempfile", "thiserror", @@ -2319,13 +2319,14 @@ dependencies = [ "assert_matches", "bincode", "crossbeam-channel", - "igloo-interface", "log", "rand 0.8.5", "solana-account-decoder", "solana-accounts-db", "solana-bpf-loader-program", + "solana-client", "solana-compute-budget", + "solana-connection-cache", "solana-core", "solana-entry", "solana-gossip", @@ -2335,7 +2336,8 @@ dependencies = [ "solana-program-runtime", "solana-rpc", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "solana-send-transaction-service", "solana-stake-program", "solana-streamer", "solana-svm", @@ -2350,12 +2352,11 @@ dependencies = [ ] [[package]] -name = "igloo-validator" +name = "igloo-verifier" version = "0.1.0" dependencies = [ "anyhow", "crossbeam-channel", - "igloo-interface", "igloo-storage", "log", "solana-accounts-db", @@ -2363,7 +2364,7 @@ dependencies = [ "solana-entry", "solana-ledger", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-svm", "tempfile", "thiserror", @@ -4528,9 +4529,9 @@ dependencies = [ [[package]] name = "solana-account-decoder" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e92694b819c0baf7fe9d1f3d74c0360b08c49054e888f9bfbba731653bb7ff22" +checksum = "b3e6fe577e2495b9dd4a50236bf1db97dff4315ee38054ce554dd8babb9e6ae3" dependencies = [ "Inflector", "base64 0.22.1", @@ -4542,7 +4543,7 @@ dependencies = [ "serde_derive", "serde_json", "solana-config-program", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "spl-token", "spl-token-2022", "spl-token-group-interface", @@ -4553,9 +4554,9 @@ dependencies = [ [[package]] name = "solana-accounts-db" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b63694c7259bc34439a6619cec9c4c3b256faa30af32172b993aa017bb30d1d" +checksum = "52dce3c27ef315c56b0098c9016031f0a4a6b5270a81d84574253a9ca5ee29ba" dependencies = [ "bincode", "blake3", @@ -4588,7 +4589,7 @@ dependencies = [ "solana-metrics", "solana-nohash-hasher", "solana-rayon-threadlimit", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-svm", "static_assertions", "tar", @@ -4598,9 +4599,9 @@ dependencies = [ [[package]] name = "solana-address-lookup-table-program" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b04b5b8108d715e4f1472e0a932782b470498342117944c949cf0e7f9ce575b" +checksum = "f8db1e1fa5d506ba877d402e6cfb9c168558ae5c48544464db50ab3f82fac3c6" dependencies = [ "bincode", "bytemuck", @@ -4610,15 +4611,15 @@ dependencies = [ "rustc_version", "solana-program", "solana-program-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "solana-bloom" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc4e6c9bedbcb6d319d4b0674417fe0d33591bb1b3ad2c1cdee3a86f697b1d9c" +checksum = "0a8c6f16dc7415a72cb7b42d0c8fe0e10d5700625d1bc8daf5ed6009573502c1" dependencies = [ "bv", "fnv", @@ -4628,14 +4629,14 @@ dependencies = [ "rustc_version", "serde", "serde_derive", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "solana-bpf-loader-program" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0afab9603ad56a836daf03444ea3a08682cead8c12b35f47641170b3dd1c1586" +checksum = "87a115d2e65412da4757e852242d647d7bbb93269c1c6e5b0938ff664cb095b6" dependencies = [ "bincode", "byteorder", @@ -4647,7 +4648,7 @@ dependencies = [ "solana-measure", "solana-poseidon", "solana-program-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-type-overrides", "solana_rbpf", "thiserror", @@ -4655,9 +4656,9 @@ dependencies = [ [[package]] name = "solana-bucket-map" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ec81d062e8929d66bf09bc5c67d25e4123794607682d72ff16c33714a1cdb1d" +checksum = "8834b13d11b945442537c2e021ec86436276ad9e0c12466690d2b413a5c5a487" dependencies = [ "bv", "bytemuck", @@ -4668,21 +4669,21 @@ dependencies = [ "num_enum", "rand 0.8.5", "solana-measure", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile", ] [[package]] name = "solana-clap-utils" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf985fe4abeed8401b715d3c3cf08551455ea18bfe1e6fcf96f995f20723e053" +checksum = "47d33add6ab0a2f52fa6e59827e1918c089556cc19939afa1b0b2c64ea0cdf46" dependencies = [ "chrono", "clap 2.34.0", "rpassword", "solana-remote-wallet", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "tiny-bip39", "uriparse", @@ -4691,9 +4692,9 @@ dependencies = [ [[package]] name = "solana-cli-config" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe3d1d535798e8becae4d742d37269d0791f454a34443a95c810865b776ac378" +checksum = "3c1abb756d1c1a4fab59160c545b8a3d6d0983d8aad5fe402c7225198ba5d9cb" dependencies = [ "dirs-next", "lazy_static", @@ -4701,15 +4702,15 @@ dependencies = [ "serde_derive", "serde_yaml", "solana-clap-utils", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.5.2", ] [[package]] name = "solana-client" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a455a20e3e03d2da6d1e4f6c1f122c4ba4ab119651f02bd6744cc5af03e7774" +checksum = "35e9f44bd660baa87ddfa9d7b6c7b65091a9dd1feb6ebb40e40cff8c27e1631a" dependencies = [ "async-trait", "bincode", @@ -4729,7 +4730,7 @@ dependencies = [ "solana-rpc-client", "solana-rpc-client-api", "solana-rpc-client-nonce-utils", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-streamer", "solana-thin-client", "solana-tpu-client", @@ -4740,43 +4741,43 @@ dependencies = [ [[package]] name = "solana-compute-budget" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1610de88eddf42a9a4b0a8f31eb3f7f9863850dedf51355508550975e8895cd" +checksum = "327385a512e0c175d127b67e2e3d143ada56b90d775ff9ab54f75b9c309da77a" dependencies = [ "rustc_version", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "solana-compute-budget-program" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7405a9ed256c5a972c7b04396d912206e4547733c8bb109c72f5fab5f16f271" +checksum = "5e35ec0c03dc5210f962d9c786f6526149de770316ddfde90b10f820af686507" dependencies = [ "solana-program-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "solana-config-program" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7961fbad7a0facdc03037b484bacbf80198f68347d37ed84b2866b63c24015" +checksum = "54c79b9af54aeec3d9816d0e8b488927deaa6207912fcc37b0d39d4d2f97ceb9" dependencies = [ "bincode", "chrono", "serde", "serde_derive", "solana-program-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "solana-connection-cache" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "163e56d6851952e4ccde37a9b3fb6edab0207b6eb871da506434d55df4e8de94" +checksum = "38f93253e5803170642b7ee7d5c7551d3cd36913cac06582c540c5f43321d5a9" dependencies = [ "async-trait", "bincode", @@ -4788,16 +4789,16 @@ dependencies = [ "rayon", "solana-measure", "solana-metrics", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "tokio", ] [[package]] name = "solana-core" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a4e596cf4401d4a794290c28fed55a987cb3ef38e0c5cb0afc4a45f078ac90" +checksum = "fe43aea6d30218f5785ecf98d5ee54579e8d7eafb7f2f96c35194099775964a0" dependencies = [ "ahash 0.8.11", "base64 0.22.1", @@ -4849,7 +4850,7 @@ dependencies = [ "solana-rpc", "solana-rpc-client-api", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-send-transaction-service", "solana-streamer", "solana-svm", @@ -4873,9 +4874,9 @@ dependencies = [ [[package]] name = "solana-cost-model" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c01d51484359e01726e93f4dbb7e72459cf707cc8f07b1adfc66c3821bcd6f34" +checksum = "c13f20ff33764ff83505e68809e3f2f382ca20d816d9cb3d0d72d940c04933b3" dependencies = [ "ahash 0.8.11", "lazy_static", @@ -4888,7 +4889,7 @@ dependencies = [ "solana-config-program", "solana-loader-v4-program", "solana-metrics", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-stake-program", "solana-system-program", "solana-vote-program", @@ -4896,9 +4897,8 @@ dependencies = [ [[package]] name = "solana-curve25519" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147c81e77b74f5d0a52579c1cf982fffb8c4491fb3baabf0e4fa19e2f6f39030" +version = "2.0.7" +source = "git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8#11b87c1ba32c1895898f2a17502417fccdf1a4c8" dependencies = [ "bytemuck", "bytemuck_derive", @@ -4909,9 +4909,9 @@ dependencies = [ [[package]] name = "solana-entry" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66c9eb6121b1dcc24c5142ea3bb15df6c15e6b60be8d6374a7220630aa09fdd1" +checksum = "bc0e23e437f1cfac472386fbfcd6e8a67794b0a2c0134555e7a9312107753bdd" dependencies = [ "bincode", "crossbeam-channel", @@ -4926,14 +4926,14 @@ dependencies = [ "solana-metrics", "solana-perf", "solana-rayon-threadlimit", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "solana-faucet" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "044ee289987278e800857536e4eafaa04fba676e19edd11d06d1302cbded6f92" +checksum = "8608d6f51609420071c6733857a81e5c7e77a0ce958ae047a16528050d72b83f" dependencies = [ "bincode", "byteorder", @@ -4946,7 +4946,7 @@ dependencies = [ "solana-cli-config", "solana-logger", "solana-metrics", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-version", "spl-memo", "thiserror", @@ -4955,9 +4955,9 @@ dependencies = [ [[package]] name = "solana-geyser-plugin-manager" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "323661874211276a190577e624cee8d133e484a419ce4ca13b27c419e2a8badc" +checksum = "9a0e1704d038566c0be7112d68313b4ac361f2f298ae9bbbdd9231f2bd144544" dependencies = [ "agave-geyser-plugin-interface", "bs58", @@ -4974,7 +4974,7 @@ dependencies = [ "solana-metrics", "solana-rpc", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-transaction-status", "thiserror", "tokio", @@ -4982,9 +4982,9 @@ dependencies = [ [[package]] name = "solana-gossip" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8aa36f92ad3554175fc3793c5839c02e05a32731d900bc5ead1397b2d13c7d7" +checksum = "fc1fe274bc1edb8bc4f62ee49fa9a6c3d676054757a241df5336335ce6a6a4bf" dependencies = [ "assert_matches", "bincode", @@ -5018,7 +5018,7 @@ dependencies = [ "solana-perf", "solana-rayon-threadlimit", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-streamer", "solana-tpu-client", "solana-version", @@ -5030,20 +5030,20 @@ dependencies = [ [[package]] name = "solana-inline-spl" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f101319f4740095125c5006be1dc6d4b6108180def37ae94df42f16e78b93f4" +checksum = "e78cc3503120de3ef560188164d7b4d8b952e2322ec417173a8c8cfadb742aff" dependencies = [ "bytemuck", "rustc_version", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "solana-ledger" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c63cc564288ff107b9d18914a6f449c24d323b16892f16e26512cb2d6a24252" +checksum = "1257e3de317351f8eb1bc930bd6dc8c0234ec3dd686210f7b93904cdf35328e4" dependencies = [ "assert_matches", "bincode", @@ -5088,7 +5088,7 @@ dependencies = [ "solana-program-runtime", "solana-rayon-threadlimit", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-stake-program", "solana-storage-bigtable", "solana-storage-proto", @@ -5110,24 +5110,24 @@ dependencies = [ [[package]] name = "solana-loader-v4-program" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031a5c11cd84a398a19be442b3092f03457f785670a64edc339e9a676dfd033b" +checksum = "70642610ddd6f244171a241a6a980b0fc71ee8e63531594cbf044e44c7a7d88e" dependencies = [ "log", "solana-compute-budget", "solana-measure", "solana-program-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-type-overrides", "solana_rbpf", ] [[package]] name = "solana-logger" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc3c188176db5d4e60c137525439c4b881dfd262dd306abcac4c568f15177a6" +checksum = "56d54e8da6ff07964bf2aa55c58608a52239aed1819f51a4818c4fe524febfe0" dependencies = [ "env_logger 0.9.3", "lazy_static", @@ -5136,19 +5136,19 @@ dependencies = [ [[package]] name = "solana-measure" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe09f58977e579c3e91f0a7032a1d741e76327924ae868d17beb5d496b40c8f" +checksum = "26448e25e1dade7b708be92e2ca2404091300d70050cf1890fa1942f9ba7dadb" dependencies = [ "log", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "solana-merkle-tree" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f5908022103e87f15493371e689c7284555e19cc7cef2749eb7fefa14b1f5c7" +checksum = "ce9bb03966c8d02341787f893707f196c7df917fbfd795b0c93051064480bf5c" dependencies = [ "fast-math", "solana-program", @@ -5156,24 +5156,24 @@ dependencies = [ [[package]] name = "solana-metrics" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7860d18901af0b24e05d7631cd655924eb056d83a52040234f827cc3cc8da0c6" +checksum = "89df6a8653361ee8bcd88df498784d667937f3dee8a50da8aa5a793bed7e9df5" dependencies = [ "crossbeam-channel", "gethostname", "lazy_static", "log", "reqwest", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "solana-net-utils" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6723ddcc4393d9d2d5e258871461d0002e45c7d9b6ea895bff1011d16163e9" +checksum = "3ad8b6a549a868647fa2ba73aa75f82f8c476d5fd820868e80fef05bef70c1ac" dependencies = [ "bincode", "clap 3.2.25", @@ -5185,7 +5185,7 @@ dependencies = [ "serde_derive", "socket2", "solana-logger", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-version", "static_assertions", "tokio", @@ -5200,9 +5200,9 @@ checksum = "8b8a731ed60e89177c8a7ab05fe0f1511cedd3e70e773f288f9de33a9cfdc21e" [[package]] name = "solana-perf" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9393d11aa5643f6afdffa8ab7b12d8149b7b32409149f673f832f2be442fbe10" +checksum = "7a5cd42753f5ad99b2de70b068dedec4e52743af54b93b0af9345893b2cf51cd" dependencies = [ "ahash 0.8.11", "bincode", @@ -5221,15 +5221,15 @@ dependencies = [ "serde", "solana-metrics", "solana-rayon-threadlimit", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-vote-program", ] [[package]] name = "solana-poh" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1f9ca40763d1fd0176ab4325f3b4729dffbdb6ce1078cc1564c99fb1d8d057" +checksum = "ce090e5009cba19aa37512b94982343aae99394404242d2cb0e65fc4ec732d12" dependencies = [ "core_affinity", "crossbeam-channel", @@ -5239,15 +5239,15 @@ dependencies = [ "solana-measure", "solana-metrics", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "solana-poseidon" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3927e1c5ef192f8d95211ee07f02463b86a2e4b47181fa9f7eb6a962c87a57" +checksum = "7ed53e07cc34bbfa216bd4c133407321fe7b7660e1c55e744b9bd1be6b8a7d38" dependencies = [ "ark-bn254", "light-poseidon", @@ -5256,9 +5256,8 @@ dependencies = [ [[package]] name = "solana-program" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d899c2a1d37290dcfeeb9d1c0032915a29bd48f35759f19ff1e0f6b096eca0b" +version = "2.0.7" +source = "git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8#11b87c1ba32c1895898f2a17502417fccdf1a4c8" dependencies = [ "ark-bn254", "ark-ec", @@ -5295,16 +5294,16 @@ dependencies = [ "serde_derive", "sha2 0.10.8", "sha3 0.10.8", - "solana-sdk-macro", + "solana-sdk-macro 2.0.7 (git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8)", "thiserror", "wasm-bindgen", ] [[package]] name = "solana-program-runtime" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2612ef05b38afcbf642f9be889819713b23564a26d3f612b2ab5616c9ea4c19" +checksum = "7f03426bdadd9cc242192501dac96bf56e7300b40b8112c14aa5784697a63254" dependencies = [ "base64 0.22.1", "bincode", @@ -5322,7 +5321,7 @@ dependencies = [ "solana-compute-budget", "solana-measure", "solana-metrics", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-type-overrides", "solana-vote", "solana_rbpf", @@ -5331,9 +5330,9 @@ dependencies = [ [[package]] name = "solana-pubsub-client" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be61b8e62654303ba158764fb37b4706cc280c7cd239dc977edaf599dfb79875" +checksum = "ae1b21715e80019a0b7e7e24eb5e1309188488f5b836eb475682a9a5be6cfde0" dependencies = [ "crossbeam-channel", "futures-util", @@ -5345,7 +5344,7 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-rpc-client-api", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "tokio", "tokio-stream", @@ -5356,9 +5355,9 @@ dependencies = [ [[package]] name = "solana-quic-client" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bcf89e7ed0daabc4db107d6c38453bbd0ef84150f0acec760c65579361378cb" +checksum = "b36731edca01a316f722ab14f11b09864d88ca292c4703a8882312890525f3e3" dependencies = [ "async-mutex", "async-trait", @@ -5374,7 +5373,7 @@ dependencies = [ "solana-metrics", "solana-net-utils", "solana-rpc-client-api", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-streamer", "thiserror", "tokio", @@ -5382,9 +5381,9 @@ dependencies = [ [[package]] name = "solana-rayon-threadlimit" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45d6268135fcf812d9e9add2dff578b7ac8a0d003d6f95b996aec7a0311aad8e" +checksum = "19cc93c851adb3fdc326216a38e46877b568ff29cee1580964e399531441c9a0" dependencies = [ "lazy_static", "num_cpus", @@ -5392,9 +5391,9 @@ dependencies = [ [[package]] name = "solana-remote-wallet" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc12b8f2e668712995ae972c497663fdcb61f19b925029d104e19917b8d66428" +checksum = "eb379310edfad66a6ed80d1ba13ab7ebde4650e777b8e1753220b2c4cf851062" dependencies = [ "console", "dialoguer", @@ -5404,16 +5403,16 @@ dependencies = [ "parking_lot 0.12.3", "qstring", "semver", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "uriparse", ] [[package]] name = "solana-rpc" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5abe17aede48b76c20c6155b2d82272c45ed1f423f9c0396af5e82db1813f023" +checksum = "e1fdf4de065cd607d6c4277c18b80b090480a29282e9f2956cd4d12f123fcd40" dependencies = [ "base64 0.22.1", "bincode", @@ -5449,7 +5448,7 @@ dependencies = [ "solana-rayon-threadlimit", "solana-rpc-client-api", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-send-transaction-service", "solana-stake-program", "solana-storage-bigtable", @@ -5470,9 +5469,9 @@ dependencies = [ [[package]] name = "solana-rpc-client" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "846113929e8458f5dcb875d379cc28bdb9149ba68db80202b220795608bc3227" +checksum = "7c47b64bb84f058e667c29546d20ce98322247a5ed8df9b3178acaabd2c509e8" dependencies = [ "async-trait", "base64 0.22.1", @@ -5488,7 +5487,7 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-rpc-client-api", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-transaction-status", "solana-version", "solana-vote-program", @@ -5497,9 +5496,9 @@ dependencies = [ [[package]] name = "solana-rpc-client-api" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "272eb64c9baf966eccf4fa5c8ed9344fe162d2a13a2ac09cf2cd2b40a85a3a65" +checksum = "b9c8f8c19112479c4e8646a3ea6fcb604c460b38f8ae116590320c339734f8c9" dependencies = [ "anyhow", "base64 0.22.1", @@ -5513,7 +5512,7 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-inline-spl", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-transaction-status", "solana-version", "thiserror", @@ -5521,22 +5520,22 @@ dependencies = [ [[package]] name = "solana-rpc-client-nonce-utils" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23cf6f2875e47a5ac67b00dda4306646bb63ae5bb79ef408758cf1bad810497b" +checksum = "d235792bc2cdf4d5cfbd01719b1e40d1c5e7a240f21e7676380cf5e7649c0fa5" dependencies = [ "clap 2.34.0", "solana-clap-utils", "solana-rpc-client", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "solana-runtime" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a67288559196913f43abfef1b12820a1233a1e32038d0cfbcbf6ebf1ca6a2690" +checksum = "1b20caac931a7796f3faff30c117e31d9092c185fb67a808ded33644965f57a8" dependencies = [ "aquamarine", "arrayref", @@ -5590,7 +5589,7 @@ dependencies = [ "solana-perf", "solana-program-runtime", "solana-rayon-threadlimit", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-stake-program", "solana-svm", "solana-system-program", @@ -5614,9 +5613,9 @@ dependencies = [ [[package]] name = "solana-sdk" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62d86ef4a245cec35b7b0c24a659e22cc2d1fbbad65c141e332cc5928ed04dc" +checksum = "fc6b9c32d9748606fd2459bd189f04cacbc3ae0f4919229c810fc4c238ef1e50" dependencies = [ "bincode", "bitflags 2.6.0", @@ -5656,7 +5655,55 @@ dependencies = [ "sha3 0.10.8", "siphasher", "solana-program", - "solana-sdk-macro", + "solana-sdk-macro 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror", + "uriparse", + "wasm-bindgen", +] + +[[package]] +name = "solana-sdk" +version = "2.0.7" +source = "git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8#11b87c1ba32c1895898f2a17502417fccdf1a4c8" +dependencies = [ + "bincode", + "bitflags 2.6.0", + "borsh 1.5.1", + "bs58", + "bytemuck", + "bytemuck_derive", + "byteorder", + "chrono", + "derivation-path", + "digest 0.10.7", + "ed25519-dalek", + "ed25519-dalek-bip32", + "generic-array", + "getrandom 0.1.16", + "hmac 0.12.1", + "itertools 0.12.1", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "memmap2", + "num_enum", + "pbkdf2 0.11.0", + "qstring", + "rand 0.7.3", + "rand 0.8.5", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "serde_with", + "sha2 0.10.8", + "sha3 0.10.8", + "siphasher", + "solana-program", + "solana-sdk-macro 2.0.7 (git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8)", "thiserror", "uriparse", "wasm-bindgen", @@ -5664,9 +5711,21 @@ dependencies = [ [[package]] name = "solana-sdk-macro" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23198ed620c4a61c97fe49bd907fc965659aea9a5ed0ea0cf90084eecc72a3c1" +checksum = "8d9b401b1105318f89f73807fc9195cb41392639409cf629a7751487241d3171" +dependencies = [ + "bs58", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.77", +] + +[[package]] +name = "solana-sdk-macro" +version = "2.0.7" +source = "git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8#11b87c1ba32c1895898f2a17502417fccdf1a4c8" dependencies = [ "bs58", "proc-macro2", @@ -5683,9 +5742,9 @@ checksum = "468aa43b7edb1f9b7b7b686d5c3aeb6630dc1708e86e31343499dd5c4d775183" [[package]] name = "solana-send-transaction-service" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bcc119c009f557d68998f0075866b6918a1c904ab6fe53ee3c5233f175e8d2b" +checksum = "4d17669fea66931edf4452393b28ed48cd05915680b380603f00885bb4180c7b" dependencies = [ "crossbeam-channel", "log", @@ -5694,31 +5753,31 @@ dependencies = [ "solana-measure", "solana-metrics", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-tpu-client", ] [[package]] name = "solana-stake-program" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e798a6139a4fff4a84a93378d071873a643b2f76e0b7a38c878fc924ab1a219e" +checksum = "5c4077cc51aa7ce6e236640b2e3f48eacd128aff167cdcd499d081524ce0833c" dependencies = [ "bincode", "log", "rustc_version", "solana-config-program", "solana-program-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-type-overrides", "solana-vote-program", ] [[package]] name = "solana-storage-bigtable" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a112c72853a21c9654251fed110bda75f9d4f43373e96cd648d0a602c12f229" +checksum = "eb891d41f7a34ee472e882595faa783b497dd12725c80bd33134188fa15856f8" dependencies = [ "backoff", "bincode", @@ -5739,7 +5798,7 @@ dependencies = [ "serde_derive", "smpl_jwt", "solana-metrics", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-storage-proto", "solana-transaction-status", "thiserror", @@ -5750,9 +5809,9 @@ dependencies = [ [[package]] name = "solana-storage-proto" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ccf50865cb4f88aab23625ffa370ab32bcb4bb6cbf30057e07f9ea28f7bc5bc" +checksum = "a9d24b85f74f9f5dbff06fc12fc16c18101538356c7b433294956100cd128b85" dependencies = [ "bincode", "bs58", @@ -5760,16 +5819,16 @@ dependencies = [ "protobuf-src", "serde", "solana-account-decoder", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-transaction-status", "tonic-build", ] [[package]] name = "solana-streamer" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cef6776681796df95aeaacf5af2f017fd6e215579f6589ea67904bc384b4bcc" +checksum = "43b5205662601c8a61da72030f8b9e21f4e2d82df1a466776c2670773a8b5fa2" dependencies = [ "async-channel", "bytes", @@ -5792,7 +5851,7 @@ dependencies = [ "solana-measure", "solana-metrics", "solana-perf", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-transaction-metrics-tracker", "thiserror", "tokio", @@ -5801,9 +5860,9 @@ dependencies = [ [[package]] name = "solana-svm" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b237446f6485d7c3b3df5c8acb1dc69e6e3b3e4ebbdc17d7a7b7053bced48fa" +checksum = "d4c88e3aed439b66620c6f94da673499da74aeeb957312709e4b663a6ac8123a" dependencies = [ "itertools 0.12.1", "log", @@ -5819,7 +5878,7 @@ dependencies = [ "solana-measure", "solana-metrics", "solana-program-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-system-program", "solana-type-overrides", "solana-vote", @@ -5827,24 +5886,24 @@ dependencies = [ [[package]] name = "solana-system-program" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1ff7360fad80c1bf62e262e8ed312cf1ebc8838369a0d2c59004faf9f42cf4" +checksum = "8bea0579bdaf3009ae9009daeb5ca37b00653fdb9699d24c3c850d5a0b9666f6" dependencies = [ "bincode", "log", "serde", "serde_derive", "solana-program-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-type-overrides", ] [[package]] name = "solana-thin-client" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff07c0d23dd839eda4324a02c8634855bdd1f72c385f4466e5caf78e7a5e2a25" +checksum = "bdfb2c9130b1a88286f227258cecc1a33f748c01863381f5d955b73af357b348" dependencies = [ "bincode", "log", @@ -5852,14 +5911,14 @@ dependencies = [ "solana-connection-cache", "solana-rpc-client", "solana-rpc-client-api", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "solana-tpu-client" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce3b3fb075bd06f360c74d77816d3527dbf9bb2f2e89f9e0a52a55c06575871" +checksum = "6433d6e9648f7ef2819d0897843bf2ee0fb4fafb6b51ca4e9762ede8647aa12c" dependencies = [ "async-trait", "bincode", @@ -5874,16 +5933,16 @@ dependencies = [ "solana-pubsub-client", "solana-rpc-client", "solana-rpc-client-api", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", "tokio", ] [[package]] name = "solana-transaction-metrics-tracker" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23895b81f3cc9ebf1472609bd2ce75b9bdea0f89a0c3245d5c72df354a92a4d" +checksum = "0f531bee36a6a897c5aaccae87d72468fbc0d9fc1bc0610470d62a784812fb4b" dependencies = [ "Inflector", "base64 0.22.1", @@ -5892,14 +5951,14 @@ dependencies = [ "log", "rand 0.8.5", "solana-perf", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "solana-transaction-status" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4873ad4df45ef4f88b68982ac651caa93f489a4bfe62eedb2f59ea48da1df88e" +checksum = "15369ec10147118fe356fc637a63d21ab91cca3eb7f466bad94e9b8506f2d5ff" dependencies = [ "Inflector", "base64 0.22.1", @@ -5912,7 +5971,7 @@ dependencies = [ "serde_derive", "serde_json", "solana-account-decoder", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "spl-associated-token-account", "spl-memo", "spl-token", @@ -5924,9 +5983,9 @@ dependencies = [ [[package]] name = "solana-turbine" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38a51ee16213d8e3eba6147c517a53e7dee098ea99eb1e9d4909b1c7c02666ec" +checksum = "c5762d476e10f860df787d11135657b8e212bd6d8a35783df7d7514c6dd7c447" dependencies = [ "bincode", "bytes", @@ -5952,7 +6011,7 @@ dependencies = [ "solana-rpc", "solana-rpc-client-api", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-streamer", "static_assertions", "thiserror", @@ -5961,9 +6020,9 @@ dependencies = [ [[package]] name = "solana-type-overrides" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "540b1df966da86b0e183e124e48fef59605daf57b22809842b5273cb49277a89" +checksum = "ea285bb00ae9664c60f5d3eff7c3ecd4c0e16987628f86097bda91be25449878" dependencies = [ "lazy_static", "rand 0.8.5", @@ -5971,14 +6030,14 @@ dependencies = [ [[package]] name = "solana-udp-client" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91423aac2b1410e5f81faeb8cf655d63249d525761c4bd3f92a2c8e7641060bb" +checksum = "9c52a26edb7c5f79531cceecd287edcb2efed797f5b488b290d787bee762c918" dependencies = [ "async-trait", "solana-connection-cache", "solana-net-utils", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-streamer", "thiserror", "tokio", @@ -5986,20 +6045,20 @@ dependencies = [ [[package]] name = "solana-unified-scheduler-logic" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db48cba90b1beae183912571c58338aa2a2e86234230b0a4967f78315c1af959" +checksum = "1f0dd0e280d2321bb4316dc2679469542d1eeb4d0ab6f1e85e19a2fbb5c2e885" dependencies = [ "assert_matches", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions", ] [[package]] name = "solana-unified-scheduler-pool" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08bf62bbd56683b290956bf34ace666e6c142b2b98468691bcd3feef4f441934" +checksum = "6e2ff783873c0783f083adc1a195fc88e2603a48e2e76628b3a6661a8ccf2c58" dependencies = [ "assert_matches", "crossbeam-channel", @@ -6011,45 +6070,45 @@ dependencies = [ "solana-ledger", "solana-program-runtime", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-unified-scheduler-logic", "vec_extract_if_polyfill", ] [[package]] name = "solana-version" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfc990baf7a1c8d08eff49add6b971b6f4c37c8a2ae4967b4c4300475226e71c" +checksum = "b40c95471698d908ca7f24c6492741d05efe2285f94fca1594288c34cde50132" dependencies = [ "log", "rustc_version", "semver", "serde", "serde_derive", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "solana-vote" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5755419c8efaea27fd5fcd241ba43bcf248e7e420bb4733211236517ae93f38b" +checksum = "0b3d4c049e527f13a4f7fd56a9f298dc24307d3b9eb3babde3a1cfbd1ae6cd2d" dependencies = [ "itertools 0.12.1", "log", "rustc_version", "serde", "serde_derive", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "solana-vote-program" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8165c8bc37e34456f352715acb309eb65e014beca0297eaccdd4319dfea79981" +checksum = "170a1e52833fdba8196c88602b754f0c0e40316516ef7911515cba7e0db93011" dependencies = [ "bincode", "log", @@ -6061,15 +6120,15 @@ dependencies = [ "solana-metrics", "solana-program", "solana-program-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror", ] [[package]] name = "solana-wen-restart" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c957f15bd21e6f0da6cca2fe29c437550385333f5de1ff3098551d9dfa39db" +checksum = "c55e9162e36b98070edae32387f5b60939f7f836e9a9f9b388c136d317cc9ae0" dependencies = [ "anyhow", "log", @@ -6086,29 +6145,28 @@ dependencies = [ "solana-program", "solana-program-runtime", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-vote-program", ] [[package]] name = "solana-zk-elgamal-proof-program" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79bb28874614fc1dc33651401c049177c59d4a646b3ec0be64f27729e0a43d65" +checksum = "9fd026f37969652fb5138d59e8efb0a4d08eee1ef6ae4d016d1a7b76184729d5" dependencies = [ "bytemuck", "num-derive", "num-traits", "solana-program-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-zk-sdk", ] [[package]] name = "solana-zk-sdk" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b497ac230fa5ccc7509cfd99be56cb819b22b111cf57fc7e23eaf9e6ffcbb4fd" +version = "2.0.7" +source = "git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8#11b87c1ba32c1895898f2a17502417fccdf1a4c8" dependencies = [ "aes-gcm-siv", "base64 0.22.1", @@ -6127,7 +6185,7 @@ dependencies = [ "serde_json", "sha3 0.9.1", "solana-program", - "solana-sdk", + "solana-sdk 2.0.7 (git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8)", "subtle", "thiserror", "zeroize", @@ -6135,23 +6193,22 @@ dependencies = [ [[package]] name = "solana-zk-token-proof-program" -version = "2.0.8" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d420a69c1316116e01c67a0d75ebfaac3b119258e068c5313a1e064f63cab617" +checksum = "7c3974d7529d8cd1478e557f345cbc1732d49901c2e74e0f727c5c8aae4382de" dependencies = [ "bytemuck", "num-derive", "num-traits", "solana-program-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-zk-token-sdk", ] [[package]] name = "solana-zk-token-sdk" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b286fa24abe68536297e232670d01d2c478f6d75a46311809c0a07bf251f3dfc" +version = "2.0.7" +source = "git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8#11b87c1ba32c1895898f2a17502417fccdf1a4c8" dependencies = [ "aes-gcm-siv", "base64 0.22.1", @@ -6172,7 +6229,7 @@ dependencies = [ "sha3 0.9.1", "solana-curve25519", "solana-program", - "solana-sdk", + "solana-sdk 2.0.7 (git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8)", "subtle", "thiserror", "zeroize", @@ -6490,7 +6547,7 @@ dependencies = [ "hex", "igloo-interface", "log", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-svm", "svm-executor", ] @@ -6508,7 +6565,7 @@ dependencies = [ "solana-ledger", "solana-program-runtime", "solana-runtime", - "solana-sdk", + "solana-sdk 2.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "solana-svm", "solana-system-program", "thiserror", @@ -7661,23 +7718,3 @@ dependencies = [ "cc", "pkg-config", ] - -[[patch.unused]] -name = "solana-curve25519" -version = "2.0.7" -source = "git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8#11b87c1ba32c1895898f2a17502417fccdf1a4c8" - -[[patch.unused]] -name = "solana-program" -version = "2.0.7" -source = "git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8#11b87c1ba32c1895898f2a17502417fccdf1a4c8" - -[[patch.unused]] -name = "solana-zk-sdk" -version = "2.0.7" -source = "git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8#11b87c1ba32c1895898f2a17502417fccdf1a4c8" - -[[patch.unused]] -name = "solana-zk-token-sdk" -version = "2.0.7" -source = "git+https://github.com/anza-xyz/agave.git?rev=11b87c1ba32c1895898f2a17502417fccdf1a4c8#11b87c1ba32c1895898f2a17502417fccdf1a4c8" diff --git a/Cargo.toml b/Cargo.toml index 778cc76..fcba656 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ members = [ "storage", "svm/cli", "svm/executor", - "validator", + "verifier", ] resolver = "2" @@ -38,33 +38,37 @@ crossbeam-channel = "0.5.13" tempfile = "3.3.0" assert_matches = "1.5.0" -solana-bpf-loader-program = { version = "2.0.7" } -solana-compute-budget = { version = "2.0.7" } -solana-program-runtime = { version = "2.0.7" } -solana-sdk = { version = "2.0.7" } -solana-svm = { version = "2.0.7" } -solana-system-program = { version = "2.0.7" } -solana-logger = { version = "2.0.7" } -solana-test-validator = { version = "2.0.7" } -solana-ledger = { version = "2.0.7" } -solana-runtime = { version = "2.0.7" } -solana-entry = { version = "2.0.7" } -solana-accounts-db = { version = "2.0.7" } -solana-core = { version = "2.0.7" } -solana-stake-program = { version = "2.0.7" } -solana-measure = { version = "2.0.7" } -solana-gossip = { version = "2.0.7" } -solana-streamer = { version = "2.0.7" } -solana-rpc = { version = "2.0.7" } -solana-transaction-status = { version = "2.0.7" } -solana-account-decoder = { version = "2.0.7" } -solana-metrics = { version = "2.0.7" } +solana-bpf-loader-program = { version = "=2.0.7" } +solana-compute-budget = { version = "=2.0.7" } +solana-program-runtime = { version = "=2.0.7" } +solana-sdk = { version = "=2.0.7" } +solana-svm = { version = "=2.0.7" } +solana-system-program = { version = "=2.0.7" } +solana-logger = { version = "=2.0.7" } +solana-test-validator = { version = "=2.0.7" } +solana-ledger = { version = "=2.0.7" } +solana-runtime = { version = "=2.0.7" } +solana-entry = { version = "=2.0.7" } +solana-accounts-db = { version = "=2.0.7" } +solana-core = { version = "=2.0.7" } +solana-stake-program = { version = "=2.0.7" } +solana-measure = { version = "=2.0.7" } +solana-gossip = { version = "=2.0.7" } +solana-streamer = { version = "=2.0.7" } +solana-rpc = { version = "=2.0.7" } +solana-transaction-status = { version = "=2.0.7" } +solana-account-decoder = { version = "=2.0.7" } +solana-metrics = { version = "=2.0.7" } +solana-client = { version = "=2.0.7" } +solana-connection-cache = { version = "=2.0.7" } +solana-send-transaction-service = { version = "=2.0.7" } spl-token = "=6.0.0" spl-token-2022 = "=4.0.0" +async-trait = "0.1.80" igloo-interface = { path = "interface" } igloo-storage = { path = "storage" } -igloo-validator = { path = "validator" } +igloo-verifier = { path = "verifier" } svm-executor = { path = "svm/executor" } [patch.crates-io] diff --git a/executor/Cargo.toml b/executor/Cargo.toml index 224c71d..7d1396a 100644 --- a/executor/Cargo.toml +++ b/executor/Cargo.toml @@ -8,21 +8,21 @@ license.workspace = true edition.workspace = true [dependencies] -igloo-interface = { workspace = true } igloo-storage = { workspace = true } -igloo-validator = { workspace = true } +igloo-verifier = { workspace = true } tempfile = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true } log = { workspace = true } crossbeam-channel = { workspace = true } +async-trait = { workspace = true } solana-ledger = { workspace = true } solana-accounts-db = { workspace = true } solana-sdk = { workspace = true } solana-svm = { workspace = true } -solana-runtime = { workspace = true } +solana-runtime = { workspace = true, features = ["dev-context-only-utils"] } solana-core = { workspace = true } [dev-dependencies] diff --git a/executor/src/defs.rs b/executor/src/defs.rs deleted file mode 100644 index 80a5a71..0000000 --- a/executor/src/defs.rs +++ /dev/null @@ -1,5 +0,0 @@ -use solana_sdk::transaction::SanitizedTransaction; - -pub struct BlockPayload { - pub transactions: Vec, -} diff --git a/executor/src/engine/mod.rs b/executor/src/engine/mod.rs deleted file mode 100644 index 550fde4..0000000 --- a/executor/src/engine/mod.rs +++ /dev/null @@ -1,113 +0,0 @@ -use crate::{ - defs::BlockPayload, - processor::{bank::BankProcessor, Processor}, - Result, -}; -use igloo_interface::l2::{bank::BankOperations, storage::StorageOperations}; -use igloo_storage::{ - blockstore::txs::CommitBatch, config::GlobalConfig, ledger::SlotInfo, RollupStorage, -}; -use igloo_validator::{ - settings::{Settings, Switchs}, - BankValidator, TransactionChecks, -}; -use solana_sdk::clock::Slot; -use std::{borrow::Cow, path::Path}; - -pub mod storage; - -pub struct Engine { - storage: RollupStorage, - finalized: Slot, - validator_settings: Settings, -} - -impl Engine { - pub fn new(ledger_path: &Path) -> Result { - let mut config = GlobalConfig::new(ledger_path)?; - config.keypairs.set_default_path(ledger_path); - Self::new_with_config(config) - } - - pub fn new_for_test(ledger_path: &Path) -> Result { - let config = GlobalConfig::new_temp(&ledger_path)?; - Self::new_with_config(config) - } - - pub fn new_with_config(config: GlobalConfig) -> Result { - let settings = Settings { - max_age: 150, // set default max_age from solana - switchs: Switchs { - tx_sanity_check: true, - txs_conflict_check: true, - }, - }; - Self::new_with_validator_settings(config, settings) - } - - pub fn new_with_validator_settings( - config: GlobalConfig, - validator_settings: Settings, - ) -> Result { - let mut storage = RollupStorage::new(config)?; - storage.init()?; - - let finalized = storage.get_root(); - Ok(Self { - storage, - finalized, - validator_settings, - }) - } - - pub async fn close(self) -> Result<()> { - self.storage.close().await?; - Ok(()) - } - - /// Check the block before processing - pub fn check_block(&self, block: &BlockPayload, settins: Option) -> Result<()> { - let switchs = settins.unwrap_or(self.validator_settings.switchs.clone()); - let validator = BankValidator::new(self.storage.current_bank(), Default::default()); - if switchs.tx_sanity_check { - validator.transactions_sanity_check(&block.transactions)?; - } - if switchs.txs_conflict_check { - validator.transactions_conflict_check(&block.transactions)?; - } - Ok(()) - } - - pub async fn new_block(&mut self, block: BlockPayload) -> Result { - self.storage.bump()?; - - let processor = - BankProcessor::new(self.storage.current_bank(), self.validator_settings.clone()); - let results = processor.process(Cow::Borrowed(&block.transactions))?; - self.storage - .commit( - results.into(), - CommitBatch::new(Cow::Borrowed(&block.transactions)), - ) - .await?; - - let info = self.storage.get_slot_info(self.storage.current_height())?; - info!("New block: {:?}", info); - Ok(info) - } - - pub fn confirm(&mut self, block: Slot) -> Result<()> { - self.storage.confirm(block)?; - Ok(()) - } - - pub fn reorg(&mut self, reset_to: Slot) -> Result<()> { - self.storage.reorg(reset_to, Some(self.finalized))?; - Ok(()) - } - - pub fn finalize(&mut self, block: Slot) -> Result<()> { - self.storage.set_root(block, None)?; - Ok(()) - } -} diff --git a/executor/src/engine/storage.rs b/executor/src/engine/storage.rs deleted file mode 100644 index 54a974c..0000000 --- a/executor/src/engine/storage.rs +++ /dev/null @@ -1,9 +0,0 @@ -use igloo_storage::RollupStorage; - -use super::Engine; - -impl Engine { - pub fn store(&self) -> &RollupStorage { - &self.storage - } -} diff --git a/executor/src/error.rs b/executor/src/error.rs index db24837..5bc6a1c 100644 --- a/executor/src/error.rs +++ b/executor/src/error.rs @@ -4,9 +4,18 @@ pub type Result = std::result::Result; #[derive(Debug, Error)] pub enum Error { + #[error("Storage is none")] + StorageIsNone, + + #[error("Fetch stream batch error: {0}")] + FetchStreamBatchError(String), + #[error(transparent)] StorageError(#[from] igloo_storage::Error), #[error(transparent)] - ValidatorError(#[from] igloo_validator::Error), + ValidatorError(#[from] igloo_verifier::Error), + + #[error("Storage query error: {0}")] + StorageQueryError(String), } diff --git a/executor/src/lib.rs b/executor/src/lib.rs index 7d0a24f..e7670fa 100644 --- a/executor/src/lib.rs +++ b/executor/src/lib.rs @@ -1,14 +1,177 @@ -pub mod defs; -pub mod engine; +use crate::processor::TransactionProcessor; +use async_trait::async_trait; +use igloo_storage::execution::TransactionsResultWrapper; +use igloo_storage::{ + blockstore::txs::CommitBatch, config::GlobalConfig, ledger::SlotInfo, RollupStorage, +}; +use igloo_verifier::{ + settings::{Settings, Switchs}, + BankVerifier, +}; +use solana_sdk::{clock::Slot, fee::FeeStructure, transaction::SanitizedTransaction}; +use std::{ + borrow::Cow, + fmt::{Debug, Display}, + path::Path, +}; + pub mod error; pub mod processor; #[cfg(test)] mod tests; -pub use { - engine::Engine, - error::{Error, Result}, -}; +pub use error::{Error, Result}; + +#[async_trait] +pub trait StreamOperator { + type Error: Display; + async fn next_batch(&self) -> std::result::Result, Self::Error>; +} + +pub type SanitizedTransactions = Vec; + +#[derive(Clone, Default)] +pub struct BlockPayload { + pub transactions: Vec, +} + +#[derive(Default)] +pub struct Executor { + storage: Option, + finalized: Slot, + validator_settings: Settings, +} + +impl Debug for Executor { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Engine") + .field("finalized", &self.finalized) + .field("validator_settings", &self.validator_settings) + .finish() + } +} + +impl Executor { + pub fn new_for_test(ledger_path: &Path) -> Result { + let config = GlobalConfig::new_temp(ledger_path)?; + Self::new_with_config(config) + } + + pub fn new_with_config(config: GlobalConfig) -> Result { + let settings = Settings { + max_age: 150, // set default max_age from solana + switchs: Switchs { + tx_sanity_check: true, + txs_conflict_check: true, + }, + fee_structure: FeeStructure::new(0.0000005, 0.0, vec![(1_400_000, 0.0)]), + }; + Self::new_with_validator_settings(config, settings) + } + + pub fn new_with_validator_settings( + config: GlobalConfig, + validator_settings: Settings, + ) -> Result { + let mut storage = RollupStorage::new(config)?; + storage.init()?; + + let finalized = storage.get_root(); + Ok(Self { + storage: Some(storage), + finalized, + validator_settings, + }) + } + + pub async fn close(self) -> Result<()> { + self.storage.ok_or(Error::StorageIsNone)?.close().await?; + Ok(()) + } + + /// Check the block before processing + pub fn check_block(&self, block: &BlockPayload, settins: Option) -> Result<()> { + let switchs = settins.unwrap_or(self.validator_settings.switchs.clone()); + let validator = BankVerifier::new(self.storage()?.current_bank(), Default::default()); + if switchs.tx_sanity_check { + for txs in block.transactions.iter() { + validator.transactions_sanity_check(txs)?; + } + } + if switchs.txs_conflict_check { + for txs in block.transactions.iter() { + validator.transactions_conflict_check(txs)?; + } + } + Ok(()) + } + + pub async fn new_block(&mut self, block: BlockPayload) -> Result { + self.storage_mut()?.bump()?; + + let processor = TransactionProcessor::new( + self.storage()?.current_bank(), + self.validator_settings.clone(), + ); + let mut results = vec![]; + let mut origin_txs = vec![]; + for transactions in block.transactions.iter() { + let result: TransactionsResultWrapper = + processor.process(Cow::Borrowed(transactions))?.into(); + results.push(result); + origin_txs.push(CommitBatch::new(Cow::Borrowed(transactions))); + } + self.storage_mut()?.commit(results, origin_txs).await?; + + let current = self.storage()?.current_height(); + self.storage_mut()?.confirm(current)?; + let info = self + .storage()? + .get_slot_info(self.storage()?.current_height())?; + Ok(info) + } + + pub fn reorg(&mut self, reset_to: Slot) -> Result<()> { + let finalized = Some(self.finalized); + self.storage_mut()?.reorg(reset_to, finalized)?; + Ok(()) + } + + pub fn finalize(&mut self, block: Slot) -> Result<()> { + self.storage_mut()?.set_root(block, None)?; + Ok(()) + } + + pub fn storage(&self) -> Result<&RollupStorage> { + self.storage.as_ref().ok_or(Error::StorageIsNone) + } + + pub fn storage_mut(&mut self) -> Result<&mut RollupStorage> { + self.storage.as_mut().ok_or(Error::StorageIsNone) + } +} + +impl BlockPayload { + pub fn new(transactions: Vec) -> Self { + Self { + transactions: vec![transactions], + } + } + + pub fn new_with_batches(batches: Vec) -> Self { + Self { + transactions: batches, + } + } -#[macro_use] -extern crate log; + /// Extends the block with stream + pub async fn extend_with(&mut self, stream: &S) -> Result<()> { + self.transactions.extend( + stream + .next_batch() + .await + .map_err(|e| Error::FetchStreamBatchError(e.to_string()))?, + ); + Ok(()) + } +} diff --git a/executor/src/processor/bank.rs b/executor/src/processor.rs similarity index 79% rename from executor/src/processor/bank.rs rename to executor/src/processor.rs index df39323..ea87460 100644 --- a/executor/src/processor/bank.rs +++ b/executor/src/processor.rs @@ -1,6 +1,6 @@ -use super::Processor; use crate::Result; -use igloo_validator::{settings::Settings, BankValidator, SvmValidator}; +use igloo_verifier::settings::Settings; +use igloo_verifier::BankVerifier; use solana_runtime::bank::Bank; use solana_sdk::transaction::SanitizedTransaction; use solana_svm::transaction_processor::{ @@ -9,37 +9,36 @@ use solana_svm::transaction_processor::{ }; use std::{borrow::Cow, sync::Arc}; -pub struct BankProcessor { +pub struct TransactionProcessor { bank: Arc, settings: Settings, } -impl Processor for BankProcessor { - fn process<'a>( +impl TransactionProcessor { + pub fn new(bank: Arc, settings: Settings) -> Self { + Self { bank, settings } + } + + pub fn process( &self, - transactions: Cow<'a, [SanitizedTransaction]>, + transactions: Cow<[SanitizedTransaction]>, ) -> Result { - let validator = BankValidator::new(self.bank.clone(), self.settings.clone()); - let result = validator.get_batch_results(transactions.clone()); + // TODO: There are some bug in `BankVerifier`, we need to fix it in future + let validator = BankVerifier::new(self.bank.clone(), self.settings.clone()); + let results = validator.get_batch_results(transactions.clone()); // use the bank's transaction processor to process the transactions let transaction_processor = self.bank.get_transaction_processor(); let output = transaction_processor.load_and_execute_sanitized_transactions( self.bank.as_ref(), &transactions, - result, + results, &self.environment(), &self.processing_config(), ); Ok(output) } -} - -impl BankProcessor { - pub fn new(bank: Arc, settings: Settings) -> Self { - Self { bank, settings } - } fn environment(&self) -> TransactionProcessingEnvironment { let (blockhash, lamports_per_signature) = @@ -49,7 +48,7 @@ impl BankProcessor { epoch_total_stake: self.bank.epoch_total_stake(self.bank.epoch()), epoch_vote_accounts: self.bank.epoch_vote_accounts(self.bank.epoch()), feature_set: Arc::clone(&self.bank.feature_set), - fee_structure: Some(self.bank.fee_structure()), + fee_structure: Some(&self.settings.fee_structure), lamports_per_signature, rent_collector: Some(self.bank.rent_collector()), }; diff --git a/executor/src/processor/mod.rs b/executor/src/processor/mod.rs deleted file mode 100644 index b3da0a5..0000000 --- a/executor/src/processor/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -use crate::Result; -use solana_sdk::transaction::SanitizedTransaction; -use solana_svm::transaction_processor::LoadAndExecuteSanitizedTransactionsOutput; -use std::borrow::Cow; - -pub mod bank; - -pub trait Processor { - fn process<'a>( - &self, - transactions: Cow<'a, [SanitizedTransaction]>, - ) -> Result; -} diff --git a/executor/src/tests/basic.rs b/executor/src/tests.rs similarity index 51% rename from executor/src/tests/basic.rs rename to executor/src/tests.rs index b8d0646..cfdd840 100644 --- a/executor/src/tests/basic.rs +++ b/executor/src/tests.rs @@ -7,13 +7,13 @@ use solana_sdk::{ signature::Keypair, signer::Signer, system_transaction, transaction::SanitizedTransaction, }; -use crate::{defs::BlockPayload, Engine}; +use crate::{BlockPayload, Error, Executor}; #[tokio::test] async fn engine_basic_process_works() -> Result<()> { let ledger_path = tempfile::tempdir()?.into_path(); - let mut engine = Engine::new_for_test(&ledger_path)?; - let keypairs = engine.store().keypairs().clone(); + let mut engine = Executor::new_for_test(&ledger_path)?; + let keypairs = engine.storage()?.keypairs().clone(); let alice = keypairs.mint_keypair.as_ref().unwrap().clone(); let bob = keypairs.validator_keypair.as_ref().unwrap().clone(); @@ -22,10 +22,13 @@ async fn engine_basic_process_works() -> Result<()> { const ALICE_INIT_BALANCE: u64 = DEFAULT_MINT_LAMPORTS; const BOB_INIT_BALANCE: u64 = DEFAULT_VALIDATOR_LAMPORTS; - assert_eq!(engine.store().balance(&alice.pubkey()), ALICE_INIT_BALANCE); - assert_eq!(engine.store().balance(&bob.pubkey()), BOB_INIT_BALANCE); - assert_eq!(engine.store().balance(&charlie), 0); - assert_eq!(engine.store().balance(&dave), 0); + assert_eq!( + engine.storage()?.balance(&alice.pubkey()), + ALICE_INIT_BALANCE + ); + assert_eq!(engine.storage()?.balance(&bob.pubkey()), BOB_INIT_BALANCE); + assert_eq!(engine.storage()?.balance(&charlie), 0); + assert_eq!(engine.storage()?.balance(&dave), 0); const TO_CHARLIE: u64 = 2000000; const TO_DAVE: u64 = 1000000; @@ -35,21 +38,21 @@ async fn engine_basic_process_works() -> Result<()> { &alice, &charlie, TO_CHARLIE, - engine.store().current_bank().last_blockhash(), + engine.storage()?.current_bank().last_blockhash(), ), system_transaction::transfer( &bob, &dave, TO_DAVE, - engine.store().current_bank().last_blockhash(), + engine.storage()?.current_bank().last_blockhash(), ), ]; let block_payload = BlockPayload { - transactions: raw_txs + transactions: vec![raw_txs .clone() .into_iter() - .map(|tx| SanitizedTransaction::from_transaction_for_tests(tx)) - .collect::>(), + .map(SanitizedTransaction::from_transaction_for_tests) + .collect::>()], }; // we can check block before processing @@ -62,39 +65,59 @@ async fn engine_basic_process_works() -> Result<()> { // after commit new block balance changed assert_eq!( - engine.store().balance(&alice.pubkey()), + engine.storage()?.balance(&alice.pubkey()), ALICE_INIT_BALANCE - TO_CHARLIE ); assert_eq!( - engine.store().balance(&bob.pubkey()), + engine.storage()?.balance(&bob.pubkey()), BOB_INIT_BALANCE - TO_DAVE ); - assert_eq!(engine.store().balance(&charlie), TO_CHARLIE); - assert_eq!(engine.store().balance(&dave), TO_DAVE); + assert_eq!(engine.storage()?.balance(&charlie), TO_CHARLIE); + assert_eq!(engine.storage()?.balance(&dave), TO_DAVE); // save and close - engine.confirm(info.head.slot)?; engine.close().await?; // open again let mut config = GlobalConfig::new(&ledger_path)?; config.keypairs = keypairs; - let engine = Engine::new_with_config(config)?; + let engine = Executor::new_with_config(config)?; - let (bank_height, store_height) = engine.store().get_mixed_heights()?; + let (bank_height, store_height) = engine.storage()?.get_mixed_heights()?; assert_eq!(bank_height, 1); assert_eq!(store_height, Some(1)); assert_eq!( - engine.store().balance(&alice.pubkey()), + engine.storage()?.balance(&alice.pubkey()), ALICE_INIT_BALANCE - TO_CHARLIE ); assert_eq!( - engine.store().balance(&bob.pubkey()), + engine.storage()?.balance(&bob.pubkey()), BOB_INIT_BALANCE - TO_DAVE ); - assert_eq!(engine.store().balance(&charlie), TO_CHARLIE); - assert_eq!(engine.store().balance(&dave), TO_DAVE); + assert_eq!(engine.storage()?.balance(&charlie), TO_CHARLIE); + assert_eq!(engine.storage()?.balance(&dave), TO_DAVE); engine.close().await?; Ok(()) } + +#[tokio::test] +async fn commit_empty_block_should_fail() -> Result<()> { + let ledger_path = tempfile::tempdir()?.into_path(); + let mut engine = Executor::new_for_test(&ledger_path)?; + + let block_payload = BlockPayload { + transactions: vec![], + }; + + // we can check block before processing + assert!(engine.check_block(&block_payload, None).is_ok()); + + let result = engine.new_block(block_payload).await; + assert!(matches!( + result, + Err(Error::StorageError(igloo_storage::Error::NoEntries)) + )); + + Ok(()) +} diff --git a/executor/src/tests/mod.rs b/executor/src/tests/mod.rs deleted file mode 100644 index 1bca5f8..0000000 --- a/executor/src/tests/mod.rs +++ /dev/null @@ -1 +0,0 @@ -mod basic; diff --git a/scripts/genesis.sh b/scripts/genesis.sh index 0fe2b73..a173d78 100755 --- a/scripts/genesis.sh +++ b/scripts/genesis.sh @@ -28,7 +28,7 @@ export RUST_BACKTRACE=1 dataDir=$BASE_DIR/"$(basename "$0" .sh)" ledgerDir=$BASE_DIR/ledger -SOON_RUN_SH_CLUSTER_TYPE=${SOON_RUN_SH_CLUSTER_TYPE:-development} +igloo_RUN_SH_CLUSTER_TYPE=${igloo_RUN_SH_CLUSTER_TYPE:-development} if ! solana address; then echo Generating default keypair @@ -61,4 +61,4 @@ solana-genesis \ "$validator_vote_account" \ "$validator_stake_account" \ --ledger "$ledgerDir" \ - --cluster-type "$SOON_RUN_SH_CLUSTER_TYPE" + --cluster-type "$igloo_RUN_SH_CLUSTER_TYPE" diff --git a/storage/Cargo.toml b/storage/Cargo.toml index a2d4bf8..f73a031 100644 --- a/storage/Cargo.toml +++ b/storage/Cargo.toml @@ -16,6 +16,7 @@ crossbeam-channel = { workspace = true } rand = { workspace = true } assert_matches = { workspace = true } +solana-client = { workspace = true } solana-ledger = { workspace = true } solana-accounts-db = { workspace = true } solana-sdk = { workspace = true } @@ -28,14 +29,14 @@ solana-measure = { workspace = true } solana-gossip = { workspace = true } solana-streamer = { workspace = true } solana-rpc = { workspace = true } +solana-send-transaction-service = { workspace = true } solana-transaction-status = { workspace = true } solana-account-decoder = { workspace = true } solana-metrics = { workspace = true } +solana-connection-cache = { workspace = true } spl-token = { workspace = true } spl-token-2022 = { workspace = true } -igloo-interface = { workspace = true } - [dev-dependencies] anyhow = { workspace = true } svm-executor = { workspace = true } @@ -44,3 +45,4 @@ solana-compute-budget = { workspace = true } solana-bpf-loader-program = { workspace = true } solana-system-program = { workspace = true } solana-program-runtime = { workspace = true } +tokio = { workspace = true, features = ["full"] } diff --git a/storage/src/accounts/mod.rs b/storage/src/accounts/mod.rs index e808a01..42d4bed 100644 --- a/storage/src/accounts/mod.rs +++ b/storage/src/accounts/mod.rs @@ -1,4 +1,3 @@ -use igloo_interface::l2::{bank::BankInfo, storage::TransactionSet}; use solana_entry::entry::Entry; use solana_runtime::{ bank::{Bank, ExecutedTransactionCounts, NewBankOptions, TotalAccountsStats}, @@ -10,7 +9,7 @@ use solana_sdk::{ account::{AccountSharedData, ReadableAccount}, clock::Slot, pubkey::Pubkey, - transaction::SanitizedTransaction, + transaction::{SanitizedTransaction, VersionedTransaction}, }; use solana_svm::{ transaction_processor::LoadAndExecuteSanitizedTransactionsOutput, @@ -22,7 +21,7 @@ use crate::{ blockstore::txs::CommitBatch, error::{AccountDbError, BankError}, execution::TransactionsResultWrapper, - Result, RollupStorage, + BankInfo, Result, RollupStorage, }; #[cfg(test)] @@ -69,8 +68,8 @@ impl RollupStorage { &ledger_path, &bank, None, - &ledger_path.join("full"), - &ledger_path.join("incremental"), + ledger_path.join("full"), + ledger_path.join("incremental"), ArchiveFormat::from_cli_arg("zstd") .ok_or(BankError::Common("Unsupported archive format".to_string()))?, ) @@ -105,10 +104,30 @@ impl RollupStorage { } pub(crate) fn bank_commit( + &mut self, + results: Vec, + batches: Vec, + entries: &[Entry], + ) -> Result> { + let mut rtn = vec![]; + for (result, batch) in results.into_iter().zip(batches) { + let result = if self.enable_history() { + self.single_batch_commit_with_history(result, batch)? + } else { + self.single_batch_commit(result, &batch)? + }; + + rtn.push(result); + } + + self.register_ticks(entries)?; + Ok(rtn) + } + + pub(crate) fn single_batch_commit( &mut self, mut result: TransactionsResultWrapper, batch: &CommitBatch, - entries: &[Entry], ) -> Result { // In order to avoid a race condition, leaders must get the last // blockhash *before* recording transactions because recording @@ -124,23 +143,42 @@ impl RollupStorage { let result = self.bank.commit_transactions( batch.transactions(), &mut result.output.loaded_transactions, - result.output.execution_results, + result.output.execution_results.clone(), last_blockhash, lamports_per_signature, counts, &mut result.output.execute_timings, ); - self.register_ticks(entries)?; Ok(result) } + pub fn to_sanitized_transaction( + &self, + tx: VersionedTransaction, + verify: bool, + ) -> Result { + let message_hash = if verify { + tx.verify_and_hash_message() + .map_err(|e| AccountDbError::ConvertTxError(e.to_string()))? + } else { + tx.message.hash() + }; + SanitizedTransaction::try_create( + tx, + message_hash, + None, + self.bank.as_ref(), + self.bank.get_reserved_account_keys(), + ) + .map_err(|e| AccountDbError::ConvertTxError(e.to_string()).into()) + } + fn register_ticks(&self, entries: &[Entry]) -> Result<()> { let fork = self.bank_forks.read().unwrap(); let bank_with_schedule = fork.working_bank_with_scheduler(); - // Skip the first tick because it's the entry that contains transactions - entries.iter().skip(1).for_each(|entry| { + entries.iter().filter(|e| e.is_tick()).for_each(|entry| { bank_with_schedule.register_tick(&entry.hash); }); @@ -149,15 +187,40 @@ impl RollupStorage { fn collect_execution_logs( &mut self, - _sanitized_output: &LoadAndExecuteSanitizedTransactionsOutput, - _sanitized_txs: &[SanitizedTransaction], + sanitized_output: &LoadAndExecuteSanitizedTransactionsOutput, + sanitized_txs: &[SanitizedTransaction], ) -> ExecutedTransactionCounts { - // TODO: implement me + let mut signature_count: u64 = 0; + let mut executed_transactions_count: u64 = 0; + let mut executed_non_vote_transactions_count: u64 = 0; + let mut executed_with_failure_result_count: u64 = 0; + for (execution_result, tx) in sanitized_output + .execution_results + .iter() + .zip(sanitized_txs.as_ref()) + { + if execution_result.was_executed() { + // Signature count must be accumulated only if the transaction + // is executed, otherwise a mismatched count between banking and + // replay could occur + signature_count += u64::from(tx.message().header().num_required_signatures); + executed_transactions_count += 1; + + if !tx.is_simple_vote_transaction() { + executed_non_vote_transactions_count += 1; + } + } + + if execution_result.flattened_result().is_err() { + executed_with_failure_result_count += 1; + } + } + ExecutedTransactionCounts { - executed_transactions_count: 0, - executed_non_vote_transactions_count: 0, - executed_with_failure_result_count: 0, - signature_count: 0, + executed_transactions_count, + executed_non_vote_transactions_count, + executed_with_failure_result_count, + signature_count, } } diff --git a/storage/src/accounts/tests.rs b/storage/src/accounts/tests.rs index 208258e..edc1d00 100644 --- a/storage/src/accounts/tests.rs +++ b/storage/src/accounts/tests.rs @@ -1,5 +1,4 @@ use anyhow::Result; -use igloo_interface::l2::{bank::BankOperations, storage::StorageOperations}; use solana_accounts_db::{ accounts_db::{self, ACCOUNTS_DB_CONFIG_FOR_TESTING}, accounts_index::AccountSecondaryIndexes, @@ -68,15 +67,15 @@ async fn init_from_snapshot_works() -> Result<()> { let origin_txs = raw_txs .clone() .into_iter() - .map(|tx| SanitizedTransaction::from_transaction_for_tests(tx)) + .map(SanitizedTransaction::from_transaction_for_tests) .collect::>(); let results = process_transfers_ex(&store, origin_txs.clone()); // 2. commit store .commit( - TransactionsResultWrapper { output: results }, - CommitBatch::new(origin_txs.clone().into()), + vec![TransactionsResultWrapper { output: results }], + vec![CommitBatch::new(origin_txs.clone().into())], ) .await?; diff --git a/storage/src/background.rs b/storage/src/background.rs index f4bebc5..4724d16 100644 --- a/storage/src/background.rs +++ b/storage/src/background.rs @@ -132,10 +132,9 @@ impl StorageBackground { accounts_package_sender, }; let pruned_banks_request_handler = PrunedBanksRequestHandler { - pruned_banks_receiver: hub - .pruned_banks_receiver - .take() - .ok_or(Error::InitCommon(format!("pruned banks receiver is None")))?, + pruned_banks_receiver: hub.pruned_banks_receiver.take().ok_or(Error::InitCommon( + "pruned banks receiver is None".to_string(), + ))?, }; let last_full_snapshot_slot = starting_snapshot_hashes.map(|x| x.full.0 .0); diff --git a/storage/src/blockstore/mod.rs b/storage/src/blockstore/mod.rs index cbec71e..9353d39 100644 --- a/storage/src/blockstore/mod.rs +++ b/storage/src/blockstore/mod.rs @@ -11,6 +11,10 @@ pub mod txs; const DEFAULT_NUM_HASHES: u64 = 2; impl RollupStorage { + pub fn get_storage_root(&self) -> u64 { + self.blockstore.max_root() + } + pub(crate) fn aligne_blockstore_with_bank_forks(&self) -> Result<()> { blockstore_processor::process_blockstore_from_root( &self.blockstore, @@ -57,20 +61,31 @@ impl RollupStorage { ) } - pub(crate) fn transactions_to_entries( + pub(crate) fn transactions_to_entry( &self, transactions: Vec, - ) -> Result> { - let mut start_hash = self - .bank - .parent() - .ok_or(BankError::BankNotExists(self.bank.parent_slot()))? - .last_blockhash(); - let entry = self.new_entry(&start_hash, DEFAULT_NUM_HASHES, transactions); - start_hash = entry.hash; + start_hash: Option, + ) -> Result { + let start_hash = match start_hash { + Some(start_hash) => start_hash, + None => self + .bank + .parent() + .ok_or(BankError::BankNotExists(self.bank.parent_slot()))? + .last_blockhash(), + }; + Ok(self.new_entry(&start_hash, DEFAULT_NUM_HASHES, transactions)) + } + + pub(crate) fn complete_entries(&self, data_entries: Vec) -> Result> { + let last_entry = data_entries.last().ok_or(Error::NoEntries)?; + let mut start_hash = last_entry.hash; + + let tick_count = self.config.genesis.ticks_per_slot + - data_entries.iter().filter(|entry| entry.is_tick()).count() as u64; - let mut entries = vec![entry]; - for _ in 0..self.config.genesis.ticks_per_slot { + let mut entries = data_entries; + for _ in 0..tick_count { let entry = self.new_entry(&start_hash, DEFAULT_NUM_HASHES, vec![]); start_hash = entry.hash; entries.push(entry); diff --git a/storage/src/blockstore/process.rs b/storage/src/blockstore/process.rs index 0c14dec..e07c75d 100644 --- a/storage/src/blockstore/process.rs +++ b/storage/src/blockstore/process.rs @@ -89,6 +89,7 @@ impl EntriesProcessor { Ok((data_shreds, coding_shreds)) } + #[allow(clippy::too_many_arguments)] fn entries_to_shreds( &mut self, keypair: &Keypair, @@ -173,9 +174,9 @@ fn get_chained_merkle_root_from_parent( debug_assert!(parent < slot, "parent: {parent} >= slot: {slot}"); let index = blockstore .meta(parent)? - .ok_or_else(|| StorageError::UnknownSlotMeta(parent))? + .ok_or(StorageError::UnknownSlotMeta(parent))? .last_index - .ok_or_else(|| StorageError::UnknownLastIndex(parent))?; + .ok_or(StorageError::UnknownLastIndex(parent))?; let shred = blockstore .get_data_shred(parent, index)? .ok_or(StorageError::ShredNotFound { diff --git a/storage/src/blockstore/txs.rs b/storage/src/blockstore/txs.rs index 94a4852..ae96405 100644 --- a/storage/src/blockstore/txs.rs +++ b/storage/src/blockstore/txs.rs @@ -1,4 +1,3 @@ -use igloo_interface::l2::storage::TransactionSet; use solana_account_decoder::{ parse_account_data::SplTokenAdditionalData, parse_token::{is_known_spl_token_id, token_amount_to_ui_amount_v2, UiTokenAmount}, @@ -25,7 +24,7 @@ struct TokenBalanceData { } pub struct CommitBatch<'a> { - sanitized_txs: Cow<'a, [SanitizedTransaction]>, + pub sanitized_txs: Cow<'a, [SanitizedTransaction]>, mint_decimals: HashMap, pub transaction_indexes: Vec, } @@ -50,6 +49,10 @@ impl<'a> CommitBatch<'a> { } } + pub fn transactions(&self) -> &[SanitizedTransaction] { + &self.sanitized_txs + } + pub fn collect_balances(&self, bank: Arc) -> TransactionBalances { let mut balances: TransactionBalances = vec![]; for transaction in self.transactions() { @@ -165,11 +168,3 @@ fn get_mint_decimals(bank: &Bank, mint: &Pubkey) -> Option { Some(decimals) } } - -impl<'a> TransactionSet for CommitBatch<'a> { - type Transaction = SanitizedTransaction; - - fn transactions(&self) -> &[Self::Transaction] { - &self.sanitized_txs - } -} diff --git a/storage/src/config.rs b/storage/src/config.rs index f5c963e..8569505 100644 --- a/storage/src/config.rs +++ b/storage/src/config.rs @@ -5,7 +5,6 @@ use std::{ time::Duration, }; -use igloo_interface::l2::executor::Config; use solana_accounts_db::{ accounts_db::{AccountShrinkThreshold, AccountsDbConfig}, accounts_index::AccountSecondaryIndexes, @@ -52,8 +51,6 @@ impl RollupStorage { } } -impl Config for GlobalConfig {} - impl GlobalConfig { pub fn new(ledger_path: &Path) -> Result { let storage = init_config(ledger_path)?; @@ -66,7 +63,7 @@ impl GlobalConfig { } pub fn new_temp(ledger_path: &Path) -> Result { - let storage = init_config(&ledger_path)?; + let storage = init_config(ledger_path)?; Ok(Self { ledger_path: ledger_path.to_path_buf(), storage, @@ -76,7 +73,7 @@ impl GlobalConfig { } pub fn new_dev(ledger_path: &Path) -> Result { - let storage = init_config(&ledger_path)?; + let storage = init_config(ledger_path)?; Ok(Self { ledger_path: ledger_path.to_path_buf(), storage, @@ -164,11 +161,11 @@ impl Default for HistoryConfig { impl KeypairsConfig { pub fn set_default_path(&mut self, base: &Path) { self.validator_key_path - .get_or_insert(base.join("../genesis/validator-identity.json")); + .get_or_insert(base.join("validator-identity.json")); self.mint_key_path - .get_or_insert(base.join("../genesis/validator-stake-account.json")); + .get_or_insert(base.join("validator-stake-account.json")); self.voting_key_path - .get_or_insert(base.join("../genesis/validator-vote-account.json")); + .get_or_insert(base.join("validator-vote-account.json")); } pub fn init(&mut self) -> crate::Result<()> { diff --git a/storage/src/error.rs b/storage/src/error.rs index 1fb8dfe..3f065ab 100644 --- a/storage/src/error.rs +++ b/storage/src/error.rs @@ -21,6 +21,12 @@ pub enum Error { #[error("Keypairs config missing validator keypair")] KeypairsConfigMissingValidatorKeypair, + #[error("Commit batch and results not match")] + CommitBachAndResultsNotMatch, + + #[error("No entries")] + NoEntries, + #[error(transparent)] SolanaBlockstoreError(#[from] BlockstoreError), @@ -56,6 +62,9 @@ pub enum StorageError { #[error("Blockstore set root failed: {0}")] SetRootFailed(String), + + #[error("Account not found")] + AccountNotFound, } #[derive(Debug, Error)] @@ -77,4 +86,7 @@ pub enum BankError { pub enum AccountDbError { #[error("Failed to scan accounts: {0}")] FailedToScanAccounts(String), + + #[error("Convert transaction error: {0}")] + ConvertTxError(String), } diff --git a/storage/src/execution/mod.rs b/storage/src/execution/mod.rs index efdae12..655ab8d 100644 --- a/storage/src/execution/mod.rs +++ b/storage/src/execution/mod.rs @@ -1,5 +1,5 @@ +use crate::Error; use crate::{blockstore::txs::CommitBatch, Result, RollupStorage}; -use igloo_interface::l2::storage::{TransactionSet, TransactionsResult}; use solana_sdk::transaction::{SanitizedTransaction, VersionedTransaction}; use solana_svm::{ transaction_processor::LoadAndExecuteSanitizedTransactionsOutput, @@ -16,23 +16,33 @@ pub struct TransactionsResultWrapper { impl RollupStorage { pub(crate) fn commit_block( &mut self, - result: TransactionsResultWrapper, - origin: &CommitBatch, - ) -> Result { - let executed_txs = result.success_txs(origin.transactions()); - let entries = self.transactions_to_entries(executed_txs)?; + result: Vec, + origin: Vec, + ) -> Result> { + if result.len() != origin.len() { + return Err(Error::CommitBachAndResultsNotMatch); + } - let bank_result = self.bank_commit(result, &origin, &entries)?; + // TODO: process entries in parallel in scheduler version + + let mut data_entries = vec![]; + let mut start_hash = None; + for (result, origin) in result.iter().zip(origin.iter()) { + let executed_txs = result.success_txs(origin.transactions()); + let entry = self.transactions_to_entry(executed_txs, start_hash)?; + start_hash = Some(entry.hash); + data_entries.push(entry); + } + let entries = self.complete_entries(data_entries)?; + + let bank_result = self.bank_commit(result, origin, &entries)?; self.blockstore_save(entries)?; Ok(bank_result) } } -impl TransactionsResult for TransactionsResultWrapper { - type SuccessIn = SanitizedTransaction; - type SuccessOut = VersionedTransaction; - - fn success_txs(&self, extras: &[Self::SuccessIn]) -> Vec { +impl TransactionsResultWrapper { + pub fn success_txs(&self, extras: &[SanitizedTransaction]) -> Vec { self.output .execution_results .iter() diff --git a/storage/src/execution/tests.rs b/storage/src/execution/tests.rs index 3d4a78f..af947b2 100644 --- a/storage/src/execution/tests.rs +++ b/storage/src/execution/tests.rs @@ -12,7 +12,6 @@ use crate::{ RollupStorage, }; use anyhow::Result; -use igloo_interface::l2::{bank::BankOperations, storage::StorageOperations}; use solana_sdk::{signature::Keypair, signer::Signer, system_transaction}; #[tokio::test] @@ -76,28 +75,28 @@ async fn conflict_transaction_may_lead_incorrect_state() -> Result<()> { assert_result_balance( bob, Some(INIT_AMOUNT + BOB_PLUS), - &results.loaded_transactions[0].as_ref().unwrap(), + results.loaded_transactions[0].as_ref().unwrap(), ); assert_result_balance( alice, Some(INIT_AMOUNT - BOB_PLUS), - &results.loaded_transactions[0].as_ref().unwrap(), + results.loaded_transactions[0].as_ref().unwrap(), ); // assert second transaction result assert_result_balance( alice, None, // alice balance not changed - &results.loaded_transactions[1].as_ref().unwrap(), + results.loaded_transactions[1].as_ref().unwrap(), ); assert_result_balance( bob, Some(INIT_AMOUNT - BOB_MINUS), // TODO: should be INIT_AMOUNT + BOB_PLUS - BOB_MINUS or throw error ? - &results.loaded_transactions[1].as_ref().unwrap(), + results.loaded_transactions[1].as_ref().unwrap(), ); assert_result_balance( charlie, Some(INIT_AMOUNT + BOB_MINUS), - &results.loaded_transactions[1].as_ref().unwrap(), + results.loaded_transactions[1].as_ref().unwrap(), ); // after process balance not changed assert_eq!(store.balance(&alice), INIT_AMOUNT); @@ -108,8 +107,8 @@ async fn conflict_transaction_may_lead_incorrect_state() -> Result<()> { let origin_txs = create_svm_transactions(&raw_txs); store .commit( - TransactionsResultWrapper { output: results }, - CommitBatch::new(origin_txs.clone().into()), + vec![TransactionsResultWrapper { output: results }], + vec![CommitBatch::new(origin_txs.clone().into())], ) .await?; @@ -155,8 +154,8 @@ async fn conflict_transaction_execute_with_bank() -> Result<()> { let bank = store.bank.clone(); let raw_txs = vec![ - system_transaction::transfer(&alice, &bob.pubkey(), TO_BOB, bank.last_blockhash()), - system_transaction::transfer(&alice, &charlie.pubkey(), TO_CHARLIE, bank.last_blockhash()), + system_transaction::transfer(alice, &bob.pubkey(), TO_BOB, bank.last_blockhash()), + system_transaction::transfer(alice, &charlie.pubkey(), TO_CHARLIE, bank.last_blockhash()), ]; let results = bank.process_transactions(raw_txs.iter()); assert_eq!(results[0], Ok(())); @@ -201,8 +200,8 @@ async fn conflict_transaction_execute_with_bank2() -> Result<()> { let bank = store.bank.clone(); let raw_txs = vec![ - system_transaction::transfer(&alice, &bob.pubkey(), TO_BOB, bank.last_blockhash()), - system_transaction::transfer(&bob, &charlie.pubkey(), TO_CHARLIE, bank.last_blockhash()), + system_transaction::transfer(alice, &bob.pubkey(), TO_BOB, bank.last_blockhash()), + system_transaction::transfer(bob, &charlie.pubkey(), TO_CHARLIE, bank.last_blockhash()), ]; let results = bank.process_transactions(raw_txs.iter()); assert_eq!(results[0], Ok(())); diff --git a/storage/src/history/mod.rs b/storage/src/history/mod.rs index 7dec48c..bd6a5a6 100644 --- a/storage/src/history/mod.rs +++ b/storage/src/history/mod.rs @@ -3,7 +3,6 @@ use crate::{ Result, RollupStorage, }; use crossbeam_channel::unbounded; -use igloo_interface::l2::storage::TransactionSet; use solana_core::cache_block_meta_service::CacheBlockMetaService; use solana_ledger::{ blockstore::Blockstore, @@ -17,7 +16,7 @@ use solana_runtime::bank::TransactionBalancesSet; use solana_sdk::{ clock::Slot, rent_debits::RentDebits, signature::Signature, transaction::SanitizedTransaction, }; -use solana_svm::transaction_results::TransactionExecutionResult; +use solana_svm::transaction_results::{TransactionExecutionResult, TransactionResults}; use solana_transaction_status::{ token_balances::TransactionTokenBalancesSet, ConfirmedTransactionWithStatusMeta, }; @@ -67,34 +66,34 @@ impl RollupStorage { .map_err(|e| e.into()) } - pub fn commit_with_history( + pub fn single_batch_commit_with_history( &mut self, result: TransactionsResultWrapper, mut origin: CommitBatch, - ) -> Result<()> { + ) -> Result { let execution_results = result.output.execution_results.clone(); let pre_balances = origin.collect_balances(self.bank.clone()); let pre_token_balances = origin.collect_token_balances(self.bank.clone()); - let bank_result = self.commit_block(result, &origin)?; + let batch_result = self.single_batch_commit(result, &origin)?; let post_balances = origin.collect_balances(self.bank.clone()); let post_token_balances = origin.collect_token_balances(self.bank.clone()); let history_info = TransactionBatchHistoryInfo { - transactions: origin.transactions().to_vec(), + transactions: origin.sanitized_txs.to_vec(), execution_results, balances: TransactionBalancesSet::new(pre_balances, post_balances), token_balances: TransactionTokenBalancesSet::new( pre_token_balances, post_token_balances, ), - transaction_indexes: origin.transaction_indexes.clone(), - rent_debits: bank_result.rent_debits, + transaction_indexes: origin.transaction_indexes, + rent_debits: batch_result.rent_debits.clone(), }; self.on_block_complete(history_info); - Ok(()) + Ok(batch_result) } pub fn notify_block_complete(&self) { diff --git a/storage/src/history/tests.rs b/storage/src/history/tests.rs index c5d3d1b..6a497f7 100644 --- a/storage/src/history/tests.rs +++ b/storage/src/history/tests.rs @@ -7,7 +7,6 @@ use crate::{ RollupStorage, }; use anyhow::Result; -use igloo_interface::l2::{bank::BankOperations, storage::StorageOperations}; use solana_sdk::{ signature::Keypair, signer::Signer, system_transaction, transaction::SanitizedTransaction, }; @@ -51,15 +50,15 @@ async fn history_storage_works() -> Result<()> { let origin_txs = raw_txs .clone() .into_iter() - .map(|tx| SanitizedTransaction::from_transaction_for_tests(tx)) + .map(SanitizedTransaction::from_transaction_for_tests) .collect::>(); let results = process_transfers_ex(&store, origin_txs.clone()); // commit store .commit( - TransactionsResultWrapper { output: results }, - CommitBatch::new(origin_txs.clone().into()), + vec![TransactionsResultWrapper { output: results }], + vec![CommitBatch::new(origin_txs.clone().into())], ) .await?; @@ -117,5 +116,130 @@ async fn history_storage_works() -> Result<()> { Ok(()) } +#[tokio::test] +async fn history_storage_with_multi_entries_works() -> Result<()> { + let ledger_path = tempfile::tempdir()?.into_path(); + let config = GlobalConfig::new_temp(&ledger_path)?; + let mut store = RollupStorage::new(config)?; + store.init()?; + let keypairs = store.config.keypairs.clone(); + + store.set_snapshot_interval(1); + assert_eq!(store.current_height(), 0); + + let alice = keypairs.mint_keypair.as_ref().unwrap().clone(); + let bob = keypairs.validator_keypair.as_ref().unwrap().clone(); + let charlie = Keypair::new().pubkey(); + let dave = Keypair::new().pubkey(); + + const ALICE_INIT_BALANCE: u64 = DEFAULT_MINT_LAMPORTS; + const BOB_INIT_BALANCE: u64 = DEFAULT_VALIDATOR_LAMPORTS; + assert_eq!(store.balance(&alice.pubkey()), ALICE_INIT_BALANCE); + assert_eq!(store.balance(&bob.pubkey()), BOB_INIT_BALANCE); + assert_eq!(store.balance(&charlie), 0); + assert_eq!(store.balance(&dave), 0); + + const TO_CHARLIE: u64 = 2000000; + const TO_DAVE: u64 = 1000000; + #[allow(dead_code)] + const FEE: u64 = 5000; + + // process transfers + store.bump()?; + let bank = store.bank.clone(); + + let raw_txs = vec![ + vec![system_transaction::transfer( + &alice, + &charlie, + TO_CHARLIE, + bank.last_blockhash(), + )], + vec![system_transaction::transfer( + &bob, + &dave, + TO_DAVE, + bank.last_blockhash(), + )], + ]; + + let mut results = vec![]; + let mut origins = vec![]; + for txs in raw_txs { + let txs = txs + .into_iter() + .map(SanitizedTransaction::from_transaction_for_tests) + .collect::>(); + results.push(TransactionsResultWrapper { + output: process_transfers_ex(&store, txs.clone()), + }); + origins.push(txs); + } + + // commit + store + .commit( + results, + origins + .iter() + .map(|txs| CommitBatch::new(txs.clone().into())) + .collect(), + ) + .await?; + + let (bank_height, store_height) = store.get_mixed_heights()?; + assert_eq!(bank_height, 1); + assert_eq!(store_height, Some(1)); + + // save and close + store.force_save().await?; + store.close().await?; + + // open again + let mut config = GlobalConfig::new(&ledger_path)?; + config.keypairs = keypairs; + let mut store = RollupStorage::new(config)?; + store.init()?; + + // query transaction meta of the first transaction + let tx1_with_meta = store + .get_transaction_meta(*origins[0][0].signature(), None)? + .unwrap(); + assert_eq!(tx1_with_meta.slot, 1); + let tx1_status = tx1_with_meta.tx_with_meta.get_status_meta().unwrap(); + assert_eq!(tx1_status.status, Ok(())); + // assert_eq!(tx1_status.fee, FEE); // FIXME: fee is not calculated correctly + assert_eq!(tx1_status.pre_balances, vec![ALICE_INIT_BALANCE, 0, 1]); + assert_eq!( + tx1_status.post_balances, + // FIXME: first item should be ALICE_INIT_BALANCE - TO_CHARLIE - FEE + vec![ALICE_INIT_BALANCE - TO_CHARLIE, TO_CHARLIE, 1] + ); + + // query transaction meta of the second transaction + let tx2_with_meta = store + .get_transaction_meta(*origins[1][0].signature(), None)? + .unwrap(); + assert_eq!(tx2_with_meta.slot, 1); + let tx2_status = tx2_with_meta.tx_with_meta.get_status_meta().unwrap(); + assert_eq!(tx2_status.status, Ok(())); + // assert_eq!(tx2_status.fee, FEE); // FIXME: fee is not calculated correctly + assert_eq!(tx2_status.pre_balances, vec![BOB_INIT_BALANCE, 0, 1]); + assert_eq!( + tx2_status.post_balances, + // FIXME: first item should be BOB_INIT_BALANCE - TO_DAVE - FEE + vec![BOB_INIT_BALANCE - TO_DAVE, TO_DAVE, 1] + ); + + // query block related meta + assert!(tx1_with_meta.block_time.is_some()); + assert_eq!(tx1_with_meta.block_time, tx2_with_meta.block_time); + assert_eq!(store.blockstore.get_block_height(1).unwrap(), Some(1)); + + store.close().await?; + + Ok(()) +} + // TODO: add unit test with commit success and failed transactions, this can be done after // transaction execution check is implemented diff --git a/storage/src/impls.rs b/storage/src/impls.rs index 576e466..c67f80b 100644 --- a/storage/src/impls.rs +++ b/storage/src/impls.rs @@ -1,7 +1,7 @@ -use igloo_interface::l2::{ - bank::{BankInfo, BankOperations}, - executor::Init, - storage::StorageOperations, +use crate::{ + background::StorageBackground, blockstore::txs::CommitBatch, config::GlobalConfig, + error::BankError, execution::TransactionsResultWrapper, history::StorageHistoryServices, + BankInfo, Error, Result, }; use solana_gossip::cluster_info::ClusterInfo; use solana_ledger::{ @@ -9,22 +9,10 @@ use solana_ledger::{ leader_schedule_cache::LeaderScheduleCache, }; use solana_runtime::{bank::Bank, bank_forks::BankForks}; -use solana_sdk::{ - account::{AccountSharedData, WritableAccount}, - account_utils::StateMut, - bpf_loader_upgradeable::{self, UpgradeableLoaderState}, - clock::Slot, - pubkey::Pubkey, - signer::Signer, -}; +use solana_sdk::{account::AccountSharedData, clock::Slot, pubkey::Pubkey, signer::Signer}; use solana_svm::transaction_processing_callback::TransactionProcessingCallback; use std::sync::{atomic::AtomicBool, Arc, RwLock}; -use crate::{ - background::StorageBackground, blockstore::txs::CommitBatch, config::GlobalConfig, - error::BankError, execution::TransactionsResultWrapper, history::StorageHistoryServices, Error, -}; - pub struct RollupStorage { pub(crate) bank: Arc, pub(crate) bank_forks: Arc>, @@ -39,18 +27,6 @@ pub struct RollupStorage { pub(crate) exit: Arc, } -impl Init for RollupStorage { - type Error = crate::Error; - type Config = GlobalConfig; - - fn init(cfg: &Self::Config) -> Result - where - Self: Sized, - { - Self::new(cfg.clone()) - } -} - impl TransactionProcessingCallback for RollupStorage { fn account_matches_owners( &self, @@ -72,73 +48,6 @@ impl TransactionProcessingCallback for RollupStorage { } } -impl BankOperations for RollupStorage { - type Pubkey = Pubkey; - - type AccountSharedData = AccountSharedData; - - type Error = Error; - - fn insert_account( - &mut self, - key: Self::Pubkey, - data: Self::AccountSharedData, - ) -> Result<(), Self::Error> { - if self.config.dev_mode { - self.bank.store_account(&key, &data); - Ok(()) - } else { - Err(BankError::InvalidOperation("Capitalization check not passed".to_string()).into()) - } - } - - fn deploy_program(&mut self, buffer: Vec) -> Result { - let program_key = solana_sdk::pubkey::new_rand(); - let programdata_key = solana_sdk::pubkey::new_rand(); - - let mut program_account = AccountSharedData::new_data( - 40, - &UpgradeableLoaderState::Program { - programdata_address: programdata_key, - }, - &bpf_loader_upgradeable::id(), - ) - .unwrap(); - program_account.set_executable(true); - program_account.set_rent_epoch(1); - let programdata_data_offset = UpgradeableLoaderState::size_of_programdata_metadata(); - let mut programdata_account = AccountSharedData::new( - 40, - programdata_data_offset + buffer.len(), - &bpf_loader_upgradeable::id(), - ); - programdata_account - .set_state(&UpgradeableLoaderState::ProgramData { - slot: self.bank.parent_slot(), - upgrade_authority_address: None, - }) - .unwrap(); - programdata_account.data_as_mut_slice()[programdata_data_offset..].copy_from_slice(&buffer); - programdata_account.set_rent_epoch(1); - self.bank.store_account(&program_key, &program_account); - self.bank - .store_account(&programdata_key, &programdata_account); - - Ok(program_key) - } - - fn set_clock(&mut self) -> Result<(), Self::Error> { - // We do nothing here because there is a clock sysvar in the bank already - Ok(()) - } - - fn bump(&mut self) -> Result<(), Self::Error> { - let slot = self.bank_forks.read().unwrap().highest_slot(); - self.bump_slot(slot + 1)?; - Ok(()) - } -} - impl BankInfo for RollupStorage { type Hash = solana_sdk::hash::Hash; @@ -148,15 +57,24 @@ impl BankInfo for RollupStorage { type Error = Error; - fn last_blockhash(&self) -> Self::Hash { - self.bank.last_blockhash() + fn last_blockhash(&self, slot: Option) -> std::result::Result { + Ok(if let Some(slot) = slot { + self.bank_forks + .read() + .unwrap() + .get(slot) + .ok_or(BankError::BankNotExists(slot))? + .last_blockhash() + } else { + self.bank.last_blockhash() + }) } fn execution_slot(&self) -> Self::Slot { self.bank.slot() } - fn collector_id(&self) -> Result { + fn collector_id(&self) -> std::result::Result { Ok(self .config .keypairs @@ -167,49 +85,76 @@ impl BankInfo for RollupStorage { } } -impl StorageOperations for RollupStorage { - type Error = Error; - type TxsResult = TransactionsResultWrapper; - type TransactionSet<'a> = CommitBatch<'a>; +impl RollupStorage { + pub(crate) fn join(self) { + drop(self.bank); + drop(self.bank_forks); + self.background_service.join(); + } - async fn commit<'a>( - &mut self, - result: Self::TxsResult, - origin: Self::TransactionSet<'a>, - ) -> Result<(), Self::Error> { - // TODO: make commit async + pub fn config(&self) -> &GlobalConfig { + &self.config + } - if self.enable_history() { - self.commit_with_history(result, origin)?; - } else { - self.commit_block(result, &origin)?; - } + pub fn bank_forks(&self) -> Arc> { + self.bank_forks.clone() + } + + pub fn blockstore(&self) -> Arc { + self.blockstore.clone() + } + + pub fn history_services(&self) -> &StorageHistoryServices { + &self.history_services + } + + pub fn cluster_info(&self) -> Arc { + self.cluster_info.clone() + } + + pub async fn commit<'a>( + &mut self, + result: Vec, + origin: Vec>, + ) -> Result<()> { + self.commit_block(result, origin)?; Ok(()) } - async fn force_save(&mut self) -> Result<(), Self::Error> { + pub async fn force_save(&mut self) -> Result<()> { self.bank.freeze(); self.set_root(self.bank.slot(), None)?; Ok(()) } - async fn close(self) -> Result<(), Self::Error> { + pub async fn close(self) -> Result<()> { self.try_wait_snapshot_complete().await; self.exit.store(true, std::sync::atomic::Ordering::Relaxed); self.blockstore.drop_signal(); self.join(); Ok(()) } -} -impl RollupStorage { - pub(crate) fn join(self) { - drop(self.bank); - drop(self.bank_forks); - self.background_service.join(); + pub fn bump(&mut self) -> Result<()> { + let slot = self.bank_forks.read().unwrap().highest_slot(); + self.bump_slot(slot + 1)?; + Ok(()) } - pub fn cluster_info(&self) -> Arc { - self.cluster_info.clone() + pub fn insert_account(&mut self, key: Pubkey, data: AccountSharedData) -> Result<()> { + if self.config.dev_mode { + self.bank.store_account(&key, &data); + Ok(()) + } else { + Err(BankError::InvalidOperation("Capitalization check not passed".to_string()).into()) + } + } + + pub fn get_bank(&self, slot: Slot) -> Result> { + self.bank_forks + .read() + .unwrap() + .get(slot) + .ok_or(BankError::BankNotExists(slot).into()) } } diff --git a/storage/src/init/mod.rs b/storage/src/init/mod.rs index 73483dc..19cdb76 100644 --- a/storage/src/init/mod.rs +++ b/storage/src/init/mod.rs @@ -79,6 +79,7 @@ impl RollupStorage { pub fn init(&mut self) -> Result<()> { self.aligne_blockstore_with_bank_forks()?; + self.bank = self.bank_forks.read().unwrap().working_bank(); Ok(()) } @@ -125,6 +126,7 @@ pub(crate) fn init_config(ledger_path: &Path) -> Result { }) } +#[allow(clippy::type_complexity)] fn load_blockstore( cfg: &mut GlobalConfig, exit: Arc, diff --git a/storage/src/ledger/mod.rs b/storage/src/ledger/mod.rs index c4f4bec..48eee04 100644 --- a/storage/src/ledger/mod.rs +++ b/storage/src/ledger/mod.rs @@ -3,7 +3,12 @@ use crate::{ Result, RollupStorage, }; use solana_runtime::{bank_forks::BankForks, installed_scheduler_pool::BankWithScheduler}; -use solana_sdk::{account::ReadableAccount, hash::Hash, pubkey::Pubkey}; +use solana_sdk::{ + account::{AccountSharedData, ReadableAccount}, + clock::Slot, + hash::Hash, + pubkey::Pubkey, +}; use std::{ collections::HashSet, sync::{Arc, RwLock}, @@ -29,7 +34,11 @@ pub struct SlotInfo { impl RollupStorage { pub fn get_slot_info(&self, slot: u64) -> Result { let head = self.get_slot_head(slot)?; - let parent = self.get_slot_head(head.slot - 1)?; + let parent = if head.slot > 0 { + self.get_slot_head(head.slot - 1)? + } else { + Default::default() + }; let store_height = self.blockstore.highest_slot()?; Ok(SlotInfo { head, @@ -80,7 +89,27 @@ impl RollupStorage { .unwrap_or(0) } - pub fn reorg(&mut self, slot: u64, finalized: Option) -> Result> { + pub fn has_account(&self, pubkey: &Pubkey) -> bool { + self.bank.get_account(pubkey).is_some() + } + + pub fn get_account(&self, pubkey: &Pubkey) -> Result { + self.bank + .get_account(pubkey) + .ok_or(StorageError::AccountNotFound.into()) + } + + pub fn get_account_by_slot(&self, slot: Slot, pubkey: &Pubkey) -> Result { + self.bank_forks + .read() + .unwrap() + .get(slot) + .ok_or(BankError::BankNotExists(slot))? + .get_account(pubkey) + .ok_or(StorageError::AccountNotFound.into()) + } + + pub fn reorg(&mut self, slot: Slot, finalized: Option) -> Result> { let removed = self.set_root(slot, finalized)?; let ancestors = find_ancestors(slot, finalized, self.bank_forks.clone(), &removed); diff --git a/storage/src/lib.rs b/storage/src/lib.rs index 0d8a2a7..a99b78b 100644 --- a/storage/src/lib.rs +++ b/storage/src/lib.rs @@ -13,6 +13,7 @@ pub mod sig_hub; #[cfg(test)] mod tests; +use solana_sdk::clock::Slot; pub use { error::{Error, Result}, impls::RollupStorage, @@ -20,3 +21,16 @@ pub use { #[macro_use] extern crate log; + +pub trait BankInfo { + type Hash; + type Pubkey; + type Slot; + type Error: std::fmt::Display; + + fn last_blockhash(&self, slot: Option) -> std::result::Result; + + fn execution_slot(&self) -> Self::Slot; + + fn collector_id(&self) -> std::result::Result; +} diff --git a/storage/src/tests/basic.rs b/storage/src/tests/basic.rs index 785fdb1..0140071 100644 --- a/storage/src/tests/basic.rs +++ b/storage/src/tests/basic.rs @@ -1,5 +1,3 @@ -use std::path::Path; - use crate::{ blockstore::txs::CommitBatch, config::GlobalConfig, @@ -9,7 +7,7 @@ use crate::{ RollupStorage, }; use anyhow::Result; -use igloo_interface::l2::{bank::BankOperations, storage::StorageOperations}; +use solana_sdk::pubkey::Pubkey; use solana_sdk::{ signature::Keypair, signer::Signer, @@ -42,7 +40,7 @@ async fn init_with_all_default_works() -> Result<()> { DEFAULT_STAKE_LAMPORTS, ); let accounts_status = store.all_accounts_status()?; - assert_eq!(accounts_status.num_accounts, 223); + assert!(accounts_status.num_accounts > 200); store.close().await?; // create store again @@ -68,40 +66,11 @@ async fn init_with_all_default_works() -> Result<()> { DEFAULT_STAKE_LAMPORTS, ); let accounts_status = store.all_accounts_status()?; - assert_eq!(accounts_status.num_accounts, 223); + assert!(accounts_status.num_accounts > 200); Ok(()) } -#[test] -fn init_with_given_config_works() -> Result<()> { - let ledger_path = Path::new("data/config/ledger"); - let mut config = GlobalConfig::new(&ledger_path)?; - config.keypairs.set_default_path(ledger_path); - let mut store = RollupStorage::new(config)?; - store.init()?; - - let keypairs = store.config.keypairs.clone(); - assert!(!store.allow_init_from_scratch()); - let (bank_height, store_height) = store.get_mixed_heights()?; - assert_eq!(bank_height, 0); - assert_eq!(store_height, Some(0)); - assert_eq!(store.current_height(), 0); - assert_eq!( - store.balance(&keypairs.validator_keypair.as_ref().unwrap().pubkey()), - 500000000000 - ); - assert_eq!( - store.balance(&keypairs.mint_keypair.as_ref().unwrap().pubkey()), - 500000000, - ); - assert_eq!( - store.balance(&keypairs.voting_keypair.as_ref().unwrap().pubkey()), - 27074400 - ); - Ok(()) -} - #[tokio::test] async fn storage_basic_process_works() -> Result<()> { let ledger_path = tempfile::tempdir()?.into_path(); @@ -110,18 +79,35 @@ async fn storage_basic_process_works() -> Result<()> { store.init()?; let keypairs = store.config.keypairs.clone(); - store.set_snapshot_interval(1); - assert_eq!(store.current_height(), 0); + let mut reload_config = GlobalConfig::new(&ledger_path)?; + reload_config.keypairs = keypairs.clone(); - let alice = keypairs.mint_keypair.as_ref().unwrap().clone(); - let bob = keypairs.validator_keypair.as_ref().unwrap().clone(); - let charlie = Keypair::new().pubkey(); - let dave = Keypair::new().pubkey(); + basic_process_tests( + store, + reload_config, + keypairs.mint_keypair.as_ref().unwrap().as_ref(), + keypairs.validator_keypair.as_ref().unwrap().as_ref(), + Keypair::new().pubkey(), + Keypair::new().pubkey(), + DEFAULT_MINT_LAMPORTS, + DEFAULT_VALIDATOR_LAMPORTS, + ) + .await +} - const ALICE_INIT_BALANCE: u64 = DEFAULT_MINT_LAMPORTS; - const BOB_INIT_BALANCE: u64 = DEFAULT_VALIDATOR_LAMPORTS; - assert_eq!(store.balance(&alice.pubkey()), ALICE_INIT_BALANCE); - assert_eq!(store.balance(&bob.pubkey()), BOB_INIT_BALANCE); +#[allow(clippy::too_many_arguments)] +async fn basic_process_tests( + mut store: RollupStorage, + reload_config: GlobalConfig, + alice: &Keypair, + bob: &Keypair, + charlie: Pubkey, + dave: Pubkey, + alice_init_balance: u64, + bob_init_balance: u64, +) -> Result<()> { + assert_eq!(store.balance(&alice.pubkey()), alice_init_balance); + assert_eq!(store.balance(&bob.pubkey()), bob_init_balance); assert_eq!(store.balance(&charlie), 0); assert_eq!(store.balance(&dave), 0); @@ -134,13 +120,13 @@ async fn storage_basic_process_works() -> Result<()> { let bank = store.bank.clone(); let raw_txs = vec![ - system_transaction::transfer(&alice, &charlie, TO_CHARLIE, bank.last_blockhash()), - system_transaction::transfer(&bob, &dave, TO_DAVE, bank.last_blockhash()), + system_transaction::transfer(alice, &charlie, TO_CHARLIE, bank.last_blockhash()), + system_transaction::transfer(bob, &dave, TO_DAVE, bank.last_blockhash()), ]; let origin_txs = raw_txs .clone() .into_iter() - .map(|tx| SanitizedTransaction::from_transaction_for_tests(tx)) + .map(SanitizedTransaction::from_transaction_for_tests) .collect::>(); let results = process_transfers_ex(&store, origin_txs.clone()); @@ -153,40 +139,40 @@ async fn storage_basic_process_works() -> Result<()> { assert_result_balance( charlie, Some(TO_CHARLIE), - &results.loaded_transactions[0].as_ref().unwrap(), + results.loaded_transactions[0].as_ref().unwrap(), ); assert_result_balance( alice.pubkey(), - Some(ALICE_INIT_BALANCE - TO_CHARLIE - FEE), - &results.loaded_transactions[0].as_ref().unwrap(), + Some(alice_init_balance - TO_CHARLIE - FEE), + results.loaded_transactions[0].as_ref().unwrap(), ); // assert second transaction result assert_result_balance( alice.pubkey(), None, // alice balance not changed - &results.loaded_transactions[1].as_ref().unwrap(), + results.loaded_transactions[1].as_ref().unwrap(), ); assert_result_balance( bob.pubkey(), - Some(BOB_INIT_BALANCE - TO_DAVE - FEE), // TODO: should be INIT_AMOUNT + BOB_PLUS - BOB_MINUS ? - &results.loaded_transactions[1].as_ref().unwrap(), + Some(bob_init_balance - TO_DAVE - FEE), // TODO: should be INIT_AMOUNT + BOB_PLUS - BOB_MINUS ? + results.loaded_transactions[1].as_ref().unwrap(), ); assert_result_balance( dave, Some(TO_DAVE), - &results.loaded_transactions[1].as_ref().unwrap(), + results.loaded_transactions[1].as_ref().unwrap(), ); // after process balance not changed - assert_eq!(store.balance(&alice.pubkey()), ALICE_INIT_BALANCE); - assert_eq!(store.balance(&bob.pubkey()), BOB_INIT_BALANCE); + assert_eq!(store.balance(&alice.pubkey()), alice_init_balance); + assert_eq!(store.balance(&bob.pubkey()), bob_init_balance); assert_eq!(store.balance(&charlie), 0); assert_eq!(store.balance(&dave), 0); // 2. commit store .commit( - TransactionsResultWrapper { output: results }, - CommitBatch::new(origin_txs.clone().into()), + vec![TransactionsResultWrapper { output: results }], + vec![CommitBatch::new(origin_txs.clone().into())], ) .await?; @@ -196,11 +182,11 @@ async fn storage_basic_process_works() -> Result<()> { // after commit balance changed assert_eq!( store.balance(&alice.pubkey()), - ALICE_INIT_BALANCE - TO_CHARLIE - FEE + alice_init_balance - TO_CHARLIE - FEE ); assert_eq!( store.balance(&bob.pubkey()), - BOB_INIT_BALANCE - TO_DAVE - FEE + bob_init_balance - TO_DAVE - FEE ); assert_eq!(store.balance(&charlie), TO_CHARLIE); assert_eq!(store.balance(&dave), TO_DAVE); @@ -210,22 +196,20 @@ async fn storage_basic_process_works() -> Result<()> { store.close().await?; // 4. open again - let mut config = GlobalConfig::new(&ledger_path)?; - config.keypairs = keypairs; - let ticks_per_slot = config.genesis.ticks_per_slot; - let mut store = RollupStorage::new(config)?; + let mut store = RollupStorage::new(reload_config)?; store.init()?; + let ticks_per_slot = store.config.genesis.ticks_per_slot; let (bank_height, store_height) = store.get_mixed_heights()?; assert_eq!(bank_height, 1); assert_eq!(store_height, Some(1)); - // TODO: check why bob balance is not `ALICE_INIT_BALANCE - TO_CHARLIE` ? + // TODO: check why bob balance is not `alice_init_balance - TO_CHARLIE` ? assert_eq!( store.balance(&alice.pubkey()), - ALICE_INIT_BALANCE - TO_CHARLIE + alice_init_balance - TO_CHARLIE ); - // TODO: check why bob balance is not `BOB_INIT_BALANCE - TO_DAVE - FEE` ? - assert_eq!(store.balance(&bob.pubkey()), BOB_INIT_BALANCE - TO_DAVE); + // TODO: check why bob balance is not `bob_init_balance - TO_DAVE - FEE` ? + assert_eq!(store.balance(&bob.pubkey()), bob_init_balance - TO_DAVE); assert_eq!(store.balance(&charlie), TO_CHARLIE); assert_eq!(store.balance(&dave), TO_DAVE); diff --git a/storage/src/tests/mod.rs b/storage/src/tests/mod.rs index 39b8f91..56c4d87 100644 --- a/storage/src/tests/mod.rs +++ b/storage/src/tests/mod.rs @@ -1,12 +1,3 @@ mod basic; pub mod mock; mod reorg; -mod svm; - -fn get_program_path(name: &str) -> String { - let mut dir = std::env::current_dir().unwrap(); - dir.push("../svm/executor/tests"); - let name = name.replace('-', "_"); - dir.push(name + "_program.so"); - dir.to_str().unwrap().to_string() -} diff --git a/storage/src/tests/reorg.rs b/storage/src/tests/reorg.rs index bcf0d7a..647886c 100644 --- a/storage/src/tests/reorg.rs +++ b/storage/src/tests/reorg.rs @@ -1,7 +1,6 @@ use std::sync::Arc; use anyhow::Result; -use igloo_interface::l2::{bank::BankOperations, storage::StorageOperations}; use solana_runtime::bank::Bank; use solana_sdk::{ pubkey::Pubkey, signature::Keypair, signer::Signer, system_transaction, @@ -49,7 +48,7 @@ async fn reorg_works() -> Result<()> { /// \ | /// slot 1 \ * (B) <-- highest confirmed root /// \ | - /// slot 0 * (A) + /// slot 0 * (A) const FEE: u64 = 5000; let bank0 = store.bank.clone(); @@ -236,6 +235,7 @@ async fn reorg_works() -> Result<()> { Ok(()) } +#[allow(clippy::too_many_arguments)] async fn new_slot_with_two_txs( bank: Arc, store: &mut RollupStorage, @@ -251,13 +251,13 @@ async fn new_slot_with_two_txs( system_transaction::transfer(&tx2_from, &tx2_to, tx2_amount, bank.last_blockhash()), ] .into_iter() - .map(|tx| SanitizedTransaction::from_transaction_for_tests(tx)) + .map(SanitizedTransaction::from_transaction_for_tests) .collect::>(); - let results = process_transfers_ex(&store, origin_txs.clone()); + let results = process_transfers_ex(store, origin_txs.clone()); store .commit( - TransactionsResultWrapper { output: results }, - CommitBatch::new(origin_txs.clone().into()), + vec![TransactionsResultWrapper { output: results }], + vec![CommitBatch::new(origin_txs.clone().into())], ) .await?; diff --git a/storage/src/tests/svm.rs b/storage/src/tests/svm.rs deleted file mode 100644 index fd8a78d..0000000 --- a/storage/src/tests/svm.rs +++ /dev/null @@ -1,173 +0,0 @@ -use anyhow::Result; -use igloo_interface::l2::executor::Init; -use solana_sdk::{ - account::ReadableAccount, clock::Clock, pubkey::Pubkey, sysvar::SysvarId, - transaction::TransactionError, -}; -use solana_svm::{ - transaction_processing_callback::TransactionProcessingCallback, - transaction_results::TransactionExecutionResult, -}; -use svm_executor::prelude::SimpleBuilder; - -use crate::{config::GlobalConfig, tests::get_program_path, RollupStorage}; - -#[test] -fn db_hello_program_works() -> Result<()> { - let path = get_program_path("hello-solana"); - - let mut builder = - SimpleBuilder::::init(&GlobalConfig::new_dev(tempfile::tempdir()?.path())?)?; - let result = builder - .program_path(Some(path)) - .build() - .expect("Failed to build transaction"); - - assert_eq!(result.execution_results.len(), 1); - assert!(result.execution_results[0] - .details() - .unwrap() - .status - .is_ok()); - let logs = result.execution_results[0] - .details() - .unwrap() - .log_messages - .as_ref() - .unwrap(); - assert!(logs.contains(&"Program log: Hello, Solana!".to_string())); - Ok(()) -} - -#[test] -fn db_clock_sysvar_works() -> Result<()> { - let path = get_program_path("clock-sysvar"); - - let mut builder = - SimpleBuilder::::init(&GlobalConfig::new_dev(tempfile::tempdir()?.path())?)?; - let result = builder - .program_path(Some(path)) - .build() - .expect("Failed to build transaction"); - - assert_eq!(result.execution_results.len(), 1); - assert!(result.execution_results[0] - .details() - .unwrap() - .status - .is_ok()); - let return_data = result.execution_results[0] - .details() - .unwrap() - .return_data - .as_ref() - .unwrap(); - let time = i64::from_be_bytes(return_data.data[0..8].try_into().unwrap()); - let clock_data = builder - .get_bank() - .get_account_shared_data(&Clock::id()) - .unwrap(); - let clock_info: Clock = bincode::deserialize(clock_data.data()).unwrap(); - assert_eq!(clock_info.unix_timestamp, time); - Ok(()) -} - -#[test] -fn db_simple_transfer_works() -> Result<()> { - let path = get_program_path("simple-transfer"); - let sender = Pubkey::new_unique(); - let recipient = Pubkey::new_unique(); - let system_account = Pubkey::from([0u8; 32]); - println!("system_account: {}", system_account); - - let mut builder = - SimpleBuilder::::init(&GlobalConfig::new_dev(tempfile::tempdir()?.path())?)?; - let result = builder - .program_path(Some(path)) - .account_with_balance(sender, Some(900000), true, true) - .account_with_balance(recipient, Some(900000), false, true) - .account_with_balance(system_account, None, false, false) - .calldata(vec![0, 0, 0, 0, 0, 0, 0, 10]) - .v0_message(true) - .build() - .expect("Failed to build transaction"); - - assert_eq!(result.execution_results.len(), 1); - assert!(result.execution_results[0] - .details() - .unwrap() - .status - .is_ok()); - let recipient_data = result.loaded_transactions[0] - .as_ref() - .unwrap() - .accounts - .iter() - .find(|key| key.0 == recipient) - .unwrap(); - assert_eq!(recipient_data.1.lamports(), 900010); - Ok(()) -} - -#[test] -fn db_simple_transfer_failed_with_insufficient_balance() -> Result<()> { - let path = get_program_path("simple-transfer"); - let sender = Pubkey::new_unique(); - let recipient = Pubkey::new_unique(); - let system_account = Pubkey::from([0u8; 32]); - - let mut builder = - SimpleBuilder::::init(&GlobalConfig::new_dev(tempfile::tempdir()?.path())?)?; - let result = builder - .program_path(Some(path)) - .account_with_balance(sender, Some(900000), true, true) - .account_with_balance(recipient, Some(900000), false, true) - .account_with_balance(system_account, None, false, false) - .calldata(900050u64.to_be_bytes().to_vec()) - .v0_message(true) - .build() - .expect("Failed to build transaction"); - - assert_eq!(result.execution_results.len(), 1); - assert!(result.execution_results[0] - .details() - .unwrap() - .status - .is_err()); - assert!(result.execution_results[0] - .details() - .unwrap() - .log_messages - .as_ref() - .unwrap() - .contains(&"Transfer: insufficient lamports 900000, need 900050".to_string())); - Ok(()) -} - -#[test] -fn db_simple_transfer_failed_with_custom_check_error() -> Result<()> { - let path = get_program_path("simple-transfer"); - let sender = Pubkey::new_unique(); - let recipient = Pubkey::new_unique(); - let system_account = Pubkey::from([0u8; 32]); - - let mut builder = - SimpleBuilder::::init(&GlobalConfig::new_dev(tempfile::tempdir()?.path())?)?; - let result = builder - .program_path(Some(path)) - .account_with_balance(sender, Some(900000), true, true) - .account_with_balance(recipient, Some(900000), false, true) - .account_with_balance(system_account, None, false, false) - .calldata(900050u64.to_be_bytes().to_vec()) - .v0_message(true) - .check_result(Err(TransactionError::BlockhashNotFound)) - .build() - .expect("Failed to build transaction"); - - assert_eq!(result.execution_results.len(), 1); - assert!(matches!( - result.execution_results[0], - TransactionExecutionResult::NotExecuted(TransactionError::BlockhashNotFound) - )); - Ok(()) -} diff --git a/validator/src/lib.rs b/validator/src/lib.rs deleted file mode 100644 index 7cd1e35..0000000 --- a/validator/src/lib.rs +++ /dev/null @@ -1,36 +0,0 @@ -pub mod bank_validator; -pub mod error; -pub mod settings; - -pub use { - bank_validator::BankValidator, - error::{Error, Result}, -}; - -#[macro_use] -extern crate log; - -pub trait SvmValidator { - type Transaction: Clone; - type TransactionCheckResult; - - fn get_batch_results<'a>( - &self, - transactions: std::borrow::Cow<'a, [Self::Transaction]>, - ) -> Vec; -} - -pub trait TransactionChecks { - type Transaction: Clone; - type Error; - - fn transactions_sanity_check( - &self, - txs: &[Self::Transaction], - ) -> std::result::Result<(), Self::Error>; - - fn transactions_conflict_check( - &self, - txs: &[Self::Transaction], - ) -> std::result::Result<(), Self::Error>; -} diff --git a/validator/Cargo.toml b/verifier/Cargo.toml similarity index 91% rename from validator/Cargo.toml rename to verifier/Cargo.toml index ee3ca46..4743a9e 100644 --- a/validator/Cargo.toml +++ b/verifier/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "igloo-validator" +name = "igloo-verifier" version.workspace = true authors.workspace = true repository.workspace = true @@ -8,7 +8,6 @@ license.workspace = true edition.workspace = true [dependencies] -igloo-interface = { workspace = true } igloo-storage = { workspace = true } tempfile = { workspace = true } diff --git a/validator/src/error.rs b/verifier/src/error.rs similarity index 100% rename from validator/src/error.rs rename to verifier/src/error.rs diff --git a/validator/src/bank_validator.rs b/verifier/src/lib.rs similarity index 85% rename from validator/src/bank_validator.rs rename to verifier/src/lib.rs index 8811ef4..0b58a2c 100644 --- a/validator/src/bank_validator.rs +++ b/verifier/src/lib.rs @@ -1,4 +1,4 @@ -use crate::{error::TicksError, settings::Settings, Result, SvmValidator, TransactionChecks}; +use crate::{error::TicksError, settings::Settings}; use solana_entry::entry::{Entry, EntrySlice}; use solana_runtime::{bank::Bank, transaction_batch::TransactionBatch}; use solana_sdk::transaction::{ @@ -9,69 +9,21 @@ use solana_svm::{ }; use std::{borrow::Cow, sync::Arc}; -#[derive(Clone)] -pub struct BankValidator { - bank: Arc, - settings: Settings, -} - -impl SvmValidator for BankValidator { - type Transaction = SanitizedTransaction; - - type TransactionCheckResult = TransactionCheckResult; - - fn get_batch_results<'a>( - &self, - transactions: std::borrow::Cow<'a, [Self::Transaction]>, - ) -> Vec { - let transaction_results = if self.settings.switchs.tx_sanity_check { - self.get_transactions_sanity_results(&transactions) - } else { - transactions.iter().map(|_| Ok(())).collect() - }; - - let batch = self.batch_and_verify_conflicts(transactions, transaction_results.into_iter()); - let result = self.validate_batch(&batch); - result - } -} - -impl TransactionChecks for BankValidator { - type Transaction = SanitizedTransaction; +pub mod error; +pub mod settings; - type Error = crate::Error; +pub use error::{Error, Result}; - fn transactions_sanity_check( - &self, - txs: &[Self::Transaction], - ) -> std::result::Result<(), Self::Error> { - txs.iter() - .map(|tx| { - self.bank - .fully_verify_transaction(tx.to_versioned_transaction()) - }) - .collect::, TransactionError>>()?; - Ok(()) - } +#[macro_use] +extern crate log; - fn transactions_conflict_check( - &self, - txs: &[Self::Transaction], - ) -> std::result::Result<(), Self::Error> { - let tx_account_lock_limit = self.bank.get_transaction_account_lock_limit(); - let results = self - .bank - .rc - .accounts - .lock_accounts(txs.iter(), tx_account_lock_limit); - results - .into_iter() - .collect::, TransactionError>>()?; - Ok(()) - } +#[derive(Clone)] +pub struct BankVerifier { + bank: Arc, + settings: Settings, } -impl BankValidator { +impl BankVerifier { pub fn new(bank: Arc, settings: Settings) -> Self { Self { bank, settings } } @@ -87,7 +39,7 @@ impl BankValidator { .fully_verify_transaction(tx.to_versioned_transaction())?; if resanitized_tx != *tx { // Sanitization before/after epoch give different transaction data - do not execute. - return Err(TransactionError::ResanitizationNeeded.into()); + return Err(TransactionError::ResanitizationNeeded); } Ok(()) }) @@ -122,7 +74,11 @@ impl BankValidator { } else { transaction_results.map(|_| Ok(())).collect() }; - TransactionBatch::new(lock_result, &self.bank, sanitized_txs) + let mut result = TransactionBatch::new(lock_result, &self.bank, sanitized_txs); + if !self.settings.switchs.txs_conflict_check { + result.set_needs_unlock(false); + } + result } pub fn validate_batch(&self, batch: &TransactionBatch) -> Vec { @@ -182,4 +138,41 @@ impl BankValidator { Ok(()) } + + pub fn get_batch_results( + &self, + transactions: Cow<[SanitizedTransaction]>, + ) -> Vec { + let transaction_results = if self.settings.switchs.tx_sanity_check { + self.get_transactions_sanity_results(&transactions) + } else { + transactions.iter().map(|_| Ok(())).collect() + }; + + let batch = self.batch_and_verify_conflicts(transactions, transaction_results.into_iter()); + self.validate_batch(&batch) + } + + pub fn transactions_sanity_check(&self, txs: &[SanitizedTransaction]) -> Result<()> { + txs.iter() + .map(|tx| { + self.bank + .fully_verify_transaction(tx.to_versioned_transaction()) + }) + .collect::, TransactionError>>()?; + Ok(()) + } + + pub fn transactions_conflict_check(&self, txs: &[SanitizedTransaction]) -> Result<()> { + let tx_account_lock_limit = self.bank.get_transaction_account_lock_limit(); + let results = self + .bank + .rc + .accounts + .lock_accounts(txs.iter(), tx_account_lock_limit); + results + .into_iter() + .collect::, TransactionError>>()?; + Ok(()) + } } diff --git a/validator/src/settings.rs b/verifier/src/settings.rs similarity index 72% rename from validator/src/settings.rs rename to verifier/src/settings.rs index d3ac260..d60751a 100644 --- a/validator/src/settings.rs +++ b/verifier/src/settings.rs @@ -1,7 +1,10 @@ +use solana_sdk::fee::FeeStructure; + #[derive(Debug, Clone)] pub struct Settings { pub max_age: usize, pub switchs: Switchs, + pub fee_structure: FeeStructure, } impl Default for Settings { @@ -9,6 +12,7 @@ impl Default for Settings { Self { max_age: 150, // set default max_age from solana switchs: Default::default(), + fee_structure: FeeStructure::new(0.0000005, 0.0, vec![(1_400_000, 0.0)]), } } }