-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit includes a big refactor of the code including the introduction of a `Hash` struct for hashing different input. Resolves #202 #248
- Loading branch information
Showing
22 changed files
with
912 additions
and
865 deletions.
There are no files selected for viewing
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
File renamed without changes.
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,31 @@ | ||
// 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 http://mozilla.org/MPL/2.0/. | ||
// | ||
// Copyright (c) DUSK NETWORK. All rights reserved. | ||
|
||
use dusk_safe::Error as SafeError; | ||
|
||
/// Defines all possible error variants for SAFE | ||
#[derive(Debug, Clone, Copy, PartialEq)] | ||
pub enum Error { | ||
/// A call to during the lifetime of the [`safe::Sponge`] that doesn't fit | ||
/// the io-pattern. | ||
IOPatternViolation, | ||
|
||
/// An invalid io-pattern. | ||
InvalidIOPattern, | ||
|
||
/// The input doesn't yield enough input elements. | ||
TooFewInputElements, | ||
} | ||
|
||
impl From<SafeError> for Error { | ||
fn from(safe_error: SafeError) -> Self { | ||
match safe_error { | ||
SafeError::IOPatternViolation => Self::IOPatternViolation, | ||
SafeError::InvalidIOPattern => Self::InvalidIOPattern, | ||
SafeError::TooFewInputElements => Self::TooFewInputElements, | ||
} | ||
} | ||
} |
Oops, something went wrong.