-
Notifications
You must be signed in to change notification settings - Fork 154
Key image store service and server for router/store system #2954
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
Merged
NotGyro
merged 33 commits into
feature/fog-ledger-router
from
milliec/key-image-store-service
Feb 7, 2023
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
7b896a0
Ledger enclave support for router and store (#2896)
NotGyro 1f4bbc6
Fog Ledger Router Admin service
awygle 371457d
Sort itertools properly in Cargo.toml
awygle 146fe19
Key Image Router Server + Binary
awygle 05936e2
Update router config for parameterized retries
awygle 5b7da21
Changes due to rebase
awygle a5bf815
normalize naming - ledger router, key image store
awygle 1826691
Linting fixes
awygle 7e86d37
Accept code review suggestions
awygle d387b2d
Updates for GRPCIO 0.12
awygle 4c19865
Remove some unwraps in ledger_router binary
awygle 101c94a
Pulling changes in from milliec/ledger-router-dev
NotGyro c0f758c
Making requested changes and clarifications to Fog ledger router comm…
NotGyro cadb1f8
PR feedback nits
awygle abe74db
Key Image Router Service
awygle 7f9b620
Update fog/ledger/server/src/key_image_router_service.rs
NotGyro 698e3bd
Address PR feedback around logging and comments.
awygle 15f223d
Parameterize allowed number of retries for query loop
awygle d03f446
Fog Ledger Router Admin service
awygle 8832017
Sort itertools properly in Cargo.toml
awygle 8cf5fd4
Key Image Router Server + Binary
awygle 5d47c3e
Key image store changes pulled in from milliec/ledger-router-dev
NotGyro c9bd120
Cargo fmt
NotGyro 0e0b849
Run clippy
NotGyro 9e71767
Sort itertools properly in Cargo.toml
awygle af88318
Rebase and update to match current fog ledger router branch
awygle 038ae67
Remove unused dependencies in fog-ledger-server
NotGyro 70a5311
Apply suggestions - Remove unused deps
NotGyro d104c9a
Apply suggestions from comments
NotGyro d6b83a4
Resolving some code quality issues in direct_key_image_store_check()
NotGyro 7f8f80e
Cargo fmt
NotGyro 45fa023
key image server and key image service moved to router server and rou…
NotGyro 073a05b
Apply suggestions from code review
NotGyro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright (c) 2018-2022 The MobileCoin Foundation | ||
|
||
use clap::Parser; | ||
use grpcio::{RpcStatus, RpcStatusCode}; | ||
use mc_common::{logger::log, time::SystemTimeProvider}; | ||
use mc_fog_ledger_enclave::{LedgerSgxEnclave, ENCLAVE_FILE}; | ||
use mc_fog_ledger_server::{KeyImageStoreServer, LedgerStoreConfig}; | ||
use mc_ledger_db::LedgerDB; | ||
use mc_util_grpc::AdminServer; | ||
use mc_watcher::watcher_db::WatcherDB; | ||
|
||
use std::{env, sync::Arc}; | ||
|
||
fn main() { | ||
let (logger, _global_logger_guard) = | ||
mc_common::logger::create_app_logger(mc_common::logger::o!()); | ||
mc_common::setup_panic_handler(); | ||
let config = LedgerStoreConfig::parse(); | ||
|
||
let enclave_path = env::current_exe() | ||
.expect("Could not get the path of our executable") | ||
.with_file_name(ENCLAVE_FILE); | ||
log::info!( | ||
logger, | ||
"enclave path {}, responder ID {}", | ||
enclave_path | ||
.to_str() | ||
.expect("enclave path is not valid UTF-8"), | ||
&config.client_responder_id | ||
); | ||
let enclave = LedgerSgxEnclave::new( | ||
enclave_path, | ||
&config.client_responder_id, | ||
config.omap_capacity, | ||
logger.clone(), | ||
); | ||
|
||
//Get our ledger connection started. | ||
let db = LedgerDB::open(&config.ledger_db).expect("Could not read ledger DB"); | ||
let watcher = | ||
WatcherDB::open_ro(&config.watcher_db, logger.clone()).expect("Could not open watcher DB"); | ||
|
||
let mut store_server = KeyImageStoreServer::new_from_config( | ||
NotGyro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
config.clone(), | ||
enclave, | ||
db, | ||
watcher, | ||
SystemTimeProvider::default(), | ||
logger.clone(), | ||
); | ||
store_server.start(); | ||
|
||
//Initialize the admin api | ||
let config2 = config.clone(); | ||
let get_config_json = Arc::new(move || { | ||
serde_json::to_string(&config2) | ||
.map_err(|err| RpcStatus::with_message(RpcStatusCode::INTERNAL, format!("{err:?}"))) | ||
}); | ||
let _admin_server = config.admin_listen_uri.as_ref().map(|admin_listen_uri| { | ||
AdminServer::start( | ||
None, | ||
admin_listen_uri, | ||
"Fog Ledger".to_owned(), | ||
config.client_responder_id.to_string(), | ||
Some(get_config_json), | ||
logger, | ||
) | ||
.expect("Failed starting admin server") | ||
}); | ||
|
||
loop { | ||
std::thread::sleep(std::time::Duration::from_millis(1000)); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider pulling out the two format values into variables and then use the variables inline in the format string.