Skip to content

Commit

Permalink
fork init: renamed crates to ddk
Browse files Browse the repository at this point in the history
  • Loading branch information
bennyhodl committed Nov 26, 2024
1 parent acbab60 commit 1409937
Show file tree
Hide file tree
Showing 116 changed files with 335 additions and 334 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on:
push:
branches:
- master
- 'testci/**'
- "testci/**"
pull_request:

name: Continuous integration
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
components: rustfmt
- name: Check format
run: cargo fmt --all --check
no-std:
Expand All @@ -38,11 +38,11 @@ jobs:
- name: install clippy
run: rustup component add clippy
- name: Run clippy dlc
run: cargo clippy --no-default-features --features no-std -p dlc -- -D warnings
run: cargo clippy --no-default-features --features no-std -p ddk-dlc -- -D warnings
- name: Run clippy dlc-messages
run: cargo clippy --no-default-features --features no-std -p dlc-messages -- -D warnings
run: cargo clippy --no-default-features --features no-std -p ddk-messages -- -D warnings
- name: Run clippy dlc-trie
run: cargo clippy --no-default-features --features no-std -p dlc-trie -- -D warnings
run: cargo clippy --no-default-features --features no-std -p ddk-trie -- -D warnings
unit-tests:
name: unit-tests
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ members = [
"bitcoin-test-utils",
"bitcoin-rpc-provider",
"p2pd-oracle-client",
"dlc",
"dlc-messages",
"dlc-trie",
"dlc-manager",
"ddk-dlc",
"ddk-messages",
"ddk-trie",
"ddk-manager",
"mocks",
"sample",
"simple-wallet",
Expand Down
2 changes: 1 addition & 1 deletion bitcoin-rpc-provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version = "0.1.0"
bitcoin = {version = "0.32.2"}
bitcoincore-rpc = {version = "0.19.0"}
bitcoincore-rpc-json = {version = "0.19.0"}
dlc-manager = {path = "../dlc-manager"}
ddk-manager = {path = "../ddk-manager"}
hex = { package = "hex-conservative", version = "0.1" }
lightning = { version = "0.0.125" }
log = "0.4.14"
Expand Down
4 changes: 2 additions & 2 deletions bitcoin-rpc-provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use bitcoincore_rpc::jsonrpc::serde_json;
use bitcoincore_rpc::jsonrpc::serde_json::Value;
use bitcoincore_rpc::{json, Auth, Client, RpcApi};
use bitcoincore_rpc_json::AddressType;
use dlc_manager::error::Error as ManagerError;
use dlc_manager::{Blockchain, ContractSignerProvider, SimpleSigner, Utxo, Wallet};
use ddk_manager::error::Error as ManagerError;
use ddk_manager::{Blockchain, ContractSignerProvider, SimpleSigner, Utxo, Wallet};
use hex::DisplayHex;
use json::EstimateMode;
use lightning::chain::chaininterface::{ConfirmationTarget, FeeEstimator};
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions dlc/Cargo.toml → ddk-dlc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
authors = ["Crypto Garage"]
authors = ["Crypto Garage", "benny b <[email protected]>"]
description = "Creation, signing and verification of Discreet Log Contracts (DLC) transactions."
homepage = "https://github.com/p2pderivatives/rust-dlc"
homepage = "https://github.com/bennyhodl/rust-dlc"
license-file = "../LICENSE"
name = "dlc"
repository = "https://github.com/p2pderivatives/rust-dlc/tree/master/dlc"
name = "ddk-dlc"
repository = "https://github.com/bennyhodl/rust-dlc/tree/master/dlc"
version = "0.7.0"

[dependencies]
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions dlc/benches/benchmarks.rs → ddk-dlc/benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

extern crate bitcoin;
extern crate bitcoin_test_utils;
extern crate dlc;
extern crate ddk_dlc;
extern crate rayon;
extern crate secp256k1_zkp;
#[cfg(all(test, feature = "unstable"))]
Expand All @@ -13,7 +13,7 @@ mod benches {

use bitcoin::{ScriptBuf, Transaction};
use bitcoin_test_utils::tx_from_string;
use dlc::*;
use ddk_dlc::*;
use rayon::prelude::*;
use secp256k1_zkp::{
global::SECP256K1, rand::thread_rng, rand::RngCore, Keypair, Message, PublicKey, SecretKey,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 12 additions & 12 deletions dlc-manager/Cargo.toml → ddk-manager/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
[package]
authors = ["Crypto Garage"]
authors = ["Crypto Garage", "benny b <[email protected]>"]
description = "Creation and handling of Discrete Log Contracts (DLC)."
edition = "2018"
homepage = "https://github.com/p2pderivatives/rust-dlc"
homepage = "https://github.com/bennyhodl/rust-dlc"
license-file = "../LICENSE"
name = "dlc-manager"
repository = "https://github.com/p2pderivatives/rust-dlc/tree/master/dlc-manager"
name = "ddk-manager"
repository = "https://github.com/bennyhodl/rust-dlc/tree/master/dlc-manager"
version = "0.7.0"

[features]
default = ["std"]
std = ["dlc/std", "dlc-messages/std", "dlc-trie/std", "bitcoin/std", "lightning/std"]
std = ["ddk-dlc/std", "ddk-messages/std", "ddk-trie/std", "bitcoin/std", "lightning/std"]
fuzztarget = ["rand_chacha"]
parallel = ["dlc-trie/parallel"]
use-serde = ["serde", "dlc/use-serde", "dlc-messages/use-serde", "dlc-trie/use-serde"]
parallel = ["ddk-trie/parallel"]
use-serde = ["serde", "ddk-dlc/use-serde", "ddk-messages/use-serde", "ddk-trie/use-serde"]

[dependencies]
async-trait = "0.1.50"
bitcoin = { version = "0.32.2", default-features = false }
dlc = { version = "0.7.0", default-features = false, path = "../dlc" }
dlc-messages = { version = "0.7.0", default-features = false, path = "../dlc-messages" }
dlc-trie = { version = "0.7.0", default-features = false, path = "../dlc-trie" }
ddk-dlc = { version = "0.7.0", default-features = false, path = "../ddk-dlc" }
ddk-messages = { version = "0.7.0", default-features = false, path = "../ddk-messages" }
ddk-trie = { version = "0.7.0", default-features = false, path = "../ddk-trie" }
hex = { package = "hex-conservative", version = "0.1" }
lightning = { version = "0.0.125", default-features = false, features = ["grind_signatures"] }
log = "0.4.14"
Expand All @@ -34,8 +34,8 @@ bitcoin-test-utils = {path = "../bitcoin-test-utils"}
bitcoincore-rpc = {version = "0.19"}
bitcoincore-rpc-json = {version = "0.19"}
criterion = "0.4.0"
dlc-manager = { path = ".", default-features = false, features = ["use-serde"] }
dlc-messages = { path = "../dlc-messages", default-features = false, features = ["serde"] }
ddk-manager = { path = ".", default-features = false, features = ["use-serde"] }
ddk-messages = { path = "../ddk-messages", default-features = false, features = ["serde"] }
electrs-blockchain-provider = {path = "../electrs-blockchain-provider"}
env_logger = "0.9.1"
mocks = {path = "../mocks"}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ use bitcoin::OutPoint;
use bitcoin::ScriptBuf;
use bitcoin::WPubkeyHash;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use dlc::create_dlc_transactions;
use dlc::DlcTransactions;
use dlc::PartyParams;
use dlc::Payout;
use dlc::TxInputInfo;
use dlc_manager::contract::contract_info::ContractInfo;
use dlc_manager::contract::numerical_descriptor::DifferenceParams;
use dlc_manager::contract::numerical_descriptor::NumericalDescriptor;
use dlc_manager::contract::ContractDescriptor;
use dlc_manager::payout_curve::PayoutFunction;
use dlc_manager::payout_curve::PayoutFunctionPiece;
use dlc_manager::payout_curve::PayoutPoint;
use dlc_manager::payout_curve::PolynomialPayoutCurvePiece;
use dlc_manager::payout_curve::RoundingInterval;
use dlc_manager::payout_curve::RoundingIntervals;
use dlc_messages::oracle_msgs::DigitDecompositionEventDescriptor;
use dlc_messages::oracle_msgs::EventDescriptor;
use dlc_messages::oracle_msgs::OracleAnnouncement;
use dlc_messages::oracle_msgs::OracleEvent;
use ddk_dlc::create_dlc_transactions;
use ddk_dlc::DlcTransactions;
use ddk_dlc::PartyParams;
use ddk_dlc::Payout;
use ddk_dlc::TxInputInfo;
use ddk_manager::contract::contract_info::ContractInfo;
use ddk_manager::contract::numerical_descriptor::DifferenceParams;
use ddk_manager::contract::numerical_descriptor::NumericalDescriptor;
use ddk_manager::contract::ContractDescriptor;
use ddk_manager::payout_curve::PayoutFunction;
use ddk_manager::payout_curve::PayoutFunctionPiece;
use ddk_manager::payout_curve::PayoutPoint;
use ddk_manager::payout_curve::PolynomialPayoutCurvePiece;
use ddk_manager::payout_curve::RoundingInterval;
use ddk_manager::payout_curve::RoundingIntervals;
use ddk_messages::oracle_msgs::DigitDecompositionEventDescriptor;
use ddk_messages::oracle_msgs::EventDescriptor;
use ddk_messages::oracle_msgs::OracleAnnouncement;
use ddk_messages::oracle_msgs::OracleEvent;
use secp256k1_zkp::{
global::SECP256K1, rand::thread_rng, schnorr::Signature, Keypair, SecretKey, XOnlyPublicKey,
};
Expand Down Expand Up @@ -120,7 +120,7 @@ fn create_contract_descriptor() -> ContractDescriptor {
rounding_mod: ROUNDING_MOD,
}],
},
oracle_numeric_infos: dlc_trie::OracleNumericInfo {
oracle_numeric_infos: ddk_trie::OracleNumericInfo {
base: BASE as usize,
nb_digits: std::iter::repeat(NB_DIGITS)
.take(NB_ORACLES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::collections::HashMap;

use bitcoin::{Block, OutPoint, Transaction, Txid};
use dlc_messages::ser_impls::{
use ddk_messages::ser_impls::{
read_ecdsa_adaptor_signature, read_hash_map, write_ecdsa_adaptor_signature, write_hash_map,
};
use lightning::ln::msgs::DecodeError;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! # Structure and methods for channels that have been accepted.
use bitcoin::{ScriptBuf, Transaction};
use dlc_messages::channel::AcceptChannel;
use ddk_messages::channel::AcceptChannel;
use secp256k1_zkp::{EcdsaAdaptorSignature, PublicKey};

use crate::{contract::accepted_contract::AcceptedContract, ChannelId, ContractId};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! # Module containing structures and methods for working with DLC channels.
use bitcoin::{hashes::Hash, Transaction, Txid};
use dlc_messages::channel::{AcceptChannel, SignChannel};
use ddk_messages::channel::{AcceptChannel, SignChannel};
use secp256k1_zkp::PublicKey;

use crate::{ChannelId, ContractId};
Expand Down Expand Up @@ -29,10 +29,10 @@ pub enum Channel {
/// A channel whose fund outputs have been signed by the offer party.
Signed(SignedChannel),
/// A channel that failed when validating an
/// [`dlc_messages::channel::AcceptChannel`] message.
/// [`ddk_messages::channel::AcceptChannel`] message.
FailedAccept(FailedAccept),
/// A channel that failed when validating an
/// [`dlc_messages::channel::SignChannel`] message.
/// [`ddk_messages::channel::SignChannel`] message.
FailedSign(FailedSign),
/// A [`OfferedChannel`] that got rejected by the counterparty.
Cancelled(OfferedChannel),
Expand Down Expand Up @@ -95,32 +95,32 @@ impl Channel {
}

/// A channel that failed when validating an
/// [`dlc_messages::channel::AcceptChannel`] message.
/// [`ddk_messages::channel::AcceptChannel`] message.
#[derive(Clone)]
pub struct FailedAccept {
/// The [`secp256k1_zkp::PublicKey`] of the counter party.
pub counter_party: PublicKey,
/// The temporary [`crate::ChannelId`] of the channel.
pub temporary_channel_id: ChannelId,
/// An message describing the error encountered while validating the
/// [`dlc_messages::channel::AcceptChannel`] message.
/// [`ddk_messages::channel::AcceptChannel`] message.
pub error_message: String,
/// The [`dlc_messages::channel::AcceptChannel`] that was received.
/// The [`ddk_messages::channel::AcceptChannel`] that was received.
pub accept_message: AcceptChannel,
}

/// A channel that failed when validating an
/// [`dlc_messages::channel::SignChannel`] message.
/// [`ddk_messages::channel::SignChannel`] message.
#[derive(Clone)]
pub struct FailedSign {
/// The [`secp256k1_zkp::PublicKey`] of the counter party.
pub counter_party: PublicKey,
/// The [`crate::ChannelId`] of the channel.
pub channel_id: ChannelId,
/// An message describing the error encountered while validating the
/// [`dlc_messages::channel::SignChannel`] message.
/// [`ddk_messages::channel::SignChannel`] message.
pub error_message: String,
/// The [`dlc_messages::channel::SignChannel`] that was received.
/// The [`ddk_messages::channel::SignChannel`] that was received.
pub sign_message: SignChannel,
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! # A channel is offered when an offer was made or received. This module contains
//! the model for it and method for working with it.
use dlc::PartyParams;
use dlc_messages::channel::OfferChannel;
// use dlc_messages::channel::OfferChannel;
use ddk_dlc::PartyParams;
use ddk_messages::channel::OfferChannel;
// use ddk_messages::channel::OfferChannel;
use secp256k1_zkp::PublicKey;

use crate::{
Expand All @@ -19,7 +19,7 @@ use super::party_points::PartyBasePoints;
derive(serde::Serialize, serde::Deserialize),
serde(rename_all = "camelCase")
)]
/// A DLC channel for which an [`dlc_messages::channel::OfferChannel`] message
/// A DLC channel for which an [`ddk_messages::channel::OfferChannel`] message
/// was sent or received.
pub struct OfferedChannel {
/// The temporary [`crate::ContractId`] of the contract that was offered for
Expand Down Expand Up @@ -73,7 +73,7 @@ impl OfferedChannel {
}

/// Creates an [`OfferedChannel`] and [`crate::contract::offered_contract::OfferedContract`]
/// from an [`dlc_messages::channel::OfferChannel`] message. Fails if the
/// from an [`ddk_messages::channel::OfferChannel`] message. Fails if the
/// transactions provided for funding cannot be decoded or the UTXO information
/// are invalid, or if the contract information is invalid.
pub fn from_offer_channel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use super::utils::{derive_public_key, derive_public_revocation_key};
use bitcoin::PublicKey as BitcoinPublicKey;
use dlc::channel::RevokeParams;
use ddk_dlc::channel::RevokeParams;
use secp256k1_zkp::{All, PublicKey, Secp256k1, Signing, Verification};

/// Base points used by a party of a DLC channel to derive public and private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::party_points::PartyBasePoints;
use super::signed_channel::{SignedChannel, SignedChannelState};
use super::{ClosedChannel, ClosedPunishedChannel, ClosingChannel, FailedAccept, FailedSign};

use dlc_messages::ser_impls::{
use ddk_messages::ser_impls::{
read_ecdsa_adaptor_signature, read_string, write_ecdsa_adaptor_signature, write_string,
};
use lightning::ln::msgs::DecodeError;
Expand Down Expand Up @@ -33,11 +33,11 @@ impl_dlc_writeable!(SignedChannel, {
(temporary_channel_id, writeable),
(fund_output_index, usize),
(own_points, writeable),
(own_params, { cb_writeable, dlc_messages::ser_impls::party_params::write, dlc_messages::ser_impls::party_params::read }),
(own_params, { cb_writeable, ddk_messages::ser_impls::party_params::write, ddk_messages::ser_impls::party_params::read }),
(own_per_update_point, writeable),
(counter_points, writeable),
(counter_per_update_point, writeable),
(counter_params, { cb_writeable, dlc_messages::ser_impls::party_params::write, dlc_messages::ser_impls::party_params::read }),
(counter_params, { cb_writeable, ddk_messages::ser_impls::party_params::write, ddk_messages::ser_impls::party_params::read }),
(state, writeable),
(update_idx, writeable),
(fund_tx, writeable),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! the possible states in which it can be as well as methods to work with it.
use bitcoin::{ScriptBuf, Transaction};
use dlc::PartyParams;
use ddk_dlc::PartyParams;
use lightning::ln::chan_utils::CounterpartyCommitmentSecrets;
use secp256k1_zkp::{ecdsa::Signature, EcdsaAdaptorSignature, PublicKey};

Expand Down
File renamed without changes.
Loading

0 comments on commit 1409937

Please sign in to comment.