1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
use crate::types::{Credit, Debit, Error as DtError, PublicKey, Token};
use crdts::Dot;
use thiserror::Error;
#[derive(Error, Debug, PartialEq, Clone)]
#[non_exhaustive]
pub enum Error {
#[error("Sender missing from actors")]
MissingSender,
#[error("Recipient missing from actors")]
MissingRecipient,
#[error("Sender and recipient are the same")]
SameSenderAndRecipient,
#[error("Current pending debit has not been completed")]
DebitPending,
#[error("PublicKey provided by the transfer was never a part of the section chain.")]
SectionKeyNeverExisted,
#[error("Debit already proposed or out of order")]
DebitProposed,
#[error("Credit and debit ids do not match")]
CreditDebitIdMismatch,
#[error("Credit and debit value do not match")]
CreditDebitValueMismatch,
#[error("Validation not intended for this actor")]
WrongValidationActor,
#[error("Could not find the expected transfer id among accumulating validations")]
PendingTransferNotFound,
#[error("Validation not expected at this actor {0:?}")]
NoSetForDebitId(Dot<PublicKey>),
#[error("Transfer not expected for this actor {0:?}")]
NoSetForTransferId(Dot<PublicKey>),
#[error(
"Operation out of order: debit's counter is '{0}', actor next expected op count is '{1}'"
)]
OperationOutOfOrder(u64, u64),
#[error("Operation out of order debit counter should be 0")]
ShouldBeInitialOperation,
#[error("There was no valid history found for provided actor.")]
NoActorHistory,
#[error("Transfer amount must be greater than zero")]
ZeroValueTransfer,
#[error("Validation already received")]
ValidatedAlready,
#[error("Debit is not from wallet {0}. Debit: {1:?}")]
DebitDoesNotBelong(PublicKey, Debit),
#[error("Credit is not to wallet {0}. Credit: {1:?}")]
CreditDoesNotBelong(PublicKey, Credit),
#[error("Overflow when subtracting {0} from balance of: {1}")]
SubtractionOverflow(Token, Token),
#[error("Overflow when adding balance {0} and credit of: {1}")]
AdditionOverflow(Token, Token),
#[error("Receive validation failed")]
ReceiveValidationFailed,
#[error("TransferCreationFailed")]
TransferCreationFailed,
#[error("SenderValidationFailed")]
SenderValidationFailed,
#[error("RegisterProofFailed")]
RegisterProofFailed,
#[error("InvalidCreditOrDebit")]
InvalidCreditOrDebit,
#[error("CouldNotGetWalletForReplica")]
CouldNotGetWalletForReplica,
#[error("CouldNotFindGroup")]
CouldNotFindGroup,
#[error("ReceivePropagationFailed")]
ReceivePropagationFailed,
#[error("SyncFailed")]
SyncFailed,
#[error("ValidationFailed")]
ValidationFailed,
#[error("GenesisFailed")]
GenesisFailed,
#[error("Unknown error: {0}")]
Unknown(String),
#[error("{0} Wallet not found locally.")]
WalletNotFound(PublicKey),
#[error("Could not aggregate with given signature shares")]
CannotAggregate,
#[error("Signature is not valid")]
InvalidSignature,
#[error("Operation is not valid")]
InvalidOperation,
#[error("Owner is not valid")]
InvalidOwner,
#[error("Insufficient balance to complete this operation")]
InsufficientBalance,
#[error("No such sender key balance")]
NoSuchSender,
#[error("No such recipient key balance")]
NoSuchRecipient,
#[error("Key already exists")]
KeyExists,
#[error(transparent)]
NetworkDataError(#[from] DtError),
#[error("Serialisation error. {0}")]
Serialisation(String),
}