Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
356 changes: 163 additions & 193 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ members = [
"pkgs/types",
"pkgs/types/marker",
]
resolver = "2"
resolver = "3"

[workspace.dependencies]
base58ck = { version = "0.4.0", default-features = false }
bitcoin_hashes = { version = "1.2.0", default-features = false }
bitcoin-consensus-encoding = { version = "1.2.0", default-features = false }
bitcoin-internals = { version = "0.6.0", default-features = false }
bitcoin-primitives = { version = "0.103.0", default-features = false }
bitcoin-units = { version = "0.5.0", default-features = false }
bitcoin_hashes = { version = "1.2.0", default-features = false }
hex-conservative = { version = "1.3", default-features = false }
rand_core = { version = "0.10.1", default-features = false }
subtle = { version = "2.6.1", default-features = false }
zeroize = { version = "1.9.0", default-features = false }

[workspace.lints.clippy]
expect_used = "deny"
Expand Down
16 changes: 16 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,19 @@ all-features = true

[advisories]
yanked = "deny"

[bans]
multiple-versions = "warn"

[licenses]
allow = [
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"BSL-1.0",
"CC0-1.0",
"ISC",
"MIT",
"Unicode-3.0",
"Unlicense",
]
9 changes: 9 additions & 0 deletions docs/num/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- [start:omit] -->

> [!NOTE]
> This is a spliced page meant for publication on Zensical. See [`pkgs/num`](../../pkgs/num/) for available
> documentation.

<!-- [end:omit] -->

<!-- [include:pkgs/num/README.md] -->
9 changes: 9 additions & 0 deletions docs/num/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- [start:omit] -->

> [!NOTE]
> This is a spliced page meant for publication on Zensical. See [`pkgs/num`](../../pkgs/num/) for available
> documentation.

<!-- [end:omit] -->

<!-- [include:pkgs/num/CHANGELOG.md] -->
52 changes: 26 additions & 26 deletions docs/samples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/samples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = ["parser", "solver"]
resolver = "2"
resolver = "3"

