From 755254ec32372c18201b614f9b85774d7ac165bf Mon Sep 17 00:00:00 2001 From: Xavier Pinsach <10213118+xavi-pinsach@users.noreply.github.com> Date: Fri, 19 Jul 2024 16:57:17 +0200 Subject: [PATCH] fix clippy warnings&errors --- Cargo.lock | 145 +++++++++--------- state-machines/main/src/main_sm.rs | 10 +- state-machines/mem/src/mem_sm.rs | 10 +- witness-computation/src/pil_helpers/pilout.rs | 10 +- witness-computation/src/zisk_wc.rs | 43 ++++-- 5 files changed, 114 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2b9bfc0..1dd28d5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,9 +125,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytes" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" [[package]] name = "cargo-zisk" @@ -149,13 +149,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.104" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" +checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" dependencies = [ "jobserver", "libc", - "once_cell", ] [[package]] @@ -166,9 +165,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.8" +version = "4.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b3edb18336f4df585bc9aa31dd99c036dfa5dc5e9a2939a722a188f3a8970d" +checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" dependencies = [ "clap_builder", "clap_derive", @@ -176,9 +175,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.8" +version = "4.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1c09dd5ada6c6c78075d6fd0da3f90d8080651e2d6cc8eb2f1aaa4034ced708" +checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" dependencies = [ "anstream", "anstyle", @@ -223,7 +222,7 @@ dependencies = [ [[package]] name = "common" version = "0.1.0" -source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#e8356ce685a1eca358fb8abbaaa1f9086f4fbd55" +source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#cf2ddfefe2b36394913fe4021a600e68afb427fb" dependencies = [ "log", "pilout", @@ -495,9 +494,9 @@ checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "git2" -version = "0.18.3" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70" +checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" dependencies = [ "bitflags", "libc", @@ -537,9 +536,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http", @@ -572,9 +571,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", @@ -738,9 +737,9 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libgit2-sys" -version = "0.16.2+1.7.2" +version = "0.17.0+1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" +checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" dependencies = [ "cc", "libc", @@ -755,7 +754,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" dependencies = [ "cfg-if", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -1069,7 +1068,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -1091,7 +1090,7 @@ dependencies = [ [[package]] name = "pilout" version = "0.1.0" -source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#e8356ce685a1eca358fb8abbaaa1f9086f4fbd55" +source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#cf2ddfefe2b36394913fe4021a600e68afb427fb" dependencies = [ "bytes", "log", @@ -1178,7 +1177,7 @@ dependencies = [ [[package]] name = "proofman" version = "0.1.0" -source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#e8356ce685a1eca358fb8abbaaa1f9086f4fbd55" +source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#cf2ddfefe2b36394913fe4021a600e68afb427fb" dependencies = [ "common", "env_logger", @@ -1352,9 +1351,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ "bitflags", ] @@ -1489,9 +1488,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.10" +version = "0.23.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" dependencies = [ "once_cell", "ring", @@ -1659,7 +1658,7 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "stark" version = "0.1.0" -source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#e8356ce685a1eca358fb8abbaaa1f9086f4fbd55" +source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#cf2ddfefe2b36394913fe4021a600e68afb427fb" dependencies = [ "common", "log", @@ -1676,7 +1675,7 @@ dependencies = [ [[package]] name = "starks-lib-c" version = "0.1.0" -source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#e8356ce685a1eca358fb8abbaaa1f9086f4fbd55" +source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#cf2ddfefe2b36394913fe4021a600e68afb427fb" dependencies = [ "log", ] @@ -1701,9 +1700,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" dependencies = [ "proc-macro2", "quote", @@ -1733,9 +1732,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.14" +version = "0.12.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" +checksum = "4873307b7c257eddcb50c9bedf158eb669578359fb28428bef438fec8e6ba7c2" [[package]] name = "tempfile" @@ -1751,18 +1750,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", @@ -1804,9 +1803,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55115c6fbe2d2bef26eb09ad74bde02d8255476fc0c7b515ef09fbb35742d82" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -1819,9 +1818,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.0" +version = "1.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df" dependencies = [ "backtrace", "bytes", @@ -1932,7 +1931,7 @@ dependencies = [ [[package]] name = "transcript" version = "0.1.0" -source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#e8356ce685a1eca358fb8abbaaa1f9086f4fbd55" +source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#cf2ddfefe2b36394913fe4021a600e68afb427fb" dependencies = [ "starks-lib-c", ] @@ -2006,7 +2005,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "util" version = "0.1.0" -source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#e8356ce685a1eca358fb8abbaaa1f9086f4fbd55" +source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#cf2ddfefe2b36394913fe4021a600e68afb427fb" dependencies = [ "colored", "sysinfo", @@ -2020,9 +2019,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vergen" -version = "8.3.1" +version = "8.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525" +checksum = "2990d9ea5967266ea0ccf413a4aa5c42a93dbcfda9cb49a97de6931726b12566" dependencies = [ "anyhow", "cfg-if", @@ -2128,7 +2127,7 @@ dependencies = [ [[package]] name = "wchelpers" version = "0.1.0" -source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#e8356ce685a1eca358fb8abbaaa1f9086f4fbd55" +source = "git+https://github.com/0xPolygonHermez/pil2-proofman.git?branch=develop#cf2ddfefe2b36394913fe4021a600e68afb427fb" dependencies = [ "common", ] @@ -2181,7 +2180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ "windows-core", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2190,7 +2189,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2208,7 +2207,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2228,18 +2227,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2250,9 +2249,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -2262,9 +2261,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -2274,15 +2273,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -2292,9 +2291,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -2304,9 +2303,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -2316,9 +2315,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -2328,9 +2327,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winreg" diff --git a/state-machines/main/src/main_sm.rs b/state-machines/main/src/main_sm.rs index 5c22ef37..3c923822 100644 --- a/state-machines/main/src/main_sm.rs +++ b/state-machines/main/src/main_sm.rs @@ -18,12 +18,10 @@ impl MainSM { _sm.insert(code.to_string(), Rc::clone(&s)); } } - let main = Rc::new(Self { sm: _sm }); + Rc::new(Self { sm: _sm }) - wcm.register_component(Rc::clone(&main) as Rc>); - wcm.register_executor(Rc::clone(&main) as Rc>); - - main + // wcm.register_component(Rc::clone(&main) as Rc>); + // wcm.register_executor(Rc::clone(&main) as Rc>); } } @@ -37,7 +35,7 @@ impl WCComponent for MainSM { ) { } - fn calculate_plan(&self, ectx: &mut ExecutionCtx) {} + fn suggest_plan(&self, ectx: &mut ExecutionCtx) {} } impl WCExecutor for MainSM { diff --git a/state-machines/mem/src/mem_sm.rs b/state-machines/mem/src/mem_sm.rs index 66a5d094..a71bb914 100644 --- a/state-machines/mem/src/mem_sm.rs +++ b/state-machines/mem/src/mem_sm.rs @@ -11,10 +11,10 @@ pub struct MemSM { impl MemSM { pub fn new(wcm: &mut WCManager) -> Rc { - let mem_sm = Rc::new(MemSM { inputs: RefCell::new(Vec::new()) }); - wcm.register_component(Rc::clone(&mem_sm) as Rc>); + Rc::new(MemSM { inputs: RefCell::new(Vec::new()) }) + // wcm.register_component(Rc::clone(&mem_sm) as Rc>); - mem_sm + // mem_sm } } @@ -30,7 +30,7 @@ impl WCOpCalculator for MemSM { let x_mod = x % module; if verify { - self.inputs.borrow_mut().push((x.into(), x_mod.into())); + self.inputs.borrow_mut().push((x, x_mod)); } Ok(vec![x_mod]) @@ -51,5 +51,5 @@ impl WCComponent for MemSM { ) { } - fn calculate_plan(&self, ectx: &mut ExecutionCtx) {} + fn suggest_plan(&self, ectx: &mut ExecutionCtx) {} } diff --git a/witness-computation/src/pil_helpers/pilout.rs b/witness-computation/src/pil_helpers/pilout.rs index 4ec3afe6..df7ec124 100644 --- a/witness-computation/src/pil_helpers/pilout.rs +++ b/witness-computation/src/pil_helpers/pilout.rs @@ -1,10 +1,10 @@ -use common::WCPilOut; +use common::WCPilout; -pub struct FibonacciVadcopPilout; +pub struct ZiskPilout; -impl FibonacciVadcopPilout { - pub fn get_fibonacci_vadcop_pilout() -> WCPilOut { - let mut pilout = WCPilOut::new("Zisk", 2, b"zisk-hash".to_vec()); +impl ZiskPilout { + pub fn get_pilout() -> WCPilout { + let mut pilout = WCPilout::new("Zisk", 2, b"zisk-hash".to_vec()); let air_group = pilout.add_air_group(Some("Main")); air_group.add_air(Some("FibonacciSquare"), 10); diff --git a/witness-computation/src/zisk_wc.rs b/witness-computation/src/zisk_wc.rs index 9d5ee456..4f989164 100644 --- a/witness-computation/src/zisk_wc.rs +++ b/witness-computation/src/zisk_wc.rs @@ -1,22 +1,22 @@ use std::rc::Rc; -use common::{ExecutionCtx, ProofCtx, WCPilOut}; +use common::{ExecutionCtx, ProofCtx, WCPilout}; use p3_field::AbstractField; use p3_goldilocks::Goldilocks; use proofman::WCManager; use sm_main::MainSM; use sm_mem::MemSM; -use wchelpers::{WCLibrary, WCOpCalculator}; +use wchelpers::{WCExecutor, WCLibrary, WCOpCalculator}; -use crate::FibonacciVadcopPilout; +use crate::ZiskPilout; -pub struct FibonacciVadcop { +pub struct ZiskWC { pub wcm: WCManager, pub main_sm: Rc, pub mem_sm: Rc, } -impl FibonacciVadcop { +impl ZiskWC { pub fn new() -> Self { let mut wcm = WCManager::new(); @@ -25,11 +25,11 @@ impl FibonacciVadcop { let sm = vec![Rc::clone(&mem_sm) as Rc]; let main_sm = MainSM::new(&mut wcm, sm); - FibonacciVadcop { wcm, main_sm, mem_sm } + ZiskWC { wcm, main_sm, mem_sm } } } -impl WCLibrary for FibonacciVadcop { +impl WCLibrary for ZiskWC { fn start_proof(&mut self, pctx: &mut ProofCtx, ectx: &mut ExecutionCtx) { self.wcm.start_proof(pctx, ectx); } @@ -42,22 +42,35 @@ impl WCLibrary for FibonacciVadcop { self.wcm.calculate_plan(ectx); } - fn initialize_air_instances(&mut self, pctx: &mut ProofCtx, ectx: &ExecutionCtx) { - for id in ectx.owned_instances.iter() { - pctx.air_instances.push((&ectx.instances[*id]).into()); - } + fn start_execute(&mut self, pctx: &mut ProofCtx, ectx: &mut ExecutionCtx) { + self.wcm.start_execute(pctx, ectx); } + + fn execute(&self, pctx: &mut ProofCtx, ectx: &mut ExecutionCtx) { + self.main_sm.execute(pctx, ectx); + } + + fn end_execute(&mut self, pctx: &mut ProofCtx, ectx: &mut ExecutionCtx) { + self.wcm.end_execute(pctx, ectx); + } + + // fn initialize_air_instances(&mut self, pctx: &mut ProofCtx, ectx: &ExecutionCtx) { + // for id in ectx.owned_instances.iter() { + // pctx.air_instances.push((&ectx.instances[*id]).into()); + // } + // } + fn calculate_witness(&mut self, stage: u32, pctx: &mut ProofCtx, ectx: &ExecutionCtx) { self.wcm.calculate_witness(stage, pctx, ectx); } - fn get_pilout(&self) -> WCPilOut { - FibonacciVadcopPilout::get_fibonacci_vadcop_pilout() + fn pilout(&self) -> WCPilout { + ZiskPilout::get_pilout() } } #[no_mangle] -pub extern "Rust" fn init_library<'a>() -> Box> { +pub extern "Rust" fn init_library() -> Box> { env_logger::builder() .format_timestamp(None) .format_level(true) @@ -65,5 +78,5 @@ pub extern "Rust" fn init_library<'a>() -> Box> { .filter_level(log::LevelFilter::Trace) .init(); - Box::new(FibonacciVadcop::new()) + Box::new(ZiskWC::new()) }