From fea645329542d5afe10407a90b10148b399beeb9 Mon Sep 17 00:00:00 2001 From: maxrobot Date: Fri, 29 Nov 2024 15:57:17 +0000 Subject: [PATCH] f: stash --- Cargo.lock | 223 ++++++------------ Cargo.toml | 32 +-- .../src/exchange/spot_market.rs | 2 + packages/injective-testing/Cargo.toml | 1 + .../src/multi_test/address_generator.rs | 40 +++- 5 files changed, 131 insertions(+), 167 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 228455be..8469ffe4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -104,7 +104,7 @@ dependencies = [ "derivative", "digest 0.10.7", "itertools 0.10.5", - "num-bigint 0.4.6", + "num-bigint", "num-traits", "paste", "rayon", @@ -128,7 +128,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", @@ -157,7 +157,7 @@ dependencies = [ "ark-serialize-derive", "ark-std", "digest 0.10.7", - "num-bigint 0.4.6", + "num-bigint", ] [[package]] @@ -219,7 +219,7 @@ dependencies = [ "injective-std 1.13.2-auction", "prost 0.12.6", "schemars", - "serde 1.0.210", + "serde", "thiserror", ] @@ -399,7 +399,7 @@ version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -524,8 +524,8 @@ dependencies = [ "eyre", "k256", "rand_core 0.6.4", - "serde 1.0.210", - "serde_json 1.0.128", + "serde", + "serde_json", "signature", "subtle-encoding", "tendermint", @@ -603,8 +603,8 @@ checksum = "93d388adfa9cb449557a92e9318121ac1a481fc4f599213b03a5b62699b403b4" dependencies = [ "cosmwasm-schema-derive 1.5.8", "schemars", - "serde 1.0.210", - "serde_json 1.0.128", + "serde", + "serde_json", "thiserror", ] @@ -616,8 +616,8 @@ checksum = "f86b4d949b6041519c58993a73f4bbfba8083ba14f7001eae704865a09065845" dependencies = [ "cosmwasm-schema-derive 2.1.4", "schemars", - "serde 1.0.210", - "serde_json 1.0.128", + "serde", + "serde_json", "thiserror", ] @@ -658,7 +658,7 @@ dependencies = [ "forward_ref", "hex", "schemars", - "serde 1.0.210", + "serde", "serde-json-wasm 0.5.2", "sha2 0.10.8", "static_assertions 1.1.0", @@ -681,7 +681,7 @@ dependencies = [ "hex", "rand_core 0.6.4", "schemars", - "serde 1.0.210", + "serde", "serde-json-wasm 1.0.1", "sha2 0.10.8", "static_assertions 1.1.0", @@ -695,7 +695,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66de2ab9db04757bcedef2b5984fbe536903ada4a8a9766717a4a71197ef34f6" dependencies = [ "cosmwasm-std 1.5.8", - "serde 1.0.210", + "serde", ] [[package]] @@ -828,7 +828,7 @@ dependencies = [ "itertools 0.13.0", "prost 0.13.3", "schemars", - "serde 1.0.210", + "serde", "sha2 0.10.8", "thiserror", ] @@ -841,7 +841,7 @@ checksum = "f13360e9007f51998d42b1bc6b7fa0141f74feae61ed5fd1e5b0a89eec7b5de1" dependencies = [ "cosmwasm-std 2.1.4", "schemars", - "serde 1.0.210", + "serde", ] [[package]] @@ -853,7 +853,7 @@ dependencies = [ "cosmwasm-schema 2.1.4", "cosmwasm-std 2.1.4", "schemars", - "serde 1.0.210", + "serde", "thiserror", ] @@ -868,7 +868,7 @@ dependencies = [ "cw-storage-plus", "schemars", "semver", - "serde 1.0.210", + "serde", "thiserror", ] @@ -960,7 +960,7 @@ dependencies = [ "injective-cosmwasm 0.3.1", "injective-std 1.13.2-auction", "schemars", - "serde 1.0.210", + "serde", "thiserror", ] @@ -1017,7 +1017,7 @@ dependencies = [ "hashbrown 0.12.3", "hex", "rand_core 0.6.4", - "serde 1.0.210", + "serde", "sha2 0.9.9", "zeroize", ] @@ -1123,7 +1123,7 @@ dependencies = [ "ethbloom", "ethereum-types-serialize", "fixed-hash 0.3.2", - "serde 1.0.210", + "serde", "uint 0.5.0", ] @@ -1133,7 +1133,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1873d77b32bc1891a79dad925f2acbc318ee942b38b9110f9dbc5fbeffcea350" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -1418,7 +1418,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -1542,7 +1542,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58e3cae7e99c7ff5a995da2cf78dd0a5383740eda71d98cf7b1910c301ac69b8" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -1582,7 +1582,7 @@ dependencies = [ "hex", "injective-math 0.3.0", "schemars", - "serde 1.0.210", + "serde", "serde-json-wasm 1.0.1", "serde_repr", "serde_test", @@ -1602,7 +1602,7 @@ dependencies = [ "hex", "injective-math 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "schemars", - "serde 1.0.210", + "serde", "serde_repr", "subtle-encoding", "tiny-keccak", @@ -1624,7 +1624,7 @@ dependencies = [ "injective-testing", "prost 0.12.6", "schemars", - "serde 1.0.210", + "serde", "thiserror", ] @@ -1645,8 +1645,8 @@ dependencies = [ "injective-testing", "prost 0.12.6", "schemars", - "serde 1.0.210", - "serde_json 1.0.128", + "serde", + "serde_json", "thiserror", ] @@ -1659,7 +1659,7 @@ dependencies = [ "ethereum-types", "primitive-types", "schemars", - "serde 1.0.210", + "serde", "subtle-encoding", ] @@ -1673,7 +1673,7 @@ dependencies = [ "ethereum-types", "primitive-types", "schemars", - "serde 1.0.210", + "serde", "subtle-encoding", ] @@ -1689,7 +1689,7 @@ dependencies = [ "prost 0.12.6", "prost-types 0.12.6", "schemars", - "serde 1.0.210", + "serde", "serde-cw-value", ] @@ -1703,7 +1703,7 @@ dependencies = [ "prost 0.12.6", "prost-types 0.12.6", "schemars", - "serde 1.0.210", + "serde", "serde-cw-value", ] @@ -1716,7 +1716,7 @@ dependencies = [ "proc-macro2", "prost 0.12.6", "quote", - "serde 1.0.210", + "serde", "syn 1.0.109", "trybuild", ] @@ -1748,8 +1748,8 @@ dependencies = [ "injective-cosmwasm 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "injective-std 1.13.0", "prost 0.12.6", - "serde 1.0.210", - "serde_json 1.0.128", + "serde", + "serde_json", "test-tube-inj", "thiserror", ] @@ -1768,8 +1768,9 @@ dependencies = [ "injective-test-tube", "prost 0.12.6", "rand 0.4.6", + "regex", "secp256k1", - "serde 1.0.210", + "serde", "tiny-keccak", ] @@ -1930,32 +1931,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "num" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" -dependencies = [ - "num-bigint 0.1.44", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1" -dependencies = [ - "num-integer", - "num-traits", - "rand 0.4.6", - "rustc-serialize", -] - [[package]] name = "num-bigint" version = "0.4.6" @@ -1966,16 +1941,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-complex" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" -dependencies = [ - "num-traits", - "rustc-serialize", -] - [[package]] name = "num-conv" version = "0.1.0" @@ -2002,29 +1967,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" -dependencies = [ - "num-bigint 0.1.44", - "num-integer", - "num-traits", - "rustc-serialize", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -2429,9 +2371,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -2482,8 +2424,8 @@ dependencies = [ "rustls", "rustls-native-certs", "rustls-pemfile", - "serde 1.0.210", - "serde_json 1.0.128", + "serde", + "serde_json", "serde_urlencoded", "sync_wrapper", "system-configuration", @@ -2661,8 +2603,8 @@ checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" dependencies = [ "dyn-clone", "schemars_derive", - "serde 1.0.210", - "serde_json 1.0.128", + "serde", + "serde_json", ] [[package]] @@ -2703,17 +2645,17 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.6.3" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10915a2fa4f8016ed747eb847f096b0d44b22c6b624a36d3cc76964f6af4821a" +checksum = "3f9936100bc0f85f254359b0f86d9aefe8440d00d40d945dbe1908206574b81e" dependencies = [ "arrayvec", "gcc", "libc", "rand 0.3.23", "rustc-serialize", - "serde 0.6.15", - "serde_json 0.6.1", + "serde", + "serde_json", ] [[package]] @@ -2745,15 +2687,6 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -[[package]] -name = "serde" -version = "0.6.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c97b18e9e53de541f11e497357d6c5eaeb39f0cb9c8734e274abe4935f6991fa" -dependencies = [ - "num", -] - [[package]] name = "serde" version = "1.0.210" @@ -2769,7 +2702,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75d32da6b8ed758b7d850b6c3c08f1d7df51a4df3cb201296e63e34a78e99d4" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -2778,7 +2711,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e9213a07d53faa0b8dd81e767a54a8188a242fdb9be99ab75ec576a774bfdd7" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -2787,7 +2720,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f05da0d153dd4595bdffd5099dc0e9ce425b205ee648eb93437ff7302af8c9a5" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -2796,7 +2729,7 @@ version = "0.11.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -2821,16 +2754,6 @@ dependencies = [ "syn 2.0.79", ] -[[package]] -name = "serde_json" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aaee47e038bf9552d30380d3973fff2593ee0a76d81ad4c581f267cdcadf36" -dependencies = [ - "num", - "serde 0.6.15", -] - [[package]] name = "serde_json" version = "1.0.128" @@ -2840,7 +2763,7 @@ dependencies = [ "itoa", "memchr", "ryu", - "serde 1.0.210", + "serde", ] [[package]] @@ -2860,7 +2783,7 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -2869,7 +2792,7 @@ version = "1.0.177" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f901ee573cab6b3060453d2d5f0bae4e6d628c23c0a962ff9b5f1d7c8d4f1ed" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -2881,7 +2804,7 @@ dependencies = [ "form_urlencoded", "itoa", "ryu", - "serde 1.0.210", + "serde", ] [[package]] @@ -3065,9 +2988,9 @@ dependencies = [ "prost 0.12.6", "prost-types 0.12.6", "ripemd", - "serde 1.0.210", + "serde", "serde_bytes", - "serde_json 1.0.128", + "serde_json", "serde_repr", "sha2 0.10.8", "signature", @@ -3085,8 +3008,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1a02da769166e2052cd537b1a97c78017632c2d9e19266367b27e73910434fc" dependencies = [ "flex-error", - "serde 1.0.210", - "serde_json 1.0.128", + "serde", + "serde_json", "tendermint", "toml 0.5.11", "url", @@ -3104,7 +3027,7 @@ dependencies = [ "num-traits", "prost 0.11.9", "prost-types 0.11.9", - "serde 1.0.210", + "serde", "serde_bytes", "subtle-encoding", "time", @@ -3122,7 +3045,7 @@ dependencies = [ "num-traits", "prost 0.12.6", "prost-types 0.12.6", - "serde 1.0.210", + "serde", "serde_bytes", "subtle-encoding", "time", @@ -3144,9 +3067,9 @@ dependencies = [ "rand 0.8.5", "reqwest", "semver", - "serde 1.0.210", + "serde", "serde_bytes", - "serde_json 1.0.128", + "serde_json", "subtle", "subtle-encoding", "tendermint", @@ -3180,8 +3103,8 @@ dependencies = [ "cosmrs", "cosmwasm-std 2.1.4", "prost 0.12.6", - "serde 1.0.210", - "serde_json 1.0.128", + "serde", + "serde_json", "tendermint-proto 0.32.2", "thiserror", ] @@ -3221,7 +3144,7 @@ dependencies = [ "deranged", "num-conv", "powerfmt", - "serde 1.0.210", + "serde", "time-core", "time-macros", ] @@ -3322,7 +3245,7 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -3331,7 +3254,7 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ - "serde 1.0.210", + "serde", "serde_spanned", "toml_datetime", "toml_edit", @@ -3343,7 +3266,7 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ - "serde 1.0.210", + "serde", ] [[package]] @@ -3353,7 +3276,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap 2.6.0", - "serde 1.0.210", + "serde", "serde_spanned", "toml_datetime", "winnow", @@ -3398,9 +3321,9 @@ checksum = "207aa50d36c4be8d8c6ea829478be44a372c6a77669937bb39c698e52f1491e8" dependencies = [ "dissimilar", "glob", - "serde 1.0.210", + "serde", "serde_derive", - "serde_json 1.0.128", + "serde_json", "termcolor", "toml 0.8.19", ] diff --git a/Cargo.toml b/Cargo.toml index cd8448e4..ad83d1a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,20 +32,24 @@ proc-macro2 = { version = "1.0.40" } prost = { version = "0.12.6" } prost-types = { version = "0.12.6", default-features = false } quote = { version = "1.0.20" } -rand = { version = "0.4.6" } -schemars = { version = "0.8.16" } -secp256k1 = { version = "0.6.2" } -serde = { version = "1.0.196", default-features = false, features = [ "derive" ] } -serde-cw-value = { version = "0.7.0" } -serde-json-wasm = { version = "1.0.0" } -serde_json = { version = "1.0.111" } -serde_repr = { version = "0.1.17" } -serde_test = { version = "1.0.176" } -subtle-encoding = { version = "0.5.1", features = [ "bech32-preview" ] } -syn = { version = "1.0.98" } -thiserror = { version = "1.0.56" } -tiny-keccak = { version = "1.2.1" } -trybuild = { version = "1.0.63", features = [ "diff" ] } +# rand = { version = "0.8.5" } +rand = { version = "0.4.6" } +regex = { version = "1.11.1" } +schemars = { version = "0.8.16" } +# secp256k1 = { version = "0.29.0", default-features = false, features = [ "alloc", "hashes" ] } +secp256k1 = { version = "0.7.1" } +serde = { version = "1.0.196", default-features = false, features = [ "derive" ] } +serde-cw-value = { version = "0.7.0" } +serde-json-wasm = { version = "1.0.0" } +serde_json = { version = "1.0.111" } +serde_repr = { version = "0.1.17" } +serde_test = { version = "1.0.176" } +subtle-encoding = { version = "0.5.1", features = [ "bech32-preview" ] } +syn = { version = "1.0.98" } +thiserror = { version = "1.0.56" } +tiny-keccak = { version = "1.2.1" } +# tiny-keccak = { version = "2.0.2", features = [ "keccak" ] } +trybuild = { version = "1.0.63", features = [ "diff" ] } [profile.release] codegen-units = 1 diff --git a/packages/injective-cosmwasm/src/exchange/spot_market.rs b/packages/injective-cosmwasm/src/exchange/spot_market.rs index 4b15cd49..08ce07e4 100644 --- a/packages/injective-cosmwasm/src/exchange/spot_market.rs +++ b/packages/injective-cosmwasm/src/exchange/spot_market.rs @@ -3,6 +3,7 @@ use cosmwasm_std::StdResult; use injective_math::FPDecimal; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; +// use tiny_keccak::{Hasher, Keccak}; use tiny_keccak::Keccak; use super::market::{GenericMarket, MarketStatus}; @@ -60,6 +61,7 @@ impl GenericMarket for SpotMarket { pub fn calculate_spot_market_id(base_denom: String, quote_denom: String) -> StdResult { let mut hasher = Keccak::new_keccak256(); + // let mut hasher = Keccak::v256(); hasher.update((base_denom + "e_denom).as_bytes()); let mut res = [0u8; 32]; hasher.finalize(&mut res); diff --git a/packages/injective-testing/Cargo.toml b/packages/injective-testing/Cargo.toml index 6295550d..0f9a9593 100644 --- a/packages/injective-testing/Cargo.toml +++ b/packages/injective-testing/Cargo.toml @@ -18,6 +18,7 @@ injective-std = { path = "../injective-std" } injective-test-tube = { workspace = true } prost = { workspace = true } rand = { workspace = true } +regex = { workspace = true } secp256k1 = { workspace = true } serde = { workspace = true } tiny-keccak = { workspace = true } diff --git a/packages/injective-testing/src/multi_test/address_generator.rs b/packages/injective-testing/src/multi_test/address_generator.rs index 50bebcc0..b5a9de87 100644 --- a/packages/injective-testing/src/multi_test/address_generator.rs +++ b/packages/injective-testing/src/multi_test/address_generator.rs @@ -2,7 +2,9 @@ use cosmwasm_std::{Addr, Storage}; use cw_multi_test::AddressGenerator; use injective_cosmwasm::addr_to_bech32; use rand::OsRng; +// use rand::rngs::OsRng; use secp256k1::Secp256k1; +// use secp256k1::{rand, Secp256k1, SecretKey}; use std::fmt::Write; use std::u8; @@ -71,12 +73,15 @@ impl AddressGenerator for StorageAwareInjectiveAddressGenerator { } pub fn generate_inj_address() -> Addr { - let secp256k1 = Secp256k1::new(); + let secp = Secp256k1::new(); + // let mut rng = rand::thread_rng(); let mut rng = OsRng::new().expect("failed to create new random number generator"); - let (_, public_key) = secp256k1.generate_keypair(&mut rng).expect("failed to generate key pair"); + let (_, pubkey) = secp.generate_keypair(&mut rng).unwrap(); + // let (_, public_key) = secp256k1.generate_keypair(&mut rng).expect("failed to generate key pair"); - let public_key_array = &public_key.serialize_vec(&secp256k1, false)[1..]; + let public_key_array = &pubkey.serialize_vec(&secp, false)[1..]; let keccak = tiny_keccak::keccak256(public_key_array); + // let keccak = tiny_keccak::keccakf(public_key_array); let address_short = to_hex_string(&keccak[ADDRESS_BYTE_INDEX..], 40); // get rid of the constant 0x04 byte let full_address = format!("0x{address_short}"); let inj_address = addr_to_bech32(full_address); @@ -93,3 +98,32 @@ fn to_hex_string(slice: &[u8], expected_string_size: usize) -> String { result } + +#[cfg(test)] +mod tests { + use super::*; + use regex::Regex; + + #[test] + fn test_generate_inj_address() { + // Generate an Injective address + let generated_address = generate_inj_address(); + + // Ensure the generated address is not empty + assert!(!generated_address.to_string().is_empty(), "Generated address should not be empty"); + + // Ensure the generated address starts with the Injective prefix (e.g., "inj") + assert!(generated_address.as_str().starts_with("inj"), "Generated address should start with 'inj'"); + + // Ensure the address matches a valid bech32 format + let bech32_regex = Regex::new(r"^inj[1-9a-z]{38}$").unwrap(); + assert!( + bech32_regex.is_match(generated_address.as_str()), + "Generated address does not match valid bech32 format" + ); + + // Ensure each generated address is unique (you can extend this for more iterations) + let another_generated_address = generate_inj_address(); + assert_ne!(generated_address, another_generated_address, "Generated addresses should be unique"); + } +}