feat(vault)!: add multi-operator Shamir custody #106
2 Participants
Notifications
Due Date
No due date set.
Blocks
Depends on
#107 WIP: feat shamir
MarketTakers/arbiter
#108 refactor(custody): drop the single-implementation CustodyStore trait
MarketTakers/arbiter
Reference: MarketTakers/arbiter#106
Reference in New Issue
Block a user
Delete Branch "feat-shamir-custody"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
666cf52755toc722712166@@ -78,6 +78,7 @@ pub_underscore_fields = "allow"redundant_pub_crate = "allow"uninhabited_references = "allow" # safe with unsafe_code = "forbid" and standard uninhabited pattern (match *self {})too-many-lines = "allow" # this is a very common pattern in server code, and it's not always possible to break it down into smaller modules without hurting readabilityunused_async_trait_impl = "allow" # to pedantic*too
@@ -90,0 +116,4 @@});}let registered = diesel::select(diesel::dsl::exists(use
diesel::preludeme completely forgot to use
generate_token, wigga@@ -90,0 +123,4 @@.await?;let token = if registered {match tokio::fs::read_to_string(&path).await {no.
TOKEN SHOULD BE REGENERATED everytime
@@ -90,1 +145,4 @@})}fn is_correct_token(&mut self, token: &[u8]) -> bool {remove
@@ -0,0 +40,4 @@total: usize,key: &mut KeyCell,rng: impl CryptoRng,) -> Result<SafeCell<Vec<Vec<u8>>>, ShamirError> {Probably should be a vector of SafeCell's isntead, e.g.
Vec<SafeCell<Vec<u8>>>.@@ -0,0 +41,4 @@key: &mut KeyCell,rng: impl CryptoRng,) -> Result<SafeCell<Vec<Vec<u8>>>, ShamirError> {if total == 0 || threshold == 0 || threshold > total || total == 2 || total > MAX_COMMITTEE_SIZEWe do support 2 total committee members, or is that including recovery operators?
Clarify with a comment
Total is total, so we do NOT support 2 committee members without a recovery operator.
We support
1-of-1and2-of-3, and there is no intermediate state.Re-check
ARCHITECTURE.md, there is probably a logical contradiction.@@ -0,0 +54,4 @@.try_into().map_err(|_| ShamirError::Split("unexpected seal key length".to_owned()))?;if threshold == 1 {This should be at the top of the function
@@ -0,0 +86,4 @@}let combined = shares.read_inline(|shares| {if threshold == 1 {Again, early exit as well
@@ -0,0 +134,4 @@let mut key = KeyCell::from(expected);let rng = UnwrapErr(SysRng);let mut shares = split_key(2, 3, &mut key, rng).expect("split should succeed");for indexes in [[0_usize, 1_usize], [0, 2], [1, 2]] {nice place for
https://github.com/la10736/rstest@@ -0,0 +1,162 @@//! Storage for Shamir custody material: the reconstruction threshold and thePurpose of this model compared to just creating an in-memory sqlite database?
#108
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.