aboutsummaryrefslogtreecommitdiff
path: root/include/hotstuff/type.h
diff options
context:
space:
mode:
authorDeterminant <tederminant@gmail.com>2018-07-16 05:00:14 -0400
committerDeterminant <tederminant@gmail.com>2018-07-16 05:00:14 -0400
commita7cfb274d651e858ab06eff5b28a6f77e0178cf1 (patch)
tree7d76e5b5be935ef63a47dd1ed43b391f9a7e513c /include/hotstuff/type.h
parentaac40104573f8aabca86410cc08584acaaa74e26 (diff)
move header files to include/hotstuff
Diffstat (limited to 'include/hotstuff/type.h')
-rw-r--r--include/hotstuff/type.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/hotstuff/type.h b/include/hotstuff/type.h
new file mode 100644
index 0000000..4665979
--- /dev/null
+++ b/include/hotstuff/type.h
@@ -0,0 +1,46 @@
+#ifndef _HOTSTUFF_TYPE_H
+#define _HOTSTUFF_TYPE_H
+
+#include "salticidae/stream.h"
+#include "salticidae/type.h"
+#include "salticidae/util.h"
+
+namespace hotstuff {
+
+using salticidae::uint256_t;
+using salticidae::DataStream;
+using salticidae::htole;
+using salticidae::letoh;
+using salticidae::get_hex;
+using salticidae::from_hex;
+using salticidae::bytearray_t;
+
+inline std::string get_hex10(const uint256_t &x) {
+ return get_hex(x).substr(0, 10);
+}
+
+class HotStuffError: public salticidae::SalticidaeError {
+ public:
+ template<typename... Args>
+ HotStuffError(Args... args): salticidae::SalticidaeError(args...) {}
+};
+
+class HotStuffInvalidEntity: public HotStuffError {
+ public:
+ template<typename... Args>
+ HotStuffInvalidEntity(Args... args): HotStuffError(args...) {}
+};
+
+using salticidae::Serializable;
+
+class Cloneable {
+ public:
+ virtual ~Cloneable() = default;
+ virtual Cloneable *clone() = 0;
+};
+
+using ReplicaID = uint16_t;
+
+}
+
+#endif