Squashed commit of Rust-ifying the repo:

commit e31c1965a2e6b9a21ce68be63b81915b2b090f1d
Author: Hernando Castano <castano.ha@gmail.com>
Date:   Sun Feb 2 21:15:42 2020 -0500

    Get Ethereum bridge module compiling

commit a497fc1640e68682f61b39414ffb15206c6120e2
Author: Hernando Castano <castano.ha@gmail.com>
Date:   Thu Jan 30 12:15:43 2020 -0500

    Make the toml file look a bit better

commit 898fb7b06cfac7cf866e1a28fed9a4f02bd246a7
Author: Hernando Castano <castano.ha@gmail.com>
Date:   Thu Jan 30 12:06:27 2020 -0500

    Get substrate bridge module compiling

commit 81e1547e6bec9f590cad9ffba0ee5dfa82cda1c1
Author: Hernando Castano <castano.ha@gmail.com>
Date:   Thu Jan 30 11:40:29 2020 -0500

    Create workspace and move more files around
This commit is contained in:
Hernando Castano
2020-02-02 21:29:06 -05:00
committed by Bastian Köcher
parent c06777a42a
commit fbaa803034
25 changed files with 142 additions and 6355 deletions
+84
View File
@@ -0,0 +1,84 @@
// Copyright 2019 Parity Technologies (UK) Ltd.
// This file is part of Parity-Bridge.
// Parity-Bridge is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity-Bridge is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity-Bridge. If not, see <http://www.gnu.org/licenses/>.
use sp_runtime::RuntimeDebug;
/// Header import error.
#[derive(RuntimeDebug)]
#[cfg_attr(feature = "std", derive(PartialEq))]
pub enum Error {
/// The header is beyound last finalized and can not be imported.
AncientHeader,
/// The header is already imported.
KnownHeader,
/// Seal has an incorrect format.
InvalidSealArity,
/// Block number isn't sensible.
RidiculousNumber,
/// Block has too much gas used.
TooMuchGasUsed,
/// Gas limit header field is invalid.
InvalidGasLimit,
/// Extra data is of an invalid length.
ExtraDataOutOfBounds,
/// Timestamp header overflowed.
TimestampOverflow,
/// The parent header is missing from the blockchain.
MissingParentBlock,
/// The header step is missing from the header.
MissingStep,
/// The header signature is missing from the header.
MissingSignature,
/// Empty steps are missing from the header.
MissingEmptySteps,
/// The same author issued different votes at the same step.
DoubleVote,
/// Validation proof insufficient.
InsufficientProof,
/// Difficulty header field is invalid.
InvalidDifficulty,
/// The received block is from an incorrect proposer.
NotValidator,
/// Missing transaction receipts for the operation.
MissingTransactionsReceipts,
/// Provided transactions receipts are not matching the header.
TransactionsReceiptsMismatch,
}
impl Error {
pub fn msg(&self) -> &'static str {
match *self {
Error::AncientHeader => "Header is beyound last finalized and can not be imported",
Error::KnownHeader => "Header is already imported",
Error::InvalidSealArity => "Header has an incorrect seal",
Error::RidiculousNumber => "Header has too large number",
Error::TooMuchGasUsed => "Header has too much gas used",
Error::InvalidGasLimit => "Header has invalid gas limit",
Error::ExtraDataOutOfBounds => "Header has too large extra data",
Error::TimestampOverflow => "Header has too large timestamp",
Error::MissingParentBlock => "Header has unknown parent hash",
Error::MissingStep => "Header is missing step seal",
Error::MissingSignature => "Header is missing signature seal",
Error::MissingEmptySteps => "Header is missing empty steps seal",
Error::DoubleVote => "Header has invalid step in seal",
Error::InsufficientProof => "Header has insufficient proof",
Error::InvalidDifficulty => "Header has invalid difficulty",
Error::NotValidator => "Header is sealed by unexpected validator",
Error::MissingTransactionsReceipts => "The import operation requires transactions receipts",
Error::TransactionsReceiptsMismatch => "Invalid transactions receipts provided",
}
}
}