-
Notifications
You must be signed in to change notification settings - Fork 45
Bootstore message handler implementation #1687
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
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
412a6af
wip
andrewjstone 6c474d5
start implementing node methods
andrewjstone 827ee53
Add rack table and allow multiple connections
andrewjstone a2240e8
Add support for rack init
andrewjstone 735d902
Add test for rack initialization
andrewjstone 16bc051
Implement KeySharePrepare handling
andrewjstone 3171843
Better error wrapping
andrewjstone 9de3249
more specific error handling in node test
andrewjstone 3ea0e6e
key_share_commit implemnented and positive test for reconfiguration
andrewjstone 7e139c2
Add some negative tests
andrewjstone b84d120
Parse UUID strings in DB layer and some other small fixes
andrewjstone 0b6f4d2
clippy clean
andrewjstone fe3f84a
Db now contains the one true connection
andrewjstone a55e683
Add trigger to ensure only one rack row is present
andrewjstone 3336ea4
remove implemented TODO comment
andrewjstone 39a7ca6
cleanup after myself
andrewjstone 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,67 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
//! DB related errors | ||
|
||
use serde::{Deserialize, Serialize}; | ||
use uuid::Uuid; | ||
|
||
#[derive(thiserror::Error, Debug, Clone, PartialEq, Serialize, Deserialize)] | ||
pub enum Error { | ||
#[error("Failed to open db connection to {path}: {err}")] | ||
DbOpen { path: String, err: String }, | ||
|
||
#[error("Diesel/sqlite error: {err}")] | ||
Diesel { err: String }, | ||
|
||
#[error("BCS serialization error: {err}")] | ||
Bcs { err: String }, | ||
|
||
#[error("Failed to parse string as UUID: {uuidstr} - {err}")] | ||
ParseUuid { uuidstr: String, err: String }, | ||
|
||
// Temporary until the using code is written | ||
#[allow(dead_code)] | ||
#[error("Share commit for {epoch} does not match prepare")] | ||
CommitHashMismatch { epoch: i32 }, | ||
|
||
#[error("No shares have been committed")] | ||
NoSharesCommitted, | ||
|
||
#[error("DB invariant violated: {0}")] | ||
DbInvariant(String), | ||
|
||
#[error("Already initialized with rack uuid: {0}")] | ||
AlreadyInitialized(Uuid), | ||
|
||
#[error( | ||
"Tried to Prepare a KeyShare with epoch {epoch}, but found one \ | ||
with later epoch {stored_epoch}" | ||
)] | ||
OldKeySharePrepare { epoch: i32, stored_epoch: i32 }, | ||
|
||
#[error("A distinct key share already exists for epoch {epoch}")] | ||
KeyShareAlreadyExists { epoch: i32 }, | ||
|
||
#[error("Rack UUID mismatch: Expected: {expected}, Actual: {actual:?}")] | ||
RackUuidMismatch { expected: Uuid, actual: Option<Uuid> }, | ||
|
||
#[error("Rack not initialized")] | ||
RackNotInitialized, | ||
|
||
#[error("Key share for epoch {epoch} not committed")] | ||
KeyShareNotCommitted { epoch: i32 }, | ||
} | ||
|
||
impl From<diesel::result::Error> for Error { | ||
fn from(err: diesel::result::Error) -> Self { | ||
Error::Diesel { err: err.to_string() } | ||
} | ||
} | ||
|
||
impl From<bcs::Error> for Error { | ||
fn from(err: bcs::Error) -> Self { | ||
Error::Bcs { err: err.to_string() } | ||
} | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.