MCPcopy Create free account
hub / github.com/cowprotocol/services / wrapper_cache_detects_wrappers

Function wrapper_cache_detects_wrappers

crates/app-data/src/app_data.rs:898–913  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

896
897 #[test]
898 fn wrapper_cache_detects_wrappers() {
899 let cache = WrapperCache::new(100);
900 let h = |b: u8| AppDataHash([b; 32]);
901
902 assert!(!cache.has_wrappers(&h(1), None));
903 assert!(!cache.has_wrappers(&h(2), Some("{}")));
904 assert!(!cache.has_wrappers(&h(3), Some(r#"{"metadata": {}}"#)));
905 assert!(!cache.has_wrappers(&h(4), Some(r#"{"metadata": {"wrappers": []}}"#)));
906 assert!(cache.has_wrappers(
907 &h(5),
908 Some(r#"{"metadata": {"wrappers": [{"address": "0x0000000000000000000000000000000000000001", "data": "0x"}]}}"#),
909 ));
910
911 // Second call hits the cache
912 assert!(cache.has_wrappers(&h(5), None));
913 }
914
915 #[test]
916 fn misc() {

Callers

nothing calls this directly

Calls 2

AppDataHashClass · 0.70
newFunction · 0.50

Tested by

no test coverage detected