Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental: Cache in client certificate verification (lib and wasm) #2166

Merged
merged 20 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e091f0d
feat(client-lib): scaffold cache system for certificates validation
Alenar Nov 26, 2024
ac0e65b
refactor(client-cli): promote `certificate_client` module to directory
Alenar Nov 26, 2024
b5a953d
refactor(client-lib): implement the certificate client only once
Alenar Nov 27, 2024
bc38aa4
refactor(client-cli): move cache instance directly to the verifier
Alenar Nov 27, 2024
9cdf019
feat(client-lib): define verifier cache api and a simple in memory im…
Alenar Nov 27, 2024
2f207f2
feat(client-lib): add a feedback event for validated certificate from…
Alenar Nov 27, 2024
54e83b1
test(client-lib): use a builder pattern to simplify certificate clien…
Alenar Nov 29, 2024
1f14231
test(client-lib): enable `trace` level logs in debug builds
Alenar Dec 4, 2024
f1f5720
feat(client-cli): use cache system when validating certificates
Alenar Dec 4, 2024
ffa62af
feat(client-lib): add expiration to cache support to `MemoryCertifica…
Alenar Dec 4, 2024
b8f6cf9
feat(client-wasm): add a local storage base certificate verifier cache
Alenar Dec 9, 2024
eb6c90c
feat(client-wasm): add option that enable certificate verification cache
Alenar Dec 10, 2024
622ae0d
feat(explorer): enable certificate verifier cache
Alenar Dec 10, 2024
cf9f7f9
feat(explorer): add reset of the certificate verifier
Alenar Dec 10, 2024
be52d65
feat(client-lib+client-wasm): certificate verifier cache duration can…
Alenar Dec 10, 2024
a93a40f
chore: adjustments following reviews
Alenar Dec 18, 2024
baa1cb6
test(common): allow to chain certificates to direct predecessor when …
Alenar Dec 18, 2024
51b3641
feat(client-lib): enhanced security check when verifying with cache e…
Alenar Dec 18, 2024
3ff980c
feat(explorer): only enable certificate verification cache in unstabl…
Alenar Dec 19, 2024
052de8f
chore: upgrade crate versions
Alenar Dec 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/client-snapshot/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "client-snapshot"
description = "Mithril client snapshot example"
version = "0.1.21"
version = "0.1.22"
authors = ["[email protected]", "[email protected]"]
documentation = "https://mithril.network/doc"
edition = "2021"
Expand Down
10 changes: 10 additions & 0 deletions examples/client-snapshot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ impl FeedbackReceiver for IndicatifFeedbackReceiver {
progress_bar.inc(1);
}
}
MithrilEvent::CertificateFetchedFromCache {
certificate_chain_validation_id: _,
certificate_hash,
} => {
let certificate_validation_pb = self.certificate_validation_pb.read().await;
if let Some(progress_bar) = certificate_validation_pb.as_ref() {
progress_bar.set_message(format!("Cached '{certificate_hash}'"));
progress_bar.inc(1);
}
}
MithrilEvent::CertificateChainValidated {
certificate_chain_validation_id: _,
} => {
Expand Down
2 changes: 1 addition & 1 deletion examples/client-wasm-nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/client-wasm-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mithril-client-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-client-cli"
version = "0.10.5"
version = "0.10.6"
description = "A Mithril Client"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
10 changes: 10 additions & 0 deletions mithril-client-cli/src/utils/feedback_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ impl FeedbackReceiver for IndicatifFeedbackReceiver {
progress_bar.inc(1);
}
}
MithrilEvent::CertificateFetchedFromCache {
certificate_chain_validation_id: _,
certificate_hash,
} => {
let certificate_validation_pb = self.certificate_validation_pb.read().await;
if let Some(progress_bar) = certificate_validation_pb.as_ref() {
progress_bar.set_message(format!("Cached '{certificate_hash}'"));
progress_bar.inc(1);
}
}
MithrilEvent::CertificateChainValidated {
certificate_chain_validation_id: _,
} => {
Expand Down
7 changes: 5 additions & 2 deletions mithril-client-wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-client-wasm"
version = "0.7.2"
version = "0.7.3"
description = "Mithril client WASM"
authors = { workspace = true }
edition = { workspace = true }
Expand All @@ -13,14 +13,17 @@ categories = ["cryptography"]
crate-type = ["cdylib"]

[dependencies]
anyhow = "1.0.94"
async-trait = "0.1.83"
chrono = { version = "0.4.38", features = ["serde"] }
futures = "0.3.31"
mithril-client = { path = "../mithril-client", features = ["unstable"] }
serde = { version = "1.0.215", features = ["derive"] }
serde-wasm-bindgen = "0.6.5"
serde_json = "1.0.132"
wasm-bindgen = "0.2.99"
wasm-bindgen-futures = "0.4.49"
web-sys = { version = "0.3.76", features = ["BroadcastChannel"] }
web-sys = { version = "0.3.76", features = ["BroadcastChannel", "console", "Storage", "Window"] }

[dev-dependencies]
wasm-bindgen-test = "0.3.49"
Expand Down
2 changes: 1 addition & 1 deletion mithril-client-wasm/ci-test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mithril-client-wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mithril-dev/mithril-client-wasm",
"version": "0.7.2",
"version": "0.7.3",
"description": "Mithril client WASM",
"license": "Apache-2.0",
"collaborators": [
Expand Down
Loading
Loading