diff --git a/.gitignore b/.gitignore index 32e0c2d..eee53d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target config /testdata/downloaded -.DS_Store \ No newline at end of file +bin/sgx-prover/sgx/private.pem +.DS_Store diff --git a/Cargo.lock b/Cargo.lock index 4cbed70..b93bc7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -422,6 +422,7 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "867a5469d61480fea08c7333ffeca52d5b621f5ca2e44f271b117ec1fc9a0525" dependencies = [ + "alloy-json-abi", "alloy-sol-macro-input", "const-hex", "heck 0.5.0", @@ -440,11 +441,13 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e482dc33a32b6fadbc0f599adea520bd3aaa585c141a80b404d0a3e3fa72528" dependencies = [ + "alloy-json-abi", "const-hex", "dunce", "heck 0.5.0", "proc-macro2", "quote", + "serde_json", "syn 2.0.76", "syn-solidity", ] @@ -465,6 +468,7 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a91ca40fa20793ae9c3841b83e74569d1cc9af29a2f5237314fd3452d51e38c7" dependencies = [ + "alloy-json-abi", "alloy-primitives", "alloy-sol-macro", "const-hex", @@ -788,7 +792,7 @@ version = "0.1.0" source = "git+https://github.com/automata-network/automata-sgx-sdk#86a40e22744d83cc42d306a8e886137440eb409c" dependencies = [ "automata-sgx-sdk-sysroot", - "base 1.0.0", + "base", "cc", "ctor", "serde", @@ -821,26 +825,17 @@ dependencies = [ [[package]] name = "base" -version = "0.4.6" +version = "1.0.0" +source = "git+https://github.com/automata-network/base-rs#d189ecc97ca5aa1572ab998c332e0b432067ec14" dependencies = [ "alloy", "async-trait", "chrono", - "env_logger", - "log", + "libflate", "secp256k1", "serde", - "serde_json", - "tokio", -] - -[[package]] -name = "base" -version = "1.0.0" -source = "git+https://github.com/automata-network/base-rs#42b6607918d20d4fa5b2b4ea1309792607a4f88e" -dependencies = [ - "chrono", "tokio", + "url", ] [[package]] @@ -937,6 +932,9 @@ name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] [[package]] name = "bitvec" @@ -946,6 +944,7 @@ checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", "radium", + "serde", "tap", "wyz", ] @@ -959,6 +958,19 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bls12_381" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" +dependencies = [ + "ff", + "group", + "pairing", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "blst" version = "0.3.13" @@ -973,12 +985,13 @@ dependencies = [ [[package]] name = "bn254" version = "0.1.0" -source = "git+https://github.com/scroll-tech/bn254#1773ed6c51f14652272056370cf135ff5d7a01c5" +source = "git+https://github.com/scroll-tech/bn254.git?branch=master#db67681f5e9ae1736565a48ec294a6d0dacb4e0d" dependencies = [ "ff", "getrandom", "rand 0.8.5", "rand_core 0.6.4", + "sp1-intrinsics", "subtle", ] @@ -1164,15 +1177,6 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" -[[package]] -name = "clients" -version = "0.4.6" -dependencies = [ - "alloy", - "base 0.4.6", - "url", -] - [[package]] name = "coins-bip32" version = "0.8.7" @@ -1529,7 +1533,7 @@ dependencies = [ [[package]] name = "encoder" version = "0.1.0" -source = "git+https://github.com/scroll-tech/da-codec#9e32313056ac5535b9024ed2db97db73cba3bbc3" +source = "git+https://github.com/scroll-tech/da-codec#8c5d2f0cd707153151a5154fef702204f6ca40b3" dependencies = [ "zstd", ] @@ -2065,6 +2069,7 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash 0.8.11", "allocator-api2", + "serde", ] [[package]] @@ -2642,6 +2647,21 @@ dependencies = [ "sha3-asm", ] +[[package]] +name = "kzg-rs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9920cd4460ce3cbca19c62f3bb9a9611562478a4dc9d2c556f4a7d049c5b6b" +dependencies = [ + "bls12_381", + "glob", + "hex", + "once_cell", + "serde", + "serde_derive", + "serde_yaml", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -2705,10 +2725,10 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "linea-executor" -version = "0.4.6" +version = "0.5.0" dependencies = [ "alloy", - "base 0.4.6", + "base", "linea-zktrie", "log", "revm 13.0.0 (git+https://github.com/automata-network/linea-revm?branch=linea-revm/v41)", @@ -2717,7 +2737,7 @@ dependencies = [ [[package]] name = "linea-mimc" -version = "0.4.6" +version = "0.5.0" dependencies = [ "ff_ce", "lazy_static", @@ -2728,10 +2748,10 @@ dependencies = [ [[package]] name = "linea-shomei" -version = "0.4.6" +version = "0.5.0" dependencies = [ "alloy", - "clients", + "base", "linea-zktrie", "log", "serde", @@ -2740,12 +2760,11 @@ dependencies = [ [[package]] name = "linea-test" -version = "0.4.6" +version = "0.5.0" dependencies = [ "alloy", - "base 0.4.6", + "base", "clap", - "clients", "linea-shomei", "linea-verifier", "log", @@ -2756,11 +2775,10 @@ dependencies = [ [[package]] name = "linea-verifier" -version = "0.4.6" +version = "0.5.0" dependencies = [ "alloy", - "base 0.4.6", - "clients", + "base", "linea-executor", "linea-mimc", "linea-shomei", @@ -2775,11 +2793,11 @@ dependencies = [ [[package]] name = "linea-zktrie" -version = "0.4.6" +version = "0.5.0" dependencies = [ "alloy", "alloy-rlp", - "base 0.4.6", + "base", "lazy_static", "linea-mimc", "log", @@ -3068,6 +3086,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "pairing" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" +dependencies = [ + "group", +] + [[package]] name = "parity-scale-codec" version = "3.6.12" @@ -3216,10 +3243,11 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "poseidon-bn254" version = "0.1.0" -source = "git+https://github.com/scroll-tech/poseidon-bn254?branch=master#a1174dac3d854bd91556b54274551326a94b11e6" +source = "git+https://github.com/scroll-tech/poseidon-bn254?branch=master#a96ba028dd00987551451d8f4bd65b7ea5469a44" dependencies = [ "bn254", "itertools 0.13.0", + "sp1-intrinsics", ] [[package]] @@ -3316,7 +3344,7 @@ dependencies = [ [[package]] name = "prometheus" -version = "0.4.6" +version = "0.5.0" dependencies = [ "alloy", ] @@ -3343,14 +3371,13 @@ dependencies = [ [[package]] name = "prover" -version = "0.4.6" +version = "0.5.0" dependencies = [ "alloy", "async-trait", "automata-sgx-sdk", - "base 0.4.6", + "base", "clap", - "clients", "env_logger", "hex", "jsonrpsee", @@ -3359,6 +3386,7 @@ dependencies = [ "log", "prometheus", "prover-types", + "scroll-da-codec", "scroll-executor", "scroll-verifier", "serde", @@ -3369,11 +3397,13 @@ dependencies = [ [[package]] name = "prover-types" -version = "0.4.6" +version = "0.5.0" dependencies = [ "alloy", - "base 0.4.6", + "base", + "env_logger", "libflate", + "log", "serde", "serde_json", ] @@ -3758,11 +3788,13 @@ dependencies = [ "auto_impl", "bitflags 2.6.0", "bitvec", + "c-kzg", "cfg-if", "dyn-clone", "enumn", "hashbrown 0.14.5", "hex", + "kzg-rs", "poseidon-bn254", "serde", ] @@ -4129,11 +4161,29 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scroll-da-codec" +version = "0.1.0" +source = "git+https://github.com/automata-network/scroll-prover#83efeadde5b2097bf2fc8211bc95ffa2378dff3a" +dependencies = [ + "base", + "blst", + "c-kzg", + "encoder", + "hex", + "lazy_static", + "log", + "scroll-executor", + "serde", + "serde_json", +] + [[package]] name = "scroll-executor" -version = "0.4.6" +version = "0.1.0" +source = "git+https://github.com/automata-network/scroll-prover#83efeadde5b2097bf2fc8211bc95ffa2378dff3a" dependencies = [ - "base 0.4.6", + "base", "eth-types", "mpt-zktrie", "revm 13.0.0 (git+https://github.com/automata-network/scroll-revm?branch=scroll-evm-executor/v41)", @@ -4143,11 +4193,10 @@ dependencies = [ [[package]] name = "scroll-test" -version = "0.4.6" +version = "0.5.0" dependencies = [ - "base 0.4.6", + "base", "clap", - "clients", "env_logger", "hex", "log", @@ -4160,19 +4209,19 @@ dependencies = [ [[package]] name = "scroll-verifier" -version = "0.4.6" +version = "0.1.0" +source = "git+https://github.com/automata-network/scroll-prover#83efeadde5b2097bf2fc8211bc95ffa2378dff3a" dependencies = [ "alloy", - "base 0.4.6", + "base", "blst", "c-kzg", - "clients", "encoder", "hex", "lazy_static", "log", - "prover-types", "rlp", + "scroll-da-codec", "scroll-executor", "scroll-zstd", "serde", @@ -4182,7 +4231,7 @@ dependencies = [ [[package]] name = "scroll-zstd" version = "0.1.0" -source = "git+https://github.com/scroll-tech/da-codec#9e32313056ac5535b9024ed2db97db73cba3bbc3" +source = "git+https://github.com/scroll-tech/da-codec#8c5d2f0cd707153151a5154fef702204f6ca40b3" dependencies = [ "encoder", ] @@ -4377,6 +4426,19 @@ dependencies = [ "syn 2.0.76", ] +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap 2.4.0", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "sgx-dcap-ql-rs" version = "0.1.0" @@ -4395,7 +4457,7 @@ dependencies = [ [[package]] name = "sgx-prover" -version = "0.4.6" +version = "0.5.0" dependencies = [ "automata-build-script", "automata-sgx-sdk", @@ -4625,6 +4687,14 @@ dependencies = [ "sha1", ] +[[package]] +name = "sp1-intrinsics" +version = "0.0.0" +source = "git+https://github.com/scroll-tech/sp1-intrinsics.git?branch=master#7e038e60db0b2e847f6d8f49e148ccac8c6fc394" +dependencies = [ + "cfg-if", +] + [[package]] name = "spin" version = "0.9.8" @@ -5115,6 +5185,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "untrusted" version = "0.9.0" @@ -5521,7 +5597,7 @@ dependencies = [ [[package]] name = "zktrie" version = "0.3.0" -source = "git+https://github.com/scroll-tech/zktrie.git?branch=main#460b8c22af65b7809164548cba1e0253b6db5a70" +source = "git+https://github.com/scroll-tech/zktrie.git?branch=main#0527b14b29abde8ba9fbaf34315d545cf32618a0" dependencies = [ "gobuild", "zktrie_rust", @@ -5530,10 +5606,11 @@ dependencies = [ [[package]] name = "zktrie_rust" version = "0.3.0" -source = "git+https://github.com/scroll-tech/zktrie.git?branch=main#460b8c22af65b7809164548cba1e0253b6db5a70" +source = "git+https://github.com/scroll-tech/zktrie.git?branch=main#0527b14b29abde8ba9fbaf34315d545cf32618a0" dependencies = [ "hex", "lazy_static", + "log", "num", "num-derive", "num-traits", diff --git a/Cargo.toml b/Cargo.toml index 453d7ca..a52fb1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,20 +1,20 @@ [workspace] resolver = "2" -members = ["bin/*", "crates/base", "crates/clients", "crates/prover", "crates/prover-types", "crates/prometheus", "crates/scroll/*", "crates/linea/*"] +members = ["bin/*", "crates/prover", "crates/prover-types", "crates/prometheus", "crates/linea/*"] [workspace.package] edition = "2021" -version = "0.4.6" +version = "0.5.0" authors = ["Automata Team"] homepage = "https://www.ata.network/" [workspace.dependencies] -clients = { path = "crates/clients" } -base = { path = "crates/base" } +base = { git = "https://github.com/automata-network/base-rs", features = ["prover"] } prover-types = { path = "crates/prover-types" } prometheus = { path = "crates/prometheus" } -scroll-executor = { path = "crates/scroll/executor" } -scroll-verifier = { path = "crates/scroll/verifier" } +scroll-executor = { git = "https://github.com/automata-network/scroll-prover" } +scroll-verifier = { git = "https://github.com/automata-network/scroll-prover" } +scroll-da-codec = { git = "https://github.com/automata-network/scroll-prover" } linea-mimc = { path = "crates/linea/mimc" } linea-zktrie = { path = "crates/linea/zktrie" } linea-shomei = { path = "crates/linea/shomei" } @@ -28,7 +28,7 @@ serde_json = { version = "1" } automata-sgx-sdk = { git = "https://github.com/automata-network/automata-sgx-sdk" } automata-build-script = { git = "https://github.com/automata-network/automata-sgx-sdk" } blst = { version = "=0.3.13" } # make sure the patch takes effect -scroll-revm = { package = "revm", git = "https://github.com/automata-network/scroll-revm", branch = "scroll-evm-executor/v41", default-features = false, features = ["scroll-default-handler", "std", "optional_no_base_fee", "scroll-poseidon-codehash"] } +scroll-revm = { package = "revm", git = "https://github.com/automata-network/scroll-revm", branch = "scroll-evm-executor/v41", default-features = false, features = ["scroll-default-handler", "std", "optional_no_base_fee", "scroll-poseidon-codehash", "serde"] } linea-revm = { package = "revm", git = "https://github.com/automata-network/linea-revm", branch = "linea-revm/v41", default-features = false, features = ["std", "secp256k1"] } lazy_static = "1.5.0" diff --git a/bin/linea-test/Cargo.toml b/bin/linea-test/Cargo.toml index a914973..a71588c 100644 --- a/bin/linea-test/Cargo.toml +++ b/bin/linea-test/Cargo.toml @@ -9,7 +9,6 @@ tokio = { version = "1.0", features = ["full"] } base.workspace = true linea-shomei.workspace = true log.workspace = true -clients.workspace = true alloy.workspace = true linea-verifier.workspace = true serde_json.workspace = true diff --git a/bin/linea-test/src/main.rs b/bin/linea-test/src/main.rs index 1e252f5..56bbef3 100644 --- a/bin/linea-test/src/main.rs +++ b/bin/linea-test/src/main.rs @@ -15,6 +15,8 @@ struct Opt { shomei_version: String, #[clap(long, default_value = "http://127.0.0.1:8545", env = "BESU")] besu: String, + #[clap(long, default_value = "60")] + timeout_secs: u64, #[clap(default_value = "0")] block: u64, @@ -22,7 +24,7 @@ struct Opt { #[tokio::main] async fn main() { - base::init_log(); + prover_types::init_log(); let opt = Opt::parse(); let mut eth = None; @@ -62,6 +64,7 @@ async fn fetch_or_gen_block_trace( let cfg = linea_shomei::ShomeiConfig { endpoint: opt.shomei.clone(), version: opt.shomei_version.clone(), + timeout_secs: Some(opt.timeout_secs), }; let client = linea_shomei::Client::new(cfg).unwrap(); if eth.is_none() { diff --git a/bin/scroll-test/Cargo.toml b/bin/scroll-test/Cargo.toml index ceb0b7c..fbf4d53 100644 --- a/bin/scroll-test/Cargo.toml +++ b/bin/scroll-test/Cargo.toml @@ -8,7 +8,6 @@ clap = { version = "4", features = ["derive"] } scroll-verifier.workspace = true scroll-executor.workspace = true prover-types.workspace = true -clients.workspace = true hex.workspace = true serde_json.workspace = true tokio = { version = "1.0", features = ["full"] } diff --git a/bin/sgx-prover/sgx/private.pem b/bin/sgx-prover/sgx/private.pem deleted file mode 100644 index 529d07b..0000000 --- a/bin/sgx-prover/sgx/private.pem +++ /dev/null @@ -1,39 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIG4gIBAAKCAYEAroOogvsj/fZDZY8XFdkl6dJmky0lRvnWMmpeH41Bla6U1qLZ -AmZuyIF+mQC/cgojIsrBMzBxb1kKqzATF4+XwPwgKz7fmiddmHyYz2WDJfAjIveJ -ZjdMjM4+EytGlkkJ52T8V8ds0/L2qKexJ+NBLxkeQLfV8n1mIk7zX7jguwbCG1Pr -nEMdJ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ZzmRg5p0pG/svVQEH -NZmwRwlopysbR69B/n1nefJ84UO50fLh5s5Zr3gBRwbWNZyzhXk= ------END RSA PRIVATE KEY----- diff --git a/crates/base/Cargo.toml b/crates/base/Cargo.toml deleted file mode 100644 index eb13515..0000000 --- a/crates/base/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "base" -version.workspace = true -edition.workspace = true - -[dependencies] -serde.workspace = true -serde_json.workspace = true -log.workspace = true -env_logger.workspace = true -chrono = "0.4.38" -async-trait.workspace = true - -tokio = { version = "1.0", features = ["time", "macros", "rt-multi-thread", "sync"] } -alloy.workspace = true -secp256k1 = { version = "0.29.1", features = ["serde", "rand", "recovery", "global-context"] } diff --git a/crates/base/src/alive.rs b/crates/base/src/alive.rs deleted file mode 100644 index 2dfa83d..0000000 --- a/crates/base/src/alive.rs +++ /dev/null @@ -1,339 +0,0 @@ -use std::{ - sync::{ - atomic::{AtomicBool, Ordering}, - Arc, - }, - time::Duration, -}; - -use tokio::{ - sync::{broadcast, mpsc}, - time::sleep, -}; - -use async_trait::async_trait; - -use crate::{SignedDuration, Time}; - -pub struct Signal { - on: AtomicBool, - notify: broadcast::Sender, -} - -impl Signal { - pub fn new(b: bool) -> Self { - let (notify, _) = broadcast::channel(1); - Self { - on: AtomicBool::new(b), - notify, - } - } - - pub fn get(&self) -> bool { - self.on.load(Ordering::SeqCst) - } - - pub fn set(&self, val: bool) { - self.on.store(val, Ordering::SeqCst); - let _ = self.notify.send(val); - } - - pub async fn wait(&self, target: bool) { - let mut rx = None; - while self.get() != target { - let rx = match rx.as_mut() { - None => { - rx = Some(self.notify.subscribe()); - rx.as_mut().unwrap() - } - Some(n) => n, - }; - let _ = rx.recv().await.unwrap(); - } - } -} - -#[derive(Clone)] -pub struct Alive { - alive: Arc, - parent: Box>, - deadline: Option