-
Notifications
You must be signed in to change notification settings - Fork 784
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aad397f
commit 33d8645
Showing
24 changed files
with
1,205 additions
and
52 deletions.
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 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 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 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 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 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 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 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,78 @@ | ||
use account_utils::ZeroizeString; | ||
use eth2_keystore::Keystore; | ||
use serde::{Deserialize, Serialize}; | ||
use slashing_protection::interchange::Interchange; | ||
use types::PublicKeyBytes; | ||
|
||
#[derive(Debug, Deserialize, Serialize, PartialEq)] | ||
pub struct ListKeystoresResponse { | ||
pub keystores: Vec<SingleKeystoreResponse>, | ||
} | ||
|
||
#[derive(Debug, Deserialize, Serialize, PartialEq)] | ||
pub struct SingleKeystoreResponse { | ||
pub validating_pubkey: PublicKeyBytes, | ||
pub derivation_path: Option<String>, | ||
} | ||
|
||
#[derive(Deserialize, Serialize)] | ||
pub struct ImportKeystoresRequest { | ||
pub keystores: Vec<Keystore>, | ||
pub keystores_password: ZeroizeString, | ||
pub slashing_protection: Option<Interchange>, | ||
} | ||
|
||
#[derive(Debug, Deserialize, Serialize)] | ||
pub struct ImportKeystoresResponse { | ||
pub statuses: Vec<Status<ImportKeystoreStatus>>, | ||
} | ||
|
||
#[derive(Debug, Clone, Deserialize, Serialize)] | ||
pub struct Status<T> { | ||
pub status: T, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub message: Option<String>, | ||
} | ||
|
||
impl<T> Status<T> { | ||
pub fn ok(status: T) -> Self { | ||
Self { | ||
status, | ||
message: None, | ||
} | ||
} | ||
|
||
pub fn error(status: T, message: String) -> Self { | ||
Self { | ||
status, | ||
message: Some(message), | ||
} | ||
} | ||
} | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)] | ||
#[serde(rename_all = "kebab-case")] | ||
pub enum ImportKeystoreStatus { | ||
Imported, | ||
Duplicate, | ||
Error, | ||
} | ||
|
||
#[derive(Deserialize, Serialize)] | ||
pub struct DeleteKeystoresRequest { | ||
pub pubkeys: Vec<PublicKeyBytes>, | ||
} | ||
|
||
#[derive(Debug, Deserialize, Serialize)] | ||
pub struct DeleteKeystoresResponse { | ||
pub statuses: Vec<Status<DeleteKeystoreStatus>>, | ||
pub slashing_protection: Interchange, | ||
} | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)] | ||
#[serde(rename_all = "kebab-case")] | ||
pub enum DeleteKeystoreStatus { | ||
Deleted, | ||
NotFound, | ||
Error, | ||
} |
This file contains 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 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 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 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 |
---|---|---|
|
@@ -3,6 +3,11 @@ name = "slashing_protection" | |
version = "0.1.0" | ||
authors = ["Michael Sproul <[email protected]>", "pscott <[email protected]>"] | ||
edition = "2018" | ||
autotests = false | ||
|
||
[[test]] | ||
name = "slashing_protection_tests" | ||
path = "tests/main.rs" | ||
|
||
[dependencies] | ||
tempfile = "3.1.0" | ||
|
Binary file added
BIN
+28 KB
validator_client/slashing_protection/migration-tests/v0_no_enabled_column.sqlite
Binary file not shown.
This file contains 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 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.