From 0a51f1ab1a07b1c92d6892741b4db9876990528d Mon Sep 17 00:00:00 2001 From: katelyn martin Date: Mon, 8 Jan 2024 12:40:14 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=93=9D=20implement=20mock-cometbf?= =?UTF-8?q?t=20crate=20(work-in-progress)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this commit introduces a new library, in `crates/test/`. this library contains a mock implementation of cometbft, for use in cargo integration tests. * this does NOT add the `penumbra-mock-cometbft` crate to the list of crates included in the rust documentation in `deployments/scripts/rust-docs`. the `penumbra-tct-property-test` crate was also not included in that list at the time of writing. /!\ ------------------------------------------------------- /!\ /!\ NOTE: this is a rolling work-in-progress. /!\ /!\ this branch will be force-pushed frequently until it is /!\ /!\ ready for review. proceed accordingly! /!\ /!\ ------------------------------------------------------- /!\ --- Cargo.lock | 4 ++++ Cargo.toml | 1 + crates/test/mock-cometbft/Cargo.toml | 8 ++++++++ crates/test/mock-cometbft/src/lib.rs | 14 ++++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 crates/test/mock-cometbft/Cargo.toml create mode 100644 crates/test/mock-cometbft/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 501ee450dd..b85693f316 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5476,6 +5476,10 @@ dependencies = [ "url", ] +[[package]] +name = "penumbra-mock-cometbft" +version = "0.64.1" + [[package]] name = "penumbra-num" version = "0.64.1" diff --git a/Cargo.toml b/Cargo.toml index e6ac21c3c2..a9898c9971 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,7 @@ members = [ "crates/bin/pcli", "crates/wasm", "crates/test/tct-property-test", + "crates/test/mock-cometbft", "crates/misc/measure", "crates/misc/tct-visualize", "crates/bench", diff --git a/crates/test/mock-cometbft/Cargo.toml b/crates/test/mock-cometbft/Cargo.toml new file mode 100644 index 0000000000..34aea8b30d --- /dev/null +++ b/crates/test/mock-cometbft/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "penumbra-mock-cometbft" +version = "0.64.1" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/crates/test/mock-cometbft/src/lib.rs b/crates/test/mock-cometbft/src/lib.rs new file mode 100644 index 0000000000..7d12d9af81 --- /dev/null +++ b/crates/test/mock-cometbft/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +}