From c28f0f4683b51c0463be05d9c0896404916f52be Mon Sep 17 00:00:00 2001 From: refcell Date: Wed, 25 Sep 2024 18:15:05 -0400 Subject: [PATCH 1/7] feat(derive): holocene activation --- crates/derive/src/errors.rs | 38 +++++++++++++++- crates/derive/src/stages/l1_traversal.rs | 12 +++++ examples/trusted-sync/src/main.rs | 56 ++++++++++++++---------- 3 files changed, 80 insertions(+), 26 deletions(-) diff --git a/crates/derive/src/errors.rs b/crates/derive/src/errors.rs index bedda965d..b0bb88e7a 100644 --- a/crates/derive/src/errors.rs +++ b/crates/derive/src/errors.rs @@ -104,7 +104,7 @@ impl PipelineError { } /// A reset error -#[derive(Error, Debug, Eq, PartialEq)] +#[derive(Error, Clone, Debug, Eq, PartialEq)] pub enum ResetError { /// The batch has a bad parent hash. /// The first argument is the expected parent hash, and the second argument is the actual @@ -127,6 +127,16 @@ pub enum ResetError { /// Attributes builder error variant, with [BuilderError]. #[error("Attributes builder error: {0}")] AttributesBuilder(#[from] BuilderError), + /// A Holocene activation temporary error. + #[error("Holocene activation reset")] + HoloceneActivation, +} + +impl ResetError { + /// Wrap [self] as a [PipelineErrorKind::Reset]. + pub const fn reset(self) -> PipelineErrorKind { + PipelineErrorKind::Reset(self) + } } /// A decoding error. @@ -159,7 +169,7 @@ pub enum BatchDecompressionError { /// An [AttributesBuilder] Error. /// /// [AttributesBuilder]: crate::traits::AttributesBuilder -#[derive(Error, Debug, PartialEq, Eq)] +#[derive(Error, Clone, Debug, PartialEq, Eq)] pub enum BuilderError { /// Mismatched blocks. #[error("Block mismatch. Expected {0:?}, got {1:?}")] @@ -199,3 +209,27 @@ pub enum BlobProviderError { #[error("{0}")] Backend(String), } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_reset_error_kinds() { + let reset_errors = [ + ResetError::BadParentHash(Default::default(), Default::default()), + ResetError::BadTimestamp(0, 0), + ResetError::L1OriginMismatch(0, 0), + ResetError::ReorgDetected(Default::default(), Default::default()), + ResetError::AttributesBuilder(BuilderError::BlockMismatch( + Default::default(), + Default::default(), + )), + ResetError::HoloceneActivation, + ]; + for error in reset_errors.into_iter() { + let expected = PipelineErrorKind::Reset(error.clone()); + assert_eq!(error.reset(), expected); + } + } +} diff --git a/crates/derive/src/stages/l1_traversal.rs b/crates/derive/src/stages/l1_traversal.rs index 1831d7347..0b64316d9 100644 --- a/crates/derive/src/stages/l1_traversal.rs +++ b/crates/derive/src/stages/l1_traversal.rs @@ -108,8 +108,20 @@ impl OriginAdvancer for L1Traversal { } crate::set!(ORIGIN_GAUGE, next_l1_origin.number as i64); + + let prev_block_holocene = self.rollup_config.is_holocene_active(block.timestamp); + let next_block_holocene = self.rollup_config.is_holocene_active(next_l1_origin.timestamp); + + // Update the block origin regardless of if a holocene activation is required. self.block = Some(next_l1_origin); self.done = false; + + // If the prev block is not holocene, but the next is, we need to flag this + // so the pipeline driver will reset the pipeline for holocene activation. + if !prev_block_holocene && next_block_holocene { + return Err(ResetError::HoloceneActivation.reset()); + } + Ok(()) } } diff --git a/examples/trusted-sync/src/main.rs b/examples/trusted-sync/src/main.rs index da226785c..2986b711b 100644 --- a/examples/trusted-sync/src/main.rs +++ b/examples/trusted-sync/src/main.rs @@ -214,32 +214,40 @@ async fn sync(cli: cli::Cli) -> Result<()> { metrics::PIPELINE_STEPS.with_label_values(&["origin_advance"]).inc(); trace!(target: "loop", "Advanced origin"); } - StepResult::OriginAdvanceErr(e) => { - metrics::PIPELINE_STEPS.with_label_values(&["origin_advance_failure"]).inc(); - warn!(target: "loop", "Could not advance origin: {:?}", e); - } - StepResult::StepFailed(e) => match e { - PipelineErrorKind::Temporary(e) => { - if matches!(e, PipelineError::NotEnoughData) { - metrics::PIPELINE_STEPS.with_label_values(&["not_enough_data"]).inc(); - debug!(target: "loop", "Not enough data to step derivation pipeline"); - } - } - PipelineErrorKind::Reset(_) => { - metrics::PIPELINE_STEPS.with_label_values(&["reset"]).inc(); - warn!(target: "loop", "Resetting pipeline: {:?}", e); - pipeline - .reset( - cursor.block_info, - pipeline.origin().ok_or(anyhow::anyhow!("Missing origin"))?, - ) - .await?; + sr => { + if let StepResult::OriginAdvanceErr(ref e) = sr { + metrics::PIPELINE_STEPS.with_label_values(&["origin_advance_failure"]).inc(); + warn!(target: "loop", "Could not advance origin: {:?}", e); } - _ => { - metrics::PIPELINE_STEPS.with_label_values(&["failure"]).inc(); - error!(target: "loop", "Error stepping derivation pipeline: {:?}", e); + + match sr { + StepResult::PreparedAttributes | StepResult::AdvancedOrigin => {} + StepResult::OriginAdvanceErr(e) | StepResult::StepFailed(e) => match e { + PipelineErrorKind::Temporary(e) => { + if matches!(e, PipelineError::NotEnoughData) { + metrics::PIPELINE_STEPS + .with_label_values(&["not_enough_data"]) + .inc(); + debug!(target: "loop", "Not enough data to step derivation pipeline"); + } + } + PipelineErrorKind::Reset(_) => { + metrics::PIPELINE_STEPS.with_label_values(&["reset"]).inc(); + warn!(target: "loop", "Resetting pipeline: {:?}", e); + pipeline + .reset( + cursor.block_info, + pipeline.origin().ok_or(anyhow::anyhow!("Missing origin"))?, + ) + .await?; + } + PipelineErrorKind::Critical(_) => { + metrics::PIPELINE_STEPS.with_label_values(&["failure"]).inc(); + error!(target: "loop", "Error stepping derivation pipeline: {:?}", e); + } + }, } - }, + } } // Peek at the next prepared attributes and validate them. From 5ebcb141a7590bfffe0bce643a7a895d765f9a21 Mon Sep 17 00:00:00 2001 From: refcell Date: Thu, 26 Sep 2024 18:15:29 -0400 Subject: [PATCH 2/7] fix: provider test --- crates/derive/src/online/blob_provider.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/derive/src/online/blob_provider.rs b/crates/derive/src/online/blob_provider.rs index 1fbec0a61..4cc0b45e3 100644 --- a/crates/derive/src/online/blob_provider.rs +++ b/crates/derive/src/online/blob_provider.rs @@ -705,7 +705,7 @@ mod tests { assert_eq!(result.unwrap_err(), BlobProviderError::Backend("expected hash 0x0101010101010101010101010101010101010101010101010101010101010101 for blob at index 0 but got 0x01b0761f87b081d5cf10757ccc89f12be355c70e2e29df288b65b30710dcbcd1".to_string())); } - #[tokio::test(flavor = "multi_thread", worker_threads = 2)] + #[tokio::test] async fn test_get_blobs_failed_verification() { let beacon_client = MockBeaconClient { beacon_genesis: Some(APIGenesisResponse::new(10)), From 4015213b91fead6cd1e055043ef3be11d518e6c7 Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 27 Sep 2024 10:07:36 -0400 Subject: [PATCH 3/7] fix: lockfile --- Cargo.lock | 8 ++++---- crates/derive/src/online/blob_provider.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6af68b111..a0f8e4c64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -919,9 +919,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" @@ -1156,9 +1156,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.21" +version = "1.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" +checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0" dependencies = [ "jobserver", "libc", diff --git a/crates/derive/src/online/blob_provider.rs b/crates/derive/src/online/blob_provider.rs index 4cc0b45e3..1fbec0a61 100644 --- a/crates/derive/src/online/blob_provider.rs +++ b/crates/derive/src/online/blob_provider.rs @@ -705,7 +705,7 @@ mod tests { assert_eq!(result.unwrap_err(), BlobProviderError::Backend("expected hash 0x0101010101010101010101010101010101010101010101010101010101010101 for blob at index 0 but got 0x01b0761f87b081d5cf10757ccc89f12be355c70e2e29df288b65b30710dcbcd1".to_string())); } - #[tokio::test] + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_get_blobs_failed_verification() { let beacon_client = MockBeaconClient { beacon_genesis: Some(APIGenesisResponse::new(10)), From 2eab78acb53c6982f8eea26643e2e030d3673526 Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 27 Sep 2024 10:24:33 -0400 Subject: [PATCH 4/7] fix: revm kzg-rs for online --- Cargo.lock | 152 +++++++++++++++++++++++++++++++++-- crates/primitives/Cargo.toml | 6 +- 2 files changed, 149 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a0f8e4c64..aa954e6ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -185,6 +185,17 @@ dependencies = [ "syn 2.0.77", ] +[[package]] +name = "addchain" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + [[package]] name = "addr2line" version = "0.24.1" @@ -738,7 +749,7 @@ dependencies = [ "ark-serialize 0.3.0", "ark-std 0.3.0", "derivative", - "num-bigint", + "num-bigint 0.4.6", "num-traits", "paste", "rustc_version 0.3.3", @@ -758,7 +769,7 @@ dependencies = [ "derivative", "digest 0.10.7", "itertools 0.10.5", - "num-bigint", + "num-bigint 0.4.6", "num-traits", "paste", "rustc_version 0.4.1", @@ -791,7 +802,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-traits", "quote", "syn 1.0.109", @@ -803,7 +814,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-traits", "proc-macro2", "quote", @@ -828,7 +839,7 @@ checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ "ark-std 0.4.0", "digest 0.10.7", - "num-bigint", + "num-bigint 0.4.6", ] [[package]] @@ -956,6 +967,15 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bindgen" version = "0.69.4" @@ -1661,10 +1681,28 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ + "byteorder", + "ff_derive", "rand_core", "subtle", ] +[[package]] +name = "ff_derive" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f54704be45ed286151c5e11531316eaef5b8f5af7d597b806fdb8af108d84a" +dependencies = [ + "addchain", + "cfg-if", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "findshlibs" version = "0.10.2" @@ -2486,6 +2524,19 @@ dependencies = [ "tracing", ] +[[package]] +name = "kzg-rs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0850eb19206463a61bede4f7b7e6b21731807137619044b1f3c287ebcfe2b3b0" +dependencies = [ + "ff", + "hex", + "sha2", + "sp1_bls12_381", + "spin", +] + [[package]] name = "language-tags" version = "0.3.2" @@ -2755,7 +2806,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-complex", "num-integer", "num-iter", @@ -2763,6 +2814,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.6" @@ -2824,7 +2886,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-integer", "num-traits", ] @@ -3036,6 +3098,15 @@ dependencies = [ "sha2", ] +[[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" @@ -3630,6 +3701,7 @@ dependencies = [ "c-kzg", "cfg-if", "k256", + "kzg-rs", "once_cell", "p256", "revm-primitives", @@ -3656,6 +3728,7 @@ dependencies = [ "dyn-clone", "enumn", "hex", + "kzg-rs", "serde", ] @@ -3763,7 +3836,7 @@ dependencies = [ "ark-ff 0.4.2", "bytes", "fastrlp", - "num-bigint", + "num-bigint 0.4.6", "num-traits", "parity-scale-codec", "primitive-types", @@ -3910,6 +3983,30 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scale-info" +version = "2.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" +dependencies = [ + "cfg-if", + "derive_more 0.99.18", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "schannel" version = "0.1.24" @@ -4164,6 +4261,16 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" +[[package]] +name = "snowbridge-amcl" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460a9ed63cdf03c1b9847e8a12a5f5ba19c4efd5869e4a737e05be25d7c427e5" +dependencies = [ + "parity-scale-codec", + "scale-info", +] + [[package]] name = "socket2" version = "0.5.7" @@ -4174,6 +4281,35 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "sp1-lib" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bea7811abd2d3a991007fcb284f41152840b8388c171288d0c52c6793956609c" +dependencies = [ + "anyhow", + "bincode", + "cfg-if", + "hex", + "serde", + "snowbridge-amcl", +] + +[[package]] +name = "sp1_bls12_381" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a27c4b8901334dc09099dd82f80a72ddfc76b0046f4b342584c808f1931bed5a" +dependencies = [ + "cfg-if", + "ff", + "group", + "pairing", + "rand_core", + "sp1-lib", + "subtle", +] + [[package]] name = "spin" version = "0.9.8" diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 6cb526a52..09a2e87d9 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -40,5 +40,9 @@ online = [ "dep:sha2", "dep:revm", "dep:tracing", - "revm/default", + "revm/blst", + "revm/portable", + "revm/secp256k1", + "revm/kzg-rs", + "revm/std", ] From 85ed50799b289b6dcff1892c400419953b187110 Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 27 Sep 2024 10:58:49 -0400 Subject: [PATCH 5/7] fix: increase thread stack size --- Cargo.lock | 152 ++-------------------- crates/derive/src/online/blob_provider.rs | 57 ++++---- crates/primitives/Cargo.toml | 6 +- 3 files changed, 44 insertions(+), 171 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa954e6ac..a0f8e4c64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -185,17 +185,6 @@ dependencies = [ "syn 2.0.77", ] -[[package]] -name = "addchain" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" -dependencies = [ - "num-bigint 0.3.3", - "num-integer", - "num-traits", -] - [[package]] name = "addr2line" version = "0.24.1" @@ -749,7 +738,7 @@ dependencies = [ "ark-serialize 0.3.0", "ark-std 0.3.0", "derivative", - "num-bigint 0.4.6", + "num-bigint", "num-traits", "paste", "rustc_version 0.3.3", @@ -769,7 +758,7 @@ dependencies = [ "derivative", "digest 0.10.7", "itertools 0.10.5", - "num-bigint 0.4.6", + "num-bigint", "num-traits", "paste", "rustc_version 0.4.1", @@ -802,7 +791,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" dependencies = [ - "num-bigint 0.4.6", + "num-bigint", "num-traits", "quote", "syn 1.0.109", @@ -814,7 +803,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ - "num-bigint 0.4.6", + "num-bigint", "num-traits", "proc-macro2", "quote", @@ -839,7 +828,7 @@ checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ "ark-std 0.4.0", "digest 0.10.7", - "num-bigint 0.4.6", + "num-bigint", ] [[package]] @@ -967,15 +956,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bindgen" version = "0.69.4" @@ -1681,28 +1661,10 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ - "byteorder", - "ff_derive", "rand_core", "subtle", ] -[[package]] -name = "ff_derive" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f54704be45ed286151c5e11531316eaef5b8f5af7d597b806fdb8af108d84a" -dependencies = [ - "addchain", - "cfg-if", - "num-bigint 0.3.3", - "num-integer", - "num-traits", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "findshlibs" version = "0.10.2" @@ -2524,19 +2486,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "kzg-rs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0850eb19206463a61bede4f7b7e6b21731807137619044b1f3c287ebcfe2b3b0" -dependencies = [ - "ff", - "hex", - "sha2", - "sp1_bls12_381", - "spin", -] - [[package]] name = "language-tags" version = "0.3.2" @@ -2806,7 +2755,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ - "num-bigint 0.4.6", + "num-bigint", "num-complex", "num-integer", "num-iter", @@ -2814,17 +2763,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-bigint" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-bigint" version = "0.4.6" @@ -2886,7 +2824,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "num-bigint 0.4.6", + "num-bigint", "num-integer", "num-traits", ] @@ -3098,15 +3036,6 @@ dependencies = [ "sha2", ] -[[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" @@ -3701,7 +3630,6 @@ dependencies = [ "c-kzg", "cfg-if", "k256", - "kzg-rs", "once_cell", "p256", "revm-primitives", @@ -3728,7 +3656,6 @@ dependencies = [ "dyn-clone", "enumn", "hex", - "kzg-rs", "serde", ] @@ -3836,7 +3763,7 @@ dependencies = [ "ark-ff 0.4.2", "bytes", "fastrlp", - "num-bigint 0.4.6", + "num-bigint", "num-traits", "parity-scale-codec", "primitive-types", @@ -3983,30 +3910,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scale-info" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" -dependencies = [ - "cfg-if", - "derive_more 0.99.18", - "parity-scale-codec", - "scale-info-derive", -] - -[[package]] -name = "scale-info-derive" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "schannel" version = "0.1.24" @@ -4261,16 +4164,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" -[[package]] -name = "snowbridge-amcl" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460a9ed63cdf03c1b9847e8a12a5f5ba19c4efd5869e4a737e05be25d7c427e5" -dependencies = [ - "parity-scale-codec", - "scale-info", -] - [[package]] name = "socket2" version = "0.5.7" @@ -4281,35 +4174,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "sp1-lib" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bea7811abd2d3a991007fcb284f41152840b8388c171288d0c52c6793956609c" -dependencies = [ - "anyhow", - "bincode", - "cfg-if", - "hex", - "serde", - "snowbridge-amcl", -] - -[[package]] -name = "sp1_bls12_381" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27c4b8901334dc09099dd82f80a72ddfc76b0046f4b342584c808f1931bed5a" -dependencies = [ - "cfg-if", - "ff", - "group", - "pairing", - "rand_core", - "sp1-lib", - "subtle", -] - [[package]] name = "spin" version = "0.9.8" diff --git a/crates/derive/src/online/blob_provider.rs b/crates/derive/src/online/blob_provider.rs index 1fbec0a61..c0c49cb26 100644 --- a/crates/derive/src/online/blob_provider.rs +++ b/crates/derive/src/online/blob_provider.rs @@ -705,28 +705,41 @@ mod tests { assert_eq!(result.unwrap_err(), BlobProviderError::Backend("expected hash 0x0101010101010101010101010101010101010101010101010101010101010101 for blob at index 0 but got 0x01b0761f87b081d5cf10757ccc89f12be355c70e2e29df288b65b30710dcbcd1".to_string())); } - #[tokio::test(flavor = "multi_thread", worker_threads = 2)] - async fn test_get_blobs_failed_verification() { - let beacon_client = MockBeaconClient { - beacon_genesis: Some(APIGenesisResponse::new(10)), - config_spec: Some(APIConfigResponse::new(12)), - blob_sidecars: Some(APIGetBlobSidecarsResponse { - data: vec![APIBlobSidecar { inner: BlobSidecar::default(), ..Default::default() }], - }), - ..Default::default() - }; - let mut blob_provider: OnlineBlobProvider<_, SimpleSlotDerivation> = - OnlineBlobProvider::new(beacon_client, None, None); - let block_ref = BlockInfo { timestamp: 15, ..Default::default() }; - let blob_hashes = vec![IndexedBlobHash { - hash: b256!("01b0761f87b081d5cf10757ccc89f12be355c70e2e29df288b65b30710dcbcd1"), - ..Default::default() - }]; - let result = blob_provider.get_blobs(&block_ref, &blob_hashes).await; - assert_eq!( - result, - Err(BlobProviderError::Backend("blob at index 0 failed verification".to_string())) - ); + #[test] + fn test_get_blobs_failed_verification() { + tokio::runtime::Builder::new_multi_thread() + .worker_threads(2) + .thread_stack_size(8 * 32 * 32 * 1024) // 8 MiB + .enable_all() + .build() + .unwrap() + .block_on(async { + let beacon_client = MockBeaconClient { + beacon_genesis: Some(APIGenesisResponse::new(10)), + config_spec: Some(APIConfigResponse::new(12)), + blob_sidecars: Some(APIGetBlobSidecarsResponse { + data: vec![APIBlobSidecar { + inner: BlobSidecar::default(), + ..Default::default() + }], + }), + ..Default::default() + }; + let mut blob_provider: OnlineBlobProvider<_, SimpleSlotDerivation> = + OnlineBlobProvider::new(beacon_client, None, None); + let block_ref = BlockInfo { timestamp: 15, ..Default::default() }; + let blob_hashes = vec![IndexedBlobHash { + hash: b256!("01b0761f87b081d5cf10757ccc89f12be355c70e2e29df288b65b30710dcbcd1"), + ..Default::default() + }]; + let result = blob_provider.get_blobs(&block_ref, &blob_hashes).await; + assert_eq!( + result, + Err(BlobProviderError::Backend( + "blob at index 0 failed verification".to_string() + )) + ); + }) } #[tokio::test] diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 09a2e87d9..6cb526a52 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -40,9 +40,5 @@ online = [ "dep:sha2", "dep:revm", "dep:tracing", - "revm/blst", - "revm/portable", - "revm/secp256k1", - "revm/kzg-rs", - "revm/std", + "revm/default", ] From fe2a5338a9c46b6307981a6794fe61c00d332c82 Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 27 Sep 2024 12:23:04 -0400 Subject: [PATCH 6/7] fix: bump stack size --- .github/workflows/coverage.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index bbab1da37..958725f30 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -26,7 +26,7 @@ jobs: run: cargo generate-lockfile - name: cargo llvm-cov run: | - cargo llvm-cov nextest --locked --workspace --lcov --output-path lcov.info --features test-utils --profile ci && \ + RUST_MIN_STACK=33554432 cargo llvm-cov nextest --locked --workspace --lcov --output-path lcov.info --features test-utils --profile ci && \ mv ./target/nextest/ci/junit.xml ./junit.xml - name: Record Rust version run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV" From 6cd14b8053ed6befba7df30bd4c35942976086eb Mon Sep 17 00:00:00 2001 From: refcell Date: Fri, 27 Sep 2024 12:24:26 -0400 Subject: [PATCH 7/7] fix: bump stack size --- crates/derive/src/online/blob_provider.rs | 57 +++++++++-------------- 1 file changed, 22 insertions(+), 35 deletions(-) diff --git a/crates/derive/src/online/blob_provider.rs b/crates/derive/src/online/blob_provider.rs index c0c49cb26..1fbec0a61 100644 --- a/crates/derive/src/online/blob_provider.rs +++ b/crates/derive/src/online/blob_provider.rs @@ -705,41 +705,28 @@ mod tests { assert_eq!(result.unwrap_err(), BlobProviderError::Backend("expected hash 0x0101010101010101010101010101010101010101010101010101010101010101 for blob at index 0 but got 0x01b0761f87b081d5cf10757ccc89f12be355c70e2e29df288b65b30710dcbcd1".to_string())); } - #[test] - fn test_get_blobs_failed_verification() { - tokio::runtime::Builder::new_multi_thread() - .worker_threads(2) - .thread_stack_size(8 * 32 * 32 * 1024) // 8 MiB - .enable_all() - .build() - .unwrap() - .block_on(async { - let beacon_client = MockBeaconClient { - beacon_genesis: Some(APIGenesisResponse::new(10)), - config_spec: Some(APIConfigResponse::new(12)), - blob_sidecars: Some(APIGetBlobSidecarsResponse { - data: vec![APIBlobSidecar { - inner: BlobSidecar::default(), - ..Default::default() - }], - }), - ..Default::default() - }; - let mut blob_provider: OnlineBlobProvider<_, SimpleSlotDerivation> = - OnlineBlobProvider::new(beacon_client, None, None); - let block_ref = BlockInfo { timestamp: 15, ..Default::default() }; - let blob_hashes = vec![IndexedBlobHash { - hash: b256!("01b0761f87b081d5cf10757ccc89f12be355c70e2e29df288b65b30710dcbcd1"), - ..Default::default() - }]; - let result = blob_provider.get_blobs(&block_ref, &blob_hashes).await; - assert_eq!( - result, - Err(BlobProviderError::Backend( - "blob at index 0 failed verification".to_string() - )) - ); - }) + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] + async fn test_get_blobs_failed_verification() { + let beacon_client = MockBeaconClient { + beacon_genesis: Some(APIGenesisResponse::new(10)), + config_spec: Some(APIConfigResponse::new(12)), + blob_sidecars: Some(APIGetBlobSidecarsResponse { + data: vec![APIBlobSidecar { inner: BlobSidecar::default(), ..Default::default() }], + }), + ..Default::default() + }; + let mut blob_provider: OnlineBlobProvider<_, SimpleSlotDerivation> = + OnlineBlobProvider::new(beacon_client, None, None); + let block_ref = BlockInfo { timestamp: 15, ..Default::default() }; + let blob_hashes = vec![IndexedBlobHash { + hash: b256!("01b0761f87b081d5cf10757ccc89f12be355c70e2e29df288b65b30710dcbcd1"), + ..Default::default() + }]; + let result = blob_provider.get_blobs(&block_ref, &blob_hashes).await; + assert_eq!( + result, + Err(BlobProviderError::Backend("blob at index 0 failed verification".to_string())) + ); } #[tokio::test]