diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5032676f..070c5b58 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,6 +42,7 @@ jobs: -p serai-processor-key-gen \ -p serai-processor-frost-attempt-manager \ -p serai-processor-primitives \ + -p serai-processor-transaction-chaining-scheduler \ -p serai-processor-scanner \ -p serai-processor \ -p tendermint-machine \ diff --git a/Cargo.toml b/Cargo.toml index 7ad08a51..27e5e562 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,6 +74,7 @@ members = [ "processor/frost-attempt-manager", "processor/primitives", + "processor/scheduler/transaction-chaining", "processor/scanner", "processor", diff --git a/deny.toml b/deny.toml index ea61fcc1..7531f3b7 100644 --- a/deny.toml +++ b/deny.toml @@ -48,6 +48,9 @@ exceptions = [ { allow = ["AGPL-3.0"], name = "serai-processor-messages" }, { allow = ["AGPL-3.0"], name = "serai-processor-key-gen" }, { allow = ["AGPL-3.0"], name = "serai-processor-frost-attempt-manager" }, + + { allow = ["AGPL-3.0"], name = "serai-processor-transaction-chaining-scheduler" }, + { allow = ["AGPL-3.0"], name = "serai-processor-scanner" }, { allow = ["AGPL-3.0"], name = "serai-processor" }, { allow = ["AGPL-3.0"], name = "tributary-chain" }, diff --git a/processor/scheduler/transaction-chaining/Cargo.toml b/processor/scheduler/transaction-chaining/Cargo.toml new file mode 100644 index 00000000..360da6c5 --- /dev/null +++ b/processor/scheduler/transaction-chaining/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "serai-processor-transaction-chaining-scheduler" +version = "0.1.0" +description = "Scheduler for networks with transaction chaining for the Serai processor" +license = "AGPL-3.0-only" +repository = "https://github.com/serai-dex/serai/tree/develop/processor/scheduler/transaction-chaining" +authors = ["Luke Parker "] +keywords = [] +edition = "2021" +publish = false + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[package.metadata.cargo-machete] +ignored = ["scale"] + +[lints] +workspace = true + +[dependencies] diff --git a/processor/scheduler/transaction-chaining/LICENSE b/processor/scheduler/transaction-chaining/LICENSE new file mode 100644 index 00000000..41d5a261 --- /dev/null +++ b/processor/scheduler/transaction-chaining/LICENSE @@ -0,0 +1,15 @@ +AGPL-3.0-only license + +Copyright (c) 2022-2024 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/processor/scheduler/transaction-chaining/README.md b/processor/scheduler/transaction-chaining/README.md new file mode 100644 index 00000000..0788ff53 --- /dev/null +++ b/processor/scheduler/transaction-chaining/README.md @@ -0,0 +1,19 @@ +# Transaction Chaining Scheduler + +A scheduler of transactions for networks premised on the UTXO model which +support transaction chaining. Transaction chaining refers to the ability to +obtain an identifier for an output within a transaction not yet signed usable +to build and sign a transaction spending it. + +### Design + +The scheduler is designed to achieve fulfillment of all expected payments with +an `O(1)` delay (regardless of prior scheduler state), `O(log n)` time, and +`O(n)` computational complexity. + +Due to the ability to chain transactions, we can immediately plan/sign dependent +transactions. For the time/computational complexity, we use a tree to fulfill +payments. This quickly gives us the ability to make as many outputs as necessary +(regardless of per-transaction output limits) and only has the latency of +including a chain of `O(log n)` transactions on-chain. The only computational +overhead is in creating the transactions which are branches in the tree. diff --git a/processor/scheduler/transaction-chaining/src/lib.rs b/processor/scheduler/transaction-chaining/src/lib.rs new file mode 100644 index 00000000..3639aa04 --- /dev/null +++ b/processor/scheduler/transaction-chaining/src/lib.rs @@ -0,0 +1,3 @@ +#![cfg_attr(docsrs, feature(doc_auto_cfg))] +#![doc = include_str!("../README.md")] +#![deny(missing_docs)]