[workspace.dependencies]
bitcoin-consensus-encoding = { version = "1.2.0", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions docs/samples/parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ full = ["std"]
dash-primitives = { version = "0.0.0", path = "../../../pkgs/primitives", default-features = false, features = [
"serde",
] }
dash-types = { version = "0.0.0", path = "../../../pkgs/types", default-features = false }
hex-conservative = { version = "0.3", default-features = false, features = [
dash-types = { version = "0.1.0-beta", path = "../../../pkgs/types", default-features = false }
hex-conservative = { version = "1.3", default-features = false, features = [
"alloc",
] }
serde_json = { version = "1", default-features = false, features = ["alloc"] }
Expand Down
6 changes: 3 additions & 3 deletions docs/samples/parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extern crate alloc;

use dash_primitives::{Block, BlockHeader, Transaction};
use dash_types::codec::BaseCodec;
use hex_conservative::FromHex;
use hex_conservative::decode_to_vec;
use serde_json::Value;
use wasm_bindgen::prelude::*;

Expand Down Expand Up @@ -68,7 +68,7 @@ fn envelope(data: Value, warnings: Vec<String>) -> Result<String, String> {
/// decoded as a full block.
#[wasm_bindgen]
pub fn parse_block_hex(hex_str: &str) -> Result<String, String> {
let bytes = Vec::<u8>::from_hex(hex_str).map_err(|e| format!("invalid hex: {e}"))?;
let bytes = decode_to_vec(hex_str).map_err(|e| format!("invalid hex: {e}"))?;

if bytes.is_empty() {
return Err("no data provided".to_string());
Expand All @@ -90,7 +90,7 @@ pub fn parse_block_hex(hex_str: &str) -> Result<String, String> {
/// Parses a hex-encoded raw transaction and returns a JSON string.
#[wasm_bindgen]
pub fn parse_tx_hex(hex_str: &str) -> Result<String, String> {
let bytes = Vec::<u8>::from_hex(hex_str).map_err(|e| format!("invalid hex: {e}"))?;
let bytes = decode_to_vec(hex_str).map_err(|e| format!("invalid hex: {e}"))?;

if bytes.is_empty() {
return Err("no data provided".to_string());
Expand Down
6 changes: 3 additions & 3 deletions docs/samples/solver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ full = ["std"]
bitcoin-consensus-encoding = { workspace = true, features = ["alloc"] }
bitcoin-primitives = { workspace = true, features = ["alloc"] }
bitcoin-units = { workspace = true, features = ["alloc"] }
dash-num = { version = "0.0.0", path = "../../../pkgs/num", default-features = false }
dash-num = { version = "0.1.0-beta", path = "../../../pkgs/num", default-features = false }
dash-pow = { version = "0.0.0", path = "../../../pkgs/pow", default-features = false, features = [
"simd",
] }
dash-primitives = { version = "0.0.0", path = "../../../pkgs/primitives", default-features = false }
dash-script = { version = "0.0.0", path = "../../../pkgs/script", default-features = false }
dash-types = { version = "0.0.0", path = "../../../pkgs/types", default-features = false }
hex-conservative = { version = "0.3", default-features = false, features = [
dash-types = { version = "0.1.0-beta", path = "../../../pkgs/types", default-features = false }
hex-conservative = { version = "1.3", default-features = false, features = [
"alloc",
] }
serde = { version = "1", default-features = false, features = [
Expand Down
10 changes: 5 additions & 5 deletions docs/samples/solver/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use bitcoin_units::Amount;
use dash_num::{Arith256, CompactTarget, Hash256};
use dash_primitives::{BlockHash, BlockHeader, MerkleRoot, OutPoint, Transaction, TxHash, TxIn, TxOut, TxType};
use dash_types::{Hashable, Numeric};
use hex_conservative::FromHex;
use hex_conservative::decode_to_vec;
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;

Expand Down Expand Up @@ -63,8 +63,8 @@ fn build_coinbase(script_sig: Vec<u8>, script_pubkey: Vec<u8>, amount_duffs: &st
/// Compute the merkle root from coinbase parameters.
#[wasm_bindgen]
pub fn merkle_root(script_sig_hex: &str, script_pubkey_hex: &str, amount_duffs: &str) -> Result<String, String> {
let sig_bytes = Vec::<u8>::from_hex(script_sig_hex).map_err(|e| format!("invalid scriptSig hex: {e}"))?;
let pk_bytes = Vec::<u8>::from_hex(script_pubkey_hex).map_err(|e| format!("invalid scriptPubKey hex: {e}"))?;
let sig_bytes = decode_to_vec(script_sig_hex).map_err(|e| format!("invalid scriptSig hex: {e}"))?;
let pk_bytes = decode_to_vec(script_pubkey_hex).map_err(|e| format!("invalid scriptPubKey hex: {e}"))?;
let coinbase = build_coinbase(sig_bytes, pk_bytes, amount_duffs)?;
let root = MerkleRoot::from_lendian(*coinbase.hash().as_bytes());
Ok(format!("{root}"))
Expand All @@ -85,8 +85,8 @@ pub fn scanhash(
nonce_count: u32,
) -> Result<String, String> {
let prev_hash = BlockHash::from_hex(prev_hash_hex).map_err(|e| format!("invalid prev_hash hex: {e}"))?;
let sig_bytes = Vec::<u8>::from_hex(script_sig_hex).map_err(|e| format!("invalid scriptSig hex: {e}"))?;
let pk_bytes = Vec::<u8>::from_hex(script_pubkey_hex).map_err(|e| format!("invalid scriptPubKey hex: {e}"))?;
let sig_bytes = decode_to_vec(script_sig_hex).map_err(|e| format!("invalid scriptSig hex: {e}"))?;
let pk_bytes = decode_to_vec(script_pubkey_hex).map_err(|e| format!("invalid scriptPubKey hex: {e}"))?;

let coinbase = build_coinbase(sig_bytes, pk_bytes, amount_duffs)?;
let merkle_root = MerkleRoot::from_lendian(*coinbase.hash().as_bytes());
Expand Down
9 changes: 9 additions & 0 deletions docs/types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- [start:omit] -->

> [!NOTE]
> This is a spliced page meant for publication on Zensical. See [`pkgs/types`](../../pkgs/types/) for available
> documentation.

<!-- [end:omit] -->

<!-- [include:pkgs/types/README.md] -->
9 changes: 9 additions & 0 deletions docs/types/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- [start:omit] -->

> [!NOTE]
> This is a spliced page meant for publication on Zensical. See [`pkgs/types`](../../pkgs/types/) for available
> documentation.

<!-- [end:omit] -->

<!-- [include:pkgs/types/CHANGELOG.md] -->
11 changes: 11 additions & 0 deletions docs/zensical.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ nav = [
{ "Maintenance" = "dev/maintenance.md" },
{ "Style Guide (Rust)" = "dev/guide_rust.md" },
] },
{ "dash-types" = [
{ "Overview" = "types/README.md" },
{ "Changelog" = "types/changelog.md" },
] },
{ "dash-num" = [
{ "Overview" = "num/README.md" },
{ "Changelog" = "num/changelog.md" },
] },
{ "Samples" = [
{ "Genesis Solver" = "samples/solver/README.md" },
{ "Object Parser" = "samples/parser/README.md" },
Expand Down Expand Up @@ -76,6 +84,9 @@ permalink = true
[project.markdown_extensions.pymdownx.betterem]
[project.markdown_extensions.pymdownx.caret]
[project.markdown_extensions.pymdownx.details]
[project.markdown_extensions.pymdownx.emoji]
emoji_generator = "zensical.extensions.emoji.to_svg"
emoji_index = "zensical.extensions.emoji.twemoji"
[project.markdown_extensions.pymdownx.highlight]
anchor_linenums = true
line_spans = "__span"
Expand Down
2 changes: 1 addition & 1 deletion maint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use [`lint_all.py`](./lint_all.py).

| Name | Purpose | Verbs | Depends on |
| ---- | ------- | ---------- | ---------- |
| [`lint_cargo.py`](./lint/lint_cargo.py) | Enforce MSRV across Rust build dependency graph, deny dependencies per [`deny.toml`](../deny.toml), check/format TOML files against [`.taplo.toml`](../.taplo.toml) | `check` , `apply`, `apply-all` | `cargo` (MSRV enforcement), `cargo-deny` (deny dependencies), `taplo` (TOML formatting) |
| [`lint_cargo.py`](./lint/lint_cargo.py) | Deny dependencies per [`deny.toml`](../deny.toml), check/format TOML files against [`.taplo.toml`](../.taplo.toml) | `check` , `apply`, `apply-all` | `cargo-deny` (deny dependencies), `taplo` (TOML formatting) |
| [`lint_codeql.py`](./lint/lint_codeql.py) | Query Rust sources against [`maint/codeql/rust/*.ql`](./codeql/rust) | `check`, `apply`, `apply-all`, `run`, `run-all` | `codeql`, `rustc` |
| [`lint_javascript.py`](./lint/lint_javascript.py) | Lint Javascript sources against [`eslint.config.mjs`](js/eslint.config.mjs) | *None* | `npx` (part of Node.js), `eslint` (auto-retrieved by script) |
| [`lint_markdown.py`](./lint/lint_markdown.py) | Lint Markdown [documentation](../docs/dev/about_docs.md) | *None* | `pymarkdownlnt` |
Expand Down
Loading