From 66f7663cb224f10f3787addc222162e7f216f5b8 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Thu, 27 Oct 2022 06:33:58 -0400 Subject: [PATCH] Redo Tendermint folder structure --- Cargo.toml | 8 ++++---- .../{consensus => tendermint/client}/Cargo.toml | 2 +- .../{consensus => tendermint/client}/LICENSE | 0 .../client}/src/block_import.rs | 0 .../client}/src/import_queue.rs | 0 .../{consensus => tendermint/client}/src/lib.rs | 0 .../client}/src/select_chain.rs | 0 .../client}/src/tendermint.rs | 0 .../client}/src/validators.rs | 0 .../client}/src/verifier.rs | 0 substrate/tendermint/{ => machine}/Cargo.toml | 2 +- substrate/tendermint/{ => machine}/LICENSE | 0 substrate/tendermint/{ => machine}/README.md | 0 substrate/tendermint/{ => machine}/src/ext.rs | 0 substrate/tendermint/{ => machine}/src/lib.rs | 0 .../tendermint/{ => machine}/src/message_log.rs | 0 substrate/tendermint/{ => machine}/tests/ext.rs | 0 .../pallet}/Cargo.toml | 3 +-- substrate/tendermint/pallet/LICENSE | 15 +++++++++++++++ .../pallet}/src/lib.rs | 0 substrate/tendermint/primitives/Cargo.toml | 12 ++++++++++++ substrate/tendermint/primitives/LICENSE | 15 +++++++++++++++ substrate/tendermint/primitives/src/lib.rs | 7 +++++++ 23 files changed, 56 insertions(+), 8 deletions(-) rename substrate/{consensus => tendermint/client}/Cargo.toml (98%) rename substrate/{consensus => tendermint/client}/LICENSE (100%) rename substrate/{consensus => tendermint/client}/src/block_import.rs (100%) rename substrate/{consensus => tendermint/client}/src/import_queue.rs (100%) rename substrate/{consensus => tendermint/client}/src/lib.rs (100%) rename substrate/{consensus => tendermint/client}/src/select_chain.rs (100%) rename substrate/{consensus => tendermint/client}/src/tendermint.rs (100%) rename substrate/{consensus => tendermint/client}/src/validators.rs (100%) rename substrate/{consensus => tendermint/client}/src/verifier.rs (100%) rename substrate/tendermint/{ => machine}/Cargo.toml (95%) rename substrate/tendermint/{ => machine}/LICENSE (100%) rename substrate/tendermint/{ => machine}/README.md (100%) rename substrate/tendermint/{ => machine}/src/ext.rs (100%) rename substrate/tendermint/{ => machine}/src/lib.rs (100%) rename substrate/tendermint/{ => machine}/src/message_log.rs (100%) rename substrate/tendermint/{ => machine}/tests/ext.rs (100%) rename substrate/{pallet-tendermint => tendermint/pallet}/Cargo.toml (97%) create mode 100644 substrate/tendermint/pallet/LICENSE rename substrate/{pallet-tendermint => tendermint/pallet}/src/lib.rs (100%) create mode 100644 substrate/tendermint/primitives/Cargo.toml create mode 100644 substrate/tendermint/primitives/LICENSE create mode 100644 substrate/tendermint/primitives/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 0ceceae6..85057ee7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,12 +16,12 @@ members = [ "processor", - "substrate/tendermint", + "substrate/tendermint/machine", + "substrate/tendermint/primitives", + "substrate/tendermint/client", + "substrate/tendermint/pallet", - "substrate/pallet-tendermint", "substrate/runtime", - - "substrate/consensus", "substrate/node", "contracts/extension", diff --git a/substrate/consensus/Cargo.toml b/substrate/tendermint/client/Cargo.toml similarity index 98% rename from substrate/consensus/Cargo.toml rename to substrate/tendermint/client/Cargo.toml index 4102601b..76cf2863 100644 --- a/substrate/consensus/Cargo.toml +++ b/substrate/tendermint/client/Cargo.toml @@ -3,7 +3,7 @@ name = "serai-consensus" version = "0.1.0" description = "Serai consensus module" license = "AGPL-3.0-only" -repository = "https://github.com/serai-dex/serai/tree/develop/substrate/consensus" +repository = "https://github.com/serai-dex/serai/tree/develop/substrate/tendermint/client" authors = ["Luke Parker "] edition = "2021" publish = false diff --git a/substrate/consensus/LICENSE b/substrate/tendermint/client/LICENSE similarity index 100% rename from substrate/consensus/LICENSE rename to substrate/tendermint/client/LICENSE diff --git a/substrate/consensus/src/block_import.rs b/substrate/tendermint/client/src/block_import.rs similarity index 100% rename from substrate/consensus/src/block_import.rs rename to substrate/tendermint/client/src/block_import.rs diff --git a/substrate/consensus/src/import_queue.rs b/substrate/tendermint/client/src/import_queue.rs similarity index 100% rename from substrate/consensus/src/import_queue.rs rename to substrate/tendermint/client/src/import_queue.rs diff --git a/substrate/consensus/src/lib.rs b/substrate/tendermint/client/src/lib.rs similarity index 100% rename from substrate/consensus/src/lib.rs rename to substrate/tendermint/client/src/lib.rs diff --git a/substrate/consensus/src/select_chain.rs b/substrate/tendermint/client/src/select_chain.rs similarity index 100% rename from substrate/consensus/src/select_chain.rs rename to substrate/tendermint/client/src/select_chain.rs diff --git a/substrate/consensus/src/tendermint.rs b/substrate/tendermint/client/src/tendermint.rs similarity index 100% rename from substrate/consensus/src/tendermint.rs rename to substrate/tendermint/client/src/tendermint.rs diff --git a/substrate/consensus/src/validators.rs b/substrate/tendermint/client/src/validators.rs similarity index 100% rename from substrate/consensus/src/validators.rs rename to substrate/tendermint/client/src/validators.rs diff --git a/substrate/consensus/src/verifier.rs b/substrate/tendermint/client/src/verifier.rs similarity index 100% rename from substrate/consensus/src/verifier.rs rename to substrate/tendermint/client/src/verifier.rs diff --git a/substrate/tendermint/Cargo.toml b/substrate/tendermint/machine/Cargo.toml similarity index 95% rename from substrate/tendermint/Cargo.toml rename to substrate/tendermint/machine/Cargo.toml index b590e146..330c685a 100644 --- a/substrate/tendermint/Cargo.toml +++ b/substrate/tendermint/machine/Cargo.toml @@ -3,7 +3,7 @@ name = "tendermint-machine" version = "0.1.0" description = "An implementation of the Tendermint state machine in Rust" license = "MIT" -repository = "https://github.com/serai-dex/serai/tree/develop/substrate/tendermint" +repository = "https://github.com/serai-dex/serai/tree/develop/substrate/tendermint/machine" authors = ["Luke Parker "] edition = "2021" diff --git a/substrate/tendermint/LICENSE b/substrate/tendermint/machine/LICENSE similarity index 100% rename from substrate/tendermint/LICENSE rename to substrate/tendermint/machine/LICENSE diff --git a/substrate/tendermint/README.md b/substrate/tendermint/machine/README.md similarity index 100% rename from substrate/tendermint/README.md rename to substrate/tendermint/machine/README.md diff --git a/substrate/tendermint/src/ext.rs b/substrate/tendermint/machine/src/ext.rs similarity index 100% rename from substrate/tendermint/src/ext.rs rename to substrate/tendermint/machine/src/ext.rs diff --git a/substrate/tendermint/src/lib.rs b/substrate/tendermint/machine/src/lib.rs similarity index 100% rename from substrate/tendermint/src/lib.rs rename to substrate/tendermint/machine/src/lib.rs diff --git a/substrate/tendermint/src/message_log.rs b/substrate/tendermint/machine/src/message_log.rs similarity index 100% rename from substrate/tendermint/src/message_log.rs rename to substrate/tendermint/machine/src/message_log.rs diff --git a/substrate/tendermint/tests/ext.rs b/substrate/tendermint/machine/tests/ext.rs similarity index 100% rename from substrate/tendermint/tests/ext.rs rename to substrate/tendermint/machine/tests/ext.rs diff --git a/substrate/pallet-tendermint/Cargo.toml b/substrate/tendermint/pallet/Cargo.toml similarity index 97% rename from substrate/pallet-tendermint/Cargo.toml rename to substrate/tendermint/pallet/Cargo.toml index 6b3228c8..6b441230 100644 --- a/substrate/pallet-tendermint/Cargo.toml +++ b/substrate/tendermint/pallet/Cargo.toml @@ -3,7 +3,7 @@ name = "pallet-tendermint" version = "0.1.0" description = "Tendermint pallet for Substrate" license = "AGPL-3.0-only" -repository = "https://github.com/serai-dex/serai/tree/develop/substrate/pallet-tendermint" +repository = "https://github.com/serai-dex/serai/tree/develop/substrate/tendermint/pallet" authors = ["Luke Parker "] edition = "2021" @@ -12,7 +12,6 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [dependencies] - parity-scale-codec = { version = "3", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"] } diff --git a/substrate/tendermint/pallet/LICENSE b/substrate/tendermint/pallet/LICENSE new file mode 100644 index 00000000..d6e1814a --- /dev/null +++ b/substrate/tendermint/pallet/LICENSE @@ -0,0 +1,15 @@ +AGPL-3.0-only license + +Copyright (c) 2022 Luke Parker + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License Version 3 as +published by the Free Software Foundation. + +This program 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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . diff --git a/substrate/pallet-tendermint/src/lib.rs b/substrate/tendermint/pallet/src/lib.rs similarity index 100% rename from substrate/pallet-tendermint/src/lib.rs rename to substrate/tendermint/pallet/src/lib.rs diff --git a/substrate/tendermint/primitives/Cargo.toml b/substrate/tendermint/primitives/Cargo.toml new file mode 100644 index 00000000..a877df51 --- /dev/null +++ b/substrate/tendermint/primitives/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "sp-tendermint" +version = "0.1.0" +description = "Substrate primitives for Tendermint" +license = "AGPL-3.0-only" +repository = "https://github.com/serai-dex/serai/tree/develop/substrate/tendermint/primitives" +authors = ["Luke Parker "] +edition = "2021" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] diff --git a/substrate/tendermint/primitives/LICENSE b/substrate/tendermint/primitives/LICENSE new file mode 100644 index 00000000..d6e1814a --- /dev/null +++ b/substrate/tendermint/primitives/LICENSE @@ -0,0 +1,15 @@ +AGPL-3.0-only license + +Copyright (c) 2022 Luke Parker + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License Version 3 as +published by the Free Software Foundation. + +This program 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 Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . diff --git a/substrate/tendermint/primitives/src/lib.rs b/substrate/tendermint/primitives/src/lib.rs new file mode 100644 index 00000000..71e29beb --- /dev/null +++ b/substrate/tendermint/primitives/src/lib.rs @@ -0,0 +1,7 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use sp_core::sr25519::Public; + +trait TendermintApi { + fn validators() -> Vec; +